section stringlengths 2 30 | filename stringlengths 1 82 | text stringlengths 783 28M |
|---|---|---|
tasks | async_migrations | from celery import states
from celery.result import AsyncResult
from posthog.async_migrations.runner import (
run_async_migration_operations,
run_migration_healthcheck,
start_async_migration,
update_migration_progress,
)
from posthog.async_migrations.utils import (
force_stop_migration,
process_... |
incident-log-builder | incident_log_builder | import typing
from apps.base.messaging import get_messaging_backend_from_id
from apps.schedules.ical_utils import list_users_to_notify_from_ical
from django.db.models import Q
from django.utils import timezone
if typing.TYPE_CHECKING:
from apps.alerts.models import AlertGroup, AlertGroupLogRecord, ResolutionNote
... |
person-overrides | sql | # Within PostHog, it is possible that two Persons are merged together. The
# impact of this is that all events that were associated with the Persons should
# now appear to be associated with a single Person.
#
# In the ClickHouse `sharded_events` table we have a `person_id` column that
# contains the UUID of the Person... |
parts | plucked_strings | # 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
... |
clientScripts | verify_mets | #!/usr/bin/env python
"""verify_mets.py
Verify METS documents provided to the script. Its first, and primary use so
far is to verify the validity of custom structmaps included with transfers and
supplied on ingest after appraisal.
"""
import os
from lxml import etree
class VerifyMETSException(Exception):
"""Exc... |
ui | scripteditor | # -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2021-2022 Laurent Monin
# Copyright (C) 2021-2022 Philipp Wolfer
# Copyright (C) 2021-2023 Bob Swift
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licens... |
migrations | 0132_team_test_account_filters | # Generated by Django 3.0.6 on 2021-02-25 17:58
import os
import re
import django.contrib.postgres.fields.jsonb
from django.db import migrations
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
def get_absolute_path(to: str) -> str:
"""
Returns an absolute path in the F... |
neubot | updater_win32 | # neubot/updater_win32.py
#
# Copyright (c) 2012 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 Publ... |
utils | filter_photos | import datetime
import re
from django.db.models import Case, IntegerField, Value, When
from photonix.photos.models import Tag
month_dict = {
"january": 1,
"february": 2,
"march": 3,
"april": 4,
"may": 5,
"june": 6,
"july": 7,
"august": 8,
"september": 9,
"october": 10,
"nov... |
thumbor | threadpool | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from concurrent.futures import ThreadPoolExecutor
from thumbor.util... |
views | user_groups | from apps.auth_token.auth import ApiTokenAuthentication
from apps.public_api.serializers.user_groups import UserGroupSerializer
from apps.public_api.throttlers.user_throttle import UserThrottle
from apps.slack.models import SlackUserGroup
from common.api_helpers.mixins import RateLimitHeadersMixin
from common.api_helpe... |
src | ModuleSystem | import os
from threading import Thread, currentThread
import appinfo
from utils import *
class Module:
def __init__(self, name, filename):
self.name = name
self.filename = filename
self.thread = None
self.module = None
@property
def mainFuncName(self):
return self... |
resources | resources | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.14.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x26\x67\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x02\x58\x... |
internal | log | from __future__ import annotations
import logging
import logging.config
import logging.handlers
import platform
from logging import LogRecord
from typing import TYPE_CHECKING, ClassVar, Literal, Optional
if TYPE_CHECKING:
from mopidy.config import Config, LoggingConfig
LogLevelName = Literal[
"critical",
... |
beetsplug | albumtypes | # This file is part of beets.
# Copyright 2021, Edgars Supe.
#
# 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, mod... |
deposit | views | # -*- 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 Affero General Public License
# as published by the Free Software Foundation; either version 2
# of the... |
-development | helpers | # noinspection PyPackageRequirements
import os
import sys
import threading
import pytest
from sqlalchemy import MetaData, create_engine
from sqlalchemy.orm import sessionmaker
script_dir = os.path.dirname(os.path.abspath(__file__))
# Add root folder to python paths
sys.path.append(os.path.realpath(os.path.join(script... |
writer8 | index | #!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import absolute_import, division, print_function, unicode_literals
from future_builtins import map
__license__ = "GPL v3"
__copyright__ = "2012, Kovid Goyal <kovid@kovidgoyal.net>"
__docformat__ = "restructuredtext en"
from coll... |
python-appimage | release | #!/usr/bin/env python3
import argparse
import copy
import os
import shutil
import subprocess
from glob import glob
CWD = os.path.abspath(
os.path.dirname(__file__),
)
os.chdir(CWD)
def parse_args():
parser = argparse.ArgumentParser("Create AppImages")
parser.add_argument(
"-p",
"--python... |
datapusher | interfaces | # encoding: utf-8
from __future__ import annotations
from typing import Any
from ckan.plugins.interfaces import Interface
from ckan.types import Context
class IDataPusher(Interface):
"""
The IDataPusher interface allows plugin authors to receive notifications
before and after a resource is submitted to ... |
extractor | abcotvs | # coding: utf-8
from __future__ import unicode_literals
import re
from ..compat import compat_str
from ..utils import dict_get, int_or_none, try_get
from .common import InfoExtractor
class ABCOTVSIE(InfoExtractor):
IE_NAME = "abcotvs"
IE_DESC = "ABC Owned Television Stations"
_VALID_URL = r"https?://(?P... |
implant | toggleStates | import wx
from logbook import Logger
from service.fit import Fit
pyfalog = Logger(__name__)
class CalcToggleImplantStatesCommand(wx.Command):
def __init__(self, fitID, mainPosition, positions, forceStates=None):
wx.Command.__init__(self, True, "Toggle Implant States")
self.fitID = fitID
s... |
extractor | biobiochiletv | # coding: utf-8
from __future__ import unicode_literals
from ..utils import ExtractorError, remove_end
from .common import InfoExtractor
class BioBioChileTVIE(InfoExtractor):
_VALID_URL = r"https?://(?:tv|www)\.biobiochile\.cl/(?:notas|noticias)/(?:[^/]+/)+(?P<id>[^/]+)\.shtml"
_TESTS = [
{
... |
femobjects | element_geometry2D | # ***************************************************************************
# * Copyright (c) 2015 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... |
core | stats | import logging
import os
import platform
import subprocess
import sys
import threading
import time
import xml.etree.ElementTree as ET
from collections import defaultdict
import psutil
def bytes2human(n):
"""
>>> bytes2human(10000)
'9.8 K/s'
>>> bytes2human(100001221)
'95.4 M/s'
"""
symbol... |
PyObjCTest | test_nspopover | import AppKit
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class PopoverHelper(AppKit.NSObject):
def popoverShouldClose_(self, a):
return 1
class TestNSPopover(TestCase):
@min_os_level("10.7")
def testConstants10_7(self):
self.assertEqual(Ap... |
webbrowser | chromium | import os
from contextlib import asynccontextmanager
from pathlib import Path
from typing import AsyncGenerator, List, Optional, Union
import trio
from streamlink.compat import is_darwin, is_win32
from streamlink.plugin.api import validate
from streamlink.session import Streamlink
from streamlink.utils.socket import f... |
PyObjCTest | test_cgsession | from PyObjCTools.TestSupport import *
from Quartz.CoreGraphics import *
try:
unicode
except NameError:
unicode = str
try:
long
except NameError:
long = int
class TestCGSession(TestCase):
def testConstants(self):
self.assertEqual(kCGSessionUserIDKey, "kCGSSessionUserIDKey")
self.... |
extractor | iprima | # coding: utf-8
from __future__ import unicode_literals
import re
import time
from ..utils import determine_ext, js_to_json
from .common import InfoExtractor
class IPrimaIE(InfoExtractor):
_VALID_URL = r"https?://(?:[^/]+)\.iprima\.cz/(?:[^/]+/)*(?P<id>[^/?#&]+)"
_GEO_BYPASS = False
_TESTS = [
... |
BasicDrawing | FrameworkTextDrawing | import sys
import objc
import QuartzTextDrawing
import Utilities
from Cocoa import *
from Quartz import *
def getTextString():
# These unicode values are the characters: Q, u, a, r, t, z,
# eighthnote, floral heart, black chess queen, and two CJK characters.
# Note: Create an NSString, because we'll use ... |
lib | packer | # -*- coding: utf-8 -*-
# http://dean.edwards.name/packer/
# http://dean.edwards.name/unpacker/
import re
from userdecompress import decompressFromBase64
# https://github.com/ytdl-org/youtube-dl/blob/befa4708fd2165b85d04002c3845adf191d34302/youtube_dl/utils.py
PACKED_CODES_RE = re.compile(r"}\('(.+)',(\d+),(\d+),'([... |
v08-custom-helper-function | plugin | # encoding: utf-8
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from ckan.common import CKANConfig
def most_popular_groups():
"""Return a sorted list of the groups with the most datasets."""
# Get a list of all the site's groups from CKAN, sorted by number of
# datasets.
grou... |
migrations | 0221_add_activity_log_model | # Generated by Django 3.2.12 on 2022-03-17 11:39
import django.db.models.deletion
import django.utils.timezone
import posthog.models.activity_logging.activity_log
import posthog.models.utils
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependenc... |
devel | example_singleton | # Singleton design pattern example.
# For more information on singleton:
# http://en.wikipedia.org/wiki/Singleton_pattern
# http://www.vincehuston.org/dp/singleton.html
class Singleton(type):
# This is a Gary Robinson implementation:
# http://www.garyrobinson.net/2004/03/python_singleto.html
def __init__(... |
CTFd | populate | #!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import datetime
import hashlib
import random
from CTFd import create_app
from CTFd.cache import clear_challenges, clear_config, clear_pages, clear_standings
from CTFd.models import (
Awards,
ChallengeFiles,
Challenges,
Fails,
Flags,
Sol... |
gui | widgets | # This file is part of MyPaint.
# Copyright (C) 2011-2018 by the MyPaint Development Team
#
# 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)... |
TechDrawTools | TDToolsUtil | # ***************************************************************************
# * Copyright (c) 2022 Wanderer Fan <wandererfan@gmail.com> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it... |
examples | gr_filtdes_callback | #!/usr/bin/env python
#
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import sys
from gnuradio.filter import filter_design
try:
from PyQt5 import Qt, QtCore, QtGui
except ImportError:
print(
"Please install PyQt5 t... |
extractor | r7 | # coding: utf-8
from __future__ import unicode_literals
from ..utils import int_or_none
from .common import InfoExtractor
class R7IE(InfoExtractor):
_VALID_URL = r"""(?x)
https?://
(?:
(?:[a-zA-Z]+)\.r7\.com(?:/[^/]+)+/idmedia/|
... |
webengine | webengineinspector | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Customized QWebInspector for QtWebEngine."""
from typing import Optional
from qutebrowser.browser import inspector
from qutebrowser.browser.webengine import webenginesettings, webview
from ... |
PyObjCTest | test_nsuserdefaults | from Foundation import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class PythonListAsValue(TestCase):
def testSettingPythonList(self):
defaults = NSUserDefaults.standardUserDefaults()
defaults.setObject_forKey_(
[b"a".decode("ascii"), b... |
src | CloudError | # Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Any, Dict, Optional
from .BaseModel import BaseModel
class CloudError(BaseModel):
"""Class representing errors generated by the servers, according to the JSON-API standard."""
def __init__(
... |
CoreGraphics | _contextmanager | """
This module defines a number of context managers. These are meant to be used
in the context of the with statement (introduced in Python 2.5).
"""
__all__ = ("CGSavedGState", "CGTransparencyLayer", "CGContextPage")
import Quartz.CoreGraphics as CG
class CGSavedGState(object):
"""
Context manager for saving... |
GCodeReader | RepRapFlavorParser | # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from . import FlavorParser
class RepRapFlavorParser(FlavorParser.FlavorParser):
"""This parser is intended to interpret the RepRap Firmware g-code flavor."""
def __init__(self):
super().__init__()
de... |
protos | keypoint_box_coder_pb2 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: object_detection/protos/keypoint_box_coder.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pb2
from google... |
extractor | afreecatv | # coding: utf-8
from __future__ import unicode_literals
import re
from ..compat import compat_xpath
from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
url_or_none,
urlencode_postdata,
xpath_text,
)
from .common import InfoExtractor
class AfreecaTVIE(InfoExtractor):
IE_NAME... |
api | instance_status | from typing import Any, Dict, List, Union
from django.conf import settings
from django.db import connection
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from posthog.async_migrations.status import async_migrations_ok
from posthog.cloud_utils import is_cloud
... |
builtinStatsViews | capacitorViewFull | # =============================================================================
# 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 ... |
script | parser | # -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2006-2009, 2012 Lukáš Lalinský
# Copyright (C) 2007 Javier Kohen
# Copyright (C) 2008-2011, 2014-2015, 2018-2021 Philipp Wolfer
# Copyright (C) 2009 Carlin Mangar
# Copyright (C) 2009 Nikolai Prokoschenko
# Copyright (C) 2011-2... |
BasicShapes | ViewProviderShapes | # ***************************************************************************
# * *
# * Copyright (c) 2020 Werner Mayer <wmayer[at]users.sourceforge.net> *
# * *
# * Th... |
gtkui | draw | # -*- 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 Licens... |
clientScripts | handle_unstored_dip | #!/usr/bin/env python
# This file is part of Archivematica.
#
# Copyright 2010-2017 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... |
scripts | gcode_pre | # ***************************************************************************
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... |
Code | GestorEntPos | import codecs
import os
from Code import (
PGN,
ControlPosicion,
Gestor,
Jugada,
Partida,
TrListas,
Tutor,
Util,
VarGen,
)
from Code.Constantes import *
from Code.QT import DatosNueva, Iconos, PantallaGM, QTUtil, QTUtil2, QTVarios
from PyQt4.QtCore import Qt
class GestorEntPos(Ges... |
colors | bases | # This file is part of MyPaint.
# Copyright (C) 2012-2014 by Andrew Chadwick <andrewc-git@piffle.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 ... |
versions | 044_4190eeeb8d73_add_task_status | # encoding: utf-8
"""044 Add task status
Revision ID: 4190eeeb8d73
Revises: bd38cd6502b2
Create Date: 2018-09-04 18:49:04.084036
"""
import sqlalchemy as sa
from alembic import op
from ckan.migration import skip_based_on_legacy_engine_version
# revision identifiers, used by Alembic.
revision = "4190eeeb8d73"
down_re... |
time-to-see-data | sessions | from typing import Dict, List, Optional, Tuple
from posthog.client import query_with_columns
from posthog.queries.time_to_see_data.hierarchy import construct_hierarchy
from posthog.queries.time_to_see_data.serializers import (
SessionEventsQuerySerializer,
SessionResponseSerializer,
SessionsQuerySerializer... |
downloaders | DataportCz | # -*- coding: utf-8 -*-
from pyload.core.utils.convert import to_bytes
from ..base.simple_downloader import SimpleDownloader
class DataportCz(SimpleDownloader):
__name__ = "DataportCz"
__type__ = "downloader"
__version__ = "0.47"
__status__ = "testing"
__pattern__ = r"http://(?:www\.)?dataport\... |
cddagl | constants | MAX_LOG_SIZE = 1024 * 1024
MAX_LOG_FILES = 5
SAVES_WARNING_SIZE = 150 * 1024 * 1024
READ_BUFFER_SIZE = 16 * 1024
MAX_GAME_DIRECTORIES = 6
GITHUB_REST_API_URL = "https://api.github.com"
GITHUB_API_VERSION = b"application/vnd.github.v3+json"
GITHUB_XRL_REMAINING = b"X-RateLimit-Remaining"
GITHUB_XRL_RESET = b"X-Rate... |
femexamples | equation_magnetostatics_2D_elmer | # ***************************************************************************
# * Copyright (c) 2023 Uwe Stöhr <uwestoehr@lyx.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... |
version-checks | bitbucket_commit | __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 base64
import logging
import requests
from . import ApiCheckError
BRANCH_HEAD_URL = (
"https://api.bitbucket.org/... |
xl | nls | # Copyright (C) 2008-2010 Adam Olsen
# Copyright (C) 2020 Johannes Sasongko <sasongko@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, or (at your option)
# any lat... |
utils | snoop | """Text manipulation utilities.
"""
__copyright__ = "Copyright (C) 2014, 2016 Martin Blais"
__license__ = "GNU GPLv2"
import collections
import functools
import threading
class Snoop:
"""A snooper callable that just saves the returned values of a
function. This is particularly useful for re.match and re.sea... |
Operations | PlatformPhysicsOperation | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from UM.Math.Vector import Vector
from UM.Operations.GroupedOperation import GroupedOperation
from UM.Operations.Operation import Operation
from UM.Scene.SceneNode import SceneNode
class PlatformPhysicsOperation(Operation)... |
gui | idealbanditems | # Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import numpy
import pyqtgraph as pg
from PyQt5 import Qt, QtCore, QtGui
class IdealBandItems(object):
def __init__(self):
# Set Global pyqtgraph options
# Default ... |
gr | tag_utils | import pmt
from . import gr_python as gr
class PythonTag(object):
"Python container for tags"
def __init__(self):
self.offset = None
self.key = None
self.value = None
self.srcid = False
def tag_to_python(tag):
"""Convert a stream tag to a Python-readable object"""
n... |
filters | no_upscale | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
import thumbor.filters
from thumbor.filters import BaseFilter, filt... |
views | notifications | """ non-interactive pages """
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from django.views import View
# pylint: disable= no-self-use
@method_decorator(login_... |
PyObjCTools | Signals | """Signals.py -- dump a python stacktrace if something bad happens.
DO NOT USE THIS MODULE IN PRODUCTION CODE
This module has two functions in its public API:
- dumpStackOnFatalSignal()
This function will install signal handlers that print a stacktrace and
then reraise the signal.
- resetFatalSignals(... |
utils | utils | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Other utilities which don't fit anywhere else."""
import contextlib
import datetime
import enum
import fnmatch
import functools
import io
import json
import mimetypes
import os
import os.pat... |
UI | WelcomePagesModel | # Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os
from collections import deque
from typing import TYPE_CHECKING, Any, Dict, List, Optional
from PyQt6.QtCore import Qt, QUrl, pyqtProperty, pyqtSignal, pyqtSlot
from UM.i18n import i18nCatalog
from UM.Logger impor... |
femtools | tokrules | # ***************************************************************************
# * Copyright (c) 2020 Werner Mayer <wmayer[at]users.sourceforge.net> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... |
forms | views | import datetime
import io
import json
import requests
import unicodecsv as csv
from flask import (
Response,
abort,
g,
jsonify,
make_response,
render_template,
render_template_string,
request,
session,
url_for,
)
from flask_login import current_user, login_required
from formspre... |
cddagl | i18n | import builtins
import gettext
import logging
import os
logger = logging.getLogger(__name__)
default_names_to_install = ("gettext", "ngettext")
def proxy_gettext(*args, **kwargs):
"""Proxy calls this function to the real built-in gettext() function.
This is not required for normal operation of the applicat... |
transformer | xpath | import logging
import six
from .utils import bake_parametrized
logger = logging.getLogger(__name__)
def parse_html(html):
"""
Returns `html` parsed with lxml.
:param html: Unicode content
"""
# pylint: disable=import-outside-toplevel
from defusedxml import lxml as dlxml
from lxml impor... |
plugins | check_average_cost | """A plugin that ensures cost basis is preserved in unbooked transactions.
This is intended to be used in accounts using the "NONE" booking method, to
manually ensure that the sum total of the cost basis of reducing legs matches
the average of what's in the account inventory. This is a partial first step
toward implem... |
mac | licenseDMG | #! /usr/bin/env python
"""
https://bitbucket.org/jaredhobbs/pyhacker/raw/master/licenseDMG.py
This script adds a license file to a DMG. Requires Xcode and a plain ascii text
license file or an RTF license file.
Obviously only runs on a Mac.
Copyright (C) 2011-2019 Jared Hobbs
Permission is hereby granted, free of ch... |
builtinShipBrowser | navigationPanel | # coding: utf-8
import gui.builtinShipBrowser.sfBrowserItem as SFItem
import gui.mainFrame
import gui.utils.color as colorUtils
import gui.utils.draw as drawUtils
import gui.utils.fonts as fonts
import wx
from gui.bitmap_loader import BitmapLoader
from gui.utils.helpers_wxPython import HandleCtrlBackspace
from logbook... |
ui | client | #
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
#
# 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 LIC... |
audioview | plugin | # encoding: utf-8
from __future__ import annotations
from typing import Any
import ckan.plugins as p
from ckan.common import CKANConfig
from ckan.config.declaration import Declaration, Key
from ckan.types import Context, DataDict
ignore_empty = p.toolkit.get_validator("ignore_empty")
unicode_safe = p.toolkit.get_val... |
iomediator | iomediator | # Copyright (C) 2011 Chris Dekter
#
# 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 t... |
lib | io | # encoding: utf-8
"""
Utility functions for I/O.
"""
import sys
from typing import Any, Union
_FILESYSTEM_ENCODING = str(sys.getfilesystemencoding() or sys.getdefaultencoding())
def encode_path(p: Union[str, Any]) -> bytes:
"""
Convert a Unicode path string to a byte string.
Intended to be used for en... |
misc | list_content | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2015 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 late... |
neubot | notify | # neubot/notify.py
#
# Copyright (c) 2010-2012
# Nexa Center for Internet & Society, Politecnico di Torino (DAUIN)
# and Simone Basso <bassosimone@gmail.com>
#
# 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 ... |
bittorrent | stream | # neubot/bittorrent/stream.py
#
# 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 ... |
PyObjCTest | test_nsfontcollection | import AppKit
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class TestNSFontCollection(TestCase):
@min_os_level("10.7")
def testConstants10_7(self):
self.assertEqual(AppKit.NSFontCollectionVisibilityProcess, 1)
self.assertEqual(AppKit.NSFontCollect... |
qltk | cover | # Copyright 2004-2017 Joe Wreschnig, Michael Urman, Iñigo Serna,
# Christoph Reiter, Nick Boultbee, Simonas Kazlauskas
# 2018-2019 Fredrik Strupe
#
# 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
... |
update | update_wikidata_units | #!/usr/bin/env python
import collections
import json
# set path
from os.path import join
from searx import searx_dir
from searx.engines.wikidata import send_wikidata_query
# the response contains duplicate ?item with the different ?symbol
# "ORDER BY ?item DESC(?rank) ?symbol" provides a deterministic result
# even... |
ui | csscompletion | from __future__ import annotations
import tinycss2.color3
from gaphor.core.styling import Style
from gi.repository import Gio, GObject, Gtk, GtkSource
class ProposalBase:
def proposals(self) -> Gio.ListStore:
raise NotImplementedError()
def proposal_text(self, proposal: GtkSource.CompletionProposal)... |
QT | TabFlechas | import copy
from Code.QT import TabBloques
from PyQt4 import QtCore, QtGui
class FlechaSC(TabBloques.BloqueEspSC):
def __init__(self, escena, bloqueFlecha, rutinaPulsada=None):
super(FlechaSC, self).__init__(escena, bloqueFlecha)
self.rutinaPulsada = rutinaPulsada
self.rutinaPulsadaCarga... |
extractor | cjsw | # coding: utf-8
from __future__ import unicode_literals
import re
from ..utils import determine_ext, unescapeHTML
from .common import InfoExtractor
class CJSWIE(InfoExtractor):
_VALID_URL = (
r"https?://(?:www\.)?cjsw\.com/program/(?P<program>[^/]+)/episode/(?P<id>\d+)"
)
_TESTS = [
{
... |
slow-coro-detection | utils | import io
from asyncio import Handle, Task
from typing import Optional
from tribler.core.utilities.slow_coro_detection.main_thread_stack_tracking import (
get_main_thread_stack,
main_stack_tracking_is_enabled,
)
# pylint: disable=protected-access
def format_info(
handle: Handle,
include_stack: bool ... |
C4Model | propertypages | from typing import Union
from gaphor.C4Model import c4model
from gaphor.core import transactional
from gaphor.diagram.propertypages import (
PropertyPageBase,
PropertyPages,
handler_blocking,
new_resource_builder,
unsubscribe_all_on_destroy,
)
new_builder = new_resource_builder("gaphor.C4Model")
... |
hogql | bytecode | from typing import Any, List
from hogvm.python.operation import (
HOGQL_BYTECODE_IDENTIFIER,
SUPPORTED_FUNCTIONS,
Operation,
)
from posthog.hogql import ast
from posthog.hogql.errors import NotImplementedException
from posthog.hogql.visitor import Visitor
COMPARE_OPERATIONS = {
ast.CompareOperationOp.... |
downloaders | XdadevelopersCom | # -*- coding: utf-8 -*
#
# Test links:
# http://forum.xda-developers.com/devdb/project/dl/?id=10885
from ..base.simple_downloader import SimpleDownloader
class XdadevelopersCom(SimpleDownloader):
__name__ = "XdadevelopersCom"
__type__ = "downloader"
__version__ = "0.08"
__status__ = "testing"
... |
plugins | dash | import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.plugin import LOW_PRIORITY, parse_params, stream_weight
from streamlink.stream.dash import DASHStream
from streamlink.utils.url import update_scheme
log = logging.getLogger(__name__)
@pluginmatcher(
re.compile(
... |
ui | util | # -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2007 Lukáš Lalinský
# Copyright (C) 2013-2015, 2018-2022 Laurent Monin
# Copyright (C) 2016-2017 Sambhav Kothari
# Copyright (C) 2017 Frederik “Freso” S. Olesen
# Copyright (C) 2017 Sophist-UK
# Copyright (C) 2018 Vishal Choudh... |
extractor | webcaster | # coding: utf-8
from __future__ import unicode_literals
import re
from ..utils import determine_ext, xpath_text
from .common import InfoExtractor
class WebcasterIE(InfoExtractor):
_VALID_URL = r"https?://bl\.webcaster\.pro/(?:quote|media)/start/free_(?P<id>[^/]+)"
_TESTS = [
{
# http://v... |
migrations | 0001_initial | # Generated by Django 3.2.16 on 2022-11-21 16:10
import apps.mobile_app.models
import django.db.models.deletion
import django_migration_linter as linter
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("user_management", "0004_auto_2022... |
StartPage | LoadCustom | # ***************************************************************************
# * Copyright (c) 2018 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.