Pathdependency
Class representing a file system path dependency.
PathDependency
Bases: Dependency
Environment PathDependency class for substituting a path dependency.
Source code in maestrowf/datastructures/environment/pathdependency.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
__init__(name, value, token='$')
Initialize the PathDependency class.
The PathDependency represents a dependency that is stored in the local
file system. These dependencies can be things like shared group folders
or local directories in user space which contain items the study needs
to run. Otherwise, this class operates like the Variable class and
represents substrings that can be present within String data that are
meant to be replaced. The general format that such items take is
generally expressed as '
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
String name that refers to a PathDependency instance. |
required | |
value |
The value to substitute for the PathDependency instance. |
required | |
token |
String of expected character(s) that appear at the beginning of a substring representing the dependency variable. |
'$'
|
Source code in maestrowf/datastructures/environment/pathdependency.py
__str__()
Generate the string representation of the object.
Returns:
Type | Description |
---|---|
A string with the token form of the variable. |
acquire(substitutions=None)
Acquire the dependency specified by the PathDependency.
The PathDependency is simply a path that already exists, so the method doesn't actually acquire anything, but it does verify that the path exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
substitutions |
List of Substitution objects that can be applied. |
None
|
Source code in maestrowf/datastructures/environment/pathdependency.py
get_var()
Get the variable representation of the dependency's name.
Returns:
Type | Description |
---|---|
String of the Dependencies's name in token form. |
substitute(data)
Substitute the dependency's value for its notation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
String to substitute dependency into. |
required |
Returns:
Type | Description |
---|---|
String with the dependency's name replaced with its value. |