How to use the libmozdata.utils.get_date_from_timestamp function in libmozdata

To help you get started, we’ve selected a few libmozdata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / relman-auto-nag / auto_nag / db.py View on Github external
def get_date(self):
        return lmdutils.get_date_from_timestamp(self.date)
github mozilla / relman-auto-nag / auto_nag / scripts / not_landed.py View on Github external
rev = PHAB_URL_PAT.search(phab_url).group(1)
        r = requests.post(
            PHAB_API,
            data={
                "api.token": self.phab_token,
                "queryKey": "all",
                "constraints[ids][0]": rev,
                "attachments[reviewers]": 1,
            },
        )
        r.raise_for_status()
        data = r.json()["result"]["data"][0]

        # this is a timestamp
        last_modified = data["fields"]["dateModified"]
        last_modified = lmdutils.get_date_from_timestamp(last_modified)
        if (self.date - last_modified).days <= self.nweeks * 7:
            # Do not do anything if recent changes in the bug
            return False

        reviewers = data["attachments"]["reviewers"]["reviewers"]
        if not reviewers:
            return False

        for reviewer in reviewers:
            if reviewer["status"] != "accepted":
                return False

        value = data["fields"]["status"].get("value", "")
        if value == "changes-planned":
            # even if the patch is r+ and not published, some changes may be required
            # so with the value 'changes-planned', the dev can say it's still a wip
github mozilla / relman-auto-nag / auto_nag / db.py View on Github external
def get_date(self):
        return lmdutils.get_date_from_timestamp(self.date)