MCPcopy Index your code
hub / github.com/saltstack/salt / __init__

Method __init__

salt/version.py:280–342  ·  view source on GitHub ↗
(
        self,  # pylint: disable=C0103
        major,
        minor=None,
        bugfix=None,
        mbugfix=0,
        pre_type=None,
        pre_num=None,
        noc=0,
        sha=None,
    )

Source from the content-addressed store, hash-verified

278 RMATCH = {v[:2]: k for (k, v) in iter(NAMES.items())}
279
280 def __init__(
281 self, # pylint: disable=C0103
282 major,
283 minor=None,
284 bugfix=None,
285 mbugfix=0,
286 pre_type=None,
287 pre_num=None,
288 noc=0,
289 sha=None,
290 ):
291 if isinstance(major, str):
292 major = int(major)
293
294 if isinstance(minor, str):
295 if not minor:
296 # Empty string
297 minor = None
298 else:
299 minor = int(minor)
300 if self.can_have_dot_zero(major):
301 minor = minor if minor else 0
302
303 if bugfix is None and not self.new_version(major=major):
304 bugfix = 0
305 elif isinstance(bugfix, str):
306 if not bugfix:
307 bugfix = None
308 else:
309 bugfix = int(bugfix)
310
311 if mbugfix is None:
312 mbugfix = 0
313 elif isinstance(mbugfix, str):
314 mbugfix = int(mbugfix)
315
316 if pre_type is None:
317 pre_type = ""
318 if pre_num is None:
319 pre_num = 0
320 elif isinstance(pre_num, str):
321 pre_num = int(pre_num)
322
323 if noc is None:
324 noc = 0
325 elif isinstance(noc, str) and noc in ("0na", "n/a"):
326 noc = -1
327 elif isinstance(noc, str):
328 noc = int(noc)
329
330 self.major = major
331 self.minor = minor
332 self.bugfix = bugfix
333 self.mbugfix = mbugfix
334 self.pre_type = pre_type
335 self.pre_num = pre_num
336 if self.new_version(major):
337 vnames_key = (major,)

Callers

nothing calls this directly

Calls 3

can_have_dot_zeroMethod · 0.95
new_versionMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected