section stringlengths 2 30 | filename stringlengths 1 82 | text stringlengths 783 28M |
|---|---|---|
bookwyrm | emailing | """ send emails """
from bookwyrm import models, settings
from bookwyrm.settings import DOMAIN
from bookwyrm.tasks import EMAIL, app
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
def email_data():
"""fields every email needs"""
site = models.SiteSettings.o... |
fpr | urls | from django.conf.urls import url
from fpr import views
UUID_REGEX = r"[\w]{8}(-[\w]{4}){3}-[\w]{12}"
app_name = "fpr"
urlpatterns = [
url(r"^$", views.home, name="fpr_index"),
url(
r"^(?P<category>format|formatgroup|idrule|idcommand|fprule|fpcommand)/(?P<uuid>"
+ UUID_REGEX
+ ")/toggle... |
feminout | readFenicsXML | # ***************************************************************************
# * Copyright (c) 2017-2023 Johannes Hartung <j.hartung@gmx.net> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... |
schedulers | qt | from __future__ import absolute_import
from apscheduler.schedulers.base import BaseScheduler
try:
from PyQt5.QtCore import QObject, QTimer
except ImportError: # pragma: nocover
try:
from PyQt4.QtCore import QObject, QTimer
except ImportError:
try:
from PySide.QtCore import QOb... |
gui | aboutData | # =============================================================================
# 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 ... |
commands | runners | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Module containing command managers (SearchRunner and CommandRunner)."""
import contextlib
import re
import traceback
from typing import TYPE_CHECKING, Callable, Dict, Iterator, Mapping, Muta... |
events | iradiolog | # Copyright 2006 Joe Wreschnig
# 2021 Nick Boultbee
#
# 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 qu... |
deployment | engine | # coding:utf-8
import logging
import os
from cactus.deployment.file import BaseFile
from cactus.utils.filesystem import fileList
from cactus.utils.helpers import get_or_prompt, map_apply, memoize
from cactus.utils.parallel import PARALLEL_DISABLED, multiMap
logger = logging.getLogger(__name__)
class BaseDeploymentE... |
widgets | note_selector | from sglib.lib.translate import _
from sgui.sgqt import *
NOTE_SELECTOR_CLIPBOARD = None
class NoteSelectorWidget:
def __init__(
self,
a_port_num,
a_rel_callback,
a_val_callback,
a_port_dict=None,
a_default_value=60,
a_preset_mgr=None,
name_label=No... |
pynocchio | main_window_view | import logging
from PyQt5 import QtCore, QtGui, QtWidgets
try:
import qdarkgraystyle
except ImportError:
pass
from .about_dialog import AboutDialog
from .bookmark import TemporaryBookmark
from .bookmark_manager_dialog import BookmarkManagerDialog
from .exception import (
InvalidTypeFileException,
Loa... |
extractors | kugou | #!/usr/bin/env python
__all__ = ["kugou_download"]
import hashlib
import re
from base64 import b64decode
from json import loads
from ..common import *
def kugou_download(url, output_dir=".", merge=True, info_only=False, **kwargs):
if url.lower().find("5sing") != -1:
# for 5sing.kugou.com
html =... |
migrations | 0222_fix_deleted_primary_dashboards | import structlog
from django.db import connection, migrations
from django.db.models import Q
# 0220_set_primary_dashboard set the primary dashboard for teams, but
# it didn't account for deleted dashboards. This migration fixes projects
# that have a primary dashboard set to a deleted dashboard.
def fix_for_deleted_... |
models | slack_channel | from common.public_primary_keys import (
generate_public_primary_key,
increase_public_primary_key_length,
)
from django.conf import settings
from django.core.validators import MinLengthValidator
from django.db import models
def generate_public_primary_key_for_slack_channel():
prefix = "H"
new_public_p... |
providers | smtp | import smtplib
from email.message import EmailMessage
from email.utils import formataddr
from socket import timeout
from CTFd.utils import get_app_config, get_config
from CTFd.utils.email.providers import EmailProvider
class SMTPEmailProvider(EmailProvider):
@staticmethod
def sendmail(addr, text, subject):
... |
libs | notifications | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#######################################################################
#
# VidCutter - media cutter & joiner
#
# copyright © 2018 Pete Alexandrou
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... |
scripts | icons_update | #!/usr/bin/env python2.7
"""
This script updates only market/item icons.
"""
import argparse
import json
import os
import sqlite3
from shutil import copyfile
from PIL import Image
parser = argparse.ArgumentParser(
description="This script updates module icons for pyfa"
)
parser.add_argument(
"-e", "--eve",... |
core | daemon | #
# Copyright (C) 2007-2009 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.
#
"""The Deluge daemon"""
i... |
core | position | """A position object, which consists of units Amount and cost Cost.
See types below for details.
"""
__copyright__ = "Copyright (C) 2013-2017 Martin Blais"
__license__ = "GNU GPLv2"
import copy
import datetime
import re
from decimal import Decimal
from typing import NamedTuple, Optional
from beancount.core.amount i... |
build-backend | test_build_backend | import pytest
from build_backend import _filter_cmd_option_args
from setuptools.command.egg_info import egg_info
@pytest.mark.parametrize(
("config_settings", "expected", "options"),
[
pytest.param(
None,
None,
egg_info.user_options,
id="Empty config_set... |
models | builder | # 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, ... |
win | version_resource | # UTF-8
#
# For more details about fixed file info 'ffi' see:
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(1, 15, 1, 0),
... |
draftguitools | gui_line_add_delete | # ***************************************************************************
# * (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
# * (c) 2009, 2010 Ken Cline <cline@frii.com> *
# * (c) 2020 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * ... |
extractor | toutv | # coding: utf-8
from __future__ import unicode_literals
import json
from ..compat import compat_HTTPError
from ..utils import ExtractorError, int_or_none, merge_dicts
from .radiocanada import RadioCanadaIE
class TouTvIE(RadioCanadaIE):
_NETRC_MACHINE = "toutv"
IE_NAME = "tou.tv"
_VALID_URL = r"https?://... |
Tools | MakeMacBundleRelocatable | import logging
import os
import re
import sys
from subprocess import check_call, check_output
# This script is intended to help copy dynamic libraries used by FreeCAD into
# a Mac application bundle and change dyld commands as appropriate. There are
# two key items that this currently does differently from other simi... |
PyObjCTest | test_nsbuttoncell | from AppKit import *
from PyObjCTools.TestSupport import *
class TestNSButtonCell(TestCase):
def testConstants(self):
self.assertEqual(NSMomentaryLightButton, 0)
self.assertEqual(NSPushOnPushOffButton, 1)
self.assertEqual(NSToggleButton, 2)
self.assertEqual(NSSwitchButton, 3)
... |
accounts | RapideoPl | # -*- coding: utf-8 -*-
import datetime
import hashlib
import json
import time
from ..base.multi_account import MultiAccount
class RapideoPl(MultiAccount):
__name__ = "RapideoPl"
__type__ = "account"
__version__ = "0.10"
__status__ = "testing"
__config__ = [
("mh_mode", "all;listed;unli... |
templatetags | rating_tags | """ template filters """
from bookwyrm import models
from bookwyrm.utils import cache
from django import template
from django.db.models import Avg
register = template.Library()
@register.filter(name="rating")
def get_rating(book, user):
"""get the overall rating of a book"""
# this shouldn't happen, but it C... |
mixins | paths | import json
from typing import Dict, List, Literal, Optional, Tuple, cast
from posthog.constants import (
CUSTOM_EVENT,
END_POINT,
FUNNEL_PATHS,
HOGQL,
LOCAL_PATH_CLEANING_FILTERS,
PAGEVIEW_EVENT,
PATH_DROPOFF_KEY,
PATH_EDGE_LIMIT,
PATH_END_KEY,
PATH_GROUPINGS,
PATH_MAX_EDGE... |
saveddata | fit | # ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos 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, ... |
api-helpers | utils | import datetime
import re
import typing
from urllib.parse import urljoin
import requests
from apps.schedules.ical_utils import fetch_ical_file
from common.api_helpers.exceptions import BadRequest
from common.timezones import raise_exception_if_not_valid_timezone
from django.conf import settings
from django.core.valida... |
misc | split | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Our own fork of shlex.split with some added and removed features."""
import re
from qutebrowser.utils import log, utils
class ShellLexer:
"""A lexical analyzer class for simple shell... |
equations | flow_writer | # ***************************************************************************
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
# * Copyright (c) 2022 Uwe Stöhr <uwestoehr@lyx.org> *
# * ... |
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 outputfilen... |
migrations | 0043_remove_create_pointer_file_ms | """Migration to remove the "Create AIP Pointer File" micro-service."""
from django.db import migrations
def data_migration(apps, schema_editor):
"""This migration removes the "Create AIP Pointer File" micro-services.
This functionality will be moved to the Storage Service (SS). The
motivation for this is ... |
songsmenu | playlist | # Copyright 2009 Christoph Reiter
# 2014-2020 Nick Boultbee
# 2022 Felix Krull
#
# 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) ... |
mail | email | try:
import rfc822
except ImportError:
import email.utils as rfc822
class Email(object):
"""An email address with an optional name."""
def __init__(self, email=None, name=None):
"""Create an Email with the given address and name.
Either fill the separate name and email fields, or pas... |
clientScripts | determine_aip_version_key_exit_code | #!/usr/bin/env python
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, ei... |
propsdlg | generic | # -*- coding: utf-8 -*-
#
# Copyright (C) 2016 by Ihor E. Novikov
#
# 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.... |
utils | debug | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Utilities used for debugging."""
import datetime
import enum
import functools
import inspect
import logging
import re
import types
from typing import (
Any,
Callable,
List,
M... |
events | screensaver | # Copyright 2011,2014 Christoph Reiter <reiter.christoph@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.
i... |
lib | pagination | # -*- coding: utf-8 -*-
"""
This module was copied (with modifications) from the webhelpers library,
which is distributed with the following license:
Copyright (c) 2005-2009 Ben Bangert, James Gardner, Philip Jenvey,
Mike Orr, Jon Rosenbaugh, Christoph Haas,
and other c... |
fetcher | script | import logging
import traceback
from ..bash import execute_bash
from ..conf import settings
from ..stash import LazyStash
logger = logging.getLogger(__name__)
PYTHON_ERROR = "script.python must set global variables ok and content"
def fetch_by_script(conf):
code = conf["script"]
try:
python_code = c... |
extractor | nbc | from __future__ import unicode_literals
import base64
import json
import re
from ..compat import compat_urllib_parse_unquote
from ..utils import (
int_or_none,
parse_duration,
smuggle_url,
try_get,
unified_timestamp,
update_url_query,
)
from .adobepass import AdobePassIE
from .common import In... |
frescobaldi-app | panel | # 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
... |
extractor | lbry | # coding: utf-8
from __future__ import unicode_literals
import functools
import json
from ..compat import (
compat_parse_qs,
compat_str,
compat_urllib_parse_unquote,
compat_urllib_parse_urlparse,
)
from ..utils import (
ExtractorError,
OnDemandPagedList,
determine_ext,
int_or_none,
... |
puddlestuff | util | import logging
import os
import shutil
import traceback
from collections import defaultdict
from copy import copy, deepcopy
from errno import EEXIST
from operator import itemgetter
from xml.sax.saxutils import escape as escape_html
from mutagen import MutagenError
from PyQt5.QtWidgets import QAction
from . import con... |
PathTests | TestPathLanguage | # -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2022 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it a... |
conversions | releaseCarnyx | """
Conversion pack for Carnyx Module Tiericide
"""
CONVERSIONS = {
# Renamed items
"1MN Microwarpdrive I": "5MN Microwarpdrive I",
"1MN Microwarpdrive II": "5MN Microwarpdrive II",
"Prototype 100MN Microwarpdrive I": "500MN Cold-Gas Enduring Microwarpdrive",
"Experimental 100MN Afterburner I": "10... |
friture | scope | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009 Timoth?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 distribu... |
PredicateEditorSample | MyWindowController | import math
from Cocoa import *
searchIndex = 0
class MyWindowController(NSWindowController):
query = objc.ivar()
previousRowCount = objc.ivar(objc._C_INT)
myTableView = objc.IBOutlet()
mySearchResults = objc.IBOutlet()
predicateEditor = objc.IBOutlet()
progressView = objc.IBOutlet() # the... |
qtgui | ledindicator | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import pmt
from gnuradio import gr
from PyQt5.QtCore import QPoint
from PyQt5.QtCore import Qt as Qtc
from PyQt5.QtGui import QBrush, QCol... |
femobjects | constraint_selfweight | # ***************************************************************************
# * Copyright (c) 2015 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... |
versions | 047_883a7c406926_rename_package_group_member | # encoding: utf-8
"""047 Rename package_group_member
Revision ID: 883a7c406926
Revises: b69e9b80396f
Create Date: 2018-09-04 18:49:05.130215
"""
import sqlalchemy as sa
from alembic import op
from ckan.migration import skip_based_on_legacy_engine_version
# revision identifiers, used by Alembic.
revision = "883a7c406... |
PyObjCLauncher | PreferencesWindowController | from AppKit import *
from FileSettings import *
from Foundation import *
from PyObjCTools import NibClassBuilder
class PreferencesWindowController(NSWindowController):
commandline = objc.IBOutlet()
debug = objc.IBOutlet()
filetype = objc.IBOutlet()
honourhashbang = objc.IBOutlet()
inspect = objc.I... |
profiles | stereotypepropertypages | """Stereotype property page."""
from gaphor import UML
from gaphor.core import transactional
from gaphor.core.modeling.element import Element
from gaphor.diagram.propertypages import PropertyPageBase, PropertyPages
from gaphor.UML.profiles.metaclasspropertypage import new_builder
from gi.repository import Gtk
@Proper... |
prefs | prefs_printers | # -*- coding: utf-8 -*-
#
# Copyright (C) 2016 by Ihor E. Novikov
#
# 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.... |
tasks | unsilence | from common.custom_celery_tasks import shared_dedicated_queue_retry_task
from django.conf import settings
from django.db import transaction
from .compare_escalations import compare_escalations
from .send_alert_group_signal import send_alert_group_signal
from .task_logger import task_logger
@shared_dedicated_queue_re... |
UFPReader | UFPReader | # Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import TYPE_CHECKING
from Charon.VirtualFile import VirtualFile
from UM.Mesh.MeshReader import MeshReader
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
from UM.PluginRegistry import PluginRegistry
... |
v1 | challenges | from typing import List # noqa: I001
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_challenges, clear_standings
from CTFd.constants impo... |
ui | ui_edittagdialog | # -*- 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_EditTagDialog(object):
def setupUi(self, EditTagDialog):
EditTagDialog.setObjectName("EditTagDialog")
EditTagDialog.setWindowModalit... |
python | test_resampler | #!/usr/bin/env python
#
# Copyright 2004,2005,2007,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import math
from argparse import ArgumentParser
from gnuradio import audio, filter, gr
from gnuradio.eng_arg import eng_float, intx
try:
from... |
bup | hashsplit | from __future__ import absolute_import
import math
import os
from bup import _helpers
BUP_BLOBBITS = 13
MAX_PER_TREE = 256
progress_callback = None
fanout = 16
GIT_MODE_FILE = 0o100644
GIT_MODE_TREE = 0o40000
GIT_MODE_SYMLINK = 0o120000
HashSplitter = _helpers.HashSplitter
def fanbits():
return int(math.log(... |
scripts | compile_data | #!/usr/bin/env python
"""
This script bootstraps Phobos from a supplied path and feeds it
information regarding EVE data paths and where to dump data. It then imports
some other scripts and uses them to convert the json data into a SQLite
database and then compare the new database to the existing one, producing a
diff ... |
models | serialize | import json
from mopidy.models import immutable
class ModelJSONEncoder(json.JSONEncoder):
"""Automatically serialize Mopidy models to JSON.
Usage::
>>> import json
>>> json.dumps({'a_track': Track(name='name')}, cls=ModelJSONEncoder)
'{"a_track": {"__model__": "Track", "name": "name... |
core | losses_test | # 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 applica... |
lib | filedownload | #!usr/bin/Python
# -*- coding:utf-8 -*-
"""GAE文件下载类,如果文件太大,则分块下载"""
import re
import time
import urllib
import Cookie
import urllib2
import urlparse
from google.appengine.api import urlfetch
from google.appengine.runtime.apiproxy_errors import OverQuotaError
from lib.urlopener import URLOpener
URLFETCH_MAX = 2
URLFET... |
PyObjCTest | test_nsoutlineview | from AppKit import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class TestNSOutlineViewHelper(NSObject):
def outlineView_sizeToFitWidthOfColumn_(self, v, c):
return 1
def outlineView_shouldReorderColumn_toColumn_(self, v, c1, c2):
return 1
... |
Gui | ZCorrect | # -*- coding: utf-8 -*
# ***************************************************************************
# * Copyright (c) 2018 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it an... |
gtk3 | peers_tab | #
# 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 os.path
... |
preferences | midi | # This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2011 - 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
... |
providers | mailgun | from email.utils import formataddr
import requests
from CTFd.utils import get_app_config, get_config
from CTFd.utils.email.providers import EmailProvider
class MailgunEmailProvider(EmailProvider):
@staticmethod
def sendmail(addr, text, subject):
ctf_name = get_config("ctf_name")
mailfrom_addr... |
imageserver | imaging_magick | #
# Quru Image Server
#
# Document: imaging_magick.py
# Date started: 07 Mar 2011
# By: Matt Fozard
# Purpose: Provides an interface to the ImageMagick image processing library
# Requires: qismagick (qismagick.so must be located somewhere in the PYTHONPATH)
# Copyright: Quru Ltd (www.qur... |
VersionUpgrade21to22 | VersionUpgrade21to22 | # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import configparser # To get version numbers from config files.
from typing import Dict, Iterable, List, Optional, Set, Tuple
from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin.
from . import Machin... |
interface | mainloop | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# SoundConverter - GNOME application for converting between audio formats.
# Copyright 2004 Lars Wirzenius
# Copyright 2005-2020 Gautier Portet
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... |
bup | compat | # pylint: disable=unused-import
import os
import sys
from contextlib import ExitStack, nullcontext
from os import environb as environ
from os import fsdecode, fsencode
from shlex import quote
def hexstr(b):
"""Return hex string (not bytes as with hexlify) representation of b."""
return b.hex()
class pending... |
definitions | manage | # Parse JSON profile definitions and provide some useful functions for managing profiles
# used in OpenShot.
#
# Args:
# - "generate": Generate a new set of profile files for OpenShot (1 text file per profile)
# - "validate": Parse through all definitions and validate the math (aspect ratios, sample ratios, etc...)
#... |
extractor | fox9 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class FOX9IE(InfoExtractor):
_VALID_URL = r"https?://(?:www\.)?fox9\.com/video/(?P<id>\d+)"
def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
"anvato:anvat... |
events | gajim_status | # Copyright 2005-2006 Sergey Fedoseev <fedoseev.sergey@gmail.com>
# Copyright 2007 Simon Morgan <zen84964@zen.co.uk>
# 2017 Nick Boultbee
#
# 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 Foundati... |
forms | errors | import json
from flask import g, jsonify, render_template, request
from formspree import settings
from formspree.utils import jsonerror, request_wants_json
class SubmitFormError(Exception):
def __init__(self, response):
self.response = response
def bad_method_error():
if request_wants_json():
... |
plotting | coordinateTransform | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2015 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 distri... |
tools | advanced_rename | from __future__ import absolute_import
import os
from gi.repository import Gdk, Gtk
from sunflower.operation import RenameOperation
class Column:
ICON = 0
OLD_NAME = 1
NEW_NAME = 2
class AdvancedRename:
"""Advanced rename tool"""
def __init__(self, parent, application):
# store parame... |
web | webapi | """
Web API (wrapper around WSGI)
(from web.py)
"""
__all__ = [
"config",
"header", "debug",
"input", "data",
"setcookie", "cookies",
"ctx",
"HTTPError",
# 200, 201, 202
"OK", "Created", "Accepted",
"ok", "created", "accepted",
# 301, 302, 303, 304, 307
"Redirect... |
backend | orcid | # -*- encoding: utf-8 -*-
# Dissemin: open access policy enforcement tool
# Copyright (C) 2014 Antonin Delpeuch
#
# 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 Licen... |
extractor | plays | # coding: utf-8
from __future__ import unicode_literals
import re
from ..utils import int_or_none
from .common import InfoExtractor
class PlaysTVIE(InfoExtractor):
_VALID_URL = r"https?://(?:www\.)?plays\.tv/(?:video|embeds)/(?P<id>[0-9a-f]{18})"
_TESTS = [
{
"url": "https://plays.tv/vid... |
QuartzFilters | _metadata | # This file is generated by objective.metadata
#
# Last update: Fri Jun 8 16:58:06 2012
import sys
import objc
if sys.maxsize > 2**32:
def sel32or64(a, b):
return b
else:
def sel32or64(a, b):
return a
if sys.byteorder == "little":
def littleOrBig(a, b):
return a
else:
... |
natsort | utils | # -*- coding: utf-8 -*-
"""
Utilities and definitions for natsort, mostly all used to define
the _natsort_key function.
SOME CONVENTIONS USED IN THIS FILE.
1 - Factory Functions
Most of the logic of natsort revolves around factory functions
that create branchless transformation functions. For example, rather
than ma... |
webkit | webkitelem | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""QtWebKit specific part of the web element API."""
from typing import TYPE_CHECKING, Iterator, List, Optional, Set, cast
from qutebrowser.browser import webelem
from qutebrowser.config impor... |
Base | Language | # -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2022 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it a... |
scripts | main | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"Launch the plover application."
import argparse
import atexit
import os
import subprocess
import sys
import traceback
import pkg_resources
from plover import __name__ as __software_name__
from plover import __version__, log
fr... |
builtinViews | entityEditor | # noinspection PyPackageRequirements
import wx
from gui.bitmap_loader import BitmapLoader
class BaseValidator(wx.Validator):
def __init__(self):
wx.Validator.__init__(self)
def Validate(self, win):
raise NotImplementedError()
def TransferToWindow(self):
return True
def Trans... |
migrations | 0310_add_starter_dashboard_template | from django.db import migrations
def create_starter_template(apps, schema_editor):
DashboardTemplate = apps.get_model("posthog", "DashboardTemplate")
DashboardTemplate.objects.create(
template_name="Product analytics",
dashboard_description="High-level overview of your product including daily ... |
extractor | zingmp3 | # coding: utf-8
from __future__ import unicode_literals
from ..utils import ExtractorError, int_or_none
from .common import InfoExtractor
class ZingMp3BaseIE(InfoExtractor):
_VALID_URL_TMPL = (
r"https?://(?:mp3\.zing|zingmp3)\.vn/(?:%s)/[^/]+/(?P<id>\w+)\.html"
)
_GEO_COUNTRIES = ["VN"]
def... |
commons | functions | import base64
import math
import os
import cv2
import numpy as np
from photonix.classifiers.face.deepface.commons import distance
from photonix.classifiers.face.mtcnn import MTCNN # 0.1.0
from PIL import Image
from tensorflow.keras.applications.imagenet_utils import preprocess_input
from tensorflow.keras.preprocessin... |
models | wiki | # 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, ... |
properties-timeline | properties_timeline | import datetime
import json
from typing import Any, Dict, List, Set, TypedDict, Union, cast
from posthog.models.filters.properties_timeline_filter import PropertiesTimelineFilter
from posthog.models.group.group import Group
from posthog.models.person.person import Person
from posthog.models.property.util import (
... |
http | http_chunk | # -*- coding: utf-8 -*-
import codecs
import os
import re
import time
import urllib.parse
from cgi import parse_header as parse_header_line
from email.header import decode_header as parse_mime_header
from ntpath import basename as ntpath_basename
from posixpath import basename as posixpath_basename
import pycurl
from... |
doclist | widget | # 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
... |
tools | make_mo | #!/usr/bin/python3 -OO
# -*- coding: utf-8 -*-
# Copyright 2007-2023 The SABnzbd-Team (sabnzbd.org)
#
# 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 yo... |
extractor | yandexmusic | # coding: utf-8
from __future__ import unicode_literals
import hashlib
import itertools
import re
from ..compat import compat_str
from ..utils import ExtractorError, float_or_none, int_or_none, try_get
from .common import InfoExtractor
class YandexMusicBaseIE(InfoExtractor):
_VALID_URL_BASE = r"https?://music\.... |
docsrc | to_rss | # -*- coding: utf-8 -*-
import formatter
import re
import sys
from htmlentitydefs import name2codepoint as n2cp
from htmllib import HTMLParser
def convert_entities(s):
s = re.sub("&#(\d+);", lambda m: unichr(int(m.groups(0)[0])), s)
return re.sub(
"&(\w)+;", lambda m: n2cp.get(m.groups(0), "&%s;" % m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.