repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_main.py | tests/test_main.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_c7nlib.py | tests/test_c7nlib.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_transpilation.py | tests/test_transpilation.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_c7n_to_cel.py | tests/test_c7n_to_cel.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_package.py | tests/test_package.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/benches/complex_expression.py | benches/complex_expression.py | """
https://github.com/cloud-custodian/cel-python/issues/68
Performance of the given expression is perfectly awful.
What can be done to make it better?
"""
import timeit
import cProfile
import pstats
from textwrap import dedent
import celpy
import celpy.celtypes
CEL_EXPRESSION_ORIGINAL = """
(
(
!has(cl... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/benches/large_resource_set.py | benches/large_resource_set.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/features/environment.py | features/environment.py | """
Environment definition for Behave acceptance test suite.
"""
from functools import partial
import os
from types import SimpleNamespace
from unittest.mock import Mock, patch
import celpy.c7nlib
def mock_text_from(context, url):
"""
Mock for :py:func:`celpy.c7nlib.text_from` that replaces a URL-based requ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/features/steps/c7n_integration.py | features/steps/c7n_integration.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/features/steps/integration_binding.py | features/steps/integration_binding.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/features/steps/cli_binding.py | features/steps/cli_binding.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/docs/source/conf.py | docs/source/conf.py | # Copyright 2020 The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/demo/celdemo.py | demo/celdemo.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# 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
#
# ... | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/run.py | run.py | from application import create_app
# from dotenv import load_dotenv
# load_dotenv(dotenv_path='.flaskenv')
app = create_app()
def main():
app.run()
if __name__ == '__main__':
main()
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/application.py | application.py | from flask import Flask
from extensions.routes_extension import register_routes
from extensions.injector_extension import register_dependency_injection
from extensions.exception_extension import register_exception_handler
def create_app():
app = Flask(__name__)
# will move to register_config soon
app.co... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/__init__.py | apps/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account_v1.py | apps/api/account_v1.py | from flask import Blueprint
from flask_restplus import Api
from werkzeug.exceptions import HTTPException
from .account.controllers.security import api as security_api
blueprint = Blueprint('account_api', __name__, url_prefix='/account/v1')
api = Api(blueprint,
doc='/doc/',
title='Resource API - A... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile_v1.py | apps/api/profile_v1.py | from flask import Blueprint
from flask_restplus import Api
from werkzeug.exceptions import HTTPException
from .profile.controllers.avatar import api as avatar_api
from .profile.controllers.member import api as member_api
from .profile.controllers.search import api as search_api
blueprint = Blueprint('profile_api', __... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/__init__.py | apps/api/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account/__init__.py | apps/api/account/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account/controllers/security.py | apps/api/account/controllers/security.py | from flask_restplus import Namespace, Resource
from extensions.log_extension import get_logger
api = Namespace('security', description='Security Endpoints')
logger = get_logger(__name__)
@api.route('/authorize')
class Authorize(Resource):
@api.doc('Authorize Requests')
def get(self):
logger.info('au... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account/controllers/__init__.py | apps/api/account/controllers/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account/adapters/__init__.py | apps/api/account/adapters/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account/adapters/presenters/__init__.py | apps/api/account/adapters/presenters/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account/adapters/validators/__init__.py | apps/api/account/adapters/validators/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account/adapters/response/__init__.py | apps/api/account/adapters/response/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/account/adapters/request/__init__.py | apps/api/account/adapters/request/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/__init__.py | apps/api/profile/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/controllers/search.py | apps/api/profile/controllers/search.py | from flask_restplus import Resource
from apps.api.profile.controllers import search_api as api
@api.route('/member')
class MemberSearch(Resource):
@api.doc('Search Member')
def post(self):
return ['search member']
@api.route('/newcomer')
class NewcomerSearch(Resource):
@api.doc('Search Newcomer... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/controllers/member.py | apps/api/profile/controllers/member.py | from flask_restplus import Resource
from injector import inject
from apps.api.profile.adapters.presenters.profile_presenter import GetUserProfilePresenter
from apps.api.profile.adapters.response.profile_response import member_profile
from apps.api.profile.controllers import member_api as api
from apps.shared.global_ex... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/controllers/__init__.py | apps/api/profile/controllers/__init__.py | from flask_restplus import Namespace
avatar_api = Namespace('avatar', description='Avatar Image Endpoints')
member_api = Namespace('member', description='Member Resource Endpoints')
search_api = Namespace('search', description='Profile Search Endpoints')
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/controllers/avatar.py | apps/api/profile/controllers/avatar.py | from flask_restplus import Resource
from apps.api.profile.controllers import avatar_api as api
@api.route('/')
class AvatarList(Resource):
@api.doc('Upload Avatar Image')
def post(self):
return ['avatar_post']
@api.route('/<string:avatar_id>')
class Avatar(Resource):
@api.doc('Get Avatar Image'... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/adapters/__init__.py | apps/api/profile/adapters/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/adapters/presenters/profile_presenter.py | apps/api/profile/adapters/presenters/profile_presenter.py | from apps.shared.global_exception import NotFoundError
from core.domain.profile.use_case.get_user_profile import GetUserProfileResponse
from core.kernel.exception import BaseNotFoundException
from core.kernel.port import JsonContentResult
from core.kernel.use_case import UseCaseOutputPort
class GetUserProfilePresent... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/adapters/presenters/__init__.py | apps/api/profile/adapters/presenters/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/adapters/validators/__init__.py | apps/api/profile/adapters/validators/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/adapters/response/profile_response.py | apps/api/profile/adapters/response/profile_response.py | from flask_restplus import fields
from apps.api.profile.controllers import member_api
entity = member_api.model('Entity', {
'id': fields.Integer
})
basic_profile = member_api.model('BasicProfile', {
'real_name': fields.String,
'gender': fields.String,
# 'birthday': fields.String
})
extra_profile = m... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/adapters/response/__init__.py | apps/api/profile/adapters/response/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/adapters/request/profile_request.py | apps/api/profile/adapters/request/profile_request.py | from flask_restplus import fields
from apps.api.profile.controllers import member_api
member_id_request = member_api.model('MemberIdRequest', {
'id': fields.Integer
})
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/api/profile/adapters/request/__init__.py | apps/api/profile/adapters/request/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/shared/global_exception.py | apps/shared/global_exception.py | from werkzeug.exceptions import (
HTTPException,
BadRequest,
NotFound
)
class CustomError(HTTPException):
""" Custom Error Exception """
code = 409
description = "custom error"
class BadRequestError(BadRequest):
""" Wrap BadRequest Exception """
class NotFoundError(NotFound):
""" W... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/apps/shared/__init__.py | apps/shared/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/routes_extension.py | extensions/routes_extension.py | from apps.api.account_v1 import blueprint as account_api
from apps.api.profile_v1 import blueprint as profile_api
def register_routes(app):
"""
Register routes with blueprint and namespace
"""
app.register_blueprint(account_api)
app.register_blueprint(profile_api)
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/config_extension.py | extensions/config_extension.py | from config import configurations
def register_config(app):
pass
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/hooks_extension.py | extensions/hooks_extension.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/log_extension.py | extensions/log_extension.py | import logging
FORMAT = '%(asctime)-15s %(name)s %(levelname)-8s %(message)s'
logging.basicConfig(format=FORMAT)
def get_logger(name):
logger = logging.getLogger(name)
return logger
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/injector_extension.py | extensions/injector_extension.py | from flask_injector import FlaskInjector
from injector import singleton, Binder
from core.domain.profile.repository.profile_repository import ProfileRepository
from core.domain.profile.use_case.get_user_profile import GetUserProfileUseCase
from infra.sql.profile.repository.sql_profile_repository import SqlProfileRepos... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/oidc_extension.py | extensions/oidc_extension.py | from authlib.integrations.flask_oauth2 import AuthorizationServer, ResourceProtector
from authlib.oauth2.rfc6749.grants import AuthorizationCodeGrant as _AuthorizationCodeGrant
from authlib.oidc.core import UserInfo
from authlib.oidc.core.grants import (
OpenIDCode as _OpenIDCode,
OpenIDImplicitGrant as _OpenID... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/__init__.py | extensions/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/database_extension.py | extensions/database_extension.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/extensions/exception_extension.py | extensions/exception_extension.py | from werkzeug.exceptions import HTTPException
def handle_global_error(error: HTTPException):
""" Make JSON Error Response instead of Web Page """
response = {
'error': error.__class__.__name__,
'message': error.description,
}
return response, error.code
def register_exception_handler... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/tests/__init__.py | tests/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/__init__.py | infra/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/mock/__init__.py | infra/mock/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/mock/repository.py | infra/mock/repository.py | from typing import List
from core.domain.profile.entity.profile import (
UserBasicProfile, EducationExtraProfile, CareerExtraProfile, UserExtraProfile
)
from core.domain.profile.entity.user import User, Member, Newcomer
from core.domain.profile.exception import UserNotFound
from core.domain.profile.repository.prof... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/sql/__init__.py | infra/sql/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/sql/account/orm.py | infra/sql/account/orm.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/sql/account/__init__.py | infra/sql/account/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/sql/account/repository/__init__.py | infra/sql/account/repository/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/sql/profile/orm.py | infra/sql/profile/orm.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/sql/profile/__init__.py | infra/sql/profile/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/sql/profile/repository/sql_profile_repository.py | infra/sql/profile/repository/sql_profile_repository.py | from typing import List
from core.domain.profile.entity.profile import (
UserBasicProfile, EducationExtraProfile, CareerExtraProfile, UserExtraProfile
)
from core.domain.profile.entity.user import User, Member, Newcomer
from core.domain.profile.exception import UserNotFound
from core.domain.profile.repository.prof... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/infra/sql/profile/repository/__init__.py | infra/sql/profile/repository/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/__init__.py | core/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/kernel/exception.py | core/kernel/exception.py | import attr
@attr.s(auto_attribs=True)
class UseCaseException(Exception):
""" Base UseCase Error """
message: str = None
@attr.s(auto_attribs=True)
class BaseNotFoundException(UseCaseException):
""" Base Not Found Exception Abstraction """
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/kernel/port.py | core/kernel/port.py | from abc import ABC, abstractmethod
from typing import TypeVar, Generic, Dict, Any
import attr
import cattr
from .exception import UseCaseException
T = TypeVar('T')
@attr.s(auto_attribs=True)
class UseCaseRequest(ABC):
""" Base UseCase Request """
@attr.s(auto_attribs=True)
class UseCaseResponse(object):
... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/kernel/__init__.py | core/kernel/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/kernel/entity.py | core/kernel/entity.py | from uuid import uuid4, UUID
import attr
@attr.s(auto_attribs=True)
class Entity(object):
""" Int ID Entity """
id: int = None
@attr.s(auto_attribs=True)
class UuidEntity(object):
""" UUID Entity """
id: UUID = uuid4()
@attr.s(auto_attribs=True)
class ValueObject(object):
""" Value Object """... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/kernel/use_case.py | core/kernel/use_case.py | from abc import ABC, abstractmethod
from .port import UseCaseRequest, UseCaseResponse, UseCaseOutputPort
class UseCase(ABC):
@abstractmethod
def execute(self, uc_request: UseCaseRequest, uc_output_port: UseCaseOutputPort[UseCaseResponse]) -> None:
return NotImplemented
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/kernel/repository.py | core/kernel/repository.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/__init__.py | core/domain/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/account/__init__.py | core/domain/account/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/account/repository/authorize_repository.py | core/domain/account/repository/authorize_repository.py | from abc import ABC, abstractmethod
class AuthorizeRepository(ABC):
@abstractmethod
def get_user(self):
return NotImplemented
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/account/repository/__init__.py | core/domain/account/repository/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/account/entity/__init__.py | core/domain/account/entity/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/account/use_case/authorize_user.py | core/domain/account/use_case/authorize_user.py | from core.kernel.use_case import UseCase
from core.kernel.port import UseCaseRequest, UseCasePresenter
from core.domain.account.repository.authorize_repository import AuthorizeRepository
class AuthorizeUser(UseCase):
_auth_repo = None
def __init__(self, auth_repo: AuthorizeRepository):
self._auth_re... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/account/use_case/__init__.py | core/domain/account/use_case/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/exception.py | core/domain/profile/exception.py | import attr
from core.kernel.exception import BaseNotFoundException
@attr.s(auto_attribs=True)
class UserNotFound(BaseNotFoundException):
""" User Not Found Exception """
message: str = "User Not Found"
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/__init__.py | core/domain/profile/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/repository/__init__.py | core/domain/profile/repository/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/repository/profile_repository.py | core/domain/profile/repository/profile_repository.py | from abc import ABC, abstractmethod
from typing import List
from core.domain.profile.entity.user import User, UserBasicProfile, UserExtraProfile
class ProfileRepository(ABC):
@abstractmethod
def get_user(self, user_type: str, user_id: int) -> User:
return NotImplemented
@abstractmethod
def ... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/entity/profile.py | core/domain/profile/entity/profile.py | import attr
from datetime import date
from core.kernel.entity import ValueObject
@attr.s(auto_attribs=True)
class UserBasicProfile(ValueObject):
""" User Basic Profile """
real_name: str = None
gender: str = None
birthday: str = None
@attr.s(auto_attribs=True)
class UserExtraProfile(ValueObject):
... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/entity/user.py | core/domain/profile/entity/user.py | import attr
from typing import List
from core.kernel.entity import Entity
from .profile import UserBasicProfile, UserExtraProfile
@attr.s(auto_attribs=True)
class User(Entity):
""" Base User Entity """
user_type: str = None
user_name: str = None
user_status: str = "enabled"
basic_profile: UserBas... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/entity/__init__.py | core/domain/profile/entity/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/use_case/get_user_profile.py | core/domain/profile/use_case/get_user_profile.py | import attr
from injector import inject
from core.domain.profile.exception import UserNotFound
from core.domain.profile.repository.profile_repository import ProfileRepository
from core.kernel.port import UseCaseRequest, UseCaseResponse, UseCaseOutputPort
from core.kernel.use_case import UseCase
@attr.s(auto_attribs=... | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/core/domain/profile/use_case/__init__.py | core/domain/profile/use_case/__init__.py | python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false | |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/config/base_config.py | config/base_config.py | """Flask config class."""
import os
class BaseConfig:
"""Base config vars."""
SECRET_KEY = os.environ.get('SECRET_KEY')
SESSION_COOKIE_NAME = os.environ.get('SESSION_COOKIE_NAME')
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/config/prod_config.py | config/prod_config.py | """Flask config class."""
import os
from .base_config import BaseConfig
class ProductionConfig(BaseConfig):
DEBUG = False
TESTING = False
DATABASE_URI = os.environ.get('PROD_DATABASE_URI')
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/config/__init__.py | config/__init__.py | from .prod_config import ProductionConfig
from .dev_config import DevelopmentConfig
configurations = {
'production': ProductionConfig,
'development': DevelopmentConfig,
'default': DevelopmentConfig
}
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
chonhan/flask_restapi_clean_architecture | https://github.com/chonhan/flask_restapi_clean_architecture/blob/539994825013d45712817da72dd96e0c6f8ee56b/config/dev_config.py | config/dev_config.py | """Flask config class."""
import os
from .base_config import BaseConfig
class ProductionConfig(BaseConfig):
DEBUG = False
TESTING = False
DATABASE_URI = os.environ.get('PROD_DATABASE_URI')
| python | MIT | 539994825013d45712817da72dd96e0c6f8ee56b | 2026-01-05T07:13:07.327713Z | false |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/setup.py | setup.py | from setuptools import setup, find_packages
setup(name='safekit',
version=1.0,
description='Neural Network Anomaly Detection for Multivariate Sequences',
url='http://aarontuor.site',
author='Aaron Tuor, Ryan Baerwolf, Robin Cosbey, Nick Knowles',
author_email='aaron.tuor@pnnl.gov',
... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | false |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/graph_training_utils.py | safekit/graph_training_utils.py | """
Utilities for training the parameters of tensorflow computational graphs.
"""
import tensorflow as tf
import sys
import math
OPTIMIZERS = {'grad': tf.train.GradientDescentOptimizer, 'adam': tf.train.AdamOptimizer}
class EarlyStop:
"""
A class for determining when to stop a training while loop by a bad c... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | false |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/util.py | safekit/util.py | """
Python and numpy functions.
"""
from tf_ops import softmax_dist_loss, diag_mvn_loss, full_mvn_loss
import numpy as np
import argparse
def make_feature_spec(dataspec):
"""
Makes lists of all the continuous and categorical features to be used as input features of a neural network.
:param dataspec: (dic... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | false |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/__init__.py | safekit/__init__.py | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | false | |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/batch.py | safekit/batch.py | """
Module for mini-batching data.
"""
# TODO: Make skipping header argument consistent (numpy style skiprows) for all batchers.
# TODO: Make arguments for all batchers as consistent as possible.
# TODO: Look at Replay batcher and try to fix behavior of replay DNN. If fixed combine replay batcher with OnlineBatcher.
# ... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | true |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/tf_ops.py | safekit/tf_ops.py | """
Functions for building tensorflow computational graph models.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import os
import sys
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import nn
from tensorflow.python.fr... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | true |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/models/simple_lm.py | safekit/models/simple_lm.py | """
Simple language model code for network modeling.
File name convention:
---------------------
- lr: learnrate for gradient descent
- nl: number of stacked lstm layers
- hs: size of hidden layers (presumes all layers have same number of hidden units)
- mb: Size of mini-batch
- bc: max bad count for early stopping
-... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | false |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/models/tiered_lm.py | safekit/models/tiered_lm.py | #!/usr/bin/env python
"""
This is a two tiered language model for anomaly detection, where the second tier LSTM (log line level)
takes the concatenation of the average sentence vector and final hidden state
from the lower tier (token level) LSTM as input, creating a new context vector and hidden state
for the given us... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | false |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/models/pca_autoencoder.py | safekit/models/pca_autoencoder.py | """Principal Components Analysis autoencoder baseline"""
import numpy as np
from sklearn.decomposition import PCA
from sklearn.preprocessing import scale
import argparse
class Batcher:
"""
For batching data too large to fit into memory. Written for one pass on data!!!
"""
def __init__(self, datafile... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | false |
pnnl/safekit | https://github.com/pnnl/safekit/blob/92c004bc72f1480a4f9b26d304a900cbc8dea48d/safekit/models/svm.py | safekit/models/svm.py | """One class support vector machine baseline
"""
import sys
import os
cyberpath = '/'.join(os.path.realpath(__file__).split('/')[:-3])
sys.path.insert(0, cyberpath)
import argparse
from sklearn.svm import OneClassSVM
from safekit.batch import DayBatcher
import time
from safekit.util import apr
def return_parser():
... | python | MIT | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | 2026-01-05T07:13:08.019988Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.