Actions.FileActions package¶
Submodules¶
Actions.FileActions.file_actions module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
Actions.FileActions.file_actions.
FileActions
[source]¶ Bases:
object
FileActions class which has methods(keywords) related to actions used in file KW
-
check_text_occurrence
(filename, regex, occurrence='', int_startidx=0, int_endidx=-1)[source]¶ find regex/string in the filename :Arguments:
filename - file path in which to do the operation regex - regex or string to be checked occurrence - list of comma separated lines index to check,
empty to check all lines- startidx - starting line from which to do check, first line
- if not given
endidx - ending line to do the check, last line if not given
Returns: True if successfully checked for all occurrences else False
-
copy
(filename, newname)[source]¶ copy filename to newname :Arguments:
filename - filename path to be copied newname - new file name or path to which the file has to be copiedReturns: True if successful otherwise False
-
copy2
(filename, newname)[source]¶ copy filename to newname along with stats :Arguments:
filename - filename path to be copied along with stats newname - new file name or path to which the file and stats has
to be movedReturns: True if successful otherwise False
-
copystat
(filename, newname)[source]¶ copy only stats of filename to newname and not its contents :Arguments:
filename - stats of the filename path to be copied newname - new file name or path to which the stats has to be copiedReturns: True if successful otherwise False
-
findreplace
(filename, regex, newstring, occurrence='', int_startidx=0, int_endidx=-1)[source]¶ find regex/string in the filename and replace it with newstring :Arguments:
filename - file path in which to do the operation regex - regex or string to be replaced newstring - the new string to replace the regex occurrence - list of comma separated lines index to find/replace,
empty to replace all occurrences- startidx - starting line from which to do find/replace, first line
- if not given
endidx - ending line to do the find/replace, last line if not given
Returns: True if successfully replaced else False
-
remove
(filename)[source]¶ remove the filename from the system :Arguments:
filename - filename path to be removed from systemReturns: True if successful otherwise False
-
rename
(filename, newname)[source]¶ rename or move filename to newname :Arguments:
filename - filename path to be renamed or moved newname - new file name or path to which the file has to be movedReturns: True if successful otherwise False
-
write
(filename, string, index=None)[source]¶ write string in the filename at index location :Arguments:
filename - filename path in which to write the string string - the string to be written index - the index in the filename at which to write. writes at the
end of file if not providedReturns: True if successful otherwise False
-
Module contents¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.