Skip to content

Commit

Permalink
fixed pycodestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Acribbs committed Oct 29, 2024
1 parent ef8dc7f commit 6a883bf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cgatcore/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
integration with AWS S3.
"""


# Import existing pipeline functionality
from cgatcore.pipeline.control import *
from cgatcore.pipeline.database import *
Expand All @@ -19,6 +20,7 @@
from cgatcore.pipeline.utils import *
from cgatcore.pipeline.parameters import *


# Import original Ruffus decorators
from ruffus import (
transform,
Expand All @@ -28,53 +30,65 @@
follows
)


# Lazy-load S3-related classes and functions through the cgatcore instance
from cgatcore import cgatcore


# Helper function to access S3Pipeline instance lazily
def get_s3_pipeline():
"""Instantiate and return the S3Pipeline instance, lazy-loaded to avoid circular imports."""
return cgatcore.remote.file_handler.S3Pipeline()


# Define S3-aware decorators as properties, accessed only when needed
s3_pipeline = None


def s3_transform(*args, **kwargs):
global s3_pipeline
if s3_pipeline is None:
s3_pipeline = get_s3_pipeline()
return s3_pipeline.s3_transform(*args, **kwargs)


def s3_merge(*args, **kwargs):
global s3_pipeline
if s3_pipeline is None:
s3_pipeline = get_s3_pipeline()
return s3_pipeline.s3_merge(*args, **kwargs)


def s3_split(*args, **kwargs):
global s3_pipeline
if s3_pipeline is None:
s3_pipeline = get_s3_pipeline()
return s3_pipeline.s3_split(*args, **kwargs)


def s3_originate(*args, **kwargs):
global s3_pipeline
if s3_pipeline is None:
s3_pipeline = get_s3_pipeline()
return s3_pipeline.s3_originate(*args, **kwargs)


def s3_follows(*args, **kwargs):
global s3_pipeline
if s3_pipeline is None:
s3_pipeline = get_s3_pipeline()
return s3_pipeline.s3_follows(*args, **kwargs)


# Expose S3Mapper and configuration function through lazy loading
def s3_mapper():
return get_s3_pipeline().s3


def configure_s3(*args, **kwargs):
return get_s3_pipeline().configure_s3(*args, **kwargs)


# Update __all__ to include both standard and S3-aware decorators and functions
__all__ = [
'transform', 'merge', 'split', 'originate', 'follows',
Expand Down

0 comments on commit 6a883bf

Please sign in to comment.