Skip to content

Commit

Permalink
feat: added max size in cache
Browse files Browse the repository at this point in the history
  • Loading branch information
dmartmillan committed Feb 18, 2022
1 parent 7217cab commit cea8e48
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions openvariant/annotation/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ def _static_process(x: StaticBuilder, original_header: List = [] or None, file_p

def _internal_process(x: InternalBuilder, original_header = List or None, file_path: str = None, annotation: dict = None) \
-> InternalProcess:
"""Get a Internal value
It will return a InternalProcess describing the value to get from static annotation.
Parameters
----------
x : StaticBuilder
Annotation builder.
Returns
-------
str
Annotation type
float or int or str
Fixed value
Callable
Function to execute on the fixed value
"""
field_pos = None
try:
for i, h in enumerate(original_header):
Expand Down
2 changes: 1 addition & 1 deletion openvariant/variant/variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _extract_header(file_path: str, original_header: list, annotation: Annotatio
return header_schema, annotation.columns


@lru_cache
@lru_cache(maxsize=256)
def _parse_field(value: float or int or str, func: Callable) -> str:
"""Getting the value of a specific annotation field. Cached with LRU policy"""
return func(value)
Expand Down

0 comments on commit cea8e48

Please sign in to comment.