text stringlengths 185 73.3k | repo stringlengths 7 100 | path stringlengths 4 146 | language stringclasses 7
values | hash stringlengths 16 16 | score float64 7 8.5 | stars int64 0 237k |
|---|---|---|---|---|---|---|
from pathlib import Path
import time
import logging
from berry import __version__
from berry._subroutines.headerfooter import header, footer
from berry._subroutines.contatempo import tempo
def prepare_message(method):
def wrapper(ref, *messages):
message = ''
if len(messages) == 0:
me... | ricardoribeiro-2020/berry | berry/utils/_logger.py | .py | e3a6f3ec1c18af3c | 7.62 | 16 |
#!/usr/bin/env python
#
# Copyright (c) 2022 SAP SE
# 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
#
# ... | sapcc/openstack-nannies | scripts/helper/manilananny.py | .py | 9b3f964bf1426b6e | 7.45 | 7 |
"""
Python helper for Semantic Versioning (http://semver.org/)
"""
import collections
import re
__version__ = '2.8.1'
__author__ = 'Kostiantyn Rybnikov'
__author_email__ = 'k-bx@k-bx.com'
__maintainer__ = 'Sebastien Celles'
__maintainer_email__ = "s.celles@gmail.com"
_REGEX = re.compile(
r"""
^
... | getsentry/sentry-release-registry | bin/semver.py | .py | 0c61985ea13a4e77 | 7.66 | 20 |
import os
import sys
from multiprocessing import freeze_support
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QColor, QFont, QIcon, QPalette, QPixmap
from PyQt5.QtWidgets import (
QAction,
QApplication,
QLabel,
QMainWindow,
QScrollArea,
QSplashScreen,
QStyleFactory,
QTabWi... | medical-physics-usz/z-rad | main.py | .py | ab3a72bc35bdcb23 | 7.52 | 10 |
import os
import time
import zipfile
from pathlib import Path
import pytest
def _acquire_file_lock(lock_path: Path, timeout: float = 60.0, check_interval: float = 0.1):
"""
Acquire an exclusive file-based lock by creating a lock file.
Args:
lock_path (Path): The path to the lock file.
ti... | medical-physics-usz/z-rad | tests/conftest.py | .py | cae9946321ffee0b | 8.02 | 10 |
"""Custom warnings and errors used across Z-Rad."""
class InvalidInputParametersError(ValueError):
"""Custom exception to indicate invalid input parameters."""
class DataStructureWarning(UserWarning):
"""Custom exception to indicate problems with input data structure."""
class DataStructureError(Exception... | medical-physics-usz/z-rad | zrad/exceptions.py | .py | 8ca8ba2d3f048666 | 7.02 | 10 |
import numpy as np
from ..image import Image
from ..preprocessing.roi import RoiData
class BaseFilter:
"""Common image-oriented API for all concrete filters."""
def __init__(self, filtering_method, **filtering_params):
self.filtering_method = filtering_method
self.filtering_params = filterin... | medical-physics-usz/z-rad | zrad/filtering/base.py | .py | 96ac61ee5a50628c | 7.52 | 10 |
import os
from abc import ABC, ABCMeta, abstractmethod
from multiprocessing import cpu_count
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QFileDialog, QVBoxLayout, QWidget
from ..exceptions import DataStructureError, InvalidInputParametersError
from ..image import Image
from .toolbox_gui import CustomBox, ... | medical-physics-usz/z-rad | zrad/gui/_base_tab.py | .py | dd05567275204e2f | 7.52 | 10 |
import json
import logging
import os
from datetime import datetime
from ..exceptions import DataStructureError, InvalidInputParametersError
from ..io.dicom import get_all_structure_names, get_dicom_files
from ..toolbox_logic import close_all_loggers, get_config_path, get_logger
from ..visualization import Visualizatio... | medical-physics-usz/z-rad | zrad/gui/visual_tab.py | .py | 740e180e5c0b5f6b | 7.52 | 10 |
import copy
import os
import numpy as np
import SimpleITK as sitk
from .io import dicom, nifti
class Image:
"""Image volume with voxel data and physical geometry metadata.
``Image`` stores arrays in NumPy order while preserving the origin, spacing,
direction, and size used by SimpleITK. The class is us... | medical-physics-usz/z-rad | zrad/image.py | .py | 7d0134e92c6ef97b | 7.52 | 10 |
import SimpleITK as sitk
def read_nifti_image(image_path):
"""Read a NIfTI image as a SimpleITK image."""
sitk_reader = sitk.ImageFileReader()
sitk_reader.SetImageIO("NiftiImageIO")
sitk_reader.SetFileName(image_path)
return sitk_reader.Execute()
def read_nifti_mask(mask_path, reference_image):
... | medical-physics-usz/z-rad | zrad/io/nifti.py | .py | 0f190d27ed7928bd | 7.52 | 10 |
import numpy as np
from ..exceptions import DataStructureError
class RoiMaskValidator:
"""Validate ROI mask geometry for 2D, 2.5D, or 3D feature extraction.
The validator enforces minimum ROI extent and voxel-count requirements
before feature extraction. In slice-wise modes, invalid slices are removed;
... | medical-physics-usz/z-rad | zrad/preprocessing/masks.py | .py | 897a5ebcb7652b7e | 7.52 | 10 |
class Pipeline:
"""Run named preprocessing steps in sequence.
A pipeline chains small preprocessing objects that expose an ``apply``
method, for example resampling, ROI-mask construction, re-segmentation, and
discretization. Each step receives the output of the previous step.
Parameters
------... | medical-physics-usz/z-rad | zrad/preprocessing/pipeline.py | .py | 51f5d596704aa69e | 7.52 | 10 |
from dataclasses import dataclass
import numpy as np
from ..image import Image
@dataclass
class RoiData:
"""Current image and ROI masks used for feature calculation.
``RoiData`` groups the image and ROI representations that move through a
preprocessing pipeline. The morphological mask defines the anato... | medical-physics-usz/z-rad | zrad/preprocessing/roi.py | .py | 54fec8f650c5fbb0 | 7.52 | 10 |
import ipyvuetify as v
from traitlets import Unicode
class RemathTrigger(v.VuetifyTemplate):
"""Trigger voila method to re-render the mathjax content.
This event
"""
# load the js file
template = Unicode(
"""
<script class='sepal-ui-script'>
{
methods: ... | sepal-contrib/se.plan | component/frontend/remath.py | .py | 10d3f2c48a07893a | 7.52 | 10 |
import pandas as pd
from traitlets import List
from component import parameter as cp
from component.message import cm
from component.model.questionnaire_model import QuestionnaireModel
from component.types import BenefitLayerData
class BenefitModel(QuestionnaireModel):
names = List([]).tag(sync=True)
ids = L... | sepal-contrib/se.plan | component/model/benefit_model.py | .py | 046852a99e4389b3 | 7.52 | 10 |
import pandas as pd
from traitlets import List, observe
from typing import Tuple
from component import parameter as cp
from component.message import cm
from component.model.questionnaire_model import QuestionnaireModel
from component.scripts.validation import validate_constraint_model_data
from component.types import ... | sepal-contrib/se.plan | component/model/constraint_model.py | .py | daba1a9efa12165c | 7.52 | 10 |
import pandas as pd
from traitlets import List
from component import parameter as cp
from component.message import cm
from component.model.questionnaire_model import QuestionnaireModel
from component.types import CostLayerData
class CostModel(QuestionnaireModel):
names = List([]).tag(sync=True)
ids = List([]... | sepal-contrib/se.plan | component/model/cost_model.py | .py | 26042d92d90ed8bd | 7.52 | 10 |
"""questionnaire model that sets the basic structure for theme model."""
from sepal_ui import model
from traitlets import Int
class QuestionnaireModel(model.Model):
updated = Int(0).tag(sync=True)
new_changes = Int().tag(sync=True)
"""A counter that is incremented every time any trait of the model chang... | sepal-contrib/se.plan | component/model/questionnaire_model.py | .py | 7a08ee1a907bc800 | 7.52 | 10 |
import copy
import logging
from datetime import datetime
from pathlib import Path
from sepal_ui.scripts.gee_interface import GEEInterface
from sepal_ui.scripts.warning import SepalWarning
from traitlets import HasTraits, Int, Unicode, observe
import component.parameter as cp
from component import model as cmod
from c... | sepal-contrib/se.plan | component/model/recipe.py | .py | dc72a1a64cb49231 | 7.52 | 10 |
"""AOI geometry helpers that avoid EE's 2M-edge ``Collection.geometry`` limit.
``ee.FeatureCollection.geometry()`` aggregates every feature into one geometry,
which can exceed EE's 2M-edge limit for dense AOIs. These helpers materialise
only per-feature bounding boxes, so they stay under the cap. Kept dependency-free
... | sepal-contrib/se.plan | component/scripts/aoi_geometry.py | .py | 412c598c693bef44 | 7.52 | 10 |
def hex_to_RGB(hex):
"""Changes from hex to RGB.
#FFFFFF -> [255,255,255].
"""
# Pass 16 to the integer function for change of base
return [int(hex[i : i + 2], 16) for i in range(1, 6, 2)]
def RGB_to_hex(RGB):
"""[255,255,255] -> "#FFFFFF"."""
# Components need to be integers for hex to m... | sepal-contrib/se.plan | component/scripts/colors.py | .py | 28c34f43368679cd | 7.52 | 10 |
from pathlib import Path
from typing import Optional
import json
def read_file(file_path: str, sepal_session) -> Optional[Path]:
if sepal_session:
# Read the file from the sepal session
data = sepal_session.get_file(file_path, parse_json=True)
else:
# Read the file from the local syste... | sepal-contrib/se.plan | component/scripts/file_handler.py | .py | 4bebc71a5e1fa4de | 7.52 | 10 |
#!/usr/bin/env python3
import io
import logging
from pathlib import Path
import ee
from apiclient import discovery
from googleapiclient.http import MediaIoBaseDownload
logging.getLogger("googleapiclient.discovery_cache").setLevel(logging.ERROR)
logger = logging.getLogger("SEPLAN")
class gdrive(object):
def __in... | sepal-contrib/se.plan | component/scripts/gdrive.py | .py | 5914aa03a2a7f50a | 7.52 | 10 |
import logging
from pathlib import Path
from typing import List, Literal, Optional, Tuple, Union
import ee
from ipyleaflet import TileLayer
from sepal_ui import mapping as sm
from sepal_ui.mapping.visualization import set_viz_params
from sepal_ui.scripts.gee import get_ee_project
from sepal_ui.scripts.gee_interface im... | sepal-contrib/se.plan | component/scripts/gee.py | .py | 82539e9c56750d93 | 7.52 | 10 |
"""Define functions to create the plots for the dashboard tile."""
from component.types import (
RecipeStatsDict,
SummaryStatsDict,
)
from sepal_ui import sepalwidgets as sw
import ipyvuetify as v
from ipecharts.option import Option, Legend, Tooltip, XAxis, YAxis, Grid, Toolbox
from ipecharts.option.series im... | sepal-contrib/se.plan | component/scripts/plots.py | .py | ead6a21d18548738 | 7.52 | 10 |
"""All tools to build the suitability index."""
from typing import List, Literal, Tuple, Union
import ee
from component import model as cmod
from component.message import cm
from component.model.aoi_model import SeplanAoi
from component.scripts.aoi_geometry import _aoi_bbox
from component.scripts.validation import v... | sepal-contrib/se.plan | component/scripts/seplan.py | .py | 6912ee93d1856fb8 | 7.52 | 10 |
import json
from typing import Dict, List, Union
from component.message import cm
from sepal_ui.scripts import utils as su
from component.parameter.file_params import legends_path
import logging
logger = logging.getLogger("SEPLAN")
def set_default_asset(w_asset_items: list, asset: str) -> list:
"""Add the defau... | sepal-contrib/se.plan | component/scripts/ui_helpers.py | .py | 6ed5f6febdf05cb6 | 7.52 | 10 |
import logging
import ee
import pandas as pd
import pygaul
import sepal_ui.sepalwidgets as sw
from sepal_ui.mapping import SepalMap
from sepal_ui.scripts.gee_interface import GEEInterface
from sepal_ui.scripts.utils import init_ee
import component.parameter as cp
from component.message import cm
from component.model... | sepal-contrib/se.plan | component/tile/custom_aoi_tile.py | .py | ab4f6f1b416bc733 | 7.52 | 10 |
from typing import List, Tuple
from component.types import (
BenefitChartsData,
ConstraintChartsData,
CostChartData,
RecipeStatsDict,
)
import ipyvuetify as v
from sepal_ui import sepalwidgets as sw
from component import widget as cw
from component.message import cm
from component.model.recipe import ... | sepal-contrib/se.plan | component/tile/dashboard_tile.py | .py | ff0936f7933012f7 | 7.52 | 10 |
import asyncio
from typing import Union
from sepal_ui import sepalwidgets as sw
from sepal_ui.scripts import utils as su
from sepal_ui.scripts.gee_interface import GEEInterface
from component.model.app_model import AppModel
from component.model.recipe import Recipe
from component.widget.alert_state import Alert, Aler... | sepal-contrib/se.plan | component/tile/map_tile.py | .py | 702effc5f4971cc0 | 7.52 | 10 |
from datetime import datetime
from pathlib import Path
from typing import Literal
import ipyvuetify as v
from component.frontend.icons import icon
from component.widget.buttons import TextBtn
from sepal_ui import sepalwidgets as sw
from sepal_ui.scripts import utils as su
from sepal_ui.scripts.decorator import loading... | sepal-contrib/se.plan | component/tile/recipe_tile.py | .py | 7d222bfd50cd65fe | 7.52 | 10 |
"""Dialog to add a sub-AOI by picking an admin unit inside the primary AOI.
Admin hierarchy guarantees structural containment, so the GEE containment
check used by drawn / imported geometries can be skipped for this path.
The only round-trip is one ``getInfo`` to materialize the picked admin
unit's geometry as GeoJSON... | sepal-contrib/se.plan | component/widget/admin_aoi_dialog.py | .py | ce5f7a0b463c83ac | 7.52 | 10 |
"""Custom alert component to inform the user the state of the building process after selecting a new or loading an existing recipe."""
from typing import Literal
from component.frontend.icons import icon
import sepal_ui.sepalwidgets as sw
from ipyvuetify import Btn
from component.message import cm
default_state = {... | sepal-contrib/se.plan | component/widget/alert_state.py | .py | b9d577a16852bb1f | 7.52 | 10 |
from pathlib import Path
from typing import Literal, Optional
from traitlets import Bool, Float, Int, Unicode, Instance, Union, List
import ipyvuetify as v
from ipywidgets import DOMWidget
from ipywidgets.widgets.widget import widget_serialization
import sepal_ui.sepalwidgets as sw
from component.message import cm
... | sepal-contrib/se.plan | component/widget/base_dialog.py | .py | efb262f4615465cc | 7.52 | 10 |
from typing import Union
import pandas as pd
from sepal_ui import sepalwidgets as sw
from sepal_ui.scripts import decorator as sd
from sepal_ui.scripts.gee_interface import GEEInterface
from traitlets import Bool, link
from component import parameter as cp
from component.message import cm
from component.model.benefit... | sepal-contrib/se.plan | component/widget/benefit_dialog.py | .py | 77784c428381e222 | 7.52 | 10 |
import pandas as pd
from component.frontend.icons import icon
from sepal_ui import sepalwidgets as sw
from sepal_ui.scripts import decorator as sd
from component import parameter as cp
from component.message import cm
from component.model.aoi_model import SeplanAoi
from component.model.benefit_model import BenefitMode... | sepal-contrib/se.plan | component/widget/benefit_row.py | .py | 087402bde145aea5 | 7.52 | 10 |
"""add account_id and relationship_status columns in tasks table
Revision ID: 031a07fb0811
Revises: 885632ab6357
Create Date: 2021-04-14 17:48:33.958394
"""
from typing import List
import sqlalchemy as sa
from alembic import op
from sqlalchemy import text
from auth_api.models import Org
from auth_api.utils.enums i... | bcgov/sbc-auth | auth-api/migrations/versions/031a07fb0811_add_account_id_column_in_tasks_table.py | .py | 4bf6d2276dded54e | 7.56 | 12 |
"""create statement permissions
Revision ID: 032248a1b370
Revises: 5cf63f567a62
Create Date: 2020-09-04 16:22:05.235285
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.sql import column, table
# revision identifiers, used by Alembic.
revision = '032248a1b370'
down_revision = '5cf63f567a62'
branch... | bcgov/sbc-auth | auth-api/migrations/versions/032248a1b370_create_statement_permissions.py | .py | d43651fc18ee7a0e | 7.56 | 12 |
"""payment_settings_changes
Revision ID: 06eda339e0d5
Revises: 09c44f82c03c
Create Date: 2020-03-25 16:49:14.477141
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '06eda339e0d5'
down_revision = '09c44f82c03c'
branch_labels = None
depends_on = None
def upgrad... | bcgov/sbc-auth | auth-api/migrations/versions/06eda339e0d5_payment_settings_changes.py | .py | d8ea36db8b0d17c7 | 7.56 | 12 |
"""Add folio number to entity table
Revision ID: 09c44f82c03c
Revises: 68e2f43b9d22
Create Date: 2020-03-20 10:33:31.402269
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '09c44f82c03c'
down_revision = '19ffc2fcc88c'
branch_labels = None
depends_on = None
de... | bcgov/sbc-auth | auth-api/migrations/versions/09c44f82c03c_add_folio_number_to_entity_table.py | .py | ee0fa6ed3f643327 | 7.06 | 12 |
"""verified_user
Revision ID: 09dd4ea64775
Revises: d00101759be4
Create Date: 2021-11-19 13:05:57.935908
"""
from typing import List
import sqlalchemy as sa
from alembic import op
from sqlalchemy import text
from sqlalchemy.sql import column, table
from auth_api.models import Affidavit
# revision identifiers, use... | bcgov/sbc-auth | auth-api/migrations/versions/09dd4ea64775_verified_user.py | .py | e5050f4b7c69bcb1 | 7.56 | 12 |
"""update-broken-link-tos
Revision ID: 0bf25945e757
Revises: d1b167ef61da
Create Date: 2020-09-14 12:40:46.004681
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy import Integer, String
from sqlalchemy.sql import column, table
# revision identifiers, used by Alembic.
revision = '0bf25945e757'
down... | bcgov/sbc-auth | auth-api/migrations/versions/0bf25945e757_update_broken_link_tos.py | .py | 1a9dd46191b1f7f6 | 7.56 | 12 |
"""affidavit_pending_status_permissions
Revision ID: 0f310e71e51d
Revises: c10f494d7e10
Create Date: 2021-01-04 14:55:28.146682
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy import text
from sqlalchemy.sql import column, table
from auth_api.utils.custom_sql import CustomSql
# revision identif... | bcgov/sbc-auth | auth-api/migrations/versions/0f310e71e51d_affidavit_pending_status_permissions.py | .py | 7459eb6f0ef44990 | 7.56 | 12 |
"""org_api_access
Revision ID: 129eb4978d07
Revises: 2d71e7d7cc18
Create Date: 2021-03-26 13:09:16.230695
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '129eb4978d07'
down_revision = '2d71e7d7cc18'
branch_labels = None
depends_on = None
def upgrade():
#... | bcgov/sbc-auth | auth-api/migrations/versions/129eb4978d07_org_api_access.py | .py | 837cbbd761ebde44 | 7.56 | 12 |
"""Add in value for activity log.
Revision ID: 1344cb533815
Revises: 2229cbcaaa93
Create Date: 2022-07-05 06:08:52.217258
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1344cb533815'
down_revision = '2229cbcaaa93'
branch_labels = None
depends_on = None
def... | bcgov/sbc-auth | auth-api/migrations/versions/1344cb533815_.py | .py | 59bd541f2a257b0c | 7.56 | 12 |
"""migrating for prod
Revision ID: 18a4955730f9
Revises: 06c7acc047fa
Create Date: 2020-10-22 17:05:30.367190
"""
# revision identifiers, used by Alembic.
revision = '18a4955730f9'
down_revision = '06c7acc047fa'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - pl... | bcgov/sbc-auth | auth-api/migrations/versions/18a4955730f9_migrating_for_prod.py | .py | 1b6534aaa026b068 | 7.56 | 12 |
"""merge heads
Revision ID: 19a7733fd001
Revises: 8e87536494e9, b22ee0cd18ad
Create Date: 2021-04-06 08:00:50.128046
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '19a7733fd001'
down_revision = ('8e87536494e9', 'b22ee0cd18ad')
branch_labels = None
depends_on ... | bcgov/sbc-auth | auth-api/migrations/versions/19a7733fd001_merge_heads.py | .py | ae09daddac67497f | 7.06 | 12 |
"""keycloak_guid made nullable
Revision ID: 19ffc2fcc88c
Revises: 68e2f43b9d22
Create Date: 2020-03-24 10:36:57.439832
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '19ffc2fcc88c'
down_revision = '68e2f43b9d22'
branc... | bcgov/sbc-auth | auth-api/migrations/versions/19ffc2fcc88c_keycloak_guid_made_nullable.py | .py | 0c8777cd0c8dcdb5 | 7.56 | 12 |
"""permissons for activity log
Revision ID: 1a46fdc4d630
Revises: a0f0a77dc77f
Create Date: 2021-05-04 10:15:37.494139
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy import text
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import column, table
from auth_api.utils.custom_sql imp... | bcgov/sbc-auth | auth-api/migrations/versions/1a46fdc4d630_permissons_for_activity_log.py | .py | c48c45b346108fa9 | 7.56 | 12 |
"""Add in keycloak_group into product codes.
Revision ID: 501d1179b2f0
Revises: 7e3f009cb4ae
Create Date: 2023-03-25 01:20:37.334504
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '501d1179b2f0'
down_revision = '7e3f009cb4ae'
branch_labels = None
depends_on =... | bcgov/sbc-auth | auth-api/migrations/versions/2023_03_25_501d1179b2f0_.py | .py | 55bce46f51d4087a | 7.56 | 12 |
"""Retroactively fix Groups for orgs that have access to PPR / MHR
Revision ID: b8dc42f28583
Revises: 501d1179b2f0
Create Date: 2023-03-26 09:12:17.295671
"""
from alembic import op
from sqlalchemy import text
import sqlalchemy as sa
from flask import current_app
from auth_api.models import db
from auth_api.service... | bcgov/sbc-auth | auth-api/migrations/versions/2023_03_26_b8dc42f28583_.py | .py | a11653d54eea962b | 7.56 | 12 |
"""Add uuid column to orgs table.
Revision ID: d53a79e9cc89
Revises: b8dc42f28583
Create Date: 2023-07-04 10:52:47.771517
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import text
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "d53a79e9cc89"
down_... | bcgov/sbc-auth | auth-api/migrations/versions/2023_07_04_d53a79e9cc89_add_uuid_column_to_orgs_table.py | .py | 68ef1f62d9f706ea | 7.56 | 12 |
"""mhr_qualified_supplier
Revision ID: b20a33cb84f2
Revises: 13121bcf368a
Create Date: 2023-07-24 13:12:24.781629
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b20a33cb84f2'
down_revision = '13121bcf368a'
branch_labels = None
depends_on = None
def upgrade(... | bcgov/sbc-auth | auth-api/migrations/versions/2023_07_24_b20a33cb84f2_mhr_qualified_supplier.py | .py | 2e08356c56fb509a | 7.56 | 12 |
"""Add 'additional message' column to the Affiliation invitation table.
Revision ID: 27d53abf3f48
Revises: 746771099983
Create Date: 2023-07-26 15:47:32.875016
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import column, table, String, Boolean
# revision identifiers, used by Alembic.
revision = ... | bcgov/sbc-auth | auth-api/migrations/versions/2023_07_26_27d53abf3f48_add_additional_message_column_to_the_.py | .py | e624950c4c0b83f7 | 7.56 | 12 |
"""add_NDS_product_code
Revision ID: 746771099983
Revises: b20a33cb84f2
Create Date: 2023-08-03 16:07:51.025459
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '746771099983'
down_revision = 'b20a33cb84f2'
branch_labels = None
depends_on = None
def upgrade():
op.execute("INSERT ... | bcgov/sbc-auth | auth-api/migrations/versions/2023_08_03_746771099983_add_nds_product_code.py | .py | dcf034ffa16d3161 | 7.56 | 12 |
"""update_product_codes
Revision ID: 18823fc88aac
Revises: 27d53abf3f48
Create Date: 2023-08-08 16:18:52.498957
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '18823fc88aac'
down_revision = '27d53abf3f48'
branch_labels = None
depends_on = None
def upgrade():... | bcgov/sbc-auth | auth-api/migrations/versions/2023_08_08_18823fc88aac_update_product_codes.py | .py | 2816306cfecc0060 | 7.56 | 12 |
"""affiliation_invitations_to_org_nullable
Revision ID: 628b52a95bad
Revises: 27d53abf3f48
Create Date: 2023-08-08 11:12:40.149008
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '628b52a95bad'
down_revision = '18823fc88aac'
branch_labels = None
depends_on = No... | bcgov/sbc-auth | auth-api/migrations/versions/2023_08_08_628b52a95bad_affiliation_invitations_to_org_nullable.py | .py | 2706ea68fc10018b | 7.56 | 12 |
"""empty message
Revision ID: 0f7e04a673f7
Revises: 4a6eb0fcc93e
Create Date: 2023-09-29 23:30:47.445227
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0f7e04a673f7'
down_revision = '4a6eb0fcc93e'
branch_labels = None
depends_on = None
def upgrade():
# ... | bcgov/sbc-auth | auth-api/migrations/versions/2023_09_29_0f7e04a673f7_.py | .py | cc1f62c82718af2b | 7.56 | 12 |
"""18091-mhr-product-code-update
Revision ID: 9e8d6b3de6d5
Revises: 0f7e04a673f7
Create Date: 2023-10-10 07:36:07.599629
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9e8d6b3de6d5'
down_revision = '0f7e04a673f7'
branch_labels = None
depends_on = None
def u... | bcgov/sbc-auth | auth-api/migrations/versions/2023_10_10_9e8d6b3de6d5_18091_mhr_product_code_update.py | .py | 6ccb83f51bcb93fa | 7.56 | 12 |
"""Add in amalgamation corp type and extend receipient fields to 8k
Revision ID: 144d6e8bd4df
Revises: 9e8d6b3de6d5
Create Date: 2023-12-05 11:42:32.349688
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '144d6e8bd4df'
down_revision = '9e8d6b3de6d5'
branch_labels = None
depends_on = N... | bcgov/sbc-auth | auth-api/migrations/versions/2023_12_05_144d6e8bd4df_make_affiliation_field_larger_add_amag.py | .py | 14396705accd2200 | 7.56 | 12 |
"""19421 - Qualified supplier - allow product subscription request resubmission
Revision ID: e65cc8ab51cc
Revises: 144d6e8bd4df
Create Date: 2024-02-12 11:34:44.872779
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e65cc8ab51cc'
down_revision = '144d6e8bd4df'... | bcgov/sbc-auth | auth-api/migrations/versions/2024_02_12_e65cc8ab51cc_19421_MHR_resubmission.py | .py | 2f2e02563860d724 | 7.56 | 12 |
"""add_ca_search_product_code
Revision ID: 824f5ef280c6
Revises: e65cc8ab51cc
Create Date: 2024-04-19 15:02:21.899101
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '824f5ef280c6'
down_revision = 'e65cc8ab51cc'
branch_labels = None
depends_on = None
def upgr... | bcgov/sbc-auth | auth-api/migrations/versions/2024_04_19_824f5ef280c6_add_ca_search_product_code.py | .py | 8e8891f31b40b0ea | 7.56 | 12 |
"""CTMP message
Revision ID: 51524729b99c
Revises: 824f5ef280c6
Create Date: 2024-04-23 14:50:24.894593
"""
from alembic import op
from sqlalchemy import Boolean, String
from sqlalchemy.sql import column, table
# revision identifiers, used by Alembic.
revision = '51524729b99c'
down_revision = '824f5ef280c6'
branch_l... | bcgov/sbc-auth | auth-api/migrations/versions/2024_04_23_51524729b99c_.py | .py | 96454b20e6b55786 | 7.56 | 12 |
"""Add STRR product code
Revision ID: 17369fa9416d
Revises: 51524729b99c
Create Date: 2024-05-08 11:23:49.995943
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '17369fa9416d'
down_revision = '51524729b99c'
branch_labels = None
depends_on = None
def upgrade():
op.execute("INSERT... | bcgov/sbc-auth | auth-api/migrations/versions/2024_05_08_17369fa9416d_add_strr_product_code.py | .py | d3a54d7968781bcc | 7.56 | 12 |
"""empty message
Revision ID: e2d1d6417607
Revises: 17369fa9416d
Create Date: 2024-05-09 15:39:36.678009
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e2d1d6417607'
down_revision = '17369fa9416d'
branch_labels = None
depends_on = None
def upgrade():
op... | bcgov/sbc-auth | auth-api/migrations/versions/2024_05_09_e2d1d6417607_add_eft_overdue_suspension_code.py | .py | a9286a9fb7edc430 | 7.56 | 12 |
"""Add in new table for account mailer for pubsub message processing.
Revision ID: b3a741249edc
Revises: e2d1d6417607
Create Date: 2024-05-15 14:52:45.780399
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b3a741249edc'
down_revision = 'e2d1d6417607'
branch_la... | bcgov/sbc-auth | auth-api/migrations/versions/2024_05_15_b3a741249edc_duplicate_queue_messages.py | .py | b2ddaad449a0142f | 7.56 | 12 |
"""add_business_and_government_flags_and_remove_rows
Revision ID: 1e4b6359f470
Revises: b3a741249edc
Create Date: 2024-05-23 10:18:59.135894
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1e4b6359f470'
down_revision = 'b3a741249edc'
branch_labels = None
depen... | bcgov/sbc-auth | auth-api/migrations/versions/2024_05_23_1e4b6359f470_add_flag_business_type_codes.py | .py | 6040b83b829bdc13 | 7.56 | 12 |
"""Add EFT PAD to suspension_reason_code
Revision ID: 41fa6588c76e
Revises: 1e4b6359f470
Create Date: 2024-05-29 10:36:53.016963
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '41fa6588c76e'
down_revision = '1e4b6359f470'
branch_labels = None
depends_on = None... | bcgov/sbc-auth | auth-api/migrations/versions/2024_05_29_41fa6588c76e_add_eft_pad_to_suspension_reason_code.py | .py | 2cb9aceb9abfb9c5 | 7.56 | 12 |
"""add view address permission to admin
Revision ID: 39b4f331c003
Revises: 41fa6588c76e
Create Date: 2024-05-30 20:21:15.422128
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '39b4f331c003'
down_revision = '41fa6588c76e'
branch_labels = None
depends_on = None
... | bcgov/sbc-auth | auth-api/migrations/versions/2024_05_30_39b4f331c003_admin_view_address_permission.py | .py | 3f420eb70b668c2c | 7.56 | 12 |
"""remove GOVM from business_type_codes
Revision ID: 7bf8428e568e
Revises: 39b4f331c003
Create Date: 2024-06-05 15:43:49.638951
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7bf8428e568e'
down_revision = '39b4f331c003'
branch_labels = None
depends_on = None
... | bcgov/sbc-auth | auth-api/migrations/versions/2024_06_05_7bf8428e568e_remove_govm_business_type_codes.py | .py | 6f24b5f16acafe9d | 7.56 | 12 |
"""remove EFT_NSF from suspension_reason_codes
Revision ID: acc7e2e2c2d7
Revises: 7bf8428e568e
Create Date: 2024-06-24 12:41:33.684863
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'acc7e2e2c2d7'
down_revision = '7bf8428e568e'
branch_labels = None
depends_on ... | bcgov/sbc-auth | auth-api/migrations/versions/2024_06_24_acc7e2e2c2d7_remove_eft_nsf_from_suspension_reason_.py | .py | a376f3b9338136b2 | 7.56 | 12 |
"""Add in new products for BCFMS, BCRHP
Revision ID: af98933abe93
Revises: acc7e2e2c2d7
Create Date: 2024-06-26 14:46:57.699068
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'af98933abe93'
down_revision = 'acc7e2e2c2d7'
branch_labels = None
depends_on = None... | bcgov/sbc-auth | auth-api/migrations/versions/2024_06_26_af98933abe93_add_partner_codes.py | .py | 465abeb5220dd54a | 7.56 | 12 |
#!/bin/env python3
# Objective:
# - Identify pool as individual vs clusters without relying on self-declared elections
# (which can easily be rigged using social nuances) from more than one source
# - Have strict tolerance: This may mean that a pool whose metadata is updated might take
# a bit to show up due to the... | cardano-community/pool_groups | update_pools.py | .py | ed515ac9a392987b | 7.52 | 10 |
# SPDX-FileCopyrightText: 2017-2020 Snoonet
# SPDX-FileCopyrightText: 2020-present linuxdaemon <linuxdaemon.irc@gmail.com>
#
# SPDX-License-Identifier: MIT
"""Basic asyncio.Protocol interface for IRC connections."""
import asyncio
import base64
import random
import socket
import time
from asyncio import Protocol, Tas... | TotallyNotRobots/async-irc | asyncirc/protocol.py | .py | 2dfb24f4d475b124 | 7.5 | 9 |
# SPDX-FileCopyrightText: 2017-2020 Snoonet
# SPDX-FileCopyrightText: 2020-present linuxdaemon <linuxdaemon.irc@gmail.com>
#
# SPDX-License-Identifier: MIT
"""Provides a Delayer object for delaying repeated calls e.g. server connections."""
import asyncio
import random
from collections.abc import Callable
__all__ = ... | TotallyNotRobots/async-irc | asyncirc/util/backoff.py | .py | fadd8f8924bb3d78 | 7.5 | 9 |
from collections import defaultdict
from collections.abc import Iterable
from typing import Any
import roman
from ....models.models import AgendaItem
def to_roman(number: int) -> str:
"""
Converts an arabic number within range from 1 to 4999 to the
corresponding roman number. Returns the input converted... | OpenSlides/openslides-backend | openslides_backend/action/actions/agenda_item/agenda_tree.py | .py | a27a4c8979aa89c9 | 7.5 | 9 |
from typing import Any
from ....models.models import AgendaItem
from ....permissions.permissions import Permissions
from ....shared.filters import And, FilterOperator
from ....shared.patterns import fqid_from_collection_and_id
from ...mixins.create_action_with_inferred_meeting import (
CreateActionWithInferredMeet... | OpenSlides/openslides-backend | openslides_backend/action/actions/agenda_item/create.py | .py | 265905a97efcab83 | 7.5 | 9 |
from typing import Any
from ....models.models import AgendaItem
from ....permissions.permissions import Permissions
from ....shared.patterns import (
collection_from_fqid,
fqid_from_collection_and_id,
id_from_fqid,
)
from ...generics.delete import DeleteAction
from ...util.default_schema import DefaultSche... | OpenSlides/openslides-backend | openslides_backend/action/actions/agenda_item/delete.py | .py | c5a321be1172206c | 7.5 | 9 |
from openslides_backend.services.database.commands import GetManyRequest
from ....models.models import AgendaItem
from ....permissions.permissions import Permissions
from ....shared.patterns import fqid_from_collection_and_id
from ...generics.update import UpdateAction
from ...mixins.singular_action_mixin import Singu... | OpenSlides/openslides-backend | openslides_backend/action/actions/agenda_item/numbering.py | .py | db829462a5c3aff3 | 7.5 | 9 |
from ....models.models import AgendaItem
from ....permissions.permissions import Permissions
from ...generics.update import UpdateAction
from ...mixins.singular_action_mixin import SingularActionMixin
from ...mixins.tree_sort_mixin import TreeSortMixin
from ...util.default_schema import DefaultSchema
from ...util.regis... | OpenSlides/openslides-backend | openslides_backend/action/actions/agenda_item/sort.py | .py | 61a1a8ea663e721c | 7.5 | 9 |
from ....models.models import Assignment, AssignmentCandidate
from ....permissions.permissions import Permissions
from ....shared.filters import And, FilterOperator
from ...generics.update import UpdateAction
from ...mixins.linear_sort_mixin import LinearSortMixin
from ...mixins.singular_action_mixin import SingularAct... | OpenSlides/openslides-backend | openslides_backend/action/actions/assignment_candidate/sort.py | .py | 9ea8a61f5b09afdf | 7.5 | 9 |
from ....models.models import ChatGroup
from ....permissions.permissions import Permissions
from ....shared.patterns import fqid_from_collection_and_id
from ...generics.update import UpdateAction
from ...util.default_schema import DefaultSchema
from ...util.register import register_action
from ...util.typing import Act... | OpenSlides/openslides-backend | openslides_backend/action/actions/chat_group/clear.py | .py | d08f485dffe36cc1 | 7.5 | 9 |
from typing import Any
from ....models.models import ChatGroup
from ....permissions.permissions import Permissions
from ...generics.create import CreateAction
from ...mixins.forbid_anonymous_group_mixin import ForbidAnonymousGroupMixin
from ...mixins.weight_mixin import WeightMixin
from ...util.default_schema import D... | OpenSlides/openslides-backend | openslides_backend/action/actions/chat_group/create.py | .py | 0a335351defcba14 | 7.5 | 9 |
from ....models.models import ChatGroup
from ....permissions.permissions import Permissions
from ....shared.filters import FilterOperator
from ...generics.update import UpdateAction
from ...mixins.linear_sort_mixin import LinearSortMixin
from ...mixins.singular_action_mixin import SingularActionMixin
from ...util.defau... | OpenSlides/openslides-backend | openslides_backend/action/actions/chat_group/sort.py | .py | 73f42a9e618ac60a | 7.5 | 9 |
from typing import Any
from ....models.models import ChatGroup
from ....permissions.permissions import Permissions
from ...generics.update import UpdateAction
from ...mixins.forbid_anonymous_group_mixin import ForbidAnonymousGroupMixin
from ...util.default_schema import DefaultSchema
from ...util.register import regis... | OpenSlides/openslides-backend | openslides_backend/action/actions/chat_group/update.py | .py | 53ebed13d67219af | 7.5 | 9 |
from typing import Any
from ....models.models import ChatMessage
from ....shared.exceptions import PermissionDenied
from ....shared.patterns import fqid_from_collection_and_id
from ...generics.update import UpdateAction
from ...util.default_schema import DefaultSchema
from ...util.register import register_action
@re... | OpenSlides/openslides-backend | openslides_backend/action/actions/chat_message/update.py | .py | 5482e938c2a6eb4a | 7.5 | 9 |
import os
import random
import re
# Base directory containing markdown files
TARGET_DIR = "./Success"
OUTPUT_FILE = "./daily_random_link.md" # File to save the random link
def extract_links_from_file(filepath):
"""Extract Markdown links from a file."""
with open(filepath, 'r', encoding='utf-8') as file:
... | kantarcise/notebook | .github/scripts/generate_random_link.py | .py | 2bbadd1b6512a58c | 7.48 | 8 |
"""
Given the roots of two binary trees p and q, write
a function to check if they are the same or not.
Two binary trees are considered the same if they
are structurally identical, and the nodes have
the same value.
Example 1:
Input: p = [1,2,3], q = [1,2,3]
Output: true
Example 2:
Input: p = [1,2], q = [1,null... | kantarcise/notebook | Leet_Code/easy/100_Same_Tree.py | .py | ef5307057df39d8a | 7.48 | 8 |
"""
Given a fixed-length integer array arr, duplicate
each occurrence of zero, shifting the remaining
elements to the right.
Note that elements beyond the length of the original
array are not written. Do the above modifications to
the input array in place and do not return anything.
Example 1:
Input: arr = [1,0,... | kantarcise/notebook | Leet_Code/easy/1089_Duplicate_Zeros.py | .py | a94355c55e4ff4fd | 7.48 | 8 |
"""
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest
path from the root node down to the nearest leaf node.
Note: A leaf is a node with no children.
Example 1:
Input: root = [3,9,20,null,null,15,7]
Output: 2
Example 2:
Input: root = [2,null,3,null,4,null,5,... | kantarcise/notebook | Leet_Code/easy/111_Minimum_Depth_of_Binary_Tree.py | .py | 09c081a79648dfb8 | 7.48 | 8 |
"""
Given the root of a binary tree and an integer targetSum, return true
if the tree has a root-to-leaf path such that adding up all the values
along the path equals targetSum.
A leaf is a node with no children.
Example 1:
Input: root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22
Output: true
Expla... | kantarcise/notebook | Leet_Code/easy/112_path_sum.py | .py | 1b8f9d31eb526132 | 7.48 | 8 |
"""
The Tribonacci sequence Tn is defined as follows:
T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0.
Given n, return the value of Tn.
Example 1:
Input: n = 4
Output: 4
Explanation:
T_3 = 0 + 1 + 1 = 2
T_4 = 1 + 1 + 2 = 4
Example 2:
Input: n = 25
... | kantarcise/notebook | Leet_Code/easy/1137_N-th_Tribonacci_Number.py | .py | 123e8b424293043a | 7.48 | 8 |
"""
Given a string date representing a Gregorian
calendar date formatted as YYYY-MM-DD, return the
day number of the year.
Example 1:
Input: date = "2019-01-09"
Output: 9
Explanation:
Given date is the 9th day of the year in 2019.
Example 2:
Input: date = "2019-02-10"
Output: 41
Con... | kantarcise/notebook | Leet_Code/easy/1154_Day_of_the_Year.py | .py | aaf362205045450c | 7.48 | 8 |
"""
Given an integer numRows, return the first
numRows of Pascal's triangle.
In Pascal's triangle, each number is the sum of the
two numbers directly above it as shown:
Example 1:
Input: numRows = 5
Output: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]
Example 2:
Input: numRows = 1
Output: ... | kantarcise/notebook | Leet_Code/easy/118_Pascals_Triangle.py | .py | a8e98b9b84b2befa | 7.48 | 8 |
"""
A phrase is a palindrome if, after converting all uppercase
letters into lowercase letters and removing all
non-alphanumeric characters, it reads the same forward
and backward.
Alphanumeric characters include letters and numbers.
Given a string s, return true if it is a palindrome, or false otherwise.
Exampl... | kantarcise/notebook | Leet_Code/easy/125_Valid_Palindrome.py | .py | fedf363ce9d96645 | 7.48 | 8 |
"""
Given an array nums of integers, return how many of
them contain an even number of digits.
Example 1:
Input: nums = [12,345,2,6,7896]
Output: 2
Explanation:
12 contains 2 digits (even number of digits).
345 contains 3 digits (odd number of digits).
2 contains 1 digit (odd number of digits).
6 conta... | kantarcise/notebook | Leet_Code/easy/1295_Find_Numbers_with_Even_Number_of_Digits.py | .py | b2e0b425082179ef | 7.48 | 8 |
"""
Given an array arr, replace every element in that array with the
greatest element among the elements to its right, and
replace the last element with -1.
After doing so, return the array.
Example 1:
Input: arr = [17,18,5,4,6,1]
Output: [18,6,6,6,1,-1]
Explanation:
- index 0 --> the greatest... | kantarcise/notebook | Leet_Code/easy/1299_Replace_Elements_with_Greatest_Element_on_Right_Side.py | .py | c35e42a93b3e9237 | 7.98 | 8 |
"""
Given an array arr of integers, check if there exist
two indices i and j such that :
i != j
0 <= i, j < arr.length
arr[i] == 2 * arr[j]
Example 1:
Input: arr = [10,2,5,3]
Output: true
Explanation: For i = 0 and j = 2,
arr[i] == 10 == 2 * 5 == 2 * arr[j]
Example 2:
... | kantarcise/notebook | Leet_Code/easy/1346_Check_If_N_and_Its_Double_Exist.py | .py | 0167809d51671ea5 | 7.48 | 8 |
"""
Roman numerals are represented by seven
different symbols:
I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, 2 is written as II in Roman numeral, just
two ones added together.
12 is... | kantarcise/notebook | Leet_Code/easy/13_Roman_to_Integer.py | .py | f8d3fe5ce383b3f1 | 7.48 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.