tyrannosaurus.update   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Update.__init__() 0 2 1
A Update.update() 0 5 1
1
"""
2
For the 'update' command.
3
4
Original source: https://github.com/dmyersturnbull/tyrannosaurus
5
Copyright 2020–2021 Douglas Myers-Turnbull
6
Licensed under the Apache License, Version 2.0 (the "License");
7
you may not use this file except in compliance with the License.
8
You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0
9
"""
10
11
from __future__ import annotations
12
13
import logging
14
from typing import Mapping
15
from typing import Tuple as Tup
16
17
from tyrannosaurus.context import Context
18
from tyrannosaurus.helpers import PyPiHelper
19
20
logger = logging.getLogger(__package__)
21
22
23
class Update:
24
    def __init__(self, context: Context):
25
        self.context = context
26
27
    def update(self) -> Tup[Mapping[str, Tup[str, str]], Mapping[str, Tup[str, str]]]:
28
        helper = PyPiHelper()
29
        updates = helper.new_versions(self.context.deps)
30
        dev_updates = helper.new_versions(self.context.dev_deps)
31
        return updates, dev_updates
32
33
34
__all__ = ["Update"]
35