section stringlengths 2 30 | filename stringlengths 1 82 | text stringlengths 783 28M |
|---|---|---|
hosts | testUpdateHostsFile | #!/usr/bin/env python
# Script by gfyoung
# https://github.com/gfyoung
#
# Python script for testing updateHostFiles.py
import json
import locale
import os
import platform
import re
import shutil
import sys
import tempfile
import unittest
import unittest.mock as mock
from io import BytesIO, StringIO
import requests
... |
friture | bar_label | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2022 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... |
rtorrent | file | # Copyright (c) 2013 Chris Lucas, <chris@chrisjlucas.com>
# 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, ... |
plugins | gulli | """
$description French live TV channel and video on-demand service owned by Gulli.
$url replay.gulli.fr
$type live, vod
$region France
"""
import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
from streamlin... |
player | nullbe | # Copyright 2004 Joe Wreschnig, Michael Urman
# 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 ve... |
calendar | forms | from __future__ import annotations
import bleach
from abilian.i18n import _l
from abilian.web.forms import Form
from abilian.web.forms.fields import DateTimeField
from abilian.web.forms.filters import strip
from abilian.web.forms.validators import required
from abilian.web.forms.widgets import RichTextWidget
from wtfo... |
types | block_elements | """
[Documentation](https://api.slack.com/reference/block-kit/block-elements)
"""
import typing
from .common import Style
from .composition_objects import (
CompositionObjectConfirm,
CompositionObjectOption,
CompositionObjectPlainText,
CompositionObjectText,
)
class _BaseBlockElement(typing.TypedDic... |
lib | promote | # 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, ... |
config | configtypes | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Types for options in qutebrowser's configuration.
Those types are used in configdata.yml as type of a setting.
Most of them are pretty generic, but some of them are e.g. specific String
sub... |
extractors | miomio | #!/usr/bin/env python
__all__ = ["miomio_download"]
from xml.dom.minidom import parseString
from ..common import *
from .tudou import tudou_download_by_id
from .youku import youku_download_by_vid
def miomio_download(url, output_dir=".", merge=True, info_only=False, **kwargs):
html = get_html(url)
title = ... |
events | appinfo | # Copyright 2017 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 platform
import mutagen
fro... |
thumbor | importer | #!/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 importlib import import_module
from thumbor.utils import logge... |
misc | editor | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Launcher for an external editor."""
import os
import tempfile
from qutebrowser.config import config
from qutebrowser.misc import guiprocess
from qutebrowser.qt import sip
from qutebrowser.q... |
plugins | utils | # -*- coding: utf-8 -*-
"""
flaskbb.plugins.utils
~~~~~~~~~~~~~~~~~~~~~
This module provides registration and a basic DB backed key-value
store for plugins.
:copyright: (c) 2017 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from flask import current_app, flash, redirect... |
model | helpers | # Copyright (C) 2011 Chris Dekter
# Copyright (C) 2019-2020 Thomas Hess <thomas.hess@udo.edu>
#
# 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 opt... |
utilities | simpledefs | """
Simple definitions.
Author(s): Arno Bakker
"""
from enum import Enum
from uuid import UUID
class DownloadStatus(Enum):
ALLOCATING_DISKSPACE = 0
WAITING_FOR_HASHCHECK = 1
HASHCHECKING = 2
DOWNLOADING = 3
SEEDING = 4
STOPPED = 5
STOPPED_ON_ERROR = 6
METADATA = 7
CIRCUITS = 8
... |
plot-tools | plot_psd_base | #!/usr/bin/env python
#
# Copyright 2007,2008,2010,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import numpy
try:
from pylab import (
Button,
ceil,
connect,
draw,
figtext,
figure,
ge... |
beetsplug | thumbnails | # This file is part of beets.
# Copyright 2016, Bruno Cauet
#
# 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, modi... |
network | webkitqutescheme | # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""QtWebKit specific qute://* handlers and glue code."""
from qutebrowser.browser import qutescheme
from qutebrowser.browser.webkit.network import networkreply
from qutebrowser.qt.core import Q... |
lib | httpauth | """
This module defines functions to implement HTTP Digest Authentication
(:rfc:`2617`).
This has full compliance with 'Digest' and 'Basic' authentication methods. In
'Digest' it supports both MD5 and MD5-sess algorithms.
Usage:
First use 'doAuth' to request the client authentication for a
certain resource. Yo... |
chardet | jpcntx | ######################## 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 R... |
OpenSCAD | expandplacements | # ***************************************************************************
# * Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it... |
blocks | _build | # Copyright 2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
import itertools
import re
from ..Constants import ADVANCED_PARAM_TAB
from ..Messages import send_warning
from ..utils import to_list
from ._flags import Flags
from ._templates import Mako... |
qltk | entry | # Copyright 2005 Joe Wreschnig, Michael Urman
# 2011, 2012 Christoph Reiter
# 2020 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 Lic... |
css | cssrule | """CSSRule implements DOM Level 2 CSS CSSRule."""
__all__ = ["CSSRule"]
__docformat__ = "restructuredtext"
__version__ = "$Id$"
import xml.dom
import cssutils
class CSSRule(cssutils.util.Base2):
"""Abstract base interface for any type of CSS statement. This includes
both rule sets and at-rules. An implement... |
models | event_definition | from django.contrib.postgres.indexes import GinIndex
from django.db import models
from django.utils import timezone
from posthog.models.team import Team
from posthog.models.utils import UUIDModel
class EventDefinition(UUIDModel):
team: models.ForeignKey = models.ForeignKey(
Team,
on_delete=models.... |
scorewiz | header | # 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
... |
core | box_coder | # 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... |
versions | 035_81148ccebd6c_harvesting_doc_versioning | # encoding: utf-8
"""035 Harvesting doc versioning
Revision ID: 81148ccebd6c
Revises: 6c600693af5b
Create Date: 2018-09-04 18:49:01.017635
"""
import sqlalchemy as sa
from alembic import op
from ckan.migration import skip_based_on_legacy_engine_version
# revision identifiers, used by Alembic.
revision = "81148ccebd6... |
extractor | cbsinteractive | # coding: utf-8
from __future__ import unicode_literals
import re
from ..utils import int_or_none
from .cbs import CBSIE
class CBSInteractiveIE(CBSIE):
_VALID_URL = r"https?://(?:www\.)?(?P<site>cnet|zdnet)\.com/(?:videos|video(?:/share)?)/(?P<id>[^/?]+)"
_TESTS = [
{
"url": "http://www.... |
marketSources | cevemarket | # =============================================================================
# Copyright (C) 2020 Copy Liu
#
# 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 vers... |
action | get | # encoding: utf-8
"""API functions for searching for and getting data from CKAN."""
from __future__ import annotations
import json
import logging
import socket
import uuid
from typing import Any, Container, Optional, Type, Union, cast
import ckan
import ckan.authz as authz
import ckan.lib.datapreview as datapreview
... |
migrations | 0151_auto_20220705_0049 | # Generated by Django 3.2.13 on 2022-07-05 00:49
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0150_readthrough_stopped_date"),
]
operations = [
migrations.R... |
admin | email_blocklist | """ Manage email blocklist"""
from bookwyrm import forms, models
from django.contrib.auth.decorators import login_required, permission_required
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from django.... |
printdlg | toolbar | # -*- 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.... |
sandbox | output | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 11 23:59:48 2011
@author: timothee
"""
import numpy as np
import pyaudio
from scipy import stats
SAMPLING_RATE = 44100
FRAMES_PER_BUFFER = 1024
time_s = 10.0
t = np.arange(0, time_s, 1.0 / float(SAMPLING_RATE))
def pinknoise(n, rvs=stats.norm.rvs):
k = min(int(np... |
docs-json | convert_docs_json_to_markdown | #!/usr/bin/env python3
"""Convert Google Docs V1 API's JSON to Markdown.
"""
__copyright__ = "Copyright (C) 2019 Martin Blais"
__license__ = "GNU GPLv2"
import argparse
import collections
import datetime
import hashlib
import json
import logging
import os
import pickle
import pprint
import re
import shelve
import sh... |
helpers | dashboard_templates | from typing import Callable, Dict, List, Optional
import structlog
from posthog.constants import (
BREAKDOWN,
BREAKDOWN_TYPE,
DATE_FROM,
DISPLAY,
ENRICHED_DASHBOARD_INSIGHT_IDENTIFIER,
FILTER_TEST_ACCOUNTS,
INSIGHT,
INSIGHT_TRENDS,
INTERVAL,
PROPERTIES,
TREND_FILTER_TYPE_EVE... |
qt | webenginecore | # pylint: disable=import-error,wildcard-import,unused-wildcard-import,unused-import
"""Wrapped Qt imports for Qt WebEngine Core.
All code in qutebrowser should use this module instead of importing from
PyQt/PySide directly. This allows supporting both Qt 5 and Qt 6.
See machinery.py for details on how Qt wrapper sel... |
dynamic-challenges | decay | from __future__ import division # Use floating point for math calculations
import math
from CTFd.models import Solves
from CTFd.utils.modes import get_model
def get_solve_count(challenge):
Model = get_model()
solve_count = (
Solves.query.join(Model, Solves.account_id == Model.id)
.filter(
... |
social-auth | middlewares | import logging
from urllib.parse import urljoin
from apps.social_auth.backends import LoginSlackOAuth2V2
from apps.social_auth.exceptions import InstallMultiRegionSlackException
from common.constants.slack_auth import REDIRECT_AFTER_SLACK_INSTALL, SLACK_AUTH_FAILED
from django.http import HttpResponse
from django.shor... |
calendar | models | from __future__ import annotations
from abilian.core.entities import SEARCHABLE, Entity
from abilian.sbe.apps.communities.models import (
Community,
CommunityIdColumn,
community_content,
)
from sqlalchemy import Column, DateTime, Unicode
from sqlalchemy.event import listens_for
from sqlalchemy.orm import b... |
extractor | spotify | # coding: utf-8
from __future__ import unicode_literals
import json
import re
from ..utils import (
clean_podcast_url,
float_or_none,
int_or_none,
strip_or_none,
try_get,
unified_strdate,
)
from .common import InfoExtractor
class SpotifyBaseIE(InfoExtractor):
_ACCESS_TOKEN = None
_OP... |
PyObjCTest | test_nserrors | from AppKit import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class TestNSErrors(TestCase):
def testConstants(self):
self.assertIsInstance(NSTextLineTooLongException, unicode)
self.assertIsInstance(NSTextNoSelectionException, unicode)
self... |
backlog | views | # 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, either version 3 of the ... |
frescobaldi-app | documenttree | # This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2013 - 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
... |
event | events_query | import json
from datetime import timedelta
from typing import Dict, List, Optional
from dateutil.parser import isoparse
from django.db.models import Prefetch
from django.utils.timezone import now
from posthog.api.element import ElementSerializer
from posthog.api.utils import get_pk_or_uuid
from posthog.clickhouse.clie... |
XmlMaterialProfile | XmlMaterialProfile | # Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import copy
import io
import json # To parse the product-to-id mapping file.
import os.path # To find the product-to-id mapping.
import xml.etree.ElementTree as ET
from typing import Any, Dict, List, Optional, Set, Tuple,... |
sunflower | common | import gettext
import locale
import os
import subprocess
import sys
from gi.repository import Gio, Pango
# user directories
class UserDirectory:
DESKTOP = "XDG_DESKTOP_DIR"
DOWNLOADS = "XDG_DOWNLOAD_DIR"
TEMPLATES = "XDG_TEMPLATES_DIR"
PUBLIC = "XDG_PUBLICSHARE_DIR"
DOCUMENTS = "XDG_DOCUMENTS_DIR... |
projectedFit | add | import eos.db
import wx
from gui.fitCommands.helpers import restoreCheckedStates
from logbook import Logger
from service.fit import Fit
pyfalog = Logger(__name__)
class CalcAddProjectedFitCommand(wx.Command):
def __init__(self, fitID, projectedFitID, amount, state=None):
wx.Command.__init__(self, True, "... |
api | albums_songs | # This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API.
#
# Copyright (C) 2013-2023 Alban 'spl0k' Féron
#
# Distributed under terms of the GNU AGPLv3 license.
from datetime import timedelta
from flask import request
from peewee import JOIN, fn
from ..db import (
Album... |
deposit | protocol | # -*- 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 th... |
lib | fill_common | # This file is part of MyPaint.
# Copyright (C) 2019 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) any... |
supysonic | lastfm | # This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API.
#
# Copyright (C) 2013-2022 Alban 'spl0k' Féron
#
# Distributed under terms of the GNU AGPLv3 license.
import hashlib
import logging
import requests
logger = logging.getLogger(__name__)
class LastFm:
def __init... |
Arch | InitGui | # ***************************************************************************
# * Copyright (c) 2011 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it... |
PyObjCTest | test_nslog | import os
import Foundation
from Foundation import *
from PyObjCTools.TestSupport import *
class TestNSLog(TestCase):
def _redirect(self):
fd = os.open("pyobjc-test-nslog.txt", os.O_RDWR | os.O_CREAT, 0o666)
self.real_stderr = os.dup(2)
os.dup2(fd, 2)
os.close(fd)
def _cleanu... |
localDrone | imprt | import eos.db
import gui.mainFrame
import wx
from gui import globalEvents as GE
from gui.fitCommands.calc.drone.localAdd import CalcAddLocalDroneCommand
from gui.fitCommands.helpers import DroneInfo, InternalCommandHistory
from service.fit import Fit
class GuiImportLocalDronesCommand(wx.Command):
def __init__(sel... |
backends | portmidi_init | """
Low-level wrapper for PortMidi library
Copied straight from Grant Yoshida's portmidizero, with slight
modifications.
"""
import ctypes.util
import sys
from ctypes import (
CDLL,
CFUNCTYPE,
POINTER,
Structure,
c_char_p,
c_int,
c_long,
c_uint,
c_void_p,
cast,
create_string... |
sgui | splash | import os
from sglib.models import theme
from sgui import shared
from sgui.sgqt import QGridLayout, QLabel, QSizePolicy, QSpacerItem, QtCore, QWidget
from sgui.util import svg_to_pixmap, ui_scaler_factory
SPLASHSCREEN = None
class SplashScreen(QWidget):
def __init__(self, parent):
global SPLASHSCREEN
... |
tasks | calculate_cohort | import time
from typing import Any, Dict, List
import structlog
from celery import shared_task
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.db.models import F
from django.utils import timezone
from posthog.models import Cohort
from posthog.models.cohort import get_and_u... |
example-iauthenticator | plugin | # encoding: utf-8
from ckan import plugins as p
from flask import Blueprint, make_response
toolkit = p.toolkit
blueprint = Blueprint("example_iauthenticator", __name__, url_prefix="/user")
def custom_login():
return "logged in"
def custom_logout():
return "logged out"
blueprint.add_url_rule("/custom_l... |
qtgui | dialcontrol | #!/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 import Qt
from PyQt5.QtCore import QSize
from PyQt5.QtCore import Qt as Qtc
from PyQt5.QtWid... |
versions | 080_8224d872c64f_continuity_id_indexes | # encoding: utf-8
"""080 Continuity id indexes
Revision ID: 8224d872c64f
Revises: e0177a15d2c9
Create Date: 2018-09-04 18:49:16.546952
"""
from alembic import op
from ckan.migration import skip_based_on_legacy_engine_version
# revision identifiers, used by Alembic.
revision = "8224d872c64f"
down_revision = "e0177a15... |
scripting | common | # Copyright (C) 2018 Thomas Hess
#
# 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 th... |
femexamples | equation_electrostatics_electricforce_elmer_nongui6 | # ***************************************************************************
# * Copyright (c) 2020 Sudhanshu Dubey <sudhanshu.thethunder@gmail.com> *
# * Copyright (c) 2021 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * Th... |
filter | qa_firdes | #!/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 import fft, filter, gr, gr_unittest
class test_firdes(gr_unittest.TestCase):
def setUp(self):
pass
def tearDown(self... |
docbrowser | browser | # 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
... |
resources | cmyk_palette | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 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.... |
extractor | tv2hu | # encoding: utf-8
from __future__ import unicode_literals
from ..utils import int_or_none
from .common import InfoExtractor
class TV2HuIE(InfoExtractor):
IE_NAME = "tv2.hu"
_VALID_URL = r"https?://(?:www\.)?tv2\.hu/(?:[^/]+/)+(?P<id>\d+)_[^/?#]+?\.html"
_TESTS = [
{
"url": "http://tv2... |
website | widgets | from tempus_dominus.widgets import DatePicker
class OIDatePicker(DatePicker):
"""
We want to use open iconic instead of font awesome. To not always pass the same options and attributes, we add them in our own widgets
"""
oi_attrs = {
"append": "oi oi-calendar",
}
oi_options = {
... |
engines | qwant | # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint
"""Qwant (Web, News, Images, Videos)
This engine uses the Qwant API (https://api.qwant.com/v3). The API is
undocumented but can be reverse engineered by reading the network log of
https://www.qwant.com/ queries.
This implementation is used by different qwant... |
lib | gettext | # This file is part of MyPaint.
# Copyright (C) 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) any... |
social | models | """Social content items: messages aka status updates, private messages, etc."""
from __future__ import annotations
import re
from abilian.core.entities import SEARCHABLE, Entity
from abilian.core.extensions import db
from abilian.core.models.subjects import Group, User
from sqlalchemy.orm import relationship
from sql... |
upload | admin | # -*- 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 th... |
extractor | unity | from __future__ import unicode_literals
from .common import InfoExtractor
from .youtube import YoutubeIE
class UnityIE(InfoExtractor):
_VALID_URL = (
r"https?://(?:www\.)?unity3d\.com/learn/tutorials/(?:[^/]+/)*(?P<id>[^/?#&]+)"
)
_TESTS = [
{
"url": "https://unity3d.com/learn... |
box-coders | faster_rcnn_box_coder | # 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... |
downloaders | SenditCloud | # -*- coding: utf-8 -*-
from ..base.simple_downloader import SimpleDownloader
class SenditCloud(SimpleDownloader):
__name__ = "SenditCloud"
__type__ = "downloader"
__version__ = "0.01"
__status__ = "testing"
__pattern__ = r"https?://(?:www\.)?sendit\.cloud/\w+"
__config__ = [
("enabl... |
core | cache | # Copyright 2017 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
import json
import logging
import os
import time
from .io import yaml
logger = logging.getLogger(__name__)
class Cache(object):
def __init__(self, filename, version=None):
se... |
extra | release | #!/usr/bin/env python3
"""A utility script for automating the beets release process.
"""
import datetime
import os
import re
import subprocess
from contextlib import contextmanager
import click
BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
CHANGELOG = os.path.join(BASE, "docs", "changelog.rst")
... |
extractor | cbsnews | # coding: utf-8
from __future__ import unicode_literals
import re
import zlib
from ..compat import compat_b64decode, compat_urllib_parse_unquote
from ..utils import parse_duration
from .cbs import CBSIE
from .common import InfoExtractor
class CBSNewsEmbedIE(CBSIE):
IE_NAME = "cbsnews:embed"
_VALID_URL = r"h... |
migrations | 0101_org_owners | # Generated by Django 3.0.6 on 2020-11-19 06:04
from django.db import migrations, models
def make_first_administrators_owners(apps, schema_editor):
Organization = apps.get_model("posthog", "Organization")
for organization in Organization.objects.all():
if organization.memberships.filter(level=15).exi... |
PyObjCTest | test_nsapplication | from AppKit import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
try:
long
except NameError:
long = int
class TestNSApplicationHelper(NSObject):
def copyWithZone_(self, zone):
return self
def writeSelectionToPasteboard_types_(self, pb, tp):
... |
library | song | # 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 pathlib import Path
from typing import Iterable, Optional, Set, Typ... |
simplejson | encoder | """Implementation of JSONEncoder
"""
import re
from decimal import Decimal
def _import_speedups():
try:
from simplejson import _speedups
return _speedups.encode_basestring_ascii, _speedups.make_encoder
except ImportError:
return None, None
c_encode_basestring_ascii, c_make_encoder =... |
builder | _lxml | # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
__all__ = [
'LXMLTreeBuilderForXML',
'LXMLTreeBuilder',
]
import collections
from io import BytesIO
from bs4.builder import (FAST, HTML, PERMISSIVE, XML, HTMLTreeBuilder,
ParserRe... |
draftguitools | gui_circulararray | # ***************************************************************************
# * (c) 2019 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... |
blocks | qa_file_descriptor_source_sink | #!/usr/bin/env python
#
# Copyright 2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import os
import tempfile
import pmt
from gnuradio import blocks, gr, gr_unittest
class test_file_descriptor_source_sink(gr_unittest.TestCase):
def setUp(s... |
activity | subscriptions | # -*- coding: utf-8 -*-
from __future__ import annotations
import logging
from typing import Any
import ckan.lib.dictization as dictization
import ckan.plugins.toolkit as tk
from ckan import types
from .model import Activity
log = logging.getLogger(__name__)
def get_subscriptions() -> types.SignalMapping:
re... |
analog | qa_fmdet | #!/usr/bin/env python
#
# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import analog, blocks, gr, gr_unittest
class test_fmdet_cf(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
... |
engines | frinkiac | # SPDX-License-Identifier: AGPL-3.0-or-later
"""
Frinkiac (Images)
"""
from json import loads
from urllib.parse import urlencode
# about
about = {
"website": "https://frinkiac.com",
"wikidata_id": "Q24882614",
"official_api_documentation": {
"url": None,
"comment": "see https://github.com... |
PyObjCTest | test_nsgraphicscontext | from AppKit import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
try:
import Quartz
except ImportError:
Quartz = None
class TestNSGraphicsContext(TestCase):
def testConstants(self):
self.assertIsInstance(NSGraphicsContextDestinationAttributeName, un... |
Arch | ArchIFC | # ***************************************************************************
# * Copyright (c) 2019 Dion Moult <dion@thinkmoult.com> *
# * Copyright (c) 2019 Yorik van Havre <yorik@uncreated.net> *
# * Copyright (c) 2020 FreeCAD Developers *
# * ... |
utils | config | def migrate_1_to_2(config):
"""Create better structure by moving most settings out of dict root
and into sub categories. Some keys are also renamed to be consistent
with other UIs.
"""
def move_key(source, dest, source_key, dest_key=None):
if dest_key is None:
dest_key = source_... |
scripts | preview | import argparse
import glob
import json
import math
import os
import sys
import bpy
import mathutils
def createParser():
"""Create command line interface."""
# When --help or no args are given, print this help
usage_text = (
"Run blender in background mode with this script:"
" blender --... |
image | table | # -*- Mode: Python; test-case-name: whipper.test.test_image_table -*-
# vi:si:et:sw=4:sts=4:ts=4
# Copyright (C) 2009 Thomas Vander Stichele
# This file is part of whipper.
#
# whipper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... |
views | main | import hashlib
import html
import json
import logging
import os
import random
import re
import shutil
import stat
import subprocess
import sys
import tempfile
import zipfile
from collections import deque
from datetime import datetime, timedelta
from io import BytesIO, TextIOWrapper
from os import scandir
from pathlib i... |
blocks | qa_selector | #!/usr/bin/env python
#
# Copyright 2019 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_selector(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown... |
clientScripts | rights_from_csv | #!/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... |
pynocchio | go_to_page_dialog | from PyQt5 import QtCore, QtWidgets
from .comic_page_handler_factory import ComicPageHandlerFactory
from .uic_files import go_to_page_dialog_ui
class GoToDialog(QtWidgets.QDialog):
def __init__(self, comic_handler, parent=None):
super().__init__(parent=parent)
self.ui = go_to_page_dialog_ui.Ui_G... |
lib | engine | import os
import signal
import sys
import time
import psutil
from sglib import constants
from sglib.constants import ENGINE_PIDFILE, MAJOR_VERSION
from sglib.hardware.rpi import is_rpi
from sglib.lib import strings as sg_strings
from sglib.lib import util
from sglib.lib.translate import _
from sglib.log import LOG
fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.