section
stringlengths
2
30
filename
stringlengths
1
82
text
stringlengths
783
28M
versions
b79d2fcafd88_comment_text
"""Change comment text field from VARCHAR(255) to mysql.TEXT Revision ID: b79d2fcafd88 Revises: ffd23e570f92 Create Date: 2017-08-14 18:57:44.165168 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = "b79d2fcafd88" down_revision = "ffd23e570f92" branch_labels = None depends_on = None TABLE_PREFIXES = ("nyaa", "sukebei") def upgrade(): for prefix in TABLE_PREFIXES: op.alter_column( prefix + "_comments", "text", existing_type=mysql.VARCHAR( charset="utf8mb4", collation="utf8mb4_bin", length=255 ), type_=mysql.TEXT(collation="utf8mb4_bin"), existing_nullable=False, ) def downgrade(): for prefix in TABLE_PREFIXES: op.alter_column( prefix + "_comments", "text", existing_type=mysql.TEXT(collation="utf8mb4_bin"), type_=mysql.VARCHAR(charset="utf8mb4", collation="utf8mb4_bin", length=255), existing_nullable=False, )
extractor
franceinter
# coding: utf-8 from __future__ import unicode_literals from ..utils import month_by_name from .common import InfoExtractor class FranceInterIE(InfoExtractor): _VALID_URL = r"https?://(?:www\.)?franceinter\.fr/emissions/(?P<id>[^?#]+)" _TEST = { "url": "https://www.franceinter.fr/emissions/affaires-sensibles/affaires-sensibles-07-septembre-2016", "md5": "9e54d7bdb6fdc02a841007f8a975c094", "info_dict": { "id": "affaires-sensibles/affaires-sensibles-07-septembre-2016", "ext": "mp3", "title": "Affaire Cahuzac : le contentieux du compte en Suisse", "description": "md5:401969c5d318c061f86bda1fa359292b", "thumbnail": r"re:^https?://.*\.jpg", "upload_date": "20160907", }, } def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) video_url = self._search_regex( r'(?s)<div[^>]+class=["\']page-diffusion["\'][^>]*>.*?<button[^>]+data-url=(["\'])(?P<url>(?:(?!\1).)+)\1', webpage, "video url", group="url", ) title = self._og_search_title(webpage) description = self._og_search_description(webpage) thumbnail = self._html_search_meta(["og:image", "twitter:image"], webpage) upload_date_str = self._search_regex( r'class=["\']\s*cover-emission-period\s*["\'][^>]*>[^<]+\s+(\d{1,2}\s+[^\s]+\s+\d{4})<', webpage, "upload date", fatal=False, ) if upload_date_str: upload_date_list = upload_date_str.split() upload_date_list.reverse() upload_date_list[1] = "%02d" % ( month_by_name(upload_date_list[1], lang="fr") or 0 ) upload_date_list[2] = "%02d" % int(upload_date_list[2]) upload_date = "".join(upload_date_list) else: upload_date = None return { "id": video_id, "title": title, "description": description, "thumbnail": thumbnail, "upload_date": upload_date, "formats": [ { "url": video_url, "vcodec": "none", } ], }
preferences
editor
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/ # # Copyright (c) 2008 - 2014 by Wilbert Berendsen # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # See http://www.gnu.org/licenses/ for more information. """ Helper application preferences. """ import app import i18n.setup import icons import language_names import lasptyqu import preferences import qutil import util import widgets.urlrequester from PyQt5.QtCore import QSettings from PyQt5.QtWidgets import ( QCheckBox, QComboBox, QFileDialog, QGridLayout, QLabel, QLineEdit, QSpinBox, QVBoxLayout, QWidget, ) class Editor(preferences.ScrolledGroupsPage): def __init__(self, dialog): super().__init__(dialog) layout = QVBoxLayout() self.scrolledWidget.setLayout(layout) layout.addWidget(ViewSettings(self)) layout.addWidget(Highlighting(self)) layout.addWidget(Indenting(self)) layout.addWidget(KeyBoard(self)) layout.addWidget(SourceExport(self)) layout.addWidget(TypographicalQuotes(self)) layout.addStretch() class ViewSettings(preferences.Group): def __init__(self, page): super().__init__(page) layout = QGridLayout(spacing=1) self.setLayout(layout) self.wrapLines = QCheckBox(toggled=self.changed) self.numContextLines = QSpinBox( minimum=0, maximum=20, valueChanged=self.changed ) self.numContextLinesLabel = l = QLabel() l.setBuddy(self.numContextLines) layout.addWidget(self.wrapLines, 0, 0, 1, 1) layout.addWidget(self.numContextLinesLabel, 1, 0) layout.addWidget(self.numContextLines, 1, 1) app.translateUI(self) def translateUI(self): self.setTitle(_("View Preferences")) self.wrapLines.setText(_("Wrap long lines by default")) self.wrapLines.setToolTip( "<qt>" + _( "If enabled, lines that don't fit in the editor width are wrapped " "by default. " "Note: when the document is displayed by multiple views, they all " "share the same line wrapping width, which might look strange." ) ) self.numContextLinesLabel.setText(_("Number of surrounding lines:")) self.numContextLines.setToolTip( "<qt>" + _( "When jumping between search results or clicking on a link, the " "text view tries to scroll as few lines as possible. " "Here you can specify how many surrounding lines at least should " "be visible." ) ) self.numContextLinesLabel.setToolTip(self.numContextLines.toolTip()) def loadSettings(self): s = QSettings() s.beginGroup("view_preferences") self.wrapLines.setChecked(s.value("wrap_lines", False, bool)) self.numContextLines.setValue(s.value("context_lines", 3, int)) def saveSettings(self): s = QSettings() s.beginGroup("view_preferences") s.setValue("wrap_lines", self.wrapLines.isChecked()) s.setValue("context_lines", self.numContextLines.value()) class Highlighting(preferences.Group): def __init__(self, page): super().__init__(page) layout = QGridLayout(spacing=1) self.setLayout(layout) self.messageLabel = QLabel(wordWrap=True) layout.addWidget(self.messageLabel, 0, 0, 1, 2) self.labels = {} self.entries = {} for row, (name, title, default) in enumerate(self.items(), 1): self.labels[name] = l = QLabel() self.entries[name] = e = QSpinBox() e.setRange(0, 60) e.valueChanged.connect(page.changed) layout.addWidget(l, row, 0) layout.addWidget(e, row, 1) app.translateUI(self) def items(self): """ Yields (name, title, default) tuples for every setting in this group. Default is understood in seconds. """ yield "match", _("Matching Item:"), 1 def translateUI(self): self.setTitle(_("Highlighting Options")) self.messageLabel.setText( _( "Below you can define how long " '"matching" items like matching brackets or the items ' "linked through Point-and-Click are highlighted." ) ) # L10N: abbreviation for "n seconds" in spinbox, n >= 1, no plural forms prefix, suffix = _("{num} sec").split("{num}") for name, title, default in self.items(): self.entries[name].setSpecialValueText(_("Infinite")) self.entries[name].setPrefix(prefix) self.entries[name].setSuffix(suffix) self.labels[name].setText(title) def loadSettings(self): s = QSettings() s.beginGroup("editor_highlighting") for name, title, default in self.items(): self.entries[name].setValue(s.value(name, default, int)) def saveSettings(self): s = QSettings() s.beginGroup("editor_highlighting") for name, title, default in self.items(): s.setValue(name, self.entries[name].value()) class Indenting(preferences.Group): def __init__(self, page): super().__init__(page) layout = QGridLayout(spacing=1) self.setLayout(layout) self.tabwidthBox = QSpinBox(minimum=1, maximum=99) self.tabwidthLabel = l = QLabel() l.setBuddy(self.tabwidthBox) self.nspacesBox = QSpinBox(minimum=0, maximum=99) self.nspacesLabel = l = QLabel() l.setBuddy(self.nspacesBox) self.dspacesBox = QSpinBox(minimum=0, maximum=99) self.dspacesLabel = l = QLabel() l.setBuddy(self.dspacesBox) layout.addWidget(self.tabwidthLabel, 0, 0) layout.addWidget(self.tabwidthBox, 0, 1) layout.addWidget(self.nspacesLabel, 1, 0) layout.addWidget(self.nspacesBox, 1, 1) layout.addWidget(self.dspacesLabel, 2, 0) layout.addWidget(self.dspacesBox, 2, 1) self.tabwidthBox.valueChanged.connect(page.changed) self.nspacesBox.valueChanged.connect(page.changed) self.dspacesBox.valueChanged.connect(page.changed) self.translateUI() def translateUI(self): self.setTitle(_("Indenting Preferences")) self.tabwidthLabel.setText(_("Visible Tab Width:")) self.tabwidthBox.setToolTip( _("The visible width of a Tab character in the editor.") ) self.nspacesLabel.setText(_("Indent text with:")) self.nspacesBox.setToolTip( _( "How many spaces to use for indenting one level.\n" "Move to zero to use a Tab character for indenting." ) ) self.nspacesBox.setSpecialValueText(_("Tab")) self.dspacesLabel.setText(_("Tab outside indent inserts:")) self.dspacesBox.setToolTip( _( "How many spaces to insert when Tab is pressed outside the indent, " "elsewhere in the document.\n" "Move to zero to insert a literal Tab character in this case." ) ) self.nspacesBox.setSpecialValueText(_("Tab")) self.dspacesBox.setSpecialValueText(_("Tab")) # L10N: abbreviation for "n spaces" in spinbox, n >= 1, no plural forms prefix, suffix = _("{num} spaces").split("{num}") self.nspacesBox.setPrefix(prefix) self.nspacesBox.setSuffix(suffix) self.dspacesBox.setPrefix(prefix) self.dspacesBox.setSuffix(suffix) def loadSettings(self): s = QSettings() s.beginGroup("indent") self.tabwidthBox.setValue(s.value("tab_width", 8, int)) self.nspacesBox.setValue(s.value("indent_spaces", 2, int)) self.dspacesBox.setValue(s.value("document_spaces", 8, int)) def saveSettings(self): s = QSettings() s.beginGroup("indent") s.setValue("tab_width", self.tabwidthBox.value()) s.setValue("indent_spaces", self.nspacesBox.value()) s.setValue("document_spaces", self.dspacesBox.value()) class KeyBoard(preferences.Group): def __init__(self, page): super().__init__(page) layout = QGridLayout(spacing=1) self.setLayout(layout) self.keepCursorInLine = QCheckBox(toggled=self.changed) self.smartHome = QCheckBox(toggled=self.changed) self.smartStartEnd = QCheckBox(toggled=self.changed) layout.addWidget(self.smartHome, 0, 0, 1, 1) layout.addWidget(self.smartStartEnd, 1, 0, 1, 1) layout.addWidget(self.keepCursorInLine, 2, 0, 1, 1) app.translateUI(self) def translateUI(self): self.setTitle(_("Keyboard Preferences")) self.smartHome.setText(_("Smart Home key")) self.smartHome.setToolTip( "<qt>" + _( "If enabled, pressing Home will put the cursor at the first non-" "whitespace character on the line. " "When the cursor is on that spot, pressing Home moves the cursor " "to the beginning of the line." ) ) self.smartStartEnd.setText(_("Smart Up/PageUp and Down/PageDown keys")) self.smartStartEnd.setToolTip( "<qt>" + _( "If enabled, pressing Up or PageUp in the first line will move the " "cursor to the beginning of the document, and pressing Down or " "PageDown in the last line will move the cursor to the end of the " "document." ) ) self.keepCursorInLine.setText( _("Horizontal arrow keys keep cursor in current line") ) self.keepCursorInLine.setToolTip( "<qt>" + _( "If enabled, the cursor will stay in the current line when using " "the horizontal arrow keys, and not wrap around to the next or previous line." ) ) def loadSettings(self): s = QSettings() s.beginGroup("view_preferences") self.smartHome.setChecked(s.value("smart_home_key", True, bool)) self.smartStartEnd.setChecked(s.value("smart_start_end", True, bool)) self.keepCursorInLine.setChecked(s.value("keep_cursor_in_line", False, bool)) def saveSettings(self): s = QSettings() s.beginGroup("view_preferences") s.setValue("smart_home_key", self.smartHome.isChecked()) s.setValue("smart_start_end", self.smartStartEnd.isChecked()) s.setValue("keep_cursor_in_line", self.keepCursorInLine.isChecked()) class SourceExport(preferences.Group): def __init__(self, page): super().__init__(page) layout = QGridLayout(spacing=1) self.setLayout(layout) self.numberLines = QCheckBox(toggled=self.changed) self.inlineStyleCopy = QCheckBox(toggled=self.changed) self.copyHtmlAsPlainText = QCheckBox(toggled=self.changed) self.inlineStyleExport = QCheckBox(toggled=self.changed) self.copyDocumentBodyOnly = QCheckBox(toggled=self.changed) self.wrapperTag = QLabel() self.wrapTagSelector = QComboBox() self.wrapTagSelector.currentIndexChanged.connect(page.changed) self.wrapperAttribute = QLabel() self.wrapAttribSelector = QComboBox() self.wrapAttribSelector.currentIndexChanged.connect(page.changed) self.wrapAttribNameLabel = QLabel() self.wrapAttribName = QLineEdit() self.wrapAttribName.textEdited.connect(page.changed) self.wrapperTag.setBuddy(self.wrapTagSelector) self.wrapperAttribute.setBuddy(self.wrapAttribSelector) self.wrapAttribNameLabel.setBuddy(self.wrapAttribName) layout.addWidget(self.copyHtmlAsPlainText, 0, 0, 1, 2) layout.addWidget(self.copyDocumentBodyOnly, 1, 0, 1, 2) layout.addWidget(self.inlineStyleCopy, 2, 0, 1, 2) layout.addWidget(self.inlineStyleExport, 3, 0, 1, 2) layout.addWidget(self.numberLines, 4, 0, 1, 2) layout.addWidget(self.wrapperTag, 5, 0) layout.addWidget(self.wrapTagSelector, 5, 1) layout.addWidget(self.wrapperAttribute, 6, 0) layout.addWidget(self.wrapAttribSelector, 6, 1) layout.addWidget(self.wrapAttribNameLabel, 7, 0) layout.addWidget(self.wrapAttribName, 7, 1) self.wrapTagSelector.addItem("pre") self.wrapTagSelector.addItem("code") self.wrapTagSelector.addItem("div") self.wrapAttribSelector.addItem("id") self.wrapAttribSelector.addItem("class") app.translateUI(self) def translateUI(self): self.setTitle(_("Source Export Preferences")) self.numberLines.setText(_("Show line numbers")) self.numberLines.setToolTip( "<qt>" + _( "If enabled, line numbers are shown in exported HTML or printed " "source." ) ) self.inlineStyleCopy.setText(_("Use inline style when copying colored HTML")) self.inlineStyleCopy.setToolTip( "<qt>" + _( "If enabled, inline style attributes are used when copying " "colored HTML to the clipboard. " "Otherwise, a CSS stylesheet is embedded." ) ) self.inlineStyleExport.setText( _("Use inline style when exporting colored HTML") ) self.inlineStyleExport.setToolTip( "<qt>" + _( "If enabled, inline style attributes are used when exporting " "colored HTML to a file. " "Otherwise, a CSS stylesheet is embedded." ) ) self.copyHtmlAsPlainText.setText(_("Copy HTML as plain text")) self.copyHtmlAsPlainText.setToolTip( "<qt>" + _( "If enabled, HTML is copied to the clipboard as plain text. " "Use this when you want to type HTML formatted code in a " "plain text editing environment." ) ) self.copyDocumentBodyOnly.setText(_("Copy document body only")) self.copyDocumentBodyOnly.setToolTip( "<qt>" + _( "If enabled, only the HTML contents, wrapped in a single tag, will be " "copied to the clipboard instead of a full HTML document with a " "header section. " "May be used in conjunction with the plain text option, with the " "inline style option turned off, to copy highlighted code in a " "text editor when an external style sheet is already available." ) ) self.wrapperTag.setText(_("Tag to wrap around source:" + " ")) self.wrapperTag.setToolTip( "<qt>" + _("Choose what tag the colored HTML will be wrapped into.") ) self.wrapperAttribute.setText(_("Attribute type of wrapper:" + " ")) self.wrapperAttribute.setToolTip( "<qt>" + _("Choose whether the wrapper tag should be of type 'id' or 'class'") ) self.wrapAttribNameLabel.setText(_("Name of attribute:" + " ")) self.wrapAttribNameLabel.setToolTip( "<qt>" + _( "Arbitrary name for the type attribute. " + "This must match the CSS stylesheet if using external CSS." ) ) def loadSettings(self): s = QSettings() s.beginGroup("source_export") self.numberLines.setChecked(s.value("number_lines", False, bool)) self.inlineStyleCopy.setChecked(s.value("inline_copy", True, bool)) self.inlineStyleExport.setChecked(s.value("inline_export", False, bool)) self.copyHtmlAsPlainText.setChecked( s.value("copy_html_as_plain_text", False, bool) ) self.copyDocumentBodyOnly.setChecked( s.value("copy_document_body_only", False, bool) ) self.wrapTagSelector.setCurrentIndex( self.wrapTagSelector.findText(s.value("wrap_tag", "pre", str)) ) self.wrapAttribSelector.setCurrentIndex( self.wrapAttribSelector.findText(s.value("wrap_attrib", "id", str)) ) self.wrapAttribName.setText(s.value("wrap_attrib_name", "document", str)) def saveSettings(self): s = QSettings() s.beginGroup("source_export") s.setValue("number_lines", self.numberLines.isChecked()) s.setValue("inline_copy", self.inlineStyleCopy.isChecked()) s.setValue("inline_export", self.inlineStyleExport.isChecked()) s.setValue("copy_html_as_plain_text", self.copyHtmlAsPlainText.isChecked()) s.setValue("copy_document_body_only", self.copyDocumentBodyOnly.isChecked()) s.setValue("wrap_tag", self.wrapTagSelector.currentText()) s.setValue("wrap_attrib", self.wrapAttribSelector.currentText()) s.setValue("wrap_attrib_name", self.wrapAttribName.text()) class TypographicalQuotes(preferences.Group): def __init__(self, page): super().__init__(page) layout = QGridLayout(spacing=1) self.setLayout(layout) l = self.languageLabel = QLabel() c = self.languageCombo = QComboBox(currentIndexChanged=self.languageChanged) l.setBuddy(c) self.primaryLabel = QLabel() self.secondaryLabel = QLabel() self.primaryLeft = QLineEdit(textEdited=self.changed) self.primaryRight = QLineEdit(textEdited=self.changed) self.secondaryLeft = QLineEdit(textEdited=self.changed) self.secondaryRight = QLineEdit(textEdited=self.changed) self._langs = ["current", "custom"] self._langs.extend(lang for lang in lasptyqu.available() if lang != "C") c.addItems(["" for i in self._langs]) layout.addWidget(self.languageLabel, 0, 0) layout.addWidget(self.primaryLabel, 1, 0) layout.addWidget(self.secondaryLabel, 2, 0) layout.addWidget(self.languageCombo, 0, 1, 1, 2) layout.addWidget(self.primaryLeft, 1, 1) layout.addWidget(self.primaryRight, 1, 2) layout.addWidget(self.secondaryLeft, 2, 1) layout.addWidget(self.secondaryRight, 2, 2) app.translateUI(self) def languageChanged(self): """Called when the user changes the combobox.""" enabled = self.languageCombo.currentIndex() == 1 self.primaryLabel.setEnabled(enabled) self.primaryLeft.setEnabled(enabled) self.primaryRight.setEnabled(enabled) self.secondaryLabel.setEnabled(enabled) self.secondaryLeft.setEnabled(enabled) self.secondaryRight.setEnabled(enabled) self.changed.emit() def translateUI(self): self.setTitle(_("Typographical Quotes")) self.languageLabel.setText(_("Quotes to use:")) self.primaryLabel.setText(_("Primary (double) quotes:")) self.secondaryLabel.setText(_("Secondary (single) quotes:")) curlang = i18n.setup.current() qformat = "{0} {1.primary.left} {1.primary.right} {1.secondary.left} {1.secondary.right}" self.languageCombo.setItemText( 0, qformat.format( _("Current language"), lasptyqu.quotes(curlang) or lasptyqu.default() ), ) self.languageCombo.setItemText(1, _("Custom quotes (enter below)")) for i, lang in enumerate(self._langs[2:], 2): self.languageCombo.setItemText( i, qformat.format( language_names.languageName(lang, curlang), lasptyqu.quotes(lang) ), ) def loadSettings(self): s = QSettings() s.beginGroup("typographical_quotes") lang = s.value("language", "current", str) try: index = self._langs.index(lang) except ValueError: index = 0 self.languageCombo.setCurrentIndex(index) default = lasptyqu.default() self.primaryLeft.setText(s.value("primary_left", default.primary.left, str)) self.primaryRight.setText(s.value("primary_right", default.primary.right, str)) self.secondaryLeft.setText( s.value("secondary_left", default.secondary.left, str) ) self.secondaryRight.setText( s.value("secondary_right", default.secondary.right, str) ) def saveSettings(self): s = QSettings() s.beginGroup("typographical_quotes") s.setValue("language", self._langs[self.languageCombo.currentIndex()]) s.setValue("primary_left", self.primaryLeft.text()) s.setValue("primary_right", self.primaryRight.text()) s.setValue("secondary_left", self.secondaryLeft.text()) s.setValue("secondary_right", self.secondaryRight.text())
cactus
template_tags
# coding:utf-8 import logging import os from django.conf import settings from django.template.base import Library from django.utils.encoding import force_text from django.utils.safestring import mark_safe logger = logging.getLogger(__name__) register = Library() def static(context, link_url): """ Get the path for a static file in the Cactus build. We'll need this because paths can be rewritten with fingerprinting. """ # TODO: Support URLS that don't start with `/static/` site = context["__CACTUS_SITE__"] page = context["__CACTUS_CURRENT_PAGE__"] url = site.get_url_for_static(link_url) if url is None: # For the static method we check if we need to add a prefix helper_keys = [ "/static/" + link_url, "/static" + link_url, "static/" + link_url, ] for helper_key in helper_keys: url_helper_key = site.get_url_for_static(helper_key) if url_helper_key is not None: return url_helper_key logger.warning( "%s: static resource does not exist: %s", page.link_url, link_url ) url = link_url return url def url(context, link_url): """ Get the path for a page in the Cactus build. We'll need this because paths can be rewritten with prettifying. """ site = context["__CACTUS_SITE__"] page = context["__CACTUS_CURRENT_PAGE__"] url = site.get_url_for_page(link_url) if url is None: # See if we're trying to link to an /subdir/index.html with /subdir link_url_index = os.path.join(link_url, "index.html") url_link_url_index = site.get_url_for_page(link_url_index) if url_link_url_index is None: logger.warning( "%s: page resource does not exist: %s", page.link_url, link_url ) url = link_url locale = site.config.get("locale") if locale is not None and site.verb == site.VERB_BUILD: # prepend links with language directory url = "/%s%s" % (site.config.get("locale"), url) if site.prettify_urls: return url.rsplit("index.html", 1)[0] return url def config(context, key): """ Get a value from the config by key """ site = context["__CACTUS_SITE__"] result = site.config.get(key) if result: return result return "" def current_page(context): """ Returns the current URL """ page = context["__CACTUS_CURRENT_PAGE__"] return page.final_url def if_current_page(context, link_url, positive=True, negative=False): """ Return one of the passed parameters if the URL passed is the current one. For consistency reasons, we use the link_url of the page. """ page = context["__CACTUS_CURRENT_PAGE__"] return positive if page.link_url == link_url else negative @register.filter(is_safe=True) def markdown(value, arg=""): """ Runs Markdown over a given value, optionally using various extensions python-markdown supports. Syntax:: {{ value|markdown2:"extension1_name,extension2_name..." }} To enable safe mode, which strips raw HTML and only returns HTML generated by actual Markdown syntax, pass "safe" as the first extension in the list. If the version of Markdown in use does not support extensions, they will be silently ignored. """ try: import markdown2 except ImportError: logging.warning("Markdown package not installed.") return force_text(value) else: def parse_extra(extra): if ":" not in extra: return (extra, {}) name, values = extra.split(":", 1) values = dict((str(val.strip()), True) for val in values.split("|")) return (name.strip(), values) extras = (e.strip() for e in arg.split(",")) extras = dict(parse_extra(e) for e in extras if e) if "safe" in extras: del extras["safe"] safe_mode = True else: safe_mode = False return mark_safe( markdown2.markdown(force_text(value), extras=extras, safe_mode=safe_mode) ) register.simple_tag(takes_context=True)(static) register.simple_tag(takes_context=True)(url) register.simple_tag(takes_context=True)(config) register.simple_tag(takes_context=True)(current_page) register.simple_tag(takes_context=True)(if_current_page)
gdist
gettextutil
# Copyright 2015-2017 Christoph Reiter # 2019-21 Nick Boultbee # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import contextlib import fnmatch import functools import os import shutil import subprocess import tempfile import warnings from pathlib import Path from typing import Dict, Iterable, List, Optional, Tuple QL_SRC_DIR = "quodlibet" XGETTEXT_CONFIG: Dict[str, Tuple[str, List[str]]] = { "*.py": ( "Python", [ "", "_", "N_", "C_:1c,2", "NC_:1c,2", "Q_", "pgettext:1c,2", "npgettext:1c,2,3", "numeric_phrase:1,2", "dgettext:2", "ngettext:1,2", "dngettext:2,3", ], ), "*.appdata.xml": ("", []), "*.desktop": ("Desktop", ["", "Name", "GenericName", "Comment", "Keywords"]), } """Dict of pattern -> (language, [keywords])""" class GettextError(Exception): pass class GettextWarning(Warning): pass def _read_potfiles(src_root: Path, potfiles: Path) -> List[Path]: """Returns a list of paths for a POTFILES.in file""" paths = [] with open(potfiles, "r", encoding="utf-8") as h: for line in h: line = line.strip() if not line or line.startswith("#"): continue paths.append((src_root / line).resolve()) return paths def _write_potfiles(src_root: Path, potfiles: Path, paths: Iterable[Path]): assert src_root.is_absolute() with open(potfiles, "w", encoding="utf-8") as h: for path in paths: assert path.is_absolute() path = path.relative_to(src_root) h.write(str(path) + "\n") def _src_root(po_dir: Path) -> Path: assert isinstance(po_dir, Path) return po_dir.parent.resolve() def get_pot_dependencies(po_dir: Path) -> List[Path]: """Returns a list of paths that are used as input for the .pot file""" src_root = _src_root(po_dir) potfiles_path = po_dir / "POTFILES.in" return _read_potfiles(src_root, potfiles_path) def _get_pattern(path: Path) -> Optional[str]: for pattern in XGETTEXT_CONFIG: match_part = path.name if match_part.endswith(".in"): match_part = match_part.rsplit(".", 1)[0] if fnmatch.fnmatch(match_part, pattern): return pattern return None def _create_pot(potfiles_path: Path, src_root: Path) -> Path: """Create a POT file for the specified POs and source code :returns: the output path """ potfiles = _read_potfiles(src_root, potfiles_path) groups = {} for path in potfiles: pattern = _get_pattern(path) if pattern is not None: groups.setdefault(pattern, []).append(path) else: raise ValueError(f"Unknown filetype: {path!s}") specs = [] for pattern, paths in groups.items(): language, keywords = XGETTEXT_CONFIG[pattern] specs.append((language, keywords, paths)) # no language last, otherwise we get charset errors specs.sort(reverse=True) fd, out_path = tempfile.mkstemp(".pot") out_path = Path(out_path) try: os.close(fd) for language, keywords, paths in specs: args = [] if language: args.append("--language=" + language) for kw in keywords: if kw: args.append("--keyword=" + kw) else: args.append("-k") fd, potfiles_in = tempfile.mkstemp() potfiles_in = Path(potfiles_in) try: os.close(fd) _write_potfiles(src_root, potfiles_in, paths) args = [ "xgettext", "--from-code=utf-8", "--add-comments", "--files-from=" + str(potfiles_in), "--directory=" + str(src_root), "--output=" + str(out_path), "--force-po", "--join-existing", ] + args p = subprocess.Popen( args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, ) stdout, stderr = p.communicate() if p.returncode != 0: path_strs = ", ".join(str(p) for p in paths) msg = f"Error running `{' '.join(args)}`:\nPaths: {path_strs}...\n" msg += stderr or ("Got error: %d" % p.returncode) raise GettextError(msg) if stderr: warnings.warn(stderr, GettextWarning) finally: potfiles_in.unlink() except Exception: out_path.unlink() raise return out_path @contextlib.contextmanager def create_pot(po_path: Path): """Temporarily creates a .pot file in a temp directory.""" src_root = _src_root(po_path) potfiles_path = po_path / "POTFILES.in" pot_path = _create_pot(potfiles_path, src_root) try: yield pot_path finally: os.unlink(pot_path) def update_linguas(po_path: Path) -> None: """Create a LINGUAS file in po_dir""" linguas = po_path / "LINGUAS" with open(linguas, "w", encoding="utf-8") as h: for l in list_languages(po_path): h.write(l + "\n") def list_languages(po_path: Path) -> List[str]: """Returns a list of available language codes""" po_files = po_path.glob("*.po") return sorted([os.path.basename(str(po)[:-3]) for po in po_files]) def compile_po(po_path: Path, target_file: Path): """Creates an .mo from a .po""" try: subprocess.check_output( ["msgfmt", "-o", str(target_file), str(po_path)], universal_newlines=True, stderr=subprocess.STDOUT, ) except subprocess.CalledProcessError as e: raise GettextError(e.output) def po_stats(po_path: Path): """Returns a string containing translation statistics""" try: return subprocess.check_output( ["msgfmt", "--statistics", str(po_path), "-o", os.devnull], universal_newlines=True, stderr=subprocess.STDOUT, ).strip() except subprocess.CalledProcessError as e: raise GettextError(e.output) def merge_file(po_dir, file_type, source_file, target_file): """Using a template input create a new file including translations""" if file_type not in ("xml", "desktop"): raise ValueError style = "--" + file_type linguas = os.path.join(po_dir, "LINGUAS") if not os.path.exists(linguas): raise GettextError("{!r} doesn't exist".format(linguas)) try: subprocess.check_output( [ "msgfmt", style, "--template", source_file, "-d", po_dir, "-o", target_file, ], universal_newlines=True, stderr=subprocess.STDOUT, ) except subprocess.CalledProcessError as e: raise GettextError(e.output) def get_po_path(po_path: Path, lang_code: str) -> Path: """The default path to the .po file for a given language code""" return po_path / (lang_code + ".po") def update_po(pot_path: Path, po_path: Path, out_path: Optional[Path] = None) -> None: """Update .po at po_path based on .pot at po_path. If out_path is given will not touch po_path and write to out_path instead. Raises GettextError on error. """ if out_path is None: out_path = po_path try: subprocess.check_output( ["msgmerge", "-o", str(out_path), str(po_path), str(pot_path)], universal_newlines=True, stderr=subprocess.STDOUT, ) except subprocess.CalledProcessError as e: raise GettextError(e.output) def check_po(po_path: Path, ignore_header=False): """Makes sure the .po is well formed Raises GettextError if not """ check_arg = "--check" if not ignore_header else "--check-format" try: subprocess.check_output( ["msgfmt", check_arg, "--check-domain", str(po_path), "-o", os.devnull], stderr=subprocess.STDOUT, universal_newlines=True, ) except subprocess.CalledProcessError as e: raise GettextError(e.output) def check_pot(pot_path: Path) -> None: """Makes sure that the .pot is well formed Raises GettextError if not """ # msgfmt doesn't like .pot files, but we can create a dummy .po # and test that instead. fd, po_path = tempfile.mkstemp(".po") po_path = Path(po_path) os.close(fd) po_path.unlink() create_po(pot_path, po_path) try: check_po(po_path, ignore_header=True) finally: os.remove(po_path) def create_po(pot_path: Path, po_path: Path) -> None: """Create a new <po_path> file based on <pot_path> :raises GettextError: in case something went wrong or the file already exists. """ if po_path.exists(): raise GettextError(f"{po_path!s} already exists") if not pot_path.exists(): raise GettextError(f"{pot_path!s} missing") try: subprocess.check_output( ["msginit", "--no-translator", "-i", str(pot_path), "-o", str(po_path)], universal_newlines=True, stderr=subprocess.STDOUT, ) except subprocess.CalledProcessError as e: raise GettextError(e.output) if not po_path.exists(): raise GettextError(f"something went wrong; {po_path!s} didn't get created") update_po(pot_path, po_path) def get_missing(po_dir: Path) -> Iterable[str]: """Gets missing strings :returns: a list of file information for translatable strings found in files not listed in POTFILES.in and not skipped in POTFILES.skip. """ src_root = _src_root(po_dir) potfiles_path = po_dir / "POTFILES.in" skip_path = po_dir / "POTFILES.skip" # Generate a set of paths of files which are not marked translatable # and not skipped pot_files = { p.relative_to(src_root) for p in _read_potfiles(src_root, potfiles_path) } skip_files = {p.relative_to(src_root) for p in _read_potfiles(src_root, skip_path)} not_translatable = set() for root, dirs, files in os.walk(src_root): root = Path(root) for dirname in dirs: dirpath = (root / dirname).relative_to(src_root) if dirpath in skip_files or dirname.startswith("."): dirs.remove(dirname) for name in files: path = (root / name).relative_to(src_root) if path not in pot_files and path not in skip_files: not_translatable.add(path) # Filter out any unknown filetypes not_translatable = [p for p in not_translatable if _get_pattern(p) is not None] not_translatable = [src_root / p for p in not_translatable] # Filter out any files not containing translations fd, temp_path = tempfile.mkstemp("POTFILES.in") temp_path = Path(temp_path) try: os.close(fd) _write_potfiles(src_root, temp_path, not_translatable) pot_path = _create_pot(temp_path, src_root) try: infos = set() with open(pot_path, "r", encoding="utf-8") as h: for line in h.readlines(): if not line.startswith("#:"): continue infos.update(line.split()[1:]) return sorted(infos) finally: pot_path.unlink() finally: temp_path.unlink() def _get_xgettext_version() -> Tuple: """:returns: a version tuple e.g. (0, 19, 3) or GettextError""" try: result = subprocess.check_output(["xgettext", "--version"]) except subprocess.CalledProcessError as e: raise GettextError(e) try: return tuple(map(int, result.splitlines()[0].split()[-1].split(b"."))) except (IndexError, ValueError) as e: raise GettextError(e) @functools.lru_cache(None) def check_version() -> None: """Check Gettext version. :raises GettextError: (with message) if required gettext programs are missing """ required_programs = ["xgettext", "msgmerge", "msgfmt"] for prog in required_programs: if shutil.which(prog) is None: raise GettextError("{} missing".format(prog)) if _get_xgettext_version() < (0, 19, 8): raise GettextError("xgettext too old, need 0.19.8+")
executors
tornado
from __future__ import absolute_import import sys from concurrent.futures import ThreadPoolExecutor from apscheduler.executors.base import BaseExecutor, run_job from tornado.gen import convert_yielded try: from inspect import iscoroutinefunction from apscheduler.executors.base_py3 import run_coroutine_job except ImportError: def iscoroutinefunction(func): return False class TornadoExecutor(BaseExecutor): """ Runs jobs either in a thread pool or directly on the I/O loop. If the job function is a native coroutine function, it is scheduled to be run directly in the I/O loop as soon as possible. All other functions are run in a thread pool. Plugin alias: ``tornado`` :param int max_workers: maximum number of worker threads in the thread pool """ def __init__(self, max_workers=10): super(TornadoExecutor, self).__init__() self.executor = ThreadPoolExecutor(max_workers) def start(self, scheduler, alias): super(TornadoExecutor, self).start(scheduler, alias) self._ioloop = scheduler._ioloop def _do_submit_job(self, job, run_times): def callback(f): try: events = f.result() except: self._run_job_error(job.id, *sys.exc_info()[1:]) else: self._run_job_success(job.id, events) if iscoroutinefunction(job.func): f = run_coroutine_job( job, job._jobstore_alias, run_times, self._logger.name ) else: f = self.executor.submit( run_job, job, job._jobstore_alias, run_times, self._logger.name ) f = convert_yielded(f) f.add_done_callback(callback)
service
implantSet
# ============================================================================= # Copyright (C) 2016 Ryan Holmes # # This file is part of pyfa. # # pyfa is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pyfa is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with pyfa. If not, see <http://www.gnu.org/licenses/>. # ============================================================================= import copy import eos.db from eos.saveddata.implant import Implant as es_Implant from eos.saveddata.implantSet import ImplantSet as es_ImplantSet from service.market import Market class ImportError(Exception): pass class ImplantSets: instance = None @classmethod def getInstance(cls): if cls.instance is None: cls.instance = ImplantSets() return cls.instance @staticmethod def getImplantSetList(): return eos.db.getImplantSetList(None) @staticmethod def getImplantSet(name): return eos.db.getImplantSet(name) @staticmethod def getImplants(setID): return eos.db.getImplantSet(setID).implants @staticmethod def addImplants(setID, *itemIDs): implant_set = eos.db.getImplantSet(setID) for itemID in itemIDs: implant = es_Implant(eos.db.getItem(itemID)) implant_set.implants.makeRoom(implant) implant_set.implants.append(implant) eos.db.commit() @staticmethod def removeImplant(setID, implant): eos.db.getImplantSet(setID).implants.remove(implant) eos.db.commit() @staticmethod def newSet(name): implant_set = es_ImplantSet() implant_set.name = name eos.db.save(implant_set) return implant_set @staticmethod def renameSet(implant_set, newName): implant_set.name = newName eos.db.save(implant_set) @staticmethod def deleteSet(implant_set): eos.db.remove(implant_set) @staticmethod def copySet(implant_set): newS = copy.deepcopy(implant_set) eos.db.save(newS) return newS @staticmethod def saveChanges(implant_set): eos.db.save(implant_set) def importSets(self, text): sMkt = Market.getInstance() lines = text.splitlines() newSets = [] errors = 0 current = None lookup = {} for i, line in enumerate(lines): line = line.strip() try: if line == "" or line[0] == "#": # comments / empty string continue if line[:1] == "[" and line[-1:] == "]": current = es_ImplantSet(line[1:-1]) newSets.append(current) else: item = sMkt.getItem(line) current.implants.append(es_Implant(item)) except (KeyboardInterrupt, SystemExit): raise except: errors += 1 continue for implant_set in self.getImplantSetList(): lookup[implant_set.name] = implant_set for implant_set in newSets: if implant_set.name in lookup: match = lookup[implant_set.name] for implant in implant_set.implants: match.implants.append(es_Implant(implant.item)) else: eos.db.save(implant_set) eos.db.commit() lenImports = len(newSets) if lenImports == 0: raise ImportError("No patterns found for import") if errors > 0: raise ImportError( "%d sets imported from clipboard; %d errors" % (lenImports, errors) ) def exportSets(self): patterns = self.getImplantSetList() patterns.sort(key=lambda p: p.name) return es_ImplantSet.exportSets(*patterns)
StartPage
LoadNew
# *************************************************************************** # * Copyright (c) 2018 Yorik van Havre <yorik@uncreated.net> * # * * # * This program is free software; you can redistribute it and/or modify * # * it under the terms of the GNU Lesser General Public License (LGPL) * # * as published by the Free Software Foundation; either version 2 of * # * the License, or (at your option) any later version. * # * for detail see the LICENCE text file. * # * * # * This program is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU Library General Public License for more details. * # * * # * You should have received a copy of the GNU Library General Public * # * License along with this program; if not, write to the Free Software * # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * # *************************************************************************** import FreeCAD import FreeCADGui from StartPage import StartPage # template will be given before this script is run template_name = str(template) if template_name == "empty_file": FreeCADGui.runCommand("Std_New") StartPage.postStart() elif template_name == "open_file": previous_doc = FreeCADGui.ActiveDocument FreeCADGui.runCommand("Std_Open") # workaround to not run postStart() if user cancels the Open dialog if FreeCADGui.ActiveDocument != previous_doc: StartPage.postStart() elif template_name == "parametric_part": FreeCADGui.runCommand("Std_New") FreeCADGui.activateWorkbench("PartDesignWorkbench") FreeCADGui.runCommand("PartDesign_Body") StartPage.postStart(False) # elif template_name == "csg_part": # FreeCADGui.runCommand('Std_New') # FreeCADGui.activateWorkbench("PartWorkbench") # StartPage.postStart(False) elif template_name == "2d_draft": FreeCADGui.runCommand("Std_New") FreeCADGui.activateWorkbench("DraftWorkbench") FreeCADGui.runCommand("Std_ViewTop") StartPage.postStart(False) elif template_name == "architecture": FreeCADGui.runCommand("Std_New") try: import BimCommands except Exception: FreeCADGui.activateWorkbench("ArchWorkbench") else: FreeCADGui.activateWorkbench("BIMWorkbench") StartPage.postStart(False)
util
artresizer
# This file is part of beets. # Copyright 2016, Fabrice Laporte # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. """Abstraction layer to resize images using PIL, ImageMagick, or a public resizing proxy if neither is available. """ import os import os.path import platform import re import subprocess from itertools import chain from tempfile import NamedTemporaryFile from urllib.parse import urlencode from beets import logging, util from beets.util import bytestring_path, displayable_path, py3_path, syspath PROXY_URL = "https://images.weserv.nl/" log = logging.getLogger("beets") def resize_url(url, maxwidth, quality=0): """Return a proxied image URL that resizes the original image to maxwidth (preserving aspect ratio). """ params = { "url": url.replace("http://", ""), "w": maxwidth, } if quality > 0: params["q"] = quality return "{}?{}".format(PROXY_URL, urlencode(params)) def temp_file_for(path): """Return an unused filename with the same extension as the specified path. """ ext = os.path.splitext(path)[1] with NamedTemporaryFile(suffix=py3_path(ext), delete=False) as f: return bytestring_path(f.name) class LocalBackendNotAvailableError(Exception): pass _NOT_AVAILABLE = object() class LocalBackend: @classmethod def available(cls): try: cls.version() return True except LocalBackendNotAvailableError: return False class IMBackend(LocalBackend): NAME = "ImageMagick" # These fields are used as a cache for `version()`. `_legacy` indicates # whether the modern `magick` binary is available or whether to fall back # to the old-style `convert`, `identify`, etc. commands. _version = None _legacy = None @classmethod def version(cls): """Obtain and cache ImageMagick version. Raises `LocalBackendNotAvailableError` if not available. """ if cls._version is None: for cmd_name, legacy in (("magick", False), ("convert", True)): try: out = util.command_output([cmd_name, "--version"]).stdout except (subprocess.CalledProcessError, OSError) as exc: log.debug("ImageMagick version check failed: {}", exc) cls._version = _NOT_AVAILABLE else: if b"imagemagick" in out.lower(): pattern = rb".+ (\d+)\.(\d+)\.(\d+).*" match = re.search(pattern, out) if match: cls._version = ( int(match.group(1)), int(match.group(2)), int(match.group(3)), ) cls._legacy = legacy if cls._version is _NOT_AVAILABLE: raise LocalBackendNotAvailableError() else: return cls._version def __init__(self): """Initialize a wrapper around ImageMagick for local image operations. Stores the ImageMagick version and legacy flag. If ImageMagick is not available, raise an Exception. """ self.version() # Use ImageMagick's magick binary when it's available. # If it's not, fall back to the older, separate convert # and identify commands. if self._legacy: self.convert_cmd = ["convert"] self.identify_cmd = ["identify"] self.compare_cmd = ["compare"] else: self.convert_cmd = ["magick"] self.identify_cmd = ["magick", "identify"] self.compare_cmd = ["magick", "compare"] def resize(self, maxwidth, path_in, path_out=None, quality=0, max_filesize=0): """Resize using ImageMagick. Use the ``magick`` program or ``convert`` on older versions. Return the output path of resized image. """ path_out = path_out or temp_file_for(path_in) log.debug( "artresizer: ImageMagick resizing {0} to {1}", displayable_path(path_in), displayable_path(path_out), ) # "-resize WIDTHx>" shrinks images with the width larger # than the given width while maintaining the aspect ratio # with regards to the height. # ImageMagick already seems to default to no interlace, but we include # it here for the sake of explicitness. cmd = self.convert_cmd + [ syspath(path_in, prefix=False), "-resize", f"{maxwidth}x>", "-interlace", "none", ] if quality > 0: cmd += ["-quality", f"{quality}"] # "-define jpeg:extent=SIZEb" sets the target filesize for imagemagick # to SIZE in bytes. if max_filesize > 0: cmd += ["-define", f"jpeg:extent={max_filesize}b"] cmd.append(syspath(path_out, prefix=False)) try: util.command_output(cmd) except subprocess.CalledProcessError: log.warning( "artresizer: IM convert failed for {0}", displayable_path(path_in) ) return path_in return path_out def get_size(self, path_in): cmd = self.identify_cmd + ["-format", "%w %h", syspath(path_in, prefix=False)] try: out = util.command_output(cmd).stdout except subprocess.CalledProcessError as exc: log.warning("ImageMagick size query failed") log.debug( "`convert` exited with (status {}) when " "getting size with command {}:\n{}", exc.returncode, cmd, exc.output.strip(), ) return None try: return tuple(map(int, out.split(b" "))) except IndexError: log.warning("Could not understand IM output: {0!r}", out) return None def deinterlace(self, path_in, path_out=None): path_out = path_out or temp_file_for(path_in) cmd = self.convert_cmd + [ syspath(path_in, prefix=False), "-interlace", "none", syspath(path_out, prefix=False), ] try: util.command_output(cmd) return path_out except subprocess.CalledProcessError: # FIXME: Should probably issue a warning? return path_in def get_format(self, filepath): cmd = self.identify_cmd + ["-format", "%[magick]", syspath(filepath)] try: return util.command_output(cmd).stdout except subprocess.CalledProcessError: # FIXME: Should probably issue a warning? return None def convert_format(self, source, target, deinterlaced): cmd = self.convert_cmd + [ syspath(source), *(["-interlace", "none"] if deinterlaced else []), syspath(target), ] try: subprocess.check_call( cmd, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL ) return target except subprocess.CalledProcessError: # FIXME: Should probably issue a warning? return source @property def can_compare(self): return self.version() > (6, 8, 7) def compare(self, im1, im2, compare_threshold): is_windows = platform.system() == "Windows" # Converting images to grayscale tends to minimize the weight # of colors in the diff score. So we first convert both images # to grayscale and then pipe them into the `compare` command. # On Windows, ImageMagick doesn't support the magic \\?\ prefix # on paths, so we pass `prefix=False` to `syspath`. convert_cmd = self.convert_cmd + [ syspath(im2, prefix=False), syspath(im1, prefix=False), "-colorspace", "gray", "MIFF:-", ] compare_cmd = self.compare_cmd + [ "-define", "phash:colorspaces=sRGB,HCLp", "-metric", "PHASH", "-", "null:", ] log.debug("comparing images with pipeline {} | {}", convert_cmd, compare_cmd) convert_proc = subprocess.Popen( convert_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=not is_windows, ) compare_proc = subprocess.Popen( compare_cmd, stdin=convert_proc.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=not is_windows, ) # Check the convert output. We're not interested in the # standard output; that gets piped to the next stage. convert_proc.stdout.close() convert_stderr = convert_proc.stderr.read() convert_proc.stderr.close() convert_proc.wait() if convert_proc.returncode: log.debug( "ImageMagick convert failed with status {}: {!r}", convert_proc.returncode, convert_stderr, ) return None # Check the compare output. stdout, stderr = compare_proc.communicate() if compare_proc.returncode: if compare_proc.returncode != 1: log.debug( "ImageMagick compare failed: {0}, {1}", displayable_path(im2), displayable_path(im1), ) return None out_str = stderr else: out_str = stdout try: phash_diff = float(out_str) except ValueError: log.debug("IM output is not a number: {0!r}", out_str) return None log.debug("ImageMagick compare score: {0}", phash_diff) return phash_diff <= compare_threshold @property def can_write_metadata(self): return True def write_metadata(self, file, metadata): assignments = list( chain.from_iterable(("-set", k, v) for k, v in metadata.items()) ) command = self.convert_cmd + [file, *assignments, file] util.command_output(command) class PILBackend(LocalBackend): NAME = "PIL" @classmethod def version(cls): try: __import__("PIL", fromlist=["Image"]) except ImportError: raise LocalBackendNotAvailableError() def __init__(self): """Initialize a wrapper around PIL for local image operations. If PIL is not available, raise an Exception. """ self.version() def resize(self, maxwidth, path_in, path_out=None, quality=0, max_filesize=0): """Resize using Python Imaging Library (PIL). Return the output path of resized image. """ path_out = path_out or temp_file_for(path_in) from PIL import Image log.debug( "artresizer: PIL resizing {0} to {1}", displayable_path(path_in), displayable_path(path_out), ) try: im = Image.open(syspath(path_in)) size = maxwidth, maxwidth im.thumbnail(size, Image.Resampling.LANCZOS) if quality == 0: # Use PIL's default quality. quality = -1 # progressive=False only affects JPEGs and is the default, # but we include it here for explicitness. im.save(py3_path(path_out), quality=quality, progressive=False) if max_filesize > 0: # If maximum filesize is set, we attempt to lower the quality # of jpeg conversion by a proportional amount, up to 3 attempts # First, set the maximum quality to either provided, or 95 if quality > 0: lower_qual = quality else: lower_qual = 95 for i in range(5): # 5 attempts is an arbitrary choice filesize = os.stat(syspath(path_out)).st_size log.debug("PIL Pass {0} : Output size: {1}B", i, filesize) if filesize <= max_filesize: return path_out # The relationship between filesize & quality will be # image dependent. lower_qual -= 10 # Restrict quality dropping below 10 if lower_qual < 10: lower_qual = 10 # Use optimize flag to improve filesize decrease im.save( py3_path(path_out), quality=lower_qual, optimize=True, progressive=False, ) log.warning("PIL Failed to resize file to below {0}B", max_filesize) return path_out else: return path_out except OSError: log.error( "PIL cannot create thumbnail for '{0}'", displayable_path(path_in) ) return path_in def get_size(self, path_in): from PIL import Image try: im = Image.open(syspath(path_in)) return im.size except OSError as exc: log.error("PIL could not read file {}: {}", displayable_path(path_in), exc) return None def deinterlace(self, path_in, path_out=None): path_out = path_out or temp_file_for(path_in) from PIL import Image try: im = Image.open(syspath(path_in)) im.save(py3_path(path_out), progressive=False) return path_out except IOError: # FIXME: Should probably issue a warning? return path_in def get_format(self, filepath): from PIL import Image, UnidentifiedImageError try: with Image.open(syspath(filepath)) as im: return im.format except (ValueError, TypeError, UnidentifiedImageError, FileNotFoundError): log.exception("failed to detect image format for {}", filepath) return None def convert_format(self, source, target, deinterlaced): from PIL import Image, UnidentifiedImageError try: with Image.open(syspath(source)) as im: im.save(py3_path(target), progressive=not deinterlaced) return target except ( ValueError, TypeError, UnidentifiedImageError, FileNotFoundError, OSError, ): log.exception("failed to convert image {} -> {}", source, target) return source @property def can_compare(self): return False def compare(self, im1, im2, compare_threshold): # It is an error to call this when ArtResizer.can_compare is not True. raise NotImplementedError() @property def can_write_metadata(self): return True def write_metadata(self, file, metadata): from PIL import Image, PngImagePlugin # FIXME: Detect and handle other file types (currently, the only user # is the thumbnails plugin, which generates PNG images). im = Image.open(syspath(file)) meta = PngImagePlugin.PngInfo() for k, v in metadata.items(): meta.add_text(k, v, 0) im.save(py3_path(file), "PNG", pnginfo=meta) class Shareable(type): """A pseudo-singleton metaclass that allows both shared and non-shared instances. The ``MyClass.shared`` property holds a lazily-created shared instance of ``MyClass`` while calling ``MyClass()`` to construct a new object works as usual. """ def __init__(cls, name, bases, dict): super().__init__(name, bases, dict) cls._instance = None @property def shared(cls): if cls._instance is None: cls._instance = cls() return cls._instance BACKEND_CLASSES = [ IMBackend, PILBackend, ] class ArtResizer(metaclass=Shareable): """A singleton class that performs image resizes.""" def __init__(self): """Create a resizer object with an inferred method.""" # Check if a local backend is available, and store an instance of the # backend class. Otherwise, fallback to the web proxy. for backend_cls in BACKEND_CLASSES: try: self.local_method = backend_cls() log.debug(f"artresizer: method is {self.local_method.NAME}") break except LocalBackendNotAvailableError: continue else: log.debug("artresizer: method is WEBPROXY") self.local_method = None @property def method(self): if self.local: return self.local_method.NAME else: return "WEBPROXY" def resize(self, maxwidth, path_in, path_out=None, quality=0, max_filesize=0): """Manipulate an image file according to the method, returning a new path. For PIL or IMAGEMAGIC methods, resizes the image to a temporary file and encodes with the specified quality level. For WEBPROXY, returns `path_in` unmodified. """ if self.local: return self.local_method.resize( maxwidth, path_in, path_out, quality=quality, max_filesize=max_filesize ) else: # Handled by `proxy_url` already. return path_in def deinterlace(self, path_in, path_out=None): """Deinterlace an image. Only available locally. """ if self.local: return self.local_method.deinterlace(path_in, path_out) else: # FIXME: Should probably issue a warning? return path_in def proxy_url(self, maxwidth, url, quality=0): """Modifies an image URL according the method, returning a new URL. For WEBPROXY, a URL on the proxy server is returned. Otherwise, the URL is returned unmodified. """ if self.local: # Going to be handled by `resize()`. return url else: return resize_url(url, maxwidth, quality) @property def local(self): """A boolean indicating whether the resizing method is performed locally (i.e., PIL or ImageMagick). """ return self.local_method is not None def get_size(self, path_in): """Return the size of an image file as an int couple (width, height) in pixels. Only available locally. """ if self.local: return self.local_method.get_size(path_in) else: # FIXME: Should probably issue a warning? return path_in def get_format(self, path_in): """Returns the format of the image as a string. Only available locally. """ if self.local: return self.local_method.get_format(path_in) else: # FIXME: Should probably issue a warning? return None def reformat(self, path_in, new_format, deinterlaced=True): """Converts image to desired format, updating its extension, but keeping the same filename. Only available locally. """ if not self.local: # FIXME: Should probably issue a warning? return path_in new_format = new_format.lower() # A nonexhaustive map of image "types" to extensions overrides new_format = { "jpeg": "jpg", }.get(new_format, new_format) fname, ext = os.path.splitext(path_in) path_new = fname + b"." + new_format.encode("utf8") # allows the exception to propagate, while still making sure a changed # file path was removed result_path = path_in try: result_path = self.local_method.convert_format( path_in, path_new, deinterlaced ) finally: if result_path != path_in: os.unlink(path_in) return result_path @property def can_compare(self): """A boolean indicating whether image comparison is available""" if self.local: return self.local_method.can_compare else: return False def compare(self, im1, im2, compare_threshold): """Return a boolean indicating whether two images are similar. Only available locally. """ if self.local: return self.local_method.compare(im1, im2, compare_threshold) else: # FIXME: Should probably issue a warning? return None @property def can_write_metadata(self): """A boolean indicating whether writing image metadata is supported.""" if self.local: return self.local_method.can_write_metadata else: return False def write_metadata(self, file, metadata): """Write key-value metadata to the image file. Only available locally. Currently, expects the image to be a PNG file. """ if self.local: self.local_method.write_metadata(file, metadata) else: # FIXME: Should probably issue a warning? pass
doc
mocks
""" Provided so that we can build docs without needing to have any dependencies installed (such as for RTFD). Derived from https://read-the-docs.readthedocs.org/en/latest/faq.html """ import sys class MockGiModule: def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return MockGiModule() @classmethod def __getattr__(cls, name): if name in ("__file__", "__path__"): return "/dev/null" elif name in "__mro_entries__": raise AttributeError("'MockGiModule' object has no attribute '%s'" % (name)) elif name in "GObject": # This corresponds to GObject class in the GI (GObject) # module - we need to return type instead of an instance! # # Note: we need to do this for each class that comes from # a GI module AND is involved in multiple-inheritance in our # codebase in order to avoid "TypeError: metaclass conflict" # errors. return MockGiModule else: return MockGiModule() # glib mocks @classmethod def get_user_data_dir(cls): return "/tmp" @classmethod def get_user_config_dir(cls): return "/tmp" @classmethod def get_user_cache_dir(cls): return "/tmp" # gtk/gdk mocks class ModifierType: SHIFT_MASK = 0 @classmethod def accelerator_parse(cls, *args): return [0, 0] class Mock: __all__ = [] def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return Mock() @classmethod def __getattr__(cls, name): if name in ("__file__", "__path__"): return "/dev/null" elif name in ("__qualname__",): return "" elif name in ("__mro_entries__",): raise AttributeError("'Mock' object has no attribute '%s'" % (name)) elif name in ("Gio", "GLib", "GObject", "Gst", "Gtk", "Gdk"): # These are reached via 'from gi.repository import x' and # correspond to GI sub-modules - need to return an instance # of our mock GI module return MockGiModule() else: return Mock() MOCK_MODULES = [ "bsddb3", "cairo", "dbus", "dbus.service", "gi", "gi.repository", "gi.repository.Gio", "gi.repository.GLib", "gi.repository.GObject", "gi.repository.Gst", "gi.repository.Gtk", "mutagen", "mutagen.apev2", "mutagen.ogg", "mutagen.flac", ] def import_fake_modules(): for mod_name in MOCK_MODULES: sys.modules[mod_name] = Mock() def fake_xl_settings(): # player hack import xl.settings def option_hack(name, default): if name == "player/engine": return "rtfd_hack" else: return orig_get_option(name, default) orig_get_option = xl.settings.get_option xl.settings.get_option = option_hack
util
functemplate
# This file is part of beets. # Copyright 2016, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. """This module implements a string formatter based on the standard PEP 292 string.Template class extended with function calls. Variables, as with string.Template, are indicated with $ and functions are delimited with %. This module assumes that everything is Unicode: the template and the substitution values. Bytestrings are not supported. Also, the templates always behave like the ``safe_substitute`` method in the standard library: unknown symbols are left intact. This is sort of like a tiny, horrible degeneration of a real templating engine like Jinja2 or Mustache. """ import ast import dis import functools import re import sys import types SYMBOL_DELIM = "$" FUNC_DELIM = "%" GROUP_OPEN = "{" GROUP_CLOSE = "}" ARG_SEP = "," ESCAPE_CHAR = "$" VARIABLE_PREFIX = "__var_" FUNCTION_PREFIX = "__func_" class Environment: """Contains the values and functions to be substituted into a template. """ def __init__(self, values, functions): self.values = values self.functions = functions # Code generation helpers. def ex_lvalue(name): """A variable load expression.""" return ast.Name(name, ast.Store()) def ex_rvalue(name): """A variable store expression.""" return ast.Name(name, ast.Load()) def ex_literal(val): """An int, float, long, bool, string, or None literal with the given value. """ return ast.Constant(val) def ex_varassign(name, expr): """Assign an expression into a single variable. The expression may either be an `ast.expr` object or a value to be used as a literal. """ if not isinstance(expr, ast.expr): expr = ex_literal(expr) return ast.Assign([ex_lvalue(name)], expr) def ex_call(func, args): """A function-call expression with only positional parameters. The function may be an expression or the name of a function. Each argument may be an expression or a value to be used as a literal. """ if isinstance(func, str): func = ex_rvalue(func) args = list(args) for i in range(len(args)): if not isinstance(args[i], ast.expr): args[i] = ex_literal(args[i]) return ast.Call(func, args, []) def compile_func(arg_names, statements, name="_the_func", debug=False): """Compile a list of statements as the body of a function and return the resulting Python function. If `debug`, then print out the bytecode of the compiled function. """ args_fields = { "args": [ast.arg(arg=n, annotation=None) for n in arg_names], "kwonlyargs": [], "kw_defaults": [], "defaults": [ex_literal(None) for _ in arg_names], } if "posonlyargs" in ast.arguments._fields: # Added in Python 3.8. args_fields["posonlyargs"] = [] args = ast.arguments(**args_fields) func_def = ast.FunctionDef( name=name, args=args, body=statements, decorator_list=[], ) # The ast.Module signature changed in 3.8 to accept a list of types to # ignore. if sys.version_info >= (3, 8): mod = ast.Module([func_def], []) else: mod = ast.Module([func_def]) ast.fix_missing_locations(mod) prog = compile(mod, "<generated>", "exec") # Debug: show bytecode. if debug: dis.dis(prog) for const in prog.co_consts: if isinstance(const, types.CodeType): dis.dis(const) the_locals = {} exec(prog, {}, the_locals) return the_locals[name] # AST nodes for the template language. class Symbol: """A variable-substitution symbol in a template.""" def __init__(self, ident, original): self.ident = ident self.original = original def __repr__(self): return "Symbol(%s)" % repr(self.ident) def evaluate(self, env): """Evaluate the symbol in the environment, returning a Unicode string. """ if self.ident in env.values: # Substitute for a value. return env.values[self.ident] else: # Keep original text. return self.original def translate(self): """Compile the variable lookup.""" ident = self.ident expr = ex_rvalue(VARIABLE_PREFIX + ident) return [expr], {ident}, set() class Call: """A function call in a template.""" def __init__(self, ident, args, original): self.ident = ident self.args = args self.original = original def __repr__(self): return "Call({}, {}, {})".format( repr(self.ident), repr(self.args), repr(self.original) ) def evaluate(self, env): """Evaluate the function call in the environment, returning a Unicode string. """ if self.ident in env.functions: arg_vals = [expr.evaluate(env) for expr in self.args] try: out = env.functions[self.ident](*arg_vals) except Exception as exc: # Function raised exception! Maybe inlining the name of # the exception will help debug. return "<%s>" % str(exc) return str(out) else: return self.original def translate(self): """Compile the function call.""" varnames = set() funcnames = {self.ident} arg_exprs = [] for arg in self.args: subexprs, subvars, subfuncs = arg.translate() varnames.update(subvars) funcnames.update(subfuncs) # Create a subexpression that joins the result components of # the arguments. arg_exprs.append( ex_call( ast.Attribute(ex_literal(""), "join", ast.Load()), [ ex_call( "map", [ ex_rvalue(str.__name__), ast.List(subexprs, ast.Load()), ], ) ], ) ) subexpr_call = ex_call(FUNCTION_PREFIX + self.ident, arg_exprs) return [subexpr_call], varnames, funcnames class Expression: """Top-level template construct: contains a list of text blobs, Symbols, and Calls. """ def __init__(self, parts): self.parts = parts def __repr__(self): return "Expression(%s)" % (repr(self.parts)) def evaluate(self, env): """Evaluate the entire expression in the environment, returning a Unicode string. """ out = [] for part in self.parts: if isinstance(part, str): out.append(part) else: out.append(part.evaluate(env)) return "".join(map(str, out)) def translate(self): """Compile the expression to a list of Python AST expressions, a set of variable names used, and a set of function names. """ expressions = [] varnames = set() funcnames = set() for part in self.parts: if isinstance(part, str): expressions.append(ex_literal(part)) else: e, v, f = part.translate() expressions.extend(e) varnames.update(v) funcnames.update(f) return expressions, varnames, funcnames # Parser. class ParseError(Exception): pass class Parser: """Parses a template expression string. Instantiate the class with the template source and call ``parse_expression``. The ``pos`` field will indicate the character after the expression finished and ``parts`` will contain a list of Unicode strings, Symbols, and Calls reflecting the concatenated portions of the expression. This is a terrible, ad-hoc parser implementation based on a left-to-right scan with no lexing step to speak of; it's probably both inefficient and incorrect. Maybe this should eventually be replaced with a real, accepted parsing technique (PEG, parser generator, etc.). """ def __init__(self, string, in_argument=False): """Create a new parser. :param in_arguments: boolean that indicates the parser is to be used for parsing function arguments, ie. considering commas (`ARG_SEP`) a special character """ self.string = string self.in_argument = in_argument self.pos = 0 self.parts = [] # Common parsing resources. special_chars = (SYMBOL_DELIM, FUNC_DELIM, GROUP_OPEN, GROUP_CLOSE, ESCAPE_CHAR) special_char_re = re.compile( r"[%s]|\Z" % "".join(re.escape(c) for c in special_chars) ) escapable_chars = (SYMBOL_DELIM, FUNC_DELIM, GROUP_CLOSE, ARG_SEP) terminator_chars = (GROUP_CLOSE,) def parse_expression(self): """Parse a template expression starting at ``pos``. Resulting components (Unicode strings, Symbols, and Calls) are added to the ``parts`` field, a list. The ``pos`` field is updated to be the next character after the expression. """ # Append comma (ARG_SEP) to the list of special characters only when # parsing function arguments. extra_special_chars = () special_char_re = self.special_char_re if self.in_argument: extra_special_chars = (ARG_SEP,) special_char_re = re.compile( r"[%s]|\Z" % "".join( re.escape(c) for c in self.special_chars + extra_special_chars ) ) text_parts = [] while self.pos < len(self.string): char = self.string[self.pos] if char not in self.special_chars + extra_special_chars: # A non-special character. Skip to the next special # character, treating the interstice as literal text. next_pos = ( special_char_re.search(self.string[self.pos :]).start() + self.pos ) text_parts.append(self.string[self.pos : next_pos]) self.pos = next_pos continue if self.pos == len(self.string) - 1: # The last character can never begin a structure, so we # just interpret it as a literal character (unless it # terminates the expression, as with , and }). if char not in self.terminator_chars + extra_special_chars: text_parts.append(char) self.pos += 1 break next_char = self.string[self.pos + 1] if char == ESCAPE_CHAR and next_char in ( self.escapable_chars + extra_special_chars ): # An escaped special character ($$, $}, etc.). Note that # ${ is not an escape sequence: this is ambiguous with # the start of a symbol and it's not necessary (just # using { suffices in all cases). text_parts.append(next_char) self.pos += 2 # Skip the next character. continue # Shift all characters collected so far into a single string. if text_parts: self.parts.append("".join(text_parts)) text_parts = [] if char == SYMBOL_DELIM: # Parse a symbol. self.parse_symbol() elif char == FUNC_DELIM: # Parse a function call. self.parse_call() elif char in self.terminator_chars + extra_special_chars: # Template terminated. break elif char == GROUP_OPEN: # Start of a group has no meaning hear; just pass # through the character. text_parts.append(char) self.pos += 1 else: assert False # If any parsed characters remain, shift them into a string. if text_parts: self.parts.append("".join(text_parts)) def parse_symbol(self): """Parse a variable reference (like ``$foo`` or ``${foo}``) starting at ``pos``. Possibly appends a Symbol object (or, failing that, text) to the ``parts`` field and updates ``pos``. The character at ``pos`` must, as a precondition, be ``$``. """ assert self.pos < len(self.string) assert self.string[self.pos] == SYMBOL_DELIM if self.pos == len(self.string) - 1: # Last character. self.parts.append(SYMBOL_DELIM) self.pos += 1 return next_char = self.string[self.pos + 1] start_pos = self.pos self.pos += 1 if next_char == GROUP_OPEN: # A symbol like ${this}. self.pos += 1 # Skip opening. closer = self.string.find(GROUP_CLOSE, self.pos) if closer == -1 or closer == self.pos: # No closing brace found or identifier is empty. self.parts.append(self.string[start_pos : self.pos]) else: # Closer found. ident = self.string[self.pos : closer] self.pos = closer + 1 self.parts.append(Symbol(ident, self.string[start_pos : self.pos])) else: # A bare-word symbol. ident = self._parse_ident() if ident: # Found a real symbol. self.parts.append(Symbol(ident, self.string[start_pos : self.pos])) else: # A standalone $. self.parts.append(SYMBOL_DELIM) def parse_call(self): """Parse a function call (like ``%foo{bar,baz}``) starting at ``pos``. Possibly appends a Call object to ``parts`` and update ``pos``. The character at ``pos`` must be ``%``. """ assert self.pos < len(self.string) assert self.string[self.pos] == FUNC_DELIM start_pos = self.pos self.pos += 1 ident = self._parse_ident() if not ident: # No function name. self.parts.append(FUNC_DELIM) return if self.pos >= len(self.string): # Identifier terminates string. self.parts.append(self.string[start_pos : self.pos]) return if self.string[self.pos] != GROUP_OPEN: # Argument list not opened. self.parts.append(self.string[start_pos : self.pos]) return # Skip past opening brace and try to parse an argument list. self.pos += 1 args = self.parse_argument_list() if self.pos >= len(self.string) or self.string[self.pos] != GROUP_CLOSE: # Arguments unclosed. self.parts.append(self.string[start_pos : self.pos]) return self.pos += 1 # Move past closing brace. self.parts.append(Call(ident, args, self.string[start_pos : self.pos])) def parse_argument_list(self): """Parse a list of arguments starting at ``pos``, returning a list of Expression objects. Does not modify ``parts``. Should leave ``pos`` pointing to a } character or the end of the string. """ # Try to parse a subexpression in a subparser. expressions = [] while self.pos < len(self.string): subparser = Parser(self.string[self.pos :], in_argument=True) subparser.parse_expression() # Extract and advance past the parsed expression. expressions.append(Expression(subparser.parts)) self.pos += subparser.pos if self.pos >= len(self.string) or self.string[self.pos] == GROUP_CLOSE: # Argument list terminated by EOF or closing brace. break # Only other way to terminate an expression is with ,. # Continue to the next argument. assert self.string[self.pos] == ARG_SEP self.pos += 1 return expressions def _parse_ident(self): """Parse an identifier and return it (possibly an empty string). Updates ``pos``. """ remainder = self.string[self.pos :] ident = re.match(r"\w*", remainder).group(0) self.pos += len(ident) return ident def _parse(template): """Parse a top-level template string Expression. Any extraneous text is considered literal text. """ parser = Parser(template) parser.parse_expression() parts = parser.parts remainder = parser.string[parser.pos :] if remainder: parts.append(remainder) return Expression(parts) @functools.lru_cache(maxsize=128) def template(fmt): return Template(fmt) # External interface. class Template: """A string template, including text, Symbols, and Calls.""" def __init__(self, template): self.expr = _parse(template) self.original = template self.compiled = self.translate() def __eq__(self, other): return self.original == other.original def interpret(self, values={}, functions={}): """Like `substitute`, but forces the interpreter (rather than the compiled version) to be used. The interpreter includes exception-handling code for missing variables and buggy template functions but is much slower. """ return self.expr.evaluate(Environment(values, functions)) def substitute(self, values={}, functions={}): """Evaluate the template given the values and functions.""" try: res = self.compiled(values, functions) except Exception: # Handle any exceptions thrown by compiled version. res = self.interpret(values, functions) return res def translate(self): """Compile the template to a Python function.""" expressions, varnames, funcnames = self.expr.translate() argnames = [] for varname in varnames: argnames.append(VARIABLE_PREFIX + varname) for funcname in funcnames: argnames.append(FUNCTION_PREFIX + funcname) func = compile_func( argnames, [ast.Return(ast.List(expressions, ast.Load()))], ) def wrapper_func(values={}, functions={}): args = {} for varname in varnames: args[VARIABLE_PREFIX + varname] = values[varname] for funcname in funcnames: args[FUNCTION_PREFIX + funcname] = functions[funcname] parts = func(**args) return "".join(parts) return wrapper_func # Performance tests. if __name__ == "__main__": import timeit _tmpl = Template("foo $bar %baz{foozle $bar barzle} $bar") _vars = {"bar": "qux"} _funcs = {"baz": str.upper} interp_time = timeit.timeit( "_tmpl.interpret(_vars, _funcs)", "from __main__ import _tmpl, _vars, _funcs", number=10000, ) print(interp_time) comp_time = timeit.timeit( "_tmpl.substitute(_vars, _funcs)", "from __main__ import _tmpl, _vars, _funcs", number=10000, ) print(comp_time) print("Speedup:", interp_time / comp_time)
core
cmgl
##################################################################### # -*- coding: utf-8 -*- # # # # Frets on Fire # # Copyright (C) 2010 John Stumpo # # 2020 Linkid # # # # This program is free software; you can redistribute it and/or # # modify it under the terms of the GNU General Public License # # as published by the Free Software Foundation; either version 2 # # of the License, or (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # # MA 02110-1301, USA. # ##################################################################### """ cmgl - context-managed OpenGL for Python Yet another Python binding for OpenGL, that uses context managers. """ from OpenGL import GL as gl def draw_arrays(mode, vertices, colors=None, texcoords=None): """Draw a triangle :param mode: mode to render (triangle, etc.) :param vertices: an array of vertex data :param colors: an array of colors (optional) :param texcoords: an array of texture coordinates (optional) """ # define vertices array gl.glVertexPointerf(vertices) gl.glEnableClientState(gl.GL_VERTEX_ARRAY) # define textures array if texcoords is not None: if texcoords.shape[0] != vertices.shape[0]: raise TypeError("Texcoords and vertices must be the same length") gl.glTexCoordPointerf(texcoords) gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) # define colors array if colors is not None: if colors.shape[0] != vertices.shape[0]: raise TypeError("Colors and vertices must be the same length") gl.glColorPointerf(colors) gl.glEnableClientState(gl.GL_COLOR_ARRAY) # draw arrays first = 0 count = vertices.shape[0] gl.glDrawArrays(mode, first, count) # disable client-side capabilities gl.glDisableClientState(gl.GL_VERTEX_ARRAY) gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY) gl.glDisableClientState(gl.GL_COLOR_ARRAY) class PushedMatrix: """Context manager for a matrix push. Inside its context, the active matrix is pushed. It is popped upon leaving the context. """ def __enter__(self): gl.glPushMatrix() def __exit__(self, etype, evalue, traceback): gl.glPopMatrix() class PushedAttrib: """Context manager for an attribute push. Inside its context, the chosen attributes are pushed. They are popped upon leaving the context. """ def __init__(self, gl_mask): self.gl_mask = gl_mask def __enter__(self): gl.glPushAttrib(self.gl_mask) def __exit__(self, etype, evalue, traceback): gl.glPopAttrib() class MatrixMode: """Context manager for switching the matrix mode. Inside its context, the chosen matrix is active. It is restored to its original value upon leaving the context. """ def __init__(self, new_mode): self.new_mode = new_mode self.old_mode = gl.GL_MODELVIEW def __enter__(self): gl.glGetIntegerv(gl.GL_MATRIX_MODE, self.old_mode) gl.glMatrixMode(self.new_mode) def __exit__(self, etype, evalue, traceback): gl.glMatrixMode(self.old_mode) class PushedSpecificMatrix: """Context manager for pushing a specific matrix. Inside its context, that matrix is pushed, but the active matrix is not changed. It is popped upon leaving the context. """ def __init__(self, mode): self.gl_mode = mode self.old_mode = gl.GL_MODELVIEW def __enter__(self): gl.glGetIntegerv(gl.GL_MATRIX_MODE, self.old_mode) gl.glMatrixMode(self.gl_mode) gl.glPushMatrix() gl.glMatrixMode(self.old_mode) def __exit__(self, etype, evalue, traceback): gl.glGetIntegerv(gl.GL_MATRIX_MODE, self.old_mode) gl.glMatrixMode(self.gl_mode) gl.glPopMatrix() gl.glMatrixMode(self.old_mode) class GList: """Abstraction of a display list. The list is automatically created and destroyed with the object. To compile operations into the list, enter the list's context. To call the list, call the object. """ def __init__(self): self.gl_list = gl.glGenLists(1) def __del__(self): gl.glDeleteLists(self.gl_list, 1) def __enter__(self): gl.glNewList(self.gl_list, gl.GL_COMPILE) def __exit__(self, etype, evalue, traceback): gl.glEndList() def __call__(self): gl.glCallList(self.gl_list)
migrations
0147_alter_user_preferred_language
# Generated by Django 3.2.12 on 2022-03-26 16:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("bookwyrm", "0146_auto_20220316_2352"), ] operations = [ migrations.AlterField( model_name="user", name="preferred_language", field=models.CharField( blank=True, choices=[ ("en-us", "English"), ("de-de", "Deutsch (German)"), ("es-es", "Español (Spanish)"), ("gl-es", "Galego (Galician)"), ("it-it", "Italiano (Italian)"), ("fr-fr", "Français (French)"), ("lt-lt", "Lietuvių (Lithuanian)"), ("no-no", "Norsk (Norwegian)"), ("pt-br", "Português do Brasil (Brazilian Portuguese)"), ("pt-pt", "Português Europeu (European Portuguese)"), ("ro-ro", "Română (Romanian)"), ("sv-se", "Svenska (Swedish)"), ("zh-hans", "简体中文 (Simplified Chinese)"), ("zh-hant", "繁體中文 (Traditional Chinese)"), ], max_length=255, null=True, ), ), ]
decrypters
TusfilesNetFolder
# -*- coding: utf-8 -*- import math import re import urllib.parse from ..base.xfs_decrypter import XFSDecrypter class TusfilesNetFolder(XFSDecrypter): __name__ = "TusfilesNetFolder" __type__ = "decrypter" __version__ = "0.17" __status__ = "testing" __pattern__ = r"https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)" __config__ = [ ("enabled", "bool", "Activated", True), ("use_premium", "bool", "Use premium account if available", True), ( "folder_per_package", "Default;Yes;No", "Create folder for each package", "Default", ), ("max_wait", "int", "Reconnect if waiting time is greater than minutes", 10), ] __description__ = """Tusfiles.net folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [ ("Walter Purcaro", "vuolter@gmail.com"), ("stickell", "l.stickell@yahoo.it"), ] PLUGIN_DOMAIN = "tusfiles.net" PAGES_PATTERN = r">\((\d+) \w+\)<" URL_REPLACEMENTS = [(__pattern__ + ".*", r"https://www.tusfiles.net/go/\g<ID>/")] def load_page(self, page_n): return self.load(urllib.parse.urljoin(self.pyfile.url, str(page_n))) def handle_pages(self, pyfile): pages = re.search(self.PAGES_PATTERN, self.data) if not pages: return pages = math.ceil(int(pages.group("pages"))) // 25 links = self.links for p in range(2, pages + 1): self.data = self.load_page(p) links.append(self.get_links()) self.links = links
tunnel-community
speed_test_exit
import argparse import asyncio import os from pathlib import Path from ipv8.messaging.anonymization.tunnel import EXIT_NODE, ORIGINATOR from ipv8.messaging.anonymization.utils import run_speed_test from ipv8.taskmanager import TaskManager from tribler.core.components.ipv8.ipv8_component import Ipv8Component from tribler.core.components.key.key_component import KeyComponent from tribler.core.components.restapi.restapi_component import RESTComponent from tribler.core.components.tunnel.tunnel_component import TunnelsComponent from tribler.core.utilities.tiny_tribler_service import TinyTriblerService EXPERIMENT_NUM_MB = int(os.environ.get("EXPERIMENT_NUM_MB", 25)) EXPERIMENT_NUM_CIRCUITS = int(os.environ.get("EXPERIMENT_NUM_CIRCUITS", 10)) EXPERIMENT_NUM_HOPS = int(os.environ.get("EXPERIMENT_NUM_HOPS", 1)) class Service(TinyTriblerService, TaskManager): def __init__(self, *args, **kwargs): super().__init__( *args, **kwargs, components=[ Ipv8Component(), KeyComponent(), RESTComponent(), TunnelsComponent(), ], ) TaskManager.__init__(self) self.config.dht.enabled = True self.results = [] self.output_file = "speed_test_exit.txt" def _graceful_shutdown(self): task = self.async_group.add_task(self.on_tribler_shutdown()) task.add_done_callback( lambda result: TinyTriblerService._graceful_shutdown(self) ) async def on_tribler_shutdown(self): await self.shutdown_task_manager() # Fill in the gaps with 0's max_time = max(result[0] for result in self.results) index = 0 while index < len(self.results): curr = self.results[index] _next = self.results[index + 1] if index + 1 < len(self.results) else None if not _next or curr[2] != _next[2]: self.results[index + 1 : index + 1] = [ (t + curr[0] + 1, curr[1], curr[2], 0) for t in range(max_time - curr[0]) ] index += max_time - curr[0] index += 1 with open(self.output_file, "w") as f: f.write("Time Circuit Type Speed\n") for result in self.results: f.write(" ".join(map(str, result)) + "\n") async def on_tribler_started(self): index = 0 while index < EXPERIMENT_NUM_CIRCUITS: component = self.session.get_instance(TunnelsComponent) community = component.community circuit = community.create_circuit(EXPERIMENT_NUM_HOPS) if circuit and (await circuit.ready): index += 1 self.results += await self.run_speed_test( ORIGINATOR, circuit, index, EXPERIMENT_NUM_MB ) self.results += await self.run_speed_test( EXIT_NODE, circuit, index, EXPERIMENT_NUM_MB ) self.logger.info(f"Remove circuit: {index}/{EXPERIMENT_NUM_CIRCUITS}") community.remove_circuit(circuit.circuit_id) else: await asyncio.sleep(1) self._graceful_shutdown() async def run_speed_test(self, direction, circuit, index, size): request_size = 0 if direction == ORIGINATOR else 1024 response_size = 1024 if direction == ORIGINATOR else 0 num_requests = size * 1024 component = self.session.get_instance(TunnelsComponent) task = asyncio.create_task( run_speed_test( component.community, circuit, request_size, response_size, num_requests, window=50, ) ) results = [] prev_transferred = ts = 0 while not task.done(): cur_transferred = ( circuit.bytes_down if direction == ORIGINATOR else circuit.bytes_up ) results.append( (ts, index, direction, (cur_transferred - prev_transferred) / 1024) ) prev_transferred = cur_transferred ts += 1 await asyncio.sleep(1) return results if __name__ == "__main__": parser = argparse.ArgumentParser(description="Run speed e2e experiment") parser.add_argument( "--fragile", "-f", help="Fail at the first error", action="store_true" ) arguments = parser.parse_args() service = Service(state_dir=Path(".Tribler")) service.run(fragile=arguments.fragile)
forms
helpers
import hashlib import json import uuid from urllib.parse import urljoin, urlparse import hashids import requests import werkzeug.datastructures from flask import g, jsonify, request from flask_login import current_user from formspree import settings from formspree.stuff import DB, redis_store CAPTCHA_URL = "https://www.google.com/recaptcha/api/siteverify" CAPTCHA_VAL = "g-recaptcha-response" HASH = lambda x, y: hashlib.md5( x.encode("utf-8") + y.encode("utf-8") + settings.NONCE_SECRET ).hexdigest() KEYS_NOT_STORED = {"_gotcha", "_format", "_language", CAPTCHA_VAL, "_host_nonce"} KEYS_EXCLUDED_FROM_EMAIL = KEYS_NOT_STORED.union({"_subject", "_cc", "_next"}) REDIS_COUNTER_KEY = "monthly_{form_id}_{month}".format REDIS_HOSTNAME_KEY = "hostname_{nonce}".format REDIS_FIRSTSUBMISSION_KEY = "first_{nonce}".format HASHIDS_CODEC = hashids.Hashids( alphabet="abcdefghijklmnopqrstuvwxyz", min_length=8, salt=settings.HASHIDS_SALT ) def ordered_storage(f): """ By default Flask doesn't maintain order of form arguments, pretty crazy From: https://gist.github.com/cbsmith/5069769 """ def decorator(*args, **kwargs): request.parameter_storage_class = ( werkzeug.datastructures.ImmutableOrderedMultiDict ) return f(*args, **kwargs) return decorator def referrer_to_path(r): if not r: return "" parsed = urlparse(r) n = parsed.netloc + parsed.path return n def referrer_to_baseurl(r): if not r: return "" parsed = urlparse(r) n = parsed.netloc return n def http_form_to_dict(data): """ Forms are ImmutableMultiDicts, convert to json-serializable version """ ret = {} ordered_keys = [] for elem in data.items(multi=True): if not elem[0] in ret.keys(): ret[elem[0]] = [] ordered_keys.append(elem[0]) ret[elem[0]].append(elem[1]) for k, v in ret.items(): ret[k] = ", ".join(v) return ret, ordered_keys def remove_www(host): if host.startswith("www."): return host[4:] return host def sitewide_file_check(url, email): if not url.startswith("http://") and not url.startswith("https://"): url = "http://" + url url = urljoin(url, "/formspree-verify.txt") g.log = g.log.bind(url=url, email=email) try: res = requests.get( url, timeout=3, headers={ "User-Agent": "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/55.0.2883.87 Chrome/55.0.2883.87 Safari/537.36" }, ) if not res.ok: g.log.debug("Sitewide file not found.", contents=res.text[:100]) return False for line in res.text.splitlines(): line = line.strip("\xef\xbb\xbf ") if line == email: g.log.debug("Email found in sitewide file.") return True except requests.exceptions.ConnectionError: pass return False def verify_captcha(form_data, request): if not CAPTCHA_VAL in form_data: return False r = requests.post( CAPTCHA_URL, data={ "secret": settings.RECAPTCHA_SECRET, "response": form_data[CAPTCHA_VAL], "remoteip": request.remote_addr, }, timeout=2, ) return r.ok and r.json().get("success") def assign_ajax(form, sent_using_ajax): if form.uses_ajax is None: form.uses_ajax = sent_using_ajax DB.session.add(form) DB.session.commit() def temp_store_hostname(hostname, referrer): nonce = uuid.uuid4() key = REDIS_HOSTNAME_KEY(nonce=nonce) redis_store.set(key, hostname + "," + referrer) redis_store.expire(key, 300000) return nonce def get_temp_hostname(nonce): key = REDIS_HOSTNAME_KEY(nonce=nonce) value = redis_store.get(key) if value is None: raise KeyError("no temp_hostname stored.") redis_store.delete(key) values = value.decode("utf-8").split(",") if len(values) != 2: raise ValueError("temp_hostname value is invalid: " + value) else: return values def store_first_submission(nonce, data): key = REDIS_FIRSTSUBMISSION_KEY(nonce=nonce) redis_store.set(key, json.dumps(data)) redis_store.expire(key, 300000) def fetch_first_submission(nonce): key = REDIS_FIRSTSUBMISSION_KEY(nonce=nonce) jsondata = redis_store.get(key) try: return json.loads(jsondata.decode("utf-8")) except: return None
utils
version
# SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # SPDX-License-Identifier: GPL-3.0-or-later """Utilities to show various version information.""" import configparser import dataclasses import datetime import enum import functools import getpass import glob import importlib import importlib.metadata import os.path import pathlib import platform import re import subprocess import sys from typing import ( TYPE_CHECKING, Any, ClassVar, Dict, Mapping, Optional, Sequence, Tuple, ) from qutebrowser.qt import machinery from qutebrowser.qt.core import PYQT_VERSION_STR from qutebrowser.qt.gui import QOffscreenSurface, QOpenGLContext from qutebrowser.qt.network import QSslSocket from qutebrowser.qt.opengl import QOpenGLVersionProfile from qutebrowser.qt.widgets import QApplication try: from qutebrowser.qt.webkit import qWebKitVersion except ImportError: # pragma: no cover qWebKitVersion = None # type: ignore[assignment] # noqa: N816 try: from qutebrowser.qt.webenginecore import PYQT_WEBENGINE_VERSION_STR except ImportError: # pragma: no cover # QtWebKit PYQT_WEBENGINE_VERSION_STR = None # type: ignore[assignment] import qutebrowser from qutebrowser.browser import pdfjs from qutebrowser.config import config from qutebrowser.misc import earlyinit, elf, httpclient, objects, pastebin, sql from qutebrowser.utils import ( log, message, qtutils, resources, standarddir, usertypes, utils, ) if TYPE_CHECKING: from qutebrowser.config import websettings _LOGO = r''' ______ ,, ,.-"` | ,-` | .^ || | / ,-*^| || | ; / | || ;-*```^*. ; ; | |;,-*` \ | | | ,-*` ,-"""\ \ | \ ,-"` ,-^`| \ | \ `^^ ,-;| | ; | *; ,-*` || | / ;; `^^`` | || | ,^ / | || `^^` ,^ | _,"| _,-" -*` ****"""`` ''' @dataclasses.dataclass class DistributionInfo: """Information about the running distribution.""" id: Optional[str] parsed: "Distribution" pretty: str pastebin_url = None class Distribution(enum.Enum): """A known Linux distribution. Usually lines up with ID=... in /etc/os-release. """ unknown = enum.auto() ubuntu = enum.auto() debian = enum.auto() void = enum.auto() arch = enum.auto() # includes rolling-release derivatives gentoo = enum.auto() # includes funtoo fedora = enum.auto() opensuse = enum.auto() linuxmint = enum.auto() manjaro = enum.auto() kde_flatpak = enum.auto() # org.kde.Platform neon = enum.auto() nixos = enum.auto() alpine = enum.auto() solus = enum.auto() def _parse_os_release() -> Optional[Dict[str, str]]: """Parse an /etc/os-release file.""" filename = os.environ.get("QUTE_FAKE_OS_RELEASE", "/etc/os-release") info = {} try: with open(filename, "r", encoding="utf-8") as f: for line in f: line = line.strip() if (not line) or line.startswith("#") or "=" not in line: continue k, v = line.split("=", maxsplit=1) info[k] = v.strip('"') except (OSError, UnicodeDecodeError): return None return info def distribution() -> Optional[DistributionInfo]: """Get some information about the running Linux distribution. Returns: A DistributionInfo object, or None if no info could be determined. parsed: A Distribution enum member pretty: Always a string (might be "Unknown") """ info = _parse_os_release() if info is None: return None pretty = info.get("PRETTY_NAME", None) if pretty in ["Linux", None]: # Funtoo has PRETTY_NAME=Linux pretty = info.get("NAME", "Unknown") assert pretty is not None dist_id = info.get("ID", None) id_mappings = { "funtoo": "gentoo", # does not have ID_LIKE=gentoo "artix": "arch", "org.kde.Platform": "kde_flatpak", } ids = [] if dist_id is not None: ids.append(id_mappings.get(dist_id, dist_id)) if "ID_LIKE" in info: ids.extend(info["ID_LIKE"].split()) parsed = Distribution.unknown for cur_id in ids: try: parsed = Distribution[cur_id] except KeyError: pass else: break return DistributionInfo(parsed=parsed, pretty=pretty, id=dist_id) def is_flatpak() -> bool: """Whether qutebrowser is running via Flatpak. If packaged via Flatpak, the environment is has restricted access to the host system. """ return flatpak_id() is not None _FLATPAK_INFO_PATH = "/.flatpak-info" def flatpak_id() -> Optional[str]: """Get the ID of the currently running Flatpak (or None if outside of Flatpak).""" if "FLATPAK_ID" in os.environ: return os.environ["FLATPAK_ID"] # 'FLATPAK_ID' was only added in Flatpak 1.2.0: # https://lists.freedesktop.org/archives/flatpak/2019-January/001464.html # but e.g. Ubuntu 18.04 ships 1.0.9. info_file = pathlib.Path(_FLATPAK_INFO_PATH) if not info_file.exists(): return None parser = configparser.ConfigParser() parser.read(info_file) return parser["Application"]["name"] def _git_str() -> Optional[str]: """Try to find out git version. Return: string containing the git commit ID. None if there was an error or we're not in a git repo. """ # First try via subprocess if possible commit = None if not hasattr(sys, "frozen"): try: gitpath = os.path.join( os.path.dirname(os.path.realpath(__file__)), os.path.pardir, os.path.pardir, ) except (NameError, OSError): log.misc.exception("Error while getting git path") else: commit = _git_str_subprocess(gitpath) if commit is not None: return commit # If that fails, check the git-commit-id file. try: return resources.read_file("git-commit-id") except (OSError, ImportError): return None def _call_git(gitpath: str, *args: str) -> str: """Call a git subprocess.""" return ( subprocess.run( ["git"] + list(args), cwd=gitpath, check=True, stdout=subprocess.PIPE ) .stdout.decode("UTF-8") .strip() ) def _git_str_subprocess(gitpath: str) -> Optional[str]: """Try to get the git commit ID and timestamp by calling git. Args: gitpath: The path where the .git folder is. Return: The ID/timestamp on success, None on failure. """ if not os.path.isdir(os.path.join(gitpath, ".git")): return None try: # https://stackoverflow.com/questions/21017300/21017394#21017394 commit_hash = _call_git( gitpath, "describe", "--match=NeVeRmAtCh", "--always", "--dirty" ) date = _call_git(gitpath, "show", "-s", "--format=%ci", "HEAD") branch = _call_git(gitpath, "rev-parse", "--abbrev-ref", "HEAD") return "{} on {} ({})".format(commit_hash, branch, date) except (subprocess.CalledProcessError, OSError): return None def _release_info() -> Sequence[Tuple[str, str]]: """Try to gather distribution release information. Return: list of (filename, content) tuples. """ blacklisted = ["ANSI_COLOR=", "HOME_URL=", "SUPPORT_URL=", "BUG_REPORT_URL="] data = [] for fn in glob.glob("/etc/*-release"): lines = [] try: with open(fn, "r", encoding="utf-8") as f: for line in f.read().strip().splitlines(): if not any(line.startswith(bl) for bl in blacklisted): lines.append(line) if lines: data.append((fn, "\n".join(lines))) except OSError: log.misc.exception("Error while reading {}.".format(fn)) return data class ModuleInfo: """Class to query version information of qutebrowser dependencies. Attributes: name: Name of the module as it is imported. _version_attributes: Sequence of attribute names belonging to the module which may hold version information. min_version: Minimum version of this module which qutebrowser can use. _installed: Is the module installed? Determined at runtime. _version: Version of the module. Determined at runtime. _initialized: Set to `True` if the `self._installed` and `self._version` attributes have been set. """ def __init__( self, name: str, version_attributes: Sequence[str], min_version: Optional[str] = None, ): self.name = name self._version_attributes = version_attributes self.min_version = min_version self._installed = False self._version: Optional[str] = None self._initialized = False def _reset_cache(self) -> None: """Reset the version cache. It is necessary to call this method in unit tests that mock a module's version number. """ self._installed = False self._version = None self._initialized = False def _initialize_info(self) -> None: """Import module and set `self.installed` and `self.version`.""" try: module = importlib.import_module(self.name) except (ImportError, ValueError): self._installed = False return else: self._installed = True for attribute_name in self._version_attributes: if hasattr(module, attribute_name): version = getattr(module, attribute_name) assert isinstance(version, (str, float)) self._version = str(version) break self._initialized = True def get_version(self) -> Optional[str]: """Finds the module version if it exists.""" if not self._initialized: self._initialize_info() return self._version def is_installed(self) -> bool: """Checks whether the module is installed.""" if not self._initialized: self._initialize_info() return self._installed def is_outdated(self) -> Optional[bool]: """Checks whether the module is outdated. Return: A boolean when the version and minimum version are both defined. Otherwise `None`. """ version = self.get_version() if not self.is_installed() or version is None or self.min_version is None: return None return version < self.min_version def is_usable(self) -> bool: """Whether the module is both installed and not outdated.""" return self.is_installed() and not self.is_outdated() def __str__(self) -> str: if not self.is_installed(): return f"{self.name}: no" version = self.get_version() if version is None: return f"{self.name}: yes" text = f"{self.name}: {version}" if self.is_outdated(): text += f" (< {self.min_version}, outdated)" return text def _create_module_info() -> Dict[str, ModuleInfo]: packages = [ ("colorama", ["VERSION", "__version__"]), ("jinja2", ["__version__"]), ("pygments", ["__version__"]), ("yaml", ["__version__"]), ("adblock", ["__version__"], "0.3.2"), ("objc", ["__version__"]), ] if machinery.IS_QT5: packages += [ ("PyQt5.QtWebEngineWidgets", []), ("PyQt5.QtWebEngine", ["PYQT_WEBENGINE_VERSION_STR"]), ("PyQt5.QtWebKitWidgets", []), ("PyQt5.sip", ["SIP_VERSION_STR"]), ] elif machinery.IS_QT6: packages += [ ("PyQt6.QtWebEngineCore", ["PYQT_WEBENGINE_VERSION_STR"]), ("PyQt6.sip", ["SIP_VERSION_STR"]), ] else: raise utils.Unreachable() # Mypy doesn't understand this. See https://github.com/python/mypy/issues/9706 return { name: ModuleInfo(name, *args) # type: ignore[arg-type, misc] for (name, *args) in packages } MODULE_INFO: Mapping[str, ModuleInfo] = _create_module_info() def _module_versions() -> Sequence[str]: """Get versions of optional modules. Return: A list of lines with version info. """ return [str(mod_info) for mod_info in MODULE_INFO.values()] def _path_info() -> Mapping[str, str]: """Get info about important path names. Return: A dictionary of descriptive to actual path names. """ info = { "config": standarddir.config(), "data": standarddir.data(), "cache": standarddir.cache(), "runtime": standarddir.runtime(), } if standarddir.config() != standarddir.config(auto=True): info["auto config"] = standarddir.config(auto=True) if standarddir.data() != standarddir.data(system=True): info["system data"] = standarddir.data(system=True) return info def _os_info() -> Sequence[str]: """Get operating system info. Return: A list of lines with version info. """ lines = [] releaseinfo = None if utils.is_linux: osver = "" releaseinfo = _release_info() elif utils.is_windows: osver = ", ".join(platform.win32_ver()) elif utils.is_mac: release, info_tpl, machine = platform.mac_ver() if all(not e for e in info_tpl): versioninfo = "" else: versioninfo = ".".join(info_tpl) osver = ", ".join(e for e in [release, versioninfo, machine] if e) elif utils.is_posix: osver = " ".join(platform.uname()) else: osver = "?" lines.append("OS Version: {}".format(osver)) if releaseinfo is not None: for fn, data in releaseinfo: lines += ["", "--- {} ---".format(fn), data] return lines def _pdfjs_version() -> str: """Get the pdf.js version. Return: A string with the version number. """ try: pdfjs_file, file_path = pdfjs.get_pdfjs_res_and_path("build/pdf.js") except pdfjs.PDFJSNotFound: return "no" else: pdfjs_file = pdfjs_file.decode("utf-8") version_re = re.compile( r"^ *(PDFJS\.version|(var|const) pdfjsVersion) = '(?P<version>[^']+)';$", re.MULTILINE, ) match = version_re.search(pdfjs_file) pdfjs_version = "unknown" if not match else match.group("version") if file_path is None: file_path = "bundled" return "{} ({})".format(pdfjs_version, file_path) def _get_pyqt_webengine_qt_version() -> Optional[str]: """Get the version of the PyQtWebEngine-Qt package. With PyQtWebEngine 5.15.3, the QtWebEngine binary got split into its own PyQtWebEngine-Qt PyPI package: https://www.riverbankcomputing.com/pipermail/pyqt/2021-February/043591.html https://www.riverbankcomputing.com/pipermail/pyqt/2021-February/043638.html PyQtWebEngine 5.15.4 renamed it to PyQtWebEngine-Qt5...: https://www.riverbankcomputing.com/pipermail/pyqt/2021-March/043699.html Here, we try to use importlib.metadata to figure out that version number. If PyQtWebEngine is installed via pip, this will give us an accurate answer. """ names = ( ["PyQt6-WebEngine-Qt6"] if machinery.IS_QT6 else ["PyQtWebEngine-Qt5", "PyQtWebEngine-Qt"] ) for name in names: try: return importlib.metadata.version(name) except importlib.metadata.PackageNotFoundError: log.misc.debug(f"{name} not found") return None @dataclasses.dataclass class WebEngineVersions: """Version numbers for QtWebEngine and the underlying Chromium.""" webengine: utils.VersionNumber chromium: Optional[str] source: str chromium_major: Optional[int] = dataclasses.field(init=False) _CHROMIUM_VERSIONS: ClassVar[Dict[utils.VersionNumber, str]] = { # ====== UNSUPPORTED ===== # Qt 5.12: Chromium 69 # (LTS) 69.0.3497.128 (~2018-09-11) # 5.12.10: Security fixes up to 86.0.4240.75 (2020-10-06) # Qt 5.13: Chromium 73 # 73.0.3683.105 (~2019-02-28) # 5.13.2: Security fixes up to 77.0.3865.120 (2019-10-10) # Qt 5.14: Chromium 77 # 77.0.3865.129 (~2019-10-10) # 5.14.2: Security fixes up to 80.0.3987.132 (2020-03-03) # Qt 5.15: Chromium 80 # 80.0.3987.163 (2020-04-02) # 5.15.0: Security fixes up to 81.0.4044.138 (2020-05-05) # 5.15.1: Security fixes up to 85.0.4183.83 (2020-08-25) # ====== SUPPORTED ===== # Qt 5.15.2: Chromium 83 # 83.0.4103.122 (~2020-06-24) # 5.15.2: Security fixes up to 86.0.4240.183 (2020-11-02) utils.VersionNumber(5, 15, 2): "83.0.4103.122", # Qt 5.15.3: Chromium 87 # 87.0.4280.144 (~2020-12-02) # 5.15.3: Security fixes up to 88.0.4324.150 (2021-02-04) # 5.15.4: Security fixes up to ??? # 5.15.5: Security fixes up to ??? # 5.15.6: Security fixes up to ??? # 5.15.7: Security fixes up to 94.0.4606.61 (2021-09-24) # 5.15.8: Security fixes up to 96.0.4664.110 (2021-12-13) # 5.15.9: Security fixes up to 98.0.4758.102 (2022-02-14) # 5.15.10: Security fixes up to ??? # 5.15.11: Security fixes up to ??? utils.VersionNumber(5, 15): "87.0.4280.144", # >= 5.15.3 # Qt 6.2: Chromium 90 # 90.0.4430.228 (2021-06-22) # 6.2.0: Security fixes up to 93.0.4577.63 (2021-08-31) # 6.2.1: Security fixes up to 94.0.4606.61 (2021-09-24) # 6.2.2: Security fixes up to 96.0.4664.45 (2021-11-15) # 6.2.3: Security fixes up to 96.0.4664.45 (2021-11-15) # 6.2.4: Security fixes up to 98.0.4758.102 (2022-02-14) # 6.2.5: Security fixes up to ??? # 6.2.6: Security fixes up to ??? # 6.2.7: Security fixes up to ??? utils.VersionNumber(6, 2): "90.0.4430.228", # Qt 6.3: Chromium 94 # 94.0.4606.126 (2021-11-17) # 6.3.0: Security fixes up to 99.0.4844.84 (2022-03-25) # 6.3.1: Security fixes up to 101.0.4951.64 (2022-05-10) # 6.3.2: Security fixes up to 104.0.5112.81 (2022-08-01) utils.VersionNumber(6, 3): "94.0.4606.126", # Qt 6.4: Chromium 102 # 102.0.5005.177 (~2022-05-24) # 6.4.0: Security fixes up to 104.0.5112.102 (2022-08-16) # 6.4.1: Security fixes up to 107.0.5304.88 (2022-10-27) # 6.4.2: Security fixes up to 108.0.5359.94 (2022-12-02) # 6.4.3: Security fixes up to 110.0.5481.78 (2023-02-07) utils.VersionNumber(6, 4): "102.0.5005.177", # Qt 6.5: Chromium 108 # 108.0.5359.220 (~2022-12-23) # (.220 claimed by code, .181 claimed by CHROMIUM_VERSION) # 6.5.0: Security fixes up to 110.0.5481.104 (2023-02-16) # 6.5.1: Security fixes up to 112.0.5615.138 (2023-04-18) # 6.5.2: Security fixes up to 114.0.5735.133 (2023-06-13) utils.VersionNumber(6, 5): "108.0.5359.220", # Qt 6.6: Chromium 112 # 112.0.5615.213 (~2023-04-18) # 6.6.0: Security fixes up to 116.0.5845.110 (?) (2023-08-22) utils.VersionNumber(6, 6): "112.0.5615.213", } def __post_init__(self) -> None: """Set the major Chromium version.""" if self.chromium is None: self.chromium_major = None else: self.chromium_major = int(self.chromium.split(".")[0]) def __str__(self) -> str: s = f"QtWebEngine {self.webengine}" if self.chromium is not None: s += f", based on Chromium {self.chromium}" if self.source != "UA": s += f" (from {self.source})" return s @classmethod def from_ua(cls, ua: "websettings.UserAgent") -> "WebEngineVersions": """Get the versions parsed from a user agent. This is the most reliable and "default" way to get this information (at least until QtWebEngine adds an API for it). However, it needs a fully initialized QtWebEngine, and we sometimes need this information before that is available. """ assert ua.qt_version is not None, ua return cls( webengine=utils.VersionNumber.parse(ua.qt_version), chromium=ua.upstream_browser_version, source="UA", ) @classmethod def from_elf(cls, versions: elf.Versions) -> "WebEngineVersions": """Get the versions based on an ELF file. This only works on Linux, and even there, depends on various assumption on how QtWebEngine is built (e.g. that the version string is in the .rodata section). On Windows/macOS, we instead rely on from_pyqt, but especially on Linux, people sometimes mix and match Qt/QtWebEngine versions, so this is a more reliable (though hackish) way to get a more accurate result. """ return cls( webengine=utils.VersionNumber.parse(versions.webengine), chromium=versions.chromium, source="ELF", ) @classmethod def _infer_chromium_version( cls, pyqt_webengine_version: utils.VersionNumber, ) -> Optional[str]: """Infer the Chromium version based on the PyQtWebEngine version.""" chromium_version = cls._CHROMIUM_VERSIONS.get(pyqt_webengine_version) if chromium_version is not None: return chromium_version # 5.15 patch versions change their QtWebEngine version, but no changes are # expected after 5.15.3 and 5.15.[01] are unsupported. if pyqt_webengine_version == utils.VersionNumber(5, 15, 2): minor_version = pyqt_webengine_version else: # e.g. 5.14.2 -> 5.14 minor_version = pyqt_webengine_version.strip_patch() return cls._CHROMIUM_VERSIONS.get(minor_version) @classmethod def from_api(cls, qtwe_version: str, chromium_version: str) -> "WebEngineVersions": """Get the versions based on the exact versions. This is called if we have proper APIs to get the versions easily (Qt 6.2 with PyQt 6.3.1+). """ parsed = utils.VersionNumber.parse(qtwe_version) return cls( webengine=parsed, chromium=chromium_version, source="api", ) @classmethod def from_webengine( cls, pyqt_webengine_qt_version: str, source: str, ) -> "WebEngineVersions": """Get the versions based on the PyQtWebEngine version. This is called if we don't want to fully initialize QtWebEngine (so from_ua isn't possible), we're not on Linux (or ELF parsing failed), but we have a PyQtWebEngine-Qt{,5} package from PyPI, so we could query its exact version. """ parsed = utils.VersionNumber.parse(pyqt_webengine_qt_version) return cls( webengine=parsed, chromium=cls._infer_chromium_version(parsed), source=source, ) @classmethod def from_pyqt( cls, pyqt_webengine_version: str, source: str = "PyQt" ) -> "WebEngineVersions": """Get the versions based on the PyQtWebEngine version. This is the "last resort" if we don't want to fully initialize QtWebEngine (so from_ua isn't possible), we're not on Linux (or ELF parsing failed), and PyQtWebEngine-Qt{5,} isn't available from PyPI. Here, we assume that the PyQtWebEngine version is the same as the QtWebEngine version, and infer the Chromium version from that. This assumption isn't generally true, but good enough for some scenarios, especially the prebuilt Windows/macOS releases. """ parsed = utils.VersionNumber.parse(pyqt_webengine_version) if utils.VersionNumber(5, 15, 3) <= parsed < utils.VersionNumber(6): # If we land here, we're in a tricky situation where we are forced to guess: # # PyQt 5.15.3 and 5.15.4 from PyPI come with QtWebEngine 5.15.2 (Chromium # 83), not 5.15.3 (Chromium 87). Given that there was no binary release of # QtWebEngine 5.15.3, this is unlikely to change before Qt 6. # # However, at this point: # # - ELF parsing failed # (so we're likely on macOS or Windows, but not definitely) # # - Getting infos from a PyPI-installed PyQtWebEngine failed # (so we're either in a PyInstaller-deployed qutebrowser, or a self-built # or distribution-installed Qt) # # PyQt 5.15.3 and 5.15.4 come with QtWebEngine 5.15.2 (83-based), but if # someone lands here with the last Qt/PyQt installed from source, they might # be using QtWebEngine 5.15.3 (87-based). For now, we play it safe, and only # do this kind of "downgrade" when we know we're using PyInstaller. frozen = hasattr(sys, "frozen") log.misc.debug(f"PyQt5 >= 5.15.3, frozen {frozen}") if frozen: parsed = utils.VersionNumber(5, 15, 2) return cls( webengine=parsed, chromium=cls._infer_chromium_version(parsed), source=source, ) def qtwebengine_versions(*, avoid_init: bool = False) -> WebEngineVersions: """Get the QtWebEngine and Chromium version numbers. If we have a parsed user agent, we use it here. If not, we avoid initializing things at all costs (because this gets called early to find out about commandline arguments). Instead, we fall back on looking at the ELF file (on Linux), or, if that fails, use the PyQtWebEngine version. This can also be checked by looking at this file with the right Qt tag: https://code.qt.io/cgit/qt/qtwebengine.git/tree/tools/scripts/version_resolver.py#n41 See WebEngineVersions above for a quick reference. Also see: - https://chromiumdash.appspot.com/schedule - https://www.chromium.org/developers/calendar - https://chromereleases.googleblog.com/ """ override = os.environ.get("QUTE_QTWEBENGINE_VERSION_OVERRIDE") if override is not None: return WebEngineVersions.from_pyqt(override, source="override") if machinery.IS_QT6: try: from qutebrowser.qt.webenginecore import ( qWebEngineChromiumVersion, qWebEngineVersion, ) except ImportError: pass # Needs QtWebEngine 6.2+ with PyQtWebEngine 6.3.1+ else: return WebEngineVersions.from_api( qtwe_version=qWebEngineVersion(), chromium_version=qWebEngineChromiumVersion(), ) from qutebrowser.browser.webengine import webenginesettings if webenginesettings.parsed_user_agent is None and not avoid_init: webenginesettings.init_user_agent() if webenginesettings.parsed_user_agent is not None: return WebEngineVersions.from_ua(webenginesettings.parsed_user_agent) versions = elf.parse_webenginecore() if versions is not None: return WebEngineVersions.from_elf(versions) pyqt_webengine_qt_version = _get_pyqt_webengine_qt_version() if pyqt_webengine_qt_version is not None: return WebEngineVersions.from_webengine( pyqt_webengine_qt_version, source="importlib" ) assert PYQT_WEBENGINE_VERSION_STR is not None return WebEngineVersions.from_pyqt(PYQT_WEBENGINE_VERSION_STR) def _backend() -> str: """Get the backend line with relevant information.""" if objects.backend == usertypes.Backend.QtWebKit: return "new QtWebKit (WebKit {})".format(qWebKitVersion()) elif objects.backend == usertypes.Backend.QtWebEngine: return str( qtwebengine_versions( avoid_init="avoid-chromium-init" in objects.debug_flags ) ) raise utils.Unreachable(objects.backend) def _uptime() -> datetime.timedelta: time_delta = datetime.datetime.now() - objects.qapp.launch_time # Round off microseconds time_delta -= datetime.timedelta(microseconds=time_delta.microseconds) return time_delta def _autoconfig_loaded() -> str: return "yes" if config.instance.yaml_loaded else "no" def _config_py_loaded() -> str: if config.instance.config_py_loaded: return "{} has been loaded".format(standarddir.config_py()) else: return "no config.py was loaded" def version_info() -> str: """Return a string with various version information.""" lines = _LOGO.lstrip("\n").splitlines() lines.append("qutebrowser v{}".format(qutebrowser.__version__)) gitver = _git_str() if gitver is not None: lines.append("Git commit: {}".format(gitver)) lines.append("Backend: {}".format(_backend())) lines.append("Qt: {}".format(earlyinit.qt_version())) lines += [ "", "{}: {}".format(platform.python_implementation(), platform.python_version()), "PyQt: {}".format(PYQT_VERSION_STR), "", str(machinery.INFO), "", ] lines += _module_versions() lines += [ "pdf.js: {}".format(_pdfjs_version()), "sqlite: {}".format(sql.version()), "QtNetwork SSL: {}\n".format( QSslSocket.sslLibraryVersionString() if QSslSocket.supportsSsl() else "no" ), ] if objects.qapp: style = objects.qapp.style() assert style is not None metaobj = style.metaObject() assert metaobj is not None lines.append("Style: {}".format(metaobj.className())) lines.append("Platform plugin: {}".format(objects.qapp.platformName())) lines.append("OpenGL: {}".format(opengl_info())) importpath = os.path.dirname(os.path.abspath(qutebrowser.__file__)) lines += [ "Platform: {}, {}".format(platform.platform(), platform.architecture()[0]), ] dist = distribution() if dist is not None: lines += ["Linux distribution: {} ({})".format(dist.pretty, dist.parsed.name)] lines += [ "Frozen: {}".format(hasattr(sys, "frozen")), "Imported from {}".format(importpath), "Using Python from {}".format(sys.executable), "Qt library executable path: {}, data path: {}".format( qtutils.library_path(qtutils.LibraryPath.library_executables), qtutils.library_path(qtutils.LibraryPath.data), ), ] if not dist or dist.parsed == Distribution.unknown: lines += _os_info() lines += [ "", "Paths:", ] for name, path in sorted(_path_info().items()): lines += ["{}: {}".format(name, path)] lines += [ "", "Autoconfig loaded: {}".format(_autoconfig_loaded()), "Config.py: {}".format(_config_py_loaded()), "Uptime: {}".format(_uptime()), ] return "\n".join(lines) @dataclasses.dataclass class OpenGLInfo: """Information about the OpenGL setup in use.""" # If we're using OpenGL ES. If so, no further information is available. gles: bool = False # The name of the vendor. Examples: # - nouveau # - "Intel Open Source Technology Center", "Intel", "Intel Inc." vendor: Optional[str] = None # The OpenGL version as a string. See tests for examples. version_str: Optional[str] = None # The parsed version as a (major, minor) tuple of ints version: Optional[Tuple[int, ...]] = None # The vendor specific information following the version number vendor_specific: Optional[str] = None def __str__(self) -> str: if self.gles: return "OpenGL ES" return "{}, {}".format(self.vendor, self.version_str) @classmethod def parse(cls, *, vendor: str, version: str) -> "OpenGLInfo": """Parse OpenGL version info from a string. The arguments should be the strings returned by OpenGL for GL_VENDOR and GL_VERSION, respectively. According to the OpenGL reference, the version string should have the following format: <major>.<minor>[.<release>] <vendor-specific info> """ if " " not in version: log.misc.warning( "Failed to parse OpenGL version (missing space): " "{}".format(version) ) return cls(vendor=vendor, version_str=version) num_str, vendor_specific = version.split(" ", maxsplit=1) try: parsed_version = tuple(int(i) for i in num_str.split(".")) except ValueError: log.misc.warning( "Failed to parse OpenGL version (parsing int): " "{}".format(version) ) return cls(vendor=vendor, version_str=version) return cls( vendor=vendor, version_str=version, version=parsed_version, vendor_specific=vendor_specific, ) @functools.lru_cache(maxsize=1) def opengl_info() -> Optional[OpenGLInfo]: # pragma: no cover """Get the OpenGL vendor used. This returns a string such as 'nouveau' or 'Intel Open Source Technology Center'; or None if the vendor can't be determined. """ assert QApplication.instance() override = os.environ.get("QUTE_FAKE_OPENGL") if override is not None: log.init.debug("Using override {}".format(override)) vendor, version = override.split(", ", maxsplit=1) return OpenGLInfo.parse(vendor=vendor, version=version) old_context: Optional[QOpenGLContext] = QOpenGLContext.currentContext() old_surface = None if old_context is None else old_context.surface() surface = QOffscreenSurface() surface.create() ctx = QOpenGLContext() ok = ctx.create() if not ok: log.init.debug("Creating context failed!") return None ok = ctx.makeCurrent(surface) if not ok: log.init.debug("Making context current failed!") return None try: if ctx.isOpenGLES(): # Can't use versionFunctions there return OpenGLInfo(gles=True) vp = QOpenGLVersionProfile() vp.setVersion(2, 0) try: if machinery.IS_QT5: vf = ctx.versionFunctions(vp) else: # Qt 6 from qutebrowser.qt.opengl import QOpenGLVersionFunctionsFactory vf: Any = QOpenGLVersionFunctionsFactory.get(vp, ctx) except ImportError as e: log.init.debug("Importing version functions failed: {}".format(e)) return None if vf is None: log.init.debug("Getting version functions failed!") return None # FIXME:mypy PyQt6-stubs issue? vendor = vf.glGetString(vf.GL_VENDOR) version = vf.glGetString(vf.GL_VERSION) return OpenGLInfo.parse(vendor=vendor, version=version) finally: ctx.doneCurrent() if old_context and old_surface: old_context.makeCurrent(old_surface) def pastebin_version(pbclient: pastebin.PastebinClient = None) -> None: """Pastebin the version and log the url to messages.""" def _yank_url(url: str) -> None: utils.set_clipboard(url) message.info("Version url {} yanked to clipboard.".format(url)) def _on_paste_version_success(url: str) -> None: assert pbclient is not None global pastebin_url url = url.strip() _yank_url(url) pbclient.deleteLater() pastebin_url = url def _on_paste_version_err(text: str) -> None: assert pbclient is not None message.error("Failed to pastebin version" " info: {}".format(text)) pbclient.deleteLater() if pastebin_url: _yank_url(pastebin_url) return app = QApplication.instance() http_client = httpclient.HTTPClient() misc_api = pastebin.PastebinClient.MISC_API_URL pbclient = pbclient or pastebin.PastebinClient( http_client, parent=app, api_url=misc_api ) pbclient.success.connect(_on_paste_version_success) pbclient.error.connect(_on_paste_version_err) pbclient.paste( getpass.getuser(), "qute version info {}".format(qutebrowser.__version__), version_info(), private=True, )
views
alert_receive_channel_template
from apps.alerts.models import AlertReceiveChannel from apps.api.permissions import RBACPermission from apps.api.serializers.alert_receive_channel import ( AlertReceiveChannelTemplatesSerializer, ) from apps.auth_token.auth import PluginAuthentication from common.api_helpers.mixins import PublicPrimaryKeyMixin, TeamFilteringMixin from common.insight_log import EntityEvent, write_resource_insight_log from common.jinja_templater.apply_jinja_template import JinjaTemplateError from rest_framework import mixins, status, viewsets from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response class AlertReceiveChannelTemplateView( TeamFilteringMixin, PublicPrimaryKeyMixin, mixins.RetrieveModelMixin, mixins.UpdateModelMixin, viewsets.GenericViewSet, ): authentication_classes = (PluginAuthentication,) permission_classes = (IsAuthenticated, RBACPermission) rbac_permissions = { "metadata": [RBACPermission.Permissions.INTEGRATIONS_READ], "list": [RBACPermission.Permissions.INTEGRATIONS_READ], "retrieve": [RBACPermission.Permissions.INTEGRATIONS_READ], "update": [RBACPermission.Permissions.INTEGRATIONS_WRITE], "partial_update": [RBACPermission.Permissions.INTEGRATIONS_WRITE], } model = AlertReceiveChannel serializer_class = AlertReceiveChannelTemplatesSerializer def get_queryset(self, ignore_filtering_by_available_teams=False): queryset = AlertReceiveChannel.objects.filter( organization=self.request.auth.organization, ) if not ignore_filtering_by_available_teams: queryset = queryset.filter(*self.available_teams_lookup_args).distinct() return queryset def update(self, request, *args, **kwargs): instance = self.get_object() prev_state = instance.insight_logs_serialized try: result = super().update(request, *args, **kwargs) except JinjaTemplateError as e: return Response(e.fallback_message, status.HTTP_400_BAD_REQUEST) instance = self.get_object() new_state = instance.insight_logs_serialized write_resource_insight_log( instance=instance, author=self.request.user, event=EntityEvent.UPDATED, prev_state=prev_state, new_state=new_state, ) return result
plugins
soundcloud
# -*- coding: utf-8 -*- # # gPodder - A media aggregator and podcast client # Copyright (c) 2005-2018 The gPodder Team # # gPodder is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # gPodder is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Soundcloud.com API client module for gPodder # Thomas Perl <thp@gpodder.org>; 2009-11-03 import json import logging import os import re import time import urllib.error import urllib.parse import urllib.request import gpodder from gpodder import feedcore, model, registry, util _ = gpodder.gettext # gPodder's consumer key for the Soundcloud API CONSUMER_KEY = "zrweghtEtnZLpXf3mlm8mQ" logger = logging.getLogger(__name__) def soundcloud_parsedate(s): """Parse a string into a unix timestamp Only strings provided by Soundcloud's API are parsed with this function (2009/11/03 13:37:00). """ m = re.match(r"(\d{4})/(\d{2})/(\d{2}) (\d{2}):(\d{2}):(\d{2})", s) return time.mktime(tuple([int(x) for x in m.groups()] + [0, 0, -1])) def get_metadata(url): """Get file download metadata Returns a (size, type, name) from the given download URL. Will use the network connection to determine the metadata via the HTTP header fields. """ track_response = util.urlopen(url) filesize = track_response.headers["content-length"] or "0" filetype = track_response.headers["content-type"] or "application/octet-stream" headers_s = "\n".join( "%s:%s" % (k, v) for k, v in list(track_response.headers.items()) ) filename = util.get_header_param( track_response.headers, "filename", "content-disposition" ) or os.path.basename(os.path.dirname(url)) track_response.close() return filesize, filetype, filename class SoundcloudUser(object): def __init__(self, username): self.username = username self.cache_file = os.path.join(gpodder.home, "Soundcloud") if os.path.exists(self.cache_file): try: self.cache = json.load(open(self.cache_file, "r")) except: self.cache = {} else: self.cache = {} def commit_cache(self): json.dump(self.cache, open(self.cache_file, "w")) def get_user_info(self): global CONSUMER_KEY key = ":".join((self.username, "user_info")) if key in self.cache: if self.cache[key].get("code", 200) == 200: return self.cache[key] try: # find user ID in soundcloud page url = "https://soundcloud.com/" + self.username r = util.urlopen(url) if not r.ok: raise Exception( 'Soundcloud "%s": %d %s' % (url, r.status_code, r.reason) ) uid = re.search(r'"https://api.soundcloud.com/users/([0-9]+)"', r.text) if not uid: raise Exception('Soundcloud user ID not found for "%s"' % url) uid = int(uid.group(1)) # load user info API json_url = "https://api.soundcloud.com/users/%d.json?consumer_key=%s" % ( uid, CONSUMER_KEY, ) r = util.urlopen(json_url) if not r.ok: raise Exception( 'Soundcloud "%s": %d %s' % (json_url, r.status_code, r.reason) ) user_info = json.loads(r.text) if user_info.get("code", 200) != 200: raise Exception( 'Soundcloud "%s": %s' % (json_url, user_info.get("message", "")) ) self.cache[key] = user_info finally: self.commit_cache() return user_info def get_coverart(self): user_info = self.get_user_info() return user_info.get("avatar_url", None) def get_user_id(self): user_info = self.get_user_info() return user_info.get("id", None) def get_tracks(self, feed): """Get a generator of tracks from a SC user The generator will give you a dictionary for every track it can find for its user.""" global CONSUMER_KEY try: json_url = ( "https://api.soundcloud.com/users/%(user)s/%(feed)s." "json?consumer_key=%" "(consumer_key)s&limit=200" % { "user": self.get_user_id(), "feed": feed, "consumer_key": CONSUMER_KEY, } ) logger.debug("loading %s", json_url) json_tracks = util.urlopen(json_url).json() tracks = [ track for track in json_tracks if track["streamable"] or track["downloadable"] ] total_count = len(json_tracks) if len(tracks) == 0 and total_count > 0: logger.warning( "Download of all %i %s of user %s is disabled" % (total_count, feed, self.username) ) else: logger.info( "%i/%i downloadable tracks for user %s %s feed" % (len(tracks), total_count, self.username, feed) ) for track in tracks: # Prefer stream URL (MP3), fallback to download URL base_url = ( track.get("stream_url") if track["streamable"] else track["download_url"] ) url = base_url + "?consumer_key=" + CONSUMER_KEY if url not in self.cache: try: self.cache[url] = get_metadata(url) except: continue filesize, filetype, filename = self.cache[url] yield { "title": track.get("title", track.get("permalink")) or _("Unknown track"), "link": track.get("permalink_url") or "https://soundcloud.com/" + self.username, "description": util.remove_html_tags( track.get("description") or "" ), "description_html": "", "url": url, "file_size": int(filesize), "mime_type": filetype, "guid": str(track.get("permalink", track.get("id"))), "published": soundcloud_parsedate(track.get("created_at", None)), } finally: self.commit_cache() class SoundcloudFeed(model.Feed): URL_REGEX = re.compile(r"https?://([a-z]+\.)?soundcloud\.com/([^/]+)$", re.I) @classmethod def fetch_channel(cls, channel, max_episodes=0): url = channel.authenticate_url(channel.url) return cls.handle_url(url, max_episodes) @classmethod def handle_url(cls, url, max_episodes): m = cls.URL_REGEX.match(url) if m is not None: subdomain, username = m.groups() return feedcore.Result(feedcore.UPDATED_FEED, cls(username, max_episodes)) def __init__(self, username, max_episodes): self.username = username self.sc_user = SoundcloudUser(username) self.max_episodes = max_episodes def get_title(self): return _("%s on Soundcloud") % self.username def get_cover_url(self): return self.sc_user.get_coverart() def get_link(self): return "https://soundcloud.com/%s" % self.username def get_description(self): return _("Tracks published by %s on Soundcloud.") % self.username def get_new_episodes(self, channel, existing_guids): return self._get_new_episodes(channel, existing_guids, "tracks") def get_next_page(self, channel, max_episodes=0): # one could return more, but it would consume too many api calls # (see PR #184) return None def _get_new_episodes(self, channel, existing_guids, track_type): tracks = list(self.sc_user.get_tracks(track_type)) if self.max_episodes > 0: tracks = tracks[: self.max_episodes] seen_guids = set(track["guid"] for track in tracks) episodes = [] for track in tracks: if track["guid"] not in existing_guids: episode = channel.episode_factory(track) episode.save() episodes.append(episode) return episodes, seen_guids class SoundcloudFavFeed(SoundcloudFeed): URL_REGEX = re.compile( r"https?://([a-z]+\.)?soundcloud\.com/([^/]+)/favorites", re.I ) def __init__(self, username): super(SoundcloudFavFeed, self).__init__(username) def get_title(self): return _("%s's favorites on Soundcloud") % self.username def get_link(self): return "https://soundcloud.com/%s/favorites" % self.username def get_description(self): return _("Tracks favorited by %s on Soundcloud.") % self.username def get_new_episodes(self, channel, existing_guids): return self._get_new_episodes(channel, existing_guids, "favorites") # Register our URL handlers registry.feed_handler.register(SoundcloudFeed.fetch_channel) registry.feed_handler.register(SoundcloudFavFeed.fetch_channel) def search_for_user(query): json_url = "https://api.soundcloud.com/users.json?q=%s&consumer_key=%s" % ( urllib.parse.quote(query), CONSUMER_KEY, ) return util.urlopen(json_url).json()
scripts
deps
"""Check the installation dependencies and report the version numbers of each. This is meant to be used as an error diagnostic tool. """ __copyright__ = "Copyright (C) 2016 Martin Blais" __license__ = "GNU GPLv2" import sys import types # pylint: disable=import-outside-toplevel def list_dependencies(file=sys.stderr): """Check the dependencies and produce a listing on the given file. Args: file: A file object to write the output to. """ print("Dependencies:") for package, version, sufficient in check_dependencies(): print( " {:16}: {} {}".format( package, version or "NOT INSTALLED", "(INSUFFICIENT)" if version and not sufficient else "", ), file=file, ) def check_dependencies(): """Check the runtime dependencies and report their version numbers. Returns: A list of pairs of (package-name, version-number, sufficient) whereby if a package has not been installed, its 'version-number' will be set to None. Otherwise, it will be a string with the version number in it. 'sufficient' will be True if the version if sufficient for this installation of Beancount. """ return [ # Check for a complete installation of Python itself. check_python(), check_cdecimal(), # Modules we really do need installed. check_import("dateutil"), check_import("ply", module_name="ply.yacc", min_version="3.4"), # Optionally required to upload data to Google Drive. check_import("googleapiclient"), check_import("oauth2client"), check_import("httplib2"), # Optionally required to support various price source fetchers. check_import("requests", min_version="2.0"), # Optionally required to support imports (identify, extract, file) code. check_python_magic(), ] def check_python(): """Check that Python 3.3 or above is installed. Returns: A triple of (package-name, version-number, sufficient) as per check_dependencies(). """ return ( "python3", ".".join(map(str, sys.version_info[:3])), sys.version_info[:2] >= (3, 3), ) def is_fast_decimal(decimal_module): "Return true if a fast C decimal implementation is installed." return isinstance(decimal_module.Decimal().sqrt, types.BuiltinFunctionType) def check_cdecimal(): """Check that Python 3.3 or above is installed. Returns: A triple of (package-name, version-number, sufficient) as per check_dependencies(). """ # Note: this code mirrors and should be kept in-sync with that at the top of # beancount.core.number. # Try the built-in installation. import decimal if is_fast_decimal(decimal): return ("cdecimal", "{} (built-in)".format(decimal.__version__), True) # Try an explicitly installed version. try: import cdecimal if is_fast_decimal(cdecimal): return ("cdecimal", getattr(cdecimal, "__version__", "OKAY"), True) except ImportError: pass # Not found. return ("cdecimal", None, False) def check_python_magic(): """Check that a recent-enough version of python-magic is installed. python-magic is an interface to libmagic, which is used by the 'file' tool and UNIX to identify file types. Note that there are two Python wrappers which provide the 'magic' import: python-magic and filemagic. The former is what we need, which appears to be more recently maintained. Returns: A triple of (package-name, version-number, sufficient) as per check_dependencies(). """ try: import magic # Check that python-magic and not filemagic is installed. if not hasattr(magic, "from_file"): # 'filemagic' is installed; install python-magic. raise ImportError return ("python-magic", "OK", True) except (ImportError, OSError): return ("python-magic", None, False) def check_import(package_name, min_version=None, module_name=None): """Check that a particular module name is installed. Args: package_name: A string, the name of the package and module to be imported to verify this works. This should have a __version__ attribute on it. min_version: If not None, a string, the minimum version number we require. module_name: The name of the module to import if it differs from the package name. Returns: A triple of (package-name, version-number, sufficient) as per check_dependencies(). """ if module_name is None: module_name = package_name try: __import__(module_name) module = sys.modules[module_name] if min_version is not None: version = module.__version__ assert isinstance(version, str) is_sufficient = ( parse_version(version) >= parse_version(min_version) if min_version else True ) else: version, is_sufficient = None, True except ImportError: version, is_sufficient = None, False return (package_name, version, is_sufficient) def parse_version(version_str: str) -> str: """Parse the version string into a comparable tuple.""" return [int(v) for v in version_str.split(".")] if __name__ == "__main__": list_dependencies(sys.stdout)
migrations
0021_checksum_algorithms
from django.db import migrations, models def data_migration(apps, schema_editor): File = apps.get_model("main", "File") DashboardSetting = apps.get_model("main", "DashboardSetting") StandardTaskConfig = apps.get_model("main", "StandardTaskConfig") File.objects.filter(checksumtype="").update(checksumtype="sha256") DashboardSetting.objects.create(name="checksum_type", value="sha256") StandardTaskConfig.objects.filter(id="045f84de-2669-4dbc-a31b-43a4954d0481").update( arguments='create "%SIPDirectory%%SIPName%-%SIPUUID%" "%SIPDirectory%" "logs/" "objects/" "METS.%SIPUUID%.xml" "thumbnails/" "metadata/" --writer filesystem' ) class Migration(migrations.Migration): dependencies = [("main", "0020_index_after_processing_decision")] operations = [ migrations.AddField( model_name="file", name="checksumtype", field=models.CharField(max_length=36, db_column="checksumType", blank=True), preserve_default=True, ), migrations.AlterField( model_name="file", name="checksum", field=models.CharField(max_length=128, db_column="checksum", blank=True), preserve_default=True, ), migrations.RunPython(data_migration), ]
mackup
utils
"""System static utilities being used by the modules.""" import base64 import os import platform import shutil import sqlite3 import stat import subprocess import sys from six.moves import input from . import constants # Flag that controls how user confirmation works. # If True, the user wants to say "yes" to everything. FORCE_YES = False # Flag that control if mackup can be run as root CAN_RUN_AS_ROOT = False def confirm(question): """ Ask the user if he really wants something to happen. Args: question(str): What can happen Returns: (boolean): Confirmed or not """ if FORCE_YES: return True while True: answer = input(question + " <Yes|No> ").lower() if answer == "yes" or answer == "y": confirmed = True break if answer == "no" or answer == "n": confirmed = False break return confirmed def delete(filepath): """ Delete the given file, directory or link. It Should support undelete later on. Args: filepath (str): Absolute full path to a file. e.g. /path/to/file """ # Some files have ACLs, let's remove them recursively remove_acl(filepath) # Some files have immutable attributes, let's remove them recursively remove_immutable_attribute(filepath) # Finally remove the files and folders if os.path.isfile(filepath) or os.path.islink(filepath): os.remove(filepath) elif os.path.isdir(filepath): shutil.rmtree(filepath) def copy(src, dst): """ Copy a file or a folder (recursively) from src to dst. For the sake of simplicity, both src and dst must be absolute path and must include the filename of the file or folder. Also do not include any trailing slash. e.g. copy('/path/to/src_file', '/path/to/dst_file') or copy('/path/to/src_folder', '/path/to/dst_folder') But not: copy('/path/to/src_file', 'path/to/') or copy('/path/to/src_folder/', '/path/to/dst_folder') Args: src (str): Source file or folder dst (str): Destination file or folder """ assert isinstance(src, str) assert os.path.exists(src) assert isinstance(dst, str) # Create the path to the dst file if it does not exist abs_path = os.path.dirname(os.path.abspath(dst)) if not os.path.isdir(abs_path): os.makedirs(abs_path) # We need to copy a single file if os.path.isfile(src): # Copy the src file to dst shutil.copy(src, dst) # We need to copy a whole folder elif os.path.isdir(src): shutil.copytree(src, dst) # What the heck is this? else: raise ValueError("Unsupported file: {}".format(src)) # Set the good mode to the file or folder recursively chmod(dst) def link(target, link_to): """ Create a link to a target file or a folder. For the sake of simplicity, both target and link_to must be absolute path and must include the filename of the file or folder. Also do not include any trailing slash. e.g. link('/path/to/file', '/path/to/link') But not: link('/path/to/file', 'path/to/') or link('/path/to/folder/', '/path/to/link') Args: target (str): file or folder the link will point to link_to (str): Link to create """ assert isinstance(target, str) assert os.path.exists(target) assert isinstance(link_to, str) # Create the path to the link if it does not exist abs_path = os.path.dirname(os.path.abspath(link_to)) if not os.path.isdir(abs_path): os.makedirs(abs_path) # Make sure the file or folder recursively has the good mode chmod(target) # Create the link to target os.symlink(target, link_to) def chmod(target): """ Recursively set the chmod for files to 0600 and 0700 for folders. It's ok unless we need something more specific. Args: target (str): Root file or folder """ assert isinstance(target, str) assert os.path.exists(target) file_mode = stat.S_IRUSR | stat.S_IWUSR folder_mode = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR # Remove the immutable attribute recursively if there is one remove_immutable_attribute(target) if os.path.isfile(target): os.chmod(target, file_mode) elif os.path.isdir(target): # chmod the root item os.chmod(target, folder_mode) # chmod recursively in the folder it it's one for root, dirs, files in os.walk(target): for cur_dir in dirs: os.chmod(os.path.join(root, cur_dir), folder_mode) for cur_file in files: os.chmod(os.path.join(root, cur_file), file_mode) else: raise ValueError("Unsupported file type: {}".format(target)) def error(message): """ Throw an error with the given message and immediately quit. Args: message(str): The message to display. """ fail = "\033[91m" end = "\033[0m" sys.exit(fail + "Error: {}".format(message) + end) def get_dropbox_folder_location(): """ Try to locate the Dropbox folder. Returns: (str) Full path to the current Dropbox folder """ host_db_path = os.path.join(os.environ["HOME"], ".dropbox/host.db") try: with open(host_db_path, "r") as f_hostdb: data = f_hostdb.read().split() except IOError: error(constants.ERROR_UNABLE_TO_FIND_STORAGE.format(provider="Dropbox install")) dropbox_home = base64.b64decode(data[1]).decode() return dropbox_home def get_google_drive_folder_location(): """ Try to locate the Google Drive folder. Returns: (str) Full path to the current Google Drive folder """ gdrive_db_path = "Library/Application Support/Google/Drive/sync_config.db" yosemite_gdrive_db_path = ( "Library/Application Support/Google/Drive/" "user_default/sync_config.db" ) yosemite_gdrive_db = os.path.join(os.environ["HOME"], yosemite_gdrive_db_path) if os.path.isfile(yosemite_gdrive_db): gdrive_db_path = yosemite_gdrive_db googledrive_home = None gdrive_db = os.path.join(os.environ["HOME"], gdrive_db_path) if os.path.isfile(gdrive_db): con = sqlite3.connect(gdrive_db) if con: cur = con.cursor() query = ( "SELECT data_value " "FROM data " "WHERE entry_key = 'local_sync_root_path';" ) cur.execute(query) data = cur.fetchone() googledrive_home = str(data[0]) con.close() if not googledrive_home: error( constants.ERROR_UNABLE_TO_FIND_STORAGE.format( provider="Google Drive install" ) ) return googledrive_home def get_copy_folder_location(): """ Try to locate the Copy folder. Returns: (str) Full path to the current Copy folder """ copy_settings_path = "Library/Application Support/Copy Agent/config.db" copy_home = None copy_settings = os.path.join(os.environ["HOME"], copy_settings_path) if os.path.isfile(copy_settings): database = sqlite3.connect(copy_settings) if database: cur = database.cursor() query = "SELECT value " "FROM config2 " "WHERE option = 'csmRootPath';" cur.execute(query) data = cur.fetchone() copy_home = str(data[0]) cur.close() if not copy_home: error(constants.ERROR_UNABLE_TO_FIND_STORAGE.format(provider="Copy install")) return copy_home def get_icloud_folder_location(): """ Try to locate the iCloud Drive folder. Returns: (str) Full path to the iCloud Drive folder. """ yosemite_icloud_path = "~/Library/Mobile Documents/com~apple~CloudDocs/" icloud_home = os.path.expanduser(yosemite_icloud_path) if not os.path.isdir(icloud_home): error(constants.ERROR_UNABLE_TO_FIND_STORAGE.format(provider="iCloud Drive")) return str(icloud_home) def is_process_running(process_name): """ Check if a process with the given name is running. Args: (str): Process name, e.g. "Sublime Text" Returns: (bool): True if the process is running """ is_running = False # On systems with pgrep, check if the given process is running if os.path.isfile("/usr/bin/pgrep"): dev_null = open(os.devnull, "wb") returncode = subprocess.call(["/usr/bin/pgrep", process_name], stdout=dev_null) is_running = bool(returncode == 0) return is_running def remove_acl(path): """ Remove the ACL of the file or folder located on the given path. Also remove the ACL of any file and folder below the given one, recursively. Args: path (str): Path to the file or folder to remove the ACL for, recursively. """ # Some files have ACLs, let's remove them recursively if platform.system() == constants.PLATFORM_DARWIN and os.path.isfile("/bin/chmod"): subprocess.call(["/bin/chmod", "-R", "-N", path]) elif (platform.system() == constants.PLATFORM_LINUX) and os.path.isfile( "/bin/setfacl" ): subprocess.call(["/bin/setfacl", "-R", "-b", path]) def remove_immutable_attribute(path): """ Remove the immutable attribute of the given path. Remove the immutable attribute of the file or folder located on the given path. Also remove the immutable attribute of any file and folder below the given one, recursively. Args: path (str): Path to the file or folder to remove the immutable attribute for, recursively. """ # Some files have ACLs, let's remove them recursively if (platform.system() == constants.PLATFORM_DARWIN) and os.path.isfile( "/usr/bin/chflags" ): subprocess.call(["/usr/bin/chflags", "-R", "nouchg", path]) elif platform.system() == constants.PLATFORM_LINUX and os.path.isfile( "/usr/bin/chattr" ): subprocess.call(["/usr/bin/chattr", "-R", "-f", "-i", path]) def can_file_be_synced_on_current_platform(path): """ Check if the given path can be synced locally. Check if it makes sense to sync the file at the given path on the current platform. For now we don't sync any file in the ~/Library folder on GNU/Linux. There might be other exceptions in the future. Args: (str): Path to the file or folder to check. If relative, prepend it with the home folder. 'abc' becomes '~/abc' '/def' stays '/def' Returns: (bool): True if given file can be synced """ can_be_synced = True # If the given path is relative, prepend home fullpath = os.path.join(os.environ["HOME"], path) # Compute the ~/Library path on macOS # End it with a slash because we are looking for this specific folder and # not any file/folder named LibrarySomething library_path = os.path.join(os.environ["HOME"], "Library/") if platform.system() == constants.PLATFORM_LINUX: if fullpath.startswith(library_path): can_be_synced = False return can_be_synced
OptionalManager
ContentDbPlugin
import collections import itertools import re import time import gevent from Config import config from Debug import Debug from Plugin import PluginManager from util import helper if "content_db" not in locals().keys(): # To keep between module reloads content_db = None @PluginManager.registerTo("ContentDb") class ContentDbPlugin(object): def __init__(self, *args, **kwargs): global content_db content_db = self self.filled = {} # Site addresses that already filled from content.json self.need_filling = ( False # file_optional table just created, fill data from content.json files ) self.time_peer_numbers_updated = 0 self.my_optional_files = {} # Last 50 site_address/inner_path called by fileWrite (auto-pinning these files) self.optional_files = collections.defaultdict(dict) self.optional_files_loaded = False self.timer_check_optional = helper.timer(60 * 5, self.checkOptionalLimit) super(ContentDbPlugin, self).__init__(*args, **kwargs) def getSchema(self): schema = super(ContentDbPlugin, self).getSchema() # Need file_optional table schema["tables"]["file_optional"] = { "cols": [ ["file_id", "INTEGER PRIMARY KEY UNIQUE NOT NULL"], ["site_id", "INTEGER REFERENCES site (site_id) ON DELETE CASCADE"], ["inner_path", "TEXT"], ["hash_id", "INTEGER"], ["size", "INTEGER"], ["peer", "INTEGER DEFAULT 0"], ["uploaded", "INTEGER DEFAULT 0"], ["is_downloaded", "INTEGER DEFAULT 0"], ["is_pinned", "INTEGER DEFAULT 0"], ["time_added", "INTEGER DEFAULT 0"], ["time_downloaded", "INTEGER DEFAULT 0"], ["time_accessed", "INTEGER DEFAULT 0"], ], "indexes": [ "CREATE UNIQUE INDEX file_optional_key ON file_optional (site_id, inner_path)", "CREATE INDEX is_downloaded ON file_optional (is_downloaded)", ], "schema_changed": 11, } return schema def initSite(self, site): super(ContentDbPlugin, self).initSite(site) if self.need_filling: self.fillTableFileOptional(site) def checkTables(self): changed_tables = super(ContentDbPlugin, self).checkTables() if "file_optional" in changed_tables: self.need_filling = True return changed_tables # Load optional files ending def loadFilesOptional(self): s = time.time() num = 0 total = 0 total_downloaded = 0 res = content_db.execute( "SELECT site_id, inner_path, size, is_downloaded FROM file_optional" ) site_sizes = collections.defaultdict(lambda: collections.defaultdict(int)) for row in res: self.optional_files[row["site_id"]][row["inner_path"][-8:]] = 1 num += 1 # Update site size stats site_sizes[row["site_id"]]["size_optional"] += row["size"] if row["is_downloaded"]: site_sizes[row["site_id"]]["optional_downloaded"] += row["size"] # Site site size stats to sites.json settings site_ids_reverse = {val: key for key, val in self.site_ids.items()} for site_id, stats in site_sizes.items(): site_address = site_ids_reverse.get(site_id) if not site_address or site_address not in self.sites: self.log.error("Not found site_id: %s" % site_id) continue site = self.sites[site_address] site.settings["size_optional"] = stats["size_optional"] site.settings["optional_downloaded"] = stats["optional_downloaded"] total += stats["size_optional"] total_downloaded += stats["optional_downloaded"] self.log.info( "Loaded %s optional files: %.2fMB, downloaded: %.2fMB in %.3fs" % ( num, float(total) / 1024 / 1024, float(total_downloaded) / 1024 / 1024, time.time() - s, ) ) if ( self.need_filling and self.getOptionalLimitBytes() >= 0 and self.getOptionalLimitBytes() < total_downloaded ): limit_bytes = self.getOptionalLimitBytes() limit_new = round( (float(total_downloaded) / 1024 / 1024 / 1024) * 1.1, 2 ) # Current limit + 10% self.log.info( "First startup after update and limit is smaller than downloaded files size (%.2fGB), increasing it from %.2fGB to %.2fGB" % ( float(total_downloaded) / 1024 / 1024 / 1024, float(limit_bytes) / 1024 / 1024 / 1024, limit_new, ) ) config.saveValue("optional_limit", limit_new) config.optional_limit = str(limit_new) # Predicts if the file is optional def isOptionalFile(self, site_id, inner_path): return self.optional_files[site_id].get(inner_path[-8:]) # Fill file_optional table with optional files found in sites def fillTableFileOptional(self, site): s = time.time() site_id = self.site_ids.get(site.address) if not site_id: return False cur = self.getCursor() res = cur.execute( "SELECT * FROM content WHERE size_files_optional > 0 AND site_id = %s" % site_id ) num = 0 for row in res.fetchall(): content = site.content_manager.contents[row["inner_path"]] try: num += self.setContentFilesOptional( site, row["inner_path"], content, cur=cur ) except Exception as err: self.log.error( "Error loading %s into file_optional: %s" % (row["inner_path"], err) ) cur.close() # Set my files to pinned from User import UserManager user = UserManager.user_manager.get() if not user: user = UserManager.user_manager.create() auth_address = user.getAuthAddress(site.address) res = self.execute( "UPDATE file_optional SET is_pinned = 1 WHERE site_id = :site_id AND inner_path LIKE :inner_path", {"site_id": site_id, "inner_path": "%%/%s/%%" % auth_address}, ) self.log.debug( "Filled file_optional table for %s in %.3fs (loaded: %s, is_pinned: %s)" % (site.address, time.time() - s, num, res.rowcount) ) self.filled[site.address] = True def setContentFilesOptional(self, site, content_inner_path, content, cur=None): if not cur: cur = self num = 0 site_id = self.site_ids[site.address] content_inner_dir = helper.getDirname(content_inner_path) for relative_inner_path, file in content.get("files_optional", {}).items(): file_inner_path = content_inner_dir + relative_inner_path hash_id = int(file["sha512"][0:4], 16) if hash_id in site.content_manager.hashfield: is_downloaded = 1 else: is_downloaded = 0 if site.address + "/" + content_inner_dir in self.my_optional_files: is_pinned = 1 else: is_pinned = 0 cur.insertOrUpdate( "file_optional", {"hash_id": hash_id, "size": int(file["size"])}, {"site_id": site_id, "inner_path": file_inner_path}, oninsert={ "time_added": int(time.time()), "time_downloaded": int(time.time()) if is_downloaded else 0, "is_downloaded": is_downloaded, "peer": is_downloaded, "is_pinned": is_pinned, }, ) self.optional_files[site_id][file_inner_path[-8:]] = 1 num += 1 return num def setContent(self, site, inner_path, content, size=0): super(ContentDbPlugin, self).setContent(site, inner_path, content, size=size) old_content = site.content_manager.contents.get(inner_path, {}) if (not self.need_filling or self.filled.get(site.address)) and ( "files_optional" in content or "files_optional" in old_content ): self.setContentFilesOptional(site, inner_path, content) # Check deleted files if old_content: old_files = old_content.get("files_optional", {}).keys() new_files = content.get("files_optional", {}).keys() content_inner_dir = helper.getDirname(inner_path) deleted = [ content_inner_dir + key for key in old_files if key not in new_files ] if deleted: site_id = self.site_ids[site.address] self.execute( "DELETE FROM file_optional WHERE ?", {"site_id": site_id, "inner_path": deleted}, ) def deleteContent(self, site, inner_path): content = site.content_manager.contents.get(inner_path) if content and "files_optional" in content: site_id = self.site_ids[site.address] content_inner_dir = helper.getDirname(inner_path) optional_inner_paths = [ content_inner_dir + relative_inner_path for relative_inner_path in content.get("files_optional", {}).keys() ] self.execute( "DELETE FROM file_optional WHERE ?", {"site_id": site_id, "inner_path": optional_inner_paths}, ) super(ContentDbPlugin, self).deleteContent(site, inner_path) def updatePeerNumbers(self): s = time.time() num_file = 0 num_updated = 0 num_site = 0 for site in list(self.sites.values()): if not site.content_manager.has_optional_files: continue if not site.isServing(): continue has_updated_hashfield = next( ( peer for peer in site.peers.values() if peer.has_hashfield and peer.hashfield.time_changed > self.time_peer_numbers_updated ), None, ) if ( not has_updated_hashfield and site.content_manager.hashfield.time_changed < self.time_peer_numbers_updated ): continue hashfield_peers = itertools.chain.from_iterable( peer.hashfield.storage for peer in site.peers.values() if peer.has_hashfield ) peer_nums = collections.Counter( itertools.chain(hashfield_peers, site.content_manager.hashfield) ) site_id = self.site_ids[site.address] if not site_id: continue res = self.execute( "SELECT file_id, hash_id, peer FROM file_optional WHERE ?", {"site_id": site_id}, ) updates = {} for row in res: peer_num = peer_nums.get(row["hash_id"], 0) if peer_num != row["peer"]: updates[row["file_id"]] = peer_num for file_id, peer_num in updates.items(): self.execute( "UPDATE file_optional SET peer = ? WHERE file_id = ?", (peer_num, file_id), ) num_updated += len(updates) num_file += len(peer_nums) num_site += 1 self.time_peer_numbers_updated = time.time() self.log.debug( "%s/%s peer number for %s site updated in %.3fs" % (num_updated, num_file, num_site, time.time() - s) ) def queryDeletableFiles(self): # First return the files with atleast 10 seeder and not accessed in last week query = """ SELECT * FROM file_optional WHERE peer > 10 AND %s ORDER BY time_accessed < %s DESC, uploaded / size """ % ( self.getOptionalUsedWhere(), int(time.time() - 60 * 60 * 7), ) limit_start = 0 while 1: num = 0 res = self.execute("%s LIMIT %s, 50" % (query, limit_start)) for row in res: yield row num += 1 if num < 50: break limit_start += 50 self.log.debug("queryDeletableFiles returning less-seeded files") # Then return files less seeder but still not accessed in last week query = """ SELECT * FROM file_optional WHERE peer <= 10 AND %s ORDER BY peer DESC, time_accessed < %s DESC, uploaded / size """ % ( self.getOptionalUsedWhere(), int(time.time() - 60 * 60 * 7), ) limit_start = 0 while 1: num = 0 res = self.execute("%s LIMIT %s, 50" % (query, limit_start)) for row in res: yield row num += 1 if num < 50: break limit_start += 50 self.log.debug("queryDeletableFiles returning everyting") # At the end return all files query = """ SELECT * FROM file_optional WHERE peer <= 10 AND %s ORDER BY peer DESC, time_accessed, uploaded / size """ % self.getOptionalUsedWhere() limit_start = 0 while 1: num = 0 res = self.execute("%s LIMIT %s, 50" % (query, limit_start)) for row in res: yield row num += 1 if num < 50: break limit_start += 50 def getOptionalLimitBytes(self): if config.optional_limit.endswith("%"): limit_percent = float(re.sub("[^0-9.]", "", config.optional_limit)) limit_bytes = helper.getFreeSpace() * (limit_percent / 100) else: limit_bytes = ( float(re.sub("[^0-9.]", "", config.optional_limit)) * 1024 * 1024 * 1024 ) return limit_bytes def getOptionalUsedWhere(self): maxsize = config.optional_limit_exclude_minsize * 1024 * 1024 query = "is_downloaded = 1 AND is_pinned = 0 AND size < %s" % maxsize # Don't delete optional files from owned sites my_site_ids = [] for address, site in self.sites.items(): if site.settings["own"]: my_site_ids.append(str(self.site_ids[address])) if my_site_ids: query += " AND site_id NOT IN (%s)" % ", ".join(my_site_ids) return query def getOptionalUsedBytes(self): size = self.execute( "SELECT SUM(size) FROM file_optional WHERE %s" % self.getOptionalUsedWhere() ).fetchone()[0] if not size: size = 0 return size def getOptionalNeedDelete(self, size): if config.optional_limit.endswith("%"): limit_percent = float(re.sub("[^0-9.]", "", config.optional_limit)) need_delete = size - ( (helper.getFreeSpace() + size) * (limit_percent / 100) ) else: need_delete = size - self.getOptionalLimitBytes() return need_delete def checkOptionalLimit(self, limit=None): if not limit: limit = self.getOptionalLimitBytes() if limit < 0: self.log.debug("Invalid limit for optional files: %s" % limit) return False size = self.getOptionalUsedBytes() need_delete = self.getOptionalNeedDelete(size) self.log.debug( "Optional size: %.1fMB/%.1fMB, Need delete: %.1fMB" % ( float(size) / 1024 / 1024, float(limit) / 1024 / 1024, float(need_delete) / 1024 / 1024, ) ) if need_delete <= 0: return False self.updatePeerNumbers() site_ids_reverse = {val: key for key, val in self.site_ids.items()} deleted_file_ids = [] for row in self.queryDeletableFiles(): site_address = site_ids_reverse.get(row["site_id"]) site = self.sites.get(site_address) if not site: self.log.error("No site found for id: %s" % row["site_id"]) continue site.log.debug( "Deleting %s %.3f MB left" % (row["inner_path"], float(need_delete) / 1024 / 1024) ) deleted_file_ids.append(row["file_id"]) try: site.content_manager.optionalRemoved( row["inner_path"], row["hash_id"], row["size"] ) site.storage.delete(row["inner_path"]) need_delete -= row["size"] except Exception as err: site.log.error("Error deleting %s: %s" % (row["inner_path"], err)) if need_delete <= 0: break cur = self.getCursor() for file_id in deleted_file_ids: cur.execute( "UPDATE file_optional SET is_downloaded = 0, is_pinned = 0, peer = peer - 1 WHERE ?", {"file_id": file_id}, ) cur.close() @PluginManager.registerTo("SiteManager") class SiteManagerPlugin(object): def load(self, *args, **kwargs): back = super(SiteManagerPlugin, self).load(*args, **kwargs) if self.sites and not content_db.optional_files_loaded and content_db.conn: content_db.optional_files_loaded = True content_db.loadFilesOptional() return back
thumbor
build
# https://github.com/python-poetry/poetry/issues/11 import glob import os from distutils.command.build_ext import build_ext from distutils.core import Extension from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError def filter_extension_module(name, lib_objs, lib_headers): return Extension( "thumbor.ext.filters.%s" % name, ["thumbor/ext/filters/%s.c" % name] + lib_objs, libraries=["m"], include_dirs=["thumbor/ext/filters/lib"], depends=["setup.py"] + lib_objs + lib_headers, extra_compile_args=[ "-Wall", "-Wextra", "-Werror", "-Wno-unused-parameter", ], ) def gather_filter_extensions(): files = glob.glob("thumbor/ext/filters/_*.c") lib_objs = glob.glob("thumbor/ext/filters/lib/*.c") lib_headers = glob.glob("thumbor/ext/filters/lib/*.h") return [ filter_extension_module(f[0:-2].split("/")[-1], lib_objs, lib_headers) for f in files ] class BuildFailed(Exception): pass class ExtBuilder(build_ext): # This class allows C extension building to fail. def run(self): try: build_ext.run(self) except (DistutilsPlatformError, FileNotFoundError): pass def build_extension(self, ext): try: build_ext.build_extension(self, ext) except ( CCompilerError, DistutilsExecError, DistutilsPlatformError, ValueError, ): pass def build(setup_kwargs): """Needed for the poetry building interface.""" if "CFLAGS" not in os.environ: os.environ["CFLAGS"] = "" setup_kwargs.update( dict( ext_modules=gather_filter_extensions(), cmdclass={"build_ext": ExtBuilder}, packages=["thumbor"], package_dir={"thumbor": "thumbor"}, include_package_data=True, package_data={"": ["*.xml"]}, ) )
viewers
documents
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/ # # Copyright (c) 2008 - 2014 by Wilbert Berendsen # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # See http://www.gnu.org/licenses/ for more information. """ Code to load and manage PDF documents to view. """ import os from PyQt5.QtCore import QSettings try: import popplerqt5 except ImportError: popplerqt5 = None import app import pagedview import plugin import resultfiles import signals # This signal gets emitted when a finished Job has created new PDF document(s). documentUpdated = signals.Signal() # Document @app.jobFinished.connect def _on_job_finished(document, job): if group(document).update(): documentUpdated(document, job) def group(document): """Returns a DocumentGroup instance for the given text document.""" return DocumentGroup.instance(document) class DocumentGroup(plugin.DocumentPlugin): """Represents a group of PDF documents, created by the text document it belongs to. Multiple MusicView instances can use this group, they can store the positions of the Documents in the viewer themselves via a weak-key dictionary on the Document instances returned by documents(). On update() these Document instances will be reused. The global documentUpdated(Document) signal will be emitted when the global app.jobFinished() signal causes a reload of documents in a group. """ def __init__(self, document): self._documents = None document.loaded.connect(self.update, -100) def documents(self): """Returns the list of PDF Document objects created by our text document.""" # If the list is asked for the very first time, update if self._documents is None: self._documents = [] self.update() return self._documents[:] def update(self, newer=None): """Queries the resultfiles of this text document for PDF files and loads them. Returns True if new documents were loaded. If newer is True, only PDF files newer than the source document are returned. If newer is False, all PDF files are returned. If newer is None (default), the setting from the configuration is used. """ if newer is None: newer = QSettings().value("musicview/newer_files_only", True, bool) results = resultfiles.results(self.document()) files = results.files(".pdf", newer) if files: # reuse the older Document objects, they will probably be displaying # (about) the same documents, and so the viewer will remember their position. d = {} if self._documents: for doc in self._documents: if doc.filename() in files: d[doc.filename()] = doc documents = [] for filename in files: doc = d.get(filename) if doc: doc.invalidate() elif popplerqt5: doc = pagedview.loadPdf(filename) doc.ispresent = os.path.isfile(filename) else: continue doc.updated = newer or results.is_newer(filename) documents.append(doc) self._documents = documents return True
ui
ui_provider_options_caa
# -*- coding: utf-8 -*- # Automatically generated - don't edit. # Use `python setup.py build_ui` to update it. from PyQt5 import QtCore, QtGui, QtWidgets class Ui_CaaOptions(object): def setupUi(self, CaaOptions): CaaOptions.setObjectName("CaaOptions") CaaOptions.resize(660, 194) self.verticalLayout = QtWidgets.QVBoxLayout(CaaOptions) self.verticalLayout.setObjectName("verticalLayout") self.select_caa_types_group = QtWidgets.QHBoxLayout() self.select_caa_types_group.setObjectName("select_caa_types_group") self.restrict_images_types = QtWidgets.QCheckBox(CaaOptions) self.restrict_images_types.setObjectName("restrict_images_types") self.select_caa_types_group.addWidget(self.restrict_images_types) spacerItem = QtWidgets.QSpacerItem( 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum ) self.select_caa_types_group.addItem(spacerItem) self.select_caa_types = QtWidgets.QPushButton(CaaOptions) self.select_caa_types.setEnabled(False) sizePolicy = QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed ) sizePolicy.setHorizontalStretch(100) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.select_caa_types.sizePolicy().hasHeightForWidth() ) self.select_caa_types.setSizePolicy(sizePolicy) self.select_caa_types.setObjectName("select_caa_types") self.select_caa_types_group.addWidget(self.select_caa_types) self.verticalLayout.addLayout(self.select_caa_types_group) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label = QtWidgets.QLabel(CaaOptions) sizePolicy = QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred ) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) spacerItem1 = QtWidgets.QSpacerItem( 40, 20, QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Minimum ) self.horizontalLayout.addItem(spacerItem1) self.cb_image_size = QtWidgets.QComboBox(CaaOptions) sizePolicy = QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed ) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.cb_image_size.sizePolicy().hasHeightForWidth() ) self.cb_image_size.setSizePolicy(sizePolicy) self.cb_image_size.setObjectName("cb_image_size") self.horizontalLayout.addWidget(self.cb_image_size) self.verticalLayout.addLayout(self.horizontalLayout) self.cb_approved_only = QtWidgets.QCheckBox(CaaOptions) self.cb_approved_only.setObjectName("cb_approved_only") self.verticalLayout.addWidget(self.cb_approved_only) spacerItem2 = QtWidgets.QSpacerItem( 20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding ) self.verticalLayout.addItem(spacerItem2) self.retranslateUi(CaaOptions) QtCore.QMetaObject.connectSlotsByName(CaaOptions) CaaOptions.setTabOrder(self.restrict_images_types, self.select_caa_types) CaaOptions.setTabOrder(self.select_caa_types, self.cb_image_size) CaaOptions.setTabOrder(self.cb_image_size, self.cb_approved_only) def retranslateUi(self, CaaOptions): _translate = QtCore.QCoreApplication.translate CaaOptions.setWindowTitle(_("Form")) self.restrict_images_types.setText( _("Download only cover art images matching selected types") ) self.select_caa_types.setText(_("Select types…")) self.label.setText(_("Only use images of the following size:")) self.cb_approved_only.setText(_("Download only approved images"))
chardet
langturkishmodel
# -*- coding: utf-8 -*- ######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # Özgür Baskın - Turkish Language Model # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### # 255: Control characters that usually does not exist in any text # 254: Carriage/Return # 253: symbol (punctuation) that does not belong to word # 252: 0 - 9 # Character Mapping Table: Latin5_TurkishCharToOrderMap = ( 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 23, 37, 47, 39, 29, 52, 36, 45, 53, 60, 16, 49, 20, 46, 42, 48, 69, 44, 35, 31, 51, 38, 62, 65, 43, 56, 255, 255, 255, 255, 255, 255, 1, 21, 28, 12, 2, 18, 27, 25, 3, 24, 10, 5, 13, 4, 15, 26, 64, 7, 8, 9, 14, 32, 57, 58, 11, 22, 255, 255, 255, 255, 255, 180, 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 101, 158, 157, 156, 155, 154, 153, 152, 151, 106, 150, 149, 148, 147, 146, 145, 144, 100, 143, 142, 141, 140, 139, 138, 137, 136, 94, 80, 93, 135, 105, 134, 133, 63, 132, 131, 130, 129, 128, 127, 126, 125, 124, 104, 73, 99, 79, 85, 123, 54, 122, 98, 92, 121, 120, 91, 103, 119, 68, 118, 117, 97, 116, 115, 50, 90, 114, 113, 112, 111, 55, 41, 40, 86, 89, 70, 59, 78, 71, 82, 88, 33, 77, 66, 84, 83, 110, 75, 61, 96, 30, 67, 109, 74, 87, 102, 34, 95, 81, 108, 76, 72, 17, 6, 19, 107, ) TurkishLangModel = ( 3, 2, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 3, 3, 1, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 1, 3, 3, 2, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 1, 0, 0, 1, 3, 2, 2, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 2, 3, 1, 0, 3, 3, 1, 3, 3, 0, 3, 3, 3, 3, 3, 0, 3, 0, 3, 3, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 1, 0, 1, 3, 3, 2, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 2, 3, 1, 1, 3, 3, 0, 3, 3, 1, 2, 3, 3, 3, 3, 0, 3, 0, 3, 3, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 2, 1, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 2, 0, 3, 2, 1, 2, 2, 1, 3, 3, 0, 0, 0, 2, 2, 2, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 3, 3, 3, 2, 3, 3, 1, 2, 3, 3, 3, 3, 3, 3, 3, 1, 3, 2, 1, 0, 3, 2, 0, 1, 2, 3, 3, 2, 1, 0, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 1, 0, 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 1, 2, 0, 0, 2, 3, 0, 2, 3, 0, 0, 2, 2, 2, 3, 0, 3, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 0, 3, 2, 0, 2, 3, 2, 3, 3, 1, 0, 0, 2, 3, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 2, 0, 0, 1, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 0, 3, 3, 0, 0, 2, 1, 0, 0, 2, 3, 2, 2, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 2, 0, 0, 1, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 0, 3, 2, 0, 1, 3, 2, 1, 1, 3, 2, 3, 2, 1, 0, 0, 2, 2, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 0, 3, 2, 2, 0, 2, 3, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, 2, 3, 3, 0, 3, 3, 1, 1, 2, 2, 0, 0, 2, 2, 3, 2, 0, 0, 1, 3, 0, 3, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 3, 3, 3, 2, 3, 3, 3, 2, 1, 2, 2, 3, 2, 3, 3, 0, 3, 2, 0, 0, 1, 1, 0, 1, 1, 2, 1, 2, 0, 0, 0, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 3, 3, 3, 2, 3, 3, 2, 3, 2, 2, 2, 3, 3, 3, 3, 1, 3, 1, 1, 0, 3, 2, 1, 1, 3, 3, 2, 3, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 3, 2, 2, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1, 0, 3, 3, 1, 3, 3, 0, 1, 3, 3, 2, 3, 0, 3, 0, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 2, 2, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 3, 2, 0, 3, 3, 0, 3, 2, 3, 3, 3, 0, 3, 1, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 1, 0, 0, 1, 3, 3, 3, 1, 2, 3, 3, 1, 0, 0, 1, 0, 0, 3, 3, 2, 3, 0, 0, 2, 0, 0, 2, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, 3, 1, 0, 1, 0, 0, 0, 2, 2, 1, 0, 1, 1, 2, 1, 2, 2, 2, 0, 2, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 2, 1, 3, 3, 0, 3, 3, 3, 3, 3, 2, 3, 0, 0, 0, 0, 2, 3, 0, 2, 3, 1, 0, 2, 3, 1, 3, 0, 3, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 3, 3, 2, 2, 3, 2, 2, 0, 1, 2, 3, 0, 1, 2, 1, 0, 1, 0, 0, 0, 1, 0, 2, 2, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 3, 3, 3, 1, 3, 3, 1, 1, 3, 3, 1, 1, 3, 3, 1, 0, 2, 1, 2, 0, 2, 1, 0, 0, 1, 1, 2, 1, 0, 0, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 0, 2, 1, 3, 0, 0, 2, 0, 0, 3, 3, 0, 3, 0, 0, 1, 0, 1, 2, 0, 0, 1, 1, 2, 2, 0, 1, 0, 0, 1, 2, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 2, 2, 1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 3, 3, 2, 3, 2, 3, 3, 0, 2, 2, 2, 3, 3, 3, 0, 3, 0, 0, 0, 2, 2, 0, 1, 2, 1, 1, 1, 0, 0, 0, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 3, 3, 3, 3, 3, 2, 1, 2, 2, 3, 3, 3, 3, 2, 0, 2, 0, 0, 0, 2, 2, 0, 0, 2, 1, 3, 3, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 2, 3, 3, 0, 3, 3, 3, 3, 3, 3, 2, 2, 0, 2, 0, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 1, 3, 2, 3, 2, 0, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 0, 0, 2, 1, 1, 0, 2, 1, 0, 0, 1, 0, 0, 0, 1, 2, 3, 3, 1, 1, 1, 0, 1, 1, 1, 2, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 2, 2, 2, 3, 2, 3, 2, 2, 1, 3, 3, 3, 0, 2, 1, 2, 0, 2, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 3, 3, 3, 2, 3, 3, 3, 3, 3, 2, 3, 1, 2, 3, 3, 1, 2, 0, 0, 0, 0, 0, 0, 0, 3, 2, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 3, 3, 2, 2, 3, 3, 2, 1, 1, 1, 1, 1, 3, 3, 0, 3, 1, 0, 0, 1, 1, 0, 0, 3, 1, 2, 1, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 3, 3, 3, 2, 2, 3, 2, 2, 2, 3, 2, 1, 1, 3, 3, 0, 3, 0, 0, 0, 0, 1, 0, 0, 3, 1, 1, 2, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 3, 3, 0, 3, 3, 3, 3, 3, 2, 2, 2, 1, 2, 0, 2, 1, 2, 2, 1, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 1, 2, 1, 2, 1, 0, 1, 1, 3, 1, 2, 1, 1, 2, 0, 0, 2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 3, 3, 3, 1, 3, 3, 3, 0, 1, 1, 0, 2, 2, 3, 1, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 2, 0, 0, 2, 2, 1, 0, 0, 1, 0, 0, 3, 3, 1, 3, 0, 0, 1, 1, 0, 2, 0, 3, 0, 0, 0, 2, 0, 1, 1, 0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 2, 1, 0, 2, 1, 1, 0, 2, 0, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 3, 2, 3, 2, 0, 2, 2, 2, 1, 3, 2, 0, 2, 1, 2, 0, 1, 2, 0, 0, 1, 0, 2, 2, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 3, 3, 3, 0, 3, 3, 1, 1, 2, 3, 1, 0, 3, 2, 3, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 3, 3, 2, 3, 3, 2, 2, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, 0, 3, 1, 1, 0, 3, 0, 2, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 2, 2, 1, 0, 3, 1, 1, 1, 1, 3, 3, 2, 3, 0, 0, 1, 0, 1, 2, 0, 2, 2, 0, 2, 2, 0, 2, 1, 0, 2, 2, 1, 1, 1, 1, 0, 2, 1, 1, 0, 1, 1, 1, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 1, 1, 3, 0, 0, 1, 1, 0, 0, 2, 2, 0, 3, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 1, 0, 1, 0, 1, 0, 2, 0, 0, 1, 0, 1, 0, 1, 1, 1, 2, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 2, 0, 2, 0, 1, 1, 1, 0, 0, 3, 3, 0, 2, 0, 0, 1, 0, 0, 2, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 2, 0, 1, 2, 0, 2, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 3, 2, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 2, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 2, 3, 0, 0, 1, 0, 1, 0, 2, 3, 2, 3, 0, 0, 1, 3, 0, 2, 1, 0, 0, 0, 0, 2, 0, 1, 0, 0, 2, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 2, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 2, 3, 2, 2, 1, 2, 2, 1, 1, 2, 0, 1, 3, 2, 2, 2, 0, 0, 2, 2, 0, 0, 0, 1, 2, 1, 3, 0, 2, 1, 1, 0, 1, 1, 1, 0, 1, 2, 2, 2, 1, 1, 2, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 0, 3, 3, 3, 2, 2, 2, 2, 1, 0, 1, 0, 1, 0, 1, 2, 2, 0, 0, 2, 2, 1, 3, 1, 1, 2, 1, 0, 0, 1, 1, 2, 0, 1, 1, 0, 0, 1, 2, 0, 2, 1, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 3, 3, 2, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 3, 2, 1, 2, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 2, 1, 1, 0, 0, 1, 0, 1, 2, 0, 0, 1, 1, 0, 0, 2, 1, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 2, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 3, 3, 2, 2, 0, 0, 1, 0, 0, 2, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 1, 1, 0, 0, 2, 0, 2, 1, 0, 0, 1, 1, 2, 1, 2, 0, 2, 1, 2, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 3, 3, 2, 0, 0, 2, 2, 0, 0, 0, 1, 1, 0, 2, 2, 1, 3, 1, 0, 1, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 2, 3, 1, 2, 0, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 2, 0, 2, 0, 0, 1, 1, 2, 2, 1, 2, 0, 2, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 2, 1, 2, 1, 0, 0, 1, 1, 0, 3, 3, 1, 2, 0, 0, 1, 0, 0, 2, 0, 2, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 3, 3, 3, 0, 2, 2, 3, 2, 0, 0, 1, 0, 0, 2, 3, 1, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 2, 2, 2, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0, 2, 0, 2, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2, 1, 1, 1, 1, 2, 2, 0, 0, 1, 0, 1, 0, 0, 1, 3, 0, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 3, 0, 2, 3, 1, 2, 2, 0, 2, 0, 0, 2, 0, 2, 1, 1, 1, 2, 1, 0, 0, 1, 2, 1, 1, 2, 1, 0, 1, 0, 2, 0, 1, 0, 1, 1, 0, 0, 2, 2, 1, 2, 1, 1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 2, 1, 2, 0, 0, 0, 1, 0, 0, 3, 2, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2, 2, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 2, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 2, 1, 0, 1, 1, 1, 0, 1, 1, 2, 1, 2, 1, 1, 2, 0, 1, 1, 2, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 2, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 2, 2, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 2, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 1, 2, 2, 0, 2, 1, 2, 1, 1, 2, 2, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ) Latin5TurkishModel = { "char_to_order_map": Latin5_TurkishCharToOrderMap, "precedence_matrix": TurkishLangModel, "typical_positive_ratio": 0.970290, "keep_english_letter": True, "charset_name": "ISO-8859-9", "language": "Turkish", }
custom-widgets
status_bar
from PyQt5 import QtCore, QtWidgets class StatusBar(QtWidgets.QStatusBar): def __init__(self, parent=None): super(StatusBar, self).__init__(parent) self.page_number = None self.page_resolution = None self.comic_path = None self.progress_bar = None self.slider = None def add_page_number_label(self): if self.page_number is None: self.remove_progress_bar() self.page_number = QtWidgets.QLabel(self) self.page_number.setMinimumWidth(120) self.addWidget(self.page_number, 0) self.page_number.show() def add_page_resolution_label(self): if self.page_resolution is None: self.remove_progress_bar() self.page_resolution = QtWidgets.QLabel(self) self.page_resolution.setMinimumWidth(140) self.addWidget(self.page_resolution, 1) self.page_resolution.show() def add_comic_path_label(self): if self.comic_path is None: self.remove_progress_bar() self.comic_path = QtWidgets.QLabel(self) self.addWidget(self.comic_path, 2) self.comic_path.show() def add_progress_bar(self, maximum_value=100): self.remove_labels() self.remove_slider() self.progress_bar = QtWidgets.QProgressBar() self.progress_bar.setFixedHeight(15) self.progress_bar.setMaximum(maximum_value) self.progress_bar.setMaximumWidth(self.width()) self.addWidget(self.progress_bar, 3) self.progress_bar.show() def add_slider(self): if self.slider is None: self.remove_progress_bar() self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self) self.slider.setFixedWidth(200) self.slider.setValue(50) self.slider.setTickPosition(QtWidgets.QSlider.TicksBelow) self.addWidget(self.slider, 3) def remove_slider(self): if self.slider is not None: self.removeWidget(self.slider) self.slider = None def remove_progress_bar(self): if self.progress_bar: self.removeWidget(self.progress_bar) self.progress_bar = None def remove_labels(self): if self.page_number: self.removeWidget(self.page_number) self.page_number = None if self.page_resolution: self.removeWidget(self.page_resolution) self.page_resolution = None if self.comic_path: self.removeWidget(self.comic_path) self.comic_path = None def set_comic_page(self, current_page, total_pages): if not self.page_number: self.add_page_number_label() self.page_number.setText( self.tr("Page: ") + str(current_page) + "/" + str(total_pages) ) def set_page_resolution(self, width, height, orig_w=None, orig_h=None): if not self.page_resolution: self.add_page_resolution_label() text = self.tr("Resolution: ") + str(width) + " × " + str(height) if orig_w and orig_h and orig_w != width and orig_h != height: text += " (" + str(orig_w) + " × " + str(orig_h) + ")" text += " px" self.page_resolution.setText(text) def set_comic_path(self, path): if not self.comic_path: self.add_comic_path_label() self.comic_path.setText(self.tr("Title: ") + path[:50]) @QtCore.pyqtSlot(int) def set_progressbar_value(self, n): if self.progress_bar is None: self.add_progress_bar() self.progress_bar.setValue(n) @QtCore.pyqtSlot() def close_progress_bar(self): self.remove_progress_bar() self.add_page_number_label() self.add_page_resolution_label() self.add_comic_path_label()
events
thumbrating
# Copyright (C) 2018 Eoin O'Neill (eoinoneill1991@gmail.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. from gi.repository import Gtk from quodlibet import _, util from quodlibet.plugins.events import EventPlugin from quodlibet.plugins.gui import UserInterfacePlugin from quodlibet.qltk import Icons, ToggleButton class RatingBox(Gtk.VBox): def __init__(self): super().__init__(self) self.thumb_ups = 1 self.thumb_downs = 1 self.title = Gtk.Label("") self.title.set_line_wrap(True) self.title.set_lines(2) hbox = Gtk.HBox() self.upvote = ToggleButton("👍") self.downvote = ToggleButton("👎") self.upvote.connect("toggled", self.__thumb_toggled) self.downvote.connect("toggled", self.__thumb_toggled) self.score_label = Gtk.Label("----") self.upvote.set_property("height-request", 50) self.downvote.set_property("height-request", 50) hbox.pack_start(self.upvote, True, True, 5) hbox.pack_start(self.downvote, True, True, 5) self.hbox = hbox self.pack_start(self.title, False, False, 10) self.pack_start(self.score_label, True, True, 5) self.pack_start(self.hbox, False, False, 5) def set_current_title(self, title): self.title.set_text(title) def set_current_score(self, cth_up, cth_down): self.thumb_ups = cth_up self.thumb_downs = cth_down self.__set_pending_score_value(self.thumb_ups - self.thumb_downs) def poll_vote(self, reset=True): upward = 1 if self.upvote.get_active() else 0 downward = 1 if self.downvote.get_active() else 0 vote = (upward, downward) if reset: self.downvote.set_active(False) self.upvote.set_active(False) return vote def __set_pending_score_value(self, score): existing_score = self.thumb_ups - self.thumb_downs if score == existing_score: self.score_label.set_markup(util.bold(str(int(score)))) elif score > existing_score: self.score_label.set_markup( '<b><span foreground="green">' + str(int(score)) + "</span></b>" ) else: self.score_label.set_markup( '<b><span foreground="red">' + str(int(score)) + "</span></b>" ) def __thumb_toggled(self, button): if button.get_active(): if button == self.upvote: self.downvote.set_active(False) elif button == self.downvote: self.upvote.set_active(False) vote = self.poll_vote(False) self.__set_pending_score_value( self.thumb_ups + vote[0] - self.thumb_downs - vote[1] ) class ThumbRating(EventPlugin, UserInterfacePlugin): """Plugin for more hands off rating system using a thumb up / thumbdown system.""" PLUGIN_ID = "Thumb Rating" PLUGIN_NAME = _("Thumb Rating") PLUGIN_DESC_MARKUP = _( "Adds a thumb-up / thumb-down scoring system " "which is converted to a rating value. Useful " "for keeping running vote totals and sorting by " "<b><tt>~#score</tt></b>." ) PLUGIN_ICON = Icons.USER_BOOKMARKS # Threshold value where points should be recalculated score_point_threshold = 0.2 def enabled(self): self.rating_box = RatingBox() def create_sidebar(self): vbox = Gtk.VBox() vbox.pack_start(self.rating_box, False, False, 0) vbox.show_all() return vbox def disabled(self): self.rating_box.destroy() def plugin_on_song_ended(self, song, stopped): if song is not None: poll = self.rating_box.poll_vote() if poll[0] >= 1 or poll[1] >= 1: ups = int(song.get("~#wins") or 0) downs = int(song.get("~#losses") or 0) ups += poll[0] downs += poll[1] song["~#wins"] = ups song["~#losses"] = downs song["~#rating"] = ups / max((ups + downs), 2) # note: ^^^ Look into implementing w/ confidence intervals! song["~#score"] = ups - downs def plugin_on_song_started(self, song): if song is not None: ups = int(song("~#wins") or 0) downs = int(song("~#losses") or 0) # Handle case where there's no score but user has a defined rating. if (ups + downs == 0) and (song.get("~#rating")): percent = song["~#rating"] ups = int(percent * 10) downs = int((1.0 - percent) * 10.0) song["~#wins"] = ups song["~#losses"] = downs elif ( song.get("~#rating") and abs((ups / max((ups + downs), 2)) - song["~#rating"]) > self.score_point_threshold ): # Cases where rating and points are not in alignment. total = max(ups + downs, 10) percent = song["~#rating"] ups = int(percent * total) downs = int((1.0 - percent) * total) song["~#wins"] = ups song["~#losses"] = downs self.rating_box.set_current_score(ups, downs) self.rating_box.set_current_title(song("~artist~title"))
migrations
0127_stricter_team_data
# Generated by Django 3.0.6 on 2021-02-09 09:11 from django.db import migrations, models def adjust_teams_for_stricter_requirements(apps, schema_editor): Team = apps.get_model("posthog", "Team") Organization = apps.get_model("posthog", "Organization") first_organization = Organization.objects.order_by("id").first() if first_organization is not None: Team.objects.filter(organization_id__isnull=True).update( organization_id=first_organization.id ) else: Team.objects.filter(organization_id__isnull=True).delete() Team.objects.filter(models.Q(name__isnull=True) | models.Q(name="")).update( name="Project X" ) for team in Team.objects.filter(opt_out_capture=True): team.organization.members.update(anonymize_data=True) class Migration(migrations.Migration): dependencies = [ ("posthog", "0126_fix_funnels_insights_links"), ] operations = [ migrations.RunPython( adjust_teams_for_stricter_requirements, migrations.RunPython.noop, elidable=True, ), ]
mp-sched
wfm_rcv_pll_to_wav
#!/usr/bin/env python # # Copyright 2005,2006,2007 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # import math import sys from argparse import ArgumentParser from gnuradio import analog, audio, blocks, eng_notation, filter, gr from gnuradio.eng_arg import eng_float, intx class wfm_rx_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) parser = ArgumentParser(description="Decode WFM signal into WAV file.") parser.add_argument( "-V", "--volume", type=eng_float, help="Volume (dB) <%r, %r> (default is midpoint)" % self.volume_range()[:2], ) parser.add_argument("input_file", help="Input file (complex samples)") parser.add_argument("output_file", help="Output WAV file") args = parser.parse_args() self.vol = 0 # build graph self.src = blocks.file_source(gr.sizeof_gr_complex, args.input_file, False) adc_rate = 64e6 # 64 MS/s usrp_decim = 200 usrp_rate = adc_rate / usrp_decim # 320 kS/s chanfilt_decim = 1 demod_rate = usrp_rate / chanfilt_decim audio_decimation = 10 audio_rate = demod_rate / audio_decimation # 32 kHz chan_filt_coeffs = filter.optfir.low_pass( 1, # gain usrp_rate, # sampling rate 80e3, # passband cutoff 115e3, # stopband cutoff 0.1, # passband ripple 60, ) # stopband attenuation # print len(chan_filt_coeffs) chan_filt = filter.fir_filter_ccf(chanfilt_decim, chan_filt_coeffs) # self.guts = analog.wfm_rcv (demod_rate, audio_decimation) self.guts = analog.wfm_rcv_pll(demod_rate, audio_decimation) # FIXME rework {add,multiply}_const_* to handle multiple streams self.volume_control_l = blocks.multiply_const_ff(self.vol) self.volume_control_r = blocks.multiply_const_ff(self.vol) # wave file as final sink if 1: sink = blocks.wavfile_sink( args.output_file, 2, int(audio_rate), blocks.FORMAT_WAV, blocks.FORMAT_PCM_16, ) else: sink = audio.sink(int(audio_rate), args.audio_output, False) # ok_to_block # now wire it all together self.connect(self.src, chan_filt, self.guts) self.connect((self.guts, 0), self.volume_control_l, (sink, 0)) self.connect((self.guts, 1), self.volume_control_r, (sink, 1)) if args.volume is None: g = self.volume_range() args.volume = float(g[0] + g[1]) / 2 # set initial values self.set_vol(args.volume) def set_vol(self, vol): g = self.volume_range() self.vol = max(g[0], min(g[1], vol)) self.volume_control_l.set_k(10 ** (self.vol / 10)) self.volume_control_r.set_k(10 ** (self.vol / 10)) def volume_range(self): return (-20.0, 0.0, 0.5) if __name__ == "__main__": tb = wfm_rx_block() try: tb.run() except KeyboardInterrupt: pass
disc
utils
# -*- coding: utf-8 -*- # # fix-header: nolicense # MIT License # # Copyright(c) 2018 Konstantin Mochalov # Copyright(c) 2022 Philipp Wolfer # # Original code from https://gist.github.com/kolen/765526 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files(the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. from collections import namedtuple PREGAP_LENGTH = 150 DATA_TRACK_GAP = 11400 TocEntry = namedtuple("TocEntry", "number start_sector end_sector") class NotSupportedTOCError(Exception): pass def calculate_mb_toc_numbers(toc): """ Take iterator of TOC entries, return a tuple of numbers for MusicBrainz disc id Each entry is a TocEntry namedtuple with the following fields: - number: track number - start_sector: start sector of the track - end_sector: end sector of the track """ toc = tuple(toc) toc = _remove_data_track(toc) num_tracks = len(toc) if not num_tracks: raise NotSupportedTOCError("Empty track list") expected_tracknums = tuple(range(1, num_tracks + 1)) tracknums = tuple(e.number for e in toc) if expected_tracknums != tracknums: raise NotSupportedTOCError(f"Non-standard track number sequence: {tracknums}") leadout_offset = toc[-1].end_sector + PREGAP_LENGTH + 1 offsets = tuple(e.start_sector + PREGAP_LENGTH for e in toc) return (1, num_tracks, leadout_offset) + offsets def _remove_data_track(toc): if len(toc) > 1: last_track_gap = toc[-1].start_sector - toc[-2].end_sector if last_track_gap == DATA_TRACK_GAP + 1: toc = toc[:-1] return toc
examples
fft_filter_ccc
#!/usr/bin/env python # # Copyright 2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # import sys from argparse import ArgumentParser import numpy from gnuradio import analog, blocks, eng_notation, filter, gr from gnuradio.eng_arg import eng_float, intx try: from matplotlib import pyplot except ImportError: print( "Error: could not from matplotlib import pyplot (http://matplotlib.sourceforge.net/)" ) sys.exit(1) class example_fft_filter_ccc(gr.top_block): def __init__(self, N, fs, bw0, bw1, tw, atten, D): gr.top_block.__init__(self) self._nsamps = N self._fs = fs self._bw0 = bw0 self._bw1 = bw1 self._tw = tw self._at = atten self._decim = D taps = filter.firdes.complex_band_pass_2( 1, self._fs, self._bw0, self._bw1, self._tw, self._at ) print("Num. Taps: ", len(taps)) self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1) self.head = blocks.head(gr.sizeof_gr_complex, self._nsamps) self.filt0 = filter.fft_filter_ccc(self._decim, taps) self.vsnk_src = blocks.vector_sink_c() self.vsnk_out = blocks.vector_sink_c() self.connect(self.src, self.head, self.vsnk_src) self.connect(self.head, self.filt0, self.vsnk_out) def main(): parser = ArgumentParser(conflict_handler="resolve") parser.add_argument( "-N", "--nsamples", type=int, default=10000, help="Number of samples to process [default=%(default)r]", ) parser.add_argument( "-s", "--samplerate", type=eng_float, default=8000, help="System sample rate [default=%(default)r]", ) parser.add_argument( "-S", "--start-pass", type=eng_float, default=1000, help="Start of Passband [default=%(default)r]", ) parser.add_argument( "-E", "--end-pass", type=eng_float, default=2000, help="End of Passband [default=%(default)r]", ) parser.add_argument( "-T", "--transition", type=eng_float, default=100, help="Transition band [default=%(default)r]", ) parser.add_argument( "-A", "--attenuation", type=eng_float, default=80, help="Stopband attenuation [default=%(default)r]", ) parser.add_argument( "-D", "--decimation", type=int, default=1, help="Decmation factor [default=%(default)r]", ) args = parser.parse_args() put = example_fft_filter_ccc( args.nsamples, args.samplerate, args.start_pass, args.end_pass, args.transition, args.attenuation, args.decimation, ) put.run() data_src = numpy.array(put.vsnk_src.data()) data_snk = numpy.array(put.vsnk_out.data()) # Plot the signals PSDs nfft = 1024 f1 = pyplot.figure(1, figsize=(12, 10)) s1 = f1.add_subplot(1, 1, 1) s1.psd(data_src, NFFT=nfft, noverlap=nfft / 4, Fs=args.samplerate) s1.psd(data_snk, NFFT=nfft, noverlap=nfft / 4, Fs=args.samplerate) f2 = pyplot.figure(2, figsize=(12, 10)) s2 = f2.add_subplot(1, 1, 1) s2.plot(data_src) s2.plot(data_snk.real, "g") pyplot.show() if __name__ == "__main__": try: main() except KeyboardInterrupt: pass
models
traffic
# The contents of this file are subject to the Common Public Attribution # License Version 1.0. (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # http://code.reddit.com/LICENSE. The License is based on the Mozilla Public # License Version 1.1, but Sections 14 and 15 have been added to cover use of # software over a computer network and provide for limited attribution for the # Original Developer. In addition, Exhibit A has been modified to be consistent # with Exhibit B. # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for # the specific language governing rights and limitations under the License. # # The Original Code is reddit. # # The Original Developer is the Initial Developer. The Initial Developer of # the Original Code is reddit Inc. # # All portions of the code written by reddit are Copyright (c) 2006-2015 reddit # Inc. All Rights Reserved. ############################################################################### """ These models represent the traffic statistics stored for subreddits and promoted links. They are written to by Pig-based MapReduce jobs and read from various places in the UI. All traffic statistics are divided up into three "intervals" of granularity, hourly, daily, and monthly. Individual hits are tracked as pageviews / impressions, and can be safely summed. Unique hits are tracked as well, but cannot be summed safely because there's no way to know overlap at this point in the data pipeline. """ import datetime from pylons import app_globals as g from r2.lib.memoize import memoize from r2.lib.utils import timedelta_by_name, tup from r2.models.link import Link from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.schema import Column from sqlalchemy.sql.expression import desc, distinct from sqlalchemy.sql.functions import sum as sa_sum from sqlalchemy.types import BigInteger, DateTime, Integer, String, TypeDecorator engine = g.dbm.get_engine("traffic") Session = scoped_session(sessionmaker(bind=engine, autocommit=True)) Base = declarative_base(bind=engine) def memoize_traffic(**memoize_kwargs): """Wrap the memoize decorator and automatically determine memoize key. The memoize key is based off the full name (including class name) of the method being memoized. """ def memoize_traffic_decorator(fn): def memoize_traffic_wrapper(cls, *args, **kwargs): method = ".".join((cls.__name__, fn.__name__)) actual_memoize_decorator = memoize(method, **memoize_kwargs) actual_memoize_wrapper = actual_memoize_decorator(fn) return actual_memoize_wrapper(cls, *args, **kwargs) return memoize_traffic_wrapper return memoize_traffic_decorator class PeekableIterator(object): """Iterator that supports peeking at the next item in the iterable.""" def __init__(self, iterable): self.iterator = iter(iterable) self.item = None def peek(self): """Get the next item in the iterable without advancing our position.""" if not self.item: try: self.item = self.iterator.next() except StopIteration: return None return self.item def next(self): """Get the next item in the iterable and advance our position.""" item = self.peek() self.item = None return item def zip_timeseries(*series, **kwargs): """Zip timeseries data while gracefully handling gaps in the data. Timeseries data is expected to be a sequence of two-tuples (date, values). Values is expected itself to be a tuple. The width of the values tuples should be the same across all elements in a timeseries sequence. The result will be a single sequence in timeseries format. Gaps in sequences are filled with an appropriate number of zeros based on the size of the first value-tuple of that sequence. """ next_slice = max if kwargs.get("order", "descending") == "descending" else min iterators = [PeekableIterator(s) for s in series] widths = [] for w in iterators: r = w.peek() if r: date, values = r widths.append(len(values)) else: widths.append(0) while True: items = [it.peek() for it in iterators] if not any(items): return current_slice = next_slice(item[0] for item in items if item) data = [] for i, item in enumerate(items): # each item is (date, data) if item and item[0] == current_slice: data.extend(item[1]) iterators[i].next() else: data.extend([0] * widths[i]) yield current_slice, tuple(data) def decrement_month(date): """Given a truncated datetime, return a new one one month in the past.""" if date.day != 1: raise ValueError("Input must be truncated to the 1st of the month.") date -= datetime.timedelta(days=1) return date.replace(day=1) def fill_gaps_generator(time_points, query, *columns): """Generate a timeseries sequence with a value for every sample expected. Iterate over specified time points and pull the columns listed out of query. If the query doesn't have data for a time point, fill the gap with an appropriate number of zeroes. """ iterator = PeekableIterator(query) for t in time_points: row = iterator.peek() if row and row.date == t: yield t, tuple(getattr(row, c) for c in columns) iterator.next() else: yield t, tuple(0 for c in columns) def fill_gaps(*args, **kwargs): """Listify the generator returned by fill_gaps_generator for `memoize`.""" generator = fill_gaps_generator(*args, **kwargs) return list(generator) time_range_by_interval = dict( hour=datetime.timedelta(days=4), day=datetime.timedelta(weeks=8), month=datetime.timedelta(weeks=52), ) def get_time_points(interval, start_time=None, stop_time=None): """Return time points for given interval type. Time points are in reverse chronological order to match the sort of queries this will be used with. If start_time and stop_time are not specified they will be picked based on the interval. """ def truncate_datetime(dt): dt = dt.replace(minute=0, second=0, microsecond=0) if interval in ("day", "month"): dt = dt.replace(hour=0) if interval == "month": dt = dt.replace(day=1) return dt if start_time and stop_time: start_time, stop_time = sorted([start_time, stop_time]) # truncate stop_time to an actual traffic time point stop_time = truncate_datetime(stop_time) else: # the stop time is the most recent slice-time; get this by truncating # the appropriate amount from the current time stop_time = datetime.datetime.utcnow() stop_time = truncate_datetime(stop_time) # then the start time is easy to work out range = time_range_by_interval[interval] start_time = stop_time - range step = timedelta_by_name(interval) current_time = stop_time time_points = [] while current_time >= start_time: time_points.append(current_time) if interval != "month": current_time -= step else: current_time = decrement_month(current_time) return time_points def points_for_interval(interval): """Calculate the number of data points to render for a given interval.""" range = time_range_by_interval[interval] interval = timedelta_by_name(interval) return range.total_seconds() / interval.total_seconds() def make_history_query(cls, interval): """Build a generic query showing the history of a given aggregate.""" time_points = get_time_points(interval) q = Session.query(cls).filter(cls.date.in_(time_points)) # subscription stats doesn't have an interval (it's only daily) if hasattr(cls, "interval"): q = q.filter(cls.interval == interval) q = q.order_by(desc(cls.date)) return time_points, q def top_last_month(cls, key, ids=None, num=None): """Aggregate a listing of the top items (by pageviews) last month. We use the last month because it's guaranteed to be fully computed and therefore will be more meaningful. """ cur_month = datetime.date.today().replace(day=1) last_month = decrement_month(cur_month) q = ( Session.query(cls) .filter(cls.date == last_month) .filter(cls.interval == "month") .order_by(desc(cls.date), desc(cls.pageview_count)) ) if ids: q = q.filter(getattr(cls, key).in_(ids)) else: num = num or 55 q = q.limit(num) return [(getattr(r, key), (r.unique_count, r.pageview_count)) for r in q.all()] class CoerceToLong(TypeDecorator): # source: # https://groups.google.com/forum/?fromgroups=#!topic/sqlalchemy/3fipkThttQA impl = BigInteger def process_result_value(self, value, dialect): if value is not None: value = long(value) return value def sum(column): """Wrapper around sqlalchemy.sql.functions.sum to handle BigInteger. sqlalchemy returns a Decimal for sum over BigInteger values. Detect the column type and coerce to long if it's a BigInteger. """ if isinstance(column.property.columns[0].type, BigInteger): return sa_sum(column, type_=CoerceToLong) else: return sa_sum(column) def totals(cls, interval): """Aggregate sitewide totals for self-serve promotion traffic. We only aggregate codenames that start with a link type prefix which effectively filters out all DART / 300x100 etc. traffic numbers. """ time_points = get_time_points(interval) q = ( Session.query(cls.date, sum(cls.pageview_count).label("sum")) .filter(cls.interval == interval) .filter(cls.date.in_(time_points)) .filter(cls.codename.startswith(Link._type_prefix)) .group_by(cls.date) .order_by(desc(cls.date)) ) return fill_gaps(time_points, q, "sum") def total_by_codename(cls, codenames): """Return total lifetime pageviews (or clicks) for given codename(s).""" codenames = tup(codenames) # uses hour totals to get the most up-to-date count q = ( Session.query(cls.codename, sum(cls.pageview_count)) .filter(cls.interval == "hour") .filter(cls.codename.in_(codenames)) .group_by(cls.codename) ) return list(q) def promotion_history(cls, count_column, codename, start, stop): """Get hourly traffic for a self-serve promotion. Traffic stats are summed over all targets for classes that include a target. count_column should be cls.pageview_count or cls.unique_count. NOTE: when retrieving uniques the counts for ALL targets are summed, which isn't strictly correct but is the best we can do for now. """ time_points = get_time_points("hour", start, stop) q = ( Session.query(cls.date, sum(count_column)) .filter(cls.interval == "hour") .filter(cls.codename == codename) .filter(cls.date.in_(time_points)) .group_by(cls.date) .order_by(cls.date) ) return [(r[0], (r[1],)) for r in q.all()] def campaign_history(cls, codenames, start, stop): """Get hourly traffic for given campaigns.""" time_points = get_time_points("hour", start, stop) q = ( Session.query(cls) .filter(cls.interval == "hour") .filter(cls.codename.in_(codenames)) .filter(cls.date.in_(time_points)) .order_by(cls.date) ) return [ (r.date, r.codename, r.subreddit, (r.unique_count, r.pageview_count)) for r in q.all() ] @memoize("traffic_last_modified", time=60 * 10) def get_traffic_last_modified(): """Guess how far behind the traffic processing system is.""" try: return ( Session.query(SitewidePageviews.date) .order_by(desc(SitewidePageviews.date)) .limit(1) .one() ).date except NoResultFound: return datetime.datetime.min @memoize("missing_traffic", time=60 * 10) def get_missing_traffic(start, end): """Check for missing hourly traffic between start and end.""" # NOTE: start, end must be UTC time without tzinfo time_points = get_time_points("hour", start, end) q = ( Session.query(SitewidePageviews.date) .filter(SitewidePageviews.interval == "hour") .filter(SitewidePageviews.date.in_(time_points)) ) found = [t for (t,) in q] return [t for t in time_points if t not in found] class SitewidePageviews(Base): """Pageviews across all areas of the site.""" __tablename__ = "traffic_aggregate" date = Column(DateTime(), nullable=False, primary_key=True) interval = Column(String(), nullable=False, primary_key=True) unique_count = Column("unique", Integer()) pageview_count = Column("total", BigInteger()) @classmethod @memoize_traffic(time=3600) def history(cls, interval): time_points, q = make_history_query(cls, interval) return fill_gaps(time_points, q, "unique_count", "pageview_count") class PageviewsBySubreddit(Base): """Pageviews within a subreddit (i.e. /r/something/...).""" __tablename__ = "traffic_subreddits" subreddit = Column(String(), nullable=False, primary_key=True) date = Column(DateTime(), nullable=False, primary_key=True) interval = Column(String(), nullable=False, primary_key=True) unique_count = Column("unique", Integer()) pageview_count = Column("total", Integer()) @classmethod @memoize_traffic(time=3600) def history(cls, interval, subreddit): time_points, q = make_history_query(cls, interval) q = q.filter(cls.subreddit == subreddit) return fill_gaps(time_points, q, "unique_count", "pageview_count") @classmethod @memoize_traffic(time=3600 * 6) def top_last_month(cls, num=None): return top_last_month(cls, "subreddit", num=num) @classmethod @memoize_traffic(time=3600 * 6) def last_month(cls, srs): ids = [sr.name for sr in srs] return top_last_month(cls, "subreddit", ids=ids) class PageviewsBySubredditAndPath(Base): """Pageviews within a subreddit with action included. `srpath` is the subreddit name, a dash, then the controller method called to render the page the user viewed. e.g. reddit.com-GET_listing. This is useful to determine how many pageviews in a subreddit are on listing pages, comment pages, or elsewhere. """ __tablename__ = "traffic_srpaths" srpath = Column(String(), nullable=False, primary_key=True) date = Column(DateTime(), nullable=False, primary_key=True) interval = Column(String(), nullable=False, primary_key=True) unique_count = Column("unique", Integer()) pageview_count = Column("total", Integer()) class PageviewsByLanguage(Base): """Sitewide pageviews correlated by user's interface language.""" __tablename__ = "traffic_lang" lang = Column(String(), nullable=False, primary_key=True) date = Column(DateTime(), nullable=False, primary_key=True) interval = Column(String(), nullable=False, primary_key=True) unique_count = Column("unique", Integer()) pageview_count = Column("total", BigInteger()) @classmethod @memoize_traffic(time=3600) def history(cls, interval, lang): time_points, q = make_history_query(cls, interval) q = q.filter(cls.lang == lang) return fill_gaps(time_points, q, "unique_count", "pageview_count") @classmethod @memoize_traffic(time=3600 * 6) def top_last_month(cls): return top_last_month(cls, "lang") class ClickthroughsByCodename(Base): """Clickthrough counts for ads.""" __tablename__ = "traffic_click" codename = Column("fullname", String(), nullable=False, primary_key=True) date = Column(DateTime(), nullable=False, primary_key=True) interval = Column(String(), nullable=False, primary_key=True) unique_count = Column("unique", Integer()) pageview_count = Column("total", Integer()) @classmethod @memoize_traffic(time=3600) def history(cls, interval, codename): time_points, q = make_history_query(cls, interval) q = q.filter(cls.codename == codename) return fill_gaps(time_points, q, "unique_count", "pageview_count") @classmethod @memoize_traffic(time=3600) def promotion_history(cls, codename, start, stop): return promotion_history(cls, cls.unique_count, codename, start, stop) @classmethod @memoize_traffic(time=3600) def historical_totals(cls, interval): return totals(cls, interval) @classmethod @memoize_traffic(time=3600) def total_by_codename(cls, codenames): return total_by_codename(cls, codenames) class TargetedClickthroughsByCodename(Base): """Clickthroughs for ads, correlated by ad campaign.""" __tablename__ = "traffic_clicktarget" codename = Column("fullname", String(), nullable=False, primary_key=True) subreddit = Column(String(), nullable=False, primary_key=True) date = Column(DateTime(), nullable=False, primary_key=True) interval = Column(String(), nullable=False, primary_key=True) unique_count = Column("unique", Integer()) pageview_count = Column("total", Integer()) @classmethod @memoize_traffic(time=3600) def promotion_history(cls, codename, start, stop): return promotion_history(cls, cls.unique_count, codename, start, stop) @classmethod @memoize_traffic(time=3600) def total_by_codename(cls, codenames): return total_by_codename(cls, codenames) @classmethod def campaign_history(cls, codenames, start, stop): return campaign_history(cls, codenames, start, stop) class AdImpressionsByCodename(Base): """Impressions for ads.""" __tablename__ = "traffic_thing" codename = Column("fullname", String(), nullable=False, primary_key=True) date = Column(DateTime(), nullable=False, primary_key=True) interval = Column(String(), nullable=False, primary_key=True) unique_count = Column("unique", Integer()) pageview_count = Column("total", BigInteger()) @classmethod @memoize_traffic(time=3600) def history(cls, interval, codename): time_points, q = make_history_query(cls, interval) q = q.filter(cls.codename == codename) return fill_gaps(time_points, q, "unique_count", "pageview_count") @classmethod @memoize_traffic(time=3600) def promotion_history(cls, codename, start, stop): return promotion_history(cls, cls.pageview_count, codename, start, stop) @classmethod @memoize_traffic(time=3600) def historical_totals(cls, interval): return totals(cls, interval) @classmethod @memoize_traffic(time=3600) def top_last_month(cls): return top_last_month(cls, "codename") @classmethod @memoize_traffic(time=3600) def recent_codenames(cls, fullname): """Get a list of recent codenames used for 300x100 ads. The 300x100 ads get a codename that looks like "fullname_campaign". This function gets a list of recent campaigns. """ time_points = get_time_points("day") query = ( Session.query(distinct(cls.codename).label("codename")) .filter(cls.date.in_(time_points)) .filter(cls.codename.startswith(fullname)) ) return [row.codename for row in query] @classmethod @memoize_traffic(time=3600) def total_by_codename(cls, codename): return total_by_codename(cls, codename) class TargetedImpressionsByCodename(Base): """Impressions for ads, correlated by ad campaign.""" __tablename__ = "traffic_thingtarget" codename = Column("fullname", String(), nullable=False, primary_key=True) subreddit = Column(String(), nullable=False, primary_key=True) date = Column(DateTime(), nullable=False, primary_key=True) interval = Column(String(), nullable=False, primary_key=True) unique_count = Column("unique", Integer()) pageview_count = Column("total", Integer()) @classmethod @memoize_traffic(time=3600) def promotion_history(cls, codename, start, stop): return promotion_history(cls, cls.pageview_count, codename, start, stop) @classmethod @memoize_traffic(time=3600) def total_by_codename(cls, codenames): return total_by_codename(cls, codenames) @classmethod def campaign_history(cls, codenames, start, stop): return campaign_history(cls, codenames, start, stop) class SubscriptionsBySubreddit(Base): """Subscription statistics for subreddits. This table is different from the rest of the traffic ones. It only contains data at a daily interval (hence no `interval` column) and is updated separately in the subscribers cron job (see reddit-job-subscribers). """ __tablename__ = "traffic_subscriptions" subreddit = Column(String(), nullable=False, primary_key=True) date = Column(DateTime(), nullable=False, primary_key=True) subscriber_count = Column("unique", Integer()) @classmethod @memoize_traffic(time=3600) def history(cls, interval, subreddit): time_points, q = make_history_query(cls, interval) q = q.filter(cls.subreddit == subreddit) return fill_gaps(time_points, q, "subscriber_count") # create the tables if they don't exist if g.db_create_tables: Base.metadata.create_all()
VersionUpgrade44to45
VersionUpgrade44to45
# Copyright (c) 2022 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import configparser import fnmatch # To filter files that we need to delete. import io import os # To get the path to check for hidden stacks to delete. import re # To filter directories to search for hidden stacks to delete. import urllib.parse # To get the container IDs from file names. from typing import List, Tuple from UM.Logger import Logger from UM.Resources import ( Resources, ) # To get the path to check for hidden stacks to delete. from UM.Version import Version # To sort folders by version number. from UM.VersionUpgrade import VersionUpgrade # Settings that were merged into one. Each one is a pair of settings. If both # are overwritten, the key wins. If only the key or the value is overwritten, # that value is used in the key. _merged_settings = { "machine_head_with_fans_polygon": "machine_head_polygon", "support_wall_count": "support_tree_wall_count", } _removed_settings = {"support_tree_wall_thickness"} class VersionUpgrade44to45(VersionUpgrade): def __init__(self) -> None: """ Creates the version upgrade plug-in from 4.4 to 4.5. In this case the plug-in will also check for stacks that need to be deleted. """ super().__init__() # Only delete hidden stacks when upgrading from version 4.4. Not 4.3 or 4.5, just when you're starting out from 4.4. # If you're starting from an earlier version, you can't have had the bug that produces too many hidden stacks (https://github.com/Ultimaker/Cura/issues/6731). # If you're starting from a later version, the bug was already fixed. data_storage_root = os.path.dirname(Resources.getDataStoragePath()) if os.path.exists(data_storage_root): folders = set(os.listdir(data_storage_root)) # All version folders. folders = set( filter(lambda p: re.fullmatch(r"\d+\.\d+", p), folders) ) # Only folders with a correct version number as name. folders.difference_update( {os.path.basename(Resources.getDataStoragePath())} ) # Remove current version from candidates (since the folder was just copied). if folders: latest_version = max( folders, key=Version ) # Sort them by semantic version numbering. if latest_version == "4.4": self.removeHiddenStacks() def removeHiddenStacks(self) -> None: """ If starting the upgrade from 4.4, this will remove any hidden printer stacks from the configuration folder as well as all of the user profiles and definition changes profiles. This will ONLY run when upgrading from 4.4, not when e.g. upgrading from 4.3 to 4.6 (through 4.4). This is because it's to fix a bug (https://github.com/Ultimaker/Cura/issues/6731) that occurred in 4.4 only, so only there will it have hidden stacks that need to be deleted. If people upgrade from 4.3 they don't need to be deleted. If people upgrade from 4.5 they have already been deleted previously or never got the broken hidden stacks. """ Logger.log("d", "Removing all hidden container stacks.") hidden_global_stacks = set() # Which global stacks have been found? We'll delete anything referred to by these. Set of stack IDs. hidden_extruder_stacks = ( set() ) # Which extruder stacks refer to the hidden global profiles? hidden_instance_containers = ( set() ) # Which instance containers are referred to by the hidden stacks? exclude_directories = {"plugins"} # First find all of the hidden container stacks. data_storage = Resources.getDataStoragePath() for root, dirs, files in os.walk(data_storage): dirs[:] = [dir for dir in dirs if dir not in exclude_directories] for filename in fnmatch.filter(files, "*.global.cfg"): parser = configparser.ConfigParser(interpolation=None) try: parser.read(os.path.join(root, filename)) except OSError: # File not found or insufficient rights. continue except configparser.Error: # Invalid file format. continue if ( "metadata" in parser and "hidden" in parser["metadata"] and parser["metadata"]["hidden"] == "True" ): stack_id = urllib.parse.unquote_plus( os.path.basename(filename).split(".")[0] ) hidden_global_stacks.add(stack_id) # The user container and definition changes container are specific to this stack. We need to delete those too. if "containers" in parser: if "0" in parser["containers"]: # User container. hidden_instance_containers.add(parser["containers"]["0"]) if "6" in parser["containers"]: # Definition changes container. hidden_instance_containers.add(parser["containers"]["6"]) os.remove(os.path.join(root, filename)) # Walk a second time to find all extruder stacks referring to these hidden container stacks. for root, dirs, files in os.walk(data_storage): dirs[:] = [dir for dir in dirs if dir not in exclude_directories] for filename in fnmatch.filter(files, "*.extruder.cfg"): parser = configparser.ConfigParser(interpolation=None) try: parser.read(os.path.join(root, filename)) except OSError: # File not found or insufficient rights. continue except configparser.Error: # Invalid file format. continue if ( "metadata" in parser and "machine" in parser["metadata"] and parser["metadata"]["machine"] in hidden_global_stacks ): stack_id = urllib.parse.unquote_plus( os.path.basename(filename).split(".")[0] ) hidden_extruder_stacks.add(stack_id) # The user container and definition changes container are specific to this stack. We need to delete those too. if "containers" in parser: if "0" in parser["containers"]: # User container. hidden_instance_containers.add(parser["containers"]["0"]) if "6" in parser["containers"]: # Definition changes container. hidden_instance_containers.add(parser["containers"]["6"]) os.remove(os.path.join(root, filename)) # Walk a third time to remove all instance containers that are referred to by either of those. for root, dirs, files in os.walk(data_storage): dirs[:] = [dir for dir in dirs if dir not in exclude_directories] for filename in fnmatch.filter(files, "*.inst.cfg"): container_id = urllib.parse.unquote_plus( os.path.basename(filename).split(".")[0] ) if container_id in hidden_instance_containers: try: os.remove(os.path.join(root, filename)) except ( OSError ): # Is a directory, file not found, or insufficient rights. continue def upgradePreferences( self, serialized: str, filename: str ) -> Tuple[List[str], List[str]]: """Upgrades Preferences to have the new version number. This renames the renamed settings in the list of visible settings. """ parser = configparser.ConfigParser(interpolation=None) parser.read_string(serialized) # Update version number. parser["metadata"]["setting_version"] = "11" result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] def upgradeInstanceContainer( self, serialized: str, filename: str ) -> Tuple[List[str], List[str]]: """Upgrades instance containers to have the new version number. This renames the renamed settings in the containers. """ parser = configparser.ConfigParser(interpolation=None, comment_prefixes=()) parser.read_string(serialized) # Update version number. parser["metadata"]["setting_version"] = "11" if "values" in parser: # Merged settings: When two settings are merged, one is preferred. # If the preferred one is available, that value is taken regardless # of the other one. If only the non-preferred one is available, that # value is moved to the preferred setting value. for preferred, removed in _merged_settings.items(): if removed in parser["values"]: if preferred not in parser["values"]: parser["values"][preferred] = parser["values"][removed] del parser["values"][removed] for removed in _removed_settings: if removed in parser["values"]: del parser["values"][removed] result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] def upgradeStack( self, serialized: str, filename: str ) -> Tuple[List[str], List[str]]: """Upgrades stacks to have the new version number.""" parser = configparser.ConfigParser(interpolation=None) parser.read_string(serialized) # Update version number. if "metadata" not in parser: parser["metadata"] = {} parser["metadata"]["setting_version"] = "11" result = io.StringIO() parser.write(result) return [filename], [result.getvalue()]
bittorrent
peer
# neubot/bittorrent/peer.py # # Copyright (c) 2011 Simone Basso <bassosimone@gmail.com>, # NEXA Center for Internet & Society at Politecnico di Torino # # This file is part of Neubot <http://www.neubot.org/>. # # Neubot is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Neubot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Neubot. If not, see <http://www.gnu.org/licenses/>. # """ This file tries to emulate the behavior of a BitTorrent peer to the extent that is required by Neubot's purpose. """ import getopt import logging import random import sys if __name__ == "__main__": sys.path.insert(0, ".") from neubot import utils, utils_net, utils_rc from neubot.bittorrent import config from neubot.bittorrent.bitfield import Bitfield, make_bitfield from neubot.bittorrent.btsched import sched_req # Constants from neubot.bittorrent.config import PIECE_LEN from neubot.bittorrent.stream import StreamBitTorrent from neubot.config import CONFIG from neubot.net.poller import POLLER from neubot.net.stream import StreamHandler from neubot.state import STATE LO_THRESH = 3 MAX_REPEAT = 7 TARGET = 5 # States of the PeerNeubot object STATES = ( INITIAL, SENT_INTERESTED, DOWNLOADING, UPLOADING, SENT_NOT_INTERESTED, WAIT_REQUEST, WAIT_NOT_INTERESTED, ) = range(7) # # This class implements the test finite state # machine and message exchange that are documented # by <doc/neubot/bittorrent/peer.png>. # class PeerNeubot(StreamHandler): def __init__(self, poller): StreamHandler.__init__(self, poller) STATE.update("test", "bittorrent") self.connector_side = False self.saved_bytes = 0 self.saved_ticks = 0 self.inflight = 0 self.dload_speed = 0 self.repeat = MAX_REPEAT self.state = INITIAL self.infohash = None self.rtt = 0 self.version = 1 self.begin_upload = 0.0 def configure(self, conf): StreamHandler.configure(self, conf) self.numpieces = conf["bittorrent.numpieces"] self.bitfield = make_bitfield(self.numpieces) self.peer_bitfield = make_bitfield(self.numpieces) self.my_id = conf["bittorrent.my_id"] self.target_bytes = conf["bittorrent.bytes.down"] self.make_sched() def make_sched(self): self.sched_req = sched_req( self.bitfield, self.peer_bitfield, self.target_bytes, self.conf["bittorrent.piece_len"], self.conf["bittorrent.piece_len"], ) def connect(self, endpoint, count=1): self.connector_side = True # # In Neubot the listener does not have an infohash # and handshakes, including connector infohash, after # it receives the connector handshake. # self.infohash = self.conf["bittorrent.infohash"] logging.info("BitTorrent: connecting to %s in progress...", str(endpoint)) StreamHandler.connect(self, endpoint, count) # # Empty but here to remind hackers that the controlling # object must divert this function to its own function in # order to catch the case where we cannot connect to the # remote end. # def connection_failed(self, connector, exception): pass def connection_made(self, sock, endpoint, rtt): if rtt: latency = utils.time_formatter(rtt) logging.info( "BitTorrent: connecting to %s ... done, %s", str(utils_net.getpeername(sock)), latency, ) STATE.update("test_latency", latency) self.rtt = rtt stream = StreamBitTorrent(self.poller) if not self.connector_side: # # Note that we use self.__class__() because self # might be a subclass of PeerNeubot. # peer = self.__class__(self.poller) peer.configure(self.conf) # Inherit version peer.version = self.version else: peer = self stream.attach(peer, sock, peer.conf) stream.watchdog = self.conf["bittorrent.watchdog"] def connection_ready(self, stream): stream.send_bitfield(str(self.bitfield)) logging.debug("BitTorrent: test version %d", self.version) logging.info("BitTorrent: receiving bitfield in progress...") if self.connector_side: self.state = SENT_INTERESTED stream.send_interested() def got_bitfield(self, bitfield): self.peer_bitfield = Bitfield(self.numpieces, bitfield) logging.info("BitTorrent: receiving bitfield ... done") # Upload # # BEP0003 suggests to keep blocks into an application # level queue and just pipe few blocks into the socket # buffer, allowing for graceful abort. # def got_request(self, stream, index, begin, length): # # Start actual uploading when we receive the first REQUEST. # When the upload is over and we are waiting for NOT_INTERESTED # we ignore incoming REQUESTs. Because they have "certainly" # been sent before the peer received our NOT_INTERESTED. # if self.version >= 2: if self.state == WAIT_REQUEST: self.begin_upload = utils.ticks() self.state = UPLOADING if self.version == 2: # send_complete() kickstarts the uploader self.send_complete(stream) return elif self.state == WAIT_NOT_INTERESTED: return if self.state != UPLOADING: raise RuntimeError("REQUEST when state != UPLOADING") if begin + length > PIECE_LEN: raise RuntimeError("REQUEST too big") # # The rule that we send a PIECE each time we get a REQUEST is # not valid anymore, pieces go on the wire when the send queue # becomes empty. # if self.version == 2: return # # TODO Here we should use the random block # generator but before we do that we should # also make sure it does not slow down the # bittorrent test. # block = chr(random.randint(32, 126)) * length stream.send_piece(index, begin, block) def send_complete(self, stream): """Invoked when the send queue is empty""" if self.version >= 2 and self.state == UPLOADING: # # The sender stops sending when the upload has run for # enough time, notifies peer with CHOKE and waits for # NOT_INTERESTED. # diff = utils.ticks() - self.begin_upload if diff > TARGET: self.state = WAIT_NOT_INTERESTED stream.send_choke() return if self.version == 3: return # # TODO Here we should use the random block # generator but before we do that we should # also make sure it does not slow down the # bittorrent test. # block = chr(random.randint(32, 126)) * PIECE_LEN index = random.randrange(self.numpieces) stream.send_piece(index, 0, block) def got_interested(self, stream): if self.connector_side and self.state != SENT_NOT_INTERESTED: raise RuntimeError("INTERESTED when state != SENT_NOT_INTERESTED") if not self.connector_side and self.state != INITIAL: raise RuntimeError("INTERESTED when state != INITIAL") logging.info("BitTorrent: uploading in progress...") # # We don't start uploading until we receive # the first REQUEST from the peer. # if self.version >= 2: self.state = WAIT_REQUEST stream.send_unchoke() return self.state = UPLOADING stream.send_unchoke() def got_not_interested(self, stream): if self.state != UPLOADING and self.version == 1: raise RuntimeError("NOT_INTERESTED when state != UPLOADING") # # It's the sender that decides when it has sent # for enough time and enters WAIT_NOT_INTERESTED. # if self.state != WAIT_NOT_INTERESTED and self.version >= 2: raise RuntimeError("NOT_INTERESTED when state " "!= WAIT_NOT_INTERESTED") logging.info("BitTorrent: uploading ... done") if self.connector_side: self.complete(stream, self.dload_speed, self.rtt, self.target_bytes) stream.close() else: self.state = SENT_INTERESTED stream.send_interested() # Download def got_choke(self, stream): # # The download terminates when we recv CHOKE. # The code below is adapted from version 1 # code in got_piece(). # if self.version >= 2: logging.info("BitTorrent: download ... done") # Calculate speed xfered = stream.bytes_recv_tot - self.saved_bytes elapsed = utils.ticks() - self.saved_ticks self.dload_speed = xfered / elapsed # Properly terminate download self.state = SENT_NOT_INTERESTED stream.send_not_interested() download = utils.speed_formatter(self.dload_speed) logging.info("BitTorrent: download speed: %s", download) # To next state if not self.connector_side: self.complete(stream, self.dload_speed, self.rtt, self.target_bytes) else: STATE.update("test_download", download) # We MUST NOT fallthru return # # We don't implement CHOKE and we cannot ignore it, since # that would violate the specification. So we raise an # exception, which has the side effect that the connection # will be closed. # raise RuntimeError("Unexpected CHOKE message") def got_unchoke(self, stream): if self.state != SENT_INTERESTED: raise RuntimeError("UNCHOKE when state != SENT_INTERESTED") else: self.state = DOWNLOADING # # We just need to send one request to tell # the peer we would like the download to start. # if self.version >= 2: logging.info("BitTorrent: download in progress...") index = random.randrange(self.numpieces) stream.send_request(index, 0, PIECE_LEN) return # # When we're unchoked immediately pipeline a number # of requests and then put another request on the pipe # as soon as a piece arrives. Note that the pipelining # is automagically done by the scheduler generator. # The idea of pipelining is that of filling with many # messages the space between us and the peer to do # something that approxymates a continuous download. # logging.info( "BitTorrent: downloading %d bytes in progress...", self.target_bytes ) burst = self.sched_req.next() for index, begin, length in burst: stream.send_request(index, begin, length) self.inflight += 1 def got_have(self, index): if self.state != UPLOADING: raise RuntimeError("HAVE when state != UPLOADING") self.peer_bitfield[index] = 1 # We don't use HAVE messages at the moment logging.warning("Ignoring unexpected HAVE message") def got_piece(self, *args): stream = args[0] if self.state != DOWNLOADING: raise RuntimeError("PIECE when state != DOWNLOADING") # Start measuring if not self.saved_ticks: self.saved_bytes = stream.bytes_recv_tot self.saved_ticks = utils.ticks() # # The download is driven by the sender and # we just need to discard the pieces. # Periodically send some requests to the other # end, with probability 10%. # if self.version >= 2: if self.version == 3 or random.random() < 0.1: index = random.randrange(self.numpieces) stream.send_request(index, 0, PIECE_LEN) return self.get_piece_old(stream) # # Time to put another piece on the wire, assuming # that we can do that. Note that we start measuring # after the first PIECE message: at that point we # can assume the pipeline to be full (note that this # holds iff bdp < initial-burst). # Note to self: when the connection is buffer limited # the TCP stack is very likely to miss fast retransmit # and recovery. We cannot measure throughput in that # condition but the fact that TCP is more sensitive to # losses might be interesting as well. # def get_piece_old(self, stream): """implements get_piece() for test version 1""" # Get next piece try: vector = self.sched_req.next() except StopIteration: vector = None if vector: # Send next piece index, begin, length = vector[0] stream.send_request(index, begin, length) else: # # No more pieces: Wait for the pipeline to empty # # TODO Check whether it's better to stop the measurement # when the pipeline starts emptying instead of when it # becomes empty (maybe it is reasonable to discard when # it fills and when it empties, isn't it?) # self.inflight -= 1 if self.inflight == 0: xfered = stream.bytes_recv_tot - self.saved_bytes elapsed = utils.ticks() - self.saved_ticks speed = xfered / elapsed logging.info( "BitTorrent: downloading %d bytes ... %s", self.target_bytes, utils.speed_formatter(speed), ) # # Make sure that next test would take about # TARGET secs, under current conditions. # We're a bit conservative when the elapsed # time is small because there is the risk of # overestimating the available bandwith. # TODO Don't start from scratch but use speedtest # estimate (maybe we need to divide it by two # but I'm not sure at the moment). # if elapsed >= LO_THRESH / 3: self.target_bytes = int(self.target_bytes * TARGET / elapsed) else: self.target_bytes *= 2 # # The stopping rule is when the test has run # for more than LO_THRESH seconds or after some # number of runs (just to be sure that we can # not run forever due to unexpected network # conditions). # self.repeat -= 1 if elapsed > LO_THRESH or self.repeat <= 0: self.dload_speed = speed self.state = SENT_NOT_INTERESTED stream.send_not_interested() if not self.connector_side: self.complete( stream, self.dload_speed, self.rtt, self.target_bytes ) else: download = utils.speed_formatter(self.dload_speed) STATE.update("test_progress", "50%", publish=False) STATE.update("test_download", download) else: self.saved_ticks = 0 self.make_sched() self.state = SENT_INTERESTED # XXX self.got_unchoke(stream) elif self.inflight < 0: raise RuntimeError("Inflight became negative") def complete(self, stream, speed, rtt, target_bytes): pass def main(args): """Main function""" try: options, arguments = getopt.getopt(args[1:], "lO:v") except getopt.error: sys.exit("usage: neubot bittorrent_peer [-lv] [-O setting]") if arguments: sys.exit("usage: neubot bittorrent_peer [-lv] [-O setting]") settings = ['address "127.0.0.1 ::1"', "port 6881", "version 1"] listener = False for name, value in options: if name == "-l": listener = True elif name == "-O": settings.append(value) elif name == "-v": CONFIG["verbose"] = 1 settings = utils_rc.parse_safe(iterable=settings) config_copy = CONFIG.copy() config.finalize_conf(config_copy) peer = PeerNeubot(POLLER) peer.configure(config_copy) # BLEAH peer.version = int(settings["version"]) if not listener: peer.connect((settings["address"], int(settings["port"]))) else: peer.listen((settings["address"], int(settings["port"]))) POLLER.loop() if __name__ == "__main__": main(sys.argv)
extractor
porn91
# coding: utf-8 from __future__ import unicode_literals from ..utils import ExtractorError, int_or_none, parse_duration from .common import InfoExtractor class Porn91IE(InfoExtractor): IE_NAME = "91porn" _VALID_URL = r"(?:https?://)(?:www\.|)91porn\.com/.+?\?viewkey=(?P<id>[\w\d]+)" _TEST = { "url": "http://91porn.com/view_video.php?viewkey=7e42283b4f5ab36da134", "md5": "7fcdb5349354f40d41689bd0fa8db05a", "info_dict": { "id": "7e42283b4f5ab36da134", "title": "18岁大一漂亮学妹,水嫩性感,再爽一次!", "ext": "mp4", "duration": 431, "age_limit": 18, }, } def _real_extract(self, url): video_id = self._match_id(url) self._set_cookie("91porn.com", "language", "cn_CN") webpage = self._download_webpage( "http://91porn.com/view_video.php?viewkey=%s" % video_id, video_id ) if "作为游客,你每天只可观看10个视频" in webpage: raise ExtractorError( "91 Porn says: Daily limit 10 videos exceeded", expected=True ) title = self._search_regex( r'<div id="viewvideo-title">([^<]+)</div>', webpage, "title" ) title = title.replace("\n", "") video_link_url = self._search_regex( r'<textarea[^>]+id=["\']fm-video_link[^>]+>([^<]+)</textarea>', webpage, "video link", ) videopage = self._download_webpage(video_link_url, video_id) info_dict = self._parse_html5_media_entries(url, videopage, video_id)[0] duration = parse_duration( self._search_regex( r"时长:\s*</span>\s*(\d+:\d+)", webpage, "duration", fatal=False ) ) comment_count = int_or_none( self._search_regex( r"留言:\s*</span>\s*(\d+)", webpage, "comment count", fatal=False ) ) info_dict.update( { "id": video_id, "title": title, "duration": duration, "comment_count": comment_count, "age_limit": self._rta_search(webpage), } ) return info_dict
extractor
pluralsight
from __future__ import unicode_literals import collections import json import os import random import re from ..compat import compat_str, compat_urlparse from ..utils import ( ExtractorError, dict_get, float_or_none, int_or_none, parse_duration, qualities, srt_subtitles_timecode, try_get, update_url_query, urlencode_postdata, ) from .common import InfoExtractor class PluralsightBaseIE(InfoExtractor): _API_BASE = "https://app.pluralsight.com" _GRAPHQL_EP = "%s/player/api/graphql" % _API_BASE _GRAPHQL_HEADERS = { "Content-Type": "application/json;charset=UTF-8", } _GRAPHQL_COURSE_TMPL = """ query BootstrapPlayer { rpc { bootstrapPlayer { profile { firstName lastName email username userHandle authed isAuthed plan } course(courseId: "%s") { name title courseHasCaptions translationLanguages { code name } supportsWideScreenVideoFormats timestamp modules { name title duration formattedDuration author authorized clips { authorized clipId duration formattedDuration id index moduleIndex moduleTitle name title watched } } } } } }""" def _download_course(self, course_id, url, display_id): try: return self._download_course_rpc(course_id, url, display_id) except ExtractorError: # Old API fallback return self._download_json( "https://app.pluralsight.com/player/user/api/v1/player/payload", display_id, data=urlencode_postdata({"courseId": course_id}), headers={"Referer": url}, ) def _download_course_rpc(self, course_id, url, display_id): response = self._download_json( self._GRAPHQL_EP, display_id, data=json.dumps( {"query": self._GRAPHQL_COURSE_TMPL % course_id, "variables": {}} ).encode("utf-8"), headers=self._GRAPHQL_HEADERS, ) course = try_get( response, lambda x: x["data"]["rpc"]["bootstrapPlayer"]["course"], dict ) if course: return course raise ExtractorError( "%s said: %s" % (self.IE_NAME, response["error"]["message"]), expected=True ) class PluralsightIE(PluralsightBaseIE): IE_NAME = "pluralsight" _VALID_URL = r"https?://(?:(?:www|app)\.)?pluralsight\.com/(?:training/)?player\?" _LOGIN_URL = "https://app.pluralsight.com/id/" _NETRC_MACHINE = "pluralsight" _TESTS = [ { "url": "http://www.pluralsight.com/training/player?author=mike-mckeown&name=hosting-sql-server-windows-azure-iaas-m7-mgmt&mode=live&clip=3&course=hosting-sql-server-windows-azure-iaas", "md5": "4d458cf5cf4c593788672419a8dd4cf8", "info_dict": { "id": "hosting-sql-server-windows-azure-iaas-m7-mgmt-04", "ext": "mp4", "title": "Demo Monitoring", "duration": 338, }, "skip": "Requires pluralsight account credentials", }, { "url": "https://app.pluralsight.com/training/player?course=angularjs-get-started&author=scott-allen&name=angularjs-get-started-m1-introduction&clip=0&mode=live", "only_matching": True, }, { # available without pluralsight account "url": "http://app.pluralsight.com/training/player?author=scott-allen&name=angularjs-get-started-m1-introduction&mode=live&clip=0&course=angularjs-get-started", "only_matching": True, }, { "url": "https://app.pluralsight.com/player?course=ccna-intro-networking&author=ross-bagurdes&name=ccna-intro-networking-m06&clip=0", "only_matching": True, }, ] GRAPHQL_VIEWCLIP_TMPL = """ query viewClip { viewClip(input: { author: "%(author)s", clipIndex: %(clipIndex)d, courseName: "%(courseName)s", includeCaptions: %(includeCaptions)s, locale: "%(locale)s", mediaType: "%(mediaType)s", moduleName: "%(moduleName)s", quality: "%(quality)s" }) { urls { url cdn rank source }, status } }""" def _real_initialize(self): self._login() def _login(self): username, password = self._get_login_info() if username is None: return login_page = self._download_webpage( self._LOGIN_URL, None, "Downloading login page" ) login_form = self._hidden_inputs(login_page) login_form.update( { "Username": username, "Password": password, } ) post_url = self._search_regex( r'<form[^>]+action=(["\'])(?P<url>.+?)\1', login_page, "post url", default=self._LOGIN_URL, group="url", ) if not post_url.startswith("http"): post_url = compat_urlparse.urljoin(self._LOGIN_URL, post_url) response = self._download_webpage( post_url, None, "Logging in", data=urlencode_postdata(login_form), headers={"Content-Type": "application/x-www-form-urlencoded"}, ) error = self._search_regex( r'<span[^>]+class="field-validation-error"[^>]*>([^<]+)</span>', response, "error message", default=None, ) if error: raise ExtractorError("Unable to login: %s" % error, expected=True) if all( not re.search(p, response) for p in ( r"__INITIAL_STATE__", r'["\']currentUser["\']', # new layout? r">\s*Sign out\s*<", ) ): BLOCKED = "Your account has been blocked due to suspicious activity" if BLOCKED in response: raise ExtractorError("Unable to login: %s" % BLOCKED, expected=True) MUST_AGREE = "To continue using Pluralsight, you must agree to" if any(p in response for p in (MUST_AGREE, ">Disagree<", ">Agree<")): raise ExtractorError( "Unable to login: %s some documents. Go to pluralsight.com, " "log in and agree with what Pluralsight requires." % MUST_AGREE, expected=True, ) raise ExtractorError("Unable to log in") def _get_subtitles(self, author, clip_idx, clip_id, lang, name, duration, video_id): captions = None if clip_id: captions = self._download_json( "%s/transcript/api/v1/caption/json/%s/%s" % (self._API_BASE, clip_id, lang), video_id, "Downloading captions JSON", "Unable to download captions JSON", fatal=False, ) if not captions: captions_post = { "a": author, "cn": int(clip_idx), "lc": lang, "m": name, } captions = self._download_json( "%s/player/retrieve-captions" % self._API_BASE, video_id, "Downloading captions JSON", "Unable to download captions JSON", fatal=False, data=json.dumps(captions_post).encode("utf-8"), headers={"Content-Type": "application/json;charset=utf-8"}, ) if captions: return { lang: [ { "ext": "json", "data": json.dumps(captions), }, { "ext": "srt", "data": self._convert_subtitles(duration, captions), }, ] } @staticmethod def _convert_subtitles(duration, subs): srt = "" TIME_OFFSET_KEYS = ("displayTimeOffset", "DisplayTimeOffset") TEXT_KEYS = ("text", "Text") for num, current in enumerate(subs): current = subs[num] start, text = ( float_or_none( dict_get(current, TIME_OFFSET_KEYS, skip_false_values=False) ), dict_get(current, TEXT_KEYS), ) if start is None or text is None: continue end = ( duration if num == len(subs) - 1 else float_or_none( dict_get(subs[num + 1], TIME_OFFSET_KEYS, skip_false_values=False) ) ) if end is None: continue srt += os.linesep.join( ( "%d" % num, "%s --> %s" % (srt_subtitles_timecode(start), srt_subtitles_timecode(end)), text, os.linesep, ) ) return srt def _real_extract(self, url): qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query) author = qs.get("author", [None])[0] name = qs.get("name", [None])[0] clip_idx = qs.get("clip", [None])[0] course_name = qs.get("course", [None])[0] if any( not f for f in ( author, name, clip_idx, course_name, ) ): raise ExtractorError("Invalid URL", expected=True) display_id = "%s-%s" % (name, clip_idx) course = self._download_course(course_name, url, display_id) collection = course["modules"] clip = None for module_ in collection: if name in (module_.get("moduleName"), module_.get("name")): for clip_ in module_.get("clips", []): clip_index = clip_.get("clipIndex") if clip_index is None: clip_index = clip_.get("index") if clip_index is None: continue if compat_str(clip_index) == clip_idx: clip = clip_ break if not clip: raise ExtractorError("Unable to resolve clip") title = clip["title"] clip_id = clip.get("clipName") or clip.get("name") or clip["clipId"] QUALITIES = { "low": {"width": 640, "height": 480}, "medium": {"width": 848, "height": 640}, "high": {"width": 1024, "height": 768}, "high-widescreen": {"width": 1280, "height": 720}, } QUALITIES_PREFERENCE = ( "low", "medium", "high", "high-widescreen", ) quality_key = qualities(QUALITIES_PREFERENCE) AllowedQuality = collections.namedtuple("AllowedQuality", ["ext", "qualities"]) ALLOWED_QUALITIES = ( AllowedQuality( "webm", [ "high", ], ), AllowedQuality( "mp4", [ "low", "medium", "high", ], ), ) # Some courses also offer widescreen resolution for high quality (see # https://github.com/ytdl-org/youtube-dl/issues/7766) widescreen = course.get("supportsWideScreenVideoFormats") is True best_quality = "high-widescreen" if widescreen else "high" if widescreen: for allowed_quality in ALLOWED_QUALITIES: allowed_quality.qualities.append(best_quality) # In order to minimize the number of calls to ViewClip API and reduce # the probability of being throttled or banned by Pluralsight we will request # only single format until formats listing was explicitly requested. if self._downloader.params.get("listformats", False): allowed_qualities = ALLOWED_QUALITIES else: def guess_allowed_qualities(): req_format = self._downloader.params.get("format") or "best" req_format_split = req_format.split("-", 1) if len(req_format_split) > 1: req_ext, req_quality = req_format_split req_quality = "-".join(req_quality.split("-")[:2]) for allowed_quality in ALLOWED_QUALITIES: if ( req_ext == allowed_quality.ext and req_quality in allowed_quality.qualities ): return (AllowedQuality(req_ext, (req_quality,)),) req_ext = ( "webm" if self._downloader.params.get("prefer_free_formats") else "mp4" ) return (AllowedQuality(req_ext, (best_quality,)),) allowed_qualities = guess_allowed_qualities() formats = [] for ext, qualities_ in allowed_qualities: for quality in qualities_: f = QUALITIES[quality].copy() clip_post = { "author": author, "includeCaptions": "false", "clipIndex": int(clip_idx), "courseName": course_name, "locale": "en", "moduleName": name, "mediaType": ext, "quality": "%dx%d" % (f["width"], f["height"]), } format_id = "%s-%s" % (ext, quality) try: viewclip = self._download_json( self._GRAPHQL_EP, display_id, "Downloading %s viewclip graphql" % format_id, data=json.dumps( { "query": self.GRAPHQL_VIEWCLIP_TMPL % clip_post, "variables": {}, } ).encode("utf-8"), headers=self._GRAPHQL_HEADERS, )["data"]["viewClip"] except ExtractorError: # Still works but most likely will go soon viewclip = self._download_json( "%s/video/clips/viewclip" % self._API_BASE, display_id, "Downloading %s viewclip JSON" % format_id, fatal=False, data=json.dumps(clip_post).encode("utf-8"), headers={"Content-Type": "application/json;charset=utf-8"}, ) # Pluralsight tracks multiple sequential calls to ViewClip API and start # to return 429 HTTP errors after some time (see # https://github.com/ytdl-org/youtube-dl/pull/6989). Moreover it may even lead # to account ban (see https://github.com/ytdl-org/youtube-dl/issues/6842). # To somewhat reduce the probability of these consequences # we will sleep random amount of time before each call to ViewClip. self._sleep( random.randint(5, 10), display_id, "%(video_id)s: Waiting for %(timeout)s seconds to avoid throttling", ) if not viewclip: continue clip_urls = viewclip.get("urls") if not isinstance(clip_urls, list): continue for clip_url_data in clip_urls: clip_url = clip_url_data.get("url") if not clip_url: continue cdn = clip_url_data.get("cdn") clip_f = f.copy() clip_f.update( { "url": clip_url, "ext": ext, "format_id": "%s-%s" % (format_id, cdn) if cdn else format_id, "quality": quality_key(quality), "source_preference": int_or_none(clip_url_data.get("rank")), } ) formats.append(clip_f) self._sort_formats(formats) duration = int_or_none(clip.get("duration")) or parse_duration( clip.get("formattedDuration") ) # TODO: other languages? subtitles = self.extract_subtitles( author, clip_idx, clip.get("clipId"), "en", name, duration, display_id ) return { "id": clip_id, "title": title, "duration": duration, "creator": author, "formats": formats, "subtitles": subtitles, } class PluralsightCourseIE(PluralsightBaseIE): IE_NAME = "pluralsight:course" _VALID_URL = r"https?://(?:(?:www|app)\.)?pluralsight\.com/(?:library/)?courses/(?P<id>[^/]+)" _TESTS = [ { # Free course from Pluralsight Starter Subscription for Microsoft TechNet # https://offers.pluralsight.com/technet?loc=zTS3z&prod=zOTprodz&tech=zOttechz&prog=zOTprogz&type=zSOz&media=zOTmediaz&country=zUSz "url": "http://www.pluralsight.com/courses/hosting-sql-server-windows-azure-iaas", "info_dict": { "id": "hosting-sql-server-windows-azure-iaas", "title": "Hosting SQL Server in Microsoft Azure IaaS Fundamentals", "description": "md5:61b37e60f21c4b2f91dc621a977d0986", }, "playlist_count": 31, }, { # available without pluralsight account "url": "https://www.pluralsight.com/courses/angularjs-get-started", "only_matching": True, }, { "url": "https://app.pluralsight.com/library/courses/understanding-microsoft-azure-amazon-aws/table-of-contents", "only_matching": True, }, ] def _real_extract(self, url): course_id = self._match_id(url) # TODO: PSM cookie course = self._download_course(course_id, url, course_id) title = course["title"] course_name = course["name"] course_data = course["modules"] description = course.get("description") or course.get("shortDescription") entries = [] for num, module in enumerate(course_data, 1): author = module.get("author") module_name = module.get("name") if not author or not module_name: continue for clip in module.get("clips", []): clip_index = int_or_none(clip.get("index")) if clip_index is None: continue clip_url = update_url_query( "%s/player" % self._API_BASE, query={ "mode": "live", "course": course_name, "author": author, "name": module_name, "clip": clip_index, }, ) entries.append( { "_type": "url_transparent", "url": clip_url, "ie_key": PluralsightIE.ie_key(), "chapter": module.get("title"), "chapter_number": num, "chapter_id": module.get("moduleRef"), } ) return self.playlist_result(entries, course_id, title, description)
migrations
0007_dashboard_permissions
# Generated by Django 3.2.5 on 2022-01-31 20:50 import django.db.models.deletion import posthog.models.utils from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("posthog", "0203_dashboard_permissions"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("ee", "0006_event_definition_verification"), ] operations = [ migrations.CreateModel( name="DashboardPrivilege", fields=[ ( "id", models.UUIDField( default=posthog.models.utils.UUIDT, editable=False, primary_key=True, serialize=False, ), ), ( "level", models.PositiveSmallIntegerField( choices=[ (21, "Everyone in the project can edit"), (37, "Only those invited to this dashboard can edit"), ] ), ), ("added_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ( "dashboard", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="privileges", related_query_name="privilege", to="posthog.dashboard", ), ), ( "user", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="explicit_dashboard_privileges", related_query_name="explicit_dashboard_privilege", to=settings.AUTH_USER_MODEL, ), ), ], ), migrations.AddConstraint( model_name="dashboardprivilege", constraint=models.UniqueConstraint( fields=("dashboard", "user"), name="unique_explicit_dashboard_privilege" ), ), ]
diagram
group
"""Grouping functionality allows nesting of one item within another item (parent item). This is useful in several use cases. - artifact deployed within a node - a class within a package, or a component - composite structures (i.e. component within a node) """ from __future__ import annotations import itertools from typing import Callable from gaphor.core.modeling import Diagram, Element, self_and_owners from generic.multidispatch import FunctionDispatcher, multidispatch def change_owner(new_parent, element): if element.model is not new_parent.model: return False if element.owner is new_parent: return False if new_parent is None and element.owner: return ungroup(element.owner, element) if not can_group(new_parent, element): return False if element.owner: ungroup(element.owner, element) return group(new_parent, element) def no_group(parent, element) -> bool: return False class GroupPreconditions: def __init__(self, func): self.__func = func def __getattr__(self, key): return getattr(self.__func, key) def __call__(self, parent, element) -> bool: if element in self_and_owners(parent): return False return self.__func(parent, element) # type: ignore[no-any-return] group: FunctionDispatcher[Callable[[Element, Element], bool]] = GroupPreconditions( multidispatch(object, object)(no_group) ) group.register(None, object)(no_group) def can_group(parent: Element, element_or_type: Element | type[Element]) -> bool: element_type = ( type(element_or_type) if isinstance(element_or_type, Element) else element_or_type ) parent_mro = type(parent).__mro__ if parent else [None] get_registration = group.registry.get_registration for t1, t2 in itertools.product(parent_mro, element_type.__mro__): if r := get_registration(t1, t2): return r is not no_group return False @multidispatch(object, object) def ungroup(parent, element) -> bool: return False @ungroup.register(None, Element) def none_ungroup(none, element): """In the rare (error?) case a model element has no parent, but is grouped in a diagram, allow it to ungroup.""" return True @group.register(Element, Diagram) def diagram_group(element, diagram): diagram.element = element return True @ungroup.register(Element, Diagram) def diagram_ungroup(element, diagram): if diagram.element is element: del diagram.element return True return False
BOPTools
ShapeMerge
# /*************************************************************************** # * Copyright (c) 2016 Victor Titov (DeepSOIC) <vv.titov@gmail.com> * # * * # * This file is part of the FreeCAD CAx development system. * # * * # * This library is free software; you can redistribute it and/or * # * modify it under the terms of the GNU Library General Public * # * License as published by the Free Software Foundation; either * # * version 2 of the License, or (at your option) any later version. * # * * # * This library is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU Library General Public License for more details. * # * * # * You should have received a copy of the GNU Library General Public * # * License along with this library; see the file COPYING.LIB. If not, * # * write to the Free Software Foundation, Inc., 59 Temple Place, * # * Suite 330, Boston, MA 02111-1307, USA * # * * # ***************************************************************************/ __title__ = "BOPTools.ShapeMerge module" __author__ = "DeepSOIC" __url__ = "http://www.freecad.org" __doc__ = "Tools for merging shapes with shared elements. Useful for final processing of results of Part.Shape.generalFuse()." import Part from .Utils import HashableShape def findSharedElements(shape_list, element_extractor): if len(shape_list) < 2: raise ValueError( "findSharedElements: at least two shapes must be provided (have {num})".format( num=len(shape_list) ) ) all_elements = [] # list of sets of HashableShapes for shape in shape_list: all_elements.append(set([HashableShape(sh) for sh in element_extractor(shape)])) shared_elements = None for elements in all_elements: if shared_elements is None: shared_elements = elements else: shared_elements.intersection_update(elements) return [el.Shape for el in shared_elements] def isConnected(shape1, shape2, shape_dim=-1): if shape_dim == -1: shape_dim = dimensionOfShapes([shape1, shape2]) extractor = { 0: None, 1: (lambda sh: sh.Vertexes), 2: (lambda sh: sh.Edges), 3: (lambda sh: sh.Faces), }[shape_dim] return len(findSharedElements([shape1, shape2], extractor)) > 0 def splitIntoGroupsBySharing(list_of_shapes, element_extractor, split_connections=[]): """splitIntoGroupsBySharing(list_of_shapes, element_type, split_connections = []): find, which shapes in list_of_shapes are connected into groups by sharing elements. element_extractor: function that takes shape as input, and returns list of shapes. split_connections: list of shapes to exclude when testing for connections. Use to split groups on purpose. return: list of lists of shapes. Top-level list is list of groups; bottom level lists enumerate shapes of a group.""" split_connections = set([HashableShape(element) for element in split_connections]) groups = [] # list of tuples (shapes,elements). Shapes is a list of plain shapes. Elements is a set of HashableShapes - all elements of shapes in the group, excluding split_connections. # add shapes to the list of groups, one by one. If not connected to existing groups, # new group is created. If connected, shape is added to groups, and the groups are joined. for shape in list_of_shapes: shape_elements = set( [HashableShape(element) for element in element_extractor(shape)] ) shape_elements.difference_update(split_connections) # search if shape is connected to any groups connected_to = [] not_in_connected_to = [] for iGroup in range(len(groups)): connected = False for element in shape_elements: if element in groups[iGroup][1]: connected_to.append(iGroup) connected = True break else: # `break` not invoked, so `connected` is false not_in_connected_to.append(iGroup) # test if we need to join groups if len(connected_to) > 1: # shape bridges a gap between some groups. Join them into one. # rebuilding list of groups. First, add the new "supergroup", then add the rest groups_new = [] supergroup = (list(), set()) for iGroup in connected_to: supergroup[0].extend(groups[iGroup][0]) # merge lists of shapes supergroup[1].update(groups[iGroup][1]) # merge lists of elements groups_new.append(supergroup) l_groups = len(groups) groups_new.extend( [ groups[i_group] for i_group in not_in_connected_to if i_group < l_groups ] ) groups = groups_new connected_to = [0] # add shape to the group it is connected to (if to many, the groups should have been unified by the above code snippet) if len(connected_to) > 0: iGroup = connected_to[0] groups[iGroup][0].append(shape) groups[iGroup][1].update(shape_elements) else: newgroup = ([shape], shape_elements) groups.append(newgroup) # done. Discard unnecessary data and return result. return [shapes for shapes, elements in groups] def mergeSolids( list_of_solids_compsolids, flag_single=False, split_connections=[], bool_compsolid=False, ): """mergeSolids(list_of_solids, flag_single = False): merges touching solids that share faces. If flag_single is True, it is assumed that all solids touch, and output is a single solid. If flag_single is False, the output is a compound containing all resulting solids. Note. CompSolids are treated as lists of solids - i.e., merged into solids.""" solids = [] for sh in list_of_solids_compsolids: solids.extend(sh.Solids) if flag_single: cs = Part.CompSolid(solids) return cs if bool_compsolid else Part.makeSolid(cs) else: if len(solids) == 0: return Part.Compound([]) groups = splitIntoGroupsBySharing( solids, lambda sh: sh.Faces, split_connections ) if bool_compsolid: merged_solids = [Part.CompSolid(group) for group in groups] else: merged_solids = [Part.makeSolid(Part.CompSolid(group)) for group in groups] return Part.makeCompound(merged_solids) def mergeShells(list_of_faces_shells, flag_single=False, split_connections=[]): faces = [] for sh in list_of_faces_shells: faces.extend(sh.Faces) if flag_single: return Part.makeShell(faces) else: groups = splitIntoGroupsBySharing(faces, lambda sh: sh.Edges, split_connections) return Part.makeCompound([Part.Shell(group) for group in groups]) def mergeWires(list_of_edges_wires, flag_single=False, split_connections=[]): edges = [] for sh in list_of_edges_wires: edges.extend(sh.Edges) if flag_single: return Part.Wire(edges) else: groups = splitIntoGroupsBySharing( edges, lambda sh: sh.Vertexes, split_connections ) return Part.makeCompound( [Part.Wire(Part.sortEdges(group)[0]) for group in groups] ) def mergeVertices(list_of_vertices, flag_single=False, split_connections=[]): # no comprehensive support, just following the footprint of other mergeXXX() return Part.makeCompound(removeDuplicates(list_of_vertices)) def mergeShapes( list_of_shapes, flag_single=False, split_connections=[], bool_compsolid=False ): """mergeShapes(list_of_shapes, flag_single = False, split_connections = [], bool_compsolid = False): merges list of edges/wires into wires, faces/shells into shells, solids/compsolids into solids or compsolids. list_of_shapes: shapes to merge. Shapes must share elements in order to be merged. flag_single: assume all shapes in list are connected. If False, return is a compound. If True, return is the single piece (e.g. a shell). split_connections: list of shapes that are excluded when searching for connections. This can be used for example to split a wire in two by supplying vertices where to split. If flag_single is True, this argument is ignored. bool_compsolid: determines behavior when dealing with solids/compsolids. If True, result is compsolid/compound of compsolids. If False, all touching solids and compsolids are unified into single solids. If not merging solids/compsolids, this argument is ignored.""" if len(list_of_shapes) == 0: return Part.Compound([]) args = [list_of_shapes, flag_single, split_connections] dim = dimensionOfShapes(list_of_shapes) if dim == 0: return mergeVertices(*args) elif dim == 1: return mergeWires(*args) elif dim == 2: return mergeShells(*args) elif dim == 3: args.append(bool_compsolid) return mergeSolids(*args) else: assert dim >= 0 and dim <= 3 def removeDuplicates(list_of_shapes): hashes = set() new_list = [] for sh in list_of_shapes: hash = HashableShape(sh) if hash in hashes: pass else: new_list.append(sh) hashes.add(hash) return new_list def dimensionOfShapes(list_of_shapes): """dimensionOfShapes(list_of_shapes): returns dimension (0D, 1D, 2D, or 3D) of shapes in the list. If dimension of shapes varies, TypeError is raised.""" dimensions = [ ["Vertex"], ["Edge", "Wire"], ["Face", "Shell"], ["Solid", "CompSolid"], ] dim = -1 for sh in list_of_shapes: sht = sh.ShapeType for iDim in range(len(dimensions)): if sht in dimensions[iDim]: if dim == -1: dim = iDim if iDim != dim: raise TypeError( "Shapes are of different dimensions ({t1} and {t2}), and cannot be merged or compared.".format( t1=list_of_shapes[0].ShapeType, t2=sht ) ) return dim
sunflower
keyring
from __future__ import absolute_import try: import gi gi.require_version("GnomeKeyring", "1.0") from gi.repository import GnomeKeyring as keyring except: keyring = None else: from gi.repository import GObject, Gtk from sunflower.gui.input_dialog import InputDialog, PasswordDialog class EntryType: GENERIC = 0 NETWORK = 1 NOTE = 2 class KeyringCreateError(Exception): pass class PasswordStoreError(Exception): pass class InvalidKeyringError(Exception): pass class InvalidEntryError(Exception): pass class KeyringManager: """Keyring manager is used to securely store passwords. It also manages keyring availability and provides automatic locking. """ KEYRING_NAME = "sunflower" TIMEOUT = 1 if keyring is not None: KEYRING_TYPE = { EntryType.GENERIC: keyring.ItemType.GENERIC_SECRET, EntryType.NETWORK: keyring.ItemType.NETWORK_PASSWORD, EntryType.NOTE: keyring.ItemType.NOTE, } def __init__(self, application): # initialize keyring if not self.is_available(): return self._application = application self._info = None self._timeout = None # create status icon self._status_icon = Gtk.Image() self._status_icon.show() self.__initialize_keyring() def __update_icon(self): """Update icon based on keyring status""" is_locked = self.is_locked() icon_name = ("changes-allow-symbolic", "changes-prevent-symbolic")[is_locked] icon_tooltip = (_("Keyring is unlocked"), _("Keyring is locked"))[is_locked] self._status_icon.set_from_icon_name(icon_name, Gtk.IconSize.MENU) self._status_icon.set_tooltip_text(icon_tooltip) def __initialize_keyring(self): """Initialize keyring""" if not self.keyring_exists(): return # update keyring information self.__update_info() def __update_info(self): """Update keyring status information""" self._info = keyring.get_info_sync(self.KEYRING_NAME)[1] # update icon self.__update_icon() def __reset_timeout(self): """Reset autolock timeout""" if self._timeout is not None: GObject.source_remove(self._timeout) self._timeout = None timeout = int(self.TIMEOUT * 60 * 1000) self._timeout = GObject.timeout_add(timeout, self.__lock_keyring) def __lock_keyring(self): """Method called after specified amount of time has passed""" if self._timeout is not None: GObject.source_remove(self._timeout) self._timeout = None # lock keyring keyring.lock_sync(self.KEYRING_NAME) # update information about keyring self.__update_info() def __unlock_keyring(self): """Unlock keyring and schedule automatic lock""" result = False dialog = InputDialog(self._application) dialog.set_title(_("Unlock keyring")) dialog.set_label(_("Please enter your keyring password:")) dialog.set_password() response = dialog.get_response() if response[0] == Gtk.ResponseType.OK: # try to unlock keyring keyring.unlock_sync(self.KEYRING_NAME, response[1]) # update status information self.__update_info() if not self.is_locked(): # set timeout for automatic locking self.__reset_timeout() result = True return result def __get_entry_info(self, entry): """Get entry info object""" result = None for item_id in keyring.list_item_ids_sync(self.KEYRING_NAME)[1]: info = keyring.item_get_info_sync(self.KEYRING_NAME, item_id)[1] if info.get_display_name() == entry: result = info break return result def __get_entry_id(self, entry): """Get entry ID""" result = None for item_id in keyring.list_item_ids_sync(self.KEYRING_NAME)[1]: info = keyring.item_get_info_sync(self.KEYRING_NAME, item_id)[1] if info.get_display_name() == entry: result = item_id break return result def lock_keyring(self): """Lock keyring""" if self.keyring_exists(): self.__lock_keyring() def keyring_exists(self): """Check if keyring exists""" result = False if self.is_available(): result = self.KEYRING_NAME in keyring.list_keyring_names_sync()[1] return result def is_available(self): """Return true if we are able to use Gnome keyring""" return keyring is not None and keyring.is_available() def is_locked(self): """Return true if current keyring is locked""" if not self.keyring_exists(): raise InvalidKeyringError("Keyring does not exist!") return self._info.get_is_locked() def rename_entry(self, entry, new_name): """Rename entry""" if not self.keyring_exists(): raise InvalidKeyringError("Keyring does not exist!") result = False # if keyring is locked, try to unlock it if self.is_locked() and not self.__unlock_keyring(): return result # get entry information entry_id = self.__get_entry_id(entry) info = keyring.item_get_info_sync(self.KEYRING_NAME, entry_id)[1] if info is not None: info.set_display_name(new_name) keyring.item_set_info_sync(self.KEYRING_NAME, entry_id, info) result = True return result def change_secret(self, entry_id, secret): """Change secret for selected entry""" if not self.keyring_exists(): raise InvalidKeyringError("Keyring does not exist!") result = False # if keyring is locked, try to unlock it if self.is_locked() and not self.__unlock_keyring(): return result # get entry information info = keyring.item_get_info_sync(self.KEYRING_NAME, entry_id)[1] if info is not None: info.set_secret(secret) keyring.item_set_info_sync(self.KEYRING_NAME, entry_id, info) result = True return result def remove_entry(self, entry): """Remove entry from keyring""" if not self.keyring_exists(): raise InvalidKeyringError("Keyring does not exist!") result = False # if keyring is locked, try to unlock it if self.is_locked() and not self.__unlock_keyring(): return result # get entry id entry_id = self.__get_entry_id(entry) if entry_id is not None: keyring.item_delete_sync(self.KEYRING_NAME, entry_id) result = True return result def get_entries(self): """Return list of tuples containing entry names and description""" if not self.keyring_exists(): raise InvalidKeyringError("Keyring does not exist!") result = [] # if keyring is locked, try to unlock it if self.is_locked() and not self.__unlock_keyring(): return result # populate result list for item_id in keyring.list_item_ids_sync(self.KEYRING_NAME)[1]: info = keyring.item_get_info_sync(self.KEYRING_NAME, item_id)[1] result.append((item_id, info.get_display_name(), info.get_mtime())) return result def get_password(self, entry): """Return password for specified entry""" if not self.keyring_exists(): raise InvalidKeyringError("Keyring does not exist!") result = None # if keyring is locked, try to unlock it if self.is_locked() and not self.__unlock_keyring(): return result # get password item_info = self.__get_entry_info(entry) if item_info is not None: result = item_info.get_secret() # reset autolock timeout self.__reset_timeout() return result def get_attributes(self, entry): """Get attributes associated with specified entry""" if not self.keyring_exists(): raise InvalidKeyringError("Keyring does not exist!") result = None # if keyring is locked, try to unlock it if self.is_locked() and not self.__unlock_keyring(): return result # get password item_info = self.__get_entry_info(entry) if item_info is not None: result = item_info.get_attributes() # reset autolock timeout self.__reset_timeout() def store_password( self, entry, password, attributes=None, entry_type=EntryType.GENERIC ): """Create new entry in keyring with specified data""" assert self.is_available() # create a new keyring if it doesn't exist if not self.KEYRING_NAME in keyring.list_keyring_names_sync()[1]: dialog = PasswordDialog(self._application) dialog.set_title(_("New keyring")) dialog.set_label( _( "We need to create a new keyring to safely " "store your passwords. Choose the password you " "want to use for it." ) ) response = dialog.get_response() if response[0] == Gtk.ResponseType.OK and response[1] == response[2]: # create new keyring keyring.create_sync(self.KEYRING_NAME, response[1]) self.__update_info() else: # wrong password raise KeyringCreateError("No keyring to store password to.") # if keyring is locked, try to unlock it if self.is_locked() and not self.__unlock_keyring(): return False attribute_array = keyring.Attribute.list_new() for key in attributes: keyring.Attribute.list_append_string(attribute_array, key, attributes[key]) # store password to existing keyring keyring.item_create_sync( self.KEYRING_NAME, self.KEYRING_TYPE[entry_type], entry, attribute_array, password, True, # update if exists ) return True
plugins
drdk
""" $description Live TV channels from DR, a Danish public, state-owned broadcaster. $url dr.dk $type live $region Denmark """ import logging import re from streamlink.plugin import Plugin, pluginmatcher from streamlink.plugin.api import validate from streamlink.stream.hls import HLSStream log = logging.getLogger(__name__) @pluginmatcher( re.compile( r"https?://(?:www\.)?dr\.dk/drtv(/kanal/[\w-]+)", ) ) class DRDK(Plugin): live_api_url = "https://www.dr-massive.com/api/page" _live_data_schema = validate.Schema( { "item": { "customFields": { validate.optional("hlsURL"): validate.url(), validate.optional("hlsWithSubtitlesURL"): validate.url(), } } }, validate.get("item"), validate.get("customFields"), ) def _get_live(self, path): params = dict( ff="idp", path=path, ) res = self.session.http.get(self.live_api_url, params=params) playlists = self.session.http.json(res, schema=self._live_data_schema) streams = {} for name, url in playlists.items(): name_prefix = "" if name == "hlsWithSubtitlesURL": name_prefix = "subtitled_" streams.update( HLSStream.parse_variant_playlist( self.session, url, name_prefix=name_prefix, ) ) return streams def _get_streams(self): path = self.match.group(1) log.debug("Path={0}".format(path)) return self._get_live(path) __plugin__ = DRDK
contentprocessors
autotagger
import re from apiproxy import ApiProxy from logger import AmbarLogger from model import AmbarTaggingRule from parsers.contenttypeanalyzer import ContentTypeAnalyzer class AutoTagger: def __init__(self, Logger, ApiProxy): self.logger = Logger self.apiProxy = ApiProxy self.AUTO_TAG_TYPE = "auto" self.SOURCE_TAG_TYPE = "source" def AutoTagAmbarFile(self, AmbarFile): self.SetOCRTag(AmbarFile) self.SetSourceIdTag(AmbarFile) self.SetArchiveTag(AmbarFile) self.SetImageTag(AmbarFile) for rule in self.GetTaggingRules(): self.ProcessTaggingRule(rule, AmbarFile) def ProcessTaggingRule(self, TaggingRuleToProcess, AmbarFile): try: if TaggingRuleToProcess.field == "content": match = re.search( TaggingRuleToProcess.regex, AmbarFile["content"]["text"] ) elif TaggingRuleToProcess.field == "path": match = re.search( TaggingRuleToProcess.regex, AmbarFile["meta"]["full_name"] ) else: self.logger.LogMessage( "error", "error applying autotagging rule {0}, no such field known {1}".format( TaggingRuleToProcess.name, TaggingRuleToProcess.field ), ) return if match: for tag in TaggingRuleToProcess.tags: self.AddTagToAmbarFile( AmbarFile["file_id"], AmbarFile["meta"]["full_name"], self.AUTO_TAG_TYPE, tag, ) except Exception as ex: self.logger.LogMessage( "error", "error applying autotagging rule {0} to {1} {2}".format( TaggingRuleToProcess.name, AmbarFile["meta"]["full_name"], str(ex) ), ) def GetTaggingRules(self): taggingRules = [] apiResp = self.apiProxy.GetTaggingRules() if not apiResp.Success: self.logger.LogMessage( "error", "error retrieving autotagging rules {0}".format(apiResp.message), ) return taggingRules if not (apiResp.Ok): self.logger.LogMessage( "error", "error retrieving autotagging rules, unexpected response code {0} {1}".format( apiResp.code, apiResp.message ), ) return taggingRules for ruleDict in apiResp.payload: taggingRules.append(AmbarTaggingRule.Init(ruleDict)) return taggingRules def SetSourceIdTag(self, AmbarFile): self.AddTagToAmbarFile( AmbarFile["file_id"], AmbarFile["meta"]["full_name"], self.SOURCE_TAG_TYPE, AmbarFile["meta"]["source_id"], ) def SetOCRTag(self, AmbarFile): if AmbarFile["content"]["ocr_performed"]: self.AddTagToAmbarFile( AmbarFile["file_id"], AmbarFile["meta"]["full_name"], self.AUTO_TAG_TYPE, "ocr", ) def SetArchiveTag(self, AmbarFile): if ContentTypeAnalyzer.IsArchive(AmbarFile["meta"]["full_name"]): self.AddTagToAmbarFile( AmbarFile["file_id"], AmbarFile["meta"]["full_name"], self.AUTO_TAG_TYPE, "archive", ) def SetImageTag(self, AmbarFile): if ContentTypeAnalyzer.IsImageByContentType(AmbarFile["content"]["type"]): self.AddTagToAmbarFile( AmbarFile["file_id"], AmbarFile["meta"]["full_name"], self.AUTO_TAG_TYPE, "image", ) def AddTagToAmbarFile(self, FileId, FullName, TagType, Tag): apiResp = self.apiProxy.AddFileTag(FileId, TagType, Tag) if not apiResp.Success: self.logger.LogMessage( "error", "error adding {0} tag to file {1} {2}".format( Tag, FullName, apiResp.message ), ) return False if not (apiResp.Ok or apiResp.Created): self.logger.LogMessage( "error", "error adding {0} tag to file, unexpected response code {1} {2} {3}".format( Tag, FullName, apiResp.code, apiResp.message ), ) return False self.logger.LogMessage("verbose", "{0} tag added to {1}".format(Tag, FullName))
PathTests
TestPathProfile
# -*- coding: utf-8 -*- # *************************************************************************** # * Copyright (c) 2023 Robert Schöftner <rs@unfoo.net> * # * Copyright (c) 2021 Russell Johnson (russ4262) <russ4262@gmail.com> * # * * # * This file is part of the FreeCAD CAx development system. * # * * # * This program is free software; you can redistribute it and/or modify * # * it under the terms of the GNU Lesser General Public License (LGPL) * # * as published by the Free Software Foundation; either version 2 of * # * the License, or (at your option) any later version. * # * for detail see the LICENCE text file. * # * * # * This program is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU Library General Public License for more details. * # * * # * You should have received a copy of the GNU Library General Public * # * License along with this program; if not, write to the Free Software * # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * # *************************************************************************** import FreeCAD import Part import Path.Main.Job as PathJob import Path.Op.Profile as PathProfile from PathTests.PathTestUtils import PathTestBase from PathTests.TestPathAdaptive import getGcodeMoves if FreeCAD.GuiUp: import Path.Main.Gui.Job as PathJobGui import Path.Op.Gui.Profile as PathProfileGui class TestPathProfile(PathTestBase): """Unit tests for the Adaptive operation.""" @classmethod def setUpClass(cls): """setUpClass()... This method is called upon instantiation of this test class. Add code and objects here that are needed for the duration of the test() methods in this class. In other words, set up the 'global' test environment here; use the `setUp()` method to set up a 'local' test environment. This method does not have access to the class `self` reference, but it is able to call static methods within this same class. """ cls.needsInit = True @classmethod def initClass(cls): # Open existing FreeCAD document with test geometry cls.needsInit = False cls.doc = FreeCAD.open( FreeCAD.getHomePath() + "Mod/Path/PathTests/test_profile.fcstd" ) # Create Job object, adding geometry objects from file opened above cls.job = PathJob.Create("Job", [cls.doc.Body], None) cls.job.GeometryTolerance.Value = 0.001 if FreeCAD.GuiUp: cls.job.ViewObject.Proxy = PathJobGui.ViewProvider(cls.job.ViewObject) # Instantiate an Profile operation for querying available properties cls.prototype = PathProfile.Create("Profile") cls.prototype.Base = [(cls.doc.Body, ["Face18"])] cls.prototype.Label = "Prototype" _addViewProvider(cls.prototype) cls.doc.recompute() @classmethod def tearDownClass(cls): """tearDownClass()... This method is called prior to destruction of this test class. Add code and objects here that cleanup the test environment after the test() methods in this class have been executed. This method does not have access to the class `self` reference. This method is able to call static methods within this same class. """ # FreeCAD.Console.PrintMessage("TestPathAdaptive.tearDownClass()\n") # Close geometry document without saving if not cls.needsInit: FreeCAD.closeDocument(cls.doc.Name) # Setup and tear down methods called before and after each unit test def setUp(self): """setUp()... This method is called prior to each `test()` method. Add code and objects here that are needed for multiple `test()` methods. """ if self.needsInit: self.initClass() def tearDown(self): """tearDown()... This method is called after each test() method. Add cleanup instructions here. Such cleanup instructions will likely undo those in the setUp() method. """ pass # Unit tests def test00(self): """test00() Empty test.""" return def test01(self): """test01() Verify path generated on Face18, outside, with tool compensation.""" # Instantiate a Profile operation and set Base Geometry profile = PathProfile.Create("Profile1") profile.Base = [(self.doc.Body, ["Face18"])] # (base, subs_list) profile.Label = "test01+" profile.Comment = ( "test01() Verify path generated on Face18, outside, with tool compensation." ) # Set additional operation properties # setDepthsAndHeights(adaptive) profile.processCircles = True profile.processHoles = True profile.UseComp = True profile.Direction = "CW" _addViewProvider(profile) self.doc.recompute() moves = getGcodeMoves(profile.Path.Commands, includeRapids=False) operationMoves = "; ".join(moves) # FreeCAD.Console.PrintMessage("test01_moves: " + operationMoves + "\n") expected_moves = ( "G1 X16.47 Y16.47 Z10.0; G3 I-2.48 J-2.48 K0.0 X13.93 Y17.5 Z10.0; " "G1 X-13.93 Y17.5 Z10.0; G3 I-0.06 J-3.51 K0.0 X-17.5 Y13.93 Z10.0; " "G1 X-17.5 Y-13.93 Z10.0; G3 I3.51 J-0.06 K0.0 X-13.93 Y-17.5 Z10.0; " "G1 X13.93 Y-17.5 Z10.0; G3 I0.06 J3.51 K0.0 X17.5 Y-13.93 Z10.0; " "G1 X17.5 Y13.93 Z10.0; G3 I-3.51 J0.06 K0.0 X16.47 Y16.47 Z10.0; " "G1 X23.55 Y23.54 Z10.0; G2 I-9.55 J-9.54 K0.0 X27.5 Y14.1 Z10.0; " "G1 X27.5 Y-14.0 Z10.0; G2 I-13.5 J0.0 K0.0 X14.1 Y-27.5 Z10.0; " "G1 X-14.0 Y-27.5 Z10.0; G2 I0.0 J13.5 K0.0 X-27.5 Y-14.1 Z10.0; " "G1 X-27.5 Y14.0 Z10.0; G2 I13.5 J-0.0 K0.0 X-14.1 Y27.5 Z10.0; " "G1 X14.0 Y27.5 Z10.0; G2 I-0.0 J-13.5 K0.0 X23.55 Y23.54 Z10.0" ) self.assertTrue( expected_moves == operationMoves, "expected_moves: {}\noperationMoves: {}".format( expected_moves, operationMoves ), ) def test02(self): """test02() Verify path generated on Face18, outside, without compensation.""" # Instantiate a Profile operation and set Base Geometry profile = PathProfile.Create("Profile2") profile.Base = [(self.doc.Body, ["Face18"])] # (base, subs_list) profile.Label = "test02+" profile.Comment = ( "test02() Verify path generated on Face18, outside, without compensation." ) # Set additional operation properties # setDepthsAndHeights(adaptive) profile.processCircles = True profile.processHoles = True profile.UseComp = False profile.Direction = "CW" _addViewProvider(profile) self.doc.recompute() moves = getGcodeMoves(profile.Path.Commands, includeRapids=False) operationMoves = "; ".join(moves) # FreeCAD.Console.PrintMessage("test02_moves: " + operationMoves + "\n") expected_moves = ( "G1 X18.24 Y18.24 Z10.0; G3 I-4.24 J-4.24 K0.0 X14.0 Y20.0 Z10.0; " "G1 X-14.0 Y20.0 Z10.0; G3 I0.0 J-6.0 K0.0 X-20.0 Y14.0 Z10.0; " "G1 X-20.0 Y-14.0 Z10.0; G3 I6.0 J0.0 K0.0 X-14.0 Y-20.0 Z10.0; " "G1 X14.0 Y-20.0 Z10.0; G3 I-0.0 J6.0 K0.0 X20.0 Y-14.0 Z10.0; " "G1 X20.0 Y14.0 Z10.0; G3 I-6.0 J-0.0 K0.0 X18.24 Y18.24 Z10.0; " "G1 X21.78 Y21.78 Z10.0; G2 I-7.78 J-7.78 K0.0 X25.0 Y14.0 Z10.0; " "G1 X25.0 Y-14.0 Z10.0; G2 I-11.0 J0.0 K0.0 X14.0 Y-25.0 Z10.0; " "G1 X-14.0 Y-25.0 Z10.0; G2 I0.0 J11.0 K0.0 X-25.0 Y-14.0 Z10.0; " "G1 X-25.0 Y14.0 Z10.0; G2 I11.0 J-0.0 K0.0 X-14.0 Y25.0 Z10.0; " "G1 X14.0 Y25.0 Z10.0; G2 I-0.0 J-11.0 K0.0 X21.78 Y21.78 Z10.0" ) self.assertTrue( expected_moves == operationMoves, "expected_moves: {}\noperationMoves: {}".format( expected_moves, operationMoves ), ) def test03(self): """test03() Verify path generated on Face18, outside, with compensation and extra offset -radius.""" # Instantiate a Profile operation and set Base Geometry profile = PathProfile.Create("Profile3") profile.Base = [(self.doc.Body, ["Face18"])] # (base, subs_list) profile.Label = "test03+" profile.Comment = ( "test03() Verify path generated on Face4, " "with compensation and extra offset -radius" ) # Set additional operation properties # setDepthsAndHeights(adaptive) profile.processCircles = True profile.processHoles = True profile.UseComp = True profile.Direction = "CW" profile.OffsetExtra = -profile.OpToolDiameter / 2.0 _addViewProvider(profile) self.doc.recompute() moves = getGcodeMoves(profile.Path.Commands, includeRapids=False) operationMoves = "; ".join(moves) # FreeCAD.Console.PrintMessage("test03_moves: " + operationMoves + "\n") expected_moves = ( "G1 X18.24 Y18.24 Z10.0; G3 I-4.24 J-4.24 K0.0 X14.0 Y20.0 Z10.0; " "G1 X-14.0 Y20.0 Z10.0; G3 I0.0 J-6.0 K0.0 X-20.0 Y14.0 Z10.0; " "G1 X-20.0 Y-14.0 Z10.0; G3 I6.0 J0.0 K0.0 X-14.0 Y-20.0 Z10.0; " "G1 X14.0 Y-20.0 Z10.0; G3 I-0.0 J6.0 K0.0 X20.0 Y-14.0 Z10.0; " "G1 X20.0 Y14.0 Z10.0; G3 I-6.0 J-0.0 K0.0 X18.24 Y18.24 Z10.0; " "G1 X21.78 Y21.78 Z10.0; G2 I-7.78 J-7.78 K0.0 X25.0 Y14.0 Z10.0; " "G1 X25.0 Y-14.0 Z10.0; G2 I-11.0 J0.0 K0.0 X14.0 Y-25.0 Z10.0; " "G1 X-14.0 Y-25.0 Z10.0; G2 I0.0 J11.0 K0.0 X-25.0 Y-14.0 Z10.0; " "G1 X-25.0 Y14.0 Z10.0; G2 I11.0 J-0.0 K0.0 X-14.0 Y25.0 Z10.0; " "G1 X14.0 Y25.0 Z10.0; G2 I-0.0 J-11.0 K0.0 X21.78 Y21.78 Z10.0" ) self.assertTrue( expected_moves == operationMoves, "expected_moves: {}\noperationMoves: {}".format( expected_moves, operationMoves ), ) def _addViewProvider(profileOp): if FreeCAD.GuiUp: PathOpGui = PathProfileGui.PathOpGui cmdRes = PathProfileGui.Command.res profileOp.ViewObject.Proxy = PathOpGui.ViewProvider( profileOp.ViewObject, cmdRes )
implementation
core
import time from collections import deque import psutil from ipv8.taskmanager import TaskManager from tribler.core import notifications from tribler.core.components.resource_monitor.implementation.base import ResourceMonitor from tribler.core.components.resource_monitor.implementation.profiler import ( YappiProfiler, ) from tribler.core.components.resource_monitor.settings import ResourceMonitorSettings from tribler.core.utilities.notifier import Notifier FREE_DISK_THRESHOLD = 100 * (1024 * 1024) # 100MB CORE_RESOURCE_HISTORY_SIZE = 1000 class CoreResourceMonitor(ResourceMonitor, TaskManager): """ Implementation class of ResourceMonitor by the core process. The core process uses TaskManager to implement start() and stop() methods. """ def __init__( self, state_dir, log_dir, config: ResourceMonitorSettings, notifier: Notifier, history_size=CORE_RESOURCE_HISTORY_SIZE, ): TaskManager.__init__(self) ResourceMonitor.__init__(self, history_size=history_size) self.config = config self.notifier = notifier self.disk_usage_data = deque(maxlen=history_size) self.state_dir = state_dir self.resource_log_enabled = config.enabled # Setup yappi profiler self.profiler = YappiProfiler(log_dir) def start(self): """ Start the resource monitoring by scheduling a task in TaskManager. """ self._logger.info("Starting...") poll_interval = self.config.poll_interval self.register_task( "check_resources", self.check_resources, interval=poll_interval ) async def stop(self): """ Called during shutdown, should clear all scheduled tasks. """ await self.shutdown_task_manager() def check_resources(self): super().check_resources() # Additionally, record the disk and notify on low disk space available. self.record_disk_usage() def set_resource_log_enabled(self, enabled): self.resource_log_enabled = enabled def is_resource_log_enabled(self): return self.resource_log_enabled def record_disk_usage(self, recorded_at=None): recorded_at = recorded_at or time.time() # Check for available disk space disk_usage = self.get_free_disk_space() self.disk_usage_data.append( { "time": recorded_at, "total": disk_usage.total, "used": disk_usage.used, "free": disk_usage.free, "percent": disk_usage.percent, } ) # Notify session if less than 100MB of disk space is available if disk_usage.free < FREE_DISK_THRESHOLD: self._logger.warning("Warning! Less than 100MB of disk space available") if self.notifier: self.notifier[notifications.low_space](self.disk_usage_data[-1]) def get_free_disk_space(self): return psutil.disk_usage(str(self.state_dir)) def get_disk_usage(self): """ Return a list containing the history of free disk space """ return self.disk_usage_data
config
file
# coding:utf-8 import json import logging logger = logging.getLogger(__name__) class ConfigFile(object): """ A single config file, as present on the filesystem. """ _dirty = None def __init__(self, path): self.path = path self.load() def get(self, key, default=None): return self._data.get(key, default) def set(self, key, value): self._data[key] = value self._dirty = True def has_key(self, key): return key in self._data def load(self): self._data = {} try: self._data = json.load(open(self.path, "rU")) self._dirty = False except IOError: logger.warning( "Unable to load configuration at '{0}'. No file found.".format( self.path ) ) except ValueError as e: logger.error( "Unable to load configuration at '{0}'. Invalid JSON caused by: {1}".format( self.path, e ) ) except Exception as e: logger.exception("Unable to load configuration at '{0}'.".format(self.path)) def write(self): if self._dirty: json.dump( self._data, open(self.path, "w"), sort_keys=True, indent=4, separators=(",", ": "), ) self._dirty = False logger.debug("Saved configuration at {0}".format(self.path))
widgets
filter
# Filter Widget/Dialog # Copyright (C) 2006 Johannes Sasongko <sasongko@gmail.com> # Copyright (C) 2008-2010 Adam Olsen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # # The developers of the Exaile media player hereby grant permission # for non-GPL compatible GStreamer and Exaile plugins to be used and # distributed together with GStreamer and Exaile. This permission is # above and beyond the permissions granted by the GPL license by which # Exaile is covered. If you modify this code, you may extend this # exception to your version of the code, but you are not obligated to # do so. If you do not wish to do so, delete this exception statement # from your version. """Generic widget and dialog for filtering items. They resemble the configuration dialogs of Evolution's mail filters and Rhythmbox's automatic playlists. """ import urllib.parse from typing import Sequence from gi.repository import Gtk from gi.types import GObjectMeta from xl.nls import gettext as _ from xlgui.guiutil import GtkTemplate, gtk_widget_replace @GtkTemplate("ui", "widgets", "filter_dialog.ui") class FilterDialog(Gtk.Dialog): """Dialog to filter a list of items. Consists of a FilterWidget and an Add button. """ __gtype_name__ = "FilterDialog" ( name_entry, filter, match_any, random, lim_check, lim_spin, ) = GtkTemplate.Child.widgets(6) def __init__(self, title, parent, criteria): """Create a filter dialog. Parameters: - title: title of the dialog window - criteria: possible criteria; see FilterWindow """ Gtk.Dialog.__init__(self, title=title, transient_for=parent) self.init_template() self.add_buttons( Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT, Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT, ) f = FilterWidget(sorted(criteria, key=lambda k: _(k[0]))) f.add_criteria_row() f.set_border_width(5) f.show_all() self.filter = gtk_widget_replace(self.filter, f) @GtkTemplate.Callback def on_add_button_clicked(self, *args): self.filter.add_criteria_row() @GtkTemplate.Callback def on_lim_check_toggled(self, *args): self.lim_spin.set_sensitive(self.lim_check.get_active()) def set_limit(self, limit): """ Sets the limit for the number of items that should be returned """ if limit > -1: self.lim_check.set_active(True) self.lim_spin.set_value(limit) else: self.lim_check.set_active(False) def get_limit(self): """ Get the limit value """ if self.lim_check.get_active(): return int(self.lim_spin.get_value()) else: return -1 def get_random(self): """ Returns if the playlist should be random """ return self.random.get_active() def set_random(self, random): """ Sets if this playlist should be random """ self.random.set_active(random) def get_match_any(self): """ Returns true if this dialog should match any of the criteria """ return self.match_any.get_active() def set_match_any(self, any): """ Sets whether this dialog should match any of the criteria or not """ self.match_any.set_active(any) def get_name(self): """ Returns the text in the name_entry """ return self.name_entry.get_text() def set_name(self, name): """ Sets the text in the name_entry """ self.name_entry.set_text(name) def get_result(self): """Return the user's input as a list of filter criteria. See FilterWidget.get_result. """ # TODO: display error message return self.filter.get_result() def get_state(self): """Return the filter state. See FilterWidget.get_state. """ return self.filter.get_state() def set_state(self, state): """Set the filter state. See FilterWidget.set_state. """ self.filter.set_state(state) class FilterWidget(Gtk.Grid): """Widget to filter a list of items. This widget only includes the criteria selector (Criterion widgets) and their Remove buttons; it does not include an Add button. Attributes: - criteria: see example - rows: list of (criterion, remove_btn, remove_btn_handler_id) - n: number of rows Example of criteria: [ # name (N_('Year'), [ # name - field class/factory (N_('is'), EntryField), (N_('is between'), lambda x: EntryLabelEntryField(x, _('and'))), (N_('is this year'), NothingField) ]), ] The field class is a class following this interface: class Field(Gtk.Widget): def __init__(self, result_generator): pass def get_result(self): return object def get_state(self): return object def set_state(self, state): pass Although not required, these methods should use unicode instead of str objects when dealing with strings. """ def __init__(self, criteria): """Create a filter widget. Parameter: - criteria: see FilterWidget """ super(FilterWidget, self).__init__() self.set_column_spacing(10) self.set_row_spacing(2) self.criteria = criteria self.rows = [] def add_criteria_row(self): """Add a new criteria row.""" criterion = Criterion(self.criteria) criterion.show() n = len(self.rows) if n != 0: criterion.set_state(self.rows[-1][0].get_state()) remove_btn = Gtk.Button() image = Gtk.Image() image.set_from_icon_name("list-remove", Gtk.IconSize.BUTTON) remove_btn.add(image) remove_btn_handler_id = remove_btn.connect("clicked", self.__remove_clicked) remove_btn.show_all() self.attach(criterion, 0, n, 1, 1) self.attach(remove_btn, 1, n, 1, 1) self.rows.append((criterion, remove_btn, remove_btn_handler_id)) def remove_criteria_row(self, row): """Remove a criteria row.""" self.remove_row(row) del self.rows[row] def __remove_clicked(self, widget): n = self.child_get_property(widget, "top-attach") self.remove_criteria_row(n) def get_state(self): """Return the filter state. See set_state for the state format. """ state = [] for row in self.rows: state.append(row[0].get_state()) state[-1][0].reverse() # reverse so it reads more nicely return state def set_state(self, state): """Set the filter state. Format: [ ( [criterion1_1, criterion1_2, ...], filter1 ), ( [criterion2_1, criterion2_2, ...], filter2 ), ... ] """ n_present = len(self.rows) n_required = len(state) for i in range(n_present, n_required): self.add_criteria_row() for i in range(n_present, n_required, -1): self.remove_criteria_row(i - 1) # i is one less than n for i, cstate in enumerate(state): cstate[0].reverse() # reverse so it becomes a stack self.rows[i][0].set_state(cstate) class Criterion(Gtk.Box): """Widget representing one filter criterion. It contains either: - one combo box and another criterion object, or - a field object. """ def __init__(self, subcriteria): """Create a criterion object. Parameters: - subcriteria: a list of possible subcriteria; see criteria in FilterWidget """ super(Criterion, self).__init__(spacing=5) if isinstance(subcriteria, (Gtk.Widget, GObjectMeta)): field_class = subcriteria self.child = field_class() else: self.combo = combo = Gtk.ComboBoxText() if len(subcriteria) > 10: self.combo.set_wrap_width(5) self.subcriteria = subcriteria for subc in subcriteria: combo.append_text(_(subc[0])) combo.set_active(0) combo.connect("changed", self._combo_changed) combo.show() self.pack_start(combo, False, True, 0) self.child = Criterion(subcriteria[0][1]) self.child.show() self.pack_start(self.child, True, True, 0) def _combo_changed(self, widget): """Called when the combo box changes its value.""" state = self.child.get_state() self.remove(self.child) self.child = Criterion(self.subcriteria[self.combo.get_active()][1]) if state: self.child.set_state(state) self.pack_start(self.child, True, True, 0) self.child.show() def get_state(self): """Return the criterion state. See set_state for the state format. """ state = self.child.get_state() if isinstance(self.child, Criterion): state[0].append(self.subcriteria[self.combo.get_active()][0]) else: state = ([], state) return state def set_state(self, state): """Set the criterion state. Format: ([..., grandchild_state, child_state, self_state], filter) Note the reverse order of the list. This is to give the impression of it being a stack responding to pop(). """ if isinstance(self.child, Criterion): text = state[0].pop() for i, subc in enumerate(self.subcriteria): if subc[0] == text: self.combo.set_active(i) break self.child.set_state(state) else: if len(state) > 1: self.child.set_state(state[1]) # Sample fields class ComboEntryField(Gtk.Box): """Select from multiple fixed values, but allow the user to enter text""" def __init__(self, values): Gtk.Box.__init__(self) self.combo = Gtk.ComboBoxText.new_with_entry() for value in values: self.combo.append_text(value) self.pack_start(self.combo, True, True, 0) self.combo.show() def get_state(self): return self.combo.get_active_text() def set_state(self, state): self.combo.get_child().set_text(state) class NullField(Gtk.Box): """Used as a placeholder for __null__ values""" def get_state(self): return ["__null__"] def set_state(self, state): pass class MultiEntryField(Gtk.Box): """Helper field that can be subclassed to get fields with multiple GtkEntry widgets and multiple labels.""" def __init__(self, labels): """Create a field with the specified labels and widths. Parameter: - labels: sequence of string, integer, or None values; string represents label, integer represents Entry widget with a specific width, None represents Entry widget with default width """ Gtk.Box.__init__(self, spacing=5) self.entries = [] for label in labels: if label is None: widget = Gtk.Entry() self.entries.append(widget) elif isinstance(label, (int, float)): widget = Gtk.Entry() widget.set_size_request(label, -1) self.entries.append(widget) else: widget = Gtk.Label(label=str(label)) self.pack_start(widget, False, True, 0) widget.show() def get_state(self): return [e.get_text() for e in self.entries] def set_state(self, state): entries = self.entries if isinstance(state, (list, tuple)): for i in range(min(len(entries), len(state))): entries[i].set_text(state[i]) else: entries[0].set_text(state) class EntryField(Gtk.Entry): def __init__(self): Gtk.Entry.__init__(self) def get_state(self): return self.get_text() def set_state(self, state): if isinstance(state, list) or isinstance(state, tuple): state = state[0] self.set_text(state) class QuotedEntryField(Gtk.Entry): def __init__(self): Gtk.Entry.__init__(self) def get_state(self): return urllib.parse.quote(self.get_text()) def set_state(self, state): if isinstance(state, list) or isinstance(state, tuple): state = state[0] self.set_text(urllib.parse.unquote(state)) class EntryLabelEntryField(MultiEntryField): def __init__(self, label): MultiEntryField.__init__(self, (50, label, 50)) class SpinLabelField(Gtk.Box): def __init__(self, label="", top=999999, lower=-999999): Gtk.Box.__init__(self, spacing=5) self.spin = Gtk.SpinButton.new_with_range(lower, top, 1) self.spin.set_value(0) self.pack_start(self.spin, False, True, 0) self.pack_start(Gtk.Label.new(label), False, True, 0) self.show_all() def get_state(self): return self.spin.get_value() def set_state(self, state): if isinstance(state, list) or isinstance(state, tuple): state = state[0] try: self.spin.set_value(int(state)) except ValueError: pass class SpinButtonAndComboField(Gtk.Box): def __init__(self, items=()): Gtk.Box.__init__(self, spacing=5) self.items: Sequence[str] = items self.entry = Gtk.SpinButton.new_with_range(0, 999999, 1) self.entry.set_value(0) self.pack_start(self.entry, True, True, 0) self.combo = Gtk.ComboBoxText() for item in items: self.combo.append_text(_(item)) self.combo.set_active(0) self.pack_start(self.combo, True, True, 0) self.show_all() def set_state(self, state): if not isinstance(state, (tuple, list)) or len(state) < 2: return # TODO: Check length. try: self.entry.set_value(int(state[0])) except ValueError: pass combo_state = state[1] try: index = self.items.index(combo_state) except ValueError: pass else: self.combo.set_active(index) def get_state(self): active_item = self.items[self.combo.get_active()] return [self.entry.get_value(), active_item]
gui
gtkexcepthook
# -*- coding: utf-8 -*- # (c) 2003 Gustavo J A M Carneiro gjc at inescporto.pt # 2004-2005 Filip Van Raemdonck # # http://www.daa.com.au/pipermail/pygtk/2003-August/005775.html # Message-ID: <1062087716.1196.5.camel@emperor.homelinux.net> # "The license is whatever you want." # # This file was downloaded from http://www.sysfs.be/downloads/ # Adaptions 2009-2010 by Martin Renold: # - let KeyboardInterrupt through # - print traceback to stderr before showing the dialog # - nonzero exit code when hitting the "quit" button # - suppress more dialogs while one is already active # - fix Details button when a context in the traceback is None # - remove email features # - fix lockup with dialog.run(), return to mainloop instead # see also http://faq.pygtk.org/index.py?req=show&file=faq20.010.htp # (The license is still whatever you want.) from __future__ import division, print_function import inspect import linecache import pydoc import sys import textwrap import traceback from gettext import gettext as _ import lib.meta from lib.gibindings import Gdk, Gtk, Pango from lib.pycompat import PY3 if PY3: from io import StringIO from urllib.parse import quote_plus else: from urllib import quote_plus from cStringIO import StringIO # Function that will be called when the user presses "Quit" # Return True to confirm quit, False to cancel quit_confirmation_func = None RESPONSE_QUIT = 1 RESPONSE_SEARCH = 2 RESPONSE_REPORT = 3 def analyse_simple(exctyp, value, tb): trace = StringIO() traceback.print_exception(exctyp, value, tb, None, trace) return trace def lookup(name, frame, lcls): """Find the value for a given name in the given frame""" if name in lcls: return "local", lcls[name] elif name in frame.f_globals: return "global", frame.f_globals[name] elif "__builtins__" in frame.f_globals: builtins = frame.f_globals["__builtins__"] if type(builtins) is dict: if name in builtins: return "builtin", builtins[name] else: if hasattr(builtins, name): return "builtin", getattr(builtins, name) return None, [] def analyse(exctyp, value, tb): import keyword import platform import tokenize from gui import application from gui.meta import get_libs_version_string app = application.get_app() trace = StringIO() nlines = 3 frecs = inspect.getinnerframes(tb, nlines) trace.write("Mypaint version: %s\n" % app.version) trace.write("System information: %s\n" % platform.platform()) trace.write("Using: %s\n" % (get_libs_version_string(),)) trace.write("Traceback (most recent call last):\n") for frame, fname, lineno, funcname, context, cindex in frecs: trace.write(' File "%s", line %d, ' % (fname, lineno)) args, varargs, varkw, lcls = inspect.getargvalues(frame) def readline(lno=[lineno], *args): if args: print(args) try: return linecache.getline(fname, lno[0]) finally: lno[0] += 1 all, prev, name, scope = {}, None, "", None for ttype, tstr, stup, etup, line in tokenize.generate_tokens(readline): if ttype == tokenize.NAME and tstr not in keyword.kwlist: if name: if name[-1] == ".": try: val = getattr(prev, tstr) except AttributeError: # XXX skip the rest of this identifier only break name += tstr else: assert not name and not scope scope, val = lookup(tstr, frame, lcls) name = tstr if val is not None: prev = val elif tstr == ".": if prev: name += "." else: if name: all[name] = (scope, prev) prev, name, scope = None, "", None if ttype == tokenize.NEWLINE: break try: details = inspect.formatargvalues( args, varargs, varkw, lcls, formatvalue=lambda v: "=" + pydoc.text.repr(v), ) except: # seen that one on Windows (actual exception was KeyError: self) details = "(no details)" trace.write(funcname + details + "\n") if context is None: context = ["<source context missing>\n"] trace.write( "".join( [ " " + x.replace("\t", " ") for x in filter(lambda a: a.strip(), context) ] ) ) if len(all): trace.write(" variables: %s\n" % str(all)) trace.write("%s: %s" % (exctyp.__name__, value)) return trace def _info(exctyp, value, tb): global exception_dialog_active if exctyp is KeyboardInterrupt: return original_excepthook(exctyp, value, tb) sys.stderr.write(analyse_simple(exctyp, value, tb).getvalue()) if exception_dialog_active: return Gdk.pointer_ungrab(Gdk.CURRENT_TIME) Gdk.keyboard_ungrab(Gdk.CURRENT_TIME) exception_dialog_active = True # Create the dialog dialog = Gtk.MessageDialog(message_type=Gtk.MessageType.WARNING) dialog.set_title(_("Bug Detected")) primary = _("<big><b>A programming error has been detected.</b></big>") secondary = _( "You may be able to ignore this error and carry on working, " "but you should probably save your work soon.\n\n" "Please tell the developers about this using the issue tracker " "if no-one else has reported it yet." ) dialog.set_markup(primary) dialog.format_secondary_text(secondary) dialog.add_button(_("Search Tracker…"), RESPONSE_SEARCH) if "-" in lib.meta.MYPAINT_VERSION: # only development and prereleases dialog.add_button(_("Report…"), RESPONSE_REPORT) dialog.set_response_sensitive(RESPONSE_REPORT, False) dialog.add_button(_("Ignore Error"), Gtk.ResponseType.CLOSE) dialog.add_button(_("Quit MyPaint"), RESPONSE_QUIT) # Add an expander with details of the problem to the dialog def expander_cb(expander, *ignore): # Ensures that on deactivating the expander, the dialog is resized down if expander.get_expanded(): dialog.set_resizable(True) else: dialog.set_resizable(False) details_expander = Gtk.Expander() details_expander.set_label(_("Details…")) details_expander.connect("notify::expanded", expander_cb) textview = Gtk.TextView() textview.show() textview.set_editable(False) textview.modify_font(Pango.FontDescription("Monospace normal")) sw = Gtk.ScrolledWindow() sw.show() sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) sw.add(textview) # Set window sizing so that it's always at least 600 pixels wide, and # increases by 300 pixels in height once the details panel is open sw.set_size_request(0, 300) dialog.set_size_request(600, 0) details_expander.add(sw) details_expander.show_all() dialog.get_content_area().pack_start(details_expander, True, True, 0) # Get the traceback and set contents of the details try: trace = analyse(exctyp, value, tb).getvalue() except: try: trace = _("Exception while analyzing the exception.") + "\n" trace += analyse_simple(exctyp, value, tb).getvalue() except: trace = _("Exception while analyzing the exception.") buf = textview.get_buffer() trace = "\n".join(["```python", trace, "```"]) buf.set_text(trace) ## Would be nice to scroll to the bottom automatically, but @#&%*@ # first, last = buf.get_bounds() # buf.place_cursor(last) # mark = buf.get_insert() ##buf.scroll_mark_onscreen() ##textview.scroll_mark_onscreen(buf.get_insert(), 0) # textview.scroll_to_mark(mark, 0.0) # Connect callback and present the dialog dialog.connect("response", _dialog_response_cb, trace, exctyp, value) # dialog.set_modal(True) # this might actually be contra-productive... dialog.show() # calling dialog.run() here locks everything up in some cases, so # we just return to the main loop instead def _dialog_response_cb(dialog, resp, trace, exctyp, value): global exception_dialog_active if resp == RESPONSE_QUIT and Gtk.main_level() > 0: if not quit_confirmation_func: sys.exit(1) # Exit code is important for IDEs else: if quit_confirmation_func(): sys.exit(1) # Exit code is important for IDEs else: dialog.destroy() exception_dialog_active = False elif resp == RESPONSE_SEARCH: search_url = ( "https://github.com/mypaint/mypaint/search" "?utf8=%E2%9C%93" "&q={}+{}" "&type=Issues" ).format(quote_plus(exctyp.__name__, "/"), quote_plus(str(value), "/")) Gtk.show_uri(None, search_url, Gdk.CURRENT_TIME) if "-" in lib.meta.MYPAINT_VERSION: dialog.set_response_sensitive(RESPONSE_REPORT, True) elif resp == RESPONSE_REPORT: # TRANSLATORS: Crash report template for github, preceding a traceback. # TRANSLATORS: Please ask users kindly to supply at least an English # TRANSLATORS: title if they are able. body = _( """\ #### Description Give this report a short descriptive title. Use something like "[feature-that-broke]: [what-went-wrong]" for the title, if you can. Then please replace this text with a longer description of the bug. Screenshots or videos are great, too! #### Steps to reproduce Please tell us what you were doing when the error message popped up. If you can provide step-by-step instructions on how to reproduce the bug, that's even better. #### Traceback """ ) body = "\n\n".join( [ "".join(textwrap.wrap(p, sys.maxsize)) for p in textwrap.dedent(body).split("\n\n") ] + [trace] ) report_url = ( "https://github.com/mypaint/mypaint/issues/new" "?title={title}" "&body={body}" ).format( title="", body=quote_plus(body.encode("utf-8"), "/"), ) Gtk.show_uri(None, report_url, Gdk.CURRENT_TIME) else: dialog.destroy() exception_dialog_active = False original_excepthook = sys.excepthook sys.excepthook = _info exception_dialog_active = False if __name__ == "__main__": import os import sys def _test_button_clicked_cb(*a): class _TestException(Exception): pass raise _TestException("That was supposed to happen.") win = Gtk.Window() win.set_size_request(200, 150) win.set_title(os.path.basename(sys.argv[0])) btn = Gtk.Button(label="Break it") btn.connect("clicked", _test_button_clicked_cb) win.add(btn) win.connect("destroy", lambda *a: Gtk.main_quit()) win.show_all() Gtk.main()
covergrid
main
# Copyright 2004-2007 Joe Wreschnig, Michael Urman, Iñigo Serna # 2009-2010 Steven Robertson # 2012-2022 Nick Boultbee # 2009-2014 Christoph Reiter # 2022 Thomas Leberbauer # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. from __future__ import absolute_import import os import quodlibet from gi.repository import Gdk, Gio, GLib, Gtk from quodlibet import _, app, config, ngettext, qltk, util from quodlibet.browsers import Browser from quodlibet.browsers._base import DisplayPatternMixin from quodlibet.browsers.albums.main import AlbumTagCompletion from quodlibet.browsers.albums.main import PreferencesButton as AlbumPreferencesButton from quodlibet.browsers.covergrid.models import ( AlbumListFilterModel, AlbumListModel, AlbumListSortModel, ) from quodlibet.browsers.covergrid.widgets import AlbumWidget from quodlibet.qltk import Icons, popup_menu_at_widget from quodlibet.qltk.information import Information from quodlibet.qltk.menubutton import MenuButton from quodlibet.qltk.properties import SongProperties from quodlibet.qltk.searchbar import SearchBarBox from quodlibet.qltk.songsmenu import SongsMenu from quodlibet.qltk.x import ( Align, MenuItem, RadioMenuItem, ScrolledWindow, SymbolicIconImage, ) from quodlibet.query import Query from quodlibet.util import connect_destroy, connect_obj from .prefs import DEFAULT_PATTERN_TEXT, Preferences class PreferencesButton(AlbumPreferencesButton): def __init__(self, browser, model): Gtk.HBox.__init__(self) sort_orders = [ (_("_Title"), self.__compare_title), (_("_People"), self.__compare_people), (_("_Date"), self.__compare_date), (_("_Date Added"), self.__compare_date_added), (_("_Original Date"), self.__compare_original_date), (_("_Genre"), self.__compare_genre), (_("_Rating"), self.__compare_rating), (_("Play_count"), self.__compare_avgplaycount), ] menu = Gtk.Menu() sort_item = Gtk.MenuItem(label=_("Sort _by…"), use_underline=True) sort_menu = Gtk.Menu() active = config.getint("browsers", "album_sort", 1) item = None for i, (label, func) in enumerate(sort_orders): item = RadioMenuItem(group=item, label=label, use_underline=True) model.set_sort_func(100 + i, func) if i == active: model.set_sort_column_id(100 + i, Gtk.SortType.ASCENDING) item.set_active(True) item.connect( "toggled", util.DeferredSignal(self.__sort_toggled_cb), model, i ) sort_menu.append(item) sort_item.set_submenu(sort_menu) menu.append(sort_item) pref_item = MenuItem(_("_Preferences"), Icons.PREFERENCES_SYSTEM) menu.append(pref_item) connect_obj(pref_item, "activate", Preferences, browser) menu.show_all() button = MenuButton( SymbolicIconImage(Icons.EMBLEM_SYSTEM, Gtk.IconSize.MENU), arrow=True ) button.set_menu(menu) self.pack_start(button, True, True, 0) class CoverGridContainer(ScrolledWindow): def __init__(self, fb): super().__init__( hscrollbar_policy=Gtk.PolicyType.NEVER, vscrollbar_policy=Gtk.PolicyType.AUTOMATIC, shadow_type=Gtk.ShadowType.IN, ) self._fb = fb fb.set_hadjustment(self.props.hadjustment) fb.set_vadjustment(self.props.vadjustment) self.add(fb) def scroll_up(self): va = self.props.vadjustment va.props.value = va.props.lower def scroll_to_child(self, child): def scroll(): va = self.props.vadjustment if va is None: return v = va.props.value coords = child.translate_coordinates(self, 0, v) if coords is None: return x, y = coords h = child.get_allocation().height p = va.props.page_size if y < v: va.props.value = y elif y + h > v + p: va.props.value = y - p + h GLib.idle_add(scroll, priority=GLib.PRIORITY_LOW) def do_focus(self, direction): is_tab = ( direction == Gtk.DirectionType.TAB_FORWARD or direction == Gtk.DirectionType.TAB_BACKWARD ) if not is_tab: self._fb.child_focus(direction) return True if self.get_focus_child(): # [Tab] moves focus beyond this container return False children = self._fb.get_selected_children() if children: children[0].grab_focus() else: self._fb.child_focus(direction) return True def _get_cover_size(): mag = config.getfloat("browsers", "covergrid_magnification", 3.0) size = config.getint("browsers", "cover_size") if size <= 0: size = 48 return mag * size class CoverGrid(Browser, util.InstanceTracker, DisplayPatternMixin): __model = None _PATTERN_FN = os.path.join(quodlibet.get_user_dir(), "album_pattern") _DEFAULT_PATTERN_TEXT = DEFAULT_PATTERN_TEXT name = _("Cover Grid") accelerated_name = _("_Cover Grid") keys = ["CoverGrid"] priority = 5 def pack(self, songpane): container = self.songcontainer container.pack1(self, True, False) container.pack2(songpane, True, False) return container def unpack(self, container, songpane): container.remove(songpane) container.remove(self) @classmethod def init(klass, library): super(CoverGrid, klass).load_pattern() @classmethod def _init_model(klass, library): if klass.__model is None: klass.__model = AlbumListModel(library) klass.__library = library @classmethod def _destroy_model(klass): klass.__model.destroy() klass.__model = None @classmethod def toggle_text(klass): text_visible = config.getboolean("browsers", "album_text", True) for covergrid in klass.instances(): for child in covergrid.view: child.props.text_visible = text_visible @classmethod def toggle_item_all(klass): show = config.getboolean("browsers", "covergrid_all", True) for covergrid in klass.instances(): covergrid.__model_filter.props.include_item_all = show @classmethod def toggle_wide(klass): wide = config.getboolean("browsers", "covergrid_wide", False) for covergrid in klass.instances(): covergrid.songcontainer.set_orientation( Gtk.Orientation.HORIZONTAL if wide else Gtk.Orientation.VERTICAL ) @classmethod def update_mag(klass): cover_size = _get_cover_size() for covergrid in klass.instances(): for child in covergrid.view: child.cover_size = cover_size covergrid.view.queue_resize() def __init__(self, library): super().__init__(orientation=Gtk.Orientation.VERTICAL, spacing=6) self.songcontainer = qltk.paned.ConfigRVPaned("browsers", "covergrid_pos", 0.4) if config.getboolean("browsers", "covergrid_wide", False): self.songcontainer.set_orientation(Gtk.Orientation.HORIZONTAL) self._register_instance() self._init_model(library) self.__cover_cancel = Gio.Cancellable() model_sort = AlbumListSortModel(model=self.__model) self.__model_filter = model_filter = AlbumListFilterModel( include_item_all=config.getboolean("browsers", "covergrid_all", True), child_model=model_sort, ) def create_album_widget(model): item_padding = config.getint("browsers", "item_padding", 6) text_visible = config.getboolean("browsers", "album_text", True) cover_size = _get_cover_size() widget = AlbumWidget( model, display_pattern=self.display_pattern, cover_size=cover_size, padding=item_padding, text_visible=text_visible, cancelable=self.__cover_cancel, ) widget.connect("songs-menu", self.__popup) return widget self.view = view = Gtk.FlowBox( valign=Gtk.Align.START, activate_on_single_click=False, selection_mode=Gtk.SelectionMode.MULTIPLE, homogeneous=True, min_children_per_line=1, max_children_per_line=10, row_spacing=config.getint("browsers", "row_spacing", 6), column_spacing=config.getint("browsers", "column_spacing", 6), ) self.scrollwin = sw = CoverGridContainer(view) view.connect( "selected-children-changed", util.DeferredSignal( lambda _: self.__update_songs(select_default=False), owner=self ), ) targets = [ ("text/x-quodlibet-songs", Gtk.TargetFlags.SAME_APP, 1), ("text/uri-list", 0, 2), ] targets = [Gtk.TargetEntry.new(*t) for t in targets] view.drag_source_set( Gdk.ModifierType.BUTTON1_MASK, targets, Gdk.DragAction.COPY ) view.connect("drag-data-get", self.__drag_data_get) view.connect("child-activated", self.__child_activated) self.accelerators = Gtk.AccelGroup() search = SearchBarBox( completion=AlbumTagCompletion(), accel_group=self.accelerators ) search.connect("query-changed", lambda *a: self.__update_filter()) connect_obj(search, "focus-out", lambda w: w.grab_focus(), view) self.__search = search prefs = PreferencesButton(self, model_sort) search.pack_start(prefs, False, True, 0) self.pack_start(Align(search, left=6, top=0), False, True, 0) self.pack_start(sw, True, True, 0) self.__update_filter() model_filter.connect( "notify::filter", util.DeferredSignal(lambda *a: self.__update_songs(), owner=self), ) self.connect("key-press-event", self.__key_pressed, library.librarian) self.connect("destroy", self.__destroy) if app.cover_manager: connect_destroy(app.cover_manager, "cover-changed", self.__cover_changed) # show all before binding the model, so a label in a flowbox child will # stay hidden if so configured by the "browsers.album_text" property. self.show_all() view.bind_model(model_filter, create_album_widget) def __update_songs(self, select_default=True): songs = self.__get_selected_songs(sort=False) if not select_default or songs: self.songs_selected(songs) else: child = self.view.get_child_at_index(0) if child: self.view.select_child(child) else: self.songs_selected(songs) def __key_pressed(self, widget, event, librarian): if qltk.is_accel(event, "<Primary>I"): songs = self.__get_selected_songs() if songs: window = Information(librarian, songs, self) window.show() return True elif qltk.is_accel(event, "<Primary>Return", "<Primary>KP_Enter"): qltk.enqueue(self.__get_selected_songs()) return True elif qltk.is_accel(event, "<alt>Return"): songs = self.__get_selected_songs() if songs: window = SongProperties(librarian, songs, self) window.show() return True return False def __destroy(self, browser): self.__cover_cancel.cancel() self.view.bind_model(None, lambda _: None) self.__model_filter.destroy() self.__model_filter = None if not CoverGrid.instances(): CoverGrid._destroy_model() def __cover_changed(self, manager, songs): songs = set(songs) for child in self.view: if not songs: break album = child.model.album if album is None: continue match = songs & album.songs if match: child.populate() songs -= match def __update_filter(self, scroll_up=True): if scroll_up: self.scrollwin.scroll_up() q = self.__search.get_query(star=["~people", "album"]) self.__model_filter.props.filter = None if q.matches_all else q.search def __popup(self, widget): if not widget.is_selected(): self.view.unselect_all() self.view.select_child(widget) albums = self.__get_selected_albums() songs = self.__get_songs_from_albums(albums) button_label = ngettext( "Reload album _cover", "Reload album _covers", len(albums) ) button = MenuItem(button_label, Icons.VIEW_REFRESH) button.connect("activate", self.__refresh_cover, widget) menu = SongsMenu(self.__library, songs, items=[[button]]) menu.show_all() popup_menu_at_widget( menu, widget, Gdk.BUTTON_SECONDARY, Gtk.get_current_event_time() ) def __refresh_cover(self, menuitem, view): for child in self.view.get_selected_children(): child.populate() def refresh_all(self): display_pattern = self.display_pattern for child in self.view: child.display_pattern = display_pattern def __get_selected_albums(self): items = [] for child in self.view.get_selected_children(): album = child.model.album if album is None: model = self.__model_filter return [item.album for item in model if item.album is not None] items.append(album) return items def __get_songs_from_albums(self, albums, sort=True): # Sort first by how the albums appear in the model itself, # then within the album using the default order. songs = [] if sort: for album in albums: songs.extend(sorted(album.songs, key=lambda s: s.sort_key)) else: for album in albums: songs.extend(album.songs) return songs def __get_selected_songs(self, sort=True): albums = self.__get_selected_albums() return self.__get_songs_from_albums(albums, sort) def __drag_data_get(self, view, ctx, sel, tid, etime): songs = self.__get_selected_songs() if tid == 1: qltk.selection_set_songs(sel, songs) else: sel.set_uris([song("~uri") for song in songs]) def __child_activated(self, view, child): self.songs_activated() def active_filter(self, song): for album in self.__get_selected_albums(): if song in album.songs: return True return False def can_filter_text(self): return True def filter_text(self, text): self.__search.set_text(text) if Query(text).is_parsable: self.__update_filter() self.__update_songs() def get_filter_text(self): return self.__search.get_text() def can_filter_albums(self): return True def can_filter(self, key): # Numerics are different for collections, and although title works, # it's not of much use here. if key is not None and (key.startswith("~#") or key == "title"): return False return super().can_filter(key) def filter_albums(self, values): changed = self.__select_by_func( lambda album: album is not None and album.key in values ) self.view.grab_focus() if changed: self.__update_songs() def list_albums(self): model = self.__model_filter return [item.album.key for item in model if item.album is not None] def unfilter(self): self.filter_text("") def __select_by_func(self, func, scroll=True, one=False): first = True view = self.view for i, item in enumerate(self.__model_filter): if not func(item.album): continue child = view.get_child_at_index(i) if first: view.unselect_all() view.select_child(child) if scroll: self.scrollwin.scroll_to_child(child) first = False if one: break else: view.select_child(child) return not first def save(self): conf = self.__get_config_string() config.settext("browsers", "covergrid", conf) text = self.__search.get_text() config.settext("browsers", "query_text", text) def restore(self): text = config.gettext("browsers", "query_text") entry = self.__search entry.set_text(text) if Query(text).is_parsable: self.__update_filter(scroll_up=False) keys = config.gettext("browsers", "covergrid", "").split("\n") if keys != [""]: self.__select_by_func( lambda album: album is not None and album.str_key in keys ) else: self.__select_by_func(lambda album: album is None, one=True) def finalize(self, restored): if not restored: self.__select_by_func(lambda album: album is None, one=True) def scroll(self, song): album_key = song.album_key self.__select_by_func( lambda album: album is not None and album.key == album_key, one=True ) def activate(self): self.__update_songs() def __get_config_string(self): albums = [] for child in self.view.get_selected_children(): album = child.model.album if album is None: albums.clear() break albums.append(album) if not albums: return "" confval = "\n".join((a.str_key for a in albums)) # ConfigParser strips a trailing \n so we move it to the front if confval and confval[-1] == "\n": confval = "\n" + confval[:-1] return confval
cli
tracking
# encoding: utf-8 import csv import datetime from typing import NamedTuple, Optional import ckan.logic as logic import ckan.model as model import click from ckan.cli import error_shout class ViewCount(NamedTuple): id: str name: str count: int @click.group(name="tracking", short_help="Update tracking statistics") def tracking(): pass @tracking.command() @click.argument("start_date", required=False) def update(start_date: Optional[str]): engine = model.meta.engine assert engine update_all(engine, start_date) @tracking.command() @click.argument("output_file", type=click.Path()) @click.argument("start_date", required=False) def export(output_file: str, start_date: Optional[str]): engine = model.meta.engine assert engine update_all(engine, start_date) export_tracking(engine, output_file) def update_all(engine: model.Engine, start_date: Optional[str] = None): if start_date: date = datetime.datetime.strptime(start_date, "%Y-%m-%d") else: # No date given. See when we last have data for and get data # from 2 days before then in case new data is available. # If no date here then use 2011-01-01 as the start date sql = """SELECT tracking_date from tracking_summary ORDER BY tracking_date DESC LIMIT 1;""" result = engine.execute(sql).fetchall() if result: date = result[0]["tracking_date"] date += datetime.timedelta(-2) # convert date to datetime combine = datetime.datetime.combine date = combine(date, datetime.time(0)) else: date = datetime.datetime(2011, 1, 1) start_date_solrsync = date end_date = datetime.datetime.now() while date < end_date: stop_date = date + datetime.timedelta(1) update_tracking(engine, date) click.echo("tracking updated for {}".format(date)) date = stop_date update_tracking_solr(engine, start_date_solrsync) def _total_views(engine: model.Engine): sql = """ SELECT p.id, p.name, COALESCE(SUM(s.count), 0) AS total_views FROM package AS p LEFT OUTER JOIN tracking_summary AS s ON s.package_id = p.id GROUP BY p.id, p.name ORDER BY total_views DESC """ return [ViewCount(*t) for t in engine.execute(sql).fetchall()] def _recent_views(engine: model.Engine, measure_from: datetime.date): sql = """ SELECT p.id, p.name, COALESCE(SUM(s.count), 0) AS total_views FROM package AS p LEFT OUTER JOIN tracking_summary AS s ON s.package_id = p.id WHERE s.tracking_date >= %(measure_from)s GROUP BY p.id, p.name ORDER BY total_views DESC """ return [ ViewCount(*t) for t in engine.execute(sql, measure_from=str(measure_from)).fetchall() ] def export_tracking(engine: model.Engine, output_filename: str): """Write tracking summary to a csv file.""" headings = [ "dataset id", "dataset name", "total views", "recent views (last 2 weeks)", ] measure_from = datetime.date.today() - datetime.timedelta(days=14) recent_views = _recent_views(engine, measure_from) total_views = _total_views(engine) with open(output_filename, "w") as fh: f_out = csv.writer(fh) f_out.writerow(headings) recent_views_for_id = dict((r.id, r.count) for r in recent_views) f_out.writerows( [ (r.id, r.name, r.count, recent_views_for_id.get(r.id, 0)) for r in total_views ] ) def update_tracking(engine: model.Engine, summary_date: datetime.datetime): package_url = "/dataset/" # clear out existing data before adding new sql = ( """DELETE FROM tracking_summary WHERE tracking_date='%s'; """ % summary_date ) engine.execute(sql) sql = """SELECT DISTINCT url, user_key, CAST(access_timestamp AS Date) AS tracking_date, tracking_type INTO tracking_tmp FROM tracking_raw WHERE CAST(access_timestamp as Date)=%s; INSERT INTO tracking_summary (url, count, tracking_date, tracking_type) SELECT url, count(user_key), tracking_date, tracking_type FROM tracking_tmp GROUP BY url, tracking_date, tracking_type; DROP TABLE tracking_tmp; COMMIT;""" engine.execute(sql, summary_date) # get ids for dataset urls sql = """UPDATE tracking_summary t SET package_id = COALESCE( (SELECT id FROM package p WHERE p.name = regexp_replace (' ' || t.url, '^[ ]{1}(/\\w{2}){0,1}' || %s, '')) ,'~~not~found~~') WHERE t.package_id IS NULL AND tracking_type = 'page';""" engine.execute(sql, package_url) # update summary totals for resources sql = """UPDATE tracking_summary t1 SET running_total = ( SELECT sum(count) FROM tracking_summary t2 WHERE t1.url = t2.url AND t2.tracking_date <= t1.tracking_date ) ,recent_views = ( SELECT sum(count) FROM tracking_summary t2 WHERE t1.url = t2.url AND t2.tracking_date <= t1.tracking_date AND t2.tracking_date >= t1.tracking_date - 14 ) WHERE t1.running_total = 0 AND tracking_type = 'resource';""" engine.execute(sql) # update summary totals for pages sql = """UPDATE tracking_summary t1 SET running_total = ( SELECT sum(count) FROM tracking_summary t2 WHERE t1.package_id = t2.package_id AND t2.tracking_date <= t1.tracking_date ) ,recent_views = ( SELECT sum(count) FROM tracking_summary t2 WHERE t1.package_id = t2.package_id AND t2.tracking_date <= t1.tracking_date AND t2.tracking_date >= t1.tracking_date - 14 ) WHERE t1.running_total = 0 AND tracking_type = 'page' AND t1.package_id IS NOT NULL AND t1.package_id != '~~not~found~~';""" engine.execute(sql) def update_tracking_solr(engine: model.Engine, start_date: datetime.datetime): sql = """SELECT package_id FROM tracking_summary where package_id!='~~not~found~~' and tracking_date >= %s;""" results = engine.execute(sql, start_date) package_ids: set[str] = set() for row in results: package_ids.add(row["package_id"]) total = len(package_ids) not_found = 0 click.echo( "{} package index{} to be rebuilt starting from {}".format( total, "" if total < 2 else "es", start_date ) ) from ckan.lib.search import rebuild for package_id in package_ids: try: rebuild(package_id) except logic.NotFound: click.echo("Error: package {} not found.".format(package_id)) not_found += 1 except KeyboardInterrupt: click.echo("Stopped.") return except Exception as e: error_shout(e) click.echo( "search index rebuilding done." + (" {} not found.".format(not_found) if not_found else "") )
config
server
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms of the AGPLv3 License" from enum import Enum from typing import Dict, List, Optional from octoprint.schema import BaseModel from octoprint.vendor.with_attrs_docs import with_attrs_docs CONST_15MIN = 15 * 60 CONST_1GB = 1024 * 1024 * 1024 CONST_500MB = 500 * 1024 * 1024 CONST_200MB = 200 * 1024 * 1024 CONST_100KB = 100 * 1024 @with_attrs_docs class ReverseProxyConfig(BaseModel): prefixHeader: Optional[str] = None """The request header from which to determine the URL prefix under which OctoPrint is served by the reverse proxy.""" schemeHeader: Optional[str] = None """The request header from which to determine the scheme (http or https) under which a specific request to OctoPrint was made to the reverse proxy.""" hostHeader: Optional[str] = None """The request header from which to determine the host under which OctoPrint is served by the reverse proxy.""" serverHeader: Optional[str] = None portHeader: Optional[str] = None prefixFallback: Optional[str] = None """Use this option to define an optional URL prefix (with a leading /, so absolute to your server's root) under which to run OctoPrint. This should only be needed if you want to run OctoPrint behind a reverse proxy under a different root endpoint than `/` and can't configure said reverse proxy to send a prefix HTTP header (X-Script-Name by default, see above) with forwarded requests.""" schemeFallback: Optional[str] = None """Use this option to define an optional forced scheme (http or https) under which to run OctoPrint. This should only be needed if you want to run OctoPrint behind a reverse proxy that also does HTTPS determination but can't configure said reverse proxy to send a scheme HTTP header (X-Scheme by default, see above) with forwarded requests.""" hostFallback: Optional[str] = None """Use this option to define an optional forced host under which to run OctoPrint. This should only be needed if you want to run OctoPrint behind a reverse proxy with a different hostname than OctoPrint itself but can't configure said reverse proxy to send a host HTTP header (X-Forwarded-Host by default, see above) with forwarded requests.""" serverFallback: Optional[str] = None portFallback: Optional[str] = None trustedDownstream: List[str] = [] """List of trusted downstream servers for which to ignore the IP address when trying to determine the connecting client's IP address. If you have OctoPrint behind more than one reverse proxy you should add their IPs here so that they won't be interpreted as the client's IP. One reverse proxy will be handled correctly by default.""" @with_attrs_docs class UploadsConfig(BaseModel): maxSize: int = CONST_1GB """Maximum size of uploaded files in bytes, defaults to 1GB.""" nameSuffix: str = "name" """Suffix used for storing the filename in the file upload headers when streaming uploads.""" pathSuffix: str = "path" """Suffix used for storing the path to the temporary file in the file upload headers when streaming uploads.""" @with_attrs_docs class CommandsConfig(BaseModel): systemShutdownCommand: Optional[str] = None """Command to shut down the system OctoPrint is running on.""" systemRestartCommand: Optional[str] = None """Command to restart the system OctoPrint is running on.""" serverRestartCommand: Optional[str] = None """Command to restart OctoPrint.""" localPipCommand: Optional[str] = None """pip command associated with OctoPrint, used for installing plugins and updates, if unset (default) the command will be autodetected based on the current python executable - unless you have a really special setup this is the right way to do it and there should be no need to ever touch this setting.""" @with_attrs_docs class OnlineCheckConfig(BaseModel): enabled: Optional[bool] = None """Whether the online check is enabled. Ships unset, the user will be asked to make a decision as part of the setup wizard.""" interval: int = CONST_15MIN """Interval in which to check for online connectivity (in seconds), defaults to 15 minutes.""" host: str = "1.1.1.1" """DNS host against which to check, defaults to Cloudflare's DNS.""" port: int = 53 """DNS port against which to check, defaults to the standard DNS port.""" name: str = "octoprint.org" """Host name for which to check name resolution, defaults to OctoPrint's main domain.""" @with_attrs_docs class PluginBlacklistConfig(BaseModel): enabled: Optional[bool] = None """Whether use of the blacklist is enabled. If unset, the user will be asked to make a decision as part of the setup wizard.""" url: str = "https://plugins.octoprint.org/blacklist.json" """The URL from which to fetch the blacklist.""" ttl: int = CONST_15MIN """Time to live of the cached blacklist, in seconds (default: 15 minutes).""" timeout: float = 3.05 """Timeout for fetching the blacklist, in seconds (default: 3.05 seconds).""" @with_attrs_docs class DiskspaceConfig(BaseModel): warning: int = CONST_500MB """Threshold (bytes) after which to consider disk space becoming sparse, defaults to 500MB.""" critical: int = CONST_200MB """Threshold (bytes) after which to consider disk space becoming critical, defaults to 200MB.""" @with_attrs_docs class PreemptiveCacheConfig(BaseModel): exceptions: List[str] = [] """Which server paths to exclude from the preemptive cache, e.g. `/some/path`.""" until: int = 7 """How many days to leave unused entries in the preemptive cache config.""" @with_attrs_docs class IpCheckConfig(BaseModel): enabled: bool = True """Whether to enable the check.""" trustedSubnets: List[str] = [] """Additional non-local subnets to consider trusted, in CIDR notation, e.g. `192.168.1.0/24`.""" class SameSiteEnum(str, Enum): strict = "Strict" lax = "Lax" none = "None" @with_attrs_docs class CookiesConfig(BaseModel): secure: bool = False """Whether to set the `Secure` flag to true on cookies. Only set to true if you are running OctoPrint behind a reverse proxy taking care of SSL termination.""" samesite: Optional[SameSiteEnum] = SameSiteEnum.lax """`SameSite` setting to use on the cookies. Possible values are `None`, `Lax` and `Strict`. Defaults to `Lax`. Be advised that if forced unset, this has security implications as many browsers now default to `Lax` unless you configure cookies to be set with `Secure` flag set, explicitly set `SameSite` setting here and also serve OctoPrint over https. The `Lax` setting is known to cause with embedding OctoPrint in frames. See also ["Feature: Cookies default to SameSite=Lax"](https://www.chromestatus.com/feature/5088147346030592), ["Feature: Reject insecure SameSite=None cookies"](https://www.chromestatus.com/feature/5633521622188032) and [issue #3482](https://github.com/OctoPrint/OctoPrint/issues/3482).""" @with_attrs_docs class ServerConfig(BaseModel): host: Optional[str] = None """Use this option to define the host to which to bind the server. If unset, OctoPrint will attempt to bind on all available interfaces, IPv4 and v6 unless either is disabled.""" port: int = 5000 """Use this option to define the port to which to bind the server.""" firstRun: bool = True """If this option is true, OctoPrint will show the First Run wizard and set the setting to false after that completes.""" startOnceInSafeMode: bool = False """If this option is true, OctoPrint will enable safe mode on the next server start and reset the setting to false""" ignoreIncompleteStartup: bool = False """Set this to true to make OctoPrint ignore incomplete startups. Helpful for development.""" incompleteStartup: bool = False """Signals to OctoPrint that the last startup was incomplete. OctoPrint will then startup in safe mode.""" seenWizards: Dict[str, str] = {} secretKey: Optional[str] = None """Secret key for encrypting cookies and such, randomly generated on first run.""" heartbeat: int = CONST_15MIN reverseProxy: ReverseProxyConfig = ReverseProxyConfig() """Settings if OctoPrint is running behind a reverse proxy (haproxy, nginx, apache, ...) that doesn't correctly set the [required headers](https://community.octoprint.org/t/reverse-proxy-configuration-examples/1107). These are necessary in order to make OctoPrint generate correct external URLs so that AJAX requests and download URLs work, and so that client IPs are read correctly.""" uploads: UploadsConfig = UploadsConfig() """Settings for file uploads to OctoPrint, such as maximum allowed file size and header suffixes to use for streaming uploads. OctoPrint does some nifty things internally in order to allow streaming of large file uploads to the application rather than just storing them in memory. For that it needs to do some rewriting of the incoming upload HTTP requests, storing the uploaded file to a temporary location on disk and then sending an internal request to the application containing the original filename and the location of the temporary file.""" maxSize: int = CONST_100KB """Maximum size of requests other than file uploads in bytes, defaults to 100KB.""" commands: CommandsConfig = CommandsConfig() """Commands to restart/shutdown octoprint or the system it's running on.""" onlineCheck: OnlineCheckConfig = OnlineCheckConfig() """Configuration of the regular online connectivity check.""" pluginBlacklist: PluginBlacklistConfig = PluginBlacklistConfig() """Configuration of the plugin blacklist.""" diskspace: DiskspaceConfig = DiskspaceConfig() """Settings of when to display what disk space warning.""" preemptiveCache: PreemptiveCacheConfig = PreemptiveCacheConfig() """Configuration of the preemptive cache.""" ipCheck: IpCheckConfig = IpCheckConfig() """Configuration of the client IP check to warn about connections from external networks.""" allowFraming: bool = False """Whether to allow OctoPrint to be embedded in a frame or not. Note that depending on your setup you might have to set SameSite to None, Secure to true and serve OctoPrint through a reverse proxy that enables https for cookies and thus logging in to work.""" cookies: CookiesConfig = CookiesConfig() """Settings for further configuration of the cookies that OctoPrint sets (login, remember me, ...).""" allowedLoginRedirectPaths: List[str] = [] """List of paths that are allowed to be used as redirect targets for the login page, in addition to the default ones (`/`, `/recovery/` and `/plugin/appkeys/auth/`)"""
meshes
mesh_canticcx_seg2
def create_nodes(femmesh): # nodes femmesh.addNode(0.0, 500.0, 500.0, 1) femmesh.addNode(8000.0, 500.0, 500.0, 2) femmesh.addNode(148.14814814814792, 500.0, 500.0, 3) femmesh.addNode(296.29629629629585, 500.0, 500.0, 4) femmesh.addNode(444.4444444444438, 500.0, 500.0, 5) femmesh.addNode(592.5925925925918, 500.0, 500.0, 6) femmesh.addNode(740.7407407407396, 500.0, 500.0, 7) femmesh.addNode(888.8888888888874, 500.0, 500.0, 8) femmesh.addNode(1037.0370370370354, 500.0, 500.0, 9) femmesh.addNode(1185.1851851851832, 500.0, 500.0, 10) femmesh.addNode(1333.333333333331, 500.0, 500.0, 11) femmesh.addNode(1481.4814814814792, 500.0, 500.0, 12) femmesh.addNode(1629.6296296296275, 500.0, 500.0, 13) femmesh.addNode(1777.7777777777753, 500.0, 500.0, 14) femmesh.addNode(1925.9259259259236, 500.0, 500.0, 15) femmesh.addNode(2074.0740740740716, 500.0, 500.0, 16) femmesh.addNode(2222.22222222222, 500.0, 500.0, 17) femmesh.addNode(2370.370370370368, 500.0, 500.0, 18) femmesh.addNode(2518.5185185185155, 500.0, 500.0, 19) femmesh.addNode(2666.666666666663, 500.0, 500.0, 20) femmesh.addNode(2814.8148148148107, 500.0, 500.0, 21) femmesh.addNode(2962.962962962958, 500.0, 500.0, 22) femmesh.addNode(3111.1111111111054, 500.0, 500.0, 23) femmesh.addNode(3259.259259259253, 500.0, 500.0, 24) femmesh.addNode(3407.4074074074006, 500.0, 500.0, 25) femmesh.addNode(3555.555555555548, 500.0, 500.0, 26) femmesh.addNode(3703.7037037036957, 500.0, 500.0, 27) femmesh.addNode(3851.851851851843, 500.0, 500.0, 28) femmesh.addNode(3999.9999999999905, 500.0, 500.0, 29) femmesh.addNode(4148.148148148138, 500.0, 500.0, 30) femmesh.addNode(4296.296296296286, 500.0, 500.0, 31) femmesh.addNode(4444.4444444444325, 500.0, 500.0, 32) femmesh.addNode(4592.59259259258, 500.0, 500.0, 33) femmesh.addNode(4740.740740740728, 500.0, 500.0, 34) femmesh.addNode(4888.888888888877, 500.0, 500.0, 35) femmesh.addNode(5037.037037037026, 500.0, 500.0, 36) femmesh.addNode(5185.185185185173, 500.0, 500.0, 37) femmesh.addNode(5333.333333333322, 500.0, 500.0, 38) femmesh.addNode(5481.481481481471, 500.0, 500.0, 39) femmesh.addNode(5629.6296296296205, 500.0, 500.0, 40) femmesh.addNode(5777.777777777769, 500.0, 500.0, 41) femmesh.addNode(5925.925925925918, 500.0, 500.0, 42) femmesh.addNode(6074.074074074067, 500.0, 500.0, 43) femmesh.addNode(6222.222222222214, 500.0, 500.0, 44) femmesh.addNode(6370.370370370363, 500.0, 500.0, 45) femmesh.addNode(6518.518518518513, 500.0, 500.0, 46) femmesh.addNode(6666.6666666666615, 500.0, 500.0, 47) femmesh.addNode(6814.81481481481, 500.0, 500.0, 48) femmesh.addNode(6962.962962962959, 500.0, 500.0, 49) femmesh.addNode(7111.111111111108, 500.0, 500.0, 50) femmesh.addNode(7259.259259259256, 500.0, 500.0, 51) femmesh.addNode(7407.407407407406, 500.0, 500.0, 52) femmesh.addNode(7555.555555555554, 500.0, 500.0, 53) femmesh.addNode(7703.703703703703, 500.0, 500.0, 54) femmesh.addNode(7851.851851851851, 500.0, 500.0, 55) return True def create_elements(femmesh): # elements femmesh.addEdge([1, 3], 1) femmesh.addEdge([3, 4], 2) femmesh.addEdge([4, 5], 3) femmesh.addEdge([5, 6], 4) femmesh.addEdge([6, 7], 5) femmesh.addEdge([7, 8], 6) femmesh.addEdge([8, 9], 7) femmesh.addEdge([9, 10], 8) femmesh.addEdge([10, 11], 9) femmesh.addEdge([11, 12], 10) femmesh.addEdge([12, 13], 11) femmesh.addEdge([13, 14], 12) femmesh.addEdge([14, 15], 13) femmesh.addEdge([15, 16], 14) femmesh.addEdge([16, 17], 15) femmesh.addEdge([17, 18], 16) femmesh.addEdge([18, 19], 17) femmesh.addEdge([19, 20], 18) femmesh.addEdge([20, 21], 19) femmesh.addEdge([21, 22], 20) femmesh.addEdge([22, 23], 21) femmesh.addEdge([23, 24], 22) femmesh.addEdge([24, 25], 23) femmesh.addEdge([25, 26], 24) femmesh.addEdge([26, 27], 25) femmesh.addEdge([27, 28], 26) femmesh.addEdge([28, 29], 27) femmesh.addEdge([29, 30], 28) femmesh.addEdge([30, 31], 29) femmesh.addEdge([31, 32], 30) femmesh.addEdge([32, 33], 31) femmesh.addEdge([33, 34], 32) femmesh.addEdge([34, 35], 33) femmesh.addEdge([35, 36], 34) femmesh.addEdge([36, 37], 35) femmesh.addEdge([37, 38], 36) femmesh.addEdge([38, 39], 37) femmesh.addEdge([39, 40], 38) femmesh.addEdge([40, 41], 39) femmesh.addEdge([41, 42], 40) femmesh.addEdge([42, 43], 41) femmesh.addEdge([43, 44], 42) femmesh.addEdge([44, 45], 43) femmesh.addEdge([45, 46], 44) femmesh.addEdge([46, 47], 45) femmesh.addEdge([47, 48], 46) femmesh.addEdge([48, 49], 47) femmesh.addEdge([49, 50], 48) femmesh.addEdge([50, 51], 49) femmesh.addEdge([51, 52], 50) femmesh.addEdge([52, 53], 51) femmesh.addEdge([53, 54], 52) femmesh.addEdge([54, 55], 53) femmesh.addEdge([55, 2], 54) return True
handlers
logging
""" raven.handlers.logging ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import datetime import logging import sys import traceback from raven.base import Client from raven.utils.compat import iteritems, string_types, text_type from raven.utils.encoding import to_string from raven.utils.stacks import iter_stack_frames RESERVED = frozenset( ( "stack", "name", "module", "funcName", "args", "msg", "levelno", "exc_text", "exc_info", "data", "created", "levelname", "msecs", "relativeCreated", "tags", "message", ) ) CONTEXTUAL = frozenset(("user", "culprit", "server_name", "fingerprint")) def extract_extra(record, reserved=RESERVED, contextual=CONTEXTUAL): data = {} extra = getattr(record, "data", None) if not isinstance(extra, dict): if extra: extra = {"data": extra} else: extra = {} for k, v in iteritems(vars(record)): if k in reserved: continue if k.startswith("_"): continue if "." not in k and k not in contextual: extra[k] = v else: data[k] = v return data, extra class SentryHandler(logging.Handler): def __init__(self, *args, **kwargs): client = kwargs.get("client_cls", Client) if len(args) == 1: arg = args[0] if isinstance(arg, string_types): self.client = client(dsn=arg, **kwargs) elif isinstance(arg, Client): self.client = arg else: raise ValueError( "The first argument to %s must be either a " "Client instance or a DSN, got %r instead." % ( self.__class__.__name__, arg, ) ) elif "client" in kwargs: self.client = kwargs["client"] else: self.client = client(*args, **kwargs) self.tags = kwargs.pop("tags", None) logging.Handler.__init__(self, level=kwargs.get("level", logging.NOTSET)) def can_record(self, record): return not ( record.name == "raven" or record.name.startswith(("sentry.errors", "raven.")) ) def emit(self, record): try: # Beware to python3 bug (see #10805) if exc_info is (None, None, None) self.format(record) if not self.can_record(record): print(to_string(record.message), file=sys.stderr) return return self._emit(record) except Exception: if self.client.raise_send_errors: raise print( "Top level Sentry exception caught - failed " "creating log record", file=sys.stderr, ) print(to_string(record.msg), file=sys.stderr) print(to_string(traceback.format_exc()), file=sys.stderr) def _get_targetted_stack(self, stack, record): # we might need to traverse this multiple times, so coerce it to a list stack = list(stack) frames = [] started = False last_mod = "" for item in stack: if isinstance(item, (list, tuple)): frame, lineno = item else: frame, lineno = item, item.f_lineno if not started: f_globals = getattr(frame, "f_globals", {}) module_name = f_globals.get("__name__", "") if ( last_mod and last_mod.startswith("logging") ) and not module_name.startswith("logging"): started = True else: last_mod = module_name continue frames.append((frame, lineno)) # We failed to find a starting point if not frames: return stack return frames def _emit(self, record, **kwargs): data, extra = extract_extra(record) stack = getattr(record, "stack", None) if stack is True: stack = iter_stack_frames() if stack: stack = self._get_targetted_stack(stack, record) date = datetime.datetime.utcfromtimestamp(record.created) event_type = "raven.events.Message" handler_kwargs = { "params": record.args, } try: handler_kwargs["message"] = text_type(record.msg) except UnicodeDecodeError: # Handle binary strings where it should be unicode... handler_kwargs["message"] = repr(record.msg)[1:-1] try: handler_kwargs["formatted"] = text_type(record.message) except UnicodeDecodeError: # Handle binary strings where it should be unicode... handler_kwargs["formatted"] = repr(record.message)[1:-1] # If there's no exception being processed, exc_info may be a 3-tuple of None # http://docs.python.org/library/sys.html#sys.exc_info if record.exc_info and all(record.exc_info): # capture the standard message first so that we ensure # the event is recorded as an exception, in addition to having our # message interface attached handler = self.client.get_handler(event_type) data.update(handler.capture(**handler_kwargs)) event_type = "raven.events.Exception" handler_kwargs = {"exc_info": record.exc_info} data["level"] = record.levelno data["logger"] = record.name kwargs["tags"] = tags = {} if self.tags: tags.update(self.tags) tags.update(getattr(record, "tags", {})) kwargs.update(handler_kwargs) sample_rate = extra.pop("sample_rate", None) return self.client.capture( event_type, stack=stack, data=data, extra=extra, date=date, sample_rate=sample_rate, **kwargs, )
aliceVision
CameraRigCalibration
__version__ = "1.0" import os from meshroom.core import desc class CameraRigCalibration(desc.AVCommandLineNode): commandLine = "aliceVision_rigCalibration {allParams}" category = "Utils" documentation = """ """ inputs = [ desc.File( name="sfmdata", label="SfMData", description="Input SfMData file.", value="", uid=[0], ), desc.File( name="mediapath", label="Media Path", description="The path to the video file, the folder of the image sequence or a text file\n" "(one image path per line) for each camera of the rig (eg. --mediapath /path/to/cam1.mov /path/to/cam2.mov).", value="", uid=[0], ), desc.File( name="cameraIntrinsics", label="Camera Intrinsics", description="The intrinsics calibration file for each camera of the rig (eg. --cameraIntrinsics /path/to/calib1.txt /path/to/calib2.txt).", value="", uid=[0], ), desc.File( name="export", label="Export File", description="Filename for the alembic file containing the rig poses with the 3D points. It also saves a file for each camera named 'filename.cam##.abc'.", value="trackedcameras.abc", uid=[0], ), desc.File( name="descriptorPath", label="Descriptor Path", description="Folder containing the .desc.", value="", uid=[0], ), desc.ChoiceParam( name="matchDescTypes", label="Match Describer Types", description="The describer types to use for the matching.", value=["dspsift"], values=[ "sift", "sift_float", "sift_upright", "dspsift", "akaze", "akaze_liop", "akaze_mldb", "cctag3", "cctag4", "sift_ocv", "akaze_ocv", ], exclusive=False, uid=[0], joinChar=",", ), desc.ChoiceParam( name="preset", label="Preset", description="Preset for the feature extractor when localizing a new image (low, medium, normal, high, ultra).", value="normal", values=["low", "medium", "normal", "high", "ultra"], exclusive=True, uid=[0], ), desc.ChoiceParam( name="resectionEstimator", label="Resection Estimator", description="The type of *sac framework to use for resection (acransac, loransac).", value="acransac", values=["acransac", "loransac"], exclusive=True, uid=[0], ), desc.ChoiceParam( name="matchingEstimator", label="Matching Estimator", description="The type of *sac framework to use for matching (acransac, loransac).", value="acransac", values=["acransac", "loransac"], exclusive=True, uid=[0], ), desc.StringParam( name="refineIntrinsics", label="Refine Intrinsics", description="Enable/Disable camera intrinsics refinement for each localized image.", value="", uid=[0], ), desc.FloatParam( name="reprojectionError", label="Reprojection Error", description="Maximum reprojection error (in pixels) allowed for resectioning.\n" "If set to 0, it lets the ACRansac select an optimal value.", value=4.0, range=(0.0, 10.0, 0.1), uid=[0], ), desc.IntParam( name="maxInputFrames", label="Max Input Frames", description="Maximum number of frames to read in input. 0 means no limit.", value=0, range=(0, 1000, 1), uid=[0], ), desc.File( name="voctree", label="Voctree", description="[voctree] Filename for the vocabulary tree.", value="${ALICEVISION_VOCTREE}", uid=[0], ), desc.File( name="voctreeWeights", label="Voctree Weights", description="[voctree] Filename for the vocabulary tree weights.", value="", uid=[0], ), desc.ChoiceParam( name="algorithm", label="Algorithm", description="[voctree] Algorithm type: {FirstBest, AllResults}.", value="AllResults", values=["FirstBest", "AllResults"], exclusive=True, uid=[0], ), desc.IntParam( name="nbImageMatch", label="Nb Image Match", description="[voctree] Number of images to retrieve in the database.", value=4, range=(0, 50, 1), uid=[0], ), desc.IntParam( name="maxResults", label="Max Results", description="[voctree] For algorithm AllResults, it stops the image matching when this number of matched images is reached. If set to 0, it is ignored.", value=10, range=(0, 100, 1), uid=[0], ), desc.FloatParam( name="matchingError", label="Matching Error", description="[voctree] Maximum matching error (in pixels) allowed for image matching with geometric verification.\n" "If set to 0, it lets the ACRansac select an optimal value.", value=4.0, range=(0.0, 10.0, 0.1), uid=[0], ), desc.IntParam( name="nNearestKeyFrames", label="N Nearest Key Frames", description="[cctag] Number of images to retrieve in database.", value=5, range=(0, 50, 1), uid=[0], ), desc.ChoiceParam( name="verboseLevel", label="Verbose Level", description="Verbosity level (fatal, error, warning, info, debug, trace).", value="info", values=["fatal", "error", "warning", "info", "debug", "trace"], exclusive=True, uid=[], ), ] outputs = [ desc.File( name="outfile", label="Output File", description="The name of the file to store the calibration data in.", value=desc.Node.internalFolder + "cameraRigCalibration.rigCal", uid=[], ), ]
core
compare_test
__copyright__ = "Copyright (C) 2014-2016 Martin Blais" __license__ = "GNU GPLv2" import unittest from beancount import loader from beancount.core import compare, data TEST_INPUT = """ 2012-02-01 open Assets:US:Cash 2012-02-01 open Assets:US:Credit-Card 2012-02-01 open Expenses:Grocery 2012-02-01 open Expenses:Coffee 2012-02-01 open Expenses:Restaurant 2012-05-18 * "Buying food" #dinner Expenses:Restaurant 100 USD Expenses:Grocery 200 USD Assets:US:Cash 2013-06-20 * "Whole Foods Market" "Buying books" #books #dinner ^ee89ada94a39 Expenses:Restaurant 150 USD Assets:US:Credit-Card 2013-06-22 * "La Colombe" "Buying coffee" ^ee89ada94a39 Expenses:Coffee 5 USD Assets:US:Cash 2014-02-01 close Assets:US:Cash 2014-02-01 close Assets:US:Credit-Card """ class TestCompare(unittest.TestCase): def test_hash_entries(self): previous_hashes = None for _ in range(64): entries, errors, options_map = loader.load_string(TEST_INPUT) hashes, errors = compare.hash_entries(entries) self.assertFalse(errors) if previous_hashes is None: previous_hashes = hashes else: self.assertEqual(previous_hashes.keys(), hashes.keys()) def test_hash_entries_with_duplicates(self): entries, _, __ = loader.load_string( """ 2014-08-01 price HOOL 603.10 USD """ ) hashes, errors = compare.hash_entries(entries) self.assertEqual(1, len(hashes)) entries, _, __ = loader.load_string( """ 2014-08-01 price HOOL 603.10 USD 2014-08-01 price HOOL 603.10 USD 2014-08-01 price HOOL 603.10 USD 2014-08-01 price HOOL 603.10 USD 2014-08-01 price HOOL 603.10 USD """ ) hashes, errors = compare.hash_entries(entries) self.assertEqual(1, len(hashes)) def test_hash_entries_same_postings(self): entries1, _, __ = loader.load_string( """ 2020-01-01 * "BarAlice" "Beer with my guy friends ASDF" Assets:Cash -10.00 USD Expenses:Food:Drinks 2.00 USD shared: "Assets:Debtors:Bob 4.00 USD" shared901: "Assets:Debtors:Bob 4.00 USD" Assets:Debtors:Bob 4.00 USD shared: "Expenses:Food:Drinks 4.00 USD" Assets:Debtors:Bob 4.00 USD shared: "Expenses:Food:Drinks 4.00 USD" """ ) entries2, _, __ = loader.load_string( """ 2020-01-01 * "BarAlice" "Beer with my guy friends ASDF" Assets:Cash -10.00 USD Expenses:Food:Drinks 2.00 USD shared: "Assets:Debtors:Bob 4.00 USD" shared901: "Assets:Debtors:Bob 4.00 USD" Assets:Debtors:Bob 4.00 USD shared: "Expenses:Food:Drinks 4.00 USD" """ ) hashes1, _ = compare.hash_entries(entries1) hashes2, _ = compare.hash_entries(entries2) self.assertNotEqual(set(hashes1), set(hashes2.keys())) def test_compare_entries(self): entries1, _, __ = loader.load_string(TEST_INPUT) entries2, _, __ = loader.load_string(TEST_INPUT) # Check two equal sets. same, missing1, missing2 = compare.compare_entries(entries1, entries2) self.assertTrue(same) self.assertFalse(missing1) self.assertFalse(missing2) # First > Second. same, missing1, missing2 = compare.compare_entries(entries1, entries2[:-1]) self.assertFalse(same) self.assertTrue(missing1) self.assertFalse(missing2) self.assertEqual(1, len(missing1)) self.assertTrue(isinstance(missing1.pop(), data.Close)) # First < Second. same, missing1, missing2 = compare.compare_entries(entries1[:-1], entries2) self.assertFalse(same) self.assertFalse(missing1) self.assertTrue(missing2) self.assertEqual(1, len(missing2)) self.assertTrue(isinstance(missing2.pop(), data.Close)) # Both have missing. same, missing1, missing2 = compare.compare_entries(entries1[1:], entries2[:-1]) self.assertFalse(same) self.assertTrue(missing1) self.assertTrue(missing2) self.assertEqual(1, len(missing1)) self.assertTrue(isinstance(missing1.pop(), data.Close)) self.assertEqual(1, len(missing2)) self.assertTrue(isinstance(missing2.pop(), data.Open)) def test_includes_entries(self): entries1, _, __ = loader.load_string(TEST_INPUT) entries2, _, __ = loader.load_string(TEST_INPUT) includes, missing = compare.includes_entries(entries1[0:-3], entries2) self.assertTrue(includes) self.assertFalse(missing) includes, missing = compare.includes_entries(entries1, entries2[0:-3]) self.assertFalse(includes) self.assertEqual(3, len(missing)) def test_excludes_entries(self): entries1, _, __ = loader.load_string(TEST_INPUT) entries2, _, __ = loader.load_string(TEST_INPUT) excludes, extra = compare.excludes_entries(entries1[0:4], entries2) self.assertFalse(excludes) self.assertTrue(extra) excludes, extra = compare.excludes_entries(entries1[0:4], entries2[4:]) self.assertTrue(excludes) self.assertFalse(extra) def test_hash_with_exclude_meta(self): entries, _, __ = loader.load_string( """ 2013-06-22 * "La Colombe" "Buying coffee" ^ee89ada94a39 Expenses:Coffee 5 USD Assets:US:Cash 2013-06-22 * "La Colombe" "Buying coffee" ^ee89ada94a39 Expenses:Coffee 5 USD Assets:US:Cash """ ) self.assertNotEqual( compare.hash_entry(entries[0], exclude_meta=False), compare.hash_entry(entries[1], exclude_meta=False), ) self.assertEqual( compare.hash_entry(entries[0], exclude_meta=True), compare.hash_entry(entries[1], exclude_meta=True), ) if __name__ == "__main__": unittest.main()
migrations
0006_auto_20210321_1625
# Generated by Django 3.0.7 on 2021-03-21 16:25 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("photos", "0005_auto_20210206_1032"), ] operations = [ migrations.RemoveField( model_name="photofile", name="preferred", ), migrations.AddField( model_name="photo", name="preferred_photo_file", field=models.ForeignKey( null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="+", to="photos.PhotoFile", ), ), migrations.AddField( model_name="photo", name="thumbnailed_version", field=models.PositiveIntegerField(default=0), ), migrations.AddField( model_name="photofile", name="thumbnailed_version", field=models.PositiveIntegerField(default=0), ), migrations.AlterField( model_name="phototag", name="model_version", field=models.PositiveIntegerField(default=0), ), ]
aliceVision
TracksBuilding
__version__ = "1.0" from meshroom.core import desc class TracksBuilding(desc.AVCommandLineNode): commandLine = "aliceVision_tracksBuilding {allParams}" size = desc.DynamicNodeSize("input") category = "Sparse Reconstruction" documentation = """ It fuses all feature matches between image pairs into tracks. Each track represents a candidate point in space, visible from multiple cameras. """ inputs = [ desc.File( name="input", label="SfMData", description="Input SfMData file.", value="", uid=[0], ), desc.ListAttribute( elementDesc=desc.File( name="featuresFolder", label="Features Folder", description="Folder containing some extracted features and descriptors.", value="", uid=[0], ), name="featuresFolders", label="Features Folders", description="Folder(s) containing the extracted features and descriptors.", ), desc.ListAttribute( elementDesc=desc.File( name="matchesFolder", label="Matches Folder", description="Folder containing some matches.", value="", uid=[0], ), name="matchesFolders", label="Matches Folders", description="Folder(s) in which computed matches are stored.", ), desc.ChoiceParam( name="describerTypes", label="Describer Types", description="Describer types used to describe an image.", value=["dspsift"], values=[ "sift", "sift_float", "sift_upright", "dspsift", "akaze", "akaze_liop", "akaze_mldb", "cctag3", "cctag4", "sift_ocv", "akaze_ocv", "tag16h5", ], exclusive=False, uid=[0], joinChar=",", ), desc.IntParam( name="minInputTrackLength", label="Min Input Track Length", description="Minimum track length.", value=2, range=(2, 10, 1), uid=[0], ), desc.BoolParam( name="useOnlyMatchesFromInputFolder", label="Use Only Matches From Input Folder", description="Use only matches from the input 'matchesFolder' parameter.\n" "Matches folders previously added to the SfMData file will be ignored.", value=False, uid=[], advanced=True, ), desc.BoolParam( name="filterTrackForks", label="Filter Track Forks", description="Enable/Disable the track forks removal. A track contains a fork when incoherent matches\n" "lead to multiple features in the same image for a single track.", value=False, uid=[0], ), desc.ChoiceParam( name="verboseLevel", label="Verbose Level", description="Verbosity level (fatal, error, warning, info, debug, trace).", value="info", values=["fatal", "error", "warning", "info", "debug", "trace"], exclusive=True, uid=[], ), ] outputs = [ desc.File( name="output", label="Tracks", description="Path to the output tracks file.", value=desc.Node.internalFolder + "tracksFile.json", uid=[], ), ]
PyObjCTest
test_nsaffinetransform
# # Tests for the struct-wrapper for NSAffineTransformStruct # import operator from Foundation import * from PyObjCTools.TestSupport import * class TestNSAffineTransformStruct(TestCase): def testConstructor(self): p = NSAffineTransformStruct() self.assert_(isinstance(p, NSAffineTransformStruct)) self.assertEqual(p.m11, 0) self.assertEqual(p.m12, 0) self.assertEqual(p.m21, 0) self.assertEqual(p.m22, 0) self.assertEqual(p.tX, 0) self.assertEqual(p.tY, 0) p = NSAffineTransformStruct(1, 2, 3, 4, 5, 6) self.assert_(isinstance(p, NSAffineTransformStruct)) self.assertEqual(p.m11, 1) self.assertEqual(p.m12, 2) self.assertEqual(p.m21, 3) self.assertEqual(p.m22, 4) self.assertEqual(p.tX, 5) self.assertEqual(p.tY, 6) self.assertEqual(p[0], 1) self.assertEqual(p[1], 2) self.assertEqual(p[2], 3) self.assertEqual(p[3], 4) self.assertEqual(p[4], 5) self.assertEqual(p[5], 6) p = NSAffineTransformStruct(tY=1, tX=2, m22=3, m21=4, m12=5, m11=6) self.assert_(isinstance(p, NSAffineTransformStruct)) self.assertEqual(p.m11, 6) self.assertEqual(p.m12, 5) self.assertEqual(p.m21, 4) self.assertEqual(p.m22, 3) self.assertEqual(p.tX, 2) self.assertEqual(p.tY, 1) self.assertEqual(p[0], 6) self.assertEqual(p[1], 5) self.assertEqual(p[2], 4) self.assertEqual(p[3], 3) self.assertEqual(p[4], 2) self.assertEqual(p[5], 1) self.assertRaises(TypeError, NSAffineTransformStruct, 1, 2, 3, 4, 5, 6, 7, 8) self.assertRaises(TypeError, NSAffineTransformStruct, 1, 2, 3, 4, 5, 6, tY=3) self.assertRaises(TypeError, NSAffineTransformStruct, 1, 2, 3, 4, 5, m11=3) self.assertRaises(TypeError, NSAffineTransformStruct, m11=3, mXY=4) def testHash(self): p = NSAffineTransformStruct() self.assertRaises(TypeError, hash, p) def testCompare(self): p = NSAffineTransformStruct(1, 2, 3, 4, 5, 6) q = NSAffineTransformStruct(1, 2, 3, 4, 5, 7) P = (1, 2, 3, 4, 5, 6) Q = (1, 2, 3, 4, 5, 7) self.assert_(not (p == P[:4])) self.assert_((p != P[:4])) self.assert_(not (p <= P[:4])) self.assert_(not (p < P[:4])) self.assert_((p > P[:4])) self.assert_((p >= P[:4])) self.assert_(not (p < p)) self.assert_(not (p < P)) self.assert_(p < q) self.assert_(p < Q) self.assert_(p <= p) self.assert_(p <= P) self.assert_(p <= q) self.assert_(p <= Q) self.assert_(p == p) self.assert_(p == P) self.assert_(not (p == q)) self.assert_(not (p == Q)) self.assert_(p != q) self.assert_(p != Q) self.assert_(not (p != p)) self.assert_(not (p != P)) self.assert_(q >= p) self.assert_(q >= P) self.assert_(q >= q) self.assert_(q >= Q) self.assert_(not (q > q)) self.assert_(not (q > Q)) self.assert_(q > p) self.assert_(q > P) def testRepr(self): p = NSAffineTransformStruct() self.assertEqual( repr(p), "<NSAffineTransformStruct m11=0.0 m12=0.0 m21=0.0 m22=0.0 tX=0.0 tY=0.0>", ) p = NSAffineTransformStruct(1, 2, 3, 4, 5, 6) self.assertEqual( repr(p), "<NSAffineTransformStruct m11=1 m12=2 m21=3 m22=4 tX=5 tY=6>" ) p.tX = p self.assertEqual( repr(p), "<NSAffineTransformStruct m11=1 m12=2 m21=3 m22=4 tX=<NSAffineTransformStruct ...> tY=6>", ) def testStr(self): p = NSAffineTransformStruct() self.assertEqual( str(p), "<NSAffineTransformStruct m11=0.0 m12=0.0 m21=0.0 m22=0.0 tX=0.0 tY=0.0>", ) p = NSAffineTransformStruct(1, 2, 3, 4, 5, 6) self.assertEqual( str(p), "<NSAffineTransformStruct m11=1 m12=2 m21=3 m22=4 tX=5 tY=6>" ) p.tX = p self.assertEqual( str(p), "<NSAffineTransformStruct m11=1 m12=2 m21=3 m22=4 tX=<NSAffineTransformStruct ...> tY=6>", ) def testSlice(self): p = NSAffineTransformStruct(1, 2, 3, 4, 5, 6) q = p[:] self.assert_(isinstance(q, tuple)) self.assertEqual(q, (1.0, 2.0, 3.0, 4.0, 5.0, 6.0)) def testDeleteSlice(self): p = NSAffineTransformStruct(1, 2) def delslice(o, b, e): del o[b:e] self.assertRaises(TypeError, operator.delitem, p, 0) self.assertRaises(TypeError, delslice, p, 0, 3) def testAssignSlice(self): p = NSAffineTransformStruct(1, 2, 3, 4, 5, 6) p[:] = (4, 5, 6, 7, 8, 9) self.assert_(isinstance(p, NSAffineTransformStruct)) self.assertEqual(p.m11, 4) self.assertEqual(p.m12, 5) self.assertEqual(p.m21, 6) self.assertEqual(p.m22, 7) self.assertEqual(p.tX, 8) self.assertEqual(p.tY, 9) p[:] = p self.assert_(isinstance(p, NSAffineTransformStruct)) self.assertEqual(p.m11, 4) self.assertEqual(p.m12, 5) self.assertEqual(p.m21, 6) self.assertEqual(p.m22, 7) self.assertEqual(p.tX, 8) self.assertEqual(p.tY, 9) p[1:4] = range(3) self.assertEqual(p.m11, 4) self.assertEqual(p.m12, 0) self.assertEqual(p.m21, 1) self.assertEqual(p.m22, 2) self.assertEqual(p.tX, 8) self.assertEqual(p.tY, 9) def setslice(o, b, e, v): o[b:e] = v def delslice(o, b, e): del o[b:e] self.assertRaises(TypeError, setslice, p, 0, 2, [1, 2, 3]) self.assertRaises(TypeError, setslice, p, 0, 2, [3]) self.assertRaises(TypeError, delslice, p, 0, 0) self.assertRaises(TypeError, delslice, p, 0, 1) self.assertRaises(TypeError, delslice, p, 0, 2) class TestAffineTransform(TestCase): def testStructReturn(self): transform = NSAffineTransform.transform() s = transform.transformStruct() self.assertIsInstance(s, NSAffineTransformStruct) s = NSAffineTransformStruct(0, 1, 2, 3, 4, 5) transform.setTransformStruct_(s) t = transform.transformStruct() self.assertIsInstance(t, NSAffineTransformStruct) self.assertEqual(s, t) v = transform.transformPoint_((1, 1)) self.assertIsInstance(v, NSPoint) v = transform.transformSize_((1, 1)) self.assertIsInstance(v, NSSize) if __name__ == "__main__": main()
downloaders
UploadgigCom
# -*- coding: utf-8 -*- import json import re from pyload.core.utils.misc import eval_js from ..anticaptchas.ReCaptcha import ReCaptcha from ..base.simple_downloader import SimpleDownloader class UploadgigCom(SimpleDownloader): __name__ = "UploadgigCom" __type__ = "downloader" __version__ = "0.10" __status__ = "testing" __pattern__ = r"https?://(?:www\.)?uploadgig.com/file/download/\w+" __config__ = [ ("enabled", "bool", "Activated", True), ("use_premium", "bool", "Use premium account if available", True), ("fallback", "bool", "Fallback to free download if premium fails", True), ("chk_filesize", "bool", "Check file size", True), ("max_wait", "int", "Reconnect if waiting time is greater than minutes", 10), ] __description__ = """Uploadgig.com downloader plugin""" __license__ = "GPLv3" __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] URL_REPLACEMENTS = [("http://", "https://")] NAME_PATTERN = r'<span class="filename">(?P<N>.+?)<' SIZE_PATTERN = r'<span class="filesize">\[(?P<S>[\d.,]+) (?P<U>[\w^_]+)\]<' OFFLINE_PATTERN = r"File not found" def handle_free(self, pyfile): m = re.search( r"<script>window\[String\.fromCharCode\(window\['m'\+'ax_upload_limi'\+'t'\]\)\] = (.+?);</script>", self.data, ) if m is None: self.error(self._("f pattern not found")) f = eval_js(m.group(1)) url, inputs = self.parse_html_form('id="dl_captcha_form"') if inputs is None: self.error(self._("Free download form not found")) recaptcha = ReCaptcha(pyfile) captcha_key = recaptcha.detect_key() if captcha_key is None: self.error(self._("ReCaptcha key not found")) self.captcha = recaptcha response = recaptcha.challenge(captcha_key) inputs["g-recaptcha-response"] = response self.data = self.load(self.fixurl(url), post=inputs) if self.data == "m": self.log_warning(self._("Max downloads for this hour reached")) self.retry(wait=60 * 60) elif self.data in ("fl", "rfd"): self.fail(self._("File can be downloaded by premium users only")) elif self.data == "e": self.retry() elif self.data == "0": self.retry_captcha() else: try: res = json.loads(self.data) except ValueError: self.fail(self._("Illegal response from the server")) if any([_x not in res for _x in ("cd", "sp", "q", "id")]): self.fail(self._("Illegal response from the server")) self.wait(res["cd"]) self.link = res["sp"] + "id=" + str(res["id"] - int(f)) + "&" + res["q"]
util
RateLimit
import logging import time import gevent log = logging.getLogger("RateLimit") called_db = {} # Holds events last call time queue_db = {} # Commands queued to run # Register event as called # Return: None def called(event, penalty=0): called_db[event] = time.time() + penalty # Check if calling event is allowed # Return: True if allowed False if not def isAllowed(event, allowed_again=10): last_called = called_db.get(event) if not last_called: # Its not called before return True elif time.time() - last_called >= allowed_again: del called_db[event] # Delete last call time to save memory return True else: return False def delayLeft(event, allowed_again=10): last_called = called_db.get(event) if not last_called: # Its not called before return 0 else: return allowed_again - (time.time() - last_called) def callQueue(event): func, args, kwargs, thread = queue_db[event] log.debug("Calling: %s" % event) called(event) del queue_db[event] return func(*args, **kwargs) # Rate limit and delay function call if necessary # If the function called again within the rate limit interval then previous queued call will be dropped # Return: Immediately gevent thread def callAsync(event, allowed_again=10, func=None, *args, **kwargs): if isAllowed(event, allowed_again): # Not called recently, call it now called(event) # print "Calling now" return gevent.spawn(func, *args, **kwargs) else: # Called recently, schedule it for later time_left = allowed_again - max(0, time.time() - called_db[event]) log.debug("Added to queue (%.2fs left): %s " % (time_left, event)) if not queue_db.get(event): # Function call not queued yet thread = gevent.spawn_later( time_left, lambda: callQueue(event) ) # Call this function later queue_db[event] = (func, args, kwargs, thread) return thread else: # Function call already queued, just update the parameters thread = queue_db[event][3] queue_db[event] = (func, args, kwargs, thread) return thread # Rate limit and delay function call if needed # Return: Wait for execution/delay then return value def call(event, allowed_again=10, func=None, *args, **kwargs): if isAllowed(event): # Not called recently, call it now called(event) # print "Calling now", allowed_again return func(*args, **kwargs) else: # Called recently, schedule it for later time_left = max(0, allowed_again - (time.time() - called_db[event])) # print "Time left: %s" % time_left, args, kwargs log.debug("Calling sync (%.2fs left): %s" % (time_left, event)) called(event, time_left) time.sleep(time_left) back = func(*args, **kwargs) called(event) return back # Cleanup expired events every 3 minutes def rateLimitCleanup(): while 1: expired = time.time() - 60 * 2 # Cleanup if older than 2 minutes for event in list(called_db.keys()): if called_db[event] < expired: del called_db[event] time.sleep(60 * 3) # Every 3 minutes gevent.spawn(rateLimitCleanup) if __name__ == "__main__": from gevent import monkey monkey.patch_all() import random def publish(inner_path): print("Publishing %s..." % inner_path) return 1 def cb(thread): print("Value:", thread.value) print("Testing async spam requests rate limit to 1/sec...") for i in range(3000): thread = callAsync("publish content.json", 1, publish, "content.json %s" % i) time.sleep(float(random.randint(1, 20)) / 100000) print(thread.link(cb)) print("Done") time.sleep(2) print("Testing sync spam requests rate limit to 1/sec...") for i in range(5): call("publish data.json", 1, publish, "data.json %s" % i) time.sleep(float(random.randint(1, 100)) / 100) print("Done") print("Testing cleanup") thread = callAsync("publish content.json single", 1, publish, "content.json single") print("Needs to cleanup:", called_db, queue_db) print("Waiting 3min for cleanup process...") time.sleep(60 * 3) print("Cleaned up:", called_db, queue_db)
find-file-extensions
contents
from __future__ import absolute_import from gi.repository import Gtk from sunflower.plugin_base.find_extension import FindExtension from sunflower.plugin_base.provider import FileType, Mode class ContentsFindFiles(FindExtension): """Extension for finding specified contents in files""" def __init__(self, parent): FindExtension.__init__(self, parent) # create container vbox = Gtk.VBox(False, 0) viewport = Gtk.ScrolledWindow() viewport.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) viewport.set_shadow_type(Gtk.ShadowType.IN) # create entry widget label_content = Gtk.Label(label=_("Search for:")) label_content.set_alignment(0, 0.5) self._buffer = Gtk.TextBuffer() self._text_view = Gtk.TextView(buffer=self._buffer) # pack interface viewport.add(self._text_view) vbox.pack_start(label_content, False, False, 0) vbox.pack_start(viewport, True, True, 0) self.container.pack_start(vbox, True, True, 0) def get_title(self): """Return i18n title for extension""" return _("Content") def is_path_ok(self, provider, path): """Check if specified path fits the criteria""" result = False file_type = provider.get_stat(path).type if file_type is FileType.REGULAR: # get buffer text = self._buffer.get_text( *self._buffer.get_bounds(), include_hidden_chars=True ) # try finding content in file try: with provider.get_file_handle( path, Mode.READ ) as raw_file: # make sure file is closed afterwards result = text.encode() in raw_file.read() except IOError: pass return result
blocks
qa_copy
#!/usr/bin/env python # # Copyright 2009,2010,2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # from gnuradio import blocks, gr, gr_unittest class test_copy(gr_unittest.TestCase): def setUp(self): self.tb = gr.top_block() def tearDown(self): self.tb = None def test_copy(self): src_data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] expected_result = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] src = blocks.vector_source_b(src_data) op = blocks.copy(gr.sizeof_char) dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() dst_data = dst.data() self.assertEqual(expected_result, dst_data) def test_copy_drop(self): src_data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] expected_result = [] src = blocks.vector_source_b(src_data) op = blocks.copy(gr.sizeof_char) op.set_enabled(False) dst = blocks.vector_sink_b() self.tb.connect(src, op, dst) self.tb.run() dst_data = dst.data() self.assertEqual(expected_result, dst_data) if __name__ == "__main__": gr_unittest.run(test_copy)
fingerprint
util
# Copyright 2011,2013,2014 Christoph Reiter # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. import threading import time from quodlibet import config def get_api_key(): """The user API key for submissions""" return config.get("plugins", "fingerprint_acoustid_api_key", "") def get_write_mb_tags(): return config.getboolean("plugins", "fingerprint_write_mb_tags", False) def get_group_by_dir(): return config.getboolean("plugins", "fingerprint_group_by_dir", True) class GateKeeper: def __init__(self, requests_per_sec): self._period = 1 / float(requests_per_sec) self._last = 0 self._lock = threading.Lock() def wait(self): """Block until a new request can be made.""" while 1: with self._lock: current = time.time() if abs(current - self._last) >= self._period: self._last = current break time.sleep(self._period / 10)
engines
flickr
# SPDX-License-Identifier: AGPL-3.0-or-later """ Flickr (Images) More info on api-key : https://www.flickr.com/services/apps/create/ """ from json import loads from urllib.parse import urlencode # about about = { "website": "https://www.flickr.com", "wikidata_id": "Q103204", "official_api_documentation": "https://secure.flickr.com/services/api/flickr.photos.search.html", "use_official_api": True, "require_api_key": True, "results": "JSON", } categories = ["images"] nb_per_page = 15 paging = True api_key = None url = ( "https://api.flickr.com/services/rest/?method=flickr.photos.search" + "&api_key={api_key}&{text}&sort=relevance" + "&extras=description%2C+owner_name%2C+url_o%2C+url_n%2C+url_z" + "&per_page={nb_per_page}&format=json&nojsoncallback=1&page={page}" ) photo_url = "https://www.flickr.com/photos/{userid}/{photoid}" paging = True def build_flickr_url(user_id, photo_id): return photo_url.format(userid=user_id, photoid=photo_id) def request(query, params): params["url"] = url.format( text=urlencode({"text": query}), api_key=api_key, nb_per_page=nb_per_page, page=params["pageno"], ) return params def response(resp): results = [] search_results = loads(resp.text) # return empty array if there are no results if "photos" not in search_results: return [] if "photo" not in search_results["photos"]: return [] photos = search_results["photos"]["photo"] # parse results for photo in photos: if "url_o" in photo: img_src = photo["url_o"] elif "url_z" in photo: img_src = photo["url_z"] else: continue # For a bigger thumbnail, keep only the url_z, not the url_n if "url_n" in photo: thumbnail_src = photo["url_n"] elif "url_z" in photo: thumbnail_src = photo["url_z"] else: thumbnail_src = img_src url = build_flickr_url(photo["owner"], photo["id"]) # append result results.append( { "url": url, "title": photo["title"], "img_src": img_src, "thumbnail_src": thumbnail_src, "content": photo["description"]["_content"], "author": photo["ownername"], "template": "images.html", } ) # return results return results
mackup
main
"""Mackup. Keep your application settings in sync. Copyright (C) 2013-2021 Laurent Raufaste <http://glop.org/> Usage: mackup list mackup [options] backup mackup [options] restore mackup show <application> mackup [options] uninstall mackup (-h | --help) mackup --version Options: -h --help Show this screen. -f --force Force every question asked to be answered with "Yes". -r --root Allow mackup to be run as superuser. -n --dry-run Show steps without executing. -v --verbose Show additional details. --version Show version. Modes of action: 1. list: display a list of all supported applications. 2. backup: sync your conf files to your synced storage, use this the 1st time you use Mackup. 3. restore: link the conf files already in your synced storage on your system, use it on any new system you use. 4. uninstall: reset everything as it was before using Mackup. By default, Mackup syncs all application data via Dropbox, but may be configured to exclude applications or use a different backend with a .mackup.cfg file. See https://github.com/lra/mackup/tree/master/doc for more information. """ import sys from docopt import docopt from . import utils from .application import ApplicationProfile from .appsdb import ApplicationsDatabase from .constants import MACKUP_APP_NAME, VERSION from .mackup import Mackup class ColorFormatCodes: BLUE = "\033[34m" BOLD = "\033[1m" NORMAL = "\033[0m" def header(str): return ColorFormatCodes.BLUE + str + ColorFormatCodes.NORMAL def bold(str): return ColorFormatCodes.BOLD + str + ColorFormatCodes.NORMAL def main(): """Main function.""" # Get the command line arg args = docopt(__doc__, version="Mackup {}".format(VERSION)) mckp = Mackup() app_db = ApplicationsDatabase() def printAppHeader(app_name): if verbose: print(("\n{0} {1} {0}").format(header("---"), bold(app_name))) # If we want to answer mackup with "yes" for each question if args["--force"]: utils.FORCE_YES = True # Allow mackup to be run as root if args["--root"]: utils.CAN_RUN_AS_ROOT = True dry_run = args["--dry-run"] verbose = args["--verbose"] if args["backup"]: # Check the env where the command is being run mckp.check_for_usable_backup_env() # Backup each application for app_name in sorted(mckp.get_apps_to_backup()): app = ApplicationProfile(mckp, app_db.get_files(app_name), dry_run, verbose) printAppHeader(app_name) app.backup() elif args["restore"]: # Check the env where the command is being run mckp.check_for_usable_restore_env() # Restore the Mackup config before any other config, as we might need # it to know about custom settings mackup_app = ApplicationProfile( mckp, app_db.get_files(MACKUP_APP_NAME), dry_run, verbose ) printAppHeader(MACKUP_APP_NAME) mackup_app.restore() # Initialize again the apps db, as the Mackup config might have changed # it mckp = Mackup() app_db = ApplicationsDatabase() # Restore the rest of the app configs, using the restored Mackup config app_names = mckp.get_apps_to_backup() # Mackup has already been done app_names.discard(MACKUP_APP_NAME) for app_name in sorted(app_names): app = ApplicationProfile(mckp, app_db.get_files(app_name), dry_run, verbose) printAppHeader(app_name) app.restore() elif args["uninstall"]: # Check the env where the command is being run mckp.check_for_usable_restore_env() if dry_run or ( utils.confirm( "You are going to uninstall Mackup.\n" "Every configuration file, setting and dotfile" " managed by Mackup will be unlinked and copied back" " to their original place, in your home folder.\n" "Are you sure?" ) ): # Uninstall the apps except Mackup, which we'll uninstall last, to # keep the settings as long as possible app_names = mckp.get_apps_to_backup() app_names.discard(MACKUP_APP_NAME) for app_name in sorted(app_names): app = ApplicationProfile( mckp, app_db.get_files(app_name), dry_run, verbose ) printAppHeader(app_name) app.uninstall() # Restore the Mackup config before any other config, as we might # need it to know about custom settings mackup_app = ApplicationProfile( mckp, app_db.get_files(MACKUP_APP_NAME), dry_run, verbose ) mackup_app.uninstall() # Delete the Mackup folder in Dropbox # Don't delete this as there might be other Macs that aren't # uninstalled yet # delete(mckp.mackup_folder) print( "\n" "All your files have been put back into place. You can now" " safely uninstall Mackup.\n" "\n" "Thanks for using Mackup!" ) elif args["list"]: # Display the list of supported applications mckp.check_for_usable_environment() output = "Supported applications:\n" for app_name in sorted(app_db.get_app_names()): output += " - {}\n".format(app_name) output += "\n" output += "{} applications supported in Mackup v{}".format( len(app_db.get_app_names()), VERSION ) print(output) elif args["show"]: mckp.check_for_usable_environment() app_name = args["<application>"] # Make sure the app exists if app_name not in app_db.get_app_names(): sys.exit("Unsupported application: {}".format(app_name)) print("Name: {}".format(app_db.get_name(app_name))) print("Configuration files:") for file in app_db.get_files(app_name): print(" - {}".format(file)) # Delete the tmp folder mckp.clean_temp_folder()
utils
ops
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """A module for helper tensorflow ops.""" import math import numpy as np import six import tensorflow as tf from app.object_detection.core import box_list, box_list_ops from app.object_detection.core import standard_fields as fields from app.object_detection.utils import static_shape def expanded_shape(orig_shape, start_dim, num_dims): """Inserts multiple ones into a shape vector. Inserts an all-1 vector of length num_dims at position start_dim into a shape. Can be combined with tf.reshape to generalize tf.expand_dims. Args: orig_shape: the shape into which the all-1 vector is added (int32 vector) start_dim: insertion position (int scalar) num_dims: length of the inserted all-1 vector (int scalar) Returns: An int32 vector of length tf.size(orig_shape) + num_dims. """ with tf.name_scope("ExpandedShape"): start_dim = tf.expand_dims(start_dim, 0) # scalar to rank-1 before = tf.slice(orig_shape, [0], start_dim) add_shape = tf.ones(tf.reshape(num_dims, [1]), dtype=tf.int32) after = tf.slice(orig_shape, start_dim, [-1]) new_shape = tf.concat([before, add_shape, after], 0) return new_shape def normalized_to_image_coordinates( normalized_boxes, image_shape, parallel_iterations=32 ): """Converts a batch of boxes from normal to image coordinates. Args: normalized_boxes: a float32 tensor of shape [None, num_boxes, 4] in normalized coordinates. image_shape: a float32 tensor of shape [4] containing the image shape. parallel_iterations: parallelism for the map_fn op. Returns: absolute_boxes: a float32 tensor of shape [None, num_boxes, 4] containg the boxes in image coordinates. """ def _to_absolute_coordinates(normalized_boxes): return box_list_ops.to_absolute_coordinates( box_list.BoxList(normalized_boxes), image_shape[1], image_shape[2], check_range=False, ).get() absolute_boxes = tf.map_fn( _to_absolute_coordinates, elems=(normalized_boxes), dtype=tf.float32, parallel_iterations=parallel_iterations, back_prop=True, ) return absolute_boxes def meshgrid(x, y): """Tiles the contents of x and y into a pair of grids. Multidimensional analog of numpy.meshgrid, giving the same behavior if x and y are vectors. Generally, this will give: xgrid(i1, ..., i_m, j_1, ..., j_n) = x(j_1, ..., j_n) ygrid(i1, ..., i_m, j_1, ..., j_n) = y(i_1, ..., i_m) Keep in mind that the order of the arguments and outputs is reverse relative to the order of the indices they go into, done for compatibility with numpy. The output tensors have the same shapes. Specifically: xgrid.get_shape() = y.get_shape().concatenate(x.get_shape()) ygrid.get_shape() = y.get_shape().concatenate(x.get_shape()) Args: x: A tensor of arbitrary shape and rank. xgrid will contain these values varying in its last dimensions. y: A tensor of arbitrary shape and rank. ygrid will contain these values varying in its first dimensions. Returns: A tuple of tensors (xgrid, ygrid). """ with tf.name_scope("Meshgrid"): x = tf.convert_to_tensor(x) y = tf.convert_to_tensor(y) x_exp_shape = expanded_shape(tf.shape(x), 0, tf.rank(y)) y_exp_shape = expanded_shape(tf.shape(y), tf.rank(y), tf.rank(x)) xgrid = tf.tile(tf.reshape(x, x_exp_shape), y_exp_shape) ygrid = tf.tile(tf.reshape(y, y_exp_shape), x_exp_shape) new_shape = y.get_shape().concatenate(x.get_shape()) xgrid.set_shape(new_shape) ygrid.set_shape(new_shape) return xgrid, ygrid def pad_to_multiple(tensor, multiple): """Returns the tensor zero padded to the specified multiple. Appends 0s to the end of the first and second dimension (height and width) of the tensor until both dimensions are a multiple of the input argument 'multiple'. E.g. given an input tensor of shape [1, 3, 5, 1] and an input multiple of 4, PadToMultiple will append 0s so that the resulting tensor will be of shape [1, 4, 8, 1]. Args: tensor: rank 4 float32 tensor, where tensor -> [batch_size, height, width, channels]. multiple: the multiple to pad to. Returns: padded_tensor: the tensor zero padded to the specified multiple. """ tensor_shape = tensor.get_shape() batch_size = static_shape.get_batch_size(tensor_shape) tensor_height = static_shape.get_height(tensor_shape) tensor_width = static_shape.get_width(tensor_shape) tensor_depth = static_shape.get_depth(tensor_shape) if batch_size is None: batch_size = tf.shape(tensor)[0] if tensor_height is None: tensor_height = tf.shape(tensor)[1] padded_tensor_height = ( tf.to_int32(tf.ceil(tf.to_float(tensor_height) / tf.to_float(multiple))) * multiple ) else: padded_tensor_height = int( math.ceil(float(tensor_height) / multiple) * multiple ) if tensor_width is None: tensor_width = tf.shape(tensor)[2] padded_tensor_width = ( tf.to_int32(tf.ceil(tf.to_float(tensor_width) / tf.to_float(multiple))) * multiple ) else: padded_tensor_width = int(math.ceil(float(tensor_width) / multiple) * multiple) if padded_tensor_height == tensor_height and padded_tensor_width == tensor_width: return tensor if tensor_depth is None: tensor_depth = tf.shape(tensor)[3] # Use tf.concat instead of tf.pad to preserve static shape height_pad = tf.zeros( [batch_size, padded_tensor_height - tensor_height, tensor_width, tensor_depth] ) padded_tensor = tf.concat([tensor, height_pad], 1) width_pad = tf.zeros( [ batch_size, padded_tensor_height, padded_tensor_width - tensor_width, tensor_depth, ] ) padded_tensor = tf.concat([padded_tensor, width_pad], 2) return padded_tensor def padded_one_hot_encoding(indices, depth, left_pad): """Returns a zero padded one-hot tensor. This function converts a sparse representation of indices (e.g., [4]) to a zero padded one-hot representation (e.g., [0, 0, 0, 0, 1] with depth = 4 and left_pad = 1). If `indices` is empty, the result will simply be a tensor of shape (0, depth + left_pad). If depth = 0, then this function just returns `None`. Args: indices: an integer tensor of shape [num_indices]. depth: depth for the one-hot tensor (integer). left_pad: number of zeros to left pad the one-hot tensor with (integer). Returns: padded_onehot: a tensor with shape (num_indices, depth + left_pad). Returns `None` if the depth is zero. Raises: ValueError: if `indices` does not have rank 1 or if `left_pad` or `depth are either negative or non-integers. TODO: add runtime checks for depth and indices. """ if depth < 0 or not isinstance(depth, (int, long) if six.PY2 else int): raise ValueError("`depth` must be a non-negative integer.") if left_pad < 0 or not isinstance(left_pad, (int, long) if six.PY2 else int): raise ValueError("`left_pad` must be a non-negative integer.") if depth == 0: return None if len(indices.get_shape().as_list()) != 1: raise ValueError("`indices` must have rank 1") def one_hot_and_pad(): one_hot = tf.cast( tf.one_hot(tf.cast(indices, tf.int64), depth, on_value=1, off_value=0), tf.float32, ) return tf.pad(one_hot, [[0, 0], [left_pad, 0]], mode="CONSTANT") result = tf.cond( tf.greater(tf.size(indices), 0), one_hot_and_pad, lambda: tf.zeros((depth + left_pad, 0)), ) return tf.reshape(result, [-1, depth + left_pad]) def dense_to_sparse_boxes(dense_locations, dense_num_boxes, num_classes): """Converts bounding boxes from dense to sparse form. Args: dense_locations: a [max_num_boxes, 4] tensor in which only the first k rows are valid bounding box location coordinates, where k is the sum of elements in dense_num_boxes. dense_num_boxes: a [max_num_classes] tensor indicating the counts of various bounding box classes e.g. [1, 0, 0, 2] means that the first bounding box is of class 0 and the second and third bounding boxes are of class 3. The sum of elements in this tensor is the number of valid bounding boxes. num_classes: number of classes Returns: box_locations: a [num_boxes, 4] tensor containing only valid bounding boxes (i.e. the first num_boxes rows of dense_locations) box_classes: a [num_boxes] tensor containing the classes of each bounding box (e.g. dense_num_boxes = [1, 0, 0, 2] => box_classes = [0, 3, 3] """ num_valid_boxes = tf.reduce_sum(dense_num_boxes) box_locations = tf.slice( dense_locations, tf.constant([0, 0]), tf.stack([num_valid_boxes, 4]) ) tiled_classes = [ tf.tile([i], tf.expand_dims(dense_num_boxes[i], 0)) for i in range(num_classes) ] box_classes = tf.concat(tiled_classes, 0) box_locations.set_shape([None, 4]) return box_locations, box_classes def indices_to_dense_vector( indices, size, indices_value=1.0, default_value=0, dtype=tf.float32 ): """Creates dense vector with indices set to specific value and rest to zeros. This function exists because it is unclear if it is safe to use tf.sparse_to_dense(indices, [size], 1, validate_indices=False) with indices which are not ordered. This function accepts a dynamic size (e.g. tf.shape(tensor)[0]) Args: indices: 1d Tensor with integer indices which are to be set to indices_values. size: scalar with size (integer) of output Tensor. indices_value: values of elements specified by indices in the output vector default_value: values of other elements in the output vector. dtype: data type. Returns: dense 1D Tensor of shape [size] with indices set to indices_values and the rest set to default_value. """ size = tf.to_int32(size) zeros = tf.ones([size], dtype=dtype) * default_value values = tf.ones_like(indices, dtype=dtype) * indices_value return tf.dynamic_stitch([tf.range(size), tf.to_int32(indices)], [zeros, values]) def retain_groundtruth(tensor_dict, valid_indices): """Retains groundtruth by valid indices. Args: tensor_dict: a dictionary of following groundtruth tensors - fields.InputDataFields.groundtruth_boxes fields.InputDataFields.groundtruth_instance_masks fields.InputDataFields.groundtruth_classes fields.InputDataFields.groundtruth_is_crowd fields.InputDataFields.groundtruth_area fields.InputDataFields.groundtruth_label_types fields.InputDataFields.groundtruth_difficult valid_indices: a tensor with valid indices for the box-level groundtruth. Returns: a dictionary of tensors containing only the groundtruth for valid_indices. Raises: ValueError: If the shape of valid_indices is invalid. ValueError: field fields.InputDataFields.groundtruth_boxes is not present in tensor_dict. """ input_shape = valid_indices.get_shape().as_list() if not (len(input_shape) == 1 or (len(input_shape) == 2 and input_shape[1] == 1)): raise ValueError("The shape of valid_indices is invalid.") valid_indices = tf.reshape(valid_indices, [-1]) valid_dict = {} if fields.InputDataFields.groundtruth_boxes in tensor_dict: # Prevents reshape failure when num_boxes is 0. num_boxes = tf.maximum( tf.shape(tensor_dict[fields.InputDataFields.groundtruth_boxes])[0], 1 ) for key in tensor_dict: if key in [ fields.InputDataFields.groundtruth_boxes, fields.InputDataFields.groundtruth_classes, fields.InputDataFields.groundtruth_instance_masks, ]: valid_dict[key] = tf.gather(tensor_dict[key], valid_indices) # Input decoder returns empty tensor when these fields are not provided. # Needs to reshape into [num_boxes, -1] for tf.gather() to work. elif key in [ fields.InputDataFields.groundtruth_is_crowd, fields.InputDataFields.groundtruth_area, fields.InputDataFields.groundtruth_difficult, fields.InputDataFields.groundtruth_label_types, ]: valid_dict[key] = tf.reshape( tf.gather( tf.reshape(tensor_dict[key], [num_boxes, -1]), valid_indices ), [-1], ) # Fields that are not associated with boxes. else: valid_dict[key] = tensor_dict[key] else: raise ValueError( "%s not present in input tensor dict." % (fields.InputDataFields.groundtruth_boxes) ) return valid_dict def retain_groundtruth_with_positive_classes(tensor_dict): """Retains only groundtruth with positive class ids. Args: tensor_dict: a dictionary of following groundtruth tensors - fields.InputDataFields.groundtruth_boxes fields.InputDataFields.groundtruth_classes fields.InputDataFields.groundtruth_is_crowd fields.InputDataFields.groundtruth_area fields.InputDataFields.groundtruth_label_types fields.InputDataFields.groundtruth_difficult Returns: a dictionary of tensors containing only the groundtruth with positive classes. Raises: ValueError: If groundtruth_classes tensor is not in tensor_dict. """ if fields.InputDataFields.groundtruth_classes not in tensor_dict: raise ValueError("`groundtruth classes` not in tensor_dict.") keep_indices = tf.where( tf.greater(tensor_dict[fields.InputDataFields.groundtruth_classes], 0) ) return retain_groundtruth(tensor_dict, keep_indices) def replace_nan_groundtruth_label_scores_with_ones(label_scores): """Replaces nan label scores with 1.0. Args: label_scores: a tensor containing object annoation label scores. Returns: a tensor where NaN label scores have been replaced by ones. """ return tf.where( tf.is_nan(label_scores), tf.ones(tf.shape(label_scores)), label_scores ) def filter_groundtruth_with_crowd_boxes(tensor_dict): """Filters out groundtruth with boxes corresponding to crowd. Args: tensor_dict: a dictionary of following groundtruth tensors - fields.InputDataFields.groundtruth_boxes fields.InputDataFields.groundtruth_classes fields.InputDataFields.groundtruth_is_crowd fields.InputDataFields.groundtruth_area fields.InputDataFields.groundtruth_label_types Returns: a dictionary of tensors containing only the groundtruth that have bounding boxes. """ if fields.InputDataFields.groundtruth_is_crowd in tensor_dict: is_crowd = tensor_dict[fields.InputDataFields.groundtruth_is_crowd] is_not_crowd = tf.logical_not(is_crowd) is_not_crowd_indices = tf.where(is_not_crowd) tensor_dict = retain_groundtruth(tensor_dict, is_not_crowd_indices) return tensor_dict def filter_groundtruth_with_nan_box_coordinates(tensor_dict): """Filters out groundtruth with no bounding boxes. Args: tensor_dict: a dictionary of following groundtruth tensors - fields.InputDataFields.groundtruth_boxes fields.InputDataFields.groundtruth_instance_masks fields.InputDataFields.groundtruth_classes fields.InputDataFields.groundtruth_is_crowd fields.InputDataFields.groundtruth_area fields.InputDataFields.groundtruth_label_types Returns: a dictionary of tensors containing only the groundtruth that have bounding boxes. """ groundtruth_boxes = tensor_dict[fields.InputDataFields.groundtruth_boxes] nan_indicator_vector = tf.greater( tf.reduce_sum(tf.to_int32(tf.is_nan(groundtruth_boxes)), reduction_indices=[1]), 0, ) valid_indicator_vector = tf.logical_not(nan_indicator_vector) valid_indices = tf.where(valid_indicator_vector) return retain_groundtruth(tensor_dict, valid_indices) def normalize_to_target( inputs, target_norm_value, dim, epsilon=1e-7, trainable=True, scope="NormalizeToTarget", summarize=True, ): """L2 normalizes the inputs across the specified dimension to a target norm. This op implements the L2 Normalization layer introduced in Liu, Wei, et al. "SSD: Single Shot MultiBox Detector." and Liu, Wei, Andrew Rabinovich, and Alexander C. Berg. "Parsenet: Looking wider to see better." and is useful for bringing activations from multiple layers in a convnet to a standard scale. Note that the rank of `inputs` must be known and the dimension to which normalization is to be applied should be statically defined. TODO: Add option to scale by L2 norm of the entire input. Args: inputs: A `Tensor` of arbitrary size. target_norm_value: A float value that specifies an initial target norm or a list of floats (whose length must be equal to the depth along the dimension to be normalized) specifying a per-dimension multiplier after normalization. dim: The dimension along which the input is normalized. epsilon: A small value to add to the inputs to avoid dividing by zero. trainable: Whether the norm is trainable or not scope: Optional scope for variable_scope. summarize: Whether or not to add a tensorflow summary for the op. Returns: The input tensor normalized to the specified target norm. Raises: ValueError: If dim is smaller than the number of dimensions in 'inputs'. ValueError: If target_norm_value is not a float or a list of floats with length equal to the depth along the dimension to be normalized. """ with tf.variable_scope(scope, "NormalizeToTarget", [inputs]): if not inputs.get_shape(): raise ValueError("The input rank must be known.") input_shape = inputs.get_shape().as_list() input_rank = len(input_shape) if dim < 0 or dim >= input_rank: raise ValueError( "dim must be non-negative but smaller than the input rank." ) if not input_shape[dim]: raise ValueError( "input shape should be statically defined along " "the specified dimension." ) depth = input_shape[dim] if not ( isinstance(target_norm_value, float) or (isinstance(target_norm_value, list) and len(target_norm_value) == depth) and all([isinstance(val, float) for val in target_norm_value]) ): raise ValueError( "target_norm_value must be a float or a list of floats " "with length equal to the depth along the dimension to " "be normalized." ) if isinstance(target_norm_value, float): initial_norm = depth * [target_norm_value] else: initial_norm = target_norm_value target_norm = tf.contrib.framework.model_variable( name="weights", dtype=tf.float32, initializer=tf.constant(initial_norm, dtype=tf.float32), trainable=trainable, ) if summarize: mean = tf.reduce_mean(target_norm) mean = tf.Print(mean, ["NormalizeToTarget:", mean]) tf.summary.scalar(tf.get_variable_scope().name, mean) lengths = epsilon + tf.sqrt(tf.reduce_sum(tf.square(inputs), dim, True)) mult_shape = input_rank * [1] mult_shape[dim] = depth return tf.reshape(target_norm, mult_shape) * tf.truediv(inputs, lengths) def position_sensitive_crop_regions( image, boxes, box_ind, crop_size, num_spatial_bins, global_pool, extrapolation_value=None, ): """Position-sensitive crop and pool rectangular regions from a feature grid. The output crops are split into `spatial_bins_y` vertical bins and `spatial_bins_x` horizontal bins. For each intersection of a vertical and a horizontal bin the output values are gathered by performing `tf.image.crop_and_resize` (bilinear resampling) on a a separate subset of channels of the image. This reduces `depth` by a factor of `(spatial_bins_y * spatial_bins_x)`. When global_pool is True, this function implements a differentiable version of position-sensitive RoI pooling used in [R-FCN detection system](https://arxiv.org/abs/1605.06409). When global_pool is False, this function implements a differentiable version of position-sensitive assembling operation used in [instance FCN](https://arxiv.org/abs/1603.08678). Args: image: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. A 4-D tensor of shape `[batch, image_height, image_width, depth]`. Both `image_height` and `image_width` need to be positive. boxes: A `Tensor` of type `float32`. A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor specifies the coordinates of a box in the `box_ind[i]` image and is specified in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the `[0, 1]` interval of normalized image height is mapped to `[0, image_height - 1] in image height coordinates. We do allow y1 > y2, in which case the sampled crop is an up-down flipped version of the original image. The width dimension is treated similarly. Normalized coordinates outside the `[0, 1]` range are allowed, in which case we use `extrapolation_value` to extrapolate the input image values. box_ind: A `Tensor` of type `int32`. A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. The value of `box_ind[i]` specifies the image that the `i`-th box refers to. crop_size: A list of two integers `[crop_height, crop_width]`. All cropped image patches are resized to this size. The aspect ratio of the image content is not preserved. Both `crop_height` and `crop_width` need to be positive. num_spatial_bins: A list of two integers `[spatial_bins_y, spatial_bins_x]`. Represents the number of position-sensitive bins in y and x directions. Both values should be >= 1. `crop_height` should be divisible by `spatial_bins_y`, and similarly for width. The number of image channels should be divisible by (spatial_bins_y * spatial_bins_x). Suggested value from R-FCN paper: [3, 3]. global_pool: A boolean variable. If True, we perform average global pooling on the features assembled from the position-sensitive score maps. If False, we keep the position-pooled features without global pooling over the spatial coordinates. Note that using global_pool=True is equivalent to but more efficient than running the function with global_pool=False and then performing global average pooling. extrapolation_value: An optional `float`. Defaults to `0`. Value used for extrapolation, when applicable. Returns: position_sensitive_features: A 4-D tensor of shape `[num_boxes, K, K, crop_channels]`, where `crop_channels = depth / (spatial_bins_y * spatial_bins_x)`, where K = 1 when global_pool is True (Average-pooled cropped regions), and K = crop_size when global_pool is False. Raises: ValueError: Raised in four situations: `num_spatial_bins` is not >= 1; `num_spatial_bins` does not divide `crop_size`; `(spatial_bins_y*spatial_bins_x)` does not divide `depth`; `bin_crop_size` is not square when global_pool=False due to the constraint in function space_to_depth. """ total_bins = 1 bin_crop_size = [] for num_bins, crop_dim in zip(num_spatial_bins, crop_size): if num_bins < 1: raise ValueError("num_spatial_bins should be >= 1") if crop_dim % num_bins != 0: raise ValueError("crop_size should be divisible by num_spatial_bins") total_bins *= num_bins bin_crop_size.append(crop_dim // num_bins) if not global_pool and bin_crop_size[0] != bin_crop_size[1]: raise ValueError("Only support square bin crop size for now.") ymin, xmin, ymax, xmax = tf.unstack(boxes, axis=1) spatial_bins_y, spatial_bins_x = num_spatial_bins # Split each box into spatial_bins_y * spatial_bins_x bins. position_sensitive_boxes = [] for bin_y in range(spatial_bins_y): step_y = (ymax - ymin) / spatial_bins_y for bin_x in range(spatial_bins_x): step_x = (xmax - xmin) / spatial_bins_x box_coordinates = [ ymin + bin_y * step_y, xmin + bin_x * step_x, ymin + (bin_y + 1) * step_y, xmin + (bin_x + 1) * step_x, ] position_sensitive_boxes.append(tf.stack(box_coordinates, axis=1)) image_splits = tf.split(value=image, num_or_size_splits=total_bins, axis=3) image_crops = [] for split, box in zip(image_splits, position_sensitive_boxes): crop = tf.image.crop_and_resize( split, box, box_ind, bin_crop_size, extrapolation_value=extrapolation_value ) image_crops.append(crop) if global_pool: # Average over all bins. position_sensitive_features = tf.add_n(image_crops) / len(image_crops) # Then average over spatial positions within the bins. position_sensitive_features = tf.reduce_mean( position_sensitive_features, [1, 2], keep_dims=True ) else: # Reorder height/width to depth channel. block_size = bin_crop_size[0] if block_size >= 2: image_crops = [ tf.space_to_depth(crop, block_size=block_size) for crop in image_crops ] # Pack image_crops so that first dimension is for position-senstive boxes. position_sensitive_features = tf.stack(image_crops, axis=0) # Unroll the position-sensitive boxes to spatial positions. position_sensitive_features = tf.squeeze( tf.batch_to_space_nd( position_sensitive_features, block_shape=[1] + num_spatial_bins, crops=tf.zeros((3, 2), dtype=tf.int32), ), squeeze_dims=[0], ) # Reorder back the depth channel. if block_size >= 2: position_sensitive_features = tf.depth_to_space( position_sensitive_features, block_size=block_size ) return position_sensitive_features def reframe_box_masks_to_image_masks(box_masks, boxes, image_height, image_width): """Transforms the box masks back to full image masks. Embeds masks in bounding boxes of larger masks whose shapes correspond to image shape. Args: box_masks: A tf.float32 tensor of size [num_masks, mask_height, mask_width]. boxes: A tf.float32 tensor of size [num_masks, 4] containing the box corners. Row i contains [ymin, xmin, ymax, xmax] of the box corresponding to mask i. Note that the box corners are in normalized coordinates. image_height: Image height. The output mask will have the same height as the image height. image_width: Image width. The output mask will have the same width as the image width. Returns: A tf.float32 tensor of size [num_masks, image_height, image_width]. """ # TODO: Make this a public function. def transform_boxes_relative_to_boxes(boxes, reference_boxes): boxes = tf.reshape(boxes, [-1, 2, 2]) min_corner = tf.expand_dims(reference_boxes[:, 0:2], 1) max_corner = tf.expand_dims(reference_boxes[:, 2:4], 1) transformed_boxes = (boxes - min_corner) / (max_corner - min_corner) return tf.reshape(transformed_boxes, [-1, 4]) box_masks = tf.expand_dims(box_masks, axis=3) num_boxes = tf.shape(box_masks)[0] unit_boxes = tf.concat([tf.zeros([num_boxes, 2]), tf.ones([num_boxes, 2])], axis=1) reverse_boxes = transform_boxes_relative_to_boxes(unit_boxes, boxes) image_masks = tf.image.crop_and_resize( image=box_masks, boxes=reverse_boxes, box_ind=tf.range(num_boxes), crop_size=[image_height, image_width], extrapolation_value=0.0, ) return tf.squeeze(image_masks, axis=3) def merge_boxes_with_multiple_labels(boxes, classes, num_classes): """Merges boxes with same coordinates and returns K-hot encoded classes. Args: boxes: A tf.float32 tensor with shape [N, 4] holding N boxes. classes: A tf.int32 tensor with shape [N] holding class indices. The class index starts at 0. num_classes: total number of classes to use for K-hot encoding. Returns: merged_boxes: A tf.float32 tensor with shape [N', 4] holding boxes, where N' <= N. class_encodings: A tf.int32 tensor with shape [N', num_classes] holding k-hot encodings for the merged boxes. merged_box_indices: A tf.int32 tensor with shape [N'] holding original indices of the boxes. """ def merge_numpy_boxes(boxes, classes, num_classes): """Python function to merge numpy boxes.""" if boxes.size < 1: return ( np.zeros([0, 4], dtype=np.float32), np.zeros([0, num_classes], dtype=np.int32), np.zeros([0], dtype=np.int32), ) box_to_class_indices = {} for box_index in range(boxes.shape[0]): box = tuple(boxes[box_index, :].tolist()) class_index = classes[box_index] if box not in box_to_class_indices: box_to_class_indices[box] = [box_index, np.zeros([num_classes])] box_to_class_indices[box][1][class_index] = 1 merged_boxes = np.vstack(box_to_class_indices.keys()).astype(np.float32) class_encodings = [item[1] for item in box_to_class_indices.values()] class_encodings = np.vstack(class_encodings).astype(np.int32) merged_box_indices = [item[0] for item in box_to_class_indices.values()] merged_box_indices = np.array(merged_box_indices).astype(np.int32) return merged_boxes, class_encodings, merged_box_indices merged_boxes, class_encodings, merged_box_indices = tf.py_func( merge_numpy_boxes, [boxes, classes, num_classes], [tf.float32, tf.int32, tf.int32], ) merged_boxes = tf.reshape(merged_boxes, [-1, 4]) class_encodings = tf.reshape(class_encodings, [-1, num_classes]) merged_box_indices = tf.reshape(merged_box_indices, [-1]) return merged_boxes, class_encodings, merged_box_indices
friture
statisticswidget
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2013 Timoth�e Lecomte # This file is part of Friture. # # Friture is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as published by # the Free Software Foundation. # # Friture is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Friture. If not, see <http://www.gnu.org/licenses/>. from friture.audiobackend import AudioBackend from PyQt5 import QtCore, QtWidgets class StatisticsWidget(QtWidgets.QWidget): def __init__(self, parent, timer): super().__init__(parent) self.setObjectName("tab_stats") self.stats_scrollarea = QtWidgets.QScrollArea(self) self.stats_scrollarea.setWidgetResizable(True) self.stats_scrollarea.setAlignment( QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop ) self.stats_scrollarea.setObjectName("stats_scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget(self.stats_scrollarea) self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 87, 220)) self.scrollAreaWidgetContents.setStyleSheet("""QWidget { background: white }""") self.scrollAreaWidgetContents.setObjectName("stats_scrollAreaWidgetContents") self.LabelStats = QtWidgets.QLabel(self.scrollAreaWidgetContents) self.LabelStats.setAlignment( QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop ) self.LabelStats.setTextInteractionFlags( QtCore.Qt.LinksAccessibleByKeyboard | QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextBrowserInteraction | QtCore.Qt.TextSelectableByKeyboard | QtCore.Qt.TextSelectableByMouse ) self.LabelStats.setObjectName("LabelStats") self.stats_layout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents) self.stats_layout.setObjectName("stats_layout") self.stats_layout.addWidget(self.LabelStats) self.stats_scrollarea.setWidget(self.scrollAreaWidgetContents) self.tab_stats_layout = QtWidgets.QGridLayout(self) self.tab_stats_layout.addWidget(self.stats_scrollarea) timer.timeout.connect(self.stats_update) # method def stats_update(self): if not self.LabelStats.isVisible(): return label = "Chunk #%d\n" "Number of overflowed inputs (XRUNs): %d" % ( AudioBackend().chunk_number, AudioBackend().xruns, ) self.LabelStats.setText(label)
comictaggerlib
imagefetcher
"""A class to manage fetching and caching of images by URL""" # Copyright 2012-2014 Anthony Beville # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import datetime import os import shutil import sqlite3 as lite import tempfile import urllib # import urllib2 try: from PyQt4 import QtGui from PyQt4.QtCore import QByteArray, QObject, QUrl, pyqtSignal from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest except ImportError: # No Qt, so define a few dummy QObjects to help us compile class QObject: def __init__(self, *args): pass class QByteArray: pass class pyqtSignal: def __init__(self, *args): pass def emit(a, b, c): pass from settings import ComicTaggerSettings class ImageFetcherException(Exception): pass class ImageFetcher(QObject): fetchComplete = pyqtSignal(QByteArray, int) def __init__(self): QObject.__init__(self) self.settings_folder = ComicTaggerSettings.getSettingsFolder() self.db_file = os.path.join(self.settings_folder, "image_url_cache.db") self.cache_folder = os.path.join(self.settings_folder, "image_cache") if not os.path.exists(self.db_file): self.create_image_db() def clearCache(self): os.unlink(self.db_file) if os.path.isdir(self.cache_folder): shutil.rmtree(self.cache_folder) def fetch(self, url, user_data=None, blocking=False): """ If called with blocking=True, this will block until the image is fetched. If called with blocking=False, this will run the fetch in the background, and emit a signal when done """ self.user_data = user_data self.fetched_url = url # first look in the DB image_data = self.get_image_from_cache(url) if blocking: if image_data is None: try: image_data = urllib.urlopen(url).read() except Exception as e: print(e) raise ImageFetcherException("Network Error!") # save the image to the cache self.add_image_to_cache(self.fetched_url, image_data) return image_data else: # if we found it, just emit the signal asap if image_data is not None: self.fetchComplete.emit(QByteArray(image_data), self.user_data) return # didn't find it. look online self.nam = QNetworkAccessManager() self.nam.finished.connect(self.finishRequest) self.nam.get(QNetworkRequest(QUrl(url))) # we'll get called back when done... def finishRequest(self, reply): # read in the image data image_data = reply.readAll() # save the image to the cache self.add_image_to_cache(self.fetched_url, image_data) self.fetchComplete.emit(QByteArray(image_data), self.user_data) def create_image_db(self): # this will wipe out any existing version open(self.db_file, "w").close() # wipe any existing image cache folder too if os.path.isdir(self.cache_folder): shutil.rmtree(self.cache_folder) os.makedirs(self.cache_folder) con = lite.connect(self.db_file) # create tables with con: cur = con.cursor() cur.execute( "CREATE TABLE Images(" + "url TEXT," + "filename TEXT," + "timestamp TEXT," + "PRIMARY KEY (url))" ) def add_image_to_cache(self, url, image_data): con = lite.connect(self.db_file) with con: cur = con.cursor() timestamp = datetime.datetime.now() tmp_fd, filename = tempfile.mkstemp(dir=self.cache_folder, prefix="img") f = os.fdopen(tmp_fd, "w+b") f.write(image_data) f.close() cur.execute( "INSERT or REPLACE INTO Images VALUES(?, ?, ?)", (url, filename, timestamp), ) def get_image_from_cache(self, url): con = lite.connect(self.db_file) with con: cur = con.cursor() cur.execute("SELECT filename FROM Images WHERE url=?", [url]) row = cur.fetchone() if row is None: return None else: filename = row[0] image_data = None try: with open(filename, "rb") as f: image_data = f.read() f.close() except IOError as e: pass return image_data
api
access
__author__ = "Marc Hannappel <salandora@gmail.com>" __license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" __copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License" import octoprint.access.groups as groups import octoprint.access.users as users from flask import abort, jsonify, request from flask_login import current_user from octoprint.access.permissions import Permissions from octoprint.server import SUCCESS, groupManager, userManager from octoprint.server.api import api, valid_boolean_trues from octoprint.server.util.flask import no_firstrun_access # ~~ permission api @api.route("/access/permissions", methods=["GET"]) def get_permissions(): return jsonify( permissions=[permission.as_dict() for permission in Permissions.all()] ) # ~~ group api @api.route("/access/groups", methods=["GET"]) @no_firstrun_access @Permissions.ADMIN.require(403) def get_groups(): return jsonify(groups=list(map(lambda g: g.as_dict(), groupManager.groups))) @api.route("/access/groups", methods=["POST"]) @no_firstrun_access @Permissions.ADMIN.require(403) def add_group(): data = request.get_json() if "key" not in data: abort(400, description="key is missing") if "name" not in data: abort(400, description="name is missing") if "permissions" not in data: abort(400, description="permissions are missing") key = data["key"] name = data["name"] description = data.get("description", "") permissions = data["permissions"] subgroups = data["subgroups"] default = data.get("default", False) try: groupManager.add_group( key, name, description=description, permissions=permissions, subgroups=subgroups, default=default, ) except groups.GroupAlreadyExists: abort(409) return get_groups() @api.route("/access/groups/<key>", methods=["GET"]) @no_firstrun_access @Permissions.ADMIN.require(403) def get_group(key): group = groupManager.find_group(key) if group is not None: return jsonify(group) else: abort(404) @api.route("/access/groups/<key>", methods=["PUT"]) @no_firstrun_access @Permissions.ADMIN.require(403) def update_group(key): data = request.get_json() try: kwargs = {} if "permissions" in data: kwargs["permissions"] = data["permissions"] if "subgroups" in data: kwargs["subgroups"] = data["subgroups"] if "default" in data: kwargs["default"] = data["default"] in valid_boolean_trues if "description" in data: kwargs["description"] = data["description"] groupManager.update_group(key, **kwargs) return get_groups() except groups.GroupCantBeChanged: abort(403) except groups.UnknownGroup: abort(404) @api.route("/access/groups/<key>", methods=["DELETE"]) @no_firstrun_access @Permissions.ADMIN.require(403) def remove_group(key): try: groupManager.remove_group(key) return get_groups() except groups.UnknownGroup: abort(404) except groups.GroupUnremovable: abort(403) # ~~ user api @api.route("/access/users", methods=["GET"]) @no_firstrun_access @Permissions.ADMIN.require(403) def get_users(): return jsonify(users=list(map(lambda u: u.as_dict(), userManager.get_all_users()))) @api.route("/access/users", methods=["POST"]) @no_firstrun_access @Permissions.ADMIN.require(403) def add_user(): data = request.get_json() if "name" not in data: abort(400, description="name is missing") if "password" not in data: abort(400, description="password is missing") if "active" not in data: abort(400, description="active is missing") name = data["name"] password = data["password"] active = data["active"] in valid_boolean_trues groups = data.get("groups", None) permissions = data.get("permissions", None) try: userManager.add_user(name, password, active, permissions, groups) except users.UserAlreadyExists: abort(409) except users.InvalidUsername: abort(400, "Username invalid") return get_users() @api.route("/access/users/<username>", methods=["GET"]) @no_firstrun_access def get_user(username): if ( current_user is not None and not current_user.is_anonymous and ( current_user.get_name() == username or current_user.has_permission(Permissions.ADMIN) ) ): user = userManager.find_user(username) if user is not None: return jsonify(user) else: abort(404) else: abort(403) @api.route("/access/users/<username>", methods=["PUT"]) @no_firstrun_access @Permissions.ADMIN.require(403) def update_user(username): user = userManager.find_user(username) if user is not None: data = request.get_json() # change groups if "groups" in data: groups = data["groups"] userManager.change_user_groups(username, groups) # change permissions if "permissions" in data: permissions = data["permissions"] userManager.change_user_permissions(username, permissions) # change activation if "active" in data: userManager.change_user_activation( username, data["active"] in valid_boolean_trues ) return get_users() else: abort(404) @api.route("/access/users/<username>", methods=["DELETE"]) @no_firstrun_access @Permissions.ADMIN.require(403) def remove_user(username): try: userManager.remove_user(username) return get_users() except users.UnknownUser: abort(404) @api.route("/access/users/<username>/password", methods=["PUT"]) @no_firstrun_access def change_password_for_user(username): if not userManager.enabled: return jsonify(SUCCESS) if ( current_user is not None and not current_user.is_anonymous and ( current_user.get_name() == username or current_user.has_permission(Permissions.ADMIN) ) ): data = request.get_json() if "password" not in data or not data["password"]: abort(400, description="new password is missing") if not current_user.has_permission(Permissions.ADMIN) or "current" in data: if "current" not in data or not data["current"]: abort(400, description="current password is missing") if not userManager.check_password(username, data["current"]): abort(403, description="Invalid current password") try: userManager.change_user_password(username, data["password"]) except users.UnknownUser: abort(404) return jsonify(SUCCESS) else: abort(403) @api.route("/access/users/<username>/settings", methods=["GET"]) @no_firstrun_access def get_settings_for_user(username): if ( current_user is None or current_user.is_anonymous or ( current_user.get_name() != username and not current_user.has_permission(Permissions.ADMIN) ) ): abort(403) try: return jsonify(userManager.get_all_user_settings(username)) except users.UnknownUser: abort(404) @api.route("/access/users/<username>/settings", methods=["PATCH"]) @no_firstrun_access def change_settings_for_user(username): if ( current_user is None or current_user.is_anonymous or ( current_user.get_name() != username and not current_user.has_permission(Permissions.ADMIN) ) ): abort(403) data = request.get_json() try: userManager.change_user_settings(username, data) return jsonify(SUCCESS) except users.UnknownUser: abort(404) @api.route("/access/users/<username>/apikey", methods=["DELETE"]) @no_firstrun_access def delete_apikey_for_user(username): if ( current_user is not None and not current_user.is_anonymous and ( current_user.get_name() == username or current_user.has_permission(Permissions.ADMIN) ) ): try: userManager.delete_api_key(username) except users.UnknownUser: abort(404) return jsonify(SUCCESS) else: abort(403) @api.route("/access/users/<username>/apikey", methods=["POST"]) @no_firstrun_access def generate_apikey_for_user(username): if not userManager.enabled: return jsonify(SUCCESS) if ( current_user is not None and not current_user.is_anonymous and ( current_user.get_name() == username or current_user.has_permission(Permissions.ADMIN) ) ): try: apikey = userManager.generate_api_key(username) except users.UnknownUser: abort(404) return jsonify({"apikey": apikey}) else: abort(403) def _to_external_permissions(*permissions): return list(map(lambda p: p.get_name(), permissions)) def _to_external_groups(*groups): return list(map(lambda g: g.get_name(), groups))
migrations
upgrade25
""" Migration 25 - Converts T3C fitting configurations based on the spreadsheet noted here: https://community.eveonline.com/news/patch-notes/patch-notes-for-july-2017-release (csv copies can be found on the pyfa repo in case the official documents are deleted) - For fits that don't have 5 subsystems, or for fits that error out during the conversion, go by the generic "loose" conversion. Best effort ftw """ conversion = { frozenset([30046, 29969, 30139, 30122, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29969, 30139, 30122, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30139, 30122, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30139, 30122, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29969, 30139, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29969, 30139, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30139, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30139, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29969, 30139, 30124, 30090]): (45627, 45590, 45602, 45615), frozenset([30046, 29969, 30139, 30124, 30088]): (45627, 45590, 45602, 45614), frozenset([30046, 29969, 30139, 30124, 30086]): (45627, 45590, 45602, 45614), frozenset([30046, 29969, 30139, 30124, 30092]): (45627, 45590, 45602, 45613), frozenset([30046, 29969, 30139, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29969, 30139, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29969, 30139, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29969, 30139, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29969, 30141, 30122, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29969, 30141, 30122, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30141, 30122, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30141, 30122, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29969, 30141, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29969, 30141, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30141, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30141, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29969, 30141, 30124, 30090]): (45627, 45590, 45602, 45615), frozenset([30046, 29969, 30141, 30124, 30088]): (45627, 45590, 45602, 45614), frozenset([30046, 29969, 30141, 30124, 30086]): (45627, 45590, 45602, 45614), frozenset([30046, 29969, 30141, 30124, 30092]): (45627, 45590, 45602, 45613), frozenset([30046, 29969, 30141, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29969, 30141, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29969, 30141, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29969, 30141, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29969, 30143, 30122, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29969, 30143, 30122, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30143, 30122, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30143, 30122, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29969, 30143, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29969, 30143, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30143, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30143, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29969, 30143, 30124, 30090]): (45627, 45590, 45602, 45615), frozenset([30046, 29969, 30143, 30124, 30088]): (45627, 45590, 45602, 45614), frozenset([30046, 29969, 30143, 30124, 30086]): (45627, 45590, 45602, 45614), frozenset([30046, 29969, 30143, 30124, 30092]): (45627, 45590, 45602, 45613), frozenset([30046, 29969, 30143, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29969, 30143, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29969, 30143, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29969, 30143, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29969, 30145, 30122, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29969, 30145, 30122, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30145, 30122, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30145, 30122, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29969, 30145, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29969, 30145, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30145, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29969, 30145, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29969, 30145, 30124, 30090]): (45627, 45590, 45602, 45615), frozenset([30046, 29969, 30145, 30124, 30088]): (45627, 45590, 45602, 45614), frozenset([30046, 29969, 30145, 30124, 30086]): (45627, 45590, 45602, 45614), frozenset([30046, 29969, 30145, 30124, 30092]): (45627, 45590, 45602, 45613), frozenset([30046, 29969, 30145, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29969, 30145, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29969, 30145, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29969, 30145, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29970, 30139, 30122, 30090]): (45627, 45591, 45601, 45615), frozenset([30046, 29970, 30139, 30122, 30088]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30139, 30122, 30086]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30139, 30122, 30092]): (45627, 45591, 45601, 45613), frozenset([30046, 29970, 30139, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30046, 29970, 30139, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30139, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30139, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30046, 29970, 30139, 30124, 30090]): (45627, 45591, 45602, 45615), frozenset([30046, 29970, 30139, 30124, 30088]): (45627, 45591, 45602, 45614), frozenset([30046, 29970, 30139, 30124, 30086]): (45627, 45591, 45602, 45614), frozenset([30046, 29970, 30139, 30124, 30092]): (45627, 45591, 45602, 45613), frozenset([30046, 29970, 30139, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29970, 30139, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29970, 30139, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29970, 30139, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29970, 30141, 30122, 30090]): (45627, 45591, 45601, 45615), frozenset([30046, 29970, 30141, 30122, 30088]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30141, 30122, 30086]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30141, 30122, 30092]): (45627, 45591, 45601, 45613), frozenset([30046, 29970, 30141, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30046, 29970, 30141, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30141, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30141, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30046, 29970, 30141, 30124, 30090]): (45627, 45591, 45602, 45615), frozenset([30046, 29970, 30141, 30124, 30088]): (45627, 45591, 45602, 45614), frozenset([30046, 29970, 30141, 30124, 30086]): (45627, 45591, 45602, 45614), frozenset([30046, 29970, 30141, 30124, 30092]): (45627, 45591, 45602, 45613), frozenset([30046, 29970, 30141, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29970, 30141, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29970, 30141, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29970, 30141, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29970, 30143, 30122, 30090]): (45627, 45591, 45601, 45615), frozenset([30046, 29970, 30143, 30122, 30088]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30143, 30122, 30086]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30143, 30122, 30092]): (45627, 45591, 45601, 45613), frozenset([30046, 29970, 30143, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30046, 29970, 30143, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30143, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30143, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30046, 29970, 30143, 30124, 30090]): (45627, 45591, 45602, 45615), frozenset([30046, 29970, 30143, 30124, 30088]): (45627, 45591, 45602, 45614), frozenset([30046, 29970, 30143, 30124, 30086]): (45627, 45591, 45602, 45614), frozenset([30046, 29970, 30143, 30124, 30092]): (45627, 45591, 45602, 45613), frozenset([30046, 29970, 30143, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29970, 30143, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29970, 30143, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29970, 30143, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29970, 30145, 30122, 30090]): (45627, 45591, 45601, 45615), frozenset([30046, 29970, 30145, 30122, 30088]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30145, 30122, 30086]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30145, 30122, 30092]): (45627, 45591, 45601, 45613), frozenset([30046, 29970, 30145, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30046, 29970, 30145, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30145, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30046, 29970, 30145, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30046, 29970, 30145, 30124, 30090]): (45627, 45591, 45602, 45615), frozenset([30046, 29970, 30145, 30124, 30088]): (45627, 45591, 45602, 45614), frozenset([30046, 29970, 30145, 30124, 30086]): (45627, 45591, 45602, 45614), frozenset([30046, 29970, 30145, 30124, 30092]): (45627, 45591, 45602, 45613), frozenset([30046, 29970, 30145, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29970, 30145, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29970, 30145, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29970, 30145, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29971, 30139, 30122, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29971, 30139, 30122, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30139, 30122, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30139, 30122, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29971, 30139, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29971, 30139, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30139, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30139, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29971, 30139, 30124, 30090]): (45627, 45590, 45602, 45615), frozenset([30046, 29971, 30139, 30124, 30088]): (45627, 45590, 45602, 45614), frozenset([30046, 29971, 30139, 30124, 30086]): (45627, 45590, 45602, 45614), frozenset([30046, 29971, 30139, 30124, 30092]): (45627, 45590, 45602, 45613), frozenset([30046, 29971, 30139, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29971, 30139, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29971, 30139, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29971, 30139, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29971, 30141, 30122, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29971, 30141, 30122, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30141, 30122, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30141, 30122, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29971, 30141, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29971, 30141, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30141, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30141, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29971, 30141, 30124, 30090]): (45627, 45590, 45602, 45615), frozenset([30046, 29971, 30141, 30124, 30088]): (45627, 45590, 45602, 45614), frozenset([30046, 29971, 30141, 30124, 30086]): (45627, 45590, 45602, 45614), frozenset([30046, 29971, 30141, 30124, 30092]): (45627, 45590, 45602, 45613), frozenset([30046, 29971, 30141, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29971, 30141, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29971, 30141, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29971, 30141, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29971, 30143, 30122, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29971, 30143, 30122, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30143, 30122, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30143, 30122, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29971, 30143, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29971, 30143, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30143, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30143, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29971, 30143, 30124, 30090]): (45627, 45590, 45602, 45615), frozenset([30046, 29971, 30143, 30124, 30088]): (45627, 45590, 45602, 45614), frozenset([30046, 29971, 30143, 30124, 30086]): (45627, 45590, 45602, 45614), frozenset([30046, 29971, 30143, 30124, 30092]): (45627, 45590, 45602, 45613), frozenset([30046, 29971, 30143, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29971, 30143, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29971, 30143, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29971, 30143, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29971, 30145, 30122, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29971, 30145, 30122, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30145, 30122, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30145, 30122, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29971, 30145, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30046, 29971, 30145, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30145, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30046, 29971, 30145, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30046, 29971, 30145, 30124, 30090]): (45627, 45590, 45602, 45615), frozenset([30046, 29971, 30145, 30124, 30088]): (45627, 45590, 45602, 45614), frozenset([30046, 29971, 30145, 30124, 30086]): (45627, 45590, 45602, 45614), frozenset([30046, 29971, 30145, 30124, 30092]): (45627, 45590, 45602, 45613), frozenset([30046, 29971, 30145, 30125, 30090]): (45627, 45589, 45601, 45615), frozenset([30046, 29971, 30145, 30125, 30088]): (45627, 45589, 45601, 45614), frozenset([30046, 29971, 30145, 30125, 30086]): (45627, 45589, 45601, 45614), frozenset([30046, 29971, 30145, 30125, 30092]): (45627, 45589, 45601, 45613), frozenset([30046, 29972, 30139, 30122, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30139, 30122, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30139, 30122, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30139, 30122, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30139, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30139, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30139, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30139, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30139, 30124, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30139, 30124, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30139, 30124, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30139, 30124, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30139, 30125, 30090]): (45627, 45589, 45603, 45615), frozenset([30046, 29972, 30139, 30125, 30088]): (45627, 45589, 45603, 45614), frozenset([30046, 29972, 30139, 30125, 30086]): (45627, 45589, 45603, 45614), frozenset([30046, 29972, 30139, 30125, 30092]): (45627, 45589, 45603, 45613), frozenset([30046, 29972, 30141, 30122, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30141, 30122, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30141, 30122, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30141, 30122, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30141, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30141, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30141, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30141, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30141, 30124, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30141, 30124, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30141, 30124, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30141, 30124, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30141, 30125, 30090]): (45627, 45589, 45603, 45615), frozenset([30046, 29972, 30141, 30125, 30088]): (45627, 45589, 45603, 45614), frozenset([30046, 29972, 30141, 30125, 30086]): (45627, 45589, 45603, 45614), frozenset([30046, 29972, 30141, 30125, 30092]): (45627, 45589, 45603, 45613), frozenset([30046, 29972, 30143, 30122, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30143, 30122, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30143, 30122, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30143, 30122, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30143, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30143, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30143, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30143, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30143, 30124, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30143, 30124, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30143, 30124, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30143, 30124, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30143, 30125, 30090]): (45627, 45589, 45603, 45615), frozenset([30046, 29972, 30143, 30125, 30088]): (45627, 45589, 45603, 45614), frozenset([30046, 29972, 30143, 30125, 30086]): (45627, 45589, 45603, 45614), frozenset([30046, 29972, 30143, 30125, 30092]): (45627, 45589, 45603, 45613), frozenset([30046, 29972, 30145, 30122, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30145, 30122, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30145, 30122, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30145, 30122, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30145, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30145, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30145, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30145, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30145, 30124, 30090]): (45627, 45590, 45603, 45615), frozenset([30046, 29972, 30145, 30124, 30088]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30145, 30124, 30086]): (45627, 45590, 45603, 45614), frozenset([30046, 29972, 30145, 30124, 30092]): (45627, 45590, 45603, 45613), frozenset([30046, 29972, 30145, 30125, 30090]): (45627, 45589, 45603, 45615), frozenset([30046, 29972, 30145, 30125, 30088]): (45627, 45589, 45603, 45614), frozenset([30046, 29972, 30145, 30125, 30086]): (45627, 45589, 45603, 45614), frozenset([30046, 29972, 30145, 30125, 30092]): (45627, 45589, 45603, 45613), frozenset([30048, 29969, 30139, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30048, 29969, 30139, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30048, 29969, 30139, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30048, 29969, 30139, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30048, 29969, 30139, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30048, 29969, 30139, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30048, 29969, 30139, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30048, 29969, 30139, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30048, 29969, 30139, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30048, 29969, 30139, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30048, 29969, 30139, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30048, 29969, 30139, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30048, 29969, 30139, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29969, 30139, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29969, 30139, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29969, 30139, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29969, 30141, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30048, 29969, 30141, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30048, 29969, 30141, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30048, 29969, 30141, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30048, 29969, 30141, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30048, 29969, 30141, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30048, 29969, 30141, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30048, 29969, 30141, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30048, 29969, 30141, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30048, 29969, 30141, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30048, 29969, 30141, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30048, 29969, 30141, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30048, 29969, 30141, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29969, 30141, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29969, 30141, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29969, 30141, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29969, 30143, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30048, 29969, 30143, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30048, 29969, 30143, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30048, 29969, 30143, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30048, 29969, 30143, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30048, 29969, 30143, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30048, 29969, 30143, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30048, 29969, 30143, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30048, 29969, 30143, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30048, 29969, 30143, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30048, 29969, 30143, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30048, 29969, 30143, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30048, 29969, 30143, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29969, 30143, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29969, 30143, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29969, 30143, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29969, 30145, 30122, 30090]): (45625, 45590, 45601, 45615), frozenset([30048, 29969, 30145, 30122, 30088]): (45625, 45590, 45601, 45614), frozenset([30048, 29969, 30145, 30122, 30086]): (45625, 45590, 45601, 45614), frozenset([30048, 29969, 30145, 30122, 30092]): (45625, 45590, 45601, 45613), frozenset([30048, 29969, 30145, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30048, 29969, 30145, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30048, 29969, 30145, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30048, 29969, 30145, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30048, 29969, 30145, 30124, 30090]): (45625, 45590, 45602, 45615), frozenset([30048, 29969, 30145, 30124, 30088]): (45625, 45590, 45602, 45614), frozenset([30048, 29969, 30145, 30124, 30086]): (45625, 45590, 45602, 45614), frozenset([30048, 29969, 30145, 30124, 30092]): (45625, 45590, 45602, 45613), frozenset([30048, 29969, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30048, 29969, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30048, 29969, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30048, 29969, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30048, 29970, 30139, 30122, 30090]): (45626, 45591, 45601, 45615), frozenset([30048, 29970, 30139, 30122, 30088]): (45626, 45591, 45601, 45614), frozenset([30048, 29970, 30139, 30122, 30086]): (45626, 45591, 45601, 45614), frozenset([30048, 29970, 30139, 30122, 30092]): (45626, 45591, 45601, 45613), frozenset([30048, 29970, 30139, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30048, 29970, 30139, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30048, 29970, 30139, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30048, 29970, 30139, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30048, 29970, 30139, 30124, 30090]): (45626, 45591, 45602, 45615), frozenset([30048, 29970, 30139, 30124, 30088]): (45626, 45591, 45602, 45614), frozenset([30048, 29970, 30139, 30124, 30086]): (45626, 45591, 45602, 45614), frozenset([30048, 29970, 30139, 30124, 30092]): (45626, 45591, 45602, 45613), frozenset([30048, 29970, 30139, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29970, 30139, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29970, 30139, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29970, 30139, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29970, 30141, 30122, 30090]): (45626, 45591, 45601, 45615), frozenset([30048, 29970, 30141, 30122, 30088]): (45626, 45591, 45601, 45614), frozenset([30048, 29970, 30141, 30122, 30086]): (45626, 45591, 45601, 45614), frozenset([30048, 29970, 30141, 30122, 30092]): (45626, 45591, 45601, 45613), frozenset([30048, 29970, 30141, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30048, 29970, 30141, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30048, 29970, 30141, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30048, 29970, 30141, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30048, 29970, 30141, 30124, 30090]): (45626, 45591, 45602, 45615), frozenset([30048, 29970, 30141, 30124, 30088]): (45626, 45591, 45602, 45614), frozenset([30048, 29970, 30141, 30124, 30086]): (45626, 45591, 45602, 45614), frozenset([30048, 29970, 30141, 30124, 30092]): (45626, 45591, 45602, 45613), frozenset([30048, 29970, 30141, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29970, 30141, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29970, 30141, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29970, 30141, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29970, 30143, 30122, 30090]): (45626, 45591, 45601, 45615), frozenset([30048, 29970, 30143, 30122, 30088]): (45626, 45591, 45601, 45614), frozenset([30048, 29970, 30143, 30122, 30086]): (45626, 45591, 45601, 45614), frozenset([30048, 29970, 30143, 30122, 30092]): (45626, 45591, 45601, 45613), frozenset([30048, 29970, 30143, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30048, 29970, 30143, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30048, 29970, 30143, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30048, 29970, 30143, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30048, 29970, 30143, 30124, 30090]): (45626, 45591, 45602, 45615), frozenset([30048, 29970, 30143, 30124, 30088]): (45626, 45591, 45602, 45614), frozenset([30048, 29970, 30143, 30124, 30086]): (45626, 45591, 45602, 45614), frozenset([30048, 29970, 30143, 30124, 30092]): (45626, 45591, 45602, 45613), frozenset([30048, 29970, 30143, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29970, 30143, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29970, 30143, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29970, 30143, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29970, 30145, 30122, 30090]): (45625, 45591, 45601, 45615), frozenset([30048, 29970, 30145, 30122, 30088]): (45625, 45591, 45601, 45614), frozenset([30048, 29970, 30145, 30122, 30086]): (45625, 45591, 45601, 45614), frozenset([30048, 29970, 30145, 30122, 30092]): (45625, 45591, 45601, 45613), frozenset([30048, 29970, 30145, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30048, 29970, 30145, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30048, 29970, 30145, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30048, 29970, 30145, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30048, 29970, 30145, 30124, 30090]): (45625, 45591, 45602, 45615), frozenset([30048, 29970, 30145, 30124, 30088]): (45625, 45591, 45602, 45614), frozenset([30048, 29970, 30145, 30124, 30086]): (45625, 45591, 45602, 45614), frozenset([30048, 29970, 30145, 30124, 30092]): (45625, 45591, 45602, 45613), frozenset([30048, 29970, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30048, 29970, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30048, 29970, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30048, 29970, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30048, 29971, 30139, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30048, 29971, 30139, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30048, 29971, 30139, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30048, 29971, 30139, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30048, 29971, 30139, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30048, 29971, 30139, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30048, 29971, 30139, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30048, 29971, 30139, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30048, 29971, 30139, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30048, 29971, 30139, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30048, 29971, 30139, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30048, 29971, 30139, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30048, 29971, 30139, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29971, 30139, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29971, 30139, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29971, 30139, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29971, 30141, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30048, 29971, 30141, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30048, 29971, 30141, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30048, 29971, 30141, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30048, 29971, 30141, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30048, 29971, 30141, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30048, 29971, 30141, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30048, 29971, 30141, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30048, 29971, 30141, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30048, 29971, 30141, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30048, 29971, 30141, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30048, 29971, 30141, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30048, 29971, 30141, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29971, 30141, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29971, 30141, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29971, 30141, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29971, 30143, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30048, 29971, 30143, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30048, 29971, 30143, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30048, 29971, 30143, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30048, 29971, 30143, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30048, 29971, 30143, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30048, 29971, 30143, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30048, 29971, 30143, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30048, 29971, 30143, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30048, 29971, 30143, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30048, 29971, 30143, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30048, 29971, 30143, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30048, 29971, 30143, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30048, 29971, 30143, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30048, 29971, 30143, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30048, 29971, 30143, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30048, 29971, 30145, 30122, 30090]): (45625, 45590, 45601, 45615), frozenset([30048, 29971, 30145, 30122, 30088]): (45625, 45590, 45601, 45614), frozenset([30048, 29971, 30145, 30122, 30086]): (45625, 45590, 45601, 45614), frozenset([30048, 29971, 30145, 30122, 30092]): (45625, 45590, 45601, 45613), frozenset([30048, 29971, 30145, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30048, 29971, 30145, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30048, 29971, 30145, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30048, 29971, 30145, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30048, 29971, 30145, 30124, 30090]): (45625, 45590, 45602, 45615), frozenset([30048, 29971, 30145, 30124, 30088]): (45625, 45590, 45602, 45614), frozenset([30048, 29971, 30145, 30124, 30086]): (45625, 45590, 45602, 45614), frozenset([30048, 29971, 30145, 30124, 30092]): (45625, 45590, 45602, 45613), frozenset([30048, 29971, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30048, 29971, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30048, 29971, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30048, 29971, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30048, 29972, 30139, 30122, 30090]): (45626, 45590, 45603, 45615), frozenset([30048, 29972, 30139, 30122, 30088]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30139, 30122, 30086]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30139, 30122, 30092]): (45626, 45590, 45603, 45613), frozenset([30048, 29972, 30139, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30048, 29972, 30139, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30048, 29972, 30139, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30048, 29972, 30139, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30048, 29972, 30139, 30124, 30090]): (45626, 45590, 45603, 45615), frozenset([30048, 29972, 30139, 30124, 30088]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30139, 30124, 30086]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30139, 30124, 30092]): (45626, 45590, 45603, 45613), frozenset([30048, 29972, 30139, 30125, 30090]): (45626, 45589, 45603, 45615), frozenset([30048, 29972, 30139, 30125, 30088]): (45626, 45589, 45603, 45614), frozenset([30048, 29972, 30139, 30125, 30086]): (45626, 45589, 45603, 45614), frozenset([30048, 29972, 30139, 30125, 30092]): (45626, 45589, 45603, 45613), frozenset([30048, 29972, 30141, 30122, 30090]): (45626, 45590, 45603, 45615), frozenset([30048, 29972, 30141, 30122, 30088]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30141, 30122, 30086]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30141, 30122, 30092]): (45626, 45590, 45603, 45613), frozenset([30048, 29972, 30141, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30048, 29972, 30141, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30048, 29972, 30141, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30048, 29972, 30141, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30048, 29972, 30141, 30124, 30090]): (45626, 45590, 45603, 45615), frozenset([30048, 29972, 30141, 30124, 30088]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30141, 30124, 30086]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30141, 30124, 30092]): (45626, 45590, 45603, 45613), frozenset([30048, 29972, 30141, 30125, 30090]): (45626, 45589, 45603, 45615), frozenset([30048, 29972, 30141, 30125, 30088]): (45626, 45589, 45603, 45614), frozenset([30048, 29972, 30141, 30125, 30086]): (45626, 45589, 45603, 45614), frozenset([30048, 29972, 30141, 30125, 30092]): (45626, 45589, 45603, 45613), frozenset([30048, 29972, 30143, 30122, 30090]): (45626, 45590, 45603, 45615), frozenset([30048, 29972, 30143, 30122, 30088]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30143, 30122, 30086]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30143, 30122, 30092]): (45626, 45590, 45603, 45613), frozenset([30048, 29972, 30143, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30048, 29972, 30143, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30048, 29972, 30143, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30048, 29972, 30143, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30048, 29972, 30143, 30124, 30090]): (45626, 45590, 45603, 45615), frozenset([30048, 29972, 30143, 30124, 30088]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30143, 30124, 30086]): (45626, 45590, 45603, 45614), frozenset([30048, 29972, 30143, 30124, 30092]): (45626, 45590, 45603, 45613), frozenset([30048, 29972, 30143, 30125, 30090]): (45626, 45589, 45603, 45615), frozenset([30048, 29972, 30143, 30125, 30088]): (45626, 45589, 45603, 45614), frozenset([30048, 29972, 30143, 30125, 30086]): (45626, 45589, 45603, 45614), frozenset([30048, 29972, 30143, 30125, 30092]): (45626, 45589, 45603, 45613), frozenset([30048, 29972, 30145, 30122, 30090]): (45625, 45590, 45603, 45615), frozenset([30048, 29972, 30145, 30122, 30088]): (45625, 45590, 45603, 45614), frozenset([30048, 29972, 30145, 30122, 30086]): (45625, 45590, 45603, 45614), frozenset([30048, 29972, 30145, 30122, 30092]): (45625, 45590, 45603, 45613), frozenset([30048, 29972, 30145, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30048, 29972, 30145, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30048, 29972, 30145, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30048, 29972, 30145, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30048, 29972, 30145, 30124, 30090]): (45625, 45590, 45603, 45615), frozenset([30048, 29972, 30145, 30124, 30088]): (45625, 45590, 45603, 45614), frozenset([30048, 29972, 30145, 30124, 30086]): (45625, 45590, 45603, 45614), frozenset([30048, 29972, 30145, 30124, 30092]): (45625, 45590, 45603, 45613), frozenset([30048, 29972, 30145, 30125, 30090]): (45625, 45589, 45603, 45615), frozenset([30048, 29972, 30145, 30125, 30088]): (45625, 45589, 45603, 45614), frozenset([30048, 29972, 30145, 30125, 30086]): (45625, 45589, 45603, 45614), frozenset([30048, 29972, 30145, 30125, 30092]): (45625, 45589, 45603, 45613), frozenset([30050, 29969, 30139, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30050, 29969, 30139, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30050, 29969, 30139, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30050, 29969, 30139, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30050, 29969, 30139, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30050, 29969, 30139, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30050, 29969, 30139, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30050, 29969, 30139, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30050, 29969, 30139, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30050, 29969, 30139, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30050, 29969, 30139, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30050, 29969, 30139, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30050, 29969, 30139, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29969, 30139, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29969, 30139, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29969, 30139, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29969, 30141, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30050, 29969, 30141, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30050, 29969, 30141, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30050, 29969, 30141, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30050, 29969, 30141, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30050, 29969, 30141, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30050, 29969, 30141, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30050, 29969, 30141, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30050, 29969, 30141, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30050, 29969, 30141, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30050, 29969, 30141, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30050, 29969, 30141, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30050, 29969, 30141, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29969, 30141, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29969, 30141, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29969, 30141, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29969, 30143, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30050, 29969, 30143, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30050, 29969, 30143, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30050, 29969, 30143, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30050, 29969, 30143, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30050, 29969, 30143, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30050, 29969, 30143, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30050, 29969, 30143, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30050, 29969, 30143, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30050, 29969, 30143, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30050, 29969, 30143, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30050, 29969, 30143, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30050, 29969, 30143, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29969, 30143, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29969, 30143, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29969, 30143, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29969, 30145, 30122, 30090]): (45625, 45590, 45601, 45615), frozenset([30050, 29969, 30145, 30122, 30088]): (45625, 45590, 45601, 45614), frozenset([30050, 29969, 30145, 30122, 30086]): (45625, 45590, 45601, 45614), frozenset([30050, 29969, 30145, 30122, 30092]): (45625, 45590, 45601, 45613), frozenset([30050, 29969, 30145, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30050, 29969, 30145, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30050, 29969, 30145, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30050, 29969, 30145, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30050, 29969, 30145, 30124, 30090]): (45625, 45590, 45602, 45615), frozenset([30050, 29969, 30145, 30124, 30088]): (45625, 45590, 45602, 45614), frozenset([30050, 29969, 30145, 30124, 30086]): (45625, 45590, 45602, 45614), frozenset([30050, 29969, 30145, 30124, 30092]): (45625, 45590, 45602, 45613), frozenset([30050, 29969, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30050, 29969, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30050, 29969, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30050, 29969, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30050, 29970, 30139, 30122, 30090]): (45626, 45591, 45601, 45615), frozenset([30050, 29970, 30139, 30122, 30088]): (45626, 45591, 45601, 45614), frozenset([30050, 29970, 30139, 30122, 30086]): (45626, 45591, 45601, 45614), frozenset([30050, 29970, 30139, 30122, 30092]): (45626, 45591, 45601, 45613), frozenset([30050, 29970, 30139, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30050, 29970, 30139, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30050, 29970, 30139, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30050, 29970, 30139, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30050, 29970, 30139, 30124, 30090]): (45626, 45591, 45602, 45615), frozenset([30050, 29970, 30139, 30124, 30088]): (45626, 45591, 45602, 45614), frozenset([30050, 29970, 30139, 30124, 30086]): (45626, 45591, 45602, 45614), frozenset([30050, 29970, 30139, 30124, 30092]): (45626, 45591, 45602, 45613), frozenset([30050, 29970, 30139, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29970, 30139, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29970, 30139, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29970, 30139, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29970, 30141, 30122, 30090]): (45626, 45591, 45601, 45615), frozenset([30050, 29970, 30141, 30122, 30088]): (45626, 45591, 45601, 45614), frozenset([30050, 29970, 30141, 30122, 30086]): (45626, 45591, 45601, 45614), frozenset([30050, 29970, 30141, 30122, 30092]): (45626, 45591, 45601, 45613), frozenset([30050, 29970, 30141, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30050, 29970, 30141, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30050, 29970, 30141, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30050, 29970, 30141, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30050, 29970, 30141, 30124, 30090]): (45626, 45591, 45602, 45615), frozenset([30050, 29970, 30141, 30124, 30088]): (45626, 45591, 45602, 45614), frozenset([30050, 29970, 30141, 30124, 30086]): (45626, 45591, 45602, 45614), frozenset([30050, 29970, 30141, 30124, 30092]): (45626, 45591, 45602, 45613), frozenset([30050, 29970, 30141, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29970, 30141, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29970, 30141, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29970, 30141, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29970, 30143, 30122, 30090]): (45626, 45591, 45601, 45615), frozenset([30050, 29970, 30143, 30122, 30088]): (45626, 45591, 45601, 45614), frozenset([30050, 29970, 30143, 30122, 30086]): (45626, 45591, 45601, 45614), frozenset([30050, 29970, 30143, 30122, 30092]): (45626, 45591, 45601, 45613), frozenset([30050, 29970, 30143, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30050, 29970, 30143, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30050, 29970, 30143, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30050, 29970, 30143, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30050, 29970, 30143, 30124, 30090]): (45626, 45591, 45602, 45615), frozenset([30050, 29970, 30143, 30124, 30088]): (45626, 45591, 45602, 45614), frozenset([30050, 29970, 30143, 30124, 30086]): (45626, 45591, 45602, 45614), frozenset([30050, 29970, 30143, 30124, 30092]): (45626, 45591, 45602, 45613), frozenset([30050, 29970, 30143, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29970, 30143, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29970, 30143, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29970, 30143, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29970, 30145, 30122, 30090]): (45625, 45591, 45601, 45615), frozenset([30050, 29970, 30145, 30122, 30088]): (45625, 45591, 45601, 45614), frozenset([30050, 29970, 30145, 30122, 30086]): (45625, 45591, 45601, 45614), frozenset([30050, 29970, 30145, 30122, 30092]): (45625, 45591, 45601, 45613), frozenset([30050, 29970, 30145, 30123, 30090]): (45627, 45591, 45601, 45615), frozenset([30050, 29970, 30145, 30123, 30088]): (45627, 45591, 45601, 45614), frozenset([30050, 29970, 30145, 30123, 30086]): (45627, 45591, 45601, 45614), frozenset([30050, 29970, 30145, 30123, 30092]): (45627, 45591, 45601, 45613), frozenset([30050, 29970, 30145, 30124, 30090]): (45625, 45591, 45602, 45615), frozenset([30050, 29970, 30145, 30124, 30088]): (45625, 45591, 45602, 45614), frozenset([30050, 29970, 30145, 30124, 30086]): (45625, 45591, 45602, 45614), frozenset([30050, 29970, 30145, 30124, 30092]): (45625, 45591, 45602, 45613), frozenset([30050, 29970, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30050, 29970, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30050, 29970, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30050, 29970, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30050, 29971, 30139, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30050, 29971, 30139, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30050, 29971, 30139, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30050, 29971, 30139, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30050, 29971, 30139, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30050, 29971, 30139, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30050, 29971, 30139, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30050, 29971, 30139, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30050, 29971, 30139, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30050, 29971, 30139, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30050, 29971, 30139, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30050, 29971, 30139, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30050, 29971, 30139, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29971, 30139, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29971, 30139, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29971, 30139, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29971, 30141, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30050, 29971, 30141, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30050, 29971, 30141, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30050, 29971, 30141, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30050, 29971, 30141, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30050, 29971, 30141, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30050, 29971, 30141, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30050, 29971, 30141, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30050, 29971, 30141, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30050, 29971, 30141, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30050, 29971, 30141, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30050, 29971, 30141, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30050, 29971, 30141, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29971, 30141, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29971, 30141, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29971, 30141, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29971, 30143, 30122, 30090]): (45626, 45590, 45601, 45615), frozenset([30050, 29971, 30143, 30122, 30088]): (45626, 45590, 45601, 45614), frozenset([30050, 29971, 30143, 30122, 30086]): (45626, 45590, 45601, 45614), frozenset([30050, 29971, 30143, 30122, 30092]): (45626, 45590, 45601, 45613), frozenset([30050, 29971, 30143, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30050, 29971, 30143, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30050, 29971, 30143, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30050, 29971, 30143, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30050, 29971, 30143, 30124, 30090]): (45626, 45590, 45602, 45615), frozenset([30050, 29971, 30143, 30124, 30088]): (45626, 45590, 45602, 45614), frozenset([30050, 29971, 30143, 30124, 30086]): (45626, 45590, 45602, 45614), frozenset([30050, 29971, 30143, 30124, 30092]): (45626, 45590, 45602, 45613), frozenset([30050, 29971, 30143, 30125, 30090]): (45626, 45589, 45601, 45615), frozenset([30050, 29971, 30143, 30125, 30088]): (45626, 45589, 45601, 45614), frozenset([30050, 29971, 30143, 30125, 30086]): (45626, 45589, 45601, 45614), frozenset([30050, 29971, 30143, 30125, 30092]): (45626, 45589, 45601, 45613), frozenset([30050, 29971, 30145, 30122, 30090]): (45625, 45590, 45601, 45615), frozenset([30050, 29971, 30145, 30122, 30088]): (45625, 45590, 45601, 45614), frozenset([30050, 29971, 30145, 30122, 30086]): (45625, 45590, 45601, 45614), frozenset([30050, 29971, 30145, 30122, 30092]): (45625, 45590, 45601, 45613), frozenset([30050, 29971, 30145, 30123, 30090]): (45627, 45590, 45601, 45615), frozenset([30050, 29971, 30145, 30123, 30088]): (45627, 45590, 45601, 45614), frozenset([30050, 29971, 30145, 30123, 30086]): (45627, 45590, 45601, 45614), frozenset([30050, 29971, 30145, 30123, 30092]): (45627, 45590, 45601, 45613), frozenset([30050, 29971, 30145, 30124, 30090]): (45625, 45590, 45602, 45615), frozenset([30050, 29971, 30145, 30124, 30088]): (45625, 45590, 45602, 45614), frozenset([30050, 29971, 30145, 30124, 30086]): (45625, 45590, 45602, 45614), frozenset([30050, 29971, 30145, 30124, 30092]): (45625, 45590, 45602, 45613), frozenset([30050, 29971, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30050, 29971, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30050, 29971, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30050, 29971, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30050, 29972, 30139, 30122, 30090]): (45626, 45590, 45603, 45615), frozenset([30050, 29972, 30139, 30122, 30088]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30139, 30122, 30086]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30139, 30122, 30092]): (45626, 45590, 45603, 45613), frozenset([30050, 29972, 30139, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30050, 29972, 30139, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30050, 29972, 30139, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30050, 29972, 30139, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30050, 29972, 30139, 30124, 30090]): (45626, 45590, 45603, 45615), frozenset([30050, 29972, 30139, 30124, 30088]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30139, 30124, 30086]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30139, 30124, 30092]): (45626, 45590, 45603, 45613), frozenset([30050, 29972, 30139, 30125, 30090]): (45626, 45589, 45603, 45615), frozenset([30050, 29972, 30139, 30125, 30088]): (45626, 45589, 45603, 45614), frozenset([30050, 29972, 30139, 30125, 30086]): (45626, 45589, 45603, 45614), frozenset([30050, 29972, 30139, 30125, 30092]): (45626, 45589, 45603, 45613), frozenset([30050, 29972, 30141, 30122, 30090]): (45626, 45590, 45603, 45615), frozenset([30050, 29972, 30141, 30122, 30088]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30141, 30122, 30086]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30141, 30122, 30092]): (45626, 45590, 45603, 45613), frozenset([30050, 29972, 30141, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30050, 29972, 30141, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30050, 29972, 30141, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30050, 29972, 30141, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30050, 29972, 30141, 30124, 30090]): (45626, 45590, 45603, 45615), frozenset([30050, 29972, 30141, 30124, 30088]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30141, 30124, 30086]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30141, 30124, 30092]): (45626, 45590, 45603, 45613), frozenset([30050, 29972, 30141, 30125, 30090]): (45626, 45589, 45603, 45615), frozenset([30050, 29972, 30141, 30125, 30088]): (45626, 45589, 45603, 45614), frozenset([30050, 29972, 30141, 30125, 30086]): (45626, 45589, 45603, 45614), frozenset([30050, 29972, 30141, 30125, 30092]): (45626, 45589, 45603, 45613), frozenset([30050, 29972, 30143, 30122, 30090]): (45626, 45590, 45603, 45615), frozenset([30050, 29972, 30143, 30122, 30088]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30143, 30122, 30086]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30143, 30122, 30092]): (45626, 45590, 45603, 45613), frozenset([30050, 29972, 30143, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30050, 29972, 30143, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30050, 29972, 30143, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30050, 29972, 30143, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30050, 29972, 30143, 30124, 30090]): (45626, 45590, 45603, 45615), frozenset([30050, 29972, 30143, 30124, 30088]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30143, 30124, 30086]): (45626, 45590, 45603, 45614), frozenset([30050, 29972, 30143, 30124, 30092]): (45626, 45590, 45603, 45613), frozenset([30050, 29972, 30143, 30125, 30090]): (45626, 45589, 45603, 45615), frozenset([30050, 29972, 30143, 30125, 30088]): (45626, 45589, 45603, 45614), frozenset([30050, 29972, 30143, 30125, 30086]): (45626, 45589, 45603, 45614), frozenset([30050, 29972, 30143, 30125, 30092]): (45626, 45589, 45603, 45613), frozenset([30050, 29972, 30145, 30122, 30090]): (45625, 45590, 45603, 45615), frozenset([30050, 29972, 30145, 30122, 30088]): (45625, 45590, 45603, 45614), frozenset([30050, 29972, 30145, 30122, 30086]): (45625, 45590, 45603, 45614), frozenset([30050, 29972, 30145, 30122, 30092]): (45625, 45590, 45603, 45613), frozenset([30050, 29972, 30145, 30123, 30090]): (45627, 45590, 45603, 45615), frozenset([30050, 29972, 30145, 30123, 30088]): (45627, 45590, 45603, 45614), frozenset([30050, 29972, 30145, 30123, 30086]): (45627, 45590, 45603, 45614), frozenset([30050, 29972, 30145, 30123, 30092]): (45627, 45590, 45603, 45613), frozenset([30050, 29972, 30145, 30124, 30090]): (45625, 45590, 45603, 45615), frozenset([30050, 29972, 30145, 30124, 30088]): (45625, 45590, 45603, 45614), frozenset([30050, 29972, 30145, 30124, 30086]): (45625, 45590, 45603, 45614), frozenset([30050, 29972, 30145, 30124, 30092]): (45625, 45590, 45603, 45613), frozenset([30050, 29972, 30145, 30125, 30090]): (45625, 45589, 45603, 45615), frozenset([30050, 29972, 30145, 30125, 30088]): (45625, 45589, 45603, 45614), frozenset([30050, 29972, 30145, 30125, 30086]): (45625, 45589, 45603, 45614), frozenset([30050, 29972, 30145, 30125, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29969, 30139, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29969, 30139, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30139, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30139, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29969, 30139, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29969, 30139, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29969, 30139, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29969, 30139, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29969, 30139, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29969, 30139, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29969, 30139, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29969, 30139, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29969, 30139, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29969, 30139, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30139, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30139, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29969, 30141, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29969, 30141, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30141, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30141, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29969, 30141, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29969, 30141, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29969, 30141, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29969, 30141, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29969, 30141, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29969, 30141, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29969, 30141, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29969, 30141, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29969, 30141, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29969, 30141, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30141, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30141, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29969, 30143, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29969, 30143, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30143, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30143, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29969, 30143, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29969, 30143, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29969, 30143, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29969, 30143, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29969, 30143, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29969, 30143, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29969, 30143, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29969, 30143, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29969, 30143, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29969, 30143, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30143, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30143, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29969, 30145, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29969, 30145, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30145, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30145, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29969, 30145, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29969, 30145, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29969, 30145, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29969, 30145, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29969, 30145, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29969, 30145, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29969, 30145, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29969, 30145, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29969, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29969, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29969, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29970, 30139, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29970, 30139, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30139, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30139, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29970, 30139, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29970, 30139, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29970, 30139, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29970, 30139, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29970, 30139, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29970, 30139, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29970, 30139, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29970, 30139, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29970, 30139, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29970, 30139, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30139, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30139, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29970, 30141, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29970, 30141, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30141, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30141, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29970, 30141, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29970, 30141, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29970, 30141, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29970, 30141, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29970, 30141, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29970, 30141, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29970, 30141, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29970, 30141, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29970, 30141, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29970, 30141, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30141, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30141, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29970, 30143, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29970, 30143, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30143, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30143, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29970, 30143, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29970, 30143, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29970, 30143, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29970, 30143, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29970, 30143, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29970, 30143, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29970, 30143, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29970, 30143, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29970, 30143, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29970, 30143, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30143, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30143, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29970, 30145, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29970, 30145, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30145, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30145, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29970, 30145, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29970, 30145, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29970, 30145, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29970, 30145, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29970, 30145, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29970, 30145, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29970, 30145, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29970, 30145, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29970, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29970, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29970, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29971, 30139, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29971, 30139, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30139, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30139, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29971, 30139, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29971, 30139, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29971, 30139, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29971, 30139, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29971, 30139, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29971, 30139, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29971, 30139, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29971, 30139, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29971, 30139, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29971, 30139, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30139, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30139, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29971, 30141, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29971, 30141, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30141, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30141, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29971, 30141, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29971, 30141, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29971, 30141, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29971, 30141, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29971, 30141, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29971, 30141, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29971, 30141, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29971, 30141, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29971, 30141, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29971, 30141, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30141, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30141, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29971, 30143, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29971, 30143, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30143, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30143, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29971, 30143, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29971, 30143, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29971, 30143, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29971, 30143, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29971, 30143, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29971, 30143, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29971, 30143, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29971, 30143, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29971, 30143, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29971, 30143, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30143, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30143, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29971, 30145, 30122, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29971, 30145, 30122, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30145, 30122, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30145, 30122, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29971, 30145, 30123, 30090]): (45627, 45589, 45601, 45615), frozenset([30052, 29971, 30145, 30123, 30088]): (45627, 45589, 45601, 45614), frozenset([30052, 29971, 30145, 30123, 30086]): (45627, 45589, 45601, 45614), frozenset([30052, 29971, 30145, 30123, 30092]): (45627, 45589, 45601, 45613), frozenset([30052, 29971, 30145, 30124, 30090]): (45625, 45589, 45602, 45615), frozenset([30052, 29971, 30145, 30124, 30088]): (45625, 45589, 45602, 45614), frozenset([30052, 29971, 30145, 30124, 30086]): (45625, 45589, 45602, 45614), frozenset([30052, 29971, 30145, 30124, 30092]): (45625, 45589, 45602, 45613), frozenset([30052, 29971, 30145, 30125, 30090]): (45625, 45589, 45601, 45615), frozenset([30052, 29971, 30145, 30125, 30088]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30145, 30125, 30086]): (45625, 45589, 45601, 45614), frozenset([30052, 29971, 30145, 30125, 30092]): (45625, 45589, 45601, 45613), frozenset([30052, 29972, 30139, 30122, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30139, 30122, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30139, 30122, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30139, 30122, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30139, 30123, 30090]): (45627, 45589, 45603, 45615), frozenset([30052, 29972, 30139, 30123, 30088]): (45627, 45589, 45603, 45614), frozenset([30052, 29972, 30139, 30123, 30086]): (45627, 45589, 45603, 45614), frozenset([30052, 29972, 30139, 30123, 30092]): (45627, 45589, 45603, 45613), frozenset([30052, 29972, 30139, 30124, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30139, 30124, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30139, 30124, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30139, 30124, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30139, 30125, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30139, 30125, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30139, 30125, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30139, 30125, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30141, 30122, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30141, 30122, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30141, 30122, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30141, 30122, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30141, 30123, 30090]): (45627, 45589, 45603, 45615), frozenset([30052, 29972, 30141, 30123, 30088]): (45627, 45589, 45603, 45614), frozenset([30052, 29972, 30141, 30123, 30086]): (45627, 45589, 45603, 45614), frozenset([30052, 29972, 30141, 30123, 30092]): (45627, 45589, 45603, 45613), frozenset([30052, 29972, 30141, 30124, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30141, 30124, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30141, 30124, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30141, 30124, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30141, 30125, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30141, 30125, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30141, 30125, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30141, 30125, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30143, 30122, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30143, 30122, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30143, 30122, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30143, 30122, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30143, 30123, 30090]): (45627, 45589, 45603, 45615), frozenset([30052, 29972, 30143, 30123, 30088]): (45627, 45589, 45603, 45614), frozenset([30052, 29972, 30143, 30123, 30086]): (45627, 45589, 45603, 45614), frozenset([30052, 29972, 30143, 30123, 30092]): (45627, 45589, 45603, 45613), frozenset([30052, 29972, 30143, 30124, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30143, 30124, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30143, 30124, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30143, 30124, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30143, 30125, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30143, 30125, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30143, 30125, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30143, 30125, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30145, 30122, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30145, 30122, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30145, 30122, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30145, 30122, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30145, 30123, 30090]): (45627, 45589, 45603, 45615), frozenset([30052, 29972, 30145, 30123, 30088]): (45627, 45589, 45603, 45614), frozenset([30052, 29972, 30145, 30123, 30086]): (45627, 45589, 45603, 45614), frozenset([30052, 29972, 30145, 30123, 30092]): (45627, 45589, 45603, 45613), frozenset([30052, 29972, 30145, 30124, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30145, 30124, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30145, 30124, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30145, 30124, 30092]): (45625, 45589, 45603, 45613), frozenset([30052, 29972, 30145, 30125, 30090]): (45625, 45589, 45603, 45615), frozenset([30052, 29972, 30145, 30125, 30088]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30145, 30125, 30086]): (45625, 45589, 45603, 45614), frozenset([30052, 29972, 30145, 30125, 30092]): (45625, 45589, 45603, 45613), frozenset([30036, 29964, 30169, 30117, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29964, 30169, 30117, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30169, 30117, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29964, 30169, 30117, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30169, 30118, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29964, 30169, 30118, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30169, 30118, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29964, 30169, 30118, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30169, 30119, 30076]): (45624, 45587, 45598, 45611), frozenset([30036, 29964, 30169, 30119, 30078]): (45624, 45587, 45598, 45612), frozenset([30036, 29964, 30169, 30119, 30082]): (45624, 45587, 45598, 45610), frozenset([30036, 29964, 30169, 30119, 30080]): (45624, 45587, 45598, 45612), frozenset([30036, 29964, 30169, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29964, 30169, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29964, 30169, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29964, 30169, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29964, 30171, 30117, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29964, 30171, 30117, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30171, 30117, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29964, 30171, 30117, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30171, 30118, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29964, 30171, 30118, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30171, 30118, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29964, 30171, 30118, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30171, 30119, 30076]): (45624, 45587, 45598, 45611), frozenset([30036, 29964, 30171, 30119, 30078]): (45624, 45587, 45598, 45612), frozenset([30036, 29964, 30171, 30119, 30082]): (45624, 45587, 45598, 45610), frozenset([30036, 29964, 30171, 30119, 30080]): (45624, 45587, 45598, 45612), frozenset([30036, 29964, 30171, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29964, 30171, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29964, 30171, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29964, 30171, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29964, 30173, 30117, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29964, 30173, 30117, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30173, 30117, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29964, 30173, 30117, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30173, 30118, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29964, 30173, 30118, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30173, 30118, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29964, 30173, 30118, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30173, 30119, 30076]): (45624, 45587, 45598, 45611), frozenset([30036, 29964, 30173, 30119, 30078]): (45624, 45587, 45598, 45612), frozenset([30036, 29964, 30173, 30119, 30082]): (45624, 45587, 45598, 45610), frozenset([30036, 29964, 30173, 30119, 30080]): (45624, 45587, 45598, 45612), frozenset([30036, 29964, 30173, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29964, 30173, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29964, 30173, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29964, 30173, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29964, 30175, 30117, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29964, 30175, 30117, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30175, 30117, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29964, 30175, 30117, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30175, 30118, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29964, 30175, 30118, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30175, 30118, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29964, 30175, 30118, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29964, 30175, 30119, 30076]): (45624, 45587, 45598, 45611), frozenset([30036, 29964, 30175, 30119, 30078]): (45624, 45587, 45598, 45612), frozenset([30036, 29964, 30175, 30119, 30082]): (45624, 45587, 45598, 45610), frozenset([30036, 29964, 30175, 30119, 30080]): (45624, 45587, 45598, 45612), frozenset([30036, 29964, 30175, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29964, 30175, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29964, 30175, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29964, 30175, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29965, 30169, 30117, 30076]): (45624, 45588, 45599, 45611), frozenset([30036, 29965, 30169, 30117, 30078]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30169, 30117, 30082]): (45624, 45588, 45599, 45610), frozenset([30036, 29965, 30169, 30117, 30080]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30169, 30118, 30076]): (45624, 45588, 45599, 45611), frozenset([30036, 29965, 30169, 30118, 30078]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30169, 30118, 30082]): (45624, 45588, 45599, 45610), frozenset([30036, 29965, 30169, 30118, 30080]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30169, 30119, 30076]): (45624, 45588, 45598, 45611), frozenset([30036, 29965, 30169, 30119, 30078]): (45624, 45588, 45598, 45612), frozenset([30036, 29965, 30169, 30119, 30082]): (45624, 45588, 45598, 45610), frozenset([30036, 29965, 30169, 30119, 30080]): (45624, 45588, 45598, 45612), frozenset([30036, 29965, 30169, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29965, 30169, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29965, 30169, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29965, 30169, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29965, 30171, 30117, 30076]): (45624, 45588, 45599, 45611), frozenset([30036, 29965, 30171, 30117, 30078]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30171, 30117, 30082]): (45624, 45588, 45599, 45610), frozenset([30036, 29965, 30171, 30117, 30080]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30171, 30118, 30076]): (45624, 45588, 45599, 45611), frozenset([30036, 29965, 30171, 30118, 30078]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30171, 30118, 30082]): (45624, 45588, 45599, 45610), frozenset([30036, 29965, 30171, 30118, 30080]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30171, 30119, 30076]): (45624, 45588, 45598, 45611), frozenset([30036, 29965, 30171, 30119, 30078]): (45624, 45588, 45598, 45612), frozenset([30036, 29965, 30171, 30119, 30082]): (45624, 45588, 45598, 45610), frozenset([30036, 29965, 30171, 30119, 30080]): (45624, 45588, 45598, 45612), frozenset([30036, 29965, 30171, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29965, 30171, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29965, 30171, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29965, 30171, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29965, 30173, 30117, 30076]): (45624, 45588, 45599, 45611), frozenset([30036, 29965, 30173, 30117, 30078]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30173, 30117, 30082]): (45624, 45588, 45599, 45610), frozenset([30036, 29965, 30173, 30117, 30080]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30173, 30118, 30076]): (45624, 45588, 45599, 45611), frozenset([30036, 29965, 30173, 30118, 30078]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30173, 30118, 30082]): (45624, 45588, 45599, 45610), frozenset([30036, 29965, 30173, 30118, 30080]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30173, 30119, 30076]): (45624, 45588, 45598, 45611), frozenset([30036, 29965, 30173, 30119, 30078]): (45624, 45588, 45598, 45612), frozenset([30036, 29965, 30173, 30119, 30082]): (45624, 45588, 45598, 45610), frozenset([30036, 29965, 30173, 30119, 30080]): (45624, 45588, 45598, 45612), frozenset([30036, 29965, 30173, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29965, 30173, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29965, 30173, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29965, 30173, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29965, 30175, 30117, 30076]): (45624, 45588, 45599, 45611), frozenset([30036, 29965, 30175, 30117, 30078]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30175, 30117, 30082]): (45624, 45588, 45599, 45610), frozenset([30036, 29965, 30175, 30117, 30080]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30175, 30118, 30076]): (45624, 45588, 45599, 45611), frozenset([30036, 29965, 30175, 30118, 30078]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30175, 30118, 30082]): (45624, 45588, 45599, 45610), frozenset([30036, 29965, 30175, 30118, 30080]): (45624, 45588, 45599, 45612), frozenset([30036, 29965, 30175, 30119, 30076]): (45624, 45588, 45598, 45611), frozenset([30036, 29965, 30175, 30119, 30078]): (45624, 45588, 45598, 45612), frozenset([30036, 29965, 30175, 30119, 30082]): (45624, 45588, 45598, 45610), frozenset([30036, 29965, 30175, 30119, 30080]): (45624, 45588, 45598, 45612), frozenset([30036, 29965, 30175, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29965, 30175, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29965, 30175, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29965, 30175, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29966, 30169, 30117, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29966, 30169, 30117, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30169, 30117, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29966, 30169, 30117, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30169, 30118, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29966, 30169, 30118, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30169, 30118, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29966, 30169, 30118, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30169, 30119, 30076]): (45624, 45587, 45598, 45611), frozenset([30036, 29966, 30169, 30119, 30078]): (45624, 45587, 45598, 45612), frozenset([30036, 29966, 30169, 30119, 30082]): (45624, 45587, 45598, 45610), frozenset([30036, 29966, 30169, 30119, 30080]): (45624, 45587, 45598, 45612), frozenset([30036, 29966, 30169, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29966, 30169, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29966, 30169, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29966, 30169, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29966, 30171, 30117, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29966, 30171, 30117, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30171, 30117, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29966, 30171, 30117, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30171, 30118, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29966, 30171, 30118, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30171, 30118, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29966, 30171, 30118, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30171, 30119, 30076]): (45624, 45587, 45598, 45611), frozenset([30036, 29966, 30171, 30119, 30078]): (45624, 45587, 45598, 45612), frozenset([30036, 29966, 30171, 30119, 30082]): (45624, 45587, 45598, 45610), frozenset([30036, 29966, 30171, 30119, 30080]): (45624, 45587, 45598, 45612), frozenset([30036, 29966, 30171, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29966, 30171, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29966, 30171, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29966, 30171, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29966, 30173, 30117, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29966, 30173, 30117, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30173, 30117, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29966, 30173, 30117, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30173, 30118, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29966, 30173, 30118, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30173, 30118, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29966, 30173, 30118, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30173, 30119, 30076]): (45624, 45587, 45598, 45611), frozenset([30036, 29966, 30173, 30119, 30078]): (45624, 45587, 45598, 45612), frozenset([30036, 29966, 30173, 30119, 30082]): (45624, 45587, 45598, 45610), frozenset([30036, 29966, 30173, 30119, 30080]): (45624, 45587, 45598, 45612), frozenset([30036, 29966, 30173, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29966, 30173, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29966, 30173, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29966, 30173, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29966, 30175, 30117, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29966, 30175, 30117, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30175, 30117, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29966, 30175, 30117, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30175, 30118, 30076]): (45624, 45587, 45599, 45611), frozenset([30036, 29966, 30175, 30118, 30078]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30175, 30118, 30082]): (45624, 45587, 45599, 45610), frozenset([30036, 29966, 30175, 30118, 30080]): (45624, 45587, 45599, 45612), frozenset([30036, 29966, 30175, 30119, 30076]): (45624, 45587, 45598, 45611), frozenset([30036, 29966, 30175, 30119, 30078]): (45624, 45587, 45598, 45612), frozenset([30036, 29966, 30175, 30119, 30082]): (45624, 45587, 45598, 45610), frozenset([30036, 29966, 30175, 30119, 30080]): (45624, 45587, 45598, 45612), frozenset([30036, 29966, 30175, 30120, 30076]): (45624, 45586, 45598, 45611), frozenset([30036, 29966, 30175, 30120, 30078]): (45624, 45586, 45598, 45612), frozenset([30036, 29966, 30175, 30120, 30082]): (45624, 45586, 45598, 45610), frozenset([30036, 29966, 30175, 30120, 30080]): (45624, 45586, 45598, 45612), frozenset([30036, 29967, 30169, 30117, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30169, 30117, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30169, 30117, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30169, 30117, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30169, 30118, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30169, 30118, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30169, 30118, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30169, 30118, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30169, 30119, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30169, 30119, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30169, 30119, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30169, 30119, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30169, 30120, 30076]): (45624, 45586, 45600, 45611), frozenset([30036, 29967, 30169, 30120, 30078]): (45624, 45586, 45600, 45612), frozenset([30036, 29967, 30169, 30120, 30082]): (45624, 45586, 45600, 45610), frozenset([30036, 29967, 30169, 30120, 30080]): (45624, 45586, 45600, 45612), frozenset([30036, 29967, 30171, 30117, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30171, 30117, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30171, 30117, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30171, 30117, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30171, 30118, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30171, 30118, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30171, 30118, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30171, 30118, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30171, 30119, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30171, 30119, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30171, 30119, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30171, 30119, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30171, 30120, 30076]): (45624, 45586, 45600, 45611), frozenset([30036, 29967, 30171, 30120, 30078]): (45624, 45586, 45600, 45612), frozenset([30036, 29967, 30171, 30120, 30082]): (45624, 45586, 45600, 45610), frozenset([30036, 29967, 30171, 30120, 30080]): (45624, 45586, 45600, 45612), frozenset([30036, 29967, 30173, 30117, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30173, 30117, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30173, 30117, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30173, 30117, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30173, 30118, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30173, 30118, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30173, 30118, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30173, 30118, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30173, 30119, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30173, 30119, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30173, 30119, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30173, 30119, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30173, 30120, 30076]): (45624, 45586, 45600, 45611), frozenset([30036, 29967, 30173, 30120, 30078]): (45624, 45586, 45600, 45612), frozenset([30036, 29967, 30173, 30120, 30082]): (45624, 45586, 45600, 45610), frozenset([30036, 29967, 30173, 30120, 30080]): (45624, 45586, 45600, 45612), frozenset([30036, 29967, 30175, 30117, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30175, 30117, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30175, 30117, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30175, 30117, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30175, 30118, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30175, 30118, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30175, 30118, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30175, 30118, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30175, 30119, 30076]): (45624, 45587, 45600, 45611), frozenset([30036, 29967, 30175, 30119, 30078]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30175, 30119, 30082]): (45624, 45587, 45600, 45610), frozenset([30036, 29967, 30175, 30119, 30080]): (45624, 45587, 45600, 45612), frozenset([30036, 29967, 30175, 30120, 30076]): (45624, 45586, 45600, 45611), frozenset([30036, 29967, 30175, 30120, 30078]): (45624, 45586, 45600, 45612), frozenset([30036, 29967, 30175, 30120, 30082]): (45624, 45586, 45600, 45610), frozenset([30036, 29967, 30175, 30120, 30080]): (45624, 45586, 45600, 45612), frozenset([30038, 29964, 30169, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29964, 30169, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30169, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29964, 30169, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30169, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29964, 30169, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30169, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29964, 30169, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30169, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30038, 29964, 30169, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30038, 29964, 30169, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30038, 29964, 30169, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30038, 29964, 30169, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29964, 30169, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29964, 30169, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29964, 30169, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29964, 30171, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29964, 30171, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30171, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29964, 30171, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30171, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29964, 30171, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30171, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29964, 30171, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30171, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30038, 29964, 30171, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30038, 29964, 30171, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30038, 29964, 30171, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30038, 29964, 30171, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29964, 30171, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29964, 30171, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29964, 30171, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29964, 30173, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29964, 30173, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30173, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29964, 30173, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30173, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29964, 30173, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30173, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29964, 30173, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29964, 30173, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30038, 29964, 30173, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30038, 29964, 30173, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30038, 29964, 30173, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30038, 29964, 30173, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29964, 30173, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29964, 30173, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29964, 30173, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29964, 30175, 30117, 30076]): (45622, 45587, 45599, 45611), frozenset([30038, 29964, 30175, 30117, 30078]): (45622, 45587, 45599, 45612), frozenset([30038, 29964, 30175, 30117, 30082]): (45622, 45587, 45599, 45610), frozenset([30038, 29964, 30175, 30117, 30080]): (45622, 45587, 45599, 45612), frozenset([30038, 29964, 30175, 30118, 30076]): (45622, 45587, 45599, 45611), frozenset([30038, 29964, 30175, 30118, 30078]): (45622, 45587, 45599, 45612), frozenset([30038, 29964, 30175, 30118, 30082]): (45622, 45587, 45599, 45610), frozenset([30038, 29964, 30175, 30118, 30080]): (45622, 45587, 45599, 45612), frozenset([30038, 29964, 30175, 30119, 30076]): (45622, 45587, 45598, 45611), frozenset([30038, 29964, 30175, 30119, 30078]): (45622, 45587, 45598, 45612), frozenset([30038, 29964, 30175, 30119, 30082]): (45622, 45587, 45598, 45610), frozenset([30038, 29964, 30175, 30119, 30080]): (45622, 45587, 45598, 45612), frozenset([30038, 29964, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30038, 29964, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30038, 29964, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30038, 29964, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30038, 29965, 30169, 30117, 30076]): (45623, 45588, 45599, 45611), frozenset([30038, 29965, 30169, 30117, 30078]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30169, 30117, 30082]): (45623, 45588, 45599, 45610), frozenset([30038, 29965, 30169, 30117, 30080]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30169, 30118, 30076]): (45623, 45588, 45599, 45611), frozenset([30038, 29965, 30169, 30118, 30078]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30169, 30118, 30082]): (45623, 45588, 45599, 45610), frozenset([30038, 29965, 30169, 30118, 30080]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30169, 30119, 30076]): (45623, 45588, 45598, 45611), frozenset([30038, 29965, 30169, 30119, 30078]): (45623, 45588, 45598, 45612), frozenset([30038, 29965, 30169, 30119, 30082]): (45623, 45588, 45598, 45610), frozenset([30038, 29965, 30169, 30119, 30080]): (45623, 45588, 45598, 45612), frozenset([30038, 29965, 30169, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29965, 30169, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29965, 30169, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29965, 30169, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29965, 30171, 30117, 30076]): (45623, 45588, 45599, 45611), frozenset([30038, 29965, 30171, 30117, 30078]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30171, 30117, 30082]): (45623, 45588, 45599, 45610), frozenset([30038, 29965, 30171, 30117, 30080]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30171, 30118, 30076]): (45623, 45588, 45599, 45611), frozenset([30038, 29965, 30171, 30118, 30078]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30171, 30118, 30082]): (45623, 45588, 45599, 45610), frozenset([30038, 29965, 30171, 30118, 30080]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30171, 30119, 30076]): (45623, 45588, 45598, 45611), frozenset([30038, 29965, 30171, 30119, 30078]): (45623, 45588, 45598, 45612), frozenset([30038, 29965, 30171, 30119, 30082]): (45623, 45588, 45598, 45610), frozenset([30038, 29965, 30171, 30119, 30080]): (45623, 45588, 45598, 45612), frozenset([30038, 29965, 30171, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29965, 30171, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29965, 30171, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29965, 30171, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29965, 30173, 30117, 30076]): (45623, 45588, 45599, 45611), frozenset([30038, 29965, 30173, 30117, 30078]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30173, 30117, 30082]): (45623, 45588, 45599, 45610), frozenset([30038, 29965, 30173, 30117, 30080]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30173, 30118, 30076]): (45623, 45588, 45599, 45611), frozenset([30038, 29965, 30173, 30118, 30078]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30173, 30118, 30082]): (45623, 45588, 45599, 45610), frozenset([30038, 29965, 30173, 30118, 30080]): (45623, 45588, 45599, 45612), frozenset([30038, 29965, 30173, 30119, 30076]): (45623, 45588, 45598, 45611), frozenset([30038, 29965, 30173, 30119, 30078]): (45623, 45588, 45598, 45612), frozenset([30038, 29965, 30173, 30119, 30082]): (45623, 45588, 45598, 45610), frozenset([30038, 29965, 30173, 30119, 30080]): (45623, 45588, 45598, 45612), frozenset([30038, 29965, 30173, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29965, 30173, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29965, 30173, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29965, 30173, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29965, 30175, 30117, 30076]): (45622, 45588, 45599, 45611), frozenset([30038, 29965, 30175, 30117, 30078]): (45622, 45588, 45599, 45612), frozenset([30038, 29965, 30175, 30117, 30082]): (45622, 45588, 45599, 45610), frozenset([30038, 29965, 30175, 30117, 30080]): (45622, 45588, 45599, 45612), frozenset([30038, 29965, 30175, 30118, 30076]): (45622, 45588, 45599, 45611), frozenset([30038, 29965, 30175, 30118, 30078]): (45622, 45588, 45599, 45612), frozenset([30038, 29965, 30175, 30118, 30082]): (45622, 45588, 45599, 45610), frozenset([30038, 29965, 30175, 30118, 30080]): (45622, 45588, 45599, 45612), frozenset([30038, 29965, 30175, 30119, 30076]): (45622, 45588, 45598, 45611), frozenset([30038, 29965, 30175, 30119, 30078]): (45622, 45588, 45598, 45612), frozenset([30038, 29965, 30175, 30119, 30082]): (45622, 45588, 45598, 45610), frozenset([30038, 29965, 30175, 30119, 30080]): (45622, 45588, 45598, 45612), frozenset([30038, 29965, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30038, 29965, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30038, 29965, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30038, 29965, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30038, 29966, 30169, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29966, 30169, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30169, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29966, 30169, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30169, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29966, 30169, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30169, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29966, 30169, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30169, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30038, 29966, 30169, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30038, 29966, 30169, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30038, 29966, 30169, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30038, 29966, 30169, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29966, 30169, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29966, 30169, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29966, 30169, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29966, 30171, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29966, 30171, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30171, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29966, 30171, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30171, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29966, 30171, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30171, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29966, 30171, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30171, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30038, 29966, 30171, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30038, 29966, 30171, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30038, 29966, 30171, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30038, 29966, 30171, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29966, 30171, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29966, 30171, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29966, 30171, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29966, 30173, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29966, 30173, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30173, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29966, 30173, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30173, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30038, 29966, 30173, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30173, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30038, 29966, 30173, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30038, 29966, 30173, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30038, 29966, 30173, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30038, 29966, 30173, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30038, 29966, 30173, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30038, 29966, 30173, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30038, 29966, 30173, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30038, 29966, 30173, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30038, 29966, 30173, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30038, 29966, 30175, 30117, 30076]): (45622, 45587, 45599, 45611), frozenset([30038, 29966, 30175, 30117, 30078]): (45622, 45587, 45599, 45612), frozenset([30038, 29966, 30175, 30117, 30082]): (45622, 45587, 45599, 45610), frozenset([30038, 29966, 30175, 30117, 30080]): (45622, 45587, 45599, 45612), frozenset([30038, 29966, 30175, 30118, 30076]): (45622, 45587, 45599, 45611), frozenset([30038, 29966, 30175, 30118, 30078]): (45622, 45587, 45599, 45612), frozenset([30038, 29966, 30175, 30118, 30082]): (45622, 45587, 45599, 45610), frozenset([30038, 29966, 30175, 30118, 30080]): (45622, 45587, 45599, 45612), frozenset([30038, 29966, 30175, 30119, 30076]): (45622, 45587, 45598, 45611), frozenset([30038, 29966, 30175, 30119, 30078]): (45622, 45587, 45598, 45612), frozenset([30038, 29966, 30175, 30119, 30082]): (45622, 45587, 45598, 45610), frozenset([30038, 29966, 30175, 30119, 30080]): (45622, 45587, 45598, 45612), frozenset([30038, 29966, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30038, 29966, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30038, 29966, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30038, 29966, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30038, 29967, 30169, 30117, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30169, 30117, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30169, 30117, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30169, 30117, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30169, 30118, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30169, 30118, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30169, 30118, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30169, 30118, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30169, 30119, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30169, 30119, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30169, 30119, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30169, 30119, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30169, 30120, 30076]): (45623, 45586, 45600, 45611), frozenset([30038, 29967, 30169, 30120, 30078]): (45623, 45586, 45600, 45612), frozenset([30038, 29967, 30169, 30120, 30082]): (45623, 45586, 45600, 45610), frozenset([30038, 29967, 30169, 30120, 30080]): (45623, 45586, 45600, 45612), frozenset([30038, 29967, 30171, 30117, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30171, 30117, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30171, 30117, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30171, 30117, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30171, 30118, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30171, 30118, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30171, 30118, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30171, 30118, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30171, 30119, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30171, 30119, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30171, 30119, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30171, 30119, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30171, 30120, 30076]): (45623, 45586, 45600, 45611), frozenset([30038, 29967, 30171, 30120, 30078]): (45623, 45586, 45600, 45612), frozenset([30038, 29967, 30171, 30120, 30082]): (45623, 45586, 45600, 45610), frozenset([30038, 29967, 30171, 30120, 30080]): (45623, 45586, 45600, 45612), frozenset([30038, 29967, 30173, 30117, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30173, 30117, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30173, 30117, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30173, 30117, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30173, 30118, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30173, 30118, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30173, 30118, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30173, 30118, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30173, 30119, 30076]): (45623, 45587, 45600, 45611), frozenset([30038, 29967, 30173, 30119, 30078]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30173, 30119, 30082]): (45623, 45587, 45600, 45610), frozenset([30038, 29967, 30173, 30119, 30080]): (45623, 45587, 45600, 45612), frozenset([30038, 29967, 30173, 30120, 30076]): (45623, 45586, 45600, 45611), frozenset([30038, 29967, 30173, 30120, 30078]): (45623, 45586, 45600, 45612), frozenset([30038, 29967, 30173, 30120, 30082]): (45623, 45586, 45600, 45610), frozenset([30038, 29967, 30173, 30120, 30080]): (45623, 45586, 45600, 45612), frozenset([30038, 29967, 30175, 30117, 30076]): (45622, 45587, 45600, 45611), frozenset([30038, 29967, 30175, 30117, 30078]): (45622, 45587, 45600, 45612), frozenset([30038, 29967, 30175, 30117, 30082]): (45622, 45587, 45600, 45610), frozenset([30038, 29967, 30175, 30117, 30080]): (45622, 45587, 45600, 45612), frozenset([30038, 29967, 30175, 30118, 30076]): (45622, 45587, 45600, 45611), frozenset([30038, 29967, 30175, 30118, 30078]): (45622, 45587, 45600, 45612), frozenset([30038, 29967, 30175, 30118, 30082]): (45622, 45587, 45600, 45610), frozenset([30038, 29967, 30175, 30118, 30080]): (45622, 45587, 45600, 45612), frozenset([30038, 29967, 30175, 30119, 30076]): (45622, 45587, 45600, 45611), frozenset([30038, 29967, 30175, 30119, 30078]): (45622, 45587, 45600, 45612), frozenset([30038, 29967, 30175, 30119, 30082]): (45622, 45587, 45600, 45610), frozenset([30038, 29967, 30175, 30119, 30080]): (45622, 45587, 45600, 45612), frozenset([30038, 29967, 30175, 30120, 30076]): (45622, 45586, 45600, 45611), frozenset([30038, 29967, 30175, 30120, 30078]): (45622, 45586, 45600, 45612), frozenset([30038, 29967, 30175, 30120, 30082]): (45622, 45586, 45600, 45610), frozenset([30038, 29967, 30175, 30120, 30080]): (45622, 45586, 45600, 45612), frozenset([30040, 29964, 30169, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29964, 30169, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30169, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29964, 30169, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30169, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29964, 30169, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30169, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29964, 30169, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30169, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30040, 29964, 30169, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30040, 29964, 30169, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30040, 29964, 30169, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30040, 29964, 30169, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29964, 30169, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29964, 30169, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29964, 30169, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29964, 30171, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29964, 30171, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30171, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29964, 30171, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30171, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29964, 30171, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30171, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29964, 30171, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30171, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30040, 29964, 30171, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30040, 29964, 30171, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30040, 29964, 30171, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30040, 29964, 30171, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29964, 30171, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29964, 30171, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29964, 30171, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29964, 30173, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29964, 30173, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30173, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29964, 30173, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30173, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29964, 30173, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30173, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29964, 30173, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29964, 30173, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30040, 29964, 30173, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30040, 29964, 30173, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30040, 29964, 30173, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30040, 29964, 30173, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29964, 30173, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29964, 30173, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29964, 30173, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29964, 30175, 30117, 30076]): (45622, 45587, 45599, 45611), frozenset([30040, 29964, 30175, 30117, 30078]): (45622, 45587, 45599, 45612), frozenset([30040, 29964, 30175, 30117, 30082]): (45622, 45587, 45599, 45610), frozenset([30040, 29964, 30175, 30117, 30080]): (45622, 45587, 45599, 45612), frozenset([30040, 29964, 30175, 30118, 30076]): (45622, 45587, 45599, 45611), frozenset([30040, 29964, 30175, 30118, 30078]): (45622, 45587, 45599, 45612), frozenset([30040, 29964, 30175, 30118, 30082]): (45622, 45587, 45599, 45610), frozenset([30040, 29964, 30175, 30118, 30080]): (45622, 45587, 45599, 45612), frozenset([30040, 29964, 30175, 30119, 30076]): (45622, 45587, 45598, 45611), frozenset([30040, 29964, 30175, 30119, 30078]): (45622, 45587, 45598, 45612), frozenset([30040, 29964, 30175, 30119, 30082]): (45622, 45587, 45598, 45610), frozenset([30040, 29964, 30175, 30119, 30080]): (45622, 45587, 45598, 45612), frozenset([30040, 29964, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30040, 29964, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30040, 29964, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30040, 29964, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30040, 29965, 30169, 30117, 30076]): (45623, 45588, 45599, 45611), frozenset([30040, 29965, 30169, 30117, 30078]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30169, 30117, 30082]): (45623, 45588, 45599, 45610), frozenset([30040, 29965, 30169, 30117, 30080]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30169, 30118, 30076]): (45623, 45588, 45599, 45611), frozenset([30040, 29965, 30169, 30118, 30078]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30169, 30118, 30082]): (45623, 45588, 45599, 45610), frozenset([30040, 29965, 30169, 30118, 30080]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30169, 30119, 30076]): (45623, 45588, 45598, 45611), frozenset([30040, 29965, 30169, 30119, 30078]): (45623, 45588, 45598, 45612), frozenset([30040, 29965, 30169, 30119, 30082]): (45623, 45588, 45598, 45610), frozenset([30040, 29965, 30169, 30119, 30080]): (45623, 45588, 45598, 45612), frozenset([30040, 29965, 30169, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29965, 30169, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29965, 30169, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29965, 30169, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29965, 30171, 30117, 30076]): (45623, 45588, 45599, 45611), frozenset([30040, 29965, 30171, 30117, 30078]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30171, 30117, 30082]): (45623, 45588, 45599, 45610), frozenset([30040, 29965, 30171, 30117, 30080]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30171, 30118, 30076]): (45623, 45588, 45599, 45611), frozenset([30040, 29965, 30171, 30118, 30078]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30171, 30118, 30082]): (45623, 45588, 45599, 45610), frozenset([30040, 29965, 30171, 30118, 30080]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30171, 30119, 30076]): (45623, 45588, 45598, 45611), frozenset([30040, 29965, 30171, 30119, 30078]): (45623, 45588, 45598, 45612), frozenset([30040, 29965, 30171, 30119, 30082]): (45623, 45588, 45598, 45610), frozenset([30040, 29965, 30171, 30119, 30080]): (45623, 45588, 45598, 45612), frozenset([30040, 29965, 30171, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29965, 30171, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29965, 30171, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29965, 30171, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29965, 30173, 30117, 30076]): (45623, 45588, 45599, 45611), frozenset([30040, 29965, 30173, 30117, 30078]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30173, 30117, 30082]): (45623, 45588, 45599, 45610), frozenset([30040, 29965, 30173, 30117, 30080]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30173, 30118, 30076]): (45623, 45588, 45599, 45611), frozenset([30040, 29965, 30173, 30118, 30078]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30173, 30118, 30082]): (45623, 45588, 45599, 45610), frozenset([30040, 29965, 30173, 30118, 30080]): (45623, 45588, 45599, 45612), frozenset([30040, 29965, 30173, 30119, 30076]): (45623, 45588, 45598, 45611), frozenset([30040, 29965, 30173, 30119, 30078]): (45623, 45588, 45598, 45612), frozenset([30040, 29965, 30173, 30119, 30082]): (45623, 45588, 45598, 45610), frozenset([30040, 29965, 30173, 30119, 30080]): (45623, 45588, 45598, 45612), frozenset([30040, 29965, 30173, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29965, 30173, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29965, 30173, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29965, 30173, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29965, 30175, 30117, 30076]): (45622, 45588, 45599, 45611), frozenset([30040, 29965, 30175, 30117, 30078]): (45622, 45588, 45599, 45612), frozenset([30040, 29965, 30175, 30117, 30082]): (45622, 45588, 45599, 45610), frozenset([30040, 29965, 30175, 30117, 30080]): (45622, 45588, 45599, 45612), frozenset([30040, 29965, 30175, 30118, 30076]): (45622, 45588, 45599, 45611), frozenset([30040, 29965, 30175, 30118, 30078]): (45622, 45588, 45599, 45612), frozenset([30040, 29965, 30175, 30118, 30082]): (45622, 45588, 45599, 45610), frozenset([30040, 29965, 30175, 30118, 30080]): (45622, 45588, 45599, 45612), frozenset([30040, 29965, 30175, 30119, 30076]): (45622, 45588, 45598, 45611), frozenset([30040, 29965, 30175, 30119, 30078]): (45622, 45588, 45598, 45612), frozenset([30040, 29965, 30175, 30119, 30082]): (45622, 45588, 45598, 45610), frozenset([30040, 29965, 30175, 30119, 30080]): (45622, 45588, 45598, 45612), frozenset([30040, 29965, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30040, 29965, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30040, 29965, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30040, 29965, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30040, 29966, 30169, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29966, 30169, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30169, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29966, 30169, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30169, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29966, 30169, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30169, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29966, 30169, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30169, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30040, 29966, 30169, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30040, 29966, 30169, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30040, 29966, 30169, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30040, 29966, 30169, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29966, 30169, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29966, 30169, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29966, 30169, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29966, 30171, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29966, 30171, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30171, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29966, 30171, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30171, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29966, 30171, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30171, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29966, 30171, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30171, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30040, 29966, 30171, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30040, 29966, 30171, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30040, 29966, 30171, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30040, 29966, 30171, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29966, 30171, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29966, 30171, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29966, 30171, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29966, 30173, 30117, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29966, 30173, 30117, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30173, 30117, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29966, 30173, 30117, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30173, 30118, 30076]): (45623, 45587, 45599, 45611), frozenset([30040, 29966, 30173, 30118, 30078]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30173, 30118, 30082]): (45623, 45587, 45599, 45610), frozenset([30040, 29966, 30173, 30118, 30080]): (45623, 45587, 45599, 45612), frozenset([30040, 29966, 30173, 30119, 30076]): (45623, 45587, 45598, 45611), frozenset([30040, 29966, 30173, 30119, 30078]): (45623, 45587, 45598, 45612), frozenset([30040, 29966, 30173, 30119, 30082]): (45623, 45587, 45598, 45610), frozenset([30040, 29966, 30173, 30119, 30080]): (45623, 45587, 45598, 45612), frozenset([30040, 29966, 30173, 30120, 30076]): (45623, 45586, 45598, 45611), frozenset([30040, 29966, 30173, 30120, 30078]): (45623, 45586, 45598, 45612), frozenset([30040, 29966, 30173, 30120, 30082]): (45623, 45586, 45598, 45610), frozenset([30040, 29966, 30173, 30120, 30080]): (45623, 45586, 45598, 45612), frozenset([30040, 29966, 30175, 30117, 30076]): (45622, 45587, 45599, 45611), frozenset([30040, 29966, 30175, 30117, 30078]): (45622, 45587, 45599, 45612), frozenset([30040, 29966, 30175, 30117, 30082]): (45622, 45587, 45599, 45610), frozenset([30040, 29966, 30175, 30117, 30080]): (45622, 45587, 45599, 45612), frozenset([30040, 29966, 30175, 30118, 30076]): (45622, 45587, 45599, 45611), frozenset([30040, 29966, 30175, 30118, 30078]): (45622, 45587, 45599, 45612), frozenset([30040, 29966, 30175, 30118, 30082]): (45622, 45587, 45599, 45610), frozenset([30040, 29966, 30175, 30118, 30080]): (45622, 45587, 45599, 45612), frozenset([30040, 29966, 30175, 30119, 30076]): (45622, 45587, 45598, 45611), frozenset([30040, 29966, 30175, 30119, 30078]): (45622, 45587, 45598, 45612), frozenset([30040, 29966, 30175, 30119, 30082]): (45622, 45587, 45598, 45610), frozenset([30040, 29966, 30175, 30119, 30080]): (45622, 45587, 45598, 45612), frozenset([30040, 29966, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30040, 29966, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30040, 29966, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30040, 29966, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30040, 29967, 30169, 30117, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30169, 30117, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30169, 30117, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30169, 30117, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30169, 30118, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30169, 30118, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30169, 30118, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30169, 30118, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30169, 30119, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30169, 30119, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30169, 30119, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30169, 30119, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30169, 30120, 30076]): (45623, 45586, 45600, 45611), frozenset([30040, 29967, 30169, 30120, 30078]): (45623, 45586, 45600, 45612), frozenset([30040, 29967, 30169, 30120, 30082]): (45623, 45586, 45600, 45610), frozenset([30040, 29967, 30169, 30120, 30080]): (45623, 45586, 45600, 45612), frozenset([30040, 29967, 30171, 30117, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30171, 30117, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30171, 30117, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30171, 30117, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30171, 30118, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30171, 30118, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30171, 30118, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30171, 30118, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30171, 30119, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30171, 30119, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30171, 30119, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30171, 30119, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30171, 30120, 30076]): (45623, 45586, 45600, 45611), frozenset([30040, 29967, 30171, 30120, 30078]): (45623, 45586, 45600, 45612), frozenset([30040, 29967, 30171, 30120, 30082]): (45623, 45586, 45600, 45610), frozenset([30040, 29967, 30171, 30120, 30080]): (45623, 45586, 45600, 45612), frozenset([30040, 29967, 30173, 30117, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30173, 30117, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30173, 30117, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30173, 30117, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30173, 30118, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30173, 30118, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30173, 30118, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30173, 30118, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30173, 30119, 30076]): (45623, 45587, 45600, 45611), frozenset([30040, 29967, 30173, 30119, 30078]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30173, 30119, 30082]): (45623, 45587, 45600, 45610), frozenset([30040, 29967, 30173, 30119, 30080]): (45623, 45587, 45600, 45612), frozenset([30040, 29967, 30173, 30120, 30076]): (45623, 45586, 45600, 45611), frozenset([30040, 29967, 30173, 30120, 30078]): (45623, 45586, 45600, 45612), frozenset([30040, 29967, 30173, 30120, 30082]): (45623, 45586, 45600, 45610), frozenset([30040, 29967, 30173, 30120, 30080]): (45623, 45586, 45600, 45612), frozenset([30040, 29967, 30175, 30117, 30076]): (45622, 45587, 45600, 45611), frozenset([30040, 29967, 30175, 30117, 30078]): (45622, 45587, 45600, 45612), frozenset([30040, 29967, 30175, 30117, 30082]): (45622, 45587, 45600, 45610), frozenset([30040, 29967, 30175, 30117, 30080]): (45622, 45587, 45600, 45612), frozenset([30040, 29967, 30175, 30118, 30076]): (45622, 45587, 45600, 45611), frozenset([30040, 29967, 30175, 30118, 30078]): (45622, 45587, 45600, 45612), frozenset([30040, 29967, 30175, 30118, 30082]): (45622, 45587, 45600, 45610), frozenset([30040, 29967, 30175, 30118, 30080]): (45622, 45587, 45600, 45612), frozenset([30040, 29967, 30175, 30119, 30076]): (45622, 45587, 45600, 45611), frozenset([30040, 29967, 30175, 30119, 30078]): (45622, 45587, 45600, 45612), frozenset([30040, 29967, 30175, 30119, 30082]): (45622, 45587, 45600, 45610), frozenset([30040, 29967, 30175, 30119, 30080]): (45622, 45587, 45600, 45612), frozenset([30040, 29967, 30175, 30120, 30076]): (45622, 45586, 45600, 45611), frozenset([30040, 29967, 30175, 30120, 30078]): (45622, 45586, 45600, 45612), frozenset([30040, 29967, 30175, 30120, 30082]): (45622, 45586, 45600, 45610), frozenset([30040, 29967, 30175, 30120, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29964, 30169, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29964, 30169, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30169, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29964, 30169, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30169, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29964, 30169, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30169, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29964, 30169, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30169, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29964, 30169, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30169, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29964, 30169, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30169, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29964, 30169, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30169, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29964, 30169, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30171, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29964, 30171, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30171, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29964, 30171, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30171, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29964, 30171, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30171, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29964, 30171, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30171, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29964, 30171, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30171, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29964, 30171, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30171, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29964, 30171, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30171, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29964, 30171, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30173, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29964, 30173, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30173, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29964, 30173, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30173, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29964, 30173, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30173, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29964, 30173, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30173, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29964, 30173, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30173, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29964, 30173, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30173, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29964, 30173, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30173, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29964, 30173, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30175, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29964, 30175, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30175, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29964, 30175, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30175, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29964, 30175, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30175, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29964, 30175, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29964, 30175, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29964, 30175, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30175, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29964, 30175, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29964, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29964, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29964, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30169, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29965, 30169, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30169, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29965, 30169, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30169, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29965, 30169, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30169, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29965, 30169, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30169, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29965, 30169, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30169, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29965, 30169, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30169, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29965, 30169, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30169, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29965, 30169, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30171, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29965, 30171, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30171, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29965, 30171, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30171, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29965, 30171, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30171, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29965, 30171, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30171, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29965, 30171, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30171, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29965, 30171, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30171, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29965, 30171, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30171, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29965, 30171, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30173, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29965, 30173, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30173, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29965, 30173, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30173, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29965, 30173, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30173, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29965, 30173, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30173, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29965, 30173, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30173, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29965, 30173, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30173, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29965, 30173, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30173, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29965, 30173, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30175, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29965, 30175, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30175, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29965, 30175, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30175, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29965, 30175, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30175, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29965, 30175, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29965, 30175, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29965, 30175, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30175, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29965, 30175, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29965, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29965, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29965, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30169, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29966, 30169, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30169, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29966, 30169, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30169, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29966, 30169, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30169, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29966, 30169, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30169, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29966, 30169, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30169, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29966, 30169, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30169, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29966, 30169, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30169, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29966, 30169, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30171, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29966, 30171, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30171, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29966, 30171, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30171, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29966, 30171, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30171, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29966, 30171, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30171, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29966, 30171, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30171, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29966, 30171, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30171, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29966, 30171, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30171, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29966, 30171, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30173, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29966, 30173, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30173, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29966, 30173, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30173, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29966, 30173, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30173, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29966, 30173, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30173, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29966, 30173, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30173, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29966, 30173, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30173, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29966, 30173, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30173, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29966, 30173, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30175, 30117, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29966, 30175, 30117, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30175, 30117, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29966, 30175, 30117, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30175, 30118, 30076]): (45622, 45586, 45599, 45611), frozenset([30042, 29966, 30175, 30118, 30078]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30175, 30118, 30082]): (45622, 45586, 45599, 45610), frozenset([30042, 29966, 30175, 30118, 30080]): (45622, 45586, 45599, 45612), frozenset([30042, 29966, 30175, 30119, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29966, 30175, 30119, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30175, 30119, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29966, 30175, 30119, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30175, 30120, 30076]): (45622, 45586, 45598, 45611), frozenset([30042, 29966, 30175, 30120, 30078]): (45622, 45586, 45598, 45612), frozenset([30042, 29966, 30175, 30120, 30082]): (45622, 45586, 45598, 45610), frozenset([30042, 29966, 30175, 30120, 30080]): (45622, 45586, 45598, 45612), frozenset([30042, 29967, 30169, 30117, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30169, 30117, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30169, 30117, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30169, 30117, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30169, 30118, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30169, 30118, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30169, 30118, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30169, 30118, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30169, 30119, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30169, 30119, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30169, 30119, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30169, 30119, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30169, 30120, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30169, 30120, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30169, 30120, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30169, 30120, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30171, 30117, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30171, 30117, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30171, 30117, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30171, 30117, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30171, 30118, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30171, 30118, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30171, 30118, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30171, 30118, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30171, 30119, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30171, 30119, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30171, 30119, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30171, 30119, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30171, 30120, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30171, 30120, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30171, 30120, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30171, 30120, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30173, 30117, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30173, 30117, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30173, 30117, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30173, 30117, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30173, 30118, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30173, 30118, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30173, 30118, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30173, 30118, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30173, 30119, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30173, 30119, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30173, 30119, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30173, 30119, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30173, 30120, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30173, 30120, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30173, 30120, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30173, 30120, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30175, 30117, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30175, 30117, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30175, 30117, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30175, 30117, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30175, 30118, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30175, 30118, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30175, 30118, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30175, 30118, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30175, 30119, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30175, 30119, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30175, 30119, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30175, 30119, 30080]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30175, 30120, 30076]): (45622, 45586, 45600, 45611), frozenset([30042, 29967, 30175, 30120, 30078]): (45622, 45586, 45600, 45612), frozenset([30042, 29967, 30175, 30120, 30082]): (45622, 45586, 45600, 45610), frozenset([30042, 29967, 30175, 30120, 30080]): (45622, 45586, 45600, 45612), frozenset([30056, 29979, 30149, 30127, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29979, 30149, 30127, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29979, 30149, 30127, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30149, 30127, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30149, 30128, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29979, 30149, 30128, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29979, 30149, 30128, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30149, 30128, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30149, 30129, 30100]): (45630, 45593, 45605, 45617), frozenset([30056, 29979, 30149, 30129, 30102]): (45630, 45593, 45605, 45616), frozenset([30056, 29979, 30149, 30129, 30098]): (45630, 45593, 45605, 45618), frozenset([30056, 29979, 30149, 30129, 30096]): (45630, 45593, 45605, 45618), frozenset([30056, 29979, 30149, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29979, 30149, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29979, 30149, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29979, 30149, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29979, 30151, 30127, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29979, 30151, 30127, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29979, 30151, 30127, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30151, 30127, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30151, 30128, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29979, 30151, 30128, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29979, 30151, 30128, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30151, 30128, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30151, 30129, 30100]): (45630, 45593, 45605, 45617), frozenset([30056, 29979, 30151, 30129, 30102]): (45630, 45593, 45605, 45616), frozenset([30056, 29979, 30151, 30129, 30098]): (45630, 45593, 45605, 45618), frozenset([30056, 29979, 30151, 30129, 30096]): (45630, 45593, 45605, 45618), frozenset([30056, 29979, 30151, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29979, 30151, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29979, 30151, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29979, 30151, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29979, 30153, 30127, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29979, 30153, 30127, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29979, 30153, 30127, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30153, 30127, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30153, 30128, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29979, 30153, 30128, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29979, 30153, 30128, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30153, 30128, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30153, 30129, 30100]): (45630, 45593, 45605, 45617), frozenset([30056, 29979, 30153, 30129, 30102]): (45630, 45593, 45605, 45616), frozenset([30056, 29979, 30153, 30129, 30098]): (45630, 45593, 45605, 45618), frozenset([30056, 29979, 30153, 30129, 30096]): (45630, 45593, 45605, 45618), frozenset([30056, 29979, 30153, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29979, 30153, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29979, 30153, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29979, 30153, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29979, 30155, 30127, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29979, 30155, 30127, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29979, 30155, 30127, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30155, 30127, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30155, 30128, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29979, 30155, 30128, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29979, 30155, 30128, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30155, 30128, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29979, 30155, 30129, 30100]): (45630, 45593, 45605, 45617), frozenset([30056, 29979, 30155, 30129, 30102]): (45630, 45593, 45605, 45616), frozenset([30056, 29979, 30155, 30129, 30098]): (45630, 45593, 45605, 45618), frozenset([30056, 29979, 30155, 30129, 30096]): (45630, 45593, 45605, 45618), frozenset([30056, 29979, 30155, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29979, 30155, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29979, 30155, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29979, 30155, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29980, 30149, 30127, 30100]): (45630, 45594, 45604, 45617), frozenset([30056, 29980, 30149, 30127, 30102]): (45630, 45594, 45604, 45616), frozenset([30056, 29980, 30149, 30127, 30098]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30149, 30127, 30096]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30149, 30128, 30100]): (45630, 45594, 45604, 45617), frozenset([30056, 29980, 30149, 30128, 30102]): (45630, 45594, 45604, 45616), frozenset([30056, 29980, 30149, 30128, 30098]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30149, 30128, 30096]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30149, 30129, 30100]): (45630, 45594, 45605, 45617), frozenset([30056, 29980, 30149, 30129, 30102]): (45630, 45594, 45605, 45616), frozenset([30056, 29980, 30149, 30129, 30098]): (45630, 45594, 45605, 45618), frozenset([30056, 29980, 30149, 30129, 30096]): (45630, 45594, 45605, 45618), frozenset([30056, 29980, 30149, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29980, 30149, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29980, 30149, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29980, 30149, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29980, 30151, 30127, 30100]): (45630, 45594, 45604, 45617), frozenset([30056, 29980, 30151, 30127, 30102]): (45630, 45594, 45604, 45616), frozenset([30056, 29980, 30151, 30127, 30098]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30151, 30127, 30096]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30151, 30128, 30100]): (45630, 45594, 45604, 45617), frozenset([30056, 29980, 30151, 30128, 30102]): (45630, 45594, 45604, 45616), frozenset([30056, 29980, 30151, 30128, 30098]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30151, 30128, 30096]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30151, 30129, 30100]): (45630, 45594, 45605, 45617), frozenset([30056, 29980, 30151, 30129, 30102]): (45630, 45594, 45605, 45616), frozenset([30056, 29980, 30151, 30129, 30098]): (45630, 45594, 45605, 45618), frozenset([30056, 29980, 30151, 30129, 30096]): (45630, 45594, 45605, 45618), frozenset([30056, 29980, 30151, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29980, 30151, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29980, 30151, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29980, 30151, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29980, 30153, 30127, 30100]): (45630, 45594, 45604, 45617), frozenset([30056, 29980, 30153, 30127, 30102]): (45630, 45594, 45604, 45616), frozenset([30056, 29980, 30153, 30127, 30098]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30153, 30127, 30096]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30153, 30128, 30100]): (45630, 45594, 45604, 45617), frozenset([30056, 29980, 30153, 30128, 30102]): (45630, 45594, 45604, 45616), frozenset([30056, 29980, 30153, 30128, 30098]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30153, 30128, 30096]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30153, 30129, 30100]): (45630, 45594, 45605, 45617), frozenset([30056, 29980, 30153, 30129, 30102]): (45630, 45594, 45605, 45616), frozenset([30056, 29980, 30153, 30129, 30098]): (45630, 45594, 45605, 45618), frozenset([30056, 29980, 30153, 30129, 30096]): (45630, 45594, 45605, 45618), frozenset([30056, 29980, 30153, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29980, 30153, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29980, 30153, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29980, 30153, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29980, 30155, 30127, 30100]): (45630, 45594, 45604, 45617), frozenset([30056, 29980, 30155, 30127, 30102]): (45630, 45594, 45604, 45616), frozenset([30056, 29980, 30155, 30127, 30098]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30155, 30127, 30096]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30155, 30128, 30100]): (45630, 45594, 45604, 45617), frozenset([30056, 29980, 30155, 30128, 30102]): (45630, 45594, 45604, 45616), frozenset([30056, 29980, 30155, 30128, 30098]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30155, 30128, 30096]): (45630, 45594, 45604, 45618), frozenset([30056, 29980, 30155, 30129, 30100]): (45630, 45594, 45605, 45617), frozenset([30056, 29980, 30155, 30129, 30102]): (45630, 45594, 45605, 45616), frozenset([30056, 29980, 30155, 30129, 30098]): (45630, 45594, 45605, 45618), frozenset([30056, 29980, 30155, 30129, 30096]): (45630, 45594, 45605, 45618), frozenset([30056, 29980, 30155, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29980, 30155, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29980, 30155, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29980, 30155, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29981, 30149, 30127, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29981, 30149, 30127, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29981, 30149, 30127, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30149, 30127, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30149, 30128, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29981, 30149, 30128, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29981, 30149, 30128, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30149, 30128, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30149, 30129, 30100]): (45630, 45593, 45605, 45617), frozenset([30056, 29981, 30149, 30129, 30102]): (45630, 45593, 45605, 45616), frozenset([30056, 29981, 30149, 30129, 30098]): (45630, 45593, 45605, 45618), frozenset([30056, 29981, 30149, 30129, 30096]): (45630, 45593, 45605, 45618), frozenset([30056, 29981, 30149, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29981, 30149, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29981, 30149, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29981, 30149, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29981, 30151, 30127, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29981, 30151, 30127, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29981, 30151, 30127, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30151, 30127, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30151, 30128, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29981, 30151, 30128, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29981, 30151, 30128, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30151, 30128, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30151, 30129, 30100]): (45630, 45593, 45605, 45617), frozenset([30056, 29981, 30151, 30129, 30102]): (45630, 45593, 45605, 45616), frozenset([30056, 29981, 30151, 30129, 30098]): (45630, 45593, 45605, 45618), frozenset([30056, 29981, 30151, 30129, 30096]): (45630, 45593, 45605, 45618), frozenset([30056, 29981, 30151, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29981, 30151, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29981, 30151, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29981, 30151, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29981, 30153, 30127, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29981, 30153, 30127, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29981, 30153, 30127, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30153, 30127, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30153, 30128, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29981, 30153, 30128, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29981, 30153, 30128, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30153, 30128, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30153, 30129, 30100]): (45630, 45593, 45605, 45617), frozenset([30056, 29981, 30153, 30129, 30102]): (45630, 45593, 45605, 45616), frozenset([30056, 29981, 30153, 30129, 30098]): (45630, 45593, 45605, 45618), frozenset([30056, 29981, 30153, 30129, 30096]): (45630, 45593, 45605, 45618), frozenset([30056, 29981, 30153, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29981, 30153, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29981, 30153, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29981, 30153, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29981, 30155, 30127, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29981, 30155, 30127, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29981, 30155, 30127, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30155, 30127, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30155, 30128, 30100]): (45630, 45593, 45604, 45617), frozenset([30056, 29981, 30155, 30128, 30102]): (45630, 45593, 45604, 45616), frozenset([30056, 29981, 30155, 30128, 30098]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30155, 30128, 30096]): (45630, 45593, 45604, 45618), frozenset([30056, 29981, 30155, 30129, 30100]): (45630, 45593, 45605, 45617), frozenset([30056, 29981, 30155, 30129, 30102]): (45630, 45593, 45605, 45616), frozenset([30056, 29981, 30155, 30129, 30098]): (45630, 45593, 45605, 45618), frozenset([30056, 29981, 30155, 30129, 30096]): (45630, 45593, 45605, 45618), frozenset([30056, 29981, 30155, 30130, 30100]): (45630, 45592, 45604, 45617), frozenset([30056, 29981, 30155, 30130, 30102]): (45630, 45592, 45604, 45616), frozenset([30056, 29981, 30155, 30130, 30098]): (45630, 45592, 45604, 45618), frozenset([30056, 29981, 30155, 30130, 30096]): (45630, 45592, 45604, 45618), frozenset([30056, 29982, 30149, 30127, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30149, 30127, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30149, 30127, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30149, 30127, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30149, 30128, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30149, 30128, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30149, 30128, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30149, 30128, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30149, 30129, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30149, 30129, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30149, 30129, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30149, 30129, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30149, 30130, 30100]): (45630, 45592, 45606, 45617), frozenset([30056, 29982, 30149, 30130, 30102]): (45630, 45592, 45606, 45616), frozenset([30056, 29982, 30149, 30130, 30098]): (45630, 45592, 45606, 45618), frozenset([30056, 29982, 30149, 30130, 30096]): (45630, 45592, 45606, 45618), frozenset([30056, 29982, 30151, 30127, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30151, 30127, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30151, 30127, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30151, 30127, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30151, 30128, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30151, 30128, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30151, 30128, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30151, 30128, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30151, 30129, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30151, 30129, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30151, 30129, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30151, 30129, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30151, 30130, 30100]): (45630, 45592, 45606, 45617), frozenset([30056, 29982, 30151, 30130, 30102]): (45630, 45592, 45606, 45616), frozenset([30056, 29982, 30151, 30130, 30098]): (45630, 45592, 45606, 45618), frozenset([30056, 29982, 30151, 30130, 30096]): (45630, 45592, 45606, 45618), frozenset([30056, 29982, 30153, 30127, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30153, 30127, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30153, 30127, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30153, 30127, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30153, 30128, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30153, 30128, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30153, 30128, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30153, 30128, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30153, 30129, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30153, 30129, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30153, 30129, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30153, 30129, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30153, 30130, 30100]): (45630, 45592, 45606, 45617), frozenset([30056, 29982, 30153, 30130, 30102]): (45630, 45592, 45606, 45616), frozenset([30056, 29982, 30153, 30130, 30098]): (45630, 45592, 45606, 45618), frozenset([30056, 29982, 30153, 30130, 30096]): (45630, 45592, 45606, 45618), frozenset([30056, 29982, 30155, 30127, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30155, 30127, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30155, 30127, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30155, 30127, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30155, 30128, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30155, 30128, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30155, 30128, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30155, 30128, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30155, 30129, 30100]): (45630, 45593, 45606, 45617), frozenset([30056, 29982, 30155, 30129, 30102]): (45630, 45593, 45606, 45616), frozenset([30056, 29982, 30155, 30129, 30098]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30155, 30129, 30096]): (45630, 45593, 45606, 45618), frozenset([30056, 29982, 30155, 30130, 30100]): (45630, 45592, 45606, 45617), frozenset([30056, 29982, 30155, 30130, 30102]): (45630, 45592, 45606, 45616), frozenset([30056, 29982, 30155, 30130, 30098]): (45630, 45592, 45606, 45618), frozenset([30056, 29982, 30155, 30130, 30096]): (45630, 45592, 45606, 45618), frozenset([30058, 29979, 30149, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29979, 30149, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29979, 30149, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30149, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30149, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29979, 30149, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29979, 30149, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30149, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30149, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30058, 29979, 30149, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30058, 29979, 30149, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30058, 29979, 30149, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30058, 29979, 30149, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29979, 30149, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29979, 30149, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29979, 30149, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29979, 30151, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29979, 30151, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29979, 30151, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30151, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30151, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29979, 30151, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29979, 30151, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30151, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30151, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30058, 29979, 30151, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30058, 29979, 30151, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30058, 29979, 30151, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30058, 29979, 30151, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29979, 30151, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29979, 30151, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29979, 30151, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29979, 30153, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29979, 30153, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29979, 30153, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30153, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30153, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29979, 30153, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29979, 30153, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30153, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29979, 30153, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30058, 29979, 30153, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30058, 29979, 30153, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30058, 29979, 30153, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30058, 29979, 30153, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29979, 30153, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29979, 30153, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29979, 30153, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29979, 30155, 30127, 30100]): (45628, 45593, 45604, 45617), frozenset([30058, 29979, 30155, 30127, 30102]): (45628, 45593, 45604, 45616), frozenset([30058, 29979, 30155, 30127, 30098]): (45628, 45593, 45604, 45618), frozenset([30058, 29979, 30155, 30127, 30096]): (45628, 45593, 45604, 45618), frozenset([30058, 29979, 30155, 30128, 30100]): (45628, 45593, 45604, 45617), frozenset([30058, 29979, 30155, 30128, 30102]): (45628, 45593, 45604, 45616), frozenset([30058, 29979, 30155, 30128, 30098]): (45628, 45593, 45604, 45618), frozenset([30058, 29979, 30155, 30128, 30096]): (45628, 45593, 45604, 45618), frozenset([30058, 29979, 30155, 30129, 30100]): (45628, 45593, 45605, 45617), frozenset([30058, 29979, 30155, 30129, 30102]): (45628, 45593, 45605, 45616), frozenset([30058, 29979, 30155, 30129, 30098]): (45628, 45593, 45605, 45618), frozenset([30058, 29979, 30155, 30129, 30096]): (45628, 45593, 45605, 45618), frozenset([30058, 29979, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30058, 29979, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30058, 29979, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30058, 29979, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30058, 29980, 30149, 30127, 30100]): (45629, 45594, 45604, 45617), frozenset([30058, 29980, 30149, 30127, 30102]): (45629, 45594, 45604, 45616), frozenset([30058, 29980, 30149, 30127, 30098]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30149, 30127, 30096]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30149, 30128, 30100]): (45629, 45594, 45604, 45617), frozenset([30058, 29980, 30149, 30128, 30102]): (45629, 45594, 45604, 45616), frozenset([30058, 29980, 30149, 30128, 30098]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30149, 30128, 30096]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30149, 30129, 30100]): (45629, 45594, 45605, 45617), frozenset([30058, 29980, 30149, 30129, 30102]): (45629, 45594, 45605, 45616), frozenset([30058, 29980, 30149, 30129, 30098]): (45629, 45594, 45605, 45618), frozenset([30058, 29980, 30149, 30129, 30096]): (45629, 45594, 45605, 45618), frozenset([30058, 29980, 30149, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29980, 30149, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29980, 30149, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29980, 30149, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29980, 30151, 30127, 30100]): (45629, 45594, 45604, 45617), frozenset([30058, 29980, 30151, 30127, 30102]): (45629, 45594, 45604, 45616), frozenset([30058, 29980, 30151, 30127, 30098]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30151, 30127, 30096]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30151, 30128, 30100]): (45629, 45594, 45604, 45617), frozenset([30058, 29980, 30151, 30128, 30102]): (45629, 45594, 45604, 45616), frozenset([30058, 29980, 30151, 30128, 30098]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30151, 30128, 30096]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30151, 30129, 30100]): (45629, 45594, 45605, 45617), frozenset([30058, 29980, 30151, 30129, 30102]): (45629, 45594, 45605, 45616), frozenset([30058, 29980, 30151, 30129, 30098]): (45629, 45594, 45605, 45618), frozenset([30058, 29980, 30151, 30129, 30096]): (45629, 45594, 45605, 45618), frozenset([30058, 29980, 30151, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29980, 30151, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29980, 30151, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29980, 30151, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29980, 30153, 30127, 30100]): (45629, 45594, 45604, 45617), frozenset([30058, 29980, 30153, 30127, 30102]): (45629, 45594, 45604, 45616), frozenset([30058, 29980, 30153, 30127, 30098]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30153, 30127, 30096]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30153, 30128, 30100]): (45629, 45594, 45604, 45617), frozenset([30058, 29980, 30153, 30128, 30102]): (45629, 45594, 45604, 45616), frozenset([30058, 29980, 30153, 30128, 30098]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30153, 30128, 30096]): (45629, 45594, 45604, 45618), frozenset([30058, 29980, 30153, 30129, 30100]): (45629, 45594, 45605, 45617), frozenset([30058, 29980, 30153, 30129, 30102]): (45629, 45594, 45605, 45616), frozenset([30058, 29980, 30153, 30129, 30098]): (45629, 45594, 45605, 45618), frozenset([30058, 29980, 30153, 30129, 30096]): (45629, 45594, 45605, 45618), frozenset([30058, 29980, 30153, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29980, 30153, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29980, 30153, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29980, 30153, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29980, 30155, 30127, 30100]): (45628, 45594, 45604, 45617), frozenset([30058, 29980, 30155, 30127, 30102]): (45628, 45594, 45604, 45616), frozenset([30058, 29980, 30155, 30127, 30098]): (45628, 45594, 45604, 45618), frozenset([30058, 29980, 30155, 30127, 30096]): (45628, 45594, 45604, 45618), frozenset([30058, 29980, 30155, 30128, 30100]): (45628, 45594, 45604, 45617), frozenset([30058, 29980, 30155, 30128, 30102]): (45628, 45594, 45604, 45616), frozenset([30058, 29980, 30155, 30128, 30098]): (45628, 45594, 45604, 45618), frozenset([30058, 29980, 30155, 30128, 30096]): (45628, 45594, 45604, 45618), frozenset([30058, 29980, 30155, 30129, 30100]): (45628, 45594, 45605, 45617), frozenset([30058, 29980, 30155, 30129, 30102]): (45628, 45594, 45605, 45616), frozenset([30058, 29980, 30155, 30129, 30098]): (45628, 45594, 45605, 45618), frozenset([30058, 29980, 30155, 30129, 30096]): (45628, 45594, 45605, 45618), frozenset([30058, 29980, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30058, 29980, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30058, 29980, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30058, 29980, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30058, 29981, 30149, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29981, 30149, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29981, 30149, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30149, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30149, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29981, 30149, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29981, 30149, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30149, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30149, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30058, 29981, 30149, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30058, 29981, 30149, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30058, 29981, 30149, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30058, 29981, 30149, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29981, 30149, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29981, 30149, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29981, 30149, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29981, 30151, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29981, 30151, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29981, 30151, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30151, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30151, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29981, 30151, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29981, 30151, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30151, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30151, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30058, 29981, 30151, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30058, 29981, 30151, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30058, 29981, 30151, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30058, 29981, 30151, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29981, 30151, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29981, 30151, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29981, 30151, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29981, 30153, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29981, 30153, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29981, 30153, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30153, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30153, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30058, 29981, 30153, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30058, 29981, 30153, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30153, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30058, 29981, 30153, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30058, 29981, 30153, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30058, 29981, 30153, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30058, 29981, 30153, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30058, 29981, 30153, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30058, 29981, 30153, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30058, 29981, 30153, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30058, 29981, 30153, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30058, 29981, 30155, 30127, 30100]): (45628, 45593, 45604, 45617), frozenset([30058, 29981, 30155, 30127, 30102]): (45628, 45593, 45604, 45616), frozenset([30058, 29981, 30155, 30127, 30098]): (45628, 45593, 45604, 45618), frozenset([30058, 29981, 30155, 30127, 30096]): (45628, 45593, 45604, 45618), frozenset([30058, 29981, 30155, 30128, 30100]): (45628, 45593, 45604, 45617), frozenset([30058, 29981, 30155, 30128, 30102]): (45628, 45593, 45604, 45616), frozenset([30058, 29981, 30155, 30128, 30098]): (45628, 45593, 45604, 45618), frozenset([30058, 29981, 30155, 30128, 30096]): (45628, 45593, 45604, 45618), frozenset([30058, 29981, 30155, 30129, 30100]): (45628, 45593, 45605, 45617), frozenset([30058, 29981, 30155, 30129, 30102]): (45628, 45593, 45605, 45616), frozenset([30058, 29981, 30155, 30129, 30098]): (45628, 45593, 45605, 45618), frozenset([30058, 29981, 30155, 30129, 30096]): (45628, 45593, 45605, 45618), frozenset([30058, 29981, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30058, 29981, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30058, 29981, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30058, 29981, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30058, 29982, 30149, 30127, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30149, 30127, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30149, 30127, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30149, 30127, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30149, 30128, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30149, 30128, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30149, 30128, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30149, 30128, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30149, 30129, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30149, 30129, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30149, 30129, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30149, 30129, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30149, 30130, 30100]): (45629, 45592, 45606, 45617), frozenset([30058, 29982, 30149, 30130, 30102]): (45629, 45592, 45606, 45616), frozenset([30058, 29982, 30149, 30130, 30098]): (45629, 45592, 45606, 45618), frozenset([30058, 29982, 30149, 30130, 30096]): (45629, 45592, 45606, 45618), frozenset([30058, 29982, 30151, 30127, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30151, 30127, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30151, 30127, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30151, 30127, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30151, 30128, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30151, 30128, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30151, 30128, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30151, 30128, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30151, 30129, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30151, 30129, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30151, 30129, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30151, 30129, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30151, 30130, 30100]): (45629, 45592, 45606, 45617), frozenset([30058, 29982, 30151, 30130, 30102]): (45629, 45592, 45606, 45616), frozenset([30058, 29982, 30151, 30130, 30098]): (45629, 45592, 45606, 45618), frozenset([30058, 29982, 30151, 30130, 30096]): (45629, 45592, 45606, 45618), frozenset([30058, 29982, 30153, 30127, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30153, 30127, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30153, 30127, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30153, 30127, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30153, 30128, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30153, 30128, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30153, 30128, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30153, 30128, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30153, 30129, 30100]): (45629, 45593, 45606, 45617), frozenset([30058, 29982, 30153, 30129, 30102]): (45629, 45593, 45606, 45616), frozenset([30058, 29982, 30153, 30129, 30098]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30153, 30129, 30096]): (45629, 45593, 45606, 45618), frozenset([30058, 29982, 30153, 30130, 30100]): (45629, 45592, 45606, 45617), frozenset([30058, 29982, 30153, 30130, 30102]): (45629, 45592, 45606, 45616), frozenset([30058, 29982, 30153, 30130, 30098]): (45629, 45592, 45606, 45618), frozenset([30058, 29982, 30153, 30130, 30096]): (45629, 45592, 45606, 45618), frozenset([30058, 29982, 30155, 30127, 30100]): (45628, 45593, 45606, 45617), frozenset([30058, 29982, 30155, 30127, 30102]): (45628, 45593, 45606, 45616), frozenset([30058, 29982, 30155, 30127, 30098]): (45628, 45593, 45606, 45618), frozenset([30058, 29982, 30155, 30127, 30096]): (45628, 45593, 45606, 45618), frozenset([30058, 29982, 30155, 30128, 30100]): (45628, 45593, 45606, 45617), frozenset([30058, 29982, 30155, 30128, 30102]): (45628, 45593, 45606, 45616), frozenset([30058, 29982, 30155, 30128, 30098]): (45628, 45593, 45606, 45618), frozenset([30058, 29982, 30155, 30128, 30096]): (45628, 45593, 45606, 45618), frozenset([30058, 29982, 30155, 30129, 30100]): (45628, 45593, 45606, 45617), frozenset([30058, 29982, 30155, 30129, 30102]): (45628, 45593, 45606, 45616), frozenset([30058, 29982, 30155, 30129, 30098]): (45628, 45593, 45606, 45618), frozenset([30058, 29982, 30155, 30129, 30096]): (45628, 45593, 45606, 45618), frozenset([30058, 29982, 30155, 30130, 30100]): (45628, 45592, 45606, 45617), frozenset([30058, 29982, 30155, 30130, 30102]): (45628, 45592, 45606, 45616), frozenset([30058, 29982, 30155, 30130, 30098]): (45628, 45592, 45606, 45618), frozenset([30058, 29982, 30155, 30130, 30096]): (45628, 45592, 45606, 45618), frozenset([30060, 29979, 30149, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29979, 30149, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29979, 30149, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30149, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30149, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29979, 30149, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29979, 30149, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30149, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30149, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30060, 29979, 30149, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30060, 29979, 30149, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30060, 29979, 30149, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30060, 29979, 30149, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29979, 30149, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29979, 30149, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29979, 30149, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29979, 30151, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29979, 30151, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29979, 30151, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30151, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30151, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29979, 30151, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29979, 30151, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30151, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30151, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30060, 29979, 30151, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30060, 29979, 30151, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30060, 29979, 30151, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30060, 29979, 30151, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29979, 30151, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29979, 30151, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29979, 30151, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29979, 30153, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29979, 30153, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29979, 30153, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30153, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30153, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29979, 30153, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29979, 30153, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30153, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29979, 30153, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30060, 29979, 30153, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30060, 29979, 30153, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30060, 29979, 30153, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30060, 29979, 30153, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29979, 30153, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29979, 30153, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29979, 30153, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29979, 30155, 30127, 30100]): (45628, 45593, 45604, 45617), frozenset([30060, 29979, 30155, 30127, 30102]): (45628, 45593, 45604, 45616), frozenset([30060, 29979, 30155, 30127, 30098]): (45628, 45593, 45604, 45618), frozenset([30060, 29979, 30155, 30127, 30096]): (45628, 45593, 45604, 45618), frozenset([30060, 29979, 30155, 30128, 30100]): (45628, 45593, 45604, 45617), frozenset([30060, 29979, 30155, 30128, 30102]): (45628, 45593, 45604, 45616), frozenset([30060, 29979, 30155, 30128, 30098]): (45628, 45593, 45604, 45618), frozenset([30060, 29979, 30155, 30128, 30096]): (45628, 45593, 45604, 45618), frozenset([30060, 29979, 30155, 30129, 30100]): (45628, 45593, 45605, 45617), frozenset([30060, 29979, 30155, 30129, 30102]): (45628, 45593, 45605, 45616), frozenset([30060, 29979, 30155, 30129, 30098]): (45628, 45593, 45605, 45618), frozenset([30060, 29979, 30155, 30129, 30096]): (45628, 45593, 45605, 45618), frozenset([30060, 29979, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30060, 29979, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30060, 29979, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30060, 29979, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30060, 29980, 30149, 30127, 30100]): (45629, 45594, 45604, 45617), frozenset([30060, 29980, 30149, 30127, 30102]): (45629, 45594, 45604, 45616), frozenset([30060, 29980, 30149, 30127, 30098]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30149, 30127, 30096]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30149, 30128, 30100]): (45629, 45594, 45604, 45617), frozenset([30060, 29980, 30149, 30128, 30102]): (45629, 45594, 45604, 45616), frozenset([30060, 29980, 30149, 30128, 30098]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30149, 30128, 30096]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30149, 30129, 30100]): (45629, 45594, 45605, 45617), frozenset([30060, 29980, 30149, 30129, 30102]): (45629, 45594, 45605, 45616), frozenset([30060, 29980, 30149, 30129, 30098]): (45629, 45594, 45605, 45618), frozenset([30060, 29980, 30149, 30129, 30096]): (45629, 45594, 45605, 45618), frozenset([30060, 29980, 30149, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29980, 30149, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29980, 30149, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29980, 30149, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29980, 30151, 30127, 30100]): (45629, 45594, 45604, 45617), frozenset([30060, 29980, 30151, 30127, 30102]): (45629, 45594, 45604, 45616), frozenset([30060, 29980, 30151, 30127, 30098]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30151, 30127, 30096]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30151, 30128, 30100]): (45629, 45594, 45604, 45617), frozenset([30060, 29980, 30151, 30128, 30102]): (45629, 45594, 45604, 45616), frozenset([30060, 29980, 30151, 30128, 30098]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30151, 30128, 30096]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30151, 30129, 30100]): (45629, 45594, 45605, 45617), frozenset([30060, 29980, 30151, 30129, 30102]): (45629, 45594, 45605, 45616), frozenset([30060, 29980, 30151, 30129, 30098]): (45629, 45594, 45605, 45618), frozenset([30060, 29980, 30151, 30129, 30096]): (45629, 45594, 45605, 45618), frozenset([30060, 29980, 30151, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29980, 30151, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29980, 30151, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29980, 30151, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29980, 30153, 30127, 30100]): (45629, 45594, 45604, 45617), frozenset([30060, 29980, 30153, 30127, 30102]): (45629, 45594, 45604, 45616), frozenset([30060, 29980, 30153, 30127, 30098]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30153, 30127, 30096]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30153, 30128, 30100]): (45629, 45594, 45604, 45617), frozenset([30060, 29980, 30153, 30128, 30102]): (45629, 45594, 45604, 45616), frozenset([30060, 29980, 30153, 30128, 30098]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30153, 30128, 30096]): (45629, 45594, 45604, 45618), frozenset([30060, 29980, 30153, 30129, 30100]): (45629, 45594, 45605, 45617), frozenset([30060, 29980, 30153, 30129, 30102]): (45629, 45594, 45605, 45616), frozenset([30060, 29980, 30153, 30129, 30098]): (45629, 45594, 45605, 45618), frozenset([30060, 29980, 30153, 30129, 30096]): (45629, 45594, 45605, 45618), frozenset([30060, 29980, 30153, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29980, 30153, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29980, 30153, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29980, 30153, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29980, 30155, 30127, 30100]): (45628, 45594, 45604, 45617), frozenset([30060, 29980, 30155, 30127, 30102]): (45628, 45594, 45604, 45616), frozenset([30060, 29980, 30155, 30127, 30098]): (45628, 45594, 45604, 45618), frozenset([30060, 29980, 30155, 30127, 30096]): (45628, 45594, 45604, 45618), frozenset([30060, 29980, 30155, 30128, 30100]): (45628, 45594, 45604, 45617), frozenset([30060, 29980, 30155, 30128, 30102]): (45628, 45594, 45604, 45616), frozenset([30060, 29980, 30155, 30128, 30098]): (45628, 45594, 45604, 45618), frozenset([30060, 29980, 30155, 30128, 30096]): (45628, 45594, 45604, 45618), frozenset([30060, 29980, 30155, 30129, 30100]): (45628, 45594, 45605, 45617), frozenset([30060, 29980, 30155, 30129, 30102]): (45628, 45594, 45605, 45616), frozenset([30060, 29980, 30155, 30129, 30098]): (45628, 45594, 45605, 45618), frozenset([30060, 29980, 30155, 30129, 30096]): (45628, 45594, 45605, 45618), frozenset([30060, 29980, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30060, 29980, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30060, 29980, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30060, 29980, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30060, 29981, 30149, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29981, 30149, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29981, 30149, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30149, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30149, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29981, 30149, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29981, 30149, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30149, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30149, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30060, 29981, 30149, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30060, 29981, 30149, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30060, 29981, 30149, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30060, 29981, 30149, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29981, 30149, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29981, 30149, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29981, 30149, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29981, 30151, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29981, 30151, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29981, 30151, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30151, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30151, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29981, 30151, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29981, 30151, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30151, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30151, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30060, 29981, 30151, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30060, 29981, 30151, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30060, 29981, 30151, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30060, 29981, 30151, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29981, 30151, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29981, 30151, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29981, 30151, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29981, 30153, 30127, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29981, 30153, 30127, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29981, 30153, 30127, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30153, 30127, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30153, 30128, 30100]): (45629, 45593, 45604, 45617), frozenset([30060, 29981, 30153, 30128, 30102]): (45629, 45593, 45604, 45616), frozenset([30060, 29981, 30153, 30128, 30098]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30153, 30128, 30096]): (45629, 45593, 45604, 45618), frozenset([30060, 29981, 30153, 30129, 30100]): (45629, 45593, 45605, 45617), frozenset([30060, 29981, 30153, 30129, 30102]): (45629, 45593, 45605, 45616), frozenset([30060, 29981, 30153, 30129, 30098]): (45629, 45593, 45605, 45618), frozenset([30060, 29981, 30153, 30129, 30096]): (45629, 45593, 45605, 45618), frozenset([30060, 29981, 30153, 30130, 30100]): (45629, 45592, 45604, 45617), frozenset([30060, 29981, 30153, 30130, 30102]): (45629, 45592, 45604, 45616), frozenset([30060, 29981, 30153, 30130, 30098]): (45629, 45592, 45604, 45618), frozenset([30060, 29981, 30153, 30130, 30096]): (45629, 45592, 45604, 45618), frozenset([30060, 29981, 30155, 30127, 30100]): (45628, 45593, 45604, 45617), frozenset([30060, 29981, 30155, 30127, 30102]): (45628, 45593, 45604, 45616), frozenset([30060, 29981, 30155, 30127, 30098]): (45628, 45593, 45604, 45618), frozenset([30060, 29981, 30155, 30127, 30096]): (45628, 45593, 45604, 45618), frozenset([30060, 29981, 30155, 30128, 30100]): (45628, 45593, 45604, 45617), frozenset([30060, 29981, 30155, 30128, 30102]): (45628, 45593, 45604, 45616), frozenset([30060, 29981, 30155, 30128, 30098]): (45628, 45593, 45604, 45618), frozenset([30060, 29981, 30155, 30128, 30096]): (45628, 45593, 45604, 45618), frozenset([30060, 29981, 30155, 30129, 30100]): (45628, 45593, 45605, 45617), frozenset([30060, 29981, 30155, 30129, 30102]): (45628, 45593, 45605, 45616), frozenset([30060, 29981, 30155, 30129, 30098]): (45628, 45593, 45605, 45618), frozenset([30060, 29981, 30155, 30129, 30096]): (45628, 45593, 45605, 45618), frozenset([30060, 29981, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30060, 29981, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30060, 29981, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30060, 29981, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30060, 29982, 30149, 30127, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30149, 30127, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30149, 30127, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30149, 30127, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30149, 30128, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30149, 30128, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30149, 30128, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30149, 30128, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30149, 30129, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30149, 30129, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30149, 30129, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30149, 30129, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30149, 30130, 30100]): (45629, 45592, 45606, 45617), frozenset([30060, 29982, 30149, 30130, 30102]): (45629, 45592, 45606, 45616), frozenset([30060, 29982, 30149, 30130, 30098]): (45629, 45592, 45606, 45618), frozenset([30060, 29982, 30149, 30130, 30096]): (45629, 45592, 45606, 45618), frozenset([30060, 29982, 30151, 30127, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30151, 30127, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30151, 30127, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30151, 30127, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30151, 30128, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30151, 30128, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30151, 30128, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30151, 30128, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30151, 30129, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30151, 30129, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30151, 30129, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30151, 30129, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30151, 30130, 30100]): (45629, 45592, 45606, 45617), frozenset([30060, 29982, 30151, 30130, 30102]): (45629, 45592, 45606, 45616), frozenset([30060, 29982, 30151, 30130, 30098]): (45629, 45592, 45606, 45618), frozenset([30060, 29982, 30151, 30130, 30096]): (45629, 45592, 45606, 45618), frozenset([30060, 29982, 30153, 30127, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30153, 30127, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30153, 30127, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30153, 30127, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30153, 30128, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30153, 30128, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30153, 30128, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30153, 30128, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30153, 30129, 30100]): (45629, 45593, 45606, 45617), frozenset([30060, 29982, 30153, 30129, 30102]): (45629, 45593, 45606, 45616), frozenset([30060, 29982, 30153, 30129, 30098]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30153, 30129, 30096]): (45629, 45593, 45606, 45618), frozenset([30060, 29982, 30153, 30130, 30100]): (45629, 45592, 45606, 45617), frozenset([30060, 29982, 30153, 30130, 30102]): (45629, 45592, 45606, 45616), frozenset([30060, 29982, 30153, 30130, 30098]): (45629, 45592, 45606, 45618), frozenset([30060, 29982, 30153, 30130, 30096]): (45629, 45592, 45606, 45618), frozenset([30060, 29982, 30155, 30127, 30100]): (45628, 45593, 45606, 45617), frozenset([30060, 29982, 30155, 30127, 30102]): (45628, 45593, 45606, 45616), frozenset([30060, 29982, 30155, 30127, 30098]): (45628, 45593, 45606, 45618), frozenset([30060, 29982, 30155, 30127, 30096]): (45628, 45593, 45606, 45618), frozenset([30060, 29982, 30155, 30128, 30100]): (45628, 45593, 45606, 45617), frozenset([30060, 29982, 30155, 30128, 30102]): (45628, 45593, 45606, 45616), frozenset([30060, 29982, 30155, 30128, 30098]): (45628, 45593, 45606, 45618), frozenset([30060, 29982, 30155, 30128, 30096]): (45628, 45593, 45606, 45618), frozenset([30060, 29982, 30155, 30129, 30100]): (45628, 45593, 45606, 45617), frozenset([30060, 29982, 30155, 30129, 30102]): (45628, 45593, 45606, 45616), frozenset([30060, 29982, 30155, 30129, 30098]): (45628, 45593, 45606, 45618), frozenset([30060, 29982, 30155, 30129, 30096]): (45628, 45593, 45606, 45618), frozenset([30060, 29982, 30155, 30130, 30100]): (45628, 45592, 45606, 45617), frozenset([30060, 29982, 30155, 30130, 30102]): (45628, 45592, 45606, 45616), frozenset([30060, 29982, 30155, 30130, 30098]): (45628, 45592, 45606, 45618), frozenset([30060, 29982, 30155, 30130, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29979, 30149, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30149, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30149, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30149, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30149, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30149, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30149, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30149, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30149, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29979, 30149, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29979, 30149, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29979, 30149, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29979, 30149, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30149, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30149, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30149, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30151, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30151, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30151, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30151, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30151, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30151, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30151, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30151, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30151, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29979, 30151, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29979, 30151, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29979, 30151, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29979, 30151, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30151, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30151, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30151, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30153, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30153, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30153, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30153, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30153, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30153, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30153, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30153, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30153, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29979, 30153, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29979, 30153, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29979, 30153, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29979, 30153, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30153, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30153, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30153, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30155, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30155, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30155, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30155, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30155, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30155, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30155, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30155, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30155, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29979, 30155, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29979, 30155, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29979, 30155, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29979, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29979, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29979, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29979, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30149, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30149, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30149, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30149, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30149, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30149, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30149, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30149, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30149, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29980, 30149, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29980, 30149, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29980, 30149, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29980, 30149, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30149, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30149, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30149, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30151, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30151, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30151, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30151, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30151, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30151, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30151, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30151, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30151, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29980, 30151, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29980, 30151, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29980, 30151, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29980, 30151, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30151, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30151, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30151, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30153, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30153, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30153, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30153, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30153, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30153, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30153, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30153, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30153, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29980, 30153, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29980, 30153, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29980, 30153, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29980, 30153, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30153, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30153, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30153, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30155, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30155, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30155, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30155, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30155, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30155, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30155, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30155, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30155, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29980, 30155, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29980, 30155, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29980, 30155, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29980, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29980, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29980, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29980, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30149, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30149, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30149, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30149, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30149, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30149, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30149, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30149, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30149, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29981, 30149, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29981, 30149, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29981, 30149, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29981, 30149, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30149, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30149, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30149, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30151, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30151, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30151, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30151, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30151, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30151, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30151, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30151, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30151, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29981, 30151, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29981, 30151, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29981, 30151, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29981, 30151, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30151, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30151, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30151, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30153, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30153, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30153, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30153, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30153, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30153, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30153, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30153, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30153, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29981, 30153, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29981, 30153, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29981, 30153, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29981, 30153, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30153, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30153, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30153, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30155, 30127, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30155, 30127, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30155, 30127, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30155, 30127, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30155, 30128, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30155, 30128, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30155, 30128, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30155, 30128, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30155, 30129, 30100]): (45628, 45592, 45605, 45617), frozenset([30062, 29981, 30155, 30129, 30102]): (45628, 45592, 45605, 45616), frozenset([30062, 29981, 30155, 30129, 30098]): (45628, 45592, 45605, 45618), frozenset([30062, 29981, 30155, 30129, 30096]): (45628, 45592, 45605, 45618), frozenset([30062, 29981, 30155, 30130, 30100]): (45628, 45592, 45604, 45617), frozenset([30062, 29981, 30155, 30130, 30102]): (45628, 45592, 45604, 45616), frozenset([30062, 29981, 30155, 30130, 30098]): (45628, 45592, 45604, 45618), frozenset([30062, 29981, 30155, 30130, 30096]): (45628, 45592, 45604, 45618), frozenset([30062, 29982, 30149, 30127, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30149, 30127, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30149, 30127, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30149, 30127, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30149, 30128, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30149, 30128, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30149, 30128, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30149, 30128, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30149, 30129, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30149, 30129, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30149, 30129, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30149, 30129, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30149, 30130, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30149, 30130, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30149, 30130, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30149, 30130, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30151, 30127, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30151, 30127, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30151, 30127, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30151, 30127, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30151, 30128, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30151, 30128, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30151, 30128, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30151, 30128, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30151, 30129, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30151, 30129, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30151, 30129, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30151, 30129, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30151, 30130, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30151, 30130, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30151, 30130, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30151, 30130, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30153, 30127, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30153, 30127, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30153, 30127, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30153, 30127, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30153, 30128, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30153, 30128, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30153, 30128, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30153, 30128, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30153, 30129, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30153, 30129, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30153, 30129, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30153, 30129, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30153, 30130, 30100]): (45628, 45592, 45606, 45617), frozenset([30062, 29982, 30153, 30130, 30102]): (45628, 45592, 45606, 45616), frozenset([30062, 29982, 30153, 30130, 30098]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30153, 30130, 30096]): (45628, 45592, 45606, 45618), frozenset([30062, 29982, 30155, 30127, 30100]): (45628, 45593, 45606, 45617), frozenset([30062, 29982, 30155, 30127, 30102]): (45628, 45594, 45606, 45616), frozenset([30062, 29982, 30155, 30127, 30098]): (45628, 45595, 45606, 45618), frozenset([30062, 29982, 30155, 30127, 30096]): (45628, 45596, 45606, 45618), frozenset([30062, 29982, 30155, 30128, 30100]): (45628, 45597, 45606, 45617), frozenset([30062, 29982, 30155, 30128, 30102]): (45628, 45598, 45606, 45616), frozenset([30062, 29982, 30155, 30128, 30098]): (45628, 45599, 45606, 45618), frozenset([30062, 29982, 30155, 30128, 30096]): (45628, 45600, 45606, 45618), frozenset([30062, 29982, 30155, 30129, 30100]): (45628, 45601, 45606, 45617), frozenset([30062, 29982, 30155, 30129, 30102]): (45628, 45602, 45606, 45616), frozenset([30062, 29982, 30155, 30129, 30098]): (45628, 45603, 45606, 45618), frozenset([30062, 29982, 30155, 30129, 30096]): (45628, 45604, 45606, 45618), frozenset([30062, 29982, 30155, 30130, 30100]): (45628, 45605, 45606, 45617), frozenset([30062, 29982, 30155, 30130, 30102]): (45628, 45606, 45606, 45616), frozenset([30062, 29982, 30155, 30130, 30098]): (45628, 45607, 45606, 45618), frozenset([30062, 29982, 30155, 30130, 30096]): (45628, 45592, 45606, 45618), frozenset([30066, 29974, 30159, 30132, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30159, 30132, 30110]): (45633, 45596, 45607, 45621), frozenset([30066, 29974, 30159, 30132, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30159, 30132, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29974, 30159, 30133, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30159, 30133, 30110]): (45633, 45596, 45607, 45621), frozenset([30066, 29974, 30159, 30133, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30159, 30133, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29974, 30159, 30134, 30106]): (45633, 45596, 45608, 45620), frozenset([30066, 29974, 30159, 30134, 30110]): (45633, 45596, 45608, 45621), frozenset([30066, 29974, 30159, 30134, 30108]): (45633, 45596, 45608, 45620), frozenset([30066, 29974, 30159, 30134, 30112]): (45633, 45596, 45608, 45619), frozenset([30066, 29974, 30159, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29974, 30159, 30135, 30110]): (45633, 45595, 45607, 45621), frozenset([30066, 29974, 30159, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29974, 30159, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29974, 30161, 30132, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30161, 30132, 30110]): (45633, 45596, 45607, 45621), frozenset([30066, 29974, 30161, 30132, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30161, 30132, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29974, 30161, 30133, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30161, 30133, 30110]): (45633, 45596, 45607, 45621), frozenset([30066, 29974, 30161, 30133, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30161, 30133, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29974, 30161, 30134, 30106]): (45633, 45596, 45608, 45620), frozenset([30066, 29974, 30161, 30134, 30110]): (45633, 45596, 45608, 45621), frozenset([30066, 29974, 30161, 30134, 30108]): (45633, 45596, 45608, 45620), frozenset([30066, 29974, 30161, 30134, 30112]): (45633, 45596, 45608, 45619), frozenset([30066, 29974, 30161, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29974, 30161, 30135, 30110]): (45633, 45595, 45607, 45621), frozenset([30066, 29974, 30161, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29974, 30161, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29974, 30163, 30132, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30163, 30132, 30110]): (45633, 45596, 45607, 45621), frozenset([30066, 29974, 30163, 30132, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30163, 30132, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29974, 30163, 30133, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30163, 30133, 30110]): (45633, 45596, 45607, 45621), frozenset([30066, 29974, 30163, 30133, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30163, 30133, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29974, 30163, 30134, 30106]): (45633, 45596, 45608, 45620), frozenset([30066, 29974, 30163, 30134, 30110]): (45633, 45596, 45608, 45621), frozenset([30066, 29974, 30163, 30134, 30108]): (45633, 45596, 45608, 45620), frozenset([30066, 29974, 30163, 30134, 30112]): (45633, 45596, 45608, 45619), frozenset([30066, 29974, 30163, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29974, 30163, 30135, 30110]): (45633, 45595, 45607, 45621), frozenset([30066, 29974, 30163, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29974, 30163, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29974, 30165, 30132, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30165, 30132, 30110]): (45633, 45596, 45607, 45621), frozenset([30066, 29974, 30165, 30132, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30165, 30132, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29974, 30165, 30133, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30165, 30133, 30110]): (45633, 45596, 45607, 45621), frozenset([30066, 29974, 30165, 30133, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29974, 30165, 30133, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29974, 30165, 30134, 30106]): (45633, 45596, 45608, 45620), frozenset([30066, 29974, 30165, 30134, 30110]): (45633, 45596, 45608, 45621), frozenset([30066, 29974, 30165, 30134, 30108]): (45633, 45596, 45608, 45620), frozenset([30066, 29974, 30165, 30134, 30112]): (45633, 45596, 45608, 45619), frozenset([30066, 29974, 30165, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29974, 30165, 30135, 30110]): (45633, 45595, 45607, 45621), frozenset([30066, 29974, 30165, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29974, 30165, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29975, 30159, 30132, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30159, 30132, 30110]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30159, 30132, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30159, 30132, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29975, 30159, 30133, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30159, 30133, 30110]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30159, 30133, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30159, 30133, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29975, 30159, 30134, 30106]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30159, 30134, 30110]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30159, 30134, 30108]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30159, 30134, 30112]): (45633, 45596, 45608, 45619), frozenset([30066, 29975, 30159, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30159, 30135, 30110]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30159, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30159, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29975, 30161, 30132, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30161, 30132, 30110]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30161, 30132, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30161, 30132, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29975, 30161, 30133, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30161, 30133, 30110]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30161, 30133, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30161, 30133, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29975, 30161, 30134, 30106]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30161, 30134, 30110]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30161, 30134, 30108]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30161, 30134, 30112]): (45633, 45596, 45608, 45619), frozenset([30066, 29975, 30161, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30161, 30135, 30110]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30161, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30161, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29975, 30163, 30132, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30163, 30132, 30110]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30163, 30132, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30163, 30132, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29975, 30163, 30133, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30163, 30133, 30110]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30163, 30133, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30163, 30133, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29975, 30163, 30134, 30106]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30163, 30134, 30110]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30163, 30134, 30108]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30163, 30134, 30112]): (45633, 45596, 45608, 45619), frozenset([30066, 29975, 30163, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30163, 30135, 30110]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30163, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30163, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29975, 30165, 30132, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30165, 30132, 30110]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30165, 30132, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30165, 30132, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29975, 30165, 30133, 30106]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30165, 30133, 30110]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30165, 30133, 30108]): (45633, 45596, 45607, 45620), frozenset([30066, 29975, 30165, 30133, 30112]): (45633, 45596, 45607, 45619), frozenset([30066, 29975, 30165, 30134, 30106]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30165, 30134, 30110]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30165, 30134, 30108]): (45633, 45596, 45608, 45620), frozenset([30066, 29975, 30165, 30134, 30112]): (45633, 45596, 45608, 45619), frozenset([30066, 29975, 30165, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30165, 30135, 30110]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30165, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29975, 30165, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29976, 30159, 30132, 30106]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30159, 30132, 30110]): (45633, 45597, 45607, 45621), frozenset([30066, 29976, 30159, 30132, 30108]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30159, 30132, 30112]): (45633, 45597, 45607, 45619), frozenset([30066, 29976, 30159, 30133, 30106]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30159, 30133, 30110]): (45633, 45597, 45607, 45621), frozenset([30066, 29976, 30159, 30133, 30108]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30159, 30133, 30112]): (45633, 45597, 45607, 45619), frozenset([30066, 29976, 30159, 30134, 30106]): (45633, 45597, 45608, 45620), frozenset([30066, 29976, 30159, 30134, 30110]): (45633, 45597, 45608, 45621), frozenset([30066, 29976, 30159, 30134, 30108]): (45633, 45597, 45608, 45620), frozenset([30066, 29976, 30159, 30134, 30112]): (45633, 45597, 45608, 45619), frozenset([30066, 29976, 30159, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29976, 30159, 30135, 30110]): (45633, 45595, 45607, 45621), frozenset([30066, 29976, 30159, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29976, 30159, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29976, 30161, 30132, 30106]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30161, 30132, 30110]): (45633, 45597, 45607, 45621), frozenset([30066, 29976, 30161, 30132, 30108]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30161, 30132, 30112]): (45633, 45597, 45607, 45619), frozenset([30066, 29976, 30161, 30133, 30106]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30161, 30133, 30110]): (45633, 45597, 45607, 45621), frozenset([30066, 29976, 30161, 30133, 30108]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30161, 30133, 30112]): (45633, 45597, 45607, 45619), frozenset([30066, 29976, 30161, 30134, 30106]): (45633, 45597, 45608, 45620), frozenset([30066, 29976, 30161, 30134, 30110]): (45633, 45597, 45608, 45621), frozenset([30066, 29976, 30161, 30134, 30108]): (45633, 45597, 45608, 45620), frozenset([30066, 29976, 30161, 30134, 30112]): (45633, 45597, 45608, 45619), frozenset([30066, 29976, 30161, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29976, 30161, 30135, 30110]): (45633, 45595, 45607, 45621), frozenset([30066, 29976, 30161, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29976, 30161, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29976, 30163, 30132, 30106]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30163, 30132, 30110]): (45633, 45597, 45607, 45621), frozenset([30066, 29976, 30163, 30132, 30108]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30163, 30132, 30112]): (45633, 45597, 45607, 45619), frozenset([30066, 29976, 30163, 30133, 30106]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30163, 30133, 30110]): (45633, 45597, 45607, 45621), frozenset([30066, 29976, 30163, 30133, 30108]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30163, 30133, 30112]): (45633, 45597, 45607, 45619), frozenset([30066, 29976, 30163, 30134, 30106]): (45633, 45597, 45608, 45620), frozenset([30066, 29976, 30163, 30134, 30110]): (45633, 45597, 45608, 45621), frozenset([30066, 29976, 30163, 30134, 30108]): (45633, 45597, 45608, 45620), frozenset([30066, 29976, 30163, 30134, 30112]): (45633, 45597, 45608, 45619), frozenset([30066, 29976, 30163, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29976, 30163, 30135, 30110]): (45633, 45595, 45607, 45621), frozenset([30066, 29976, 30163, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29976, 30163, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29976, 30165, 30132, 30106]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30165, 30132, 30110]): (45633, 45597, 45607, 45621), frozenset([30066, 29976, 30165, 30132, 30108]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30165, 30132, 30112]): (45633, 45597, 45607, 45619), frozenset([30066, 29976, 30165, 30133, 30106]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30165, 30133, 30110]): (45633, 45597, 45607, 45621), frozenset([30066, 29976, 30165, 30133, 30108]): (45633, 45597, 45607, 45620), frozenset([30066, 29976, 30165, 30133, 30112]): (45633, 45597, 45607, 45619), frozenset([30066, 29976, 30165, 30134, 30106]): (45633, 45597, 45608, 45620), frozenset([30066, 29976, 30165, 30134, 30110]): (45633, 45597, 45608, 45621), frozenset([30066, 29976, 30165, 30134, 30108]): (45633, 45597, 45608, 45620), frozenset([30066, 29976, 30165, 30134, 30112]): (45633, 45597, 45608, 45619), frozenset([30066, 29976, 30165, 30135, 30106]): (45633, 45595, 45607, 45620), frozenset([30066, 29976, 30165, 30135, 30110]): (45633, 45595, 45607, 45621), frozenset([30066, 29976, 30165, 30135, 30108]): (45633, 45595, 45607, 45620), frozenset([30066, 29976, 30165, 30135, 30112]): (45633, 45595, 45607, 45619), frozenset([30066, 29977, 30159, 30132, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30159, 30132, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30159, 30132, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30159, 30132, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30159, 30133, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30159, 30133, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30159, 30133, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30159, 30133, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30159, 30134, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30159, 30134, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30159, 30134, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30159, 30134, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30159, 30135, 30106]): (45633, 45595, 45609, 45620), frozenset([30066, 29977, 30159, 30135, 30110]): (45633, 45595, 45609, 45621), frozenset([30066, 29977, 30159, 30135, 30108]): (45633, 45595, 45609, 45620), frozenset([30066, 29977, 30159, 30135, 30112]): (45633, 45595, 45609, 45619), frozenset([30066, 29977, 30161, 30132, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30161, 30132, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30161, 30132, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30161, 30132, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30161, 30133, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30161, 30133, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30161, 30133, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30161, 30133, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30161, 30134, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30161, 30134, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30161, 30134, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30161, 30134, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30161, 30135, 30106]): (45633, 45595, 45609, 45620), frozenset([30066, 29977, 30161, 30135, 30110]): (45633, 45595, 45609, 45621), frozenset([30066, 29977, 30161, 30135, 30108]): (45633, 45595, 45609, 45620), frozenset([30066, 29977, 30161, 30135, 30112]): (45633, 45595, 45609, 45619), frozenset([30066, 29977, 30163, 30132, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30163, 30132, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30163, 30132, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30163, 30132, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30163, 30133, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30163, 30133, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30163, 30133, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30163, 30133, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30163, 30134, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30163, 30134, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30163, 30134, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30163, 30134, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30163, 30135, 30106]): (45633, 45595, 45609, 45620), frozenset([30066, 29977, 30163, 30135, 30110]): (45633, 45595, 45609, 45621), frozenset([30066, 29977, 30163, 30135, 30108]): (45633, 45595, 45609, 45620), frozenset([30066, 29977, 30163, 30135, 30112]): (45633, 45595, 45609, 45619), frozenset([30066, 29977, 30165, 30132, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30165, 30132, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30165, 30132, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30165, 30132, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30165, 30133, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30165, 30133, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30165, 30133, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30165, 30133, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30165, 30134, 30106]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30165, 30134, 30110]): (45633, 45596, 45609, 45621), frozenset([30066, 29977, 30165, 30134, 30108]): (45633, 45596, 45609, 45620), frozenset([30066, 29977, 30165, 30134, 30112]): (45633, 45596, 45609, 45619), frozenset([30066, 29977, 30165, 30135, 30106]): (45633, 45595, 45609, 45620), frozenset([30066, 29977, 30165, 30135, 30110]): (45633, 45595, 45609, 45621), frozenset([30066, 29977, 30165, 30135, 30108]): (45633, 45595, 45609, 45620), frozenset([30066, 29977, 30165, 30135, 30112]): (45633, 45595, 45609, 45619), frozenset([30068, 29974, 30159, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30159, 30132, 30110]): (45632, 45596, 45607, 45621), frozenset([30068, 29974, 30159, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30159, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29974, 30159, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30159, 30133, 30110]): (45632, 45596, 45607, 45621), frozenset([30068, 29974, 30159, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30159, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29974, 30159, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30068, 29974, 30159, 30134, 30110]): (45632, 45596, 45608, 45621), frozenset([30068, 29974, 30159, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30068, 29974, 30159, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30068, 29974, 30159, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30068, 29974, 30159, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30068, 29974, 30159, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30068, 29974, 30159, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29974, 30161, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30161, 30132, 30110]): (45632, 45596, 45607, 45621), frozenset([30068, 29974, 30161, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30161, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29974, 30161, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30161, 30133, 30110]): (45632, 45596, 45607, 45621), frozenset([30068, 29974, 30161, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30161, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29974, 30161, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30068, 29974, 30161, 30134, 30110]): (45632, 45596, 45608, 45621), frozenset([30068, 29974, 30161, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30068, 29974, 30161, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30068, 29974, 30161, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30068, 29974, 30161, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30068, 29974, 30161, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30068, 29974, 30161, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29974, 30163, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30163, 30132, 30110]): (45632, 45596, 45607, 45621), frozenset([30068, 29974, 30163, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30163, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29974, 30163, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30163, 30133, 30110]): (45632, 45596, 45607, 45621), frozenset([30068, 29974, 30163, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30163, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29974, 30163, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30068, 29974, 30163, 30134, 30110]): (45632, 45596, 45608, 45621), frozenset([30068, 29974, 30163, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30068, 29974, 30163, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30068, 29974, 30163, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30068, 29974, 30163, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30068, 29974, 30163, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30068, 29974, 30163, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29974, 30165, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30165, 30132, 30110]): (45631, 45596, 45607, 45621), frozenset([30068, 29974, 30165, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30165, 30132, 30112]): (45631, 45596, 45607, 45619), frozenset([30068, 29974, 30165, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30165, 30133, 30110]): (45631, 45596, 45607, 45621), frozenset([30068, 29974, 30165, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29974, 30165, 30133, 30112]): (45631, 45596, 45607, 45619), frozenset([30068, 29974, 30165, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30068, 29974, 30165, 30134, 30110]): (45631, 45596, 45608, 45621), frozenset([30068, 29974, 30165, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30068, 29974, 30165, 30134, 30112]): (45631, 45596, 45608, 45619), frozenset([30068, 29974, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30068, 29974, 30165, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30068, 29974, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30068, 29974, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30068, 29975, 30159, 30132, 30106]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30159, 30132, 30110]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30159, 30132, 30108]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30159, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29975, 30159, 30133, 30106]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30159, 30133, 30110]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30159, 30133, 30108]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30159, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29975, 30159, 30134, 30106]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30159, 30134, 30110]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30159, 30134, 30108]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30159, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30068, 29975, 30159, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30159, 30135, 30110]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30159, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30159, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29975, 30161, 30132, 30106]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30161, 30132, 30110]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30161, 30132, 30108]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30161, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29975, 30161, 30133, 30106]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30161, 30133, 30110]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30161, 30133, 30108]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30161, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29975, 30161, 30134, 30106]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30161, 30134, 30110]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30161, 30134, 30108]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30161, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30068, 29975, 30161, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30161, 30135, 30110]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30161, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30161, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29975, 30163, 30132, 30106]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30163, 30132, 30110]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30163, 30132, 30108]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30163, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29975, 30163, 30133, 30106]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30163, 30133, 30110]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30163, 30133, 30108]): (45632, 45596, 45607, 45620), frozenset([30068, 29975, 30163, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30068, 29975, 30163, 30134, 30106]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30163, 30134, 30110]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30163, 30134, 30108]): (45632, 45596, 45608, 45620), frozenset([30068, 29975, 30163, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30068, 29975, 30163, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30163, 30135, 30110]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30163, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30068, 29975, 30163, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29975, 30165, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29975, 30165, 30132, 30110]): (45631, 45596, 45607, 45620), frozenset([30068, 29975, 30165, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29975, 30165, 30132, 30112]): (45631, 45596, 45607, 45619), frozenset([30068, 29975, 30165, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30068, 29975, 30165, 30133, 30110]): (45631, 45596, 45607, 45620), frozenset([30068, 29975, 30165, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30068, 29975, 30165, 30133, 30112]): (45631, 45596, 45607, 45619), frozenset([30068, 29975, 30165, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30068, 29975, 30165, 30134, 30110]): (45631, 45596, 45608, 45620), frozenset([30068, 29975, 30165, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30068, 29975, 30165, 30134, 30112]): (45631, 45596, 45608, 45619), frozenset([30068, 29975, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30068, 29975, 30165, 30135, 30110]): (45631, 45595, 45607, 45620), frozenset([30068, 29975, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30068, 29975, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30068, 29976, 30159, 30132, 30106]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30159, 30132, 30110]): (45632, 45597, 45607, 45621), frozenset([30068, 29976, 30159, 30132, 30108]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30159, 30132, 30112]): (45632, 45597, 45607, 45619), frozenset([30068, 29976, 30159, 30133, 30106]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30159, 30133, 30110]): (45632, 45597, 45607, 45621), frozenset([30068, 29976, 30159, 30133, 30108]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30159, 30133, 30112]): (45632, 45597, 45607, 45619), frozenset([30068, 29976, 30159, 30134, 30106]): (45632, 45597, 45608, 45620), frozenset([30068, 29976, 30159, 30134, 30110]): (45632, 45597, 45608, 45621), frozenset([30068, 29976, 30159, 30134, 30108]): (45632, 45597, 45608, 45620), frozenset([30068, 29976, 30159, 30134, 30112]): (45632, 45597, 45608, 45619), frozenset([30068, 29976, 30159, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30068, 29976, 30159, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30068, 29976, 30159, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30068, 29976, 30159, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29976, 30161, 30132, 30106]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30161, 30132, 30110]): (45632, 45597, 45607, 45621), frozenset([30068, 29976, 30161, 30132, 30108]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30161, 30132, 30112]): (45632, 45597, 45607, 45619), frozenset([30068, 29976, 30161, 30133, 30106]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30161, 30133, 30110]): (45632, 45597, 45607, 45621), frozenset([30068, 29976, 30161, 30133, 30108]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30161, 30133, 30112]): (45632, 45597, 45607, 45619), frozenset([30068, 29976, 30161, 30134, 30106]): (45632, 45597, 45608, 45620), frozenset([30068, 29976, 30161, 30134, 30110]): (45632, 45597, 45608, 45621), frozenset([30068, 29976, 30161, 30134, 30108]): (45632, 45597, 45608, 45620), frozenset([30068, 29976, 30161, 30134, 30112]): (45632, 45597, 45608, 45619), frozenset([30068, 29976, 30161, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30068, 29976, 30161, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30068, 29976, 30161, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30068, 29976, 30161, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29976, 30163, 30132, 30106]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30163, 30132, 30110]): (45632, 45597, 45607, 45621), frozenset([30068, 29976, 30163, 30132, 30108]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30163, 30132, 30112]): (45632, 45597, 45607, 45619), frozenset([30068, 29976, 30163, 30133, 30106]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30163, 30133, 30110]): (45632, 45597, 45607, 45621), frozenset([30068, 29976, 30163, 30133, 30108]): (45632, 45597, 45607, 45620), frozenset([30068, 29976, 30163, 30133, 30112]): (45632, 45597, 45607, 45619), frozenset([30068, 29976, 30163, 30134, 30106]): (45632, 45597, 45608, 45620), frozenset([30068, 29976, 30163, 30134, 30110]): (45632, 45597, 45608, 45621), frozenset([30068, 29976, 30163, 30134, 30108]): (45632, 45597, 45608, 45620), frozenset([30068, 29976, 30163, 30134, 30112]): (45632, 45597, 45608, 45619), frozenset([30068, 29976, 30163, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30068, 29976, 30163, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30068, 29976, 30163, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30068, 29976, 30163, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30068, 29976, 30165, 30132, 30106]): (45631, 45597, 45607, 45620), frozenset([30068, 29976, 30165, 30132, 30110]): (45631, 45597, 45607, 45621), frozenset([30068, 29976, 30165, 30132, 30108]): (45631, 45597, 45607, 45620), frozenset([30068, 29976, 30165, 30132, 30112]): (45631, 45597, 45607, 45619), frozenset([30068, 29976, 30165, 30133, 30106]): (45631, 45597, 45607, 45620), frozenset([30068, 29976, 30165, 30133, 30110]): (45631, 45597, 45607, 45621), frozenset([30068, 29976, 30165, 30133, 30108]): (45631, 45597, 45607, 45620), frozenset([30068, 29976, 30165, 30133, 30112]): (45631, 45597, 45607, 45619), frozenset([30068, 29976, 30165, 30134, 30106]): (45631, 45597, 45608, 45620), frozenset([30068, 29976, 30165, 30134, 30110]): (45631, 45597, 45608, 45621), frozenset([30068, 29976, 30165, 30134, 30108]): (45631, 45597, 45608, 45620), frozenset([30068, 29976, 30165, 30134, 30112]): (45631, 45597, 45608, 45619), frozenset([30068, 29976, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30068, 29976, 30165, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30068, 29976, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30068, 29976, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30068, 29977, 30159, 30132, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30159, 30132, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30159, 30132, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30159, 30132, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30159, 30133, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30159, 30133, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30159, 30133, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30159, 30133, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30159, 30134, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30159, 30134, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30159, 30134, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30159, 30134, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30159, 30135, 30106]): (45632, 45595, 45609, 45620), frozenset([30068, 29977, 30159, 30135, 30110]): (45632, 45595, 45609, 45621), frozenset([30068, 29977, 30159, 30135, 30108]): (45632, 45595, 45609, 45620), frozenset([30068, 29977, 30159, 30135, 30112]): (45632, 45595, 45609, 45619), frozenset([30068, 29977, 30161, 30132, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30161, 30132, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30161, 30132, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30161, 30132, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30161, 30133, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30161, 30133, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30161, 30133, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30161, 30133, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30161, 30134, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30161, 30134, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30161, 30134, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30161, 30134, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30161, 30135, 30106]): (45632, 45595, 45609, 45620), frozenset([30068, 29977, 30161, 30135, 30110]): (45632, 45595, 45609, 45621), frozenset([30068, 29977, 30161, 30135, 30108]): (45632, 45595, 45609, 45620), frozenset([30068, 29977, 30161, 30135, 30112]): (45632, 45595, 45609, 45619), frozenset([30068, 29977, 30163, 30132, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30163, 30132, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30163, 30132, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30163, 30132, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30163, 30133, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30163, 30133, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30163, 30133, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30163, 30133, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30163, 30134, 30106]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30163, 30134, 30110]): (45632, 45596, 45609, 45621), frozenset([30068, 29977, 30163, 30134, 30108]): (45632, 45596, 45609, 45620), frozenset([30068, 29977, 30163, 30134, 30112]): (45632, 45596, 45609, 45619), frozenset([30068, 29977, 30163, 30135, 30106]): (45632, 45595, 45609, 45620), frozenset([30068, 29977, 30163, 30135, 30110]): (45632, 45595, 45609, 45621), frozenset([30068, 29977, 30163, 30135, 30108]): (45632, 45595, 45609, 45620), frozenset([30068, 29977, 30163, 30135, 30112]): (45632, 45595, 45609, 45619), frozenset([30068, 29977, 30165, 30132, 30106]): (45631, 45596, 45609, 45620), frozenset([30068, 29977, 30165, 30132, 30110]): (45631, 45596, 45609, 45621), frozenset([30068, 29977, 30165, 30132, 30108]): (45631, 45596, 45609, 45620), frozenset([30068, 29977, 30165, 30132, 30112]): (45631, 45596, 45609, 45619), frozenset([30068, 29977, 30165, 30133, 30106]): (45631, 45596, 45609, 45620), frozenset([30068, 29977, 30165, 30133, 30110]): (45631, 45596, 45609, 45621), frozenset([30068, 29977, 30165, 30133, 30108]): (45631, 45596, 45609, 45620), frozenset([30068, 29977, 30165, 30133, 30112]): (45631, 45596, 45609, 45619), frozenset([30068, 29977, 30165, 30134, 30106]): (45631, 45596, 45609, 45620), frozenset([30068, 29977, 30165, 30134, 30110]): (45631, 45596, 45609, 45621), frozenset([30068, 29977, 30165, 30134, 30108]): (45631, 45596, 45609, 45620), frozenset([30068, 29977, 30165, 30134, 30112]): (45631, 45596, 45609, 45619), frozenset([30068, 29977, 30165, 30135, 30106]): (45631, 45595, 45609, 45620), frozenset([30068, 29977, 30165, 30135, 30110]): (45631, 45595, 45609, 45621), frozenset([30068, 29977, 30165, 30135, 30108]): (45631, 45595, 45609, 45620), frozenset([30068, 29977, 30165, 30135, 30112]): (45631, 45595, 45609, 45619), frozenset([30070, 29974, 30159, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30159, 30132, 30110]): (45632, 45596, 45607, 45621), frozenset([30070, 29974, 30159, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30159, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29974, 30159, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30159, 30133, 30110]): (45632, 45596, 45607, 45621), frozenset([30070, 29974, 30159, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30159, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29974, 30159, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30070, 29974, 30159, 30134, 30110]): (45632, 45596, 45608, 45621), frozenset([30070, 29974, 30159, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30070, 29974, 30159, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30070, 29974, 30159, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30070, 29974, 30159, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30070, 29974, 30159, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30070, 29974, 30159, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29974, 30161, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30161, 30132, 30110]): (45632, 45596, 45607, 45621), frozenset([30070, 29974, 30161, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30161, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29974, 30161, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30161, 30133, 30110]): (45632, 45596, 45607, 45621), frozenset([30070, 29974, 30161, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30161, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29974, 30161, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30070, 29974, 30161, 30134, 30110]): (45632, 45596, 45608, 45621), frozenset([30070, 29974, 30161, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30070, 29974, 30161, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30070, 29974, 30161, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30070, 29974, 30161, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30070, 29974, 30161, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30070, 29974, 30161, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29974, 30163, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30163, 30132, 30110]): (45632, 45596, 45607, 45621), frozenset([30070, 29974, 30163, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30163, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29974, 30163, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30163, 30133, 30110]): (45632, 45596, 45607, 45621), frozenset([30070, 29974, 30163, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30163, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29974, 30163, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30070, 29974, 30163, 30134, 30110]): (45632, 45596, 45608, 45621), frozenset([30070, 29974, 30163, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30070, 29974, 30163, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30070, 29974, 30163, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30070, 29974, 30163, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30070, 29974, 30163, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30070, 29974, 30163, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29974, 30165, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30165, 30132, 30110]): (45631, 45596, 45607, 45621), frozenset([30070, 29974, 30165, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30165, 30132, 30112]): (45631, 45596, 45607, 45619), frozenset([30070, 29974, 30165, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30165, 30133, 30110]): (45631, 45596, 45607, 45621), frozenset([30070, 29974, 30165, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29974, 30165, 30133, 30112]): (45631, 45596, 45607, 45619), frozenset([30070, 29974, 30165, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30070, 29974, 30165, 30134, 30110]): (45631, 45596, 45608, 45621), frozenset([30070, 29974, 30165, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30070, 29974, 30165, 30134, 30112]): (45631, 45596, 45608, 45619), frozenset([30070, 29974, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30070, 29974, 30165, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30070, 29974, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30070, 29974, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30070, 29975, 30159, 30132, 30106]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30159, 30132, 30110]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30159, 30132, 30108]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30159, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29975, 30159, 30133, 30106]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30159, 30133, 30110]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30159, 30133, 30108]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30159, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29975, 30159, 30134, 30106]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30159, 30134, 30110]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30159, 30134, 30108]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30159, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30070, 29975, 30159, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30159, 30135, 30110]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30159, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30159, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29975, 30161, 30132, 30106]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30161, 30132, 30110]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30161, 30132, 30108]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30161, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29975, 30161, 30133, 30106]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30161, 30133, 30110]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30161, 30133, 30108]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30161, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29975, 30161, 30134, 30106]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30161, 30134, 30110]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30161, 30134, 30108]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30161, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30070, 29975, 30161, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30161, 30135, 30110]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30161, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30161, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29975, 30163, 30132, 30106]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30163, 30132, 30110]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30163, 30132, 30108]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30163, 30132, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29975, 30163, 30133, 30106]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30163, 30133, 30110]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30163, 30133, 30108]): (45632, 45596, 45607, 45620), frozenset([30070, 29975, 30163, 30133, 30112]): (45632, 45596, 45607, 45619), frozenset([30070, 29975, 30163, 30134, 30106]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30163, 30134, 30110]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30163, 30134, 30108]): (45632, 45596, 45608, 45620), frozenset([30070, 29975, 30163, 30134, 30112]): (45632, 45596, 45608, 45619), frozenset([30070, 29975, 30163, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30163, 30135, 30110]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30163, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30070, 29975, 30163, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29975, 30165, 30132, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29975, 30165, 30132, 30110]): (45631, 45596, 45607, 45620), frozenset([30070, 29975, 30165, 30132, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29975, 30165, 30132, 30112]): (45631, 45596, 45607, 45619), frozenset([30070, 29975, 30165, 30133, 30106]): (45631, 45596, 45607, 45620), frozenset([30070, 29975, 30165, 30133, 30110]): (45631, 45596, 45607, 45620), frozenset([30070, 29975, 30165, 30133, 30108]): (45631, 45596, 45607, 45620), frozenset([30070, 29975, 30165, 30133, 30112]): (45631, 45596, 45607, 45619), frozenset([30070, 29975, 30165, 30134, 30106]): (45631, 45596, 45608, 45620), frozenset([30070, 29975, 30165, 30134, 30110]): (45631, 45596, 45608, 45620), frozenset([30070, 29975, 30165, 30134, 30108]): (45631, 45596, 45608, 45620), frozenset([30070, 29975, 30165, 30134, 30112]): (45631, 45596, 45608, 45619), frozenset([30070, 29975, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30070, 29975, 30165, 30135, 30110]): (45631, 45595, 45607, 45620), frozenset([30070, 29975, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30070, 29975, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30070, 29976, 30159, 30132, 30106]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30159, 30132, 30110]): (45632, 45597, 45607, 45621), frozenset([30070, 29976, 30159, 30132, 30108]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30159, 30132, 30112]): (45632, 45597, 45607, 45619), frozenset([30070, 29976, 30159, 30133, 30106]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30159, 30133, 30110]): (45632, 45597, 45607, 45621), frozenset([30070, 29976, 30159, 30133, 30108]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30159, 30133, 30112]): (45632, 45597, 45607, 45619), frozenset([30070, 29976, 30159, 30134, 30106]): (45632, 45597, 45608, 45620), frozenset([30070, 29976, 30159, 30134, 30110]): (45632, 45597, 45608, 45621), frozenset([30070, 29976, 30159, 30134, 30108]): (45632, 45597, 45608, 45620), frozenset([30070, 29976, 30159, 30134, 30112]): (45632, 45597, 45608, 45619), frozenset([30070, 29976, 30159, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30070, 29976, 30159, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30070, 29976, 30159, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30070, 29976, 30159, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29976, 30161, 30132, 30106]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30161, 30132, 30110]): (45632, 45597, 45607, 45621), frozenset([30070, 29976, 30161, 30132, 30108]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30161, 30132, 30112]): (45632, 45597, 45607, 45619), frozenset([30070, 29976, 30161, 30133, 30106]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30161, 30133, 30110]): (45632, 45597, 45607, 45621), frozenset([30070, 29976, 30161, 30133, 30108]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30161, 30133, 30112]): (45632, 45597, 45607, 45619), frozenset([30070, 29976, 30161, 30134, 30106]): (45632, 45597, 45608, 45620), frozenset([30070, 29976, 30161, 30134, 30110]): (45632, 45597, 45608, 45621), frozenset([30070, 29976, 30161, 30134, 30108]): (45632, 45597, 45608, 45620), frozenset([30070, 29976, 30161, 30134, 30112]): (45632, 45597, 45608, 45619), frozenset([30070, 29976, 30161, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30070, 29976, 30161, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30070, 29976, 30161, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30070, 29976, 30161, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29976, 30163, 30132, 30106]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30163, 30132, 30110]): (45632, 45597, 45607, 45621), frozenset([30070, 29976, 30163, 30132, 30108]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30163, 30132, 30112]): (45632, 45597, 45607, 45619), frozenset([30070, 29976, 30163, 30133, 30106]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30163, 30133, 30110]): (45632, 45597, 45607, 45621), frozenset([30070, 29976, 30163, 30133, 30108]): (45632, 45597, 45607, 45620), frozenset([30070, 29976, 30163, 30133, 30112]): (45632, 45597, 45607, 45619), frozenset([30070, 29976, 30163, 30134, 30106]): (45632, 45597, 45608, 45620), frozenset([30070, 29976, 30163, 30134, 30110]): (45632, 45597, 45608, 45621), frozenset([30070, 29976, 30163, 30134, 30108]): (45632, 45597, 45608, 45620), frozenset([30070, 29976, 30163, 30134, 30112]): (45632, 45597, 45608, 45619), frozenset([30070, 29976, 30163, 30135, 30106]): (45632, 45595, 45607, 45620), frozenset([30070, 29976, 30163, 30135, 30110]): (45632, 45595, 45607, 45621), frozenset([30070, 29976, 30163, 30135, 30108]): (45632, 45595, 45607, 45620), frozenset([30070, 29976, 30163, 30135, 30112]): (45632, 45595, 45607, 45619), frozenset([30070, 29976, 30165, 30132, 30106]): (45631, 45597, 45607, 45620), frozenset([30070, 29976, 30165, 30132, 30110]): (45631, 45597, 45607, 45621), frozenset([30070, 29976, 30165, 30132, 30108]): (45631, 45597, 45607, 45620), frozenset([30070, 29976, 30165, 30132, 30112]): (45631, 45597, 45607, 45619), frozenset([30070, 29976, 30165, 30133, 30106]): (45631, 45597, 45607, 45620), frozenset([30070, 29976, 30165, 30133, 30110]): (45631, 45597, 45607, 45621), frozenset([30070, 29976, 30165, 30133, 30108]): (45631, 45597, 45607, 45620), frozenset([30070, 29976, 30165, 30133, 30112]): (45631, 45597, 45607, 45619), frozenset([30070, 29976, 30165, 30134, 30106]): (45631, 45597, 45608, 45620), frozenset([30070, 29976, 30165, 30134, 30110]): (45631, 45597, 45608, 45621), frozenset([30070, 29976, 30165, 30134, 30108]): (45631, 45597, 45608, 45620), frozenset([30070, 29976, 30165, 30134, 30112]): (45631, 45597, 45608, 45619), frozenset([30070, 29976, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30070, 29976, 30165, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30070, 29976, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30070, 29976, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30070, 29977, 30159, 30132, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30159, 30132, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30159, 30132, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30159, 30132, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30159, 30133, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30159, 30133, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30159, 30133, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30159, 30133, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30159, 30134, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30159, 30134, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30159, 30134, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30159, 30134, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30159, 30135, 30106]): (45632, 45595, 45609, 45620), frozenset([30070, 29977, 30159, 30135, 30110]): (45632, 45595, 45609, 45621), frozenset([30070, 29977, 30159, 30135, 30108]): (45632, 45595, 45609, 45620), frozenset([30070, 29977, 30159, 30135, 30112]): (45632, 45595, 45609, 45619), frozenset([30070, 29977, 30161, 30132, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30161, 30132, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30161, 30132, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30161, 30132, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30161, 30133, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30161, 30133, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30161, 30133, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30161, 30133, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30161, 30134, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30161, 30134, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30161, 30134, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30161, 30134, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30161, 30135, 30106]): (45632, 45595, 45609, 45620), frozenset([30070, 29977, 30161, 30135, 30110]): (45632, 45595, 45609, 45621), frozenset([30070, 29977, 30161, 30135, 30108]): (45632, 45595, 45609, 45620), frozenset([30070, 29977, 30161, 30135, 30112]): (45632, 45595, 45609, 45619), frozenset([30070, 29977, 30163, 30132, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30163, 30132, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30163, 30132, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30163, 30132, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30163, 30133, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30163, 30133, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30163, 30133, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30163, 30133, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30163, 30134, 30106]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30163, 30134, 30110]): (45632, 45596, 45609, 45621), frozenset([30070, 29977, 30163, 30134, 30108]): (45632, 45596, 45609, 45620), frozenset([30070, 29977, 30163, 30134, 30112]): (45632, 45596, 45609, 45619), frozenset([30070, 29977, 30163, 30135, 30106]): (45632, 45595, 45609, 45620), frozenset([30070, 29977, 30163, 30135, 30110]): (45632, 45595, 45609, 45621), frozenset([30070, 29977, 30163, 30135, 30108]): (45632, 45595, 45609, 45620), frozenset([30070, 29977, 30163, 30135, 30112]): (45632, 45595, 45609, 45619), frozenset([30070, 29977, 30165, 30132, 30106]): (45631, 45596, 45609, 45620), frozenset([30070, 29977, 30165, 30132, 30110]): (45631, 45596, 45609, 45621), frozenset([30070, 29977, 30165, 30132, 30108]): (45631, 45596, 45609, 45620), frozenset([30070, 29977, 30165, 30132, 30112]): (45631, 45596, 45609, 45619), frozenset([30070, 29977, 30165, 30133, 30106]): (45631, 45596, 45609, 45620), frozenset([30070, 29977, 30165, 30133, 30110]): (45631, 45596, 45609, 45621), frozenset([30070, 29977, 30165, 30133, 30108]): (45631, 45596, 45609, 45620), frozenset([30070, 29977, 30165, 30133, 30112]): (45631, 45596, 45609, 45619), frozenset([30070, 29977, 30165, 30134, 30106]): (45631, 45596, 45609, 45620), frozenset([30070, 29977, 30165, 30134, 30110]): (45631, 45596, 45609, 45621), frozenset([30070, 29977, 30165, 30134, 30108]): (45631, 45596, 45609, 45620), frozenset([30070, 29977, 30165, 30134, 30112]): (45631, 45596, 45609, 45619), frozenset([30070, 29977, 30165, 30135, 30106]): (45631, 45595, 45609, 45620), frozenset([30070, 29977, 30165, 30135, 30110]): (45631, 45595, 45609, 45621), frozenset([30070, 29977, 30165, 30135, 30108]): (45631, 45595, 45609, 45620), frozenset([30070, 29977, 30165, 30135, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29974, 30159, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30159, 30132, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30159, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30159, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30159, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30159, 30133, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30159, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30159, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30159, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29974, 30159, 30134, 30110]): (45631, 45595, 45608, 45621), frozenset([30072, 29974, 30159, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29974, 30159, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29974, 30159, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30159, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30159, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30159, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30161, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30161, 30132, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30161, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30161, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30161, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30161, 30133, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30161, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30161, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30161, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29974, 30161, 30134, 30110]): (45631, 45595, 45608, 45621), frozenset([30072, 29974, 30161, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29974, 30161, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29974, 30161, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30161, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30161, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30161, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30163, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30163, 30132, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30163, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30163, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30163, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30163, 30133, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30163, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30163, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30163, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29974, 30163, 30134, 30110]): (45631, 45595, 45608, 45621), frozenset([30072, 29974, 30163, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29974, 30163, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29974, 30163, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30163, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30163, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30163, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30165, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30165, 30132, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30165, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30165, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30165, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30165, 30133, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30165, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30165, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29974, 30165, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29974, 30165, 30134, 30110]): (45631, 45595, 45608, 45621), frozenset([30072, 29974, 30165, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29974, 30165, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29974, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30165, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29974, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29974, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30159, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30132, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30159, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30133, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30159, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30159, 30134, 30110]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30159, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30159, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29975, 30159, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30135, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30159, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30161, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30132, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30161, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30133, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30161, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30161, 30134, 30110]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30161, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30161, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29975, 30161, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30135, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30161, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30163, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30132, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30163, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30133, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30163, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30163, 30134, 30110]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30163, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30163, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29975, 30163, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30135, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30163, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30165, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30132, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30165, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30133, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29975, 30165, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30165, 30134, 30110]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30165, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29975, 30165, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29975, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30135, 30110]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29975, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30159, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30159, 30132, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30159, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30159, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30159, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30159, 30133, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30159, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30159, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30159, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29976, 30159, 30134, 30110]): (45631, 45595, 45608, 45621), frozenset([30072, 29976, 30159, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29976, 30159, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29976, 30159, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30159, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30159, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30159, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30161, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30161, 30132, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30161, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30161, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30161, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30161, 30133, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30161, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30161, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30161, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29976, 30161, 30134, 30110]): (45631, 45595, 45608, 45621), frozenset([30072, 29976, 30161, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29976, 30161, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29976, 30161, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30161, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30161, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30161, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30163, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30163, 30132, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30163, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30163, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30163, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30163, 30133, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30163, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30163, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30163, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29976, 30163, 30134, 30110]): (45631, 45595, 45608, 45621), frozenset([30072, 29976, 30163, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29976, 30163, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29976, 30163, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30163, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30163, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30163, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30165, 30132, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30165, 30132, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30165, 30132, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30165, 30132, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30165, 30133, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30165, 30133, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30165, 30133, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30165, 30133, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29976, 30165, 30134, 30106]): (45631, 45595, 45608, 45620), frozenset([30072, 29976, 30165, 30134, 30110]): (45631, 45595, 45608, 45621), frozenset([30072, 29976, 30165, 30134, 30108]): (45631, 45595, 45608, 45620), frozenset([30072, 29976, 30165, 30134, 30112]): (45631, 45595, 45608, 45619), frozenset([30072, 29976, 30165, 30135, 30106]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30165, 30135, 30110]): (45631, 45595, 45607, 45621), frozenset([30072, 29976, 30165, 30135, 30108]): (45631, 45595, 45607, 45620), frozenset([30072, 29976, 30165, 30135, 30112]): (45631, 45595, 45607, 45619), frozenset([30072, 29977, 30159, 30132, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30159, 30132, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30159, 30132, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30159, 30132, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30159, 30133, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30159, 30133, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30159, 30133, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30159, 30133, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30159, 30134, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30159, 30134, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30159, 30134, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30159, 30134, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30159, 30135, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30159, 30135, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30159, 30135, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30159, 30135, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30161, 30132, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30161, 30132, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30161, 30132, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30161, 30132, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30161, 30133, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30161, 30133, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30161, 30133, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30161, 30133, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30161, 30134, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30161, 30134, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30161, 30134, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30161, 30134, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30161, 30135, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30161, 30135, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30161, 30135, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30161, 30135, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30163, 30132, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30163, 30132, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30163, 30132, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30163, 30132, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30163, 30133, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30163, 30133, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30163, 30133, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30163, 30133, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30163, 30134, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30163, 30134, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30163, 30134, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30163, 30134, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30163, 30135, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30163, 30135, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30163, 30135, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30163, 30135, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30165, 30132, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30165, 30132, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30165, 30132, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30165, 30132, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30165, 30133, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30165, 30133, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30165, 30133, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30165, 30133, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30165, 30134, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30165, 30134, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30165, 30134, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30165, 30134, 30112]): (45631, 45595, 45609, 45619), frozenset([30072, 29977, 30165, 30135, 30106]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30165, 30135, 30110]): (45631, 45595, 45609, 45621), frozenset([30072, 29977, 30165, 30135, 30108]): (45631, 45595, 45609, 45620), frozenset([30072, 29977, 30165, 30135, 30112]): (45631, 45595, 45609, 45619), } conversion2 = { 30326: 30325, 30536: 30539, 30541: 30546, 30542: 30548, 30543: 30547, 20116: 20115, 30600: 30586, 30605: 30588, 30599: 30582, 30036: 45624, 30038: 45622, 30040: 45622, 30042: 45622, 30046: 45627, 30048: 45625, 30050: 45625, 30052: 45625, 30056: 45630, 30058: 45628, 30060: 45628, 30062: 45628, 30066: 45633, 30068: 45631, 30070: 45631, 30072: 45631, 30139: 45626, 30141: 45626, 30143: 45626, 30145: 45627, 30149: 45629, 30151: 45629, 30153: 45629, 30155: 45630, 30159: 45632, 30161: 45632, 30163: 45632, 30165: 45633, 30169: 45623, 30171: 45623, 30173: 45623, 30175: 45624, 30076: 45611, 30078: 45612, 30080: 45612, 30082: 45610, 30086: 45614, 30088: 45614, 30090: 45615, 30092: 45613, 30096: 45618, 30098: 45618, 30100: 45617, 30102: 45616, 30106: 45620, 30108: 45620, 30110: 45621, 30112: 45619, 29964: 45587, 29965: 45588, 29966: 45587, 29967: 45587, 29969: 45590, 29970: 45591, 29971: 45590, 29972: 45590, 29974: 45596, 29975: 45596, 29976: 45597, 29977: 45596, 29979: 45593, 29980: 45594, 29981: 45593, 29982: 45593, 30117: 45599, 30118: 45599, 30119: 45598, 30120: 45598, 30122: 45601, 30123: 45601, 30124: 45602, 30125: 45601, 30127: 45604, 30128: 45604, 30129: 45605, 30130: 45604, 30132: 45607, 30133: 45607, 30134: 45608, 30135: 45607, } def upgrade(saveddata_engine): # First we want to get a list of fittings that are completely fitted out with subsystems oldItems = [str(x) for x in conversion2.keys()] # I can't figure out a way to get IN operator to work when supplying a list using a parameterized query. So I'm # doing it the shitty way by formatting the SQL string. Don't do this kids! fits = [ x["fitID"] for x in saveddata_engine.execute( "SELECT fitID FROM modules WHERE itemID IN ({}) GROUP BY fitID HAVING COUNT(*) = 5".format( ",".join(oldItems) ) ) ] for fitID in fits: try: # Gather a list of the old subsystems and their record IDs modules = saveddata_engine.execute( "SELECT * FROM modules WHERE itemID IN ({}) AND fitID = ?".format( ",".join(oldItems) ), (fitID,), ) oldModules = [] for mod in modules: oldModules.append((mod["ID"], mod["itemID"])) # find the conversion in the Big Fucken Dictionary (BFD) newModules = conversion.get(frozenset([y[1] for y in oldModules]), None) if newModules is None: # We don't have a conversion for this. I don't think this will ever happen, but who knows continue # It doesn't actully matter which old module is replaced with which new module, so we don't have to worry # about module position or anything like that. Just doe a straight up record UPDATE for i, old in enumerate(oldModules[:4]): saveddata_engine.execute( "UPDATE modules SET itemID = ? WHERE ID = ?", (newModules[i], old[0]), ) # And last but not least, delete the last subsystem saveddata_engine.execute( "DELETE FROM modules WHERE ID = ?", (oldModules[4][0],) ) except (KeyboardInterrupt, SystemExit): raise except: # if something fails, fuck it, we tried. It'll default to the generic conversion below continue for oldItem, newItem in conversion2.items(): saveddata_engine.execute( 'UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?', (newItem, oldItem) ) saveddata_engine.execute( 'UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?', (newItem, oldItem) )
utils
stacks
""" raven.utils.stacks ~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, division import inspect import linecache import os import re import sys from raven.utils.compat import iteritems from raven.utils.serializer import transform _coding_re = re.compile(r"coding[:=]\s*([-\w.]+)") def get_lines_from_file(filename, lineno, context_lines, loader=None, module_name=None): """ Returns context_lines before and after lineno from file. Returns (pre_context_lineno, pre_context, context_line, post_context). """ source = None if loader is not None and hasattr(loader, "get_source"): try: source = loader.get_source(module_name) except (ImportError, IOError): # Traceback (most recent call last): # File "/Users/dcramer/Development/django-sentry/sentry/client/handlers.py", line 31, in emit # get_client().create_from_record(record, request=request) # File "/Users/dcramer/Development/django-sentry/sentry/client/base.py", line 325, in create_from_record # data['__sentry__']['frames'] = varmap(shorten, get_stack_info(stack)) # File "/Users/dcramer/Development/django-sentry/sentry/utils/stacks.py", line 112, in get_stack_info # pre_context_lineno, pre_context, context_line, post_context = get_lines_from_file(filename, lineno, 7, loader, module_name) # File "/Users/dcramer/Development/django-sentry/sentry/utils/stacks.py", line 24, in get_lines_from_file # source = loader.get_source(module_name) # File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 287, in get_source # fullname = self._fix_name(fullname) # File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 262, in _fix_name # "module %s" % (self.fullname, fullname)) # ImportError: Loader for module cProfile cannot handle module __main__ source = None if source is not None: source = source.splitlines() if source is None: try: source = linecache.getlines(filename) except (OSError, IOError): return None, None, None if not source: return None, None, None lower_bound = max(0, lineno - context_lines) upper_bound = min(lineno + 1 + context_lines, len(source)) try: pre_context = [line.strip("\r\n") for line in source[lower_bound:lineno]] context_line = source[lineno].strip("\r\n") post_context = [ line.strip("\r\n") for line in source[(lineno + 1) : upper_bound] ] except IndexError: # the file may have changed since it was loaded into memory return None, None, None return ( slim_string(pre_context), slim_string(context_line), slim_string(post_context), ) def _getitem_from_frame(f_locals, key, default=None): """ f_locals is not guaranteed to have .get(), but it will always support __getitem__. Even if it doesn't, we return ``default``. """ try: return f_locals[key] except Exception: return default def to_dict(dictish): """ Given something that closely resembles a dictionary, we attempt to coerce it into a propery dictionary. """ if hasattr(dictish, "iterkeys"): m = dictish.iterkeys elif hasattr(dictish, "keys"): m = dictish.keys else: raise ValueError(dictish) return dict((k, dictish[k]) for k in m()) def iter_traceback_frames(tb): """ Given a traceback object, it will iterate over all frames that do not contain the ``__traceback_hide__`` local variable. """ # Some versions of celery have hacked traceback objects that might # miss tb_frame. while tb and hasattr(tb, "tb_frame"): # support for __traceback_hide__ which is used by a few libraries # to hide internal frames. f_locals = getattr(tb.tb_frame, "f_locals", {}) if not _getitem_from_frame(f_locals, "__traceback_hide__"): yield tb.tb_frame, getattr(tb, "tb_lineno", None) tb = tb.tb_next def iter_stack_frames(frames=None): """ Given an optional list of frames (defaults to current stack), iterates over all frames that do not contain the ``__traceback_hide__`` local variable. """ if not frames: frames = inspect.stack()[1:] for frame, lineno in ((f[0], f[2]) for f in frames): f_locals = getattr(frame, "f_locals", {}) if not _getitem_from_frame(f_locals, "__traceback_hide__"): yield frame, lineno def get_frame_locals(frame, transformer=transform, max_var_size=4096): f_locals = getattr(frame, "f_locals", None) if not f_locals: return None if not isinstance(f_locals, dict): # XXX: Genshi (and maybe others) have broken implementations of # f_locals that are not actually dictionaries try: f_locals = to_dict(f_locals) except Exception: return None f_vars = {} f_size = 0 for k, v in iteritems(f_locals): v = transformer(v) v_size = len(repr(v)) if v_size + f_size < max_var_size: f_vars[k] = v f_size += v_size return f_vars def slim_frame_data(frames, frame_allowance=25): """ Removes various excess metadata from middle frames which go beyond ``frame_allowance``. Returns ``frames``. """ frames_len = 0 app_frames = [] system_frames = [] for frame in frames: frames_len += 1 if frame.get("in_app"): app_frames.append(frame) else: system_frames.append(frame) if frames_len <= frame_allowance: return frames remaining = frames_len - frame_allowance app_count = len(app_frames) system_allowance = max(frame_allowance - app_count, 0) if system_allowance: half_max = int(system_allowance / 2) # prioritize trimming system frames for frame in system_frames[half_max:-half_max]: frame.pop("vars", None) frame.pop("pre_context", None) frame.pop("post_context", None) remaining -= 1 else: for frame in system_frames: frame.pop("vars", None) frame.pop("pre_context", None) frame.pop("post_context", None) remaining -= 1 if remaining: app_allowance = app_count - remaining half_max = int(app_allowance / 2) for frame in app_frames[half_max:-half_max]: frame.pop("vars", None) frame.pop("pre_context", None) frame.pop("post_context", None) return frames def slim_string(value, length=512): if not value: return value if len(value) > length: return value[: length - 3] + "..." return value[:length] def get_stack_info( frames, transformer=transform, capture_locals=True, frame_allowance=25 ): """ Given a list of frames, returns a list of stack information dictionary objects that are JSON-ready. We have to be careful here as certain implementations of the _Frame class do not contain the necessary data to lookup all of the information we want. """ __traceback_hide__ = True # NOQA result = [] for frame_info in frames: # Old, terrible API if isinstance(frame_info, (list, tuple)): frame, lineno = frame_info else: frame = frame_info lineno = frame_info.f_lineno # Support hidden frames f_locals = getattr(frame, "f_locals", {}) if _getitem_from_frame(f_locals, "__traceback_hide__"): continue f_globals = getattr(frame, "f_globals", {}) f_code = getattr(frame, "f_code", None) if f_code: abs_path = frame.f_code.co_filename function = frame.f_code.co_name else: abs_path = None function = None loader = _getitem_from_frame(f_globals, "__loader__") module_name = _getitem_from_frame(f_globals, "__name__") if lineno: lineno -= 1 if lineno is not None and abs_path: pre_context, context_line, post_context = get_lines_from_file( abs_path, lineno, 5, loader, module_name ) else: pre_context, context_line, post_context = None, None, None # Try to pull a relative file path # This changes /foo/site-packages/baz/bar.py into baz/bar.py try: base_filename = sys.modules[module_name.split(".", 1)[0]].__file__ filename = abs_path.split(base_filename.rsplit(os.sep, 2)[0], 1)[-1].lstrip( os.sep ) except Exception: filename = abs_path if not filename: filename = abs_path frame_result = { "abs_path": abs_path, "filename": filename, "module": module_name or None, "function": function or "<unknown>", "lineno": lineno + 1, } if capture_locals: f_vars = get_frame_locals(frame, transformer=transformer) if f_vars: frame_result["vars"] = f_vars if context_line is not None: frame_result.update( { "pre_context": pre_context, "context_line": context_line, "post_context": post_context, } ) result.append(frame_result) stackinfo = { "frames": slim_frame_data(result, frame_allowance=frame_allowance), } return stackinfo
ui
coreconfig
# # Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com> # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # import logging import deluge.component as component from deluge.ui.client import client log = logging.getLogger(__name__) class CoreConfig(component.Component): def __init__(self): log.debug("CoreConfig init..") component.Component.__init__(self, "CoreConfig") self.config = {} def on_configvaluechanged_event(key, value): self.config[key] = value client.register_event_handler( "ConfigValueChangedEvent", on_configvaluechanged_event ) def start(self): def on_get_config(config): self.config = config return config return client.core.get_config().addCallback(on_get_config) def stop(self): self.config = {} def __contains__(self, key): return key in self.config def __getitem__(self, key): return self.config[key] def __setitem__(self, key, value): client.core.set_config({key: value}) def __getattr__(self, attr): # We treat this directly interacting with the dictionary return getattr(self.config, attr)
downloaders
FikperCom
# -*- coding: utf-8 -*- import json import re from ..anticaptchas.HCaptcha import HCaptcha from ..base.simple_downloader import SimpleDownloader class FikperCom(SimpleDownloader): __name__ = "FikperCom" __type__ = "downloader" __version__ = "0.01" __status__ = "testing" __pattern__ = r"https?://fikper\.com/(?P<ID>\w+)" __config__ = [ ("enabled", "bool", "Activated", True), ("use_premium", "bool", "Use premium account if available", True), ("fallback", "bool", "Fallback to free download if premium fails", True), ("chk_filesize", "bool", "Check file size", True), ("max_wait", "int", "Reconnect if waiting time is greater than minutes", 10), ] __description__ = """Fikper.com downloader plugin""" __license__ = "GPLv3" __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] HCAPTCHA_KEY = "ddd70c6f-e4cb-45e2-9374-171fbc0d4137" API_URL = "https://sapi.fikper.com/" DIRECT_LINK = False def api_request(self, *args, **kwargs): json_data = self.load(self.API_URL, post=kwargs) return json.loads(json_data) def api_info(self, url): info = {} file_id = re.match(self.__pattern__, url).group("ID") file_info = self.api_request(fileHashName=file_id) if file_info.get("code") == 404: info["status"] = 1 else: info["status"] = 2 info["name"] = file_info["name"] info["size"] = file_info["size"] info["download_token"] = file_info["downloadToken"] info["delay_dime"] = file_info["delayTime"] info["dl_limit_delay"] = int(file_info.get("remainingDelay", 0)) return info def handle_free(self, pyfile): dl_limit_delay = self.info["dl_limit_delay"] if dl_limit_delay: self.wait( dl_limit_delay, reconnect=dl_limit_delay > self.config.get("max_wait", 10) * 60, ) self.restart(self._("Download limit exceeded")) self.captcha = HCaptcha(pyfile) self.set_wait(self.info["delay_dime"] / 1000) response = self.captcha.challenge(self.HCAPTCHA_KEY) self.wait() json_data = self.api_request( fileHashName=self.info["pattern"]["ID"], downloadToken=self.info["download_token"], recaptcha=response, ) if "directLink" in json_data: self.link = json_data["directLink"]
api
authentication
import datetime import time from typing import Any, Dict, Optional, cast from uuid import uuid4 from django.conf import settings from django.contrib.auth import authenticate, login from django.contrib.auth import views as auth_views from django.contrib.auth.password_validation import validate_password from django.contrib.auth.tokens import ( PasswordResetTokenGenerator as DefaultPasswordResetTokenGenerator, ) from django.core.exceptions import ValidationError from django.db import transaction from django.http import HttpRequest, HttpResponse, JsonResponse from django.shortcuts import redirect from django.views.decorators.csrf import csrf_protect from django_otp import login as otp_login from loginas.utils import is_impersonated_session, restore_original_login from posthog.api.email_verification import EmailVerifier from posthog.email import is_email_available from posthog.event_usage import report_user_logged_in, report_user_password_reset from posthog.models import OrganizationDomain, User from posthog.tasks.email import send_password_reset from posthog.utils import get_instance_available_sso_providers from rest_framework import mixins, permissions, serializers, status, viewsets from rest_framework.exceptions import APIException from rest_framework.request import Request from rest_framework.response import Response from rest_framework.throttling import UserRateThrottle from social_django.views import auth from two_factor.utils import default_device from two_factor.views.core import REMEMBER_COOKIE_PREFIX from two_factor.views.utils import ( get_remember_device_cookie, validate_remember_device_cookie, ) class UserPasswordResetThrottle(UserRateThrottle): rate = "6/day" @csrf_protect def logout(request): if request.user.is_authenticated: request.user.temporary_token = None request.user.save() if is_impersonated_session(request): restore_original_login(request) return redirect("/admin/") response = auth_views.logout_then_login(request) return response def axes_locked_out(*args, **kwargs): return JsonResponse( { "type": "authentication_error", "code": "too_many_failed_attempts", "detail": "Too many failed login attempts. Please try again in" f" {int(settings.AXES_COOLOFF_TIME.seconds / 60)} minutes.", "attr": None, }, status=status.HTTP_403_FORBIDDEN, ) def sso_login(request: HttpRequest, backend: str) -> HttpResponse: request.session.flush() sso_providers = get_instance_available_sso_providers() # because SAML is configured at the domain-level, we have to assume it's enabled for someone in the instance sso_providers["saml"] = settings.EE_AVAILABLE if backend not in sso_providers: return redirect(f"/login?error_code=invalid_sso_provider") if not sso_providers[backend]: return redirect(f"/login?error_code=improperly_configured_sso") return auth(request, backend) class TwoFactorRequired(APIException): status_code = 401 default_detail = "2FA is required." default_code = "2fa_required" class LoginSerializer(serializers.Serializer): email = serializers.EmailField() password = serializers.CharField() def to_representation(self, instance: Any) -> Dict[str, Any]: return {"success": True} def _check_if_2fa_required(self, user: User) -> bool: device = default_device(user) if not device: return False # If user has a valid 2FA cookie, use that instead of showing them the 2FA screen for key, value in self.context["request"].COOKIES.items(): if key.startswith(REMEMBER_COOKIE_PREFIX) and value: if validate_remember_device_cookie( value, user=user, otp_device_id=device.persistent_id ): user.otp_device = device # type: ignore device.throttle_reset() return False return True def create(self, validated_data: Dict[str, str]) -> Any: # Check SSO enforcement (which happens at the domain level) sso_enforcement = ( OrganizationDomain.objects.get_sso_enforcement_for_email_address( validated_data["email"] ) ) if sso_enforcement: raise serializers.ValidationError( f"You can only login with SSO for this account ({sso_enforcement}).", code="sso_enforced", ) request = self.context["request"] user = cast( Optional[User], authenticate( request, email=validated_data["email"], password=validated_data["password"], ), ) if not user: raise serializers.ValidationError( "Invalid email or password.", code="invalid_credentials" ) # We still let them log in if is_email_verified is null so existing users don't get locked out if is_email_available() and user.is_email_verified is not True: EmailVerifier.create_token_and_send_email_verification(user) # If it's None, we want to let them log in still since they are an existing user # If it's False, we want to tell them to check their email if user.is_email_verified is False: raise serializers.ValidationError( "Your account is awaiting verification. Please check your email for a verification link.", code="not_verified", ) if self._check_if_2fa_required(user): request.session["user_authenticated_but_no_2fa"] = user.pk request.session["user_authenticated_time"] = time.time() raise TwoFactorRequired() login(request, user, backend="django.contrib.auth.backends.ModelBackend") report_user_logged_in(user, social_provider="") return user class LoginPrecheckSerializer(serializers.Serializer): email = serializers.EmailField() def to_representation(self, instance: Dict[str, str]) -> Dict[str, Any]: return instance def create(self, validated_data: Dict[str, str]) -> Any: email = validated_data.get("email", "") # TODO: Refactor methods below to remove duplicate queries return { "sso_enforcement": OrganizationDomain.objects.get_sso_enforcement_for_email_address( email ), "saml_available": OrganizationDomain.objects.get_is_saml_available_for_email( email ), } class NonCreatingViewSetMixin(mixins.CreateModelMixin): def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: """ Method `create()` is overridden to send a more appropriate HTTP status code (as no object is actually created). """ response = super().create(request, *args, **kwargs) response.status_code = getattr(self, "SUCCESS_STATUS_CODE", status.HTTP_200_OK) return response class LoginViewSet(NonCreatingViewSetMixin, viewsets.GenericViewSet): queryset = User.objects.none() serializer_class = LoginSerializer permission_classes = (permissions.AllowAny,) class TwoFactorSerializer(serializers.Serializer): token = serializers.CharField(write_only=True) class TwoFactorViewSet(NonCreatingViewSetMixin, viewsets.GenericViewSet): serializer_class = TwoFactorSerializer queryset = User.objects.none() permission_classes = (permissions.AllowAny,) def _token_is_valid(self, request, user: User, device) -> Response: login(request, user, backend="django.contrib.auth.backends.ModelBackend") otp_login(request, device) report_user_logged_in(user, social_provider="") device.throttle_reset() cookie_key = REMEMBER_COOKIE_PREFIX + str(uuid4()) cookie_value = get_remember_device_cookie( user=user, otp_device_id=device.persistent_id ) response = Response({"success": True}) response.set_cookie( cookie_key, cookie_value, max_age=settings.TWO_FACTOR_REMEMBER_COOKIE_AGE, domain=getattr(settings, "TWO_FACTOR_REMEMBER_COOKIE_DOMAIN", None), path=getattr(settings, "TWO_FACTOR_REMEMBER_COOKIE_PATH", "/"), secure=getattr(settings, "TWO_FACTOR_REMEMBER_COOKIE_SECURE", True), httponly=getattr(settings, "TWO_FACTOR_REMEMBER_COOKIE_HTTPONLY", True), samesite=getattr(settings, "TWO_FACTOR_REMEMBER_COOKIE_SAMESITE", "Strict"), ) return response def create(self, request: Request, *args: Any, **kwargs: Any) -> Any: user = User.objects.get(pk=request.session["user_authenticated_but_no_2fa"]) expiration_time = request.session["user_authenticated_time"] + getattr( settings, "TWO_FACTOR_LOGIN_TIMEOUT", 600 ) if int(time.time()) > expiration_time: raise serializers.ValidationError( detail="Login attempt has expired. Re-enter username/password.", code="2fa_expired", ) with transaction.atomic(): device = default_device(user) is_allowed = device.verify_is_allowed() if not is_allowed[0]: raise serializers.ValidationError( detail="Too many attempts.", code="2fa_too_many_attempts" ) if device.verify_token(request.data["token"]): return self._token_is_valid(request, user, device) # Failed attempt so increase throttle device.throttle_increment() raise serializers.ValidationError( detail="2FA token was not valid", code="2fa_invalid" ) class LoginPrecheckViewSet(NonCreatingViewSetMixin, viewsets.GenericViewSet): queryset = User.objects.none() serializer_class = LoginPrecheckSerializer permission_classes = (permissions.AllowAny,) class PasswordResetSerializer(serializers.Serializer): email = serializers.EmailField(write_only=True) def create(self, validated_data): email = validated_data.pop("email") # Check SSO enforcement (which happens at the domain level) if OrganizationDomain.objects.get_sso_enforcement_for_email_address(email): raise serializers.ValidationError( "Password reset is disabled because SSO login is enforced for this domain.", code="sso_enforced", ) if not is_email_available(): raise serializers.ValidationError( "Cannot reset passwords because email is not configured for your instance. Please contact your administrator.", code="email_not_available", ) try: user = User.objects.filter(is_active=True).get(email=email) except User.DoesNotExist: user = None if user: user.requested_password_reset_at = datetime.datetime.now() user.save() token = password_reset_token_generator.make_token(user) send_password_reset(user.id, token) return True class PasswordResetCompleteSerializer(serializers.Serializer): token = serializers.CharField(write_only=True) password = serializers.CharField(write_only=True) def create(self, validated_data): # Special handling for E2E tests (note we don't actually change anything in the DB, just simulate the response) if settings.E2E_TESTING and validated_data["token"] == "e2e_test_token": return True try: user = User.objects.filter(is_active=True).get( uuid=self.context["view"].kwargs["user_uuid"] ) except User.DoesNotExist: raise serializers.ValidationError( {"token": ["This reset token is invalid or has expired."]}, code="invalid_token", ) if not password_reset_token_generator.check_token( user, validated_data["token"] ): raise serializers.ValidationError( {"token": ["This reset token is invalid or has expired."]}, code="invalid_token", ) password = validated_data["password"] try: validate_password(password, user) except ValidationError as e: raise serializers.ValidationError({"password": e.messages}) user.set_password(password) user.requested_password_reset_at = None user.save() login( self.context["request"], user, backend="django.contrib.auth.backends.ModelBackend", ) report_user_password_reset(user) return True class PasswordResetViewSet(NonCreatingViewSetMixin, viewsets.GenericViewSet): queryset = User.objects.none() serializer_class = PasswordResetSerializer permission_classes = (permissions.AllowAny,) throttle_classes = [UserPasswordResetThrottle] SUCCESS_STATUS_CODE = status.HTTP_204_NO_CONTENT class PasswordResetCompleteViewSet( NonCreatingViewSetMixin, mixins.RetrieveModelMixin, viewsets.GenericViewSet ): queryset = User.objects.none() serializer_class = PasswordResetCompleteSerializer permission_classes = (permissions.AllowAny,) SUCCESS_STATUS_CODE = status.HTTP_204_NO_CONTENT def get_object(self): token = self.request.query_params.get("token") user_uuid = self.kwargs.get("user_uuid") if not token: raise serializers.ValidationError( {"token": ["This field is required."]}, code="required" ) # Special handling for E2E tests if ( settings.E2E_TESTING and user_uuid == "e2e_test_user" and token == "e2e_test_token" ): return {"success": True, "token": token} try: user = User.objects.filter(is_active=True).get(uuid=user_uuid) except User.DoesNotExist: user = None if not user or not password_reset_token_generator.check_token(user, token): raise serializers.ValidationError( {"token": ["This reset token is invalid or has expired."]}, code="invalid_token", ) return {"success": True, "token": token} def retrieve(self, request: Request, *args: Any, **kwargs: Any) -> Response: response = super().retrieve(request, *args, **kwargs) response.status_code = self.SUCCESS_STATUS_CODE return response class PasswordResetTokenGenerator(DefaultPasswordResetTokenGenerator): def _make_hash_value(self, user, timestamp): # Due to type differences between the user model and the token generator, we need to # re-fetch the user from the database to get the correct type. usable_user: User = User.objects.get(pk=user.pk) return ( f"{user.pk}{user.email}{usable_user.requested_password_reset_at}{timestamp}" ) password_reset_token_generator = PasswordResetTokenGenerator()
addons
AppriseNotify
# -*- coding: utf-8 -*- from ..base.notifier import Notifier from ..helpers import check_module class AppriseNotify(Notifier): __name__ = "AppriseNotify" __type__ = "addon" __version__ = "0.02" __status__ = "testing" __config__ = [ ("enabled", "bool", "Activated", False), ("configs", "string", "Configuration(s) path/URL (comma separated)", ""), ("title", "string", "Notification title", "pyLoad Notification"), ("captcha", "bool", "Notify captcha request", True), ("reconnection", "bool", "Notify reconnection request", True), ("downloadfinished", "bool", "Notify download finished", True), ("downloadfailed", "bool", "Notify download failed", True), ("alldownloadsfinished", "bool", "Notify all downloads finished", True), ("alldownloadsprocessed", "bool", "Notify all downloads processed", True), ("packagefinished", "bool", "Notify package finished", True), ("packagefailed", "bool", "Notify package failed", True), ("update", "bool", "Notify pyload update", False), ("exit", "bool", "Notify pyload shutdown/restart", False), ("sendinterval", "int", "Interval in seconds between notifications", 1), ("sendpermin", "int", "Max notifications per minute", 60), ("ignoreclient", "bool", "Send notifications if client is connected", True), ] __description__ = "Send push notifications to apprise." __license__ = "GPLv3" __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] def get_key(self): return self.config.get("configs").split(",") def send(self, event, msg, key): if not check_module("apprise"): self.log_error( self._("Cannot send notification: apprise is not installed."), self._("Install apprise by issuing 'pip install apprise' command."), ) return import apprise apprise_obj = apprise.Apprise() apprise_config = apprise.AppriseConfig() for c in key: apprise_config.add(c) apprise_obj.add(apprise_config) apprise_obj.notify( title=self.config.get("title"), body="%s: %s" % (event, msg) if msg else event, )
prototypes
jsarray
import six if six.PY3: xrange = range import functools def to_arr(this): """Returns Python array from Js array""" return [this.get(str(e)) for e in xrange(len(this))] ARR_STACK = set({}) class ArrayPrototype: def toString(): # this function is wrong but I will leave it here fore debugging purposes. func = this.get("join") if not func.is_callable(): @this.Js def func(): return "[object %s]" % this.Class return func.call(this, ()) def toLocaleString(): array = this.to_object() arr_len = array.get("length").to_uint32() # separator is simply a comma ',' if not arr_len: return "" res = [] for i in xrange(arr_len): element = array[str(i)] if element.is_undefined() or element.is_null(): res.append("") else: cand = element.to_object() str_func = element.get("toLocaleString") if not str_func.is_callable(): raise this.MakeError( "TypeError", "toLocaleString method of item at index %d is not callable" % i, ) res.append(element.callprop("toLocaleString").value) return ",".join(res) def concat(): array = this.to_object() A = this.Js([]) items = [array] items.extend(to_arr(arguments)) n = 0 for E in items: if E.Class == "Array": k = 0 e_len = len(E) while k < e_len: if E.has_property(str(k)): A.put(str(n), E.get(str(k))) n += 1 k += 1 else: A.put(str(n), E) n += 1 return A def join(separator): ARR_STACK.add(this) array = this.to_object() arr_len = array.get("length").to_uint32() separator = "," if separator.is_undefined() else separator.to_string().value elems = [] for e in xrange(arr_len): elem = array.get(str(e)) if elem in ARR_STACK: s = "" else: s = elem.to_string().value elems.append(s if not (elem.is_undefined() or elem.is_null()) else "") res = separator.join(elems) ARR_STACK.remove(this) return res def pop(): # todo check array = this.to_object() arr_len = array.get("length").to_uint32() if not arr_len: array.put("length", this.Js(arr_len)) return None ind = str(arr_len - 1) element = array.get(ind) array.delete(ind) array.put("length", this.Js(arr_len - 1)) return element def push(item): # todo check array = this.to_object() arr_len = array.get("length").to_uint32() to_put = arguments.to_list() i = arr_len for i, e in enumerate(to_put, arr_len): array.put(str(i), e) if to_put: i += 1 array.put("length", this.Js(i)) return i def reverse(): array = this.to_object() # my own algorithm vals = to_arr(array) has_props = [array.has_property(str(e)) for e in xrange(len(array))] vals.reverse() has_props.reverse() for i, val in enumerate(vals): if has_props[i]: array.put(str(i), val) else: array.delete(str(i)) return array def shift(): # todo check array = this.to_object() arr_len = array.get("length").to_uint32() if not arr_len: array.put("length", this.Js(0)) return None first = array.get("0") for k in xrange(1, arr_len): from_s, to_s = str(k), str(k - 1) if array.has_property(from_s): array.put(to_s, array.get(from_s)) else: array.delete(to) array.delete(str(arr_len - 1)) array.put("length", this.Js(str(arr_len - 1))) return first def slice(start, end): # todo check array = this.to_object() arr_len = array.get("length").to_uint32() relative_start = start.to_int() k = ( max((arr_len + relative_start), 0) if relative_start < 0 else min(relative_start, arr_len) ) relative_end = arr_len if end.is_undefined() else end.to_int() final = ( max((arr_len + relative_end), 0) if relative_end < 0 else min(relative_end, arr_len) ) res = [] n = 0 while k < final: pk = str(k) if array.has_property(pk): res.append(array.get(pk)) k += 1 n += 1 return res def sort(cmpfn): if not this.Class in {"Array", "Arguments"}: return this.to_object() # do nothing arr = [] for i in xrange(len(this)): arr.append(this.get(six.text_type(i))) if not arr: return this if not cmpfn.is_callable(): cmpfn = None cmp = lambda a, b: sort_compare(a, b, cmpfn) if six.PY3: key = functools.cmp_to_key(cmp) arr.sort(key=key) else: arr.sort(cmp=cmp) for i in xrange(len(arr)): this.put(six.text_type(i), arr[i]) return this def splice(start, deleteCount): # 1-8 array = this.to_object() arr_len = array.get("length").to_uint32() relative_start = start.to_int() actual_start = ( max((arr_len + relative_start), 0) if relative_start < 0 else min(relative_start, arr_len) ) actual_delete_count = min(max(deleteCount.to_int(), 0), arr_len - actual_start) k = 0 A = this.Js([]) # 9 while k < actual_delete_count: if array.has_property(str(actual_start + k)): A.put(str(k), array.get(str(actual_start + k))) k += 1 # 10-11 items = to_arr(arguments)[2:] items_len = len(items) # 12 if items_len < actual_delete_count: k = actual_start while k < (arr_len - actual_delete_count): fr = str(k + actual_delete_count) to = str(k + items_len) if array.has_property(fr): array.put(to, array.get(fr)) else: array.delete(to) k += 1 k = arr_len while k > (arr_len - actual_delete_count + items_len): array.delete(str(k - 1)) k -= 1 # 13 elif items_len > actual_delete_count: k = arr_len - actual_delete_count while k > actual_start: fr = str(k + actual_delete_count - 1) to = str(k + items_len - 1) if array.has_property(fr): array.put(to, array.get(fr)) else: array.delete(to) k -= 1 # 14-17 k = actual_start while items: E = items.pop(0) array.put(str(k), E) k += 1 array.put("length", this.Js(arr_len - actual_delete_count + items_len)) return A def unshift(): array = this.to_object() arr_len = array.get("length").to_uint32() argCount = len(arguments) k = arr_len while k > 0: fr = str(k - 1) to = str(k + argCount - 1) if array.has_property(fr): array.put(to, array.get(fr)) else: array.delete(to) k -= 1 j = 0 items = to_arr(arguments) while items: E = items.pop(0) array.put(str(j), E) j += 1 array.put("length", this.Js(arr_len + argCount)) return arr_len + argCount def indexOf(searchElement): array = this.to_object() arr_len = array.get("length").to_uint32() if arr_len == 0: return -1 if len(arguments) > 1: n = arguments[1].to_int() else: n = 0 if n >= arr_len: return -1 if n >= 0: k = n else: k = arr_len - abs(n) if k < 0: k = 0 while k < arr_len: if array.has_property(str(k)): elementK = array.get(str(k)) if searchElement.strict_equality_comparison(elementK): return k k += 1 return -1 def lastIndexOf(searchElement): array = this.to_object() arr_len = array.get("length").to_uint32() if arr_len == 0: return -1 if len(arguments) > 1: n = arguments[1].to_int() else: n = arr_len - 1 if n >= 0: k = min(n, arr_len - 1) else: k = arr_len - abs(n) while k >= 0: if array.has_property(str(k)): elementK = array.get(str(k)) if searchElement.strict_equality_comparison(elementK): return k k -= 1 return -1 def every(callbackfn): array = this.to_object() arr_len = array.get("length").to_uint32() if not callbackfn.is_callable(): raise this.MakeError("TypeError", "callbackfn must be a function") T = arguments[1] k = 0 while k < arr_len: if array.has_property(str(k)): kValue = array.get(str(k)) if ( not callbackfn.call(T, (kValue, this.Js(k), array)) .to_boolean() .value ): return False k += 1 return True def some(callbackfn): array = this.to_object() arr_len = array.get("length").to_uint32() if not callbackfn.is_callable(): raise this.MakeError("TypeError", "callbackfn must be a function") T = arguments[1] k = 0 while k < arr_len: if array.has_property(str(k)): kValue = array.get(str(k)) if callbackfn.call(T, (kValue, this.Js(k), array)).to_boolean().value: return True k += 1 return False def forEach(callbackfn): array = this.to_object() arr_len = array.get("length").to_uint32() if not callbackfn.is_callable(): raise this.MakeError("TypeError", "callbackfn must be a function") T = arguments[1] k = 0 while k < arr_len: if array.has_property(str(k)): kValue = array.get(str(k)) callbackfn.call(T, (kValue, this.Js(k), array)) k += 1 def map(callbackfn): array = this.to_object() arr_len = array.get("length").to_uint32() if not callbackfn.is_callable(): raise this.MakeError("TypeError", "callbackfn must be a function") T = arguments[1] A = this.Js([]) k = 0 while k < arr_len: Pk = str(k) if array.has_property(Pk): kValue = array.get(Pk) mappedValue = callbackfn.call(T, (kValue, this.Js(k), array)) A.define_own_property( Pk, { "value": mappedValue, "writable": True, "enumerable": True, "configurable": True, }, ) k += 1 return A def filter(callbackfn): array = this.to_object() arr_len = array.get("length").to_uint32() if not callbackfn.is_callable(): raise this.MakeError("TypeError", "callbackfn must be a function") T = arguments[1] res = [] k = 0 while k < arr_len: if array.has_property(str(k)): kValue = array.get(str(k)) if callbackfn.call(T, (kValue, this.Js(k), array)).to_boolean().value: res.append(kValue) k += 1 return res # converted to js array automatically def reduce(callbackfn): array = this.to_object() arr_len = array.get("length").to_uint32() if not callbackfn.is_callable(): raise this.MakeError("TypeError", "callbackfn must be a function") if not arr_len and len(arguments) < 2: raise this.MakeError( "TypeError", "Reduce of empty array with no initial value" ) k = 0 if len(arguments) > 1: # initial value present accumulator = arguments[1] else: kPresent = False while not kPresent and k < arr_len: kPresent = array.has_property(str(k)) if kPresent: accumulator = array.get(str(k)) k += 1 if not kPresent: raise this.MakeError( "TypeError", "Reduce of empty array with no initial value" ) while k < arr_len: if array.has_property(str(k)): kValue = array.get(str(k)) accumulator = callbackfn.call( this.undefined, (accumulator, kValue, this.Js(k), array) ) k += 1 return accumulator def reduceRight(callbackfn): array = this.to_object() arr_len = array.get("length").to_uint32() if not callbackfn.is_callable(): raise this.MakeError("TypeError", "callbackfn must be a function") if not arr_len and len(arguments) < 2: raise this.MakeError( "TypeError", "Reduce of empty array with no initial value" ) k = arr_len - 1 if len(arguments) > 1: # initial value present accumulator = arguments[1] else: kPresent = False while not kPresent and k >= 0: kPresent = array.has_property(str(k)) if kPresent: accumulator = array.get(str(k)) k -= 1 if not kPresent: raise this.MakeError( "TypeError", "Reduce of empty array with no initial value" ) while k >= 0: if array.has_property(str(k)): kValue = array.get(str(k)) accumulator = callbackfn.call( this.undefined, (accumulator, kValue, this.Js(k), array) ) k -= 1 return accumulator def sort_compare(a, b, comp): if a is None: if b is None: return 0 return 1 if b is None: if a is None: return 0 return -1 if a.is_undefined(): if b.is_undefined(): return 0 return 1 if b.is_undefined(): if a.is_undefined(): return 0 return -1 if comp is not None: res = comp.call(a.undefined, (a, b)) return res.to_int() x, y = a.to_string(), b.to_string() if x < y: return -1 elif x > y: return 1 return 0
data
volume_widgets
# -------------------------------------------------------------------------- # Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas # Copyright: (C) 2001 Centro de Pesquisas Renato Archer # Homepage: http://www.softwarepublico.gov.br # Contact: invesalius@cti.gov.br # License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt) # -------------------------------------------------------------------------- # Este programa e software livre; voce pode redistribui-lo e/ou # modifica-lo sob os termos da Licenca Publica Geral GNU, conforme # publicada pela Free Software Foundation; de acordo com a versao 2 # da Licenca. # # Este programa eh distribuido na expectativa de ser util, mas SEM # QUALQUER GARANTIA; sem mesmo a garantia implicita de # COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais # detalhes. # -------------------------------------------------------------------------- from vtkmodules.vtkFiltersSources import vtkPlaneSource from vtkmodules.vtkInteractionWidgets import vtkImagePlaneWidget from vtkmodules.vtkRenderingCore import vtkActor, vtkCellPicker, vtkPolyDataMapper AXIAL, SAGITAL, CORONAL = 0, 1, 2 PLANE_DATA = { AXIAL: ["z", (0, 0, 1)], SAGITAL: ["x", (1, 0, 0)], CORONAL: ["y", (0, 1, 0)], } class Plane: """ How to use: import ivVolumeWidgets as vw imagedata = v16.GetOutput() axial_plane = vw.Plane() axial_plane.SetRender(ren) axial_plane.SetInteractor(pane) axial_plane.SetOrientation(vw.CORONAL) axial_plane.SetInput(imagedata) axial_plane.Show() axial_plane.Update() """ def __init__(self): self.orientation = AXIAL self.render = None self.iren = None self.index = 0 self.source = None self.widget = None self.actor = None def SetOrientation(self, orientation=AXIAL): self.orientation = orientation def SetRender(self, render=None): self.render = render def SetInteractor(self, iren=None): self.iren = iren def SetSliceIndex(self, index): self.index = 0 try: self.widget.SetSliceIndex(int(index)) except AttributeError: pass else: self.Update() if self.widget.GetEnabled(): print("send signal - update slice info in panel and in 2d") def SetInput(self, imagedata): axes = PLANE_DATA[self.orientation][0] # "x", "y" or "z" colour = PLANE_DATA[self.orientation][1] # if self.orientation == SAGITAL: # spacing = min(imagedata.GetSpacing()) # permute = vtk.vtkImagePermute() # permute.SetInput(imagedata) # permute.GetOutput().ReleaseDataFlagOn() # permute.SetOutputSpacing(spacing, spacing, spacing) # imagedata = permute.GetOutput() # Picker for enabling plane motion. # Allows selection of a cell by shooting a ray into graphics window picker = vtkCellPicker() picker.SetTolerance(0.005) picker.PickFromListOn() # 3D widget for reslicing image data. # This 3D widget defines a plane that can be interactively placed in an image volume. widget = vtkImagePlaneWidget() widget.SetInput(imagedata) widget.SetSliceIndex(self.index) widget.SetPicker(picker) widget.SetKeyPressActivationValue(axes) widget.SetInteractor(self.iren) widget.TextureVisibilityOff() widget.DisplayTextOff() widget.RestrictPlaneToVolumeOff() exec("widget.SetPlaneOrientationTo" + axes.upper() + "Axes()") widget.AddObserver("InteractionEvent", self.Update) self.widget = widget prop = widget.GetPlaneProperty() prop.SetColor(colour) # Syncronize coloured outline with texture appropriately source = vtkPlaneSource() source.SetOrigin(widget.GetOrigin()) source.SetPoint1(widget.GetPoint1()) source.SetPoint2(widget.GetPoint2()) source.SetNormal(widget.GetNormal()) self.source = source mapper = vtkPolyDataMapper() mapper.SetInput(source.GetOutput()) actor = vtkActor() actor.SetMapper(mapper) actor.SetTexture(widget.GetTexture()) actor.VisibilityOff() self.actor = actor self.render.AddActor(actor) def Update(self, x=None, y=None): source = self.source widget = self.widget source.SetOrigin(widget.GetOrigin()) source.SetPoint1(widget.GetPoint1()) source.SetPoint2(widget.GetPoint2()) source.SetNormal(widget.GetNormal()) def Show(self, show=1): actor = self.actor widget = self.widget if show: actor.VisibilityOn() widget.On() else: actor.VisibilityOff() widget.Off()
lector
threaded
# This file is a part of Lector, a Qt based ebook reader # Copyright (C) 2017-2019 BasioMeusPuga # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import logging import os import pathlib import re from multiprocessing.dummy import Pool from lector import database, sorter from PyQt5 import QtCore, QtGui # The following have to be separate try: from lector.parsers.pdf import render_pdf_page except ImportError: pass try: from lector.parsers.djvu import render_djvu_page except ImportError: pass logger = logging.getLogger(__name__) class BackGroundTabUpdate(QtCore.QThread): def __init__(self, database_path, all_metadata, parent=None): super(BackGroundTabUpdate, self).__init__(parent) self.database_path = database_path self.all_metadata = all_metadata def run(self): for i in self.all_metadata: book_hash = i["hash"] database_dict = { "Position": i["position"], "LastAccessed": i["last_accessed"], "Bookmarks": i["bookmarks"], "Annotations": i["annotations"], } database.DatabaseFunctions(self.database_path).modify_metadata( database_dict, book_hash ) class BackGroundBookAddition(QtCore.QThread): def __init__( self, file_list, database_path, addition_mode, main_window, parent=None ): super(BackGroundBookAddition, self).__init__(parent) self.file_list = file_list self.database_path = database_path self.addition_mode = addition_mode self.main_window = main_window self.errors = [] self.prune_required = True if self.addition_mode == "manual": self.prune_required = False def run(self): books = sorter.BookSorter( self.file_list, ("addition", self.addition_mode), self.database_path, self.main_window.settings, self.main_window.temp_dir.path(), ) parsed_books, self.errors = books.initiate_threads() self.main_window.lib_ref.generate_model("addition", parsed_books, False) database.DatabaseFunctions(self.database_path).add_to_database(parsed_books) if self.prune_required: self.main_window.lib_ref.prune_models(self.file_list) class BackGroundBookDeletion(QtCore.QThread): def __init__(self, hash_list, database_path, parent=None): super(BackGroundBookDeletion, self).__init__(parent) self.hash_list = hash_list self.database_path = database_path def run(self): database.DatabaseFunctions(self.database_path).delete_from_database( "Hash", self.hash_list ) class BackGroundBookSearch(QtCore.QThread): def __init__(self, data_list, parent=None): super(BackGroundBookSearch, self).__init__(parent) self.valid_files = [] # Filter for checked directories self.valid_directories = [ [i[0], i[1], i[2]] for i in data_list if i[3] == QtCore.Qt.Checked and os.path.exists(i[0]) ] self.unwanted_directories = [ pathlib.Path(i[0]) for i in data_list if i[3] == QtCore.Qt.Unchecked ] def run(self): def is_wanted(directory): directory_parents = pathlib.Path(directory).parents for i in self.unwanted_directories: if i in directory_parents: return False return True def traverse_directory(incoming_data): root_directory = incoming_data[0] for directory, subdirs, files in os.walk(root_directory, topdown=True): # Black magic fuckery # Skip subdir tree in case it's not wanted subdirs[:] = [ d for d in subdirs if is_wanted(os.path.join(directory, d)) ] for filename in files: if os.path.splitext(filename)[1][1:] in sorter.available_parsers: self.valid_files.append(os.path.join(directory, filename)) def initiate_threads(): _pool = Pool(5) _pool.map(traverse_directory, self.valid_directories) _pool.close() _pool.join() if self.valid_directories: initiate_threads() if self.valid_files: info_string = str(len(self.valid_files)) + " books found" logger.info(info_string) else: logger.error("No books found on scan") else: logger.error("No valid directories") class BackGroundCacheRefill(QtCore.QThread): def __init__( self, image_cache, remove_value, filetype, book, all_pages, parent=None ): super(BackGroundCacheRefill, self).__init__(parent) # TODO # Return with only the first image in case of a cache miss # Rebuilding the entire n image cache takes considerably longer self.image_cache = image_cache self.remove_value = remove_value self.filetype = filetype self.book = book self.all_pages = all_pages def run(self): def load_page(current_page): pixmap = QtGui.QPixmap() if self.filetype in ("cbz", "cbr"): page_data = self.book.read(current_page) pixmap.loadFromData(page_data) elif self.filetype == "pdf": page_data = self.book.loadPage(current_page) pixmap = render_pdf_page(page_data) elif self.filetype == "djvu": page_data = self.book.pages[current_page] pixmap = render_djvu_page(page_data) return pixmap remove_index = self.image_cache.index(self.remove_value) if remove_index == 1: first_path = self.image_cache[0][0] self.image_cache.pop(3) previous_page = self.all_pages[self.all_pages.index(first_path) - 1] refill_pixmap = load_page(previous_page) self.image_cache.insert(0, (previous_page, refill_pixmap)) else: self.image_cache[0] = self.image_cache[1] self.image_cache.pop(1) try: last_page = self.image_cache[2][0] next_page = self.all_pages[self.all_pages.index(last_page) + 1] refill_pixmap = load_page(next_page) self.image_cache.append((next_page, refill_pixmap)) except (IndexError, TypeError): self.image_cache.append(None) class BackGroundTextSearch(QtCore.QThread): def __init__(self): super(BackGroundTextSearch, self).__init__(None) self.search_content = None self.search_text = None self.case_sensitive = False self.match_words = False self.search_results = [] def set_search_options( self, search_content, search_text, case_sensitive, match_words ): self.search_content = search_content self.search_text = search_text self.case_sensitive = case_sensitive self.match_words = match_words def run(self): if not self.search_text or len(self.search_text) < 3: return def get_surrounding_text(textCursor, words_before): textCursor.movePosition( QtGui.QTextCursor.WordLeft, QtGui.QTextCursor.MoveAnchor, words_before ) textCursor.movePosition( QtGui.QTextCursor.NextWord, QtGui.QTextCursor.KeepAnchor, words_before * 2, ) cursor_selection = textCursor.selection().toPlainText() return cursor_selection.replace("\n", "") self.search_results = {} # Create a new QTextDocument of each chapter and iterate # through it looking for hits for i in self.search_content: chapter_title = i[0] chapterDocument = QtGui.QTextDocument() chapterDocument.setHtml(i[1]) chapter_number = i[2] findFlags = QtGui.QTextDocument.FindFlags(0) if self.match_words: findFlags = findFlags | QtGui.QTextDocument.FindWholeWords if self.case_sensitive: findFlags = findFlags | QtGui.QTextDocument.FindCaseSensitively findResultCursor = chapterDocument.find(self.search_text, 0, findFlags) while not findResultCursor.isNull(): result_position = findResultCursor.position() words_before = 3 while True: surroundingTextCursor = QtGui.QTextCursor(chapterDocument) surroundingTextCursor.setPosition( result_position, QtGui.QTextCursor.MoveAnchor ) surrounding_text = get_surrounding_text( surroundingTextCursor, words_before ) words_before += 1 if surrounding_text[:2] not in (". ", ", "): break # Case insensitive replace for find results replace_pattern = re.compile(re.escape(self.search_text), re.IGNORECASE) surrounding_text = replace_pattern.sub( f"<b>{self.search_text}</b>", surrounding_text ) result_tuple = ( result_position, surrounding_text, self.search_text, chapter_number, ) try: self.search_results[chapter_title].append(result_tuple) except KeyError: self.search_results[chapter_title] = [result_tuple] new_position = result_position + len(self.search_text) findResultCursor = chapterDocument.find( self.search_text, new_position, findFlags )
extractors
tudou
#!/usr/bin/env python __all__ = [ "tudou_download", "tudou_download_playlist", "tudou_download_by_id", "tudou_download_by_iid", ] from xml.dom.minidom import parseString import you_get.extractors.acfun from ..common import * def tudou_download_by_iid(iid, title, output_dir=".", merge=True, info_only=False): data = json.loads( get_decoded_html( "http://www.tudou.com/outplay/goto/getItemSegs.action?iid=%s" % iid ) ) temp = max( [data[i] for i in data if "size" in data[i][0]], key=lambda x: sum([part["size"] for part in x]), ) vids, size = [t["k"] for t in temp], sum([t["size"] for t in temp]) urls = [] for vid in vids: for i in parseString( get_html("http://ct.v2.tudou.com/f?id=%s" % vid) ).getElementsByTagName("f"): urls.append(i.firstChild.nodeValue.strip()) ext = r1(r"http://[\w.]*/(\w+)/[\w.]*", urls[0]) print_info(site_info, title, ext, size) if not info_only: download_urls(urls, title, ext, size, output_dir=output_dir, merge=merge) def tudou_download_by_id(id, title, output_dir=".", merge=True, info_only=False): html = get_html("http://www.tudou.com/programs/view/%s/" % id) iid = r1(r"iid\s*[:=]\s*(\S+)", html) try: title = r1(r"kw\s*[:=]\s*[\'\"]([^\n]+?)\'\s*\n", html).replace("\\'", "'") except AttributeError: title = "" tudou_download_by_iid( iid, title, output_dir=output_dir, merge=merge, info_only=info_only ) def tudou_download(url, output_dir=".", merge=True, info_only=False, **kwargs): if "acfun.tudou.com" in url: # wrong way! url = url.replace("acfun.tudou.com", "www.acfun.tv") you_get.extractors.acfun.acfun_download(url, output_dir, merge, info_only) return # throw you back # Embedded player id = r1(r"http://www.tudou.com/v/([^/]+)/", url) if id: return tudou_download_by_id(id, title="", info_only=info_only) html = get_content(url) try: title = r1(r"\Wkw\s*[:=]\s*[\'\"]([^\n]+?)\'\s*\n", html).replace("\\'", "'") assert title title = unescape_html(title) except AttributeError: title = match1(html, r"id=\"subtitle\"\s*title\s*=\s*\"([^\"]+)\"") if title is None: title = "" vcode = r1(r"vcode\s*[:=]\s*\'([^\']+)\'", html) if vcode is None: vcode = match1(html, r"viden\s*[:=]\s*\"([\w+/=]+)\"") if vcode: from .youku import youku_download_by_vid return youku_download_by_vid( vcode, title=title, output_dir=output_dir, merge=merge, info_only=info_only, src="tudou", **kwargs, ) iid = r1(r"iid\s*[:=]\s*(\d+)", html) if not iid: return tudou_download_playlist(url, output_dir, merge, info_only) tudou_download_by_iid( iid, title, output_dir=output_dir, merge=merge, info_only=info_only ) # obsolete? def parse_playlist(url): aid = r1("http://www.tudou.com/playlist/p/a(\d+)(?:i\d+)?\.html", url) html = get_decoded_html(url) if not aid: aid = r1(r"aid\s*[:=]\s*'(\d+)'", html) if re.match(r"http://www.tudou.com/albumcover/", url): atitle = r1(r"title\s*:\s*'([^']+)'", html) elif re.match(r"http://www.tudou.com/playlist/p/", url): atitle = r1(r'atitle\s*=\s*"([^"]+)"', html) else: raise NotImplementedError(url) assert aid assert atitle import json # url = 'http://www.tudou.com/playlist/service/getZyAlbumItems.html?aid='+aid url = "http://www.tudou.com/playlist/service/getAlbumItems.html?aid=" + aid return [ (atitle + "-" + x["title"], str(x["itemId"])) for x in json.loads(get_html(url))["message"] ] def parse_plist(url): html = get_decoded_html(url) lcode = r1(r"lcode:\s*'([^']+)'", html) plist_info = json.loads( get_content("http://www.tudou.com/crp/plist.action?lcode=" + lcode) ) return [(item["kw"], item["iid"]) for item in plist_info["items"]] def tudou_download_playlist(url, output_dir=".", merge=True, info_only=False, **kwargs): videos = parse_plist(url) for i, (title, id) in enumerate(videos): print("Processing %s of %s videos..." % (i + 1, len(videos))) tudou_download_by_iid( id, title, output_dir=output_dir, merge=merge, info_only=info_only ) site_info = "Tudou.com" download = tudou_download download_playlist = tudou_download_playlist
data
styles
# -------------------------------------------------------------------------- # Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas # Copyright: (C) 2001 Centro de Pesquisas Renato Archer # Homepage: http://www.softwarepublico.gov.br # Contact: invesalius@cti.gov.br # License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt) # -------------------------------------------------------------------------- # Este programa e software livre; voce pode redistribui-lo e/ou # modifica-lo sob os termos da Licenca Publica Geral GNU, conforme # publicada pela Free Software Foundation; de acordo com a versao 2 # da Licenca. # # Este programa eh distribuido na expectativa de ser util, mas SEM # QUALQUER GARANTIA; sem mesmo a garantia implicita de # COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais # detalhes. # -------------------------------------------------------------------------- import multiprocessing import os import tempfile import time from concurrent import futures import numpy as np import wx from scipy import ndimage from scipy.ndimage import generate_binary_structure, watershed_ift try: # Skimage >= 0.19 from skimage.segmentation import watershed except ImportError: from skimage.morphology import watershed import invesalius.constants as const import invesalius.data.cursor_actors as ca import invesalius.data.geometry as geom # For tracts import invesalius.data.tractography as dtr import invesalius.data.transformations as transformations import invesalius.data.watershed_process as watershed_process import invesalius.gui.dialogs as dialogs import invesalius.session as ses import invesalius.utils as utils from invesalius.data.imagedata_utils import get_LUT_value, get_LUT_value_255 from invesalius.data.measures import ( CircleDensityMeasure, MeasureData, PolygonDensityMeasure, ) from invesalius.pubsub import pub as Publisher from invesalius_cy import floodfill from vtkmodules.vtkFiltersSources import vtkLineSource from vtkmodules.vtkInteractionStyle import ( vtkInteractorStyleImage, vtkInteractorStyleRubberBandZoom, ) from vtkmodules.vtkRenderingCore import ( vtkActor2D, vtkCellPicker, vtkCoordinate, vtkPolyDataMapper2D, vtkWorldPointPicker, ) # import invesalius.project as prj # from time import sleep # --- ORIENTATIONS = { "AXIAL": const.AXIAL, "CORONAL": const.CORONAL, "SAGITAL": const.SAGITAL, } BRUSH_FOREGROUND = 1 BRUSH_BACKGROUND = 2 BRUSH_ERASE = 0 WATERSHED_OPERATIONS = { _("Erase"): BRUSH_ERASE, _("Foreground"): BRUSH_FOREGROUND, _("Background"): BRUSH_BACKGROUND, } class BaseImageInteractorStyle(vtkInteractorStyleImage): def __init__(self, viewer): self.viewer = viewer self.right_pressed = False self.left_pressed = False self.middle_pressed = False self.AddObserver("LeftButtonPressEvent", self.OnPressLeftButton) self.AddObserver("LeftButtonReleaseEvent", self.OnReleaseLeftButton) self.AddObserver("RightButtonPressEvent", self.OnPressRightButton) self.AddObserver("RightButtonReleaseEvent", self.OnReleaseRightButton) self.AddObserver("MiddleButtonPressEvent", self.OnMiddleButtonPressEvent) self.AddObserver("MiddleButtonReleaseEvent", self.OnMiddleButtonReleaseEvent) def OnPressLeftButton(self, evt, obj): self.left_pressed = True def OnReleaseLeftButton(self, evt, obj): self.left_pressed = False def OnPressRightButton(self, evt, obj): self.right_pressed = True self.viewer.last_position_mouse_move = ( self.viewer.interactor.GetLastEventPosition() ) def OnReleaseRightButton(self, evt, obj): self.right_pressed = False def OnMiddleButtonPressEvent(self, evt, obj): self.middle_pressed = True def OnMiddleButtonReleaseEvent(self, evt, obj): self.middle_pressed = False def GetMousePosition(self): mx, my = self.viewer.get_vtk_mouse_position() return mx, my def GetPickPosition(self, mouse_position=None): if mouse_position is None: mx, my = self.GetMousePosition() else: mx, my = mouse_position iren = self.viewer.interactor render = iren.FindPokedRenderer(mx, my) self.picker.Pick(mx, my, 0, render) x, y, z = self.picker.GetPickPosition() return (x, y, z) class DefaultInteractorStyle(BaseImageInteractorStyle): """ Interactor style responsible for Default functionalities: * Zoom moving mouse with right button pressed; * Change the slices with the scroll. """ def __init__(self, viewer): BaseImageInteractorStyle.__init__(self, viewer) self.state_code = const.STATE_DEFAULT self.viewer = viewer # Zoom using right button self.AddObserver("RightButtonPressEvent", self.OnZoomRightClick) self.AddObserver("RightButtonReleaseEvent", self.OnZoomRightRelease) self.AddObserver("MouseMoveEvent", self.OnZoomRightMove) self.AddObserver("MouseWheelForwardEvent", self.OnScrollForward) self.AddObserver("MouseWheelBackwardEvent", self.OnScrollBackward) self.AddObserver("EnterEvent", self.OnFocus) def OnFocus(self, evt, obj): self.viewer.SetFocus() def OnZoomRightMove(self, evt, obj): if self.right_pressed: evt.Dolly() evt.OnRightButtonDown() elif self.middle_pressed: evt.Pan() evt.OnMiddleButtonDown() def OnZoomRightClick(self, evt, obj): evt.StartDolly() def OnZoomRightRelease(self, evt, obj): print("EndDolly") evt.OnRightButtonUp() # evt.EndDolly() self.right_pressed = False def OnScrollForward(self, evt, obj): iren = self.viewer.interactor viewer = self.viewer if iren.GetShiftKey(): opacity = viewer.slice_.opacity + 0.1 if opacity <= 1: viewer.slice_.opacity = opacity self.viewer.slice_.buffer_slices["AXIAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["CORONAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["SAGITAL"].discard_vtk_mask() Publisher.sendMessage("Reload actual slice") else: self.viewer.OnScrollForward() def OnScrollBackward(self, evt, obj): iren = self.viewer.interactor viewer = self.viewer if iren.GetShiftKey(): opacity = viewer.slice_.opacity - 0.1 if opacity >= 0.1: viewer.slice_.opacity = opacity self.viewer.slice_.buffer_slices["AXIAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["CORONAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["SAGITAL"].discard_vtk_mask() Publisher.sendMessage("Reload actual slice") else: self.viewer.OnScrollBackward() class BaseImageEditionInteractorStyle(DefaultInteractorStyle): def __init__(self, viewer): super().__init__(viewer) self.viewer = viewer self.orientation = self.viewer.orientation self.picker = vtkWorldPointPicker() self.matrix = None self.cursor = None self.brush_size = const.BRUSH_SIZE self.brush_format = const.DEFAULT_BRUSH_FORMAT self.brush_colour = const.BRUSH_COLOUR self._set_cursor() self.fill_value = 254 self.AddObserver("EnterEvent", self.OnBIEnterInteractor) self.AddObserver("LeaveEvent", self.OnBILeaveInteractor) self.AddObserver("LeftButtonPressEvent", self.OnBIBrushClick) self.AddObserver("LeftButtonReleaseEvent", self.OnBIBrushRelease) self.AddObserver("MouseMoveEvent", self.OnBIBrushMove) self.RemoveObservers("MouseWheelForwardEvent") self.RemoveObservers("MouseWheelBackwardEvent") self.AddObserver("MouseWheelForwardEvent", self.OnBIScrollForward) self.AddObserver("MouseWheelBackwardEvent", self.OnBIScrollBackward) def _set_cursor(self): if const.DEFAULT_BRUSH_FORMAT == const.BRUSH_SQUARE: self.cursor = ca.CursorRectangle() elif const.DEFAULT_BRUSH_FORMAT == const.BRUSH_CIRCLE: self.cursor = ca.CursorCircle() self.cursor.SetOrientation(self.orientation) n = self.viewer.slice_data.number coordinates = {"SAGITAL": [n, 0, 0], "CORONAL": [0, n, 0], "AXIAL": [0, 0, n]} self.cursor.SetPosition(coordinates[self.orientation]) spacing = self.viewer.slice_.spacing self.cursor.SetSpacing(spacing) self.cursor.SetColour(self.viewer._brush_cursor_colour) self.cursor.SetSize(self.brush_size) self.viewer.slice_data.SetCursor(self.cursor) def set_brush_size(self, size): self.brush_size = size self._set_cursor() def set_brush_format(self, format): self.brush_format = format self._set_cursor() def set_brush_operation(self, operation): self.brush_operation = operation self._set_cursor() def set_fill_value(self, fill_value): self.fill_value = fill_value def set_matrix(self, matrix): self.matrix = matrix def OnBIEnterInteractor(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return self.viewer.slice_data.cursor.Show() self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_BLANK)) self.viewer.interactor.Render() def OnBILeaveInteractor(self, obj, evt): self.viewer.slice_data.cursor.Show(0) self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_DEFAULT)) self.viewer.interactor.Render() def OnBIBrushClick(self, obj, evt): try: self.before_brush_click() except AttributeError: pass if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return viewer = self.viewer iren = viewer.interactor operation = self.config.operation viewer._set_editor_cursor_visibility(1) mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = viewer.get_slice_data(render) slice_data.cursor.Show() wx, wy, wz = viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) position = viewer.get_slice_pixel_coord_by_world_pos(wx, wy, wz) index = slice_data.number cursor = slice_data.cursor radius = cursor.radius slice_data.cursor.SetPosition((wx, wy, wz)) self.edit_mask_pixel( self.fill_value, index, cursor.GetPixels(), position, radius, viewer.orientation, ) try: self.after_brush_click() except AttributeError: pass viewer.OnScrollBar() def OnBIBrushMove(self, obj, evt): try: self.before_brush_move() except AttributeError: pass if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return viewer = self.viewer iren = viewer.interactor viewer._set_editor_cursor_visibility(1) mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = viewer.get_slice_data(render) operation = self.config.operation wx, wy, wz = viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) slice_data.cursor.SetPosition((wx, wy, wz)) if self.left_pressed: cursor = slice_data.cursor radius = cursor.radius position = viewer.get_slice_pixel_coord_by_world_pos(wx, wy, wz) index = slice_data.number slice_data.cursor.SetPosition((wx, wy, wz)) self.edit_mask_pixel( self.fill_value, index, cursor.GetPixels(), position, radius, viewer.orientation, ) try: self.after_brush_move() except AttributeError: pass viewer.OnScrollBar(update3D=False) else: viewer.interactor.Render() def OnBIBrushRelease(self, evt, obj): try: self.before_brush_release() except AttributeError: pass if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return self.after_brush_release() self.viewer.discard_mask_cache(all_orientations=True, vtk_cache=True) Publisher.sendMessage("Reload actual slice") def edit_mask_pixel(self, fill_value, n, index, position, radius, orientation): if orientation == "AXIAL": matrix = self.matrix[n, :, :] elif orientation == "CORONAL": matrix = self.matrix[:, n, :] elif orientation == "SAGITAL": matrix = self.matrix[:, :, n] spacing = self.viewer.slice_.spacing if hasattr(position, "__iter__"): px, py = position if orientation == "AXIAL": sx = spacing[0] sy = spacing[1] elif orientation == "CORONAL": sx = spacing[0] sy = spacing[2] elif orientation == "SAGITAL": sx = spacing[2] sy = spacing[1] else: if orientation == "AXIAL": sx = spacing[0] sy = spacing[1] py = position / matrix.shape[1] px = position % matrix.shape[1] elif orientation == "CORONAL": sx = spacing[0] sy = spacing[2] py = position / matrix.shape[1] px = position % matrix.shape[1] elif orientation == "SAGITAL": sx = spacing[2] sy = spacing[1] py = position / matrix.shape[1] px = position % matrix.shape[1] cx = index.shape[1] / 2 + 1 cy = index.shape[0] / 2 + 1 xi = int(px - index.shape[1] + cx) xf = int(xi + index.shape[1]) yi = int(py - index.shape[0] + cy) yf = int(yi + index.shape[0]) if yi < 0: index = index[abs(yi) :, :] yi = 0 if yf > matrix.shape[0]: index = index[: index.shape[0] - (yf - matrix.shape[0]), :] yf = matrix.shape[0] if xi < 0: index = index[:, abs(xi) :] xi = 0 if xf > matrix.shape[1]: index = index[:, : index.shape[1] - (xf - matrix.shape[1])] xf = matrix.shape[1] # Verifying if the points is over the image array. if (not 0 <= xi <= matrix.shape[1] and not 0 <= xf <= matrix.shape[1]) or ( not 0 <= yi <= matrix.shape[0] and not 0 <= yf <= matrix.shape[0] ): return roi_m = matrix[yi:yf, xi:xf] # Checking if roi_i has at least one element. if roi_m.size: roi_m[index] = self.fill_value def OnBIScrollForward(self, evt, obj): iren = self.viewer.interactor if iren.GetControlKey(): size = self.brush_size + 1 if size <= 100: self.set_brush_size(size) else: self.OnScrollForward(obj, evt) def OnBIScrollBackward(self, evt, obj): iren = self.viewer.interactor if iren.GetControlKey(): size = self.brush_size - 1 if size > 0: self.set_brush_size(size) else: self.OnScrollBackward(obj, evt) class CrossInteractorStyle(DefaultInteractorStyle): """ Interactor style responsible for the Cross. """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_CROSS self.viewer = viewer self.orientation = viewer.orientation self.slice_actor = viewer.slice_data.actor self.slice_data = viewer.slice_data self.picker = vtkWorldPointPicker() self.AddObserver("MouseMoveEvent", self.OnCrossMove) self.AddObserver("LeftButtonPressEvent", self.OnCrossMouseClick) self.AddObserver("LeftButtonReleaseEvent", self.OnReleaseLeftButton) def SetUp(self): self.viewer.set_cross_visibility(1) Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=True) def CleanUp(self): self.viewer.set_cross_visibility(0) Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=False) def OnCrossMouseClick(self, obj, evt): iren = obj.GetInteractor() self.ChangeCrossPosition(iren) def OnCrossMove(self, obj, evt): # The user moved the mouse with left button pressed if self.left_pressed: iren = obj.GetInteractor() self.ChangeCrossPosition(iren) def ChangeCrossPosition(self, iren): mouse_x, mouse_y = self.GetMousePosition() x, y, z = self.viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) self.viewer.UpdateSlicesPosition([x, y, z]) # This "Set cross" message is needed to update the cross in the other slices Publisher.sendMessage( "Set cross focal point", position=[x, y, z, None, None, None] ) Publisher.sendMessage("Update slice viewer") def OnScrollBar(self, *args, **kwargs): # Update other slice's cross according to the new focal point from # the actual orientation. x, y, z = self.viewer.cross.GetFocalPoint() self.viewer.UpdateSlicesPosition([x, y, z]) Publisher.sendMessage( "Set cross focal point", position=[x, y, z, None, None, None] ) Publisher.sendMessage("Update slice viewer") class TractsInteractorStyle(CrossInteractorStyle): """ Interactor style responsible for tracts visualization. """ def __init__(self, viewer): CrossInteractorStyle.__init__(self, viewer) # self.state_code = const.SLICE_STATE_TRACTS self.viewer = viewer # print("Im fucking brilliant!") self.tracts = None # data_dir = b'C:\Users\deoliv1\OneDrive\data\dti' # FOD_path = b"sub-P0_dwi_FOD.nii" # full_path = os.path.join(data_dir, FOD_path) # self.tracker = Trekker.tracker(full_path) # self.orientation = viewer.orientation # self.slice_actor = viewer.slice_data.actor # self.slice_data = viewer.slice_data # self.picker = vtkWorldPointPicker() self.AddObserver("MouseMoveEvent", self.OnTractsMove) self.AddObserver("LeftButtonPressEvent", self.OnTractsMouseClick) self.AddObserver("LeftButtonReleaseEvent", self.OnTractsReleaseLeftButton) # def SetUp(self): # self.viewer.set_cross_visibility(1) # Publisher.sendMessage('Toggle toolbar item', # _id=self.state_code, value=True) # def CleanUp(self): # self.viewer.set_cross_visibility(0) # Publisher.sendMessage('Toggle toolbar item', # _id=self.state_code, value=False) def OnTractsMove(self, obj, evt): # The user moved the mouse with left button pressed if self.left_pressed: # print("OnTractsMove interactor style") # iren = obj.GetInteractor() self.ChangeTracts(True) def OnTractsMouseClick(self, obj, evt): # print("Single mouse click") # self.tracts = dtr.compute_and_visualize_tracts(self.tracker, self.seed, self.left_pressed) self.ChangeTracts(True) def OnTractsReleaseLeftButton(self, obj, evt): # time.sleep(3.) self.tracts.stop() # self.ChangeCrossPosition(iren) def ChangeTracts(self, pressed): # print("Trying to compute tracts") self.tracts = dtr.compute_and_visualize_tracts( self.tracker, self.seed, self.affine_vtk, pressed ) # mouse_x, mouse_y = iren.GetEventPosition() # wx, wy, wz = self.viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) # px, py = self.viewer.get_slice_pixel_coord_by_world_pos(wx, wy, wz) # coord = self.viewer.calcultate_scroll_position(px, py) # Publisher.sendMessage('Update cross position', position=(wx, wy, wz)) # # self.ScrollSlice(coord) # Publisher.sendMessage('Set ball reference position', position=(wx, wy, wz)) # Publisher.sendMessage('Co-registered points', arg=None, position=(wx, wy, wz, 0., 0., 0.)) # iren.Render() # def ScrollSlice(self, coord): # if self.orientation == "AXIAL": # Publisher.sendMessage(('Set scroll position', 'SAGITAL'), # index=coord[0]) # Publisher.sendMessage(('Set scroll position', 'CORONAL'), # index=coord[1]) # elif self.orientation == "SAGITAL": # Publisher.sendMessage(('Set scroll position', 'AXIAL'), # index=coord[2]) # Publisher.sendMessage(('Set scroll position', 'CORONAL'), # index=coord[1]) # elif self.orientation == "CORONAL": # Publisher.sendMessage(('Set scroll position', 'AXIAL'), # index=coord[2]) # Publisher.sendMessage(('Set scroll position', 'SAGITAL'), # index=coord[0]) class WWWLInteractorStyle(DefaultInteractorStyle): """ Interactor style responsible for Window Level & Width functionality. """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.STATE_WL self.viewer = viewer self.last_x = 0 self.last_y = 0 self.acum_achange_window = viewer.slice_.window_width self.acum_achange_level = viewer.slice_.window_level self.AddObserver("MouseMoveEvent", self.OnWindowLevelMove) self.AddObserver("LeftButtonPressEvent", self.OnWindowLevelClick) def SetUp(self): self.viewer.on_wl = True Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=True) self.viewer.canvas.draw_list.append(self.viewer.wl_text) self.viewer.UpdateCanvas() def CleanUp(self): self.viewer.on_wl = False Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=False) if self.viewer.wl_text is not None: self.viewer.canvas.draw_list.remove(self.viewer.wl_text) self.viewer.UpdateCanvas() def OnWindowLevelMove(self, obj, evt): if self.left_pressed: iren = obj.GetInteractor() mouse_x, mouse_y = self.GetMousePosition() self.acum_achange_window += mouse_x - self.last_x self.acum_achange_level += mouse_y - self.last_y self.last_x, self.last_y = mouse_x, mouse_y Publisher.sendMessage( "Bright and contrast adjustment image", window=self.acum_achange_window, level=self.acum_achange_level, ) # self.SetWLText(self.acum_achange_level, # self.acum_achange_window) const.WINDOW_LEVEL["Manual"] = ( self.acum_achange_window, self.acum_achange_level, ) Publisher.sendMessage("Check window and level other") Publisher.sendMessage( "Update window level value", window=self.acum_achange_window, level=self.acum_achange_level, ) # Necessary update the slice plane in the volume case exists Publisher.sendMessage("Update slice viewer") Publisher.sendMessage("Render volume viewer") def OnWindowLevelClick(self, obj, evt): iren = obj.GetInteractor() self.last_x, self.last_y = iren.GetLastEventPosition() self.acum_achange_window = self.viewer.slice_.window_width self.acum_achange_level = self.viewer.slice_.window_level class LinearMeasureInteractorStyle(DefaultInteractorStyle): """ Interactor style responsible for insert linear measurements. """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.STATE_MEASURE_DISTANCE self.viewer = viewer self.orientation = viewer.orientation self.slice_data = viewer.slice_data self.measures = MeasureData() self.selected = None self.creating = None self._type = const.LINEAR spacing = self.slice_data.actor.GetInput().GetSpacing() if self.orientation == "AXIAL": self.radius = min(spacing[1], spacing[2]) * 0.8 self._ori = const.AXIAL elif self.orientation == "CORONAL": self.radius = min(spacing[0], spacing[1]) * 0.8 self._ori = const.CORONAL elif self.orientation == "SAGITAL": self.radius = min(spacing[1], spacing[2]) * 0.8 self._ori = const.SAGITAL self.picker = vtkCellPicker() self.picker.PickFromListOn() self._bind_events() def _bind_events(self): self.AddObserver("LeftButtonPressEvent", self.OnInsertMeasurePoint) self.AddObserver("LeftButtonReleaseEvent", self.OnReleaseMeasurePoint) self.AddObserver("MouseMoveEvent", self.OnMoveMeasurePoint) self.AddObserver("LeaveEvent", self.OnLeaveMeasureInteractor) def SetUp(self): Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=True) def CleanUp(self): Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=False) self.picker.PickFromListOff() Publisher.sendMessage("Remove incomplete measurements") def OnInsertMeasurePoint(self, obj, evt): slice_number = self.slice_data.number x, y, z = self._get_pos_clicked() mx, my = self.GetMousePosition() if self.selected: self.selected = None self.viewer.scroll_enabled = True return if self.creating: n, m, mr = self.creating if mr.IsComplete(): self.creating = None self.viewer.scroll_enabled = True else: Publisher.sendMessage( "Add measurement point", position=(x, y, z), type=self._type, location=ORIENTATIONS[self.orientation], slice_number=slice_number, radius=self.radius, ) n = len(m.points) - 1 self.creating = n, m, mr self.viewer.UpdateCanvas() self.viewer.scroll_enabled = False return selected = self._verify_clicked_display(mx, my) if selected: self.selected = selected self.viewer.scroll_enabled = False else: if self.picker.GetViewProp(): renderer = self.viewer.slice_data.renderer Publisher.sendMessage( "Add measurement point", position=(x, y, z), type=self._type, location=ORIENTATIONS[self.orientation], slice_number=slice_number, radius=self.radius, ) Publisher.sendMessage( "Add measurement point", position=(x, y, z), type=self._type, location=ORIENTATIONS[self.orientation], slice_number=slice_number, radius=self.radius, ) n, (m, mr) = 1, self.measures.measures[self._ori][slice_number][-1] self.creating = n, m, mr self.viewer.UpdateCanvas() self.viewer.scroll_enabled = False def OnReleaseMeasurePoint(self, obj, evt): if self.selected: n, m, mr = self.selected x, y, z = self._get_pos_clicked() idx = self.measures._list_measures.index((m, mr)) Publisher.sendMessage( "Change measurement point position", index=idx, npoint=n, pos=(x, y, z) ) self.viewer.UpdateCanvas() self.selected = None self.viewer.scroll_enabled = True def OnMoveMeasurePoint(self, obj, evt): x, y, z = self._get_pos_clicked() if self.selected: n, m, mr = self.selected idx = self.measures._list_measures.index((m, mr)) Publisher.sendMessage( "Change measurement point position", index=idx, npoint=n, pos=(x, y, z) ) self.viewer.UpdateCanvas() elif self.creating: n, m, mr = self.creating idx = self.measures._list_measures.index((m, mr)) Publisher.sendMessage( "Change measurement point position", index=idx, npoint=n, pos=(x, y, z) ) self.viewer.UpdateCanvas() else: mx, my = self.GetMousePosition() if self._verify_clicked_display(mx, my): self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_HAND)) else: self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_DEFAULT)) def OnLeaveMeasureInteractor(self, obj, evt): if self.creating or self.selected: n, m, mr = self.creating if not mr.IsComplete(): Publisher.sendMessage("Remove incomplete measurements") self.creating = None self.selected = None self.viewer.UpdateCanvas() self.viewer.scroll_enabled = True def _get_pos_clicked(self): self.picker.AddPickList(self.slice_data.actor) x, y, z = self.GetPickPosition() self.picker.DeletePickList(self.slice_data.actor) return (x, y, z) def _verify_clicked(self, x, y, z): slice_number = self.slice_data.number sx, sy, sz = self.viewer.slice_.spacing if self.orientation == "AXIAL": max_dist = 2 * max(sx, sy) elif self.orientation == "CORONAL": max_dist = 2 * max(sx, sz) elif self.orientation == "SAGITAL": max_dist = 2 * max(sy, sz) if slice_number in self.measures.measures[self._ori]: for m, mr in self.measures.measures[self._ori][slice_number]: if mr.IsComplete(): for n, p in enumerate(m.points): px, py, pz = p dist = ((px - x) ** 2 + (py - y) ** 2 + (pz - z) ** 2) ** 0.5 if dist < max_dist: return (n, m, mr) return None def _verify_clicked_display(self, x, y, max_dist=5.0): slice_number = self.slice_data.number max_dist = max_dist**2 coord = vtkCoordinate() if slice_number in self.measures.measures[self._ori]: for m, mr in self.measures.measures[self._ori][slice_number]: if mr.IsComplete(): for n, p in enumerate(m.points): coord.SetValue(p) cx, cy = coord.GetComputedDisplayValue( self.viewer.slice_data.renderer ) dist = (cx - x) ** 2 + (cy - y) ** 2 if dist <= max_dist: return (n, m, mr) return None class AngularMeasureInteractorStyle(LinearMeasureInteractorStyle): def __init__(self, viewer): LinearMeasureInteractorStyle.__init__(self, viewer) self._type = const.ANGULAR self.state_code = const.STATE_MEASURE_ANGLE class DensityMeasureStyle(DefaultInteractorStyle): """ Interactor style responsible for density measurements. """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.STATE_MEASURE_DENSITY self.format = "polygon" self._last_measure = None self.viewer = viewer self.orientation = viewer.orientation self.slice_data = viewer.slice_data self.picker = vtkCellPicker() self.picker.PickFromListOn() self.measures = MeasureData() self._bind_events() def _bind_events(self): # self.AddObserver("LeftButtonPressEvent", self.OnInsertPoint) # self.AddObserver("LeftButtonReleaseEvent", self.OnReleaseMeasurePoint) # self.AddObserver("MouseMoveEvent", self.OnMoveMeasurePoint) # self.AddObserver("LeaveEvent", self.OnLeaveMeasureInteractor) self.viewer.canvas.subscribe_event("LeftButtonPressEvent", self.OnInsertPoint) self.viewer.canvas.subscribe_event( "LeftButtonDoubleClickEvent", self.OnInsertPolygon ) def SetUp(self): for n in self.viewer.draw_by_slice_number: for i in self.viewer.draw_by_slice_number[n]: if isinstance(i, PolygonDensityMeasure): i.set_interactive(True) self.viewer.canvas.Refresh() def CleanUp(self): self.viewer.canvas.unsubscribe_event("LeftButtonPressEvent", self.OnInsertPoint) self.viewer.canvas.unsubscribe_event( "LeftButtonDoubleClickEvent", self.OnInsertPolygon ) old_list = self.viewer.draw_by_slice_number self.viewer.draw_by_slice_number.clear() for n in old_list: for i in old_list[n]: if isinstance(i, PolygonDensityMeasure): if i.complete: self.viewer.draw_by_slice_number[n].append(i) else: self.viewer.draw_by_slice_number[n].append(i) self.viewer.UpdateCanvas() def _2d_to_3d(self, pos): mx, my = pos iren = self.viewer.interactor render = iren.FindPokedRenderer(mx, my) self.picker.AddPickList(self.slice_data.actor) self.picker.Pick(mx, my, 0, render) x, y, z = self.picker.GetPickPosition() self.picker.DeletePickList(self.slice_data.actor) return (x, y, z) def _pick_position(self): iren = self.viewer.interactor mx, my = self.GetMousePosition() return (mx, my) def _get_pos_clicked(self): mouse_x, mouse_y = self.GetMousePosition() position = self.viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) return position def OnInsertPoint(self, evt): mouse_x, mouse_y = evt.position print("OnInsertPoint", evt.position) n = self.viewer.slice_data.number pos = self.viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) if self.format == "ellipse": pp1 = self.viewer.get_coordinate_cursor(mouse_x + 50, mouse_y, self.picker) pp2 = self.viewer.get_coordinate_cursor(mouse_x, mouse_y + 50, self.picker) m = CircleDensityMeasure(self.orientation, n) m.set_center(pos) m.set_point1(pp1) m.set_point2(pp2) m.calc_density() _new_measure = True Publisher.sendMessage("Add density measurement", density_measure=m) elif self.format == "polygon": if self._last_measure is None: m = PolygonDensityMeasure(self.orientation, n) _new_measure = True else: m = self._last_measure _new_measure = False if m.slice_number != n: self.viewer.draw_by_slice_number[m.slice_number].remove(m) del m m = PolygonDensityMeasure(self.orientation, n) _new_measure = True m.insert_point(pos) if _new_measure: self.viewer.draw_by_slice_number[n].append(m) if self._last_measure: self._last_measure.set_interactive(False) self._last_measure = m # m.calc_density() self.viewer.UpdateCanvas() def OnInsertPolygon(self, evt): if self.format == "polygon" and self._last_measure: m = self._last_measure if len(m.points) >= 3: n = self.viewer.slice_data.number print(self.viewer.draw_by_slice_number[n], m) self.viewer.draw_by_slice_number[n].remove(m) m.complete_polygon() self._last_measure = None Publisher.sendMessage("Add density measurement", density_measure=m) self.viewer.UpdateCanvas() class DensityMeasureEllipseStyle(DensityMeasureStyle): def __init__(self, viewer): DensityMeasureStyle.__init__(self, viewer) self.state_code = const.STATE_MEASURE_DENSITY_ELLIPSE self.format = "ellipse" class DensityMeasurePolygonStyle(DensityMeasureStyle): def __init__(self, viewer): DensityMeasureStyle.__init__(self, viewer) self.state_code = const.STATE_MEASURE_DENSITY_POLYGON self.format = "polygon" class PanMoveInteractorStyle(DefaultInteractorStyle): """ Interactor style responsible for translate the camera. """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.STATE_PAN self.viewer = viewer self.AddObserver("MouseMoveEvent", self.OnPanMove) self.viewer.interactor.Bind(wx.EVT_LEFT_DCLICK, self.OnUnspan) def SetUp(self): Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=True) def CleanUp(self): self.viewer.interactor.Unbind(wx.EVT_LEFT_DCLICK) Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=False) def OnPanMove(self, obj, evt): if self.left_pressed: obj.Pan() obj.OnRightButtonDown() def OnUnspan(self, evt): iren = self.viewer.interactor mouse_x, mouse_y = iren.GetLastEventPosition() ren = iren.FindPokedRenderer(mouse_x, mouse_y) ren.ResetCamera() iren.Render() class SpinInteractorStyle(DefaultInteractorStyle): """ Interactor style responsible for spin the camera. """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.STATE_SPIN self.viewer = viewer self.AddObserver("MouseMoveEvent", self.OnSpinMove) self.viewer.interactor.Bind(wx.EVT_LEFT_DCLICK, self.OnUnspin) def SetUp(self): Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=True) def CleanUp(self): self.viewer.interactor.Unbind(wx.EVT_LEFT_DCLICK) Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=False) def OnSpinMove(self, obj, evt): iren = obj.GetInteractor() mouse_x, mouse_y = iren.GetLastEventPosition() ren = iren.FindPokedRenderer(mouse_x, mouse_y) cam = ren.GetActiveCamera() if self.left_pressed: self.viewer.UpdateTextDirection(cam) obj.Spin() obj.OnRightButtonDown() def OnUnspin(self, evt): orig_orien = 1 iren = self.viewer.interactor mouse_x, mouse_y = iren.GetLastEventPosition() ren = iren.FindPokedRenderer(mouse_x, mouse_y) cam = ren.GetActiveCamera() cam.SetViewUp(const.SLICE_POSITION[orig_orien][0][self.viewer.orientation]) self.viewer.ResetTextDirection(cam) iren.Render() class ZoomInteractorStyle(DefaultInteractorStyle): """ Interactor style responsible for zoom with movement of the mouse and the left mouse button clicked. """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.STATE_ZOOM self.viewer = viewer self.AddObserver("MouseMoveEvent", self.OnZoomMoveLeft) self.viewer.interactor.Bind(wx.EVT_LEFT_DCLICK, self.OnUnZoom) def SetUp(self): Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=True) def CleanUp(self): self.viewer.interactor.Unbind(wx.EVT_LEFT_DCLICK) Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=False) def OnZoomMoveLeft(self, obj, evt): if self.left_pressed: obj.Dolly() obj.OnRightButtonDown() def OnUnZoom(self, evt): mouse_x, mouse_y = self.viewer.interactor.GetLastEventPosition() ren = self.viewer.interactor.FindPokedRenderer(mouse_x, mouse_y) # slice_data = self.get_slice_data(ren) ren.ResetCamera() ren.ResetCameraClippingRange() # self.Reposition(slice_data) self.viewer.interactor.Render() class ZoomSLInteractorStyle(vtkInteractorStyleRubberBandZoom): """ Interactor style responsible for zoom by selecting a region. """ def __init__(self, viewer): self.viewer = viewer self.viewer.interactor.Bind(wx.EVT_LEFT_DCLICK, self.OnUnZoom) self.state_code = const.STATE_ZOOM_SL def SetUp(self): Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=True) def CleanUp(self): self.viewer.interactor.Unbind(wx.EVT_LEFT_DCLICK) Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=False) def OnUnZoom(self, evt): mouse_x, mouse_y = self.viewer.interactor.GetLastEventPosition() ren = self.viewer.interactor.FindPokedRenderer(mouse_x, mouse_y) # slice_data = self.get_slice_data(ren) ren.ResetCamera() ren.ResetCameraClippingRange() # self.Reposition(slice_data) self.viewer.interactor.Render() class ChangeSliceInteractorStyle(DefaultInteractorStyle): """ Interactor style responsible for change slice moving the mouse. """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_SCROLL self.viewer = viewer self.AddObserver("MouseMoveEvent", self.OnChangeSliceMove) self.AddObserver("LeftButtonPressEvent", self.OnChangeSliceClick) def SetUp(self): Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=True) def CleanUp(self): Publisher.sendMessage("Toggle toolbar item", _id=self.state_code, value=False) def OnChangeSliceMove(self, evt, obj): if self.left_pressed: min = 0 max = self.viewer.slice_.GetMaxSliceNumber(self.viewer.orientation) position = self.viewer.interactor.GetLastEventPosition() scroll_position = self.viewer.scroll.GetThumbPosition() if (position[1] > self.last_position) and (self.acum_achange_slice > min): self.acum_achange_slice -= 1 elif (position[1] < self.last_position) and (self.acum_achange_slice < max): self.acum_achange_slice += 1 self.last_position = position[1] self.viewer.scroll.SetThumbPosition(self.acum_achange_slice) self.viewer.OnScrollBar() def OnChangeSliceClick(self, evt, obj): position = self.viewer.interactor.GetLastEventPosition() self.acum_achange_slice = self.viewer.scroll.GetThumbPosition() self.last_position = position[1] class EditorConfig(metaclass=utils.Singleton): def __init__(self): self.operation = const.BRUSH_THRESH self.cursor_type = const.BRUSH_CIRCLE self.cursor_size = const.BRUSH_SIZE self.cursor_unit = "mm" class EditorInteractorStyle(DefaultInteractorStyle): def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_EDITOR self.viewer = viewer self.orientation = self.viewer.orientation self.config = EditorConfig() self.picker = vtkWorldPointPicker() self.AddObserver("EnterEvent", self.OnEnterInteractor) self.AddObserver("LeaveEvent", self.OnLeaveInteractor) self.AddObserver("LeftButtonPressEvent", self.OnBrushClick) self.AddObserver("LeftButtonReleaseEvent", self.OnBrushRelease) self.AddObserver("MouseMoveEvent", self.OnBrushMove) self.RemoveObservers("MouseWheelForwardEvent") self.RemoveObservers("MouseWheelBackwardEvent") self.AddObserver("MouseWheelForwardEvent", self.EOnScrollForward) self.AddObserver("MouseWheelBackwardEvent", self.EOnScrollBackward) Publisher.subscribe(self.set_bsize, "Set edition brush size") Publisher.subscribe(self.set_bunit, "Set edition brush unit") Publisher.subscribe(self.set_bformat, "Set brush format") Publisher.subscribe(self.set_boperation, "Set edition operation") self._set_cursor() self.viewer.slice_data.cursor.Show(0) def SetUp(self): x, y = self.viewer.interactor.ScreenToClient(wx.GetMousePosition()) if self.viewer.interactor.HitTest((x, y)) == wx.HT_WINDOW_INSIDE: self.viewer.slice_data.cursor.Show() y = self.viewer.interactor.GetSize()[1] - y w_x, w_y, w_z = self.viewer.get_coordinate_cursor(x, y, self.picker) self.viewer.slice_data.cursor.SetPosition((w_x, w_y, w_z)) self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_BLANK)) self.viewer.interactor.Render() def CleanUp(self): Publisher.unsubscribe(self.set_bsize, "Set edition brush size") Publisher.unsubscribe(self.set_bunit, "Set edition brush unit") Publisher.unsubscribe(self.set_bformat, "Set brush format") Publisher.unsubscribe(self.set_boperation, "Set edition operation") self.viewer.slice_data.cursor.Show(0) self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_DEFAULT)) self.viewer.interactor.Render() def set_bsize(self, size): self.config.cursor_size = size self.viewer.slice_data.cursor.SetSize(size) def set_bunit(self, unit): self.config.cursor_unit = unit self.viewer.slice_data.cursor.SetUnit(unit) def set_bformat(self, cursor_format): self.config.cursor_type = cursor_format self._set_cursor() def set_boperation(self, operation): self.config.operation = operation def _set_cursor(self): if self.config.cursor_type == const.BRUSH_SQUARE: cursor = ca.CursorRectangle() elif self.config.cursor_type == const.BRUSH_CIRCLE: cursor = ca.CursorCircle() cursor.SetOrientation(self.orientation) n = self.viewer.slice_data.number coordinates = {"SAGITAL": [n, 0, 0], "CORONAL": [0, n, 0], "AXIAL": [0, 0, n]} cursor.SetPosition(coordinates[self.orientation]) spacing = self.viewer.slice_.spacing cursor.SetSpacing(spacing) cursor.SetColour(self.viewer._brush_cursor_colour) cursor.SetSize(self.config.cursor_size) cursor.SetUnit(self.config.cursor_unit) self.viewer.slice_data.SetCursor(cursor) def OnEnterInteractor(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return self.viewer.slice_data.cursor.Show() self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_BLANK)) self.viewer.interactor.Render() def OnLeaveInteractor(self, obj, evt): self.viewer.slice_data.cursor.Show(0) self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_DEFAULT)) self.viewer.interactor.Render() def OnBrushClick(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return viewer = self.viewer iren = viewer.interactor operation = self.config.operation if operation == const.BRUSH_THRESH: if iren.GetControlKey(): if iren.GetShiftKey(): operation = const.BRUSH_THRESH_ERASE_ONLY else: operation = const.BRUSH_THRESH_ERASE elif iren.GetShiftKey(): operation = const.BRUSH_THRESH_ADD_ONLY elif operation == const.BRUSH_ERASE and iren.GetControlKey(): operation = const.BRUSH_DRAW elif operation == const.BRUSH_DRAW and iren.GetControlKey(): operation = const.BRUSH_ERASE viewer._set_editor_cursor_visibility(1) mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = viewer.get_slice_data(render) # TODO: Improve! # for i in self.slice_data_list: # i.cursor.Show(0) slice_data.cursor.Show() wx, wy, wz = viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) position = viewer.get_slice_pixel_coord_by_world_pos(wx, wy, wz) cursor = slice_data.cursor radius = cursor.radius slice_data.cursor.SetPosition((wx, wy, wz)) viewer.slice_.edit_mask_pixel( operation, cursor.GetPixels(), position, radius, viewer.orientation ) # viewer._flush_buffer = True # TODO: To create a new function to reload images to viewer. viewer.OnScrollBar() def OnBrushMove(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return viewer = self.viewer iren = viewer.interactor viewer._set_editor_cursor_visibility(1) mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = viewer.get_slice_data(render) operation = self.config.operation if operation == const.BRUSH_THRESH: if iren.GetControlKey(): if iren.GetShiftKey(): operation = const.BRUSH_THRESH_ERASE_ONLY else: operation = const.BRUSH_THRESH_ERASE elif iren.GetShiftKey(): operation = const.BRUSH_THRESH_ADD_ONLY elif operation == const.BRUSH_ERASE and iren.GetControlKey(): operation = const.BRUSH_DRAW elif operation == const.BRUSH_DRAW and iren.GetControlKey(): operation = const.BRUSH_ERASE wx, wy, wz = viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) slice_data.cursor.SetPosition((wx, wy, wz)) if self.left_pressed: cursor = slice_data.cursor radius = cursor.radius position = viewer.get_slice_pixel_coord_by_world_pos(wx, wy, wz) slice_data.cursor.SetPosition((wx, wy, wz)) viewer.slice_.edit_mask_pixel( operation, cursor.GetPixels(), position, radius, viewer.orientation ) viewer.OnScrollBar(update3D=False) else: viewer.interactor.Render() def OnBrushRelease(self, evt, obj): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return self.viewer._flush_buffer = True self.viewer.slice_.apply_slice_buffer_to_mask(self.orientation) self.viewer._flush_buffer = False self.viewer.slice_.current_mask.modified() def EOnScrollForward(self, evt, obj): iren = self.viewer.interactor viewer = self.viewer if iren.GetControlKey(): mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = self.viewer.get_slice_data(render) cursor = slice_data.cursor size = cursor.radius * 2 size += 1 if size <= 100: Publisher.sendMessage("Set edition brush size", size=size) cursor.SetPosition(cursor.position) self.viewer.interactor.Render() else: self.OnScrollForward(obj, evt) def EOnScrollBackward(self, evt, obj): iren = self.viewer.interactor viewer = self.viewer if iren.GetControlKey(): mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = self.viewer.get_slice_data(render) cursor = slice_data.cursor size = cursor.radius * 2 size -= 1 if size > 0: Publisher.sendMessage("Set edition brush size", size=size) cursor.SetPosition(cursor.position) self.viewer.interactor.Render() else: self.OnScrollBackward(obj, evt) class WatershedProgressWindow(object): def __init__(self, process): self.process = process self.title = "InVesalius 3" self.msg = _("Applying watershed ...") self.style = wx.PD_APP_MODAL | wx.PD_APP_MODAL | wx.PD_CAN_ABORT self.dlg = wx.ProgressDialog( self.title, self.msg, parent=wx.GetApp().GetTopWindow(), style=self.style ) self.dlg.Bind(wx.EVT_BUTTON, self.Cancel) self.dlg.Show() def Cancel(self, evt): self.process.terminate() def Update(self): self.dlg.Pulse() def Close(self): self.dlg.Destroy() class WatershedConfig(metaclass=utils.Singleton): def __init__(self): self.algorithm = "Watershed" self.con_2d = 4 self.con_3d = 6 self.mg_size = 3 self.use_ww_wl = True self.operation = BRUSH_FOREGROUND self.cursor_type = const.BRUSH_CIRCLE self.cursor_size = const.BRUSH_SIZE self.cursor_unit = "mm" Publisher.subscribe(self.set_operation, "Set watershed operation") Publisher.subscribe(self.set_use_ww_wl, "Set use ww wl") Publisher.subscribe(self.set_algorithm, "Set watershed algorithm") Publisher.subscribe(self.set_2dcon, "Set watershed 2d con") Publisher.subscribe(self.set_3dcon, "Set watershed 3d con") Publisher.subscribe(self.set_gaussian_size, "Set watershed gaussian size") def set_operation(self, operation): self.operation = WATERSHED_OPERATIONS[operation] def set_use_ww_wl(self, use_ww_wl): self.use_ww_wl = use_ww_wl def set_algorithm(self, algorithm): self.algorithm = algorithm def set_2dcon(self, con_2d): self.con_2d = con_2d def set_3dcon(self, con_3d): self.con_3d = con_3d def set_gaussian_size(self, size): self.mg_size = size WALGORITHM = {"Watershed": watershed, "Watershed IFT": watershed_ift} CON2D = {4: 1, 8: 2} CON3D = {6: 1, 18: 2, 26: 3} class WaterShedInteractorStyle(DefaultInteractorStyle): def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_WATERSHED self.viewer = viewer self.orientation = self.viewer.orientation self.matrix = None self.config = WatershedConfig() self.picker = vtkWorldPointPicker() self.AddObserver("EnterEvent", self.OnEnterInteractor) self.AddObserver("LeaveEvent", self.OnLeaveInteractor) self.RemoveObservers("MouseWheelForwardEvent") self.RemoveObservers("MouseWheelBackwardEvent") self.AddObserver("MouseWheelForwardEvent", self.WOnScrollForward) self.AddObserver("MouseWheelBackwardEvent", self.WOnScrollBackward) self.AddObserver("LeftButtonPressEvent", self.OnBrushClick) self.AddObserver("LeftButtonReleaseEvent", self.OnBrushRelease) self.AddObserver("MouseMoveEvent", self.OnBrushMove) Publisher.subscribe( self.expand_watershed, "Expand watershed to 3D " + self.orientation ) Publisher.subscribe(self.set_bsize, "Set watershed brush size") Publisher.subscribe(self.set_bunit, "Set watershed brush unit") Publisher.subscribe(self.set_bformat, "Set watershed brush format") self._set_cursor() self.viewer.slice_data.cursor.Show(0) def SetUp(self): mask = self.viewer.slice_.current_mask.matrix self._create_mask() self.viewer.slice_.to_show_aux = "watershed" self.viewer.OnScrollBar() x, y = self.viewer.interactor.ScreenToClient(wx.GetMousePosition()) if self.viewer.interactor.HitTest((x, y)) == wx.HT_WINDOW_INSIDE: self.viewer.slice_data.cursor.Show() y = self.viewer.interactor.GetSize()[1] - y w_x, w_y, w_z = self.viewer.get_coordinate_cursor(x, y, self.picker) self.viewer.slice_data.cursor.SetPosition((w_x, w_y, w_z)) self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_BLANK)) self.viewer.interactor.Render() def CleanUp(self): # self._remove_mask() Publisher.unsubscribe( self.expand_watershed, "Expand watershed to 3D " + self.orientation ) Publisher.unsubscribe(self.set_bformat, "Set watershed brush format") Publisher.unsubscribe(self.set_bsize, "Set watershed brush size") self.RemoveAllObservers() self.viewer.slice_.to_show_aux = "" self.viewer.OnScrollBar() self.viewer.slice_data.cursor.Show(0) self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_DEFAULT)) self.viewer.interactor.Render() def _create_mask(self): if self.matrix is None: try: self.matrix = self.viewer.slice_.aux_matrices["watershed"] except KeyError: self.temp_file, self.matrix = self.viewer.slice_.create_temp_mask() self.viewer.slice_.aux_matrices["watershed"] = self.matrix def _remove_mask(self): if self.matrix is not None: self.matrix = None os.remove(self.temp_file) print("deleting", self.temp_file) def _set_cursor(self): if self.config.cursor_type == const.BRUSH_SQUARE: cursor = ca.CursorRectangle() elif self.config.cursor_type == const.BRUSH_CIRCLE: cursor = ca.CursorCircle() cursor.SetOrientation(self.orientation) n = self.viewer.slice_data.number coordinates = {"SAGITAL": [n, 0, 0], "CORONAL": [0, n, 0], "AXIAL": [0, 0, n]} cursor.SetPosition(coordinates[self.orientation]) spacing = self.viewer.slice_.spacing cursor.SetSpacing(spacing) cursor.SetColour(self.viewer._brush_cursor_colour) cursor.SetSize(self.config.cursor_size) cursor.SetUnit(self.config.cursor_unit) self.viewer.slice_data.SetCursor(cursor) def set_bsize(self, size): self.config.cursor_size = size self.viewer.slice_data.cursor.SetSize(size) def set_bunit(self, unit): self.config.cursor_unit = unit self.viewer.slice_data.cursor.SetUnit(unit) def set_bformat(self, brush_format): self.config.cursor_type = brush_format self._set_cursor() def OnEnterInteractor(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return self.viewer.slice_data.cursor.Show() self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_BLANK)) self.viewer.interactor.Render() def OnLeaveInteractor(self, obj, evt): self.viewer.slice_data.cursor.Show(0) self.viewer.interactor.SetCursor(wx.Cursor(wx.CURSOR_DEFAULT)) self.viewer.interactor.Render() def WOnScrollBackward(self, obj, evt): iren = self.viewer.interactor viewer = self.viewer if iren.GetControlKey(): mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = self.viewer.get_slice_data(render) cursor = slice_data.cursor size = cursor.radius * 2 size -= 1 if size > 0: Publisher.sendMessage("Set watershed brush size", size=size) cursor.SetPosition(cursor.position) self.viewer.interactor.Render() else: self.OnScrollBackward(obj, evt) def WOnScrollForward(self, obj, evt): iren = self.viewer.interactor viewer = self.viewer if iren.GetControlKey(): mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = self.viewer.get_slice_data(render) cursor = slice_data.cursor size = cursor.radius * 2 size += 1 if size <= 100: Publisher.sendMessage("Set watershed brush size", size=size) cursor.SetPosition(cursor.position) self.viewer.interactor.Render() else: self.OnScrollForward(obj, evt) def OnBrushClick(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return viewer = self.viewer iren = viewer.interactor viewer._set_editor_cursor_visibility(1) mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = viewer.get_slice_data(render) coord = self.viewer.get_coordinate_cursor(mouse_x, mouse_y, picker=None) position = self.viewer.get_slice_pixel_coord_by_screen_pos( mouse_x, mouse_y, self.picker ) slice_data.cursor.Show() slice_data.cursor.SetPosition(coord) cursor = slice_data.cursor radius = cursor.radius operation = self.config.operation if operation == BRUSH_FOREGROUND: if iren.GetControlKey(): operation = BRUSH_BACKGROUND elif iren.GetShiftKey(): operation = BRUSH_ERASE elif operation == BRUSH_BACKGROUND: if iren.GetControlKey(): operation = BRUSH_FOREGROUND elif iren.GetShiftKey(): operation = BRUSH_ERASE n = self.viewer.slice_data.number self.edit_mask_pixel( operation, n, cursor.GetPixels(), position, radius, self.orientation ) if self.orientation == "AXIAL": mask = self.matrix[n, :, :] elif self.orientation == "CORONAL": mask = self.matrix[:, n, :] elif self.orientation == "SAGITAL": mask = self.matrix[:, :, n] # TODO: To create a new function to reload images to viewer. viewer.OnScrollBar() def OnBrushMove(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return viewer = self.viewer iren = viewer.interactor viewer._set_editor_cursor_visibility(1) mouse_x, mouse_y = self.GetMousePosition() render = iren.FindPokedRenderer(mouse_x, mouse_y) slice_data = viewer.get_slice_data(render) coord = self.viewer.get_coordinate_cursor(mouse_x, mouse_y, self.picker) slice_data.cursor.SetPosition(coord) if self.left_pressed: cursor = slice_data.cursor position = self.viewer.get_slice_pixel_coord_by_world_pos(*coord) radius = cursor.radius if isinstance(position, int) and position < 0: position = viewer.calculate_matrix_position(coord) operation = self.config.operation if operation == BRUSH_FOREGROUND: if iren.GetControlKey(): operation = BRUSH_BACKGROUND elif iren.GetShiftKey(): operation = BRUSH_ERASE elif operation == BRUSH_BACKGROUND: if iren.GetControlKey(): operation = BRUSH_FOREGROUND elif iren.GetShiftKey(): operation = BRUSH_ERASE n = self.viewer.slice_data.number self.edit_mask_pixel( operation, n, cursor.GetPixels(), position, radius, self.orientation ) if self.orientation == "AXIAL": mask = self.matrix[n, :, :] elif self.orientation == "CORONAL": mask = self.matrix[:, n, :] elif self.orientation == "SAGITAL": mask = self.matrix[:, :, n] # TODO: To create a new function to reload images to viewer. viewer.OnScrollBar(update3D=False) else: viewer.interactor.Render() def OnBrushRelease(self, evt, obj): n = self.viewer.slice_data.number self.viewer.slice_.discard_all_buffers() if self.orientation == "AXIAL": image = self.viewer.slice_.matrix[n] mask = self.viewer.slice_.current_mask.matrix[n + 1, 1:, 1:] self.viewer.slice_.current_mask.matrix[n + 1, 0, 0] = 1 markers = self.matrix[n] elif self.orientation == "CORONAL": image = self.viewer.slice_.matrix[:, n, :] mask = self.viewer.slice_.current_mask.matrix[1:, n + 1, 1:] self.viewer.slice_.current_mask.matrix[0, n + 1, 0] markers = self.matrix[:, n, :] elif self.orientation == "SAGITAL": image = self.viewer.slice_.matrix[:, :, n] mask = self.viewer.slice_.current_mask.matrix[1:, 1:, n + 1] self.viewer.slice_.current_mask.matrix[0, 0, n + 1] markers = self.matrix[:, :, n] ww = self.viewer.slice_.window_width wl = self.viewer.slice_.window_level if BRUSH_BACKGROUND in markers and BRUSH_FOREGROUND in markers: # w_algorithm = WALGORITHM[self.config.algorithm] bstruct = generate_binary_structure(2, CON2D[self.config.con_2d]) if self.config.use_ww_wl: if self.config.algorithm == "Watershed": tmp_image = ndimage.morphological_gradient( get_LUT_value(image, ww, wl).astype("uint16"), self.config.mg_size, ) tmp_mask = watershed(tmp_image, markers.astype("int16"), bstruct) else: # tmp_image = ndimage.gaussian_filter(get_LUT_value(image, ww, wl).astype('uint16'), self.config.mg_size) # tmp_image = ndimage.morphological_gradient( # get_LUT_value(image, ww, wl).astype('uint16'), # self.config.mg_size) tmp_image = get_LUT_value(image, ww, wl).astype("uint16") # markers[markers == 2] = -1 tmp_mask = watershed_ift( tmp_image, markers.astype("int16"), bstruct ) # markers[markers == -1] = 2 # tmp_mask[tmp_mask == -1] = 2 else: if self.config.algorithm == "Watershed": tmp_image = ndimage.morphological_gradient( (image - image.min()).astype("uint16"), self.config.mg_size ) tmp_mask = watershed(tmp_image, markers.astype("int16"), bstruct) else: # tmp_image = (image - image.min()).astype('uint16') # tmp_image = ndimage.gaussian_filter(tmp_image, self.config.mg_size) # tmp_image = ndimage.morphological_gradient((image - image.min()).astype('uint16'), self.config.mg_size) tmp_image = image - image.min().astype("uint16") tmp_mask = watershed_ift( tmp_image, markers.astype("int16"), bstruct ) if self.viewer.overwrite_mask: mask[:] = 0 mask[tmp_mask == 1] = 253 else: mask[(tmp_mask == 2) & ((mask == 0) | (mask == 2) | (mask == 253))] = 2 mask[ (tmp_mask == 1) & ((mask == 0) | (mask == 2) | (mask == 253)) ] = 253 self.viewer.slice_.current_mask.was_edited = True self.viewer.slice_.current_mask.modified() self.viewer.slice_.current_mask.clear_history() # Marking the project as changed session = ses.Session() session.ChangeProject() Publisher.sendMessage("Reload actual slice") def edit_mask_pixel(self, operation, n, index, position, radius, orientation): if orientation == "AXIAL": mask = self.matrix[n, :, :] elif orientation == "CORONAL": mask = self.matrix[:, n, :] elif orientation == "SAGITAL": mask = self.matrix[:, :, n] spacing = self.viewer.slice_.spacing if hasattr(position, "__iter__"): px, py = position if orientation == "AXIAL": sx = spacing[0] sy = spacing[1] elif orientation == "CORONAL": sx = spacing[0] sy = spacing[2] elif orientation == "SAGITAL": sx = spacing[2] sy = spacing[1] else: if orientation == "AXIAL": sx = spacing[0] sy = spacing[1] py = position / mask.shape[1] px = position % mask.shape[1] elif orientation == "CORONAL": sx = spacing[0] sy = spacing[2] py = position / mask.shape[1] px = position % mask.shape[1] elif orientation == "SAGITAL": sx = spacing[2] sy = spacing[1] py = position / mask.shape[1] px = position % mask.shape[1] cx = index.shape[1] / 2 + 1 cy = index.shape[0] / 2 + 1 xi = int(px - index.shape[1] + cx) xf = int(xi + index.shape[1]) yi = int(py - index.shape[0] + cy) yf = int(yi + index.shape[0]) if yi < 0: index = index[abs(yi) :, :] yi = 0 if yf > mask.shape[0]: index = index[: index.shape[0] - (yf - mask.shape[0]), :] yf = mask.shape[0] if xi < 0: index = index[:, abs(xi) :] xi = 0 if xf > mask.shape[1]: index = index[:, : index.shape[1] - (xf - mask.shape[1])] xf = mask.shape[1] # Verifying if the points is over the image array. if (not 0 <= xi <= mask.shape[1] and not 0 <= xf <= mask.shape[1]) or ( not 0 <= yi <= mask.shape[0] and not 0 <= yf <= mask.shape[0] ): return roi_m = mask[yi:yf, xi:xf] # Checking if roi_i has at least one element. if roi_m.size: roi_m[index] = operation def expand_watershed(self): markers = self.matrix image = self.viewer.slice_.matrix self.viewer.slice_.do_threshold_to_all_slices() mask = self.viewer.slice_.current_mask.matrix[1:, 1:, 1:] ww = self.viewer.slice_.window_width wl = self.viewer.slice_.window_level if BRUSH_BACKGROUND in markers and BRUSH_FOREGROUND in markers: # w_algorithm = WALGORITHM[self.config.algorithm] bstruct = generate_binary_structure(3, CON3D[self.config.con_3d]) tfile = tempfile.mktemp() tmp_mask = np.memmap(tfile, shape=mask.shape, dtype=mask.dtype, mode="w+") q = multiprocessing.Queue() p = multiprocessing.Process( target=watershed_process.do_watershed, args=( image, markers, tfile, tmp_mask.shape, bstruct, self.config.algorithm, self.config.mg_size, self.config.use_ww_wl, wl, ww, q, ), ) wp = WatershedProgressWindow(p) p.start() while q.empty() and p.is_alive(): time.sleep(0.5) wp.Update() wx.Yield() wp.Close() del wp w_x, w_y = wx.GetMousePosition() x, y = self.viewer.ScreenToClient((w_x, w_y)) flag = self.viewer.interactor.HitTest((x, y)) if flag == wx.HT_WINDOW_INSIDE: self.OnEnterInteractor(None, None) if q.empty(): return # do_watershed(image, markers, tmp_mask, bstruct, self.config.algorithm, # self.config.mg_size, self.config.use_ww_wl, wl, ww) # if self.config.use_ww_wl: # if self.config.algorithm == 'Watershed': # tmp_image = ndimage.morphological_gradient( # get_LUT_value(image, ww, wl).astype('uint16'), # self.config.mg_size) # tmp_mask = watershed(tmp_image, markers.astype('int16'), bstruct) # else: # tmp_image = get_LUT_value(image, ww, wl).astype('uint16') ##tmp_image = ndimage.gaussian_filter(tmp_image, self.config.mg_size) ##tmp_image = ndimage.morphological_gradient( ##get_LUT_value(image, ww, wl).astype('uint16'), ##self.config.mg_size) # tmp_mask = watershed_ift(tmp_image, markers.astype('int16'), bstruct) # else: # if self.config.algorithm == 'Watershed': # tmp_image = ndimage.morphological_gradient((image - image.min()).astype('uint16'), self.config.mg_size) # tmp_mask = watershed(tmp_image, markers.astype('int16'), bstruct) # else: # tmp_image = (image - image.min()).astype('uint16') ##tmp_image = ndimage.gaussian_filter(tmp_image, self.config.mg_size) ##tmp_image = ndimage.morphological_gradient((image - image.min()).astype('uint16'), self.config.mg_size) # tmp_mask = watershed_ift(tmp_image, markers.astype('int8'), bstruct) if self.viewer.overwrite_mask: mask[:] = 0 mask[tmp_mask == 1] = 253 else: mask[(tmp_mask == 2) & ((mask == 0) | (mask == 2) | (mask == 253))] = 2 mask[ (tmp_mask == 1) & ((mask == 0) | (mask == 2) | (mask == 253)) ] = 253 self.viewer.slice_.current_mask.modified(True) self.viewer.slice_.discard_all_buffers() self.viewer.slice_.current_mask.clear_history() Publisher.sendMessage("Reload actual slice") # Marking the project as changed session = ses.Session() session.ChangeProject() class ReorientImageInteractorStyle(DefaultInteractorStyle): """ Interactor style responsible for image reorientation """ def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_REORIENT self.viewer = viewer self.line1 = None self.line2 = None self.actors = [] self._over_center = False self.dragging = False self.to_rot = False self.picker = vtkWorldPointPicker() self.AddObserver("LeftButtonPressEvent", self.OnLeftClick) self.AddObserver("LeftButtonReleaseEvent", self.OnLeftRelease) self.AddObserver("MouseMoveEvent", self.OnMouseMove) self.viewer.slice_data.renderer.AddObserver("StartEvent", self.OnUpdate) if self.viewer.orientation == "AXIAL": Publisher.subscribe( self._set_reorientation_angles, "Set reorientation angles" ) self.viewer.interactor.Bind(wx.EVT_LEFT_DCLICK, self.OnDblClick) def SetUp(self): self.draw_lines() Publisher.sendMessage("Hide current mask") Publisher.sendMessage("Reload actual slice") def CleanUp(self): self.viewer.interactor.Unbind(wx.EVT_LEFT_DCLICK) for actor in self.actors: self.viewer.slice_data.renderer.RemoveActor(actor) self.viewer.slice_.rotations = [0, 0, 0] self.viewer.slice_.q_orientation = np.array((1, 0, 0, 0)) self._discard_buffers() Publisher.sendMessage("Close reorient dialog") Publisher.sendMessage("Show current mask") def OnLeftClick(self, obj, evt): if self._over_center: self.dragging = True else: x, y = self.GetMousePosition() w, h = self.viewer.interactor.GetSize() self.picker.Pick(h / 2.0, w / 2.0, 0, self.viewer.slice_data.renderer) cx, cy, cz = self.viewer.slice_.center self.picker.Pick(x, y, 0, self.viewer.slice_data.renderer) x, y, z = self.picker.GetPickPosition() self.p0 = self.get_image_point_coord(x, y, z) self.to_rot = True def OnLeftRelease(self, obj, evt): self.dragging = False if self.to_rot: Publisher.sendMessage("Reload actual slice") self.to_rot = False def OnMouseMove(self, obj, evt): """ This event is responsible to reorient image, set mouse cursors """ if self.dragging: self._move_center_rot() elif self.to_rot: self._rotate() else: # Getting mouse position iren = self.viewer.interactor mx, my = self.GetMousePosition() # Getting center value center = self.viewer.slice_.center coord = vtkCoordinate() coord.SetValue(center) cx, cy = coord.GetComputedDisplayValue(self.viewer.slice_data.renderer) dist_center = ((mx - cx) ** 2 + (my - cy) ** 2) ** 0.5 if dist_center <= 15: self._over_center = True cursor = wx.Cursor(wx.CURSOR_SIZENESW) else: self._over_center = False cursor = wx.Cursor(wx.CURSOR_DEFAULT) self.viewer.interactor.SetCursor(cursor) def OnUpdate(self, obj, evt): w, h = self.viewer.slice_data.renderer.GetSize() center = self.viewer.slice_.center coord = vtkCoordinate() coord.SetValue(center) x, y = coord.GetComputedDisplayValue(self.viewer.slice_data.renderer) self.line1.SetPoint1(0, y, 0) self.line1.SetPoint2(w, y, 0) self.line1.Update() self.line2.SetPoint1(x, 0, 0) self.line2.SetPoint2(x, h, 0) self.line2.Update() def OnDblClick(self, evt): self.viewer.slice_.rotations = [0, 0, 0] self.viewer.slice_.q_orientation = np.array((1, 0, 0, 0)) Publisher.sendMessage("Update reorient angles", angles=(0, 0, 0)) self._discard_buffers() self.viewer.slice_.current_mask.clear_history() Publisher.sendMessage("Reload actual slice") def _move_center_rot(self): iren = self.viewer.interactor mx, my = self.GetMousePosition() icx, icy, icz = self.viewer.slice_.center self.picker.Pick(mx, my, 0, self.viewer.slice_data.renderer) x, y, z = self.picker.GetPickPosition() if self.viewer.orientation == "AXIAL": self.viewer.slice_.center = (x, y, icz) elif self.viewer.orientation == "CORONAL": self.viewer.slice_.center = (x, icy, z) elif self.viewer.orientation == "SAGITAL": self.viewer.slice_.center = (icx, y, z) self._discard_buffers() self.viewer.slice_.current_mask.clear_history() Publisher.sendMessage("Reload actual slice") def _rotate(self): # Getting mouse position iren = self.viewer.interactor mx, my = self.GetMousePosition() cx, cy, cz = self.viewer.slice_.center self.picker.Pick(mx, my, 0, self.viewer.slice_data.renderer) x, y, z = self.picker.GetPickPosition() if self.viewer.orientation == "AXIAL": p1 = np.array((y - cy, x - cx)) elif self.viewer.orientation == "CORONAL": p1 = np.array((z - cz, x - cx)) elif self.viewer.orientation == "SAGITAL": p1 = np.array((z - cz, y - cy)) p0 = self.p0 p1 = self.get_image_point_coord(x, y, z) axis = np.cross(p0, p1) norm = np.linalg.norm(axis) if norm == 0: return axis = axis / norm angle = np.arccos(np.dot(p0, p1) / (np.linalg.norm(p0) * np.linalg.norm(p1))) self.viewer.slice_.q_orientation = transformations.quaternion_multiply( self.viewer.slice_.q_orientation, transformations.quaternion_about_axis(angle, axis), ) az, ay, ax = transformations.euler_from_quaternion( self.viewer.slice_.q_orientation ) Publisher.sendMessage("Update reorient angles", angles=(ax, ay, az)) self._discard_buffers() if self.viewer.slice_.current_mask: self.viewer.slice_.current_mask.clear_history() Publisher.sendMessage("Reload actual slice %s" % self.viewer.orientation) self.p0 = self.get_image_point_coord(x, y, z) def get_image_point_coord(self, x, y, z): cx, cy, cz = self.viewer.slice_.center if self.viewer.orientation == "AXIAL": z = cz elif self.viewer.orientation == "CORONAL": y = cy elif self.viewer.orientation == "SAGITAL": x = cx x, y, z = x - cx, y - cy, z - cz M = transformations.quaternion_matrix(self.viewer.slice_.q_orientation) tcoord = np.array((z, y, x, 1)).dot(M) tcoord = tcoord[:3] / tcoord[3] # print (z, y, x), tcoord return tcoord def _set_reorientation_angles(self, angles): ax, ay, az = angles q = transformations.quaternion_from_euler(az, ay, ax) self.viewer.slice_.q_orientation = q self._discard_buffers() self.viewer.slice_.current_mask.clear_history() Publisher.sendMessage("Reload actual slice") def _create_line(self, x0, y0, x1, y1, color): line = vtkLineSource() line.SetPoint1(x0, y0, 0) line.SetPoint2(x1, y1, 0) coord = vtkCoordinate() coord.SetCoordinateSystemToDisplay() mapper = vtkPolyDataMapper2D() mapper.SetTransformCoordinate(coord) mapper.SetInputConnection(line.GetOutputPort()) mapper.Update() actor = vtkActor2D() actor.SetMapper(mapper) actor.GetProperty().SetLineWidth(2.0) actor.GetProperty().SetColor(color) actor.GetProperty().SetOpacity(0.5) self.viewer.slice_data.renderer.AddActor(actor) self.actors.append(actor) return line def draw_lines(self): if self.viewer.orientation == "AXIAL": color1 = (0, 1, 0) color2 = (0, 0, 1) elif self.viewer.orientation == "CORONAL": color1 = (1, 0, 0) color2 = (0, 0, 1) elif self.viewer.orientation == "SAGITAL": color1 = (1, 0, 0) color2 = (0, 1, 0) self.line1 = self._create_line(0, 0.5, 1, 0.5, color1) self.line2 = self._create_line(0.5, 0, 0.5, 1, color2) def _discard_buffers(self): for buffer_ in self.viewer.slice_.buffer_slices.values(): buffer_.discard_vtk_image() buffer_.discard_image() class FFillConfig(metaclass=utils.Singleton): def __init__(self): self.dlg_visible = False self.target = "2D" self.con_2d = 4 self.con_3d = 6 class FloodFillMaskInteractorStyle(DefaultInteractorStyle): def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_MASK_FFILL self.viewer = viewer self.orientation = self.viewer.orientation self.picker = vtkWorldPointPicker() self.slice_actor = viewer.slice_data.actor self.slice_data = viewer.slice_data self.config = FFillConfig() self.dlg_ffill = None # InVesalius uses the following values to mark non selected parts in a # mask: # 0 - Threshold # 1 - Manual edition and floodfill # 2 - Watershed self.t0 = 0 self.t1 = 2 self.fill_value = 254 self._dlg_title = _("Fill holes") self._progr_title = _("Fill hole") self._progr_msg = _("Filling hole ...") self.AddObserver("LeftButtonPressEvent", self.OnFFClick) def SetUp(self): if not self.config.dlg_visible: self.config.dlg_visible = True self.dlg_ffill = dialogs.FFillOptionsDialog(self._dlg_title, self.config) self.dlg_ffill.Show() def CleanUp(self): if (self.dlg_ffill is not None) and (self.config.dlg_visible): self.config.dlg_visible = False self.dlg_ffill.Destroy() self.dlg_ffill = None def OnFFClick(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return viewer = self.viewer iren = viewer.interactor mouse_x, mouse_y = self.GetMousePosition() x, y, z = self.viewer.get_voxel_coord_by_screen_pos( mouse_x, mouse_y, self.picker ) mask = self.viewer.slice_.current_mask.matrix[1:, 1:, 1:] if mask[z, y, x] < self.t0 or mask[z, y, x] > self.t1: return if self.config.target == "3D": bstruct = np.array( generate_binary_structure(3, CON3D[self.config.con_3d]), dtype="uint8" ) self.viewer.slice_.do_threshold_to_all_slices() cp_mask = self.viewer.slice_.current_mask.matrix.copy() else: _bstruct = generate_binary_structure(2, CON2D[self.config.con_2d]) if self.orientation == "AXIAL": bstruct = np.zeros((1, 3, 3), dtype="uint8") bstruct[0] = _bstruct elif self.orientation == "CORONAL": bstruct = np.zeros((3, 1, 3), dtype="uint8") bstruct[:, 0, :] = _bstruct elif self.orientation == "SAGITAL": bstruct = np.zeros((3, 3, 1), dtype="uint8") bstruct[:, :, 0] = _bstruct if self.config.target == "2D": floodfill.floodfill_threshold( mask, [[x, y, z]], self.t0, self.t1, self.fill_value, bstruct, mask ) b_mask = self.viewer.slice_.buffer_slices[self.orientation].mask index = self.viewer.slice_.buffer_slices[self.orientation].index if self.orientation == "AXIAL": p_mask = mask[index, :, :].copy() elif self.orientation == "CORONAL": p_mask = mask[:, index, :].copy() elif self.orientation == "SAGITAL": p_mask = mask[:, :, index].copy() self.viewer.slice_.current_mask.save_history( index, self.orientation, p_mask, b_mask ) else: with futures.ThreadPoolExecutor(max_workers=1) as executor: future = executor.submit( floodfill.floodfill_threshold, mask, [[x, y, z]], self.t0, self.t1, self.fill_value, bstruct, mask, ) dlg = wx.ProgressDialog( self._progr_title, self._progr_msg, parent=wx.GetApp().GetTopWindow(), style=wx.PD_APP_MODAL, ) while not future.done(): dlg.Pulse() time.sleep(0.1) dlg.Destroy() self.viewer.slice_.current_mask.save_history( 0, "VOLUME", self.viewer.slice_.current_mask.matrix.copy(), cp_mask ) self.viewer.slice_.buffer_slices["AXIAL"].discard_mask() self.viewer.slice_.buffer_slices["CORONAL"].discard_mask() self.viewer.slice_.buffer_slices["SAGITAL"].discard_mask() self.viewer.slice_.buffer_slices["AXIAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["CORONAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["SAGITAL"].discard_vtk_mask() self.viewer.slice_.current_mask.was_edited = True self.viewer.slice_.current_mask.modified(True) Publisher.sendMessage("Reload actual slice") class RemoveMaskPartsInteractorStyle(FloodFillMaskInteractorStyle): def __init__(self, viewer): FloodFillMaskInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_REMOVE_MASK_PARTS # InVesalius uses the following values to mark selected parts in a # mask: # 255 - Threshold # 254 - Manual edition and floodfill # 253 - Watershed self.t0 = 253 self.t1 = 255 self.fill_value = 1 self._dlg_title = _("Remove parts") self._progr_title = _("Remove part") self._progr_msg = _("Removing part ...") class CropMaskConfig(metaclass=utils.Singleton): def __init__(self): self.dlg_visible = False class CropMaskInteractorStyle(DefaultInteractorStyle): def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_CROP_MASK self.viewer = viewer self.orientation = self.viewer.orientation self.picker = vtkWorldPointPicker() self.slice_actor = viewer.slice_data.actor self.slice_data = viewer.slice_data self.draw_retangle = None self.config = CropMaskConfig() def __evts__(self): self.AddObserver("MouseMoveEvent", self.OnMove) self.AddObserver("LeftButtonPressEvent", self.OnLeftPressed) self.AddObserver("LeftButtonReleaseEvent", self.OnReleaseLeftButton) Publisher.subscribe(self.CropMask, "Crop mask") def OnMove(self, obj, evt): x, y = self.GetMousePosition() self.draw_retangle.MouseMove(x, y) def OnLeftPressed(self, obj, evt): self.draw_retangle.mouse_pressed = True x, y = self.GetMousePosition() self.draw_retangle.LeftPressed(x, y) def OnReleaseLeftButton(self, obj, evt): self.draw_retangle.mouse_pressed = False self.draw_retangle.ReleaseLeft() def SetUp(self): self.draw_retangle = geom.DrawCrop2DRetangle() self.draw_retangle.SetViewer(self.viewer) self.viewer.canvas.draw_list.append(self.draw_retangle) self.viewer.UpdateCanvas() if not (self.config.dlg_visible): self.config.dlg_visible = True dlg = dialogs.CropOptionsDialog(self.config) dlg.UpdateValues(self.draw_retangle.box.GetLimits()) dlg.Show() self.__evts__() # self.draw_lines() # Publisher.sendMessage('Hide current mask') # Publisher.sendMessage('Reload actual slice') def CleanUp(self): self.viewer.canvas.draw_list.remove(self.draw_retangle) Publisher.sendMessage("Redraw canvas") def CropMask(self): if self.viewer.orientation == "AXIAL": xi, xf, yi, yf, zi, zf = self.draw_retangle.box.GetLimits() xi += 1 xf += 1 yi += 1 yf += 1 zi += 1 zf += 1 self.viewer.slice_.do_threshold_to_all_slices() cp_mask = self.viewer.slice_.current_mask.matrix.copy() tmp_mask = self.viewer.slice_.current_mask.matrix[ zi - 1 : zf + 1, yi - 1 : yf + 1, xi - 1 : xf + 1 ].copy() self.viewer.slice_.current_mask.matrix[:] = 1 self.viewer.slice_.current_mask.matrix[ zi - 1 : zf + 1, yi - 1 : yf + 1, xi - 1 : xf + 1 ] = tmp_mask self.viewer.slice_.current_mask.save_history( 0, "VOLUME", self.viewer.slice_.current_mask.matrix.copy(), cp_mask ) self.viewer.slice_.buffer_slices["AXIAL"].discard_mask() self.viewer.slice_.buffer_slices["CORONAL"].discard_mask() self.viewer.slice_.buffer_slices["SAGITAL"].discard_mask() self.viewer.slice_.buffer_slices["AXIAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["CORONAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["SAGITAL"].discard_vtk_mask() self.viewer.slice_.current_mask.was_edited = True self.viewer.slice_.current_mask.modified(True) Publisher.sendMessage("Reload actual slice") class SelectPartConfig(metaclass=utils.Singleton): def __init__(self): self.mask = None self.con_3d = 6 self.dlg_visible = False self.mask_name = "" class SelectMaskPartsInteractorStyle(DefaultInteractorStyle): def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_SELECT_MASK_PARTS self.viewer = viewer self.orientation = self.viewer.orientation self.picker = vtkWorldPointPicker() self.slice_actor = viewer.slice_data.actor self.slice_data = viewer.slice_data self.config = SelectPartConfig() self.dlg = None # InVesalius uses the following values to mark selected parts in a # mask: # 255 - Threshold # 254 - Manual edition and floodfill # 253 - Watershed self.t0 = 253 self.t1 = 255 self.fill_value = 254 self.AddObserver("LeftButtonPressEvent", self.OnSelect) def SetUp(self): if not self.config.dlg_visible: import invesalius.data.mask as mask default_name = const.MASK_NAME_PATTERN % (mask.Mask.general_index + 2) self.config.mask_name = default_name self.config.dlg_visible = True self.dlg = dialogs.SelectPartsOptionsDialog(self.config) self.dlg.Show() def CleanUp(self): if self.dlg is None: return dialog_return = self.dlg.GetReturnCode() if self.config.dlg_visible: self.config.dlg_visible = False self.dlg.Destroy() self.dlg = None if self.config.mask: if dialog_return == wx.OK: self.config.mask.name = self.config.mask_name self.viewer.slice_._add_mask_into_proj(self.config.mask) self.viewer.slice_.SelectCurrentMask(self.config.mask.index) Publisher.sendMessage( "Change mask selected", index=self.config.mask.index ) del self.viewer.slice_.aux_matrices["SELECT"] self.viewer.slice_.to_show_aux = "" Publisher.sendMessage("Reload actual slice") self.config.mask = None def OnSelect(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return iren = self.viewer.interactor mouse_x, mouse_y = self.GetMousePosition() x, y, z = self.viewer.get_voxel_coord_by_screen_pos( mouse_x, mouse_y, self.picker ) mask = self.viewer.slice_.current_mask.matrix[1:, 1:, 1:] bstruct = np.array( generate_binary_structure(3, CON3D[self.config.con_3d]), dtype="uint8" ) self.viewer.slice_.do_threshold_to_all_slices() if self.config.mask is None: self._create_new_mask() if iren.GetControlKey(): floodfill.floodfill_threshold( self.config.mask.matrix[1:, 1:, 1:], [[x, y, z]], 254, 255, 0, bstruct, self.config.mask.matrix[1:, 1:, 1:], ) else: floodfill.floodfill_threshold( mask, [[x, y, z]], self.t0, self.t1, self.fill_value, bstruct, self.config.mask.matrix[1:, 1:, 1:], ) self.viewer.slice_.aux_matrices["SELECT"] = self.config.mask.matrix[1:, 1:, 1:] self.viewer.slice_.to_show_aux = "SELECT" self.config.mask.was_edited = True Publisher.sendMessage("Reload actual slice") def _create_new_mask(self): mask = self.viewer.slice_.create_new_mask(show=False, add_to_project=False) mask.was_edited = True mask.matrix[0, :, :] = 1 mask.matrix[:, 0, :] = 1 mask.matrix[:, :, 0] = 1 self.config.mask = mask class FFillSegmentationConfig(metaclass=utils.Singleton): def __init__(self): self.dlg_visible = False self.dlg = None self.target = "2D" self.con_2d = 4 self.con_3d = 6 self.t0 = None self.t1 = None self.fill_value = 254 self.method = "dynamic" self.dev_min = 25 self.dev_max = 25 self.use_ww_wl = True self.confid_mult = 2.5 self.confid_iters = 3 class FloodFillSegmentInteractorStyle(DefaultInteractorStyle): def __init__(self, viewer): DefaultInteractorStyle.__init__(self, viewer) self.state_code = const.SLICE_STATE_FFILL_SEGMENTATION self.viewer = viewer self.orientation = self.viewer.orientation self.picker = vtkWorldPointPicker() self.slice_actor = viewer.slice_data.actor self.slice_data = viewer.slice_data self.config = FFillSegmentationConfig() self._progr_title = _("Region growing") self._progr_msg = _("Segmenting ...") self.AddObserver("LeftButtonPressEvent", self.OnFFClick) def SetUp(self): if not self.config.dlg_visible: if self.config.t0 is None: image = self.viewer.slice_.matrix _min, _max = image.min(), image.max() self.config.t0 = int(_min + (3.0 / 4.0) * (_max - _min)) self.config.t1 = int(_max) self.config.dlg_visible = True self.config.dlg = dialogs.FFillSegmentationOptionsDialog(self.config) self.config.dlg.Show() def CleanUp(self): if (self.config.dlg is not None) and (self.config.dlg_visible): self.config.dlg_visible = False self.config.dlg.Destroy() self.config.dlg = None def OnFFClick(self, obj, evt): if self.viewer.slice_.buffer_slices[self.orientation].mask is None: return if self.config.target == "3D": self.do_3d_seg() else: self.do_2d_seg() self.viewer.slice_.buffer_slices["AXIAL"].discard_mask() self.viewer.slice_.buffer_slices["CORONAL"].discard_mask() self.viewer.slice_.buffer_slices["SAGITAL"].discard_mask() self.viewer.slice_.buffer_slices["AXIAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["CORONAL"].discard_vtk_mask() self.viewer.slice_.buffer_slices["SAGITAL"].discard_vtk_mask() self.viewer.slice_.current_mask.was_edited = True self.viewer.slice_.current_mask.modified(self.config.target == "3D") Publisher.sendMessage("Reload actual slice") def do_2d_seg(self): viewer = self.viewer iren = viewer.interactor mouse_x, mouse_y = self.GetMousePosition() x, y = self.viewer.get_slice_pixel_coord_by_screen_pos( mouse_x, mouse_y, self.picker ) mask = self.viewer.slice_.buffer_slices[self.orientation].mask.copy() image = self.viewer.slice_.buffer_slices[self.orientation].image if self.config.method == "confidence": dy, dx = image.shape image = image.reshape((1, dy, dx)) mask = mask.reshape((1, dy, dx)) bstruct = np.array( generate_binary_structure(2, CON2D[self.config.con_2d]), dtype="uint8" ) bstruct = bstruct.reshape((1, 3, 3)) out_mask = self.do_rg_confidence(image, mask, (x, y, 0), bstruct) else: if self.config.method == "threshold": v = image[y, x] t0 = self.config.t0 t1 = self.config.t1 elif self.config.method == "dynamic": if self.config.use_ww_wl: print("Using WW&WL") ww = self.viewer.slice_.window_width wl = self.viewer.slice_.window_level image = get_LUT_value_255(image, ww, wl) v = image[y, x] t0 = v - self.config.dev_min t1 = v + self.config.dev_max if image[y, x] < t0 or image[y, x] > t1: return dy, dx = image.shape image = image.reshape((1, dy, dx)) mask = mask.reshape((1, dy, dx)) out_mask = np.zeros_like(mask) bstruct = np.array( generate_binary_structure(2, CON2D[self.config.con_2d]), dtype="uint8" ) bstruct = bstruct.reshape((1, 3, 3)) floodfill.floodfill_threshold( image, [[x, y, 0]], t0, t1, 1, bstruct, out_mask ) mask[out_mask.astype("bool")] = self.config.fill_value index = self.viewer.slice_.buffer_slices[self.orientation].index b_mask = self.viewer.slice_.buffer_slices[self.orientation].mask vol_mask = self.viewer.slice_.current_mask.matrix[1:, 1:, 1:] if self.orientation == "AXIAL": vol_mask[index, :, :] = mask elif self.orientation == "CORONAL": vol_mask[:, index, :] = mask elif self.orientation == "SAGITAL": vol_mask[:, :, index] = mask self.viewer.slice_.current_mask.save_history( index, self.orientation, mask, b_mask ) def do_3d_seg(self): viewer = self.viewer iren = viewer.interactor mouse_x, mouse_y = self.GetMousePosition() x, y, z = self.viewer.get_voxel_coord_by_screen_pos( mouse_x, mouse_y, self.picker ) mask = self.viewer.slice_.current_mask.matrix[1:, 1:, 1:] image = self.viewer.slice_.matrix if self.config.method != "confidence": if self.config.method == "threshold": v = image[z, y, x] t0 = self.config.t0 t1 = self.config.t1 elif self.config.method == "dynamic": if self.config.use_ww_wl: print("Using WW&WL") ww = self.viewer.slice_.window_width wl = self.viewer.slice_.window_level image = get_LUT_value_255(image, ww, wl) v = image[z, y, x] t0 = v - self.config.dev_min t1 = v + self.config.dev_max if image[z, y, x] < t0 or image[z, y, x] > t1: return bstruct = np.array( generate_binary_structure(3, CON3D[self.config.con_3d]), dtype="uint8" ) self.viewer.slice_.do_threshold_to_all_slices() cp_mask = self.viewer.slice_.current_mask.matrix.copy() if self.config.method == "confidence": with futures.ThreadPoolExecutor(max_workers=1) as executor: future = executor.submit( self.do_rg_confidence, image, mask, (x, y, z), bstruct ) self.config.dlg.panel_ffill_progress.Enable() self.config.dlg.panel_ffill_progress.StartTimer() while not future.done(): self.config.dlg.panel_ffill_progress.Pulse() self.config.dlg.Update() time.sleep(0.1) self.config.dlg.panel_ffill_progress.StopTimer() self.config.dlg.panel_ffill_progress.Disable() out_mask = future.result() else: out_mask = np.zeros_like(mask) with futures.ThreadPoolExecutor(max_workers=1) as executor: future = executor.submit( floodfill.floodfill_threshold, image, [[x, y, z]], t0, t1, 1, bstruct, out_mask, ) self.config.dlg.panel_ffill_progress.Enable() self.config.dlg.panel_ffill_progress.StartTimer() while not future.done(): self.config.dlg.panel_ffill_progress.Pulse() self.config.dlg.Update() time.sleep(0.1) self.config.dlg.panel_ffill_progress.StopTimer() self.config.dlg.panel_ffill_progress.Disable() mask[out_mask.astype("bool")] = self.config.fill_value self.viewer.slice_.current_mask.save_history( 0, "VOLUME", self.viewer.slice_.current_mask.matrix.copy(), cp_mask ) def do_rg_confidence(self, image, mask, p, bstruct): x, y, z = p if self.config.use_ww_wl: ww = self.viewer.slice_.window_width wl = self.viewer.slice_.window_level image = get_LUT_value_255(image, ww, wl) bool_mask = np.zeros_like(mask, dtype="bool") out_mask = np.zeros_like(mask) for k in range(int(z - 1), int(z + 2)): if k < 0 or k >= bool_mask.shape[0]: continue for j in range(int(y - 1), int(y + 2)): if j < 0 or j >= bool_mask.shape[1]: continue for i in range(int(x - 1), int(x + 2)): if i < 0 or i >= bool_mask.shape[2]: continue bool_mask[k, j, i] = True for i in range(self.config.confid_iters): var = np.std(image[bool_mask]) mean = np.mean(image[bool_mask]) t0 = mean - var * self.config.confid_mult t1 = mean + var * self.config.confid_mult floodfill.floodfill_threshold( image, [[x, y, z]], t0, t1, 1, bstruct, out_mask ) bool_mask[out_mask == 1] = True return out_mask class Styles: styles = { const.STATE_DEFAULT: DefaultInteractorStyle, const.SLICE_STATE_CROSS: CrossInteractorStyle, const.STATE_WL: WWWLInteractorStyle, const.STATE_MEASURE_DISTANCE: LinearMeasureInteractorStyle, const.STATE_MEASURE_ANGLE: AngularMeasureInteractorStyle, const.STATE_MEASURE_DENSITY_ELLIPSE: DensityMeasureEllipseStyle, const.STATE_MEASURE_DENSITY_POLYGON: DensityMeasurePolygonStyle, const.STATE_PAN: PanMoveInteractorStyle, const.STATE_SPIN: SpinInteractorStyle, const.STATE_ZOOM: ZoomInteractorStyle, const.STATE_ZOOM_SL: ZoomSLInteractorStyle, const.SLICE_STATE_SCROLL: ChangeSliceInteractorStyle, const.SLICE_STATE_EDITOR: EditorInteractorStyle, const.SLICE_STATE_WATERSHED: WaterShedInteractorStyle, const.SLICE_STATE_REORIENT: ReorientImageInteractorStyle, const.SLICE_STATE_MASK_FFILL: FloodFillMaskInteractorStyle, const.SLICE_STATE_REMOVE_MASK_PARTS: RemoveMaskPartsInteractorStyle, const.SLICE_STATE_SELECT_MASK_PARTS: SelectMaskPartsInteractorStyle, const.SLICE_STATE_FFILL_SEGMENTATION: FloodFillSegmentInteractorStyle, const.SLICE_STATE_CROP_MASK: CropMaskInteractorStyle, const.SLICE_STATE_TRACTS: TractsInteractorStyle, } @classmethod def add_style(cls, style_cls, level=1): if style_cls in cls.styles.values(): for style_id in cls.styles: if cls.styles[style_id] == style_cls: const.SLICE_STYLES.append(style_id) const.STYLE_LEVEL[style_id] = level return style_id new_style_id = max(cls.styles) + 1 cls.styles[new_style_id] = style_cls const.SLICE_STYLES.append(new_style_id) const.STYLE_LEVEL[new_style_id] = level return new_style_id @classmethod def remove_style(cls, style_id): del cls.styles[style_id] @classmethod def get_style(cls, style): return cls.styles[style]
digital
qa_constellation_soft_decoder_cf
#!/usr/bin/env python # # Copyright 2013-2014 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # from math import sqrt from gnuradio import blocks, digital, gr, gr_unittest from numpy import random, vectorize class test_constellation_soft_decoder(gr_unittest.TestCase): def setUp(self): random.seed(0) self.tb = gr.top_block() def tearDown(self): self.tb = None def helper_with_lut(self, prec, src_data, const_gen, const_sd_gen, decimals=5): cnst_pts, code = const_gen() Es = 1.0 lut = digital.soft_dec_table(cnst_pts, code, prec, Es) constel = digital.const_normalization(cnst_pts, "POWER") maxamp = digital.min_max_axes(constel) expected_result = list() for s in src_data: res = digital.calc_soft_dec_from_table(s, lut, prec, maxamp) expected_result += res cnst = digital.constellation_calcdist( cnst_pts, code, 4, 1, digital.constellation.POWER_NORMALIZATION ) cnst.set_soft_dec_lut(lut, int(prec)) cnst.normalize(digital.constellation.POWER_NORMALIZATION) src = blocks.vector_source_c(src_data) op = digital.constellation_soft_decoder_cf(cnst.base()) dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() actual_result = dst.data() # fetch the contents of the sink # print "actual result", actual_result # print "expected result", expected_result self.assertFloatTuplesAlmostEqual(expected_result, actual_result, decimals) def helper_no_lut(self, prec, src_data, const_gen, const_sd_gen): cnst_pts, code = const_gen() cnst = digital.constellation_calcdist(cnst_pts, code, 2, 1) expected_result = list() for s in src_data: res = digital.calc_soft_dec(s, cnst.points(), code) expected_result += res src = blocks.vector_source_c(src_data) op = digital.constellation_soft_decoder_cf(cnst.base()) dst = blocks.vector_sink_f() self.tb.connect(src, op) self.tb.connect(op, dst) self.tb.run() actual_result = dst.data() # fetch the contents of the sink # print "actual result", actual_result # print "expected result", expected_result # Double vs. float precision issues between Python and C++, so # use only 4 decimals in comparisons. self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 4) def test_constellation_soft_decoder_cf_bpsk_3(self): prec = 3 src_data = ( -1.0 - 1.0j, 1.0 - 1.0j, -1.0 + 1.0j, 1.0 + 1.0j, -2.0 - 2.0j, 2.0 - 2.0j, -2.0 + 2.0j, 2.0 + 2.0j, -0.2 - 0.2j, 0.2 - 0.2j, -0.2 + 0.2j, 0.2 + 0.2j, 0.3 + 0.4j, 0.1 - 1.2j, -0.8 - 0.1j, -0.4 + 0.8j, 0.8 + 1.0j, -0.5 + 0.1j, 0.1 + 1.2j, -1.7 - 0.9j, ) self.helper_with_lut(prec, src_data, digital.psk_2_0x0, digital.sd_psk_2_0x0) def test_constellation_soft_decoder_cf_bpsk_8(self): prec = 8 src_data = ( -1.0 - 1.0j, 1.0 - 1.0j, -1.0 + 1.0j, 1.0 + 1.0j, -2.0 - 2.0j, 2.0 - 2.0j, -2.0 + 2.0j, 2.0 + 2.0j, -0.2 - 0.2j, 0.2 - 0.2j, -0.2 + 0.2j, 0.2 + 0.2j, 0.3 + 0.4j, 0.1 - 1.2j, -0.8 - 0.1j, -0.4 + 0.8j, 0.8 + 1.0j, -0.5 + 0.1j, 0.1 + 1.2j, -1.7 - 0.9j, ) self.helper_with_lut(prec, src_data, digital.psk_2_0x0, digital.sd_psk_2_0x0) def test_constellation_soft_decoder_cf_bpsk_8_rand(self): prec = 8 src_data = vectorize(complex)(2 * random.randn(100), 2 * random.randn(100)) self.helper_with_lut(prec, src_data, digital.psk_2_0x0, digital.sd_psk_2_0x0) def test_constellation_soft_decoder_cf_bpsk_8_rand2(self): prec = 8 src_data = vectorize(complex)(2 * random.randn(100), 2 * random.randn(100)) self.helper_no_lut(prec, src_data, digital.psk_2_0x0, digital.sd_psk_2_0x0) def test_constellation_soft_decoder_cf_qpsk_3(self): prec = 3 src_data = ( -1.0 - 1.0j, 1.0 - 1.0j, -1.0 + 1.0j, 1.0 + 1.0j, -2.0 - 2.0j, 2.0 - 2.0j, -2.0 + 2.0j, 2.0 + 2.0j, -0.2 - 0.2j, 0.2 - 0.2j, -0.2 + 0.2j, 0.2 + 0.2j, 0.3 + 0.4j, 0.1 - 1.2j, -0.8 - 0.1j, -0.4 + 0.8j, 0.8 + 1.0j, -0.5 + 0.1j, 0.1 + 1.2j, -1.7 - 0.9j, ) self.helper_with_lut( prec, src_data, digital.psk_4_0x0_0_1, digital.sd_psk_4_0x0_0_1 ) def test_constellation_soft_decoder_cf_qpsk_8(self): prec = 8 src_data = ( -1.0 - 1.0j, 1.0 - 1.0j, -1.0 + 1.0j, 1.0 + 1.0j, -2.0 - 2.0j, 2.0 - 2.0j, -2.0 + 2.0j, 2.0 + 2.0j, -0.2 - 0.2j, 0.2 - 0.2j, -0.2 + 0.2j, 0.2 + 0.2j, 0.3 + 0.4j, 0.1 - 1.2j, -0.8 - 0.1j, -0.4 + 0.8j, 0.8 + 1.0j, -0.5 + 0.1j, 0.1 + 1.2j, -1.7 - 0.9j, ) self.helper_with_lut( prec, src_data, digital.psk_4_0x0_0_1, digital.sd_psk_4_0x0_0_1 ) def test_constellation_soft_decoder_cf_qpsk_8_rand(self): prec = 8 src_data = vectorize(complex)(2 * random.randn(100), 2 * random.randn(100)) self.helper_with_lut( prec, src_data, digital.psk_4_0x0_0_1, digital.sd_psk_4_0x0_0_1, 3 ) def test_constellation_soft_decoder_cf_qpsk_8_rand2(self): prec = 8 src_data = vectorize(complex)(2 * random.randn(100), 2 * random.randn(100)) self.helper_no_lut( prec, src_data, digital.psk_4_0x0_0_1, digital.sd_psk_4_0x0_0_1 ) def test_constellation_soft_decoder_cf_qam16_3(self): prec = 3 src_data = ( -1.0 - 1.0j, 1.0 - 1.0j, -1.0 + 1.0j, 1.0 + 1.0j, -2.0 - 2.0j, 2.0 - 2.0j, -2.0 + 2.0j, 2.0 + 2.0j, -0.2 - 0.2j, 0.2 - 0.2j, -0.2 + 0.2j, 0.2 + 0.2j, 0.3 + 0.4j, 0.1 - 1.2j, -0.8 - 0.1j, -0.4 + 0.8j, 0.8 + 1.0j, -0.5 + 0.1j, 0.1 + 1.2j, -1.7 - 0.9j, ) self.helper_with_lut( prec, src_data, digital.qam_16_0x0_0_1_2_3, digital.sd_qam_16_0x0_0_1_2_3 ) def test_constellation_soft_decoder_cf_qam16_8(self): prec = 8 src_data = ( -1.0 - 1.0j, 1.0 - 1.0j, -1.0 + 1.0j, 1.0 + 1.0j, -2.0 - 2.0j, 2.0 - 2.0j, -2.0 + 2.0j, 2.0 + 2.0j, -0.2 - 0.2j, 0.2 - 0.2j, -0.2 + 0.2j, 0.2 + 0.2j, 0.3 + 0.4j, 0.1 - 1.2j, -0.8 - 0.1j, -0.4 + 0.8j, 0.8 + 1.0j, -0.5 + 0.1j, 0.1 + 1.2j, -1.7 - 0.9j, ) self.helper_with_lut( prec, src_data, digital.qam_16_0x0_0_1_2_3, digital.sd_qam_16_0x0_0_1_2_3 ) def test_constellation_soft_decoder_cf_qam16_8_rand(self): prec = 8 src_data = vectorize(complex)(2 * random.randn(100), 2 * random.randn(100)) self.helper_with_lut( prec, src_data, digital.qam_16_0x0_0_1_2_3, digital.sd_qam_16_0x0_0_1_2_3, 3 ) def test_constellation_soft_decoder_cf_qam16_8_rand2(self): prec = 8 # src_data = vectorize(complex)(2*random.randn(100), 2*random.randn(100)) src_data = vectorize(complex)(2 * random.randn(2), 2 * random.randn(2)) self.helper_no_lut( prec, src_data, digital.qam_16_0x0_0_1_2_3, digital.sd_qam_16_0x0_0_1_2_3 ) if __name__ == "__main__": gr_unittest.run(test_constellation_soft_decoder)
previewdevice
previewprefs
# Copyright (C) 2012 Dustin Spicuzza # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # # The developers of the Exaile media player hereby grant permission # for non-GPL compatible GStreamer and Exaile plugins to be used and # distributed together with GStreamer and Exaile. This permission is # above and beyond the permissions granted by the GPL license by which # Exaile is covered. If you modify this code, you may extend this # exception to your version of the code, but you are not obligated to # do so. If you do not wish to do so, delete this exception statement # from your version. import os from xl.nls import gettext as _ from xlgui.preferences import playback name = _("Preview Device") basedir = os.path.dirname(os.path.realpath(__file__)) ui = os.path.join(basedir, "previewprefs.ui") icon = "media-playback-start" def __autoconfig(): """ If the user hasn't used our plugin before, then try to autoconfig their audio settings to use a different audio device if possible.. TODO: It would be cool if we could notify the user that a new device was plugged in... """ from xl import settings if settings.get_option("preview_device/audiosink", None) is not None: return sink = settings.get_option("player/audiosink", None) if sink is None: return settings.set_option("preview_device/audiosink", sink) main_device = settings.get_option("player/audiosink_device", None) if main_device is None: return # TODO: If we ever add another engine, need to make sure that # gstreamer-specific stuff doesn't accidentally get loaded from xl.player.gst.sink import get_devices # pick the first one that isn't the main device and isn't 'Auto' # -> if the main device is '', then it's auto. So... we actually # iterate backwards, assuming that the ordering matters for _unused, device_id, _unused in reversed(list(get_devices())): if device_id != main_device and name != "auto": settings.set_option("preview_device/audiosink_device", device_id) break __autoconfig() class PreviewDeviceEnginePreference(playback.EnginePreference): name = "preview_device/engine" class PreviewDeviceAudioSinkPreference(playback.AudioSinkPreference): name = "preview_device/audiosink" class PreviewDeviceCustomAudioSinkPreference(playback.CustomAudioSinkPreference): name = "preview_device/custom_sink_pipe" condition_preference_name = "preview_device/audiosink" class PreviewDeviceSelectDeviceForSinkPreference( playback.SelectDeviceForSinkPreference ): name = "preview_device/audiosink_device" condition_preference_name = "preview_device/audiosink" class PreviewDeviceUserFadeTogglePreference(playback.UserFadeTogglePreference): name = "preview_device/user_fade_enabled" condition_preference_name = "preview_device/engine" class PreviewDeviceUserFadeDurationPreference(playback.UserFadeDurationPreference): name = "preview_device/user_fade" condition_preference_name = "preview_device/engine" class PreviewDeviceCrossFadingPreference(playback.CrossfadingPreference): default = False name = "preview_device/crossfading" condition_preference_name = "preview_device/engine" class PreviewDeviceCrossfadeDurationPreference(playback.CrossfadeDurationPreference): default = 1000 name = "preview_device/crossfade_duration" condition_preference_name = "preview_device/engine"
SimpleService
setup
""" Script for building the example. Usage: python setup.py py2app """ from distutils.core import setup import py2app plist = dict( CFBundleIdentifier="net.sf.pyobjc.PyObjCSimpleService", CFBundleName="PyObjCSimpleService", LSBackgroundOnly=1, NSServices=[ dict( NSKeyEquivalent=dict( default="F", ), NSMenuItem=dict( default="Open File", ), NSMessage="doOpenFileService", NSPortName="PyObjCSimpleService", NSSendTypes=[ "NSStringPboardType", ], ), dict( NSMenuItem=dict( default="Capitalize String", ), NSMessage="doCapitalizeService", NSPortName="PyObjCSimpleService", NSReturnTypes=[ "NSStringPboardType", ], NSSendTypes=[ "NSStringPboardType", ], ), ], ) setup( name="Simple Service", app=["SimpleService_main.py"], options=dict(py2app=dict(plist=plist)), )
WizardShaft
Shaft
# -*- coding: utf-8 -*- # /****************************************************************************** # * Copyright (c) 2012 Jan Rheinländer <jrheinlaender@users.sourceforge.net> * # * * # * This file is part of the FreeCAD CAx development system. * # * * # * This library is free software; you can redistribute it and/or * # * modify it under the terms of the GNU Library General Public * # * License as published by the Free Software Foundation; either * # * version 2 of the License, or (at your option) any later version. * # * * # * This library is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU Library General Public License for more details. * # * * # * You should have received a copy of the GNU Library General Public * # * License along with this library; see the file COPYING.LIB. If not, * # * write to the Free Software Foundation, Inc., 59 Temple Place, * # * Suite 330, Boston, MA 02111-1307, USA * # * * # ******************************************************************************/ import math import FreeCAD import FreeCADGui from .SegmentFunction import ( IntervalFunction, SegmentFunction, StressFunction, TranslationFunction, ) from .ShaftDiagram import Diagram from .ShaftFeature import ShaftFeature class ShaftSegment: def __init__(self, l, d, di): self.length = l self.diameter = d self.innerdiameter = di self.constraintType = "None" self.constraint = None class Shaft: "The axis of the shaft is always assumed to correspond to the X-axis" # Names (note Qy corresponds with Mz, and Qz with My) Fstr = ["Nx", "Qy", "Qz"] # Forces Mstr = ["Mx", "Mz", "My"] # Moments wstr = ["", "wy", "wz"] # Translations sigmaNstr = ["sigmax", "sigmay", "sigmaz"] # Normal/shear stresses sigmaBstr = ["taut", "sigmabz", "sigmaby"] # Torsion/bending stresses # For diagram labeling Qstrings = ( ("Normal force [x]", "x", "mm", "N_x", "N"), ("Shear force [y]", "x", "mm", "Q_y", "N"), ("Shear force [z]", "x", "mm", "Q_z", "N"), ) Mstrings = ( ("Torque [x]", "x", "mm", "M_t", "Nm"), ("Bending moment [z]", "x", "mm", "M_{b,z}", "Nm"), ("Bending moment [y]", "x", "mm", "M_{b,y}", "Nm"), ) wstrings = ( ("", "", "", "", ""), ("Translation [y]", "x", "mm", "w_y", "mm"), ("Translation [z]", "x", "mm", "w_z", "mm"), ) sigmaNstrings = ( ("Normal stress [x]", "x", "mm", "\\sigma_x", "N/mm²"), ("Shear stress [y]", "x", "mm", "\\sigma_y", "N/mm²"), ("Shear stress [z]", "x", "mm", "\\sigma_z", "N/mm²"), ) sigmaBstrings = ( ("Torque stress [x]", "x", "mm", "\\tau_t", "N/mm²"), ("Bending stress [z]", "x", "mm", "\\sigma_{b,z}", "N/mm²"), ("Bending stress [y]", "x", "mm", "\\sigma_{b,y}", "N/mm²"), ) def __init__(self, parent): self.parent = parent self.doc = parent.doc self.feature = ShaftFeature(self.doc) # List of shaft segments (each segment has a different diameter) self.segments = [] # The diagrams self.diagrams = {} # map of function name against Diagram object # Calculation of shaft self.F = [None, None, None] # force in direction of [x,y,z]-axis self.M = [None, None, None] # bending moment around [x,z,y]-axis self.w = [None, None, None] # Shaft translation due to bending self.sigmaN = [ None, None, None, ] # normal stress in direction of x-axis, shear stress in direction of [y,z]-axis self.sigmaB = [ None, None, None, ] # # torque stress around x-axis, maximum bending stress in direction of [y,z]-axis def getLengthTo(self, index): "Get the total length of all segments up to the given one" result = 0.0 for i in range(index): result += self.segments[i].length return result def addSegment(self, l, d, di): self.segments.append(ShaftSegment(l, d, di)) self.feature.addSegment(l, d, di) # We don't call equilibrium() here because the new segment has no constraints defined yet # Fix face reference of fixed segment if it is the last one for i in range(1, len(self.segments)): if self.segments[i].constraintType != "Fixed": continue if i == len(self.segments) - 1: self.segments[index].constraint.References = [ (self.feature.feature, "Face%u" % (2 * (index + 1) + 1)) ] else: # Remove reference since it is now in the middle of the shaft (which is not allowed) self.segments[index].constraint.References = [(None, "")] def updateSegment(self, index, length=None, diameter=None, innerdiameter=None): oldLength = self.segments[index].length if length is not None: self.segments[index].length = length if diameter is not None: self.segments[index].diameter = diameter if innerdiameter is not None: self.segments[index].innerdiameter = innerdiameter self.feature.updateSegment( index, oldLength, self.segments[index].length, self.segments[index].diameter, self.segments[index].innerdiameter, ) self.equilibrium() self.updateDiagrams() def updateConstraint(self, index, constraintType): if constraintType is not None: # Did the constraint type change? if (self.segments[index].constraintType != "None") and ( self.segments[index].constraintType != constraintType ): self.doc.removeObject(self.segments[index].constraint.Name) self.segments[index].constraint = None self.segments[index].constraintType = constraintType # Create constraint if it does not exist yet or has changed if self.segments[index].constraint is None: if constraintType == "Force": # TODO: Create a reference point and put the force onto it constraint = self.doc.addObject( "Fem::ConstraintForce", "ShaftConstraintForce" ) constraint.Force = 1000.0 self.segments[index].constraint = constraint elif constraintType == "Fixed": # TODO: Use robust reference as soon as it is available for the face constraint = self.doc.addObject( "Fem::ConstraintFixed", "ShaftConstraintFixed" ) if index == 0: constraint.References = [(self.feature.feature, "Face1")] elif index == len(self.segments) - 1: constraint.References = [ (self.feature.feature, "Face%u" % (2 * (index + 1) + 1)) ] self.segments[index].constraint = constraint elif constraintType == "Bearing": # TODO: Use robust reference as soon as it is available for the cylindrical face reference constraint = self.doc.addObject( "Fem::ConstraintBearing", "ShaftConstraintBearing" ) constraint.References = [ (self.feature.feature, "Face%u" % (2 * (index + 1))) ] constraint.AxialFree = True self.segments[index].constraint = constraint elif constraintType == "Pulley": constraint = self.doc.addObject( "Fem::ConstraintPulley", "ShaftConstraintPulley" ) constraint.References = [ (self.feature.feature, "Face%u" % (2 * (index + 1))) ] self.segments[index].constraint = constraint elif constraintType == "Gear": constraint = self.doc.addObject( "Fem::ConstraintGear", "ShaftConstraintGear" ) constraint.References = [ (self.feature.feature, "Face%u" % (2 * (index + 1))) ] self.segments[index].constraint = constraint self.equilibrium() self.updateDiagrams() def editConstraint(self, index): if self.segments[index].constraint is not None: FreeCADGui.activeDocument().setEdit(self.segments[index].constraint.Name) def getConstraint(self, index): return self.segments[index].constraint def updateEdge(self, column, start): App.Console.PrintMessage( "Not implemented yet - waiting for robust references..." ) return """ if self.sketchClosed is not True: return # Create a chamfer or fillet at the start or end edge of the segment if start is True: row = rowStartEdgeType idx = 0 else: row = rowEndEdgeType idx = 1 edgeType = self.tableWidget.item(row, column).text()[0].upper() if not ((edgeType == "C") or (edgeType == "F")): return # neither chamfer nor fillet defined if edgeType == "C": objName = self.doc.addObject("PartDesign::Chamfer","ChamferShaft%u" % (column * 2 + idx)) else: objName = self.doc.addObject("PartDesign::Fillet","FilletShaft%u" % (column * 2 + idx)) if objName == "": return edgeName = "Edge%u" % self.getEdgeIndex(column, idx, edgeType) self.doc.getObject(objName).Base = (self.doc.getObject("RevolutionShaft"),"[%s]" % edgeName) # etc. etc. """ def getEdgeIndex(self, column, startIdx): # FIXME: This is impossible without robust references anchored in the sketch!!! return def updateDiagrams(self): for ax in range(3): if self.F[ax] is not None: if self.F[ax].name in self.diagrams: self.diagrams[self.F[ax].name].update( self.F[ax], self.getLengthTo(len(self.segments)) / 1000.0 ) if self.M[ax] is not None: if self.M[ax].name in self.diagrams: self.diagrams[self.M[ax].name].update( self.M[ax], self.getLengthTo(len(self.segments)) / 1000.0 ) if self.w[ax] is not None: if self.w[ax].name in self.diagrams: self.diagrams[self.w[ax].name].update( self.w[ax], self.getLengthTo(len(self.segments)) / 1000.0 ) if self.sigmaN[ax] is not None: if self.sigmaN[ax].name in self.diagrams: self.diagrams[self.sigmaN[ax].name].update( self.sigmaN[ax], self.getLengthTo(len(self.segments)) / 1000.0 ) if self.sigmaB[ax] is not None: if self.sigmaB[ax].name in self.diagrams: self.diagrams[self.sigmaB[ax].name].update( self.sigmaB[ax], self.getLengthTo(len(self.segments)) / 1000.0 ) def showDiagram(self, which): if which in self.Fstr: ax = self.Fstr.index(which) text = self.Qstrings[ax] if self.F[ax] is None: # No data return if self.F[ax].name in self.diagrams: # Diagram is already open, close it again self.diagrams[self.F[ax].name].close() del self.diagrams[self.F[ax].name] return self.diagrams[self.F[ax].name] = Diagram() self.diagrams[self.F[ax].name].create( text[0], self.F[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1.0, 10, ) elif which in self.Mstr: ax = self.Mstr.index(which) text = self.Mstrings[ax] if self.M[ax] is None: # No data return if self.M[ax].name in self.diagrams: # Diagram is already open, close it again self.diagrams[self.M[ax].name].close() del self.diagrams[self.M[ax].name] return self.diagrams[self.M[ax].name] = Diagram() self.diagrams[self.M[ax].name].create( text[0], self.M[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1.0, 20, ) elif which in self.wstr: ax = self.wstr.index(which) text = self.wstrings[ax] if self.w[ax] is None: # No data return if self.w[ax].name in self.diagrams: # Diagram is already open, close it again self.diagrams[self.w[ax].name].close() del self.diagrams[self.w[ax].name] return self.diagrams[self.w[ax].name] = Diagram() self.diagrams[self.w[ax].name].create( text[0], self.w[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1000.0, 30, ) elif which in self.sigmaNstr: ax = self.sigmaNstr.index(which) text = self.sigmaNstrings[ax] if self.sigmaN[ax] is None: # No data return if self.sigmaN[ax].name in self.diagrams: # Diagram is already open, close it again self.diagrams[self.sigmaN[ax].name].close() del self.diagrams[self.sigmaN[ax].name] return self.diagrams[self.sigmaN[ax].name] = Diagram() self.diagrams[self.sigmaN[ax].name].create( text[0], self.sigmaN[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1.0e-6, 10, ) elif which in self.sigmaBstr: ax = self.sigmaBstr.index(which) text = self.sigmaBstrings[ax] if self.sigmaB[ax] is None: # No data return if self.sigmaB[ax].name in self.diagrams: # Diagram is already open, close it again self.diagrams[self.sigmaB[ax].name].close() del self.diagrams[self.sigmaB[ax].name] return self.diagrams[self.sigmaB[ax].name] = Diagram() self.diagrams[self.sigmaB[ax].name].create( text[0], self.sigmaB[ax], self.getLengthTo(len(self.segments)) / 1000.0, text[1], text[2], 1000.0, text[3], text[4], 1.0e-6, 20, ) def addTo(self, dict, location, value): if location not in dict: dict[location] = value else: dict[location] += value def equilibrium(self): # Build equilibrium equations try: import numpy as np except ImportError: FreeCAD.Console.PrintMessage("numpy is not installed on your system\n") raise ImportError("numpy not installed") # Initialization of structures. All three axes are handled separately so everything is 3-fold # dictionaries of (location : outer force/moment) with reverse sign, which means that the segment functions for the section force and section moment # created from them will have signs as by the convention in # http://www.umwelt-campus.de/ucb/fileadmin/users/90_t.preussler/dokumente/Skripte/TEMECH/TMI/Ebene_Balkenstatik.pdf (page 10) # (see also example on page 19) forces = [{0.0: 0.0}, {0.0: 0.0}, {0.0: 0.0}] moments = [{0.0: 0.0}, {0.0: 0.0}, {0.0: 0.0}] # Boundary conditions for shaft bending line tangents = [[], [], []] # Tangents to shaft bending line translations = [[], [], []] # Shaft displacement # Variable names, e.g. Fx, Mz. Because the system must be exactly determined, not more than two independent variables for each # force/moment per axis are possible (if there are more no solution is calculated) variableNames = [[""], [""], [""]] # # dictionary of (variableName : location) giving the x-coordinate at which the force/moment represented by the variable acts on the shaft locations = {} # Coefficients of the equilibrium equations in the form a = b * F1 + c * F2 and d = e * M1 + f * M2 # LHS (variables a1, a2, a3, d3) initialized to zero coefficientsF = [[0], [0], [0]] coefficientsM = [[0], [0], [0]] for i in range(len(self.segments)): cType = self.segments[i].constraintType constraint = self.segments[i].constraint if cType == "Fixed": # Fixed segment if i == 0: # At beginning of shaft location = 0 elif i == len(self.segments) - 1: # At end of shaft location = ( self.getLengthTo(len(self.segments)) / 1000.0 ) # convert to meters else: # TODO: Better error message FreeCAD.Console.PrintMessage( "Fixed constraint must be at beginning or end of shaft\n" ) return for ax in range(3): # Create a new reaction force variableNames[ax].append("%s%u" % (self.Fstr[ax], i)) coefficientsF[ax].append(1) # Register location of reaction force locations["%s%u" % (self.Fstr[ax], i)] = location # Boundary conditions for the translations tangents[ax].append((location, 0.0)) translations[ax].append((location, 0.0)) coefficientsM[0].append( 0 ) # Reaction force contributes no moment around x axis coefficientsM[1].append( location ) # Reaction force contributes a positive moment around z axis coefficientsM[2].append( -location ) # Reaction force contributes a negative moment around y axis for ax in range(3): # Create a new reaction moment variableNames[ax].append("%s%u" % (self.Mstr[ax], i)) coefficientsF[ax].append(0) coefficientsM[ax].append(1) locations["%s%u" % (self.Mstr[ax], i)] = location elif cType == "Force": # Static force (currently force on midpoint of segment only) force = constraint.DirectionVector.multiply(constraint.Force) # TODO: Extract value of the location from geometry location = ( self.getLengthTo(i) + self.segments[i].length / 2.0 ) / 1000.0 # The force itself for ax in range(3): if abs(force[ax]) > 0.0: coefficientsF[ax][0] = ( coefficientsF[ax][0] - force[ax] ) # neg. because this coefficient is on the LHS of the equilibrium equation self.addTo( forces[ax], location, -force[ax] ) # neg. to fulfill the convention mentioned above # Moments created by the force (by definition no moment is created by the force in x-direction) if abs(force[1]) > 0.0: coefficientsM[1][0] = ( coefficientsM[1][0] - force[1] * location ) # moment around z-axis self.addTo(moments[1], location, 0) if abs(force[2]) > 0.0: coefficientsM[2][0] = ( coefficientsM[2][0] + force[2] * location ) # moment around y-axis self.addTo(moments[2], location, 0) # No outer moment acts here! elif cType == "Bearing": location = ( constraint.BasePoint.x / 1000.0 ) # TODO: This assumes that the shaft feature starts with the first segment at (0,0,0) and its axis corresponds to the x-axis # Bearing reaction forces. TODO: the bearing is assumed to not induce any reaction moments start = 0 if constraint.AxialFree == False else 1 for ax in range(start, 3): variableNames[ax].append("%s%u" % (self.Fstr[ax], i)) coefficientsF[ax].append(1) locations["%s%u" % (self.Fstr[ax], i)] = location # Boundary condition translations[ax].append((location, 0.0)) if constraint.AxialFree == False: coefficientsM[0].append( 0 ) # Reaction force contributes no moment around x axis coefficientsM[1].append( location ) # Reaction force contributes a positive moment around z axis coefficientsM[2].append( -location ) # Reaction force contributes a negative moment around y axis elif cType == "Gear": force = constraint.DirectionVector.multiply(constraint.Force) location = constraint.BasePoint.x / 1000.0 lever = [ 0, constraint.Diameter / 2.0 / 1000.0 * math.sin(constraint.ForceAngle / 180.0 * math.pi), constraint.Diameter / 2.0 / 1000.0 * math.cos(constraint.ForceAngle / 180.0 * math.pi), ] # Effect of the gear force for ax in range(3): if abs(force[ax]) > 0.0: # Effect of the force coefficientsF[ax][0] = coefficientsF[ax][0] - force[ax] self.addTo(forces[ax], location, -force[ax]) # Moments created by the force (by definition no moment is created by the force in x-direction) if abs(force[1]) > 0.0: coefficientsM[1][0] = ( coefficientsM[1][0] - force[1] * location ) # moment around z-axis self.addTo(moments[1], location, 0) if abs(force[2]) > 0.0: coefficientsM[2][0] = ( coefficientsM[2][0] + force[2] * location ) # moment around y-axis self.addTo(moments[2], location, 0) # No outer moment acts here! # Moments created by the force and lever if abs(force[0]) > 0.0: momenty = force[0] * lever[2] momentz = force[0] * lever[1] coefficientsM[1][0] = ( coefficientsM[1][0] + momentz ) # moment around z-axis self.addTo(moments[1], location, momentz) coefficientsM[2][0] = ( coefficientsM[2][0] - momenty ) # moment around y-axis self.addTo(moments[2], location, -momenty) if abs(force[1]) > 0.0: moment = force[1] * lever[2] coefficientsM[0][0] = coefficientsM[0][0] + moment self.addTo(moments[0], location, moment) if abs(force[2]) > 0.0: moment = force[2] * lever[1] coefficientsM[0][0] = coefficientsM[0][0] - moment self.addTo(moments[0], location, -moment) elif cType == "Pulley": forceAngle1 = ( (constraint.ForceAngle + constraint.BeltAngle + 90.0) / 180.0 * math.pi ) forceAngle2 = ( (constraint.ForceAngle - constraint.BeltAngle + 90.0) / 180.0 * math.pi ) # FreeCAD.Console.PrintMessage("BeltForce1: %f, BeltForce2: %f\n" % (constraint.BeltForce1, constraint.BeltForce2)) # FreeCAD.Console.PrintMessage("Angle1: %f, Angle2: %f\n" % (forceAngle1, forceAngle2)) force = [ 0, -constraint.BeltForce1 * math.sin(forceAngle1) - constraint.BeltForce2 * math.sin(forceAngle2), constraint.BeltForce1 * math.cos(forceAngle1) + constraint.BeltForce2 * math.cos(forceAngle2), ] location = constraint.BasePoint.x / 1000.0 # Effect of the pulley forces for ax in range(3): if abs(force[ax]) > 0.0: # Effect of the force coefficientsF[ax][0] = coefficientsF[ax][0] - force[ax] self.addTo(forces[ax], location, -force[ax]) # Moments created by the force (by definition no moment is created by the force in x-direction) if abs(force[1]) > 0.0: coefficientsM[1][0] = ( coefficientsM[1][0] - force[1] * location ) # moment around z-axis self.addTo(moments[1], location, 0) if abs(force[2]) > 0.0: coefficientsM[2][0] = ( coefficientsM[2][0] + force[2] * location ) # moment around y-axis self.addTo(moments[2], location, 0) # No outer moment acts here! # Torque moment = constraint.Force * (1 if constraint.IsDriven is True else -1) coefficientsM[0][0] = coefficientsM[0][0] + moment self.addTo(moments[0], location, moment) areas = [None, None, None] areamoments = [None, None, None] bendingmoments = [None, None, None] torquemoments = [None, None, None] for ax in range(3): FreeCAD.Console.PrintMessage("Axis: %u\n" % ax) self.printEquilibrium(variableNames[ax], coefficientsF[ax]) self.printEquilibrium(variableNames[ax], coefficientsM[ax]) if len(coefficientsF[ax]) <= 1: # Note: coefficientsF and coefficientsM always have the same length FreeCAD.Console.PrintMessage( "Matrix is singular, no solution possible\n" ) self.parent.updateButtons(ax, False) continue # Handle special cases. Note that the code above should ensure that coefficientsF and coefficientsM always have same length solution = [None, None] if len(coefficientsF[ax]) == 2: if coefficientsF[ax][1] != 0.0 and coefficientsF[ax][0] != 0.0: solution[0] = coefficientsF[ax][0] / coefficientsF[ax][1] if coefficientsM[ax][1] != 0.0 and coefficientsM[ax][0] != 0.0: solution[1] = coefficientsM[ax][0] / coefficientsM[ax][1] if abs(solution[0] - solution[1]) < 1e9: FreeCAD.Console.PrintMessage( "System is statically undetermined. No solution possible.\n" ) self.parent.updateButtons(ax, False) continue else: # Build matrix and vector for linear algebra solving algorithm # TODO: This could easily be done manually... there are only 2 variables and 6 coefficients A = np.array([coefficientsF[ax][1:], coefficientsM[ax][1:]]) b = np.array([coefficientsF[ax][0], coefficientsM[ax][0]]) try: solution = np.linalg.solve(A, b) # A * solution = b except np.linalg.linalg.LinAlgError as e: FreeCAD.Console.PrintMessage(e.message) FreeCAD.Console.PrintMessage(". No solution possible.\n") self.parent.updateButtons(ax, False) continue # Complete dictionary of forces and moments with the two reaction forces that were calculated for i in range(2): if solution[i] is None: continue FreeCAD.Console.PrintMessage( "Reaction force/moment: %s = %f\n" % (variableNames[ax][i + 1], solution[i]) ) if variableNames[ax][i + 1][0] == "M": moments[ax][locations[variableNames[ax][i + 1]]] = -solution[i] else: forces[ax][locations[variableNames[ax][i + 1]]] = -solution[i] FreeCAD.Console.PrintMessage(forces[ax]) FreeCAD.Console.PrintMessage("\n") FreeCAD.Console.PrintMessage(moments[ax]) FreeCAD.Console.PrintMessage("\n") # Forces self.F[ax] = SegmentFunction(self.Fstr[ax]) self.F[ax].buildFromDict("x", forces[ax]) self.parent.updateButton(1, ax, not self.F[ax].isZero()) self.F[ax].output() # Moments if ax == 0: self.M[0] = SegmentFunction(self.Mstr[0]) self.M[0].buildFromDict("x", moments[0]) elif ax == 1: self.M[1] = self.F[1].integrated().negate() self.M[1].name = self.Mstr[1] self.M[1].addSegments(moments[1]) # takes care of boundary conditions elif ax == 2: self.M[2] = self.F[2].integrated() self.M[2].name = self.Mstr[2] self.M[2].addSegments(moments[2]) # takes care of boundary conditions self.parent.updateButton(2, ax, not self.M[ax].isZero()) self.M[ax].output() # Areas and area moments location = 0.0 areas[ax] = IntervalFunction() # A [m²] areamoments[ax] = IntervalFunction() # I [m⁴] bendingmoments[ax] = IntervalFunction() # W_b [m³] torquemoments[ax] = IntervalFunction() # W_t [m³] for i in range(len(self.segments)): od = self.segments[i].diameter / 1000.0 id = self.segments[i].innerdiameter / 1000.0 length = self.segments[i].length / 1000.0 areas[ax].addInterval( location, length, math.pi / 4.0 * (math.pow(od, 2.0) - math.pow(id, 2.0)), ) areamoment = math.pi / 64.0 * (math.pow(od, 4.0) - math.pow(id, 4.0)) areamoments[ax].addInterval(location, length, areamoment) bendingmoments[ax].addInterval( location, length, areamoment / (od / 2.0) ) torquemoments[ax].addInterval( location, length, 2 * (areamoment / (od / 2.0)) ) location += length # Bending line if ax > 0: if len(tangents[ax]) + len(translations[ax]) == 2: # TODO: Get Young's module from material type instead of using 210000 N/mm² = 2.1E12 N/m² self.w[ax] = TranslationFunction( self.M[ax].negated(), 2.1e12, areamoments[ax], tangents[ax], translations[ax], ) self.w[ax].name = self.wstr[ax] self.parent.updateButton(3, ax, not self.w[ax].isZero()) else: self.parent.updateButton(3, ax, False) # Normal/shear stresses and torque/bending stresses self.sigmaN[ax] = StressFunction(self.F[ax], areas[ax]) self.sigmaN[ax].name = self.sigmaNstr[ax] self.parent.updateButton(4, ax, not self.sigmaN[ax].isZero()) if ax == 0: self.sigmaB[ax] = StressFunction(self.M[ax], torquemoments[ax]) else: self.sigmaB[ax] = StressFunction(self.M[ax], bendingmoments[ax]) self.sigmaB[ax].name = self.sigmaBstr[ax] self.parent.updateButton(5, ax, not self.sigmaB[ax].isZero()) def printEquilibrium(self, var, coeff): # Auxiliary method for debugging purposes for i in range(len(var)): if i == 0: FreeCAD.Console.PrintMessage("%f = " % coeff[i]) else: FreeCAD.Console.PrintMessage("%f * %s" % (coeff[i], var[i])) if (i < len(var) - 1) and (i != 0): FreeCAD.Console.PrintMessage(" + ") FreeCAD.Console.PrintMessage("\n")
Part
JoinFeatures
# *************************************************************************** # * Copyright (c) 2016 Victor Titov (DeepSOIC) <vv.titov@gmail.com> * # * * # * This program is free software; you can redistribute it and/or modify * # * it under the terms of the GNU Lesser General Public License (LGPL) * # * as published by the Free Software Foundation; either version 2 of * # * the License, or (at your option) any later version. * # * for detail see the LICENCE text file. * # * * # * This program is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU Library General Public License for more details. * # * * # * You should have received a copy of the GNU Library General Public * # * License along with this program; if not, write to the Free Software * # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * # *************************************************************************** import FreeCAD import Part # if FreeCAD.GuiUp: # import FreeCADGui # from PySide import QtCore, QtGui __title__ = "JoinFeatures module (legacy)" __author__ = "DeepSOIC" __url__ = "http://www.freecad.org" __doc__ = "Legacy JoinFeatures module provided for ability to load projects made with \ FreeCAD v0.16. Do not use. Use BOPTools.JoinFeatures instead." def getParamRefine(): return FreeCAD.ParamGet( "User parameter:BaseApp/Preferences/Mod/Part/Boolean" ).GetBool("RefineModel") def shapeOfMaxVol(compound): if compound.ShapeType == "Compound": maxVol = 0 cntEq = 0 shMax = None for sh in compound.childShapes(): v = sh.Volume if v > maxVol + 1e-8: maxVol = v shMax = sh cntEq = 1 elif abs(v - maxVol) <= 1e-8: cntEq = cntEq + 1 if cntEq > 1: raise ValueError("Equal volumes, can't figure out what to cut off!") return shMax else: return compound # # def makePartJoinFeature(name, mode="bypass"): # """makePartJoinFeature(name, mode = 'bypass'): makes an PartJoinFeature object.""" # obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", name) # _PartJoinFeature(obj) # obj.Mode = mode # obj.Refine = getParamRefine() # _ViewProviderPartJoinFeature(obj.ViewObject) # return obj class _PartJoinFeature: "The PartJoinFeature object" def __init__(self, obj): self.Type = "PartJoinFeature" obj.addProperty( "App::PropertyEnumeration", "Mode", "Join", "The mode of operation. bypass = make compound (fast)", ) obj.Mode = ["bypass", "Connect", "Embed", "Cutout"] obj.addProperty("App::PropertyLink", "Base", "Join", "First object") obj.addProperty("App::PropertyLink", "Tool", "Join", "Second object") obj.addProperty( "App::PropertyBool", "Refine", "Join", "True = refine resulting shape. False = output as is.", ) obj.Proxy = self def execute(self, obj): rst = None if obj.Mode == "bypass": rst = Part.makeCompound([obj.Base.Shape, obj.Tool.Shape]) else: cut1 = obj.Base.Shape.cut(obj.Tool.Shape) cut1 = shapeOfMaxVol(cut1) if obj.Mode == "Connect": cut2 = obj.Tool.Shape.cut(obj.Base.Shape) cut2 = shapeOfMaxVol(cut2) rst = cut1.multiFuse([cut2, obj.Tool.Shape.common(obj.Base.Shape)]) elif obj.Mode == "Embed": rst = cut1.fuse(obj.Tool.Shape) elif obj.Mode == "Cutout": rst = cut1 if obj.Refine: rst = rst.removeSplitter() obj.Shape = rst return class _ViewProviderPartJoinFeature: "A View Provider for the PartJoinFeature object" def __init__(self, vobj): vobj.Proxy = self def getIcon(self): if self.Object is None: return getIconPath("Part_JoinConnect.svg") else: return getIconPath( { "bypass": "Part_JoinBypass.svg", "Connect": "Part_JoinConnect.svg", "Embed": "Part_JoinEmbed.svg", "Cutout": "Part_JoinCutout.svg", }[self.Object.Mode] ) def attach(self, vobj): self.ViewObject = vobj self.Object = vobj.Object def setEdit(self, vobj, mode): return False def unsetEdit(self, vobj, mode): return def dumps(self): return None def loads(self, state): return None def claimChildren(self): return [self.Object.Base, self.Object.Tool] def onDelete(self, feature, subelements): try: self.Object.Base.ViewObject.show() self.Object.Tool.ViewObject.show() except Exception as err: FreeCAD.Console.PrintError("Error in onDelete: " + str(err)) return True # def CreateJoinFeature(name, mode): # sel = FreeCADGui.Selection.getSelectionEx() # FreeCAD.ActiveDocument.openTransaction("Create " + mode + "ObjectsFeature") # FreeCADGui.addModule("JoinFeatures") # FreeCADGui.doCommand( # "j = JoinFeatures.makePartJoinFeature(name = '" # + name # + "', mode = '" # + mode # + "' )" # ) # FreeCADGui.doCommand("j.Base = App.ActiveDocument." + sel[0].Object.Name) # FreeCADGui.doCommand("j.Tool = App.ActiveDocument." + sel[1].Object.Name) # try: # FreeCADGui.doCommand("j.Proxy.execute(j)") # FreeCADGui.doCommand("j.purgeTouched()") # except Exception as err: # mb = QtGui.QMessageBox() # mb.setIcon(mb.Icon.Warning) # mb.setText( # translate( # "Part_JoinFeatures", # "Computing the result failed with an error: {err}. Click 'Continue' to create the feature anyway, or 'Abort' to cancel.", # None, # ).format(err=str(err)) # ) # mb.setWindowTitle(translate("Part_JoinFeatures", "Bad selection", None)) # btnAbort = mb.addButton(QtGui.QMessageBox.StandardButton.Abort) # btnOK = mb.addButton( # translate("Part_JoinFeatures", "Continue", None), # QtGui.QMessageBox.ButtonRole.ActionRole, # ) # mb.setDefaultButton(btnOK) # mb.exec_() # if mb.clickedButton() is btnAbort: # FreeCAD.ActiveDocument.abortTransaction() # return # FreeCADGui.doCommand("j.Base.ViewObject.hide()") # FreeCADGui.doCommand("j.Tool.ViewObject.hide()") # FreeCAD.ActiveDocument.commitTransaction() def getIconPath(icon_dot_svg): return ":/icons/" + icon_dot_svg # class _CommandConnectFeature: # "Command to create PartJoinFeature in Connect mode" # def GetResources(self): # return { # "Pixmap": getIconPath("Part_JoinConnect.svg"), # "MenuText": QtCore.QT_TRANSLATE_NOOP( # "Part_ConnectFeature", "Connect objects" # ), # "Accel": "", # "ToolTip": QtCore.QT_TRANSLATE_NOOP( # "Part_ConnectFeature", "Fuses objects, taking care to preserve voids." # ), # } # def Activated(self): # if len(FreeCADGui.Selection.getSelectionEx()) == 2: # CreateJoinFeature(name="Connect", mode="Connect") # else: # mb = QtGui.QMessageBox() # mb.setIcon(mb.Icon.Warning) # mb.setText( # translate( # "Part_JoinFeatures", "Two solids need to be selected, first!", None # ) # ) # mb.setWindowTitle(translate("Part_JoinFeatures", "Bad selection", None)) # mb.exec_() # def IsActive(self): # if FreeCAD.ActiveDocument: # return True # else: # return False # FreeCADGui.addCommand("Part_JoinConnect", _CommandConnectFeature()) # class _CommandEmbedFeature: # "Command to create PartJoinFeature in Embed mode" # def GetResources(self): # return { # "Pixmap": getIconPath("Part_JoinEmbed.svg"), # "MenuText": QtCore.QT_TRANSLATE_NOOP("Part_EmbedFeature", "Embed object"), # "Accel": "", # "ToolTip": QtCore.QT_TRANSLATE_NOOP( # "Part_EmbedFeature", # "Fuses one object into another, taking care to preserve voids.", # ), # } # def Activated(self): # if len(FreeCADGui.Selection.getSelection()) == 2: # CreateJoinFeature(name="Embed", mode="Embed") # else: # mb = QtGui.QMessageBox() # mb.setIcon(mb.Icon.Warning) # mb.setText( # translate( # "Part_JoinFeatures", # "Select base object, then the object to embed, and invoke this tool.", # None, # ) # ) # mb.setWindowTitle(translate("Part_JoinFeatures", "Bad selection", None)) # mb.exec_() # def IsActive(self): # if FreeCAD.ActiveDocument: # return True # else: # return False # FreeCADGui.addCommand("Part_JoinEmbed", _CommandEmbedFeature()) # class _CommandCutoutFeature: # "Command to create PartJoinFeature in Cutout mode" # def GetResources(self): # return { # "Pixmap": getIconPath("Part_JoinCutout.svg"), # "MenuText": QtCore.QT_TRANSLATE_NOOP( # "Part_CutoutFeature", "Cutout for object" # ), # "Accel": "", # "ToolTip": QtCore.QT_TRANSLATE_NOOP( # "Part_CutoutFeature", # "Makes a cutout in one object to fit another object.", # ), # } # def Activated(self): # if len(FreeCADGui.Selection.getSelection()) == 2: # CreateJoinFeature(name="Cutout", mode="Cutout") # else: # mb = QtGui.QMessageBox() # mb.setIcon(mb.Icon.Warning) # mb.setText( # translate( # "Part_JoinFeatures", # "Select the object to make a cutout in, then the object that should fit into the cutout, and invoke this tool.", # None, # ) # ) # mb.setWindowTitle(translate("Part_JoinFeatures", "Bad selection", None)) # mb.exec_() # def IsActive(self): # if FreeCAD.ActiveDocument: # return True # else: # return False # FreeCADGui.addCommand("Part_JoinCutout", _CommandCutoutFeature())
extractor
sunporno
from __future__ import unicode_literals import re from ..utils import determine_ext, int_or_none, parse_duration, qualities from .common import InfoExtractor class SunPornoIE(InfoExtractor): _VALID_URL = r"https?://(?:(?:www\.)?sunporno\.com/videos|embeds\.sunporno\.com/embed)/(?P<id>\d+)" _TESTS = [ { "url": "http://www.sunporno.com/videos/807778/", "md5": "507887e29033502f29dba69affeebfc9", "info_dict": { "id": "807778", "ext": "mp4", "title": "md5:0a400058e8105d39e35c35e7c5184164", "description": "md5:a31241990e1bd3a64e72ae99afb325fb", "thumbnail": r"re:^https?://.*\.jpg$", "duration": 302, "age_limit": 18, }, }, { "url": "http://embeds.sunporno.com/embed/807778", "only_matching": True, }, ] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage( "http://www.sunporno.com/videos/%s" % video_id, video_id ) title = self._html_search_regex(r"<title>([^<]+)</title>", webpage, "title") description = self._html_search_meta("description", webpage, "description") thumbnail = self._html_search_regex( r'poster="([^"]+)"', webpage, "thumbnail", fatal=False ) duration = parse_duration( self._search_regex( ( r'itemprop="duration"[^>]*>\s*(\d+:\d+)\s*<', r">Duration:\s*<span[^>]+>\s*(\d+:\d+)\s*<", ), webpage, "duration", fatal=False, ) ) view_count = int_or_none( self._html_search_regex( r'class="views">(?:<noscript>)?\s*(\d+)\s*<', webpage, "view count", fatal=False, ) ) comment_count = int_or_none( self._html_search_regex( r"(\d+)</b> Comments?", webpage, "comment count", fatal=False, default=None, ) ) formats = [] quality = qualities(["mp4", "flv"]) for video_url in re.findall(r'<(?:source|video) src="([^"]+)"', webpage): video_ext = determine_ext(video_url) formats.append( { "url": video_url, "format_id": video_ext, "quality": quality(video_ext), } ) self._sort_formats(formats) return { "id": video_id, "title": title, "description": description, "thumbnail": thumbnail, "duration": duration, "view_count": view_count, "comment_count": comment_count, "formats": formats, "age_limit": 18, }
blocks
qa_tag_gate
#!/usr/bin/env python # # Copyright 2013 Free Software Foundation, Inc. # # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-3.0-or-later # # import pmt from gnuradio import blocks, gr, gr_unittest class qa_tag_gate(gr_unittest.TestCase): def setUp(self): self.tb = gr.top_block() def tearDown(self): self.tb = None def test_001_t(self): tag = gr.tag_t() tag.key = pmt.string_to_symbol("key") tag.value = pmt.from_long(42) tag.offset = 0 src = blocks.vector_source_f(list(range(20)), False, 1, (tag,)) gate = blocks.tag_gate(gr.sizeof_float, False) sink = blocks.vector_sink_f() self.tb.connect(src, gate, sink) self.tb.run() self.assertEqual(len(sink.tags()), 0) def test_002_t(self): tags = [] tags.append(gr.tag_t()) tags[0].key = pmt.string_to_symbol("key") tags[0].value = pmt.from_long(42) tags[0].offset = 0 tags.append(gr.tag_t()) tags[1].key = pmt.string_to_symbol("key") tags[1].value = pmt.from_long(42) tags[1].offset = 5 tags.append(gr.tag_t()) tags[2].key = pmt.string_to_symbol("secondkey") tags[2].value = pmt.from_long(42) tags[2].offset = 6 src = blocks.vector_source_f(range(20), False, 1, tags) gate = blocks.tag_gate(gr.sizeof_float, False) gate.set_single_key("key") self.assertEqual(gate.single_key(), "key") sink = blocks.vector_sink_f() self.tb.connect(src, gate, sink) self.tb.run() self.assertEqual(len(sink.tags()), 1) def test_003_t(self): tags = [] tags.append(gr.tag_t()) tags[0].key = pmt.string_to_symbol("key") tags[0].value = pmt.from_long(42) tags[0].offset = 0 tags.append(gr.tag_t()) tags[1].key = pmt.string_to_symbol("key") tags[1].value = pmt.from_long(42) tags[1].offset = 5 tags.append(gr.tag_t()) tags[2].key = pmt.string_to_symbol("secondkey") tags[2].value = pmt.from_long(42) tags[2].offset = 6 src = blocks.vector_source_f(range(20), False, 1, tags) gate = blocks.tag_gate(gr.sizeof_float, True) gate.set_single_key("key") sink = blocks.vector_sink_f() self.tb.connect(src, gate, sink) self.tb.run() self.assertEqual(len(sink.tags()), 3) def test_004_t(self): tags = [] tags.append(gr.tag_t()) tags[0].key = pmt.string_to_symbol("key") tags[0].value = pmt.from_long(42) tags[0].offset = 0 tags.append(gr.tag_t()) tags[1].key = pmt.string_to_symbol("key") tags[1].value = pmt.from_long(42) tags[1].offset = 5 tags.append(gr.tag_t()) tags[2].key = pmt.string_to_symbol("secondkey") tags[2].value = pmt.from_long(42) tags[2].offset = 6 src = blocks.vector_source_f(range(20), False, 1, tags) gate = blocks.tag_gate(gr.sizeof_float, True) sink = blocks.vector_sink_f() self.tb.connect(src, gate, sink) self.tb.run() self.assertEqual(len(sink.tags()), 3) def test_005_t(self): gate = blocks.tag_gate(gr.sizeof_float, True) self.assertEqual(gate.single_key(), "") gate.set_single_key("the_key") self.assertEqual(gate.single_key(), "the_key") gate.set_single_key("") self.assertEqual(gate.single_key(), "") if __name__ == "__main__": gr_unittest.run(qa_tag_gate)
scripts
check_test
__copyright__ = "Copyright (C) 2014, 2016 Martin Blais" __license__ = "GNU GPLv2" import unittest import click.testing from beancount.scripts import check from beancount.utils import test_utils class TestScriptCheck(test_utils.ClickTestCase): @test_utils.docfile def test_success(self, filename): """ 2013-01-01 open Expenses:Restaurant 2013-01-01 open Assets:Cash 2014-03-02 * "Something" Expenses:Restaurant 50.02 USD Assets:Cash """ result = self.run_with_args(check.main, filename) self.assertLines("", result.stdout) @test_utils.docfile def test_fail(self, filename): """ 2013-01-01 open Expenses:Restaurant 2013-01-01 open Assets:Cash 2014-03-02 * "Something" Expenses:Restaurant 50.02 USD Assets:Cash 2014-03-07 balance Assets:Cash 100 USD """ # We should use mix_stderr=False and we check for the error # message on result.stderr, but it does not work. See # https://github.com/pallets/click/issues/1761 runner = click.testing.CliRunner() result = runner.invoke(check.main, [filename]) self.assertEqual(result.exit_code, 1) self.assertRegex(result.output, "Balance failed") self.assertRegex(result.output, "Assets:Cash") @test_utils.docfile def test_auto_plugins(self, filename): """ 2014-03-02 * "Something" Expenses:Restaurant 50.02 USD Assets:Cash """ # We should use mix_stderr=False and we check for the error # message on result.stderr, but it does not work. See # https://github.com/pallets/click/issues/1761 runner = click.testing.CliRunner() result = runner.invoke(check.main, ["--auto", filename]) self.assertEqual(result.exit_code, 0) self.assertEqual("", result.output.strip()) if __name__ == "__main__": unittest.main()
extractor
cloudy
# coding: utf-8 from __future__ import unicode_literals from ..utils import str_to_int, unified_strdate from .common import InfoExtractor class CloudyIE(InfoExtractor): _IE_DESC = "cloudy.ec" _VALID_URL = ( r"https?://(?:www\.)?cloudy\.ec/(?:v/|embed\.php\?.*?\bid=)(?P<id>[A-Za-z0-9]+)" ) _TESTS = [ { "url": "https://www.cloudy.ec/v/af511e2527aac", "md5": "29832b05028ead1b58be86bf319397ca", "info_dict": { "id": "af511e2527aac", "ext": "mp4", "title": "Funny Cats and Animals Compilation june 2013", "upload_date": "20130913", "view_count": int, }, }, { "url": "http://www.cloudy.ec/embed.php?autoplay=1&id=af511e2527aac", "only_matching": True, }, ] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage( "https://www.cloudy.ec/embed.php", video_id, query={ "id": video_id, "playerPage": 1, "autoplay": 1, }, ) info = self._parse_html5_media_entries(url, webpage, video_id)[0] webpage = self._download_webpage( "https://www.cloudy.ec/v/%s" % video_id, video_id, fatal=False ) if webpage: info.update( { "title": self._search_regex( r"<h\d[^>]*>([^<]+)<", webpage, "title" ), "upload_date": unified_strdate( self._search_regex( r">Published at (\d{4}-\d{1,2}-\d{1,2})", webpage, "upload date", fatal=False, ) ), "view_count": str_to_int( self._search_regex( r"([\d,.]+) views<", webpage, "view count", fatal=False ) ), } ) if not info.get("title"): info["title"] = video_id info["id"] = video_id return info
draftmake
make_circle
# *************************************************************************** # * Copyright (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> * # * Copyright (c) 2009, 2010 Ken Cline <cline@frii.com> * # * Copyright (c) 2020 FreeCAD Developers * # * * # * This program is free software; you can redistribute it and/or modify * # * it under the terms of the GNU Lesser General Public License (LGPL) * # * as published by the Free Software Foundation; either version 2 of * # * the License, or (at your option) any later version. * # * for detail see the LICENCE text file. * # * * # * This program is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU Library General Public License for more details. * # * * # * You should have received a copy of the GNU Library General Public * # * License along with this program; if not, write to the Free Software * # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * # *************************************************************************** """Provides functions to create Circle objects.""" ## @package make_circle # \ingroup draftmake # \brief Provides functions to create Circle objects. ## \addtogroup draftmake # @{ import math import DraftGeomUtils import draftutils.gui_utils as gui_utils import draftutils.utils as utils import FreeCAD as App import Part from draftobjects.circle import Circle if App.GuiUp: from draftviewproviders.view_base import ViewProviderDraft def make_circle( radius, placement=None, face=None, startangle=None, endangle=None, support=None ): """make_circle(radius, [placement, face, startangle, endangle]) or make_circle(edge,[face]): Creates a circle object with given parameters. If startangle and endangle are provided and not equal, the object will show an arc instead of a full circle. Parameters ---------- radius : the radius of the circle. placement : If placement is given, it is used. face : Bool If face is False, the circle is shown as a wireframe, otherwise as a face. startangle : start angle of the circle (in degrees) Recalculated if not in the -360 to 360 range. endangle : end angle of the circle (in degrees) Recalculated if not in the -360 to 360 range. edge : edge.Curve must be a 'Part.Circle' The circle is created from the given edge. support : TODO: Describe """ if not App.ActiveDocument: App.Console.PrintError("No active document. Aborting\n") return if placement: utils.type_check([(placement, App.Placement)], "make_circle") if startangle != endangle: _name = "Arc" else: _name = "Circle" obj = App.ActiveDocument.addObject("Part::Part2DObjectPython", _name) Circle(obj) if face is not None: obj.MakeFace = face if isinstance(radius, Part.Edge): edge = radius if DraftGeomUtils.geomType(edge) == "Circle": obj.Radius = edge.Curve.Radius placement = App.Placement(edge.Placement) delta = edge.Curve.Center.sub(placement.Base) placement.move(delta) # Rotation of the edge rotOk = App.Rotation( edge.Curve.XAxis, edge.Curve.YAxis, edge.Curve.Axis, "ZXY" ) placement.Rotation = rotOk if len(edge.Vertexes) > 1: v0 = edge.Curve.XAxis v1 = (edge.Vertexes[0].Point).sub(edge.Curve.Center) v2 = (edge.Vertexes[-1].Point).sub(edge.Curve.Center) # Angle between edge.Curve.XAxis and the vector from center to start of arc a0 = math.degrees(App.Vector.getAngle(v0, v1)) # Angle between edge.Curve.XAxis and the vector from center to end of arc a1 = math.degrees(App.Vector.getAngle(v0, v2)) obj.FirstAngle = a0 obj.LastAngle = a1 else: obj.Radius = radius if (startangle is not None) and (endangle is not None): obj.FirstAngle = math.copysign(abs(startangle) % 360, startangle) obj.LastAngle = math.copysign(abs(endangle) % 360, endangle) obj.Support = support if placement: obj.Placement = placement if App.GuiUp: ViewProviderDraft(obj.ViewObject) gui_utils.format_object(obj) gui_utils.select(obj) return obj makeCircle = make_circle ## @}
gui-qt
main_window
import json import os import subprocess from functools import partial from plover import _, log from plover.gui_qt.about_dialog import AboutDialog from plover.gui_qt.config_window import ConfigWindow from plover.gui_qt.log_qt import NotificationHandler from plover.gui_qt.main_window_ui import Ui_MainWindow from plover.gui_qt.trayicon import TrayIcon from plover.gui_qt.utils import WindowState, find_menu_actions from plover.oslayer import wmctrl from plover.oslayer.config import CONFIG_DIR, PLATFORM from plover.registry import registry from plover.resource import resource_filename from PyQt5.QtCore import QCoreApplication, Qt from PyQt5.QtGui import QCursor, QIcon, QKeySequence from PyQt5.QtWidgets import QMainWindow, QMenu class MainWindow(QMainWindow, Ui_MainWindow, WindowState): ROLE = "main" def __init__(self, engine, use_qt_notifications): super().__init__() self.setupUi(self) if hasattr(self, "setUnifiedTitleAndToolBarOnMac"): self.setUnifiedTitleAndToolBarOnMac(True) self._engine = engine self._active_dialogs = {} self._dialog_class = { "about": AboutDialog, "configuration": ConfigWindow, } all_actions = find_menu_actions(self.menubar) # Dictionaries. self.dictionaries.add_translation.connect(self._add_translation) self.dictionaries.setup(engine) # Populate edit menu from dictionaries' own. edit_menu = all_actions["menu_Edit"].menu() for action in self.dictionaries.edit_menu.actions(): edit_menu.addAction(action) # Tray icon. self._trayicon = TrayIcon() self._trayicon.enable() self._trayicon.clicked.connect(self._engine.toggle_output) if use_qt_notifications: handler = NotificationHandler() handler.emitSignal.connect(self._trayicon.log) log.add_handler(handler) popup_menu = QMenu() for action_name in ( "action_ToggleOutput", "action_Reconnect", "", "menu_Tools", "", "action_Configure", "action_OpenConfigFolder", "", "menu_Help", "", "action_Show", "action_Quit", ): if action_name: popup_menu.addAction(all_actions[action_name]) else: popup_menu.addSeparator() self._trayicon.set_menu(popup_menu) engine.signal_connect( "machine_state_changed", self._trayicon.update_machine_state ) engine.signal_connect("quit", self.on_quit) self.action_Quit.triggered.connect(engine.quit) # Toolbar popup menu for selecting which tools are shown. self.toolbar_menu = QMenu() self.toolbar.setContextMenuPolicy(Qt.CustomContextMenu) self.toolbar.customContextMenuRequested.connect( lambda: self.toolbar_menu.popup(QCursor.pos()) ) # Populate tools bar/menu. tools_menu = all_actions["menu_Tools"].menu() for tool_plugin in registry.list_plugins("gui.qt.tool"): tool = tool_plugin.obj menu_action = tools_menu.addAction(tool.TITLE) if tool.SHORTCUT is not None: menu_action.setShortcut(QKeySequence.fromString(tool.SHORTCUT)) if tool.ICON is not None: icon = tool.ICON # Internal QT resources start with a `:`. if not icon.startswith(":"): icon = resource_filename(icon) menu_action.setIcon(QIcon(icon)) menu_action.triggered.connect( partial(self._activate_dialog, tool_plugin.name, args=()) ) toolbar_action = self.toolbar.addAction( menu_action.icon(), menu_action.text() ) if tool.__doc__ is not None: toolbar_action.setToolTip(tool.__doc__) toolbar_action.triggered.connect(menu_action.trigger) toggle_action = self.toolbar_menu.addAction( menu_action.icon(), menu_action.text() ) toggle_action.setObjectName(tool_plugin.name) toggle_action.setCheckable(True) toggle_action.setChecked(True) toggle_action.toggled.connect(toolbar_action.setVisible) self._dialog_class[tool_plugin.name] = tool engine.signal_connect("output_changed", self.on_output_changed) # Machine. for plugin in registry.list_plugins("machine"): self.machine_type.addItem(_(plugin.name), plugin.name) engine.signal_connect("config_changed", self.on_config_changed) engine.signal_connect( "machine_state_changed", lambda machine, state: self.machine_state.setText(state.capitalize()), ) self.restore_state() # Commands. engine.signal_connect( "add_translation", partial(self._add_translation, manage_windows=True) ) engine.signal_connect("focus", self._focus) engine.signal_connect( "configure", partial(self._configure, manage_windows=True) ) engine.signal_connect( "lookup", partial(self._activate_dialog, "lookup", manage_windows=True) ) engine.signal_connect( "suggestions", partial(self._activate_dialog, "suggestions", manage_windows=True), ) # Load the configuration (but do not start the engine yet). if not engine.load_config(): self.on_configure() # Apply configuration settings. config = self._engine.config self._warn_on_hide_to_tray = not config["start_minimized"] self._update_machine(config["machine_type"]) self._configured = False self.set_visible(not config["start_minimized"]) # Process events before starting the engine # (to avoid display lag at window creation). QCoreApplication.processEvents() # Start the engine. engine.start() def set_visible(self, visible): if visible: self.show() else: if self._trayicon.is_enabled(): self.hide() else: self.showMinimized() def _activate_dialog(self, name, args=(), manage_windows=False): if manage_windows: previous_window = wmctrl.GetForegroundWindow() dialog = self._active_dialogs.get(name) if dialog is None: dialog_class = self._dialog_class[name] dialog = self._active_dialogs[name] = dialog_class(self._engine, *args) dialog.setWindowIcon(self.windowIcon()) def on_finished(): del self._active_dialogs[name] dialog.deleteLater() if manage_windows and previous_window is not None: wmctrl.SetForegroundWindow(previous_window) dialog.finished.connect(on_finished) dialog.showNormal() dialog.activateWindow() dialog.raise_() def _add_translation(self, dictionary=None, manage_windows=False): if not dictionary: dictionary = None self._activate_dialog( "add_translation", args=(dictionary,), manage_windows=manage_windows ) def _focus(self): self.showNormal() self.activateWindow() self.raise_() def _configure(self, manage_windows=False): self._activate_dialog("configuration", manage_windows=manage_windows) def _lookup(self, manage_windows=False): self._activate_dialog("lookup", manage_windows=manage_windows) def _restore_state(self, settings): if settings.contains("hidden_toolbar_tools"): hidden_toolbar_tools = json.loads(settings.value("hidden_toolbar_tools")) for action in self.toolbar_menu.actions(): action.setChecked(action.objectName() not in hidden_toolbar_tools) def _save_state(self, settings): hidden_toolbar_tools = { action.objectName() for action in self.toolbar_menu.actions() if not action.isChecked() } settings.setValue( "hidden_toolbar_tools", json.dumps(list(sorted(hidden_toolbar_tools))) ) def _update_machine(self, machine_type): self.machine_type.setCurrentIndex(self.machine_type.findData(machine_type)) def on_config_changed(self, config_update): if "machine_type" in config_update: self._update_machine(config_update["machine_type"]) if not self._configured: self._configured = True if config_update.get("show_suggestions_display", False): self._activate_dialog("suggestions") if config_update.get("show_stroke_display", False): self._activate_dialog("paper_tape") def on_machine_changed(self, machine_index): self._engine.config = { "machine_type": self.machine_type.itemData(machine_index) } def on_output_changed(self, enabled): self._trayicon.update_output(enabled) self.output_enable.setChecked(enabled) self.output_disable.setChecked(not enabled) self.action_ToggleOutput.setChecked(enabled) def on_toggle_output(self, enabled): self._engine.output = enabled def on_enable_output(self): self.on_toggle_output(True) def on_disable_output(self): self.on_toggle_output(False) def on_configure(self): self._configure() def on_open_config_folder(self): if PLATFORM == "win": os.startfile(CONFIG_DIR) elif PLATFORM == "linux": subprocess.call(["xdg-open", CONFIG_DIR]) elif PLATFORM == "mac": subprocess.call(["open", CONFIG_DIR]) def on_reconnect(self): self._engine.reset_machine() def on_manage_dictionaries(self): self._activate_dialog("dictionary_manager") def on_about(self): self._activate_dialog("about") def on_quit(self): for dialog in list(self._active_dialogs.values()): dialog.close() self.save_state() self._trayicon.disable() self.hide() QCoreApplication.quit() def on_show(self): self._focus() def closeEvent(self, event): event.ignore() self.hide() if not self._trayicon.is_enabled(): self._engine.quit() return if not self._warn_on_hide_to_tray: return self._trayicon.show_message(_("Application is still running.")) self._warn_on_hide_to_tray = False
doxygen
update_pydoc
# # Copyright 2010-2012 Free Software Foundation, Inc. # # This file was generated by gr_modtool, a tool from the GNU Radio framework # This file is a part of gnuradio # # SPDX-License-Identifier: GPL-3.0-or-later # # """ Updates the *pydoc_h files for a module Execute using: python update_pydoc.py xml_path outputfilename The file instructs Pybind11 to transfer the doxygen comments into the python docstrings. """ import glob import json import os import re import sys import time from argparse import ArgumentParser from doxyxml import ( DoxyClass, DoxyFile, DoxyFriend, DoxyFunction, DoxyIndex, DoxyOther, base, ) def py_name(name): bits = name.split("_") return "_".join(bits[1:]) def make_name(name): bits = name.split("_") return bits[0] + "_make_" + "_".join(bits[1:]) class Block(object): """ Checks if doxyxml produced objects correspond to a gnuradio block. """ @classmethod def includes(cls, item): if not isinstance(item, DoxyClass): return False # Check for a parsing error. if item.error(): return False friendname = make_name(item.name()) is_a_block = item.has_member(friendname, DoxyFriend) # But now sometimes the make function isn't a friend so check again. if not is_a_block: is_a_block = di.has_member(friendname, DoxyFunction) return is_a_block class Block2(object): """ Checks if doxyxml produced objects correspond to a new style gnuradio block. """ @classmethod def includes(cls, item): if not isinstance(item, DoxyClass): return False # Check for a parsing error. if item.error(): return False is_a_block2 = item.has_member("make", DoxyFunction) and item.has_member( "sptr", DoxyOther ) return is_a_block2 def utoascii(text): """ Convert unicode text into ascii and escape quotes and backslashes. """ if text is None: return "" out = text.encode("ascii", "replace") # swig will require us to replace blackslash with 4 backslashes # TODO: evaluate what this should be for pybind11 out = out.replace(b"\\", b"\\\\\\\\") out = out.replace(b'"', b'\\"').decode("ascii") return str(out) def combine_descriptions(obj): """ Combines the brief and detailed descriptions of an object together. """ description = [] bd = obj.brief_description.strip() dd = obj.detailed_description.strip() if bd: description.append(bd) if dd: description.append(dd) return utoascii("\n\n".join(description)).strip() def format_params(parameteritems): output = ["Args:"] template = " {0} : {1}" for pi in parameteritems: output.append(template.format(pi.name, pi.description)) return "\n".join(output) entry_templ = '%feature("docstring") {name} "{docstring}"' def make_entry(obj, name=None, templ="{description}", description=None, params=[]): """ Create a docstring key/value pair, where the key is the object name. obj - a doxyxml object from which documentation will be extracted. name - the name of the C object (defaults to obj.name()) templ - an optional template for the docstring containing only one variable named 'description'. description - if this optional variable is set then it's value is used as the description instead of extracting it from obj. """ if name is None: name = obj.name() if hasattr(obj, "_parse_data") and hasattr(obj._parse_data, "definition"): name = obj._parse_data.definition.split(" ")[-1] if "operator " in name: return "" if description is None: description = combine_descriptions(obj) if params: description += "\n\n" description += utoascii(format_params(params)) docstring = templ.format(description=description) return {name: docstring} def make_class_entry(klass, description=None, ignored_methods=[], params=None): """ Create a class docstring key/value pair. """ if params is None: params = klass.params output = {} output.update(make_entry(klass, description=description, params=params)) for func in klass.in_category(DoxyFunction): if func.name() not in ignored_methods: name = klass.name() + "::" + func.name() output.update(make_entry(func, name=name)) return output def make_block_entry(di, block): """ Create class and function docstrings of a gnuradio block """ descriptions = [] # Get the documentation associated with the class. class_desc = combine_descriptions(block) if class_desc: descriptions.append(class_desc) # Get the documentation associated with the make function make_func = di.get_member(make_name(block.name()), DoxyFunction) make_func_desc = combine_descriptions(make_func) if make_func_desc: descriptions.append(make_func_desc) # Get the documentation associated with the file try: block_file = di.get_member(block.name() + ".h", DoxyFile) file_desc = combine_descriptions(block_file) if file_desc: descriptions.append(file_desc) except base.Base.NoSuchMember: # Don't worry if we can't find a matching file. pass # And join them all together to make a super duper description. super_description = "\n\n".join(descriptions) # Associate the combined description with the class and # the make function. output = {} output.update(make_class_entry(block, description=super_description)) output.update( make_entry(make_func, description=super_description, params=block.params) ) return output def make_block2_entry(di, block): """ Create class and function docstrings of a new style gnuradio block """ # For new style blocks all the relevant documentation should be # associated with the 'make' method. class_description = combine_descriptions(block) make_func = block.get_member("make", DoxyFunction) make_description = combine_descriptions(make_func) description = ( class_description + "\n\nConstructor Specific Documentation:\n\n" + make_description ) # Associate the combined description with the class and # the make function. output = {} output.update( make_class_entry( block, description=description, ignored_methods=["make"], params=make_func.params, ) ) makename = block.name() + "::make" output.update( make_entry( make_func, name=makename, description=description, params=make_func.params ) ) return output def get_docstrings_dict(di, custom_output=None): output = {} if custom_output: output.update(custom_output) # Create docstrings for the blocks. blocks = di.in_category(Block) blocks2 = di.in_category(Block2) make_funcs = set([]) for block in blocks: try: make_func = di.get_member(make_name(block.name()), DoxyFunction) # Don't want to risk writing to output twice. if make_func.name() not in make_funcs: make_funcs.add(make_func.name()) output.update(make_block_entry(di, block)) except block.ParsingError: sys.stderr.write("Parsing error for block {0}\n".format(block.name())) raise for block in blocks2: try: make_func = block.get_member("make", DoxyFunction) make_func_name = block.name() + "::make" # Don't want to risk writing to output twice. if make_func_name not in make_funcs: make_funcs.add(make_func_name) output.update(make_block2_entry(di, block)) except block.ParsingError: sys.stderr.write("Parsing error for block {0}\n".format(block.name())) raise # Create docstrings for functions # Don't include the make functions since they have already been dealt with. funcs = [ f for f in di.in_category(DoxyFunction) if f.name() not in make_funcs and not f.name().startswith("std::") ] for f in funcs: try: output.update(make_entry(f)) except f.ParsingError: sys.stderr.write("Parsing error for function {0}\n".format(f.name())) # Create docstrings for classes block_names = [block.name() for block in blocks] block_names += [block.name() for block in blocks2] klasses = [ k for k in di.in_category(DoxyClass) if k.name() not in block_names and not k.name().startswith("std::") ] for k in klasses: try: output.update(make_class_entry(k)) except k.ParsingError: sys.stderr.write("Parsing error for class {0}\n".format(k.name())) # Docstrings are not created for anything that is not a function or a class. # If this excludes anything important please add it here. return output def sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, output_dir, filter_str=None): if filter_str: docstrings_dict = { k: v for k, v in docstrings_dict.items() if k.startswith(filter_str) } with open(os.path.join(output_dir, "docstring_status"), "w") as status_file: for pydoc_file in pydoc_files: if filter_str: filter_str2 = "::".join( ( filter_str, os.path.split(pydoc_file)[-1].split("_pydoc_template.h")[0], ) ) docstrings_dict2 = { k: v for k, v in docstrings_dict.items() if k.startswith(filter_str2) } else: docstrings_dict2 = docstrings_dict file_in = open(pydoc_file, "r").read() for key, value in docstrings_dict2.items(): file_in_tmp = file_in try: doc_key = key.split("::") # if 'gr' in doc_key: # doc_key.remove('gr') doc_key = "_".join(doc_key) regexp = r"(__doc_{} =\sR\"doc\()[^)]*(\)doc\")".format(doc_key) regexp = re.compile(regexp, re.MULTILINE) (file_in, nsubs) = regexp.subn( r"\1" + value + r"\2", file_in, count=1 ) if nsubs == 1: status_file.write("PASS: " + pydoc_file + "\n") except KeyboardInterrupt: raise KeyboardInterrupt except: # be permissive, TODO log, but just leave the docstring blank status_file.write("FAIL: " + pydoc_file + "\n") file_in = file_in_tmp output_pathname = os.path.join( output_dir, os.path.basename(pydoc_file).replace("_template.h", ".h") ) with open(output_pathname, "w") as file_out: file_out.write(file_in) def copy_docstring_templates(pydoc_files, output_dir): with open(os.path.join(output_dir, "docstring_status"), "w") as status_file: for pydoc_file in pydoc_files: file_in = open(pydoc_file, "r").read() output_pathname = os.path.join( output_dir, os.path.basename(pydoc_file).replace("_template.h", ".h") ) with open(output_pathname, "w") as file_out: file_out.write(file_in) status_file.write("DONE") def argParse(): """Parses commandline args.""" desc = ( "Scrape the doxygen generated xml for docstrings to insert into python bindings" ) parser = ArgumentParser(description=desc) parser.add_argument( "function", help="Operation to perform on docstrings", choices=["scrape", "sub", "copy"], ) parser.add_argument("--xml_path") parser.add_argument("--bindings_dir") parser.add_argument("--output_dir") parser.add_argument("--json_path") parser.add_argument("--filter", default=None) return parser.parse_args() if __name__ == "__main__": # Parse command line options and set up doxyxml. args = argParse() if args.function.lower() == "scrape": di = DoxyIndex(args.xml_path) docstrings_dict = get_docstrings_dict(di) with open(args.json_path, "w") as fp: json.dump(docstrings_dict, fp) elif args.function.lower() == "sub": with open(args.json_path, "r") as fp: docstrings_dict = json.load(fp) pydoc_files = glob.glob(os.path.join(args.bindings_dir, "*_pydoc_template.h")) sub_docstring_in_pydoc_h( pydoc_files, docstrings_dict, args.output_dir, args.filter ) elif args.function.lower() == "copy": pydoc_files = glob.glob(os.path.join(args.bindings_dir, "*_pydoc_template.h")) copy_docstring_templates(pydoc_files, args.output_dir)
Part
MakeBottle
#! python # -*- coding: utf-8 -*- # (c) 2008 Werner Mayer LGPL import math import FreeCAD import FreeCADGui import Part App = FreeCAD Gui = FreeCADGui from FreeCAD import Base def makeBottle(myWidth=50.0, myHeight=70.0, myThickness=30.0): aPnt1 = Base.Vector(-myWidth / 2.0, 0, 0) aPnt2 = Base.Vector(-myWidth / 2.0, -myThickness / 4.0, 0) aPnt3 = Base.Vector(0, -myThickness / 2.0, 0) aPnt4 = Base.Vector(myWidth / 2.0, -myThickness / 4.0, 0) aPnt5 = Base.Vector(myWidth / 2.0, 0, 0) aArcOfCircle = Part.Arc(aPnt2, aPnt3, aPnt4) aSegment1 = Part.LineSegment(aPnt1, aPnt2) aSegment2 = Part.LineSegment(aPnt4, aPnt5) aEdge1 = aSegment1.toShape() aEdge2 = aArcOfCircle.toShape() aEdge3 = aSegment2.toShape() aWire = Part.Wire([aEdge1, aEdge2, aEdge3]) aTrsf = Base.Matrix() aTrsf.rotateZ(math.pi) # rotate around the z-axis aMirroredWire = aWire.copy() aMirroredWire.transformShape(aTrsf) myWireProfile = Part.Wire([aWire, aMirroredWire]) myFaceProfile = Part.Face(myWireProfile) aPrismVec = Base.Vector(0, 0, myHeight) myBody = myFaceProfile.extrude(aPrismVec) myBody = myBody.makeFillet(myThickness / 12.0, myBody.Edges) neckLocation = Base.Vector(0, 0, myHeight) neckNormal = Base.Vector(0, 0, 1) myNeckRadius = myThickness / 4.0 myNeckHeight = myHeight / 10 myNeck = Part.makeCylinder(myNeckRadius, myNeckHeight, neckLocation, neckNormal) myBody = myBody.fuse(myNeck) faceToRemove = 0 zMax = -1.0 for xp in myBody.Faces: surf = xp.Surface if type(surf) == Part.Plane: z = surf.Position.z if z > zMax: zMax = z faceToRemove = xp # This doesn't work for any reason myBody = myBody.makeThickness([faceToRemove], -myThickness / 50, 1.0e-3) myThreading = Part.makeThread( myNeckHeight / 10, myNeckRadius * 0.06, myHeight / 10, myNeckRadius * 0.99 ) myThreading.translate(Base.Vector(0, 0, myHeight)) myCompound = Part.Compound([myBody, myThreading]) return myCompound def makeBoreHole(): # create a document if needed if App.ActiveDocument is None: App.newDocument("Solid") Group = App.ActiveDocument.addObject("App::DocumentObjectGroup", "Group") Group.Label = "Bore hole" V1 = Base.Vector(0, 10, 0) V2 = Base.Vector(30, 10, 0) V3 = Base.Vector(30, -10, 0) V4 = Base.Vector(0, -10, 0) VC1 = Base.Vector(-10, 0, 0) C1 = Part.Arc(V1, VC1, V4) # and the second one VC2 = Base.Vector(40, 0, 0) C2 = Part.Arc(V2, VC2, V3) L1 = Part.LineSegment(V1, V2) # and the second one L2 = Part.LineSegment(V4, V3) S1 = Part.Shape([C1, C2, L1, L2]) W = Part.Wire(S1.Edges) F = Part.Face(W) P = F.extrude(Base.Vector(0, 0, 5)) # add objects with the shape Wire = Group.newObject("Part::Feature", "Wire") Wire.Shape = W Face = Group.newObject("Part::Feature", "Face") Face.Shape = F Prism = Group.newObject("Part::Feature", "Extrude") Prism.Shape = P c = Part.Circle(Base.Vector(0, 0, -1), Base.Vector(0, 0, 1), 2.0) w = Part.Wire(c.toShape()) f = Part.Face(w) p = f.extrude(Base.Vector(0, 0, 7)) P = P.cut(p) # add first borer Bore1 = Group.newObject("Part::Feature", "Borer_1") Bore1.Shape = p Hole1 = Group.newObject("Part::Feature", "Borer_Hole1") Hole1.Shape = P c = Part.Circle(Base.Vector(0, -11, 2.5), Base.Vector(0, 1, 0), 1.0) w = Part.Wire(c.toShape()) f = Part.Face(w) p = f.extrude(Base.Vector(0, 22, 0)) P = P.cut(p) # add second borer Bore2 = Group.newObject("Part::Feature", "Borer_2") Bore2.Shape = p Hole2 = Group.newObject("Part::Feature", "Borer_Hole2") Hole2.Shape = P App.ActiveDocument.recompute() # hide all objects except of the final one Gui.ActiveDocument.getObject(Wire.Name).hide() Gui.ActiveDocument.getObject(Face.Name).hide() Gui.ActiveDocument.getObject(Prism.Name).hide() Gui.ActiveDocument.getObject(Bore1.Name).hide() Gui.ActiveDocument.getObject(Hole1.Name).hide() Gui.ActiveDocument.getObject(Bore2.Name).hide() Gui.ActiveDocument.ActiveView.fitAll()
lib
subreddit_search
# The contents of this file are subject to the Common Public Attribution # License Version 1.0. (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # http://code.reddit.com/LICENSE. The License is based on the Mozilla Public # License Version 1.1, but Sections 14 and 15 have been added to cover use of # software over a computer network and provide for limited attribution for the # Original Developer. In addition, Exhibit A has been modified to be consistent # with Exhibit B. # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for # the specific language governing rights and limitations under the License. # # The Original Code is reddit. # # The Original Developer is the Initial Developer. The Initial Developer of # the Original Code is reddit Inc. # # All portions of the code written by reddit are Copyright (c) 2006-2015 reddit # Inc. All Rights Reserved. ############################################################################### from r2.lib import utils from r2.lib.cache import CL_ONE from r2.lib.db import tdb_cassandra from r2.lib.db.operators import desc from r2.lib.memoize import memoize from r2.models import Subreddit class SubredditsByPartialName(tdb_cassandra.View): _use_db = True _value_type = "pickle" _connection_pool = "main" _read_consistency_level = CL_ONE def load_all_reddits(): query_cache = {} q = Subreddit._query( Subreddit.c.type == "public", Subreddit.c._spam == False, Subreddit.c._downs > 1, sort=(desc("_downs"), desc("_ups")), data=True, ) for sr in utils.fetch_things2(q): if sr.quarantine: continue name = sr.name.lower() for i in xrange(len(name)): prefix = name[: i + 1] names = query_cache.setdefault(prefix, []) if len(names) < 10: names.append((sr.name, sr.over_18)) for name_prefix, subreddits in query_cache.iteritems(): SubredditsByPartialName._set_values(name_prefix, {"tups": subreddits}) def search_reddits(query, include_over_18=True): query = str(query.lower()) try: result = SubredditsByPartialName._byID(query) return [ name for (name, over_18) in getattr(result, "tups", []) if not over_18 or include_over_18 ] except tdb_cassandra.NotFound: return [] @memoize("popular_searches", stale=True, time=3600) def popular_searches(include_over_18=True): top_reddits = Subreddit._query( Subreddit.c.type == "public", sort=desc("_downs"), limit=100, data=True ) top_searches = {} for sr in top_reddits: if sr.quarantine: continue if sr.over_18 and not include_over_18: continue name = sr.name.lower() for i in xrange(min(len(name), 3)): query = name[: i + 1] r = search_reddits(query, include_over_18) top_searches[query] = r return top_searches
v1
pages
from typing import List from CTFd.api.v1.helpers.request import validate_args from CTFd.api.v1.helpers.schemas import sqlalchemy_to_pydantic from CTFd.api.v1.schemas import APIDetailedSuccessResponse, APIListSuccessResponse from CTFd.cache import clear_pages from CTFd.constants import RawEnum from CTFd.models import Pages, db from CTFd.schemas.pages import PageSchema from CTFd.utils.decorators import admins_only from CTFd.utils.helpers.models import build_model_filters from flask import request from flask_restx import Namespace, Resource pages_namespace = Namespace("pages", description="Endpoint to retrieve Pages") PageModel = sqlalchemy_to_pydantic(Pages) TransientPageModel = sqlalchemy_to_pydantic(Pages, exclude=["id"]) class PageDetailedSuccessResponse(APIDetailedSuccessResponse): data: PageModel class PageListSuccessResponse(APIListSuccessResponse): data: List[PageModel] pages_namespace.schema_model( "PageDetailedSuccessResponse", PageDetailedSuccessResponse.apidoc() ) pages_namespace.schema_model( "PageListSuccessResponse", PageListSuccessResponse.apidoc() ) @pages_namespace.route("") @pages_namespace.doc( responses={200: "Success", 400: "An error occured processing your data"} ) class PageList(Resource): @admins_only @pages_namespace.doc( description="Endpoint to get page objects in bulk", responses={ 200: ("Success", "PageListSuccessResponse"), 400: ( "An error occured processing the provided or stored data", "APISimpleErrorResponse", ), }, ) @validate_args( { "id": (int, None), "title": (str, None), "route": (str, None), "draft": (bool, None), "hidden": (bool, None), "auth_required": (bool, None), "q": (str, None), "field": ( RawEnum( "PageFields", {"title": "title", "route": "route", "content": "content"}, ), None, ), }, location="query", ) def get(self, query_args): q = query_args.pop("q", None) field = str(query_args.pop("field", None)) filters = build_model_filters(model=Pages, query=q, field=field) pages = Pages.query.filter_by(**query_args).filter(*filters).all() schema = PageSchema(exclude=["content"], many=True) response = schema.dump(pages) if response.errors: return {"success": False, "errors": response.errors}, 400 return {"success": True, "data": response.data} @admins_only @pages_namespace.doc( description="Endpoint to create a page object", responses={ 200: ("Success", "PageDetailedSuccessResponse"), 400: ( "An error occured processing the provided or stored data", "APISimpleErrorResponse", ), }, ) @validate_args(TransientPageModel, location="json") def post(self, json_args): req = json_args schema = PageSchema() response = schema.load(req) if response.errors: return {"success": False, "errors": response.errors}, 400 db.session.add(response.data) db.session.commit() response = schema.dump(response.data) db.session.close() clear_pages() return {"success": True, "data": response.data} @pages_namespace.route("/<page_id>") @pages_namespace.doc( params={"page_id": "ID of a page object"}, responses={ 200: ("Success", "PageDetailedSuccessResponse"), 400: ( "An error occured processing the provided or stored data", "APISimpleErrorResponse", ), }, ) class PageDetail(Resource): @admins_only @pages_namespace.doc(description="Endpoint to read a page object") def get(self, page_id): page = Pages.query.filter_by(id=page_id).first_or_404() schema = PageSchema() response = schema.dump(page) if response.errors: return {"success": False, "errors": response.errors}, 400 return {"success": True, "data": response.data} @admins_only @pages_namespace.doc(description="Endpoint to edit a page object") def patch(self, page_id): page = Pages.query.filter_by(id=page_id).first_or_404() req = request.get_json() schema = PageSchema(partial=True) response = schema.load(req, instance=page, partial=True) if response.errors: return {"success": False, "errors": response.errors}, 400 db.session.commit() response = schema.dump(response.data) db.session.close() clear_pages() return {"success": True, "data": response.data} @admins_only @pages_namespace.doc( description="Endpoint to delete a page object", responses={200: ("Success", "APISimpleSuccessResponse")}, ) def delete(self, page_id): page = Pages.query.filter_by(id=page_id).first_or_404() db.session.delete(page) db.session.commit() db.session.close() clear_pages() return {"success": True}
forum
locals
# -*- coding: utf-8 -*- """ flaskbb.forum.locals ~~~~~~~~~~~~~~~~~~~~ Thread local helpers for FlaskBB :copyright: 2017, the FlaskBB Team :license: BSD, see license for more details """ from flask import _request_ctx_stack, has_request_context, request from werkzeug.local import LocalProxy from .models import Category, Forum, Post, Topic @LocalProxy def current_post(): return _get_item(Post, "post_id", "post") @LocalProxy def current_topic(): if current_post: return current_post.topic return _get_item(Topic, "topic_id", "topic") @LocalProxy def current_forum(): if current_topic: return current_topic.forum return _get_item(Forum, "forum_id", "forum") @LocalProxy def current_category(): if current_forum: return current_forum.category return _get_item(Category, "category_id", "category") def _get_item(model, view_arg, name): if ( has_request_context() and not getattr(_request_ctx_stack.top, name, None) and view_arg in request.view_args ): setattr( _request_ctx_stack.top, name, model.query.filter_by(id=request.view_args[view_arg]).first(), ) return getattr(_request_ctx_stack.top, name, None)
gtk3
new_release_dialog
# # Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com> # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # import deluge.common import deluge.component as component from deluge.configmanager import ConfigManager from deluge.ui.client import client from gi.repository.Gtk import IconSize class NewReleaseDialog: def __init__(self): pass def show(self, available_version): self.config = ConfigManager("gtk3ui.conf") main_builder = component.get("MainWindow").get_builder() self.dialog = main_builder.get_object("new_release_dialog") # Set the version labels if deluge.common.windows_check() or deluge.common.osx_check(): main_builder.get_object("image_new_release").set_from_file( deluge.common.get_pixmap("deluge16.png") ) else: main_builder.get_object("image_new_release").set_from_icon_name( "deluge", IconSize.LARGE_TOOLBAR ) main_builder.get_object("label_available_version").set_text(available_version) main_builder.get_object("label_client_version").set_text( deluge.common.get_version() ) self.chk_not_show_dialog = main_builder.get_object( "chk_do_not_show_new_release" ) main_builder.get_object("button_goto_downloads").connect( "clicked", self._on_button_goto_downloads ) main_builder.get_object("button_close_new_release").connect( "clicked", self._on_button_close_new_release ) if client.connected(): def on_info(version): main_builder.get_object("label_server_version").set_text(version) main_builder.get_object("label_server_version").show() main_builder.get_object("label_server_version_text").show() if not client.is_standalone(): main_builder.get_object("label_client_version_text").set_label( _("<i>Client Version</i>") ) client.daemon.info().addCallback(on_info) self.dialog.show() def _on_button_goto_downloads(self, widget): deluge.common.open_url_in_browser("http://deluge-torrent.org") self.config["show_new_releases"] = not self.chk_not_show_dialog.get_active() self.dialog.destroy() def _on_button_close_new_release(self, widget): self.config["show_new_releases"] = not self.chk_not_show_dialog.get_active() self.dialog.destroy()
gui
preferenceDialog
# ============================================================================= # Copyright (C) 2010 Diego Duclos # # This file is part of pyfa. # # pyfa is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # pyfa is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with pyfa. If not, see <http://www.gnu.org/licenses/>. # ============================================================================= # noinspection PyPackageRequirements import wx from gui.bitmap_loader import BitmapLoader from gui.preferenceView import PreferenceView _t = wx.GetTranslation class PreferenceDialog(wx.Dialog): def __init__(self, parent): super().__init__( parent, id=wx.ID_ANY, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE ) self.SetTitle("pyfa - " + _t("Preferences")) i = wx.Icon(BitmapLoader.getBitmap("preferences_small", "gui")) self.SetIcon(i) mainSizer = wx.BoxSizer(wx.VERTICAL) self.listbook = wx.Listbook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT ) self.listview = self.listbook.GetListView() # self.listview.SetMinSize((500, -1)) # self.listview.SetSize((500, -1)) self.imageList = wx.ImageList(32, 32) self.listbook.AssignImageList(self.imageList) mainSizer.Add(self.listbook, 1, wx.EXPAND | wx.TOP | wx.BOTTOM | wx.LEFT, 5) self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) mainSizer.Add(self.m_staticline2, 0, wx.EXPAND, 5) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.AddStretchSpacer() # localization todo: "OK" button shoudl be a built in thing that is already localized... self.btnOK = wx.Button( self, wx.ID_ANY, "OK", wx.DefaultPosition, wx.DefaultSize, 0 ) btnSizer.Add(self.btnOK, 0, wx.ALL, 5) mainSizer.Add(btnSizer, 0, wx.EXPAND, 5) self.SetSizer(mainSizer) self.Centre(wx.BOTH) for prefView in PreferenceView.views: page = wx.ScrolledWindow(self.listbook) page.SetScrollRate(15, 15) bmp = prefView.getImage() if bmp: imgID = self.imageList.Add(bmp) else: imgID = -1 prefView.populatePanel(page) self.listbook.AddPage(page, prefView.title, imageId=imgID) bestFit = self.GetBestVirtualSize() width = max(bestFit[0], 800 if "wxGTK" in wx.PlatformInfo else 650) height = max(bestFit[1], 550) self.SetSize(width, height) self.Layout() self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent) self.btnOK.Bind(wx.EVT_BUTTON, self.OnBtnOK) def OnBtnOK(self, event): self.Close() def kbEvent(self, event): if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip()
download-manager
dht_health_manager
import math from asyncio import Future from typing import Awaitable from ipv8.taskmanager import TaskManager from tribler.core.components.libtorrent.utils.libtorrent_helper import libtorrent as lt from tribler.core.components.torrent_checker.torrent_checker.dataclasses import ( HealthInfo, ) from tribler.core.utilities.unicode import hexlify class DHTHealthManager(TaskManager): """ This class manages BEP33 health requests to the libtorrent DHT. """ def __init__(self, lt_session): """ Initialize the DHT health manager. :param lt_session: The session used to perform health lookups. """ TaskManager.__init__(self) self.lookup_futures = {} # Map from binary infohash to future self.bf_seeders = {} # Map from infohash to (final) seeders bloomfilter self.bf_peers = {} # Map from infohash to (final) peers bloomfilter self.outstanding = {} # Map from transaction_id to infohash self.lt_session = lt_session def get_health(self, infohash, timeout=15) -> Awaitable[HealthInfo]: """ Lookup the health of a given infohash. :param infohash: The 20-byte infohash to lookup. :param timeout: The timeout of the lookup. """ if infohash in self.lookup_futures: return self.lookup_futures[infohash] lookup_future = Future() self.lookup_futures[infohash] = lookup_future self.bf_seeders[infohash] = bytearray(256) self.bf_peers[infohash] = bytearray(256) # Perform a get_peers request. This should result in get_peers responses with the BEP33 bloom filters. self.lt_session.dht_get_peers(lt.sha1_hash(bytes(infohash))) self.register_task( f"lookup_{hexlify(infohash)}", self.finalize_lookup, infohash, delay=timeout ) return lookup_future def finalize_lookup(self, infohash): """ Finalize the lookup of the provided infohash and invoke the appropriate deferred. :param infohash: The infohash of the lookup we finialize. """ for transaction_id in [ key for key, value in self.outstanding.items() if value == infohash ]: self.outstanding.pop(transaction_id, None) if infohash not in self.lookup_futures: return # Determine the seeders/peers bf_seeders = self.bf_seeders.pop(infohash) bf_peers = self.bf_peers.pop(infohash) seeders = DHTHealthManager.get_size_from_bloomfilter(bf_seeders) peers = DHTHealthManager.get_size_from_bloomfilter(bf_peers) if not self.lookup_futures[infohash].done(): health = HealthInfo(infohash, seeders=seeders, leechers=peers) self.lookup_futures[infohash].set_result(health) self.lookup_futures.pop(infohash, None) @staticmethod def combine_bloomfilters(bf1, bf2): """ Combine two given bloom filters by ORing the bits. :param bf1: The first bloom filter to combine. :param bf2: The second bloom filter to combine. :return: A bytearray with the combined bloomfilter. """ final_bf_len = min(len(bf1), len(bf2)) final_bf = bytearray(final_bf_len) for bf_index in range(final_bf_len): final_bf[bf_index] = bf1[bf_index] | bf2[bf_index] return final_bf @staticmethod def get_size_from_bloomfilter(bf): """ Return the estimated number of items in the bloom filter. :param bf: The bloom filter of which we estimate the size. :return: A rounded integer, approximating the number of items in the filter. """ def tobits(s): result = [] for c in s: num = ord(c) if isinstance(c, str) else c bits = bin(num)[2:] bits = "00000000"[len(bits) :] + bits result.extend([int(b) for b in bits]) return result bits_array = tobits(bytes(bf)) total_zeros = 0 for bit in bits_array: if bit == 0: total_zeros += 1 if total_zeros == 0: return 6000 # The maximum capacity of the bloom filter used in BEP33 m = 256 * 8 c = min(m - 1, total_zeros) return int(math.log(c / float(m)) / (2 * math.log(1 - 1 / float(m)))) def requesting_bloomfilters(self, transaction_id, infohash): """ Tne libtorrent DHT has sent a get_peers query for an infohash we may be interested in. If so, keep track of the transaction and node IDs. :param transaction_id: The ID of the query :param infohash: The infohash for which the query was sent. """ if infohash in self.lookup_futures: self.outstanding[transaction_id] = infohash elif transaction_id in self.outstanding: # Libtorrent is reusing the transaction_id, and is now using it for a infohash that we're not interested in. self.outstanding.pop(transaction_id, None) def received_bloomfilters( self, transaction_id, bf_seeds=bytearray(256), bf_peers=bytearray(256) ): """ We have received bloom filters from the libtorrent DHT. Register the bloom filters and process them. :param transaction_id: The ID of the query for which we are receiving the bloom filter. :param bf_seeds: The bloom filter indicating the IP addresses of the seeders. :param bf_peers: The bloom filter indicating the IP addresses of the peers (leechers). """ infohash = self.outstanding.get(transaction_id) if not infohash: self._logger.info( "Could not find lookup infohash for incoming BEP33 bloomfilters" ) return self.bf_seeders[infohash] = DHTHealthManager.combine_bloomfilters( self.bf_seeders[infohash], bf_seeds ) self.bf_peers[infohash] = DHTHealthManager.combine_bloomfilters( self.bf_peers[infohash], bf_peers )