Last active
June 29, 2022 18:27
-
-
Save khuyentran1401/b662426c8ffbd40993301480d5c5715e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import pandas as pd | |
from typing import List | |
import pandas as pd | |
from helper import load_config | |
from omegaconf import DictConfig | |
from prefect import flow, task | |
from prefect.tasks import task_input_hash | |
from pydash import py_ | |
@task | |
def get_data(config: DictConfig): | |
with open(config.data.raw, "r") as file: | |
data = json.load(file) | |
return data | |
@task(cache_key_fn=task_input_hash, cache_expiration=timedelta(days=1)) | |
def filter_language(data: List[dict], language: str): | |
"""Only return repositories that are written in the specified language""" | |
language = language.title() | |
return py_(data).filter({"language": language}).value() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment