@@ -335,17 +335,23 @@ def by(val, *args):
335
335
return list (filter (by , self .children ))
336
336
337
337
def get_by_id (self , id ):
338
- """Return object based on ``child_id_attribute``.
338
+ """
339
+ Return object based on ``child_id_attribute``.
340
+
341
+ Parameters
342
+ ----------
343
+ val : str
344
+
345
+ Returns
346
+ -------
347
+ object
339
348
349
+ Notes
350
+ -----
340
351
Based on `.get()`_ from `backbone.js`_.
341
352
342
353
.. _backbone.js: http://backbonejs.org/
343
354
.. _.get(): http://backbonejs.org/#Collection-get
344
-
345
- :param id:
346
- :type id: str
347
- :rtype: object
348
-
349
355
"""
350
356
for child in self .children :
351
357
if child [self .child_id_attribute ] == id :
@@ -359,18 +365,26 @@ def get_by_id(self, id):
359
365
def which (exe = None , default_paths = [
360
366
'/bin' , '/sbin' , '/usr/bin' , '/usr/sbin' , '/usr/local/bin'
361
367
], append_env_path = True ):
362
- """Return path of bin. Python clone of /usr/bin/which.
363
-
368
+ """
369
+ Return path of bin. Python clone of /usr/bin/which.
370
+
371
+ Parameters
372
+ ----------
373
+ exe : str
374
+ Application to search PATHs for.
375
+ default_path : list
376
+ Paths to check inside of
377
+ append_env_path : bool, optional
378
+ Append list of directories to check in from PATH environment variable.
379
+ Default True. Setting False only for testing / diagnosing.
380
+
381
+ Returns
382
+ -------
383
+ str
384
+
385
+ Notes
386
+ -----
364
387
from salt.util - https://www.github.com/saltstack/salt - license apache
365
-
366
- :param exe: Application to search PATHs for.
367
- :type exe: str
368
- :param default_path: Application to search PATHs for.
369
- :type default_path: list
370
- :param append_env_path: Append PATHs in environmental variables.
371
- :type append_env_path: bool
372
- :rtype: str
373
-
374
388
"""
375
389
def _is_executable_file_or_link (exe ):
376
390
# check for os.X_OK doesn't suffice because directory may executable
@@ -439,23 +453,35 @@ def get_version():
439
453
440
454
441
455
def has_version (version ):
442
- """Return True if tmux version installed.
456
+ """
457
+ Return affirmative if tmux version installed.
443
458
444
- :param version: version, '1.8'
445
- :type version: str
446
- :returns: True if version matches
447
- :rtype: bool
459
+ Parameters
460
+ ----------
461
+ version : str
462
+ version number, e.g. '1.8'
463
+
464
+ Returns
465
+ -------
466
+ bool :
467
+ True if version matches
448
468
"""
449
469
return get_version () == LooseVersion (version )
450
470
451
471
452
472
def has_gt_version (min_version ):
453
- """Return True if tmux version greater than minimum.
473
+ """
474
+ Return affirmative if tmux version greater than minimum.
454
475
455
- :param min_version: version, e.g. '1.8'
456
- :type min_version: str
457
- :returns: True if version above min_version
458
- :rtype: bool
476
+ Parameters
477
+ ----------
478
+ min_version : str
479
+ tmux version, e.g. '1.8'
480
+
481
+ Returns
482
+ -------
483
+ bool :
484
+ True if version above min_version
459
485
"""
460
486
return get_version () > LooseVersion (min_version )
461
487
0 commit comments