partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
Repository.create_package
Create a tar file package of all the repository files and directories. Only files and directories that are stored in the repository info are stored in the package tar file. **N.B. On some systems packaging requires root permissions.** :Parameters: #. path (None, string): Th...
OldRepository.py
def create_package(self, path=None, name=None, mode=None): """ Create a tar file package of all the repository files and directories. Only files and directories that are stored in the repository info are stored in the package tar file. **N.B. On some systems packaging requires r...
def create_package(self, path=None, name=None, mode=None): """ Create a tar file package of all the repository files and directories. Only files and directories that are stored in the repository info are stored in the package tar file. **N.B. On some systems packaging requires r...
[ "Create", "a", "tar", "file", "package", "of", "all", "the", "repository", "files", "and", "directories", ".", "Only", "files", "and", "directories", "that", "are", "stored", "in", "the", "repository", "info", "are", "stored", "in", "the", "package", "tar", ...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L999-L1060
[ "def", "create_package", "(", "self", ",", "path", "=", "None", ",", "name", "=", "None", ",", "mode", "=", "None", ")", ":", "# check mode", "assert", "mode", "in", "(", "None", ",", "'w'", ",", "'w:'", ",", "'w:gz'", ",", "'w:bz2'", ")", ",", "'u...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.is_repository
Check if there is a Repository in path. :Parameters: #. path (string): The real path of the directory where to check if there is a repository. :Returns: #. result (boolean): Whether its a repository or not.
OldRepository.py
def is_repository(self, path): """ Check if there is a Repository in path. :Parameters: #. path (string): The real path of the directory where to check if there is a repository. :Returns: #. result (boolean): Whether its a repository or not. """ ...
def is_repository(self, path): """ Check if there is a Repository in path. :Parameters: #. path (string): The real path of the directory where to check if there is a repository. :Returns: #. result (boolean): Whether its a repository or not. """ ...
[ "Check", "if", "there", "is", "a", "Repository", "in", "path", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1062-L1077
[ "def", "is_repository", "(", "self", ",", "path", ")", ":", "realPath", "=", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "realPath", ")", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_directory_info
get directory info from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory. :Returns: #. info (None, dictionary): The directory information dictionary. If None, it means an error has occurred. #...
OldRepository.py
def get_directory_info(self, relativePath): """ get directory info from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory. :Returns: #. info (None, dictionary): The directory information dictionary. ...
def get_directory_info(self, relativePath): """ get directory info from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory. :Returns: #. info (None, dictionary): The directory information dictionary. ...
[ "get", "directory", "info", "from", "the", "Repository", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1079-L1108
[ "def", "get_directory_info", "(", "self", ",", "relativePath", ")", ":", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "# if root directory", "if", "relativePath", "in", "(", "''", ",", "'.'", ")", ":", "return", "self", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_parent_directory_info
get parent directory info of a file or directory from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the file or directory of which the parent directory info is requested. :Returns: #. info (None, dictionary): The directory informa...
OldRepository.py
def get_parent_directory_info(self, relativePath): """ get parent directory info of a file or directory from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the file or directory of which the parent directory info is requested. ...
def get_parent_directory_info(self, relativePath): """ get parent directory info of a file or directory from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the file or directory of which the parent directory info is requested. ...
[ "get", "parent", "directory", "info", "of", "a", "file", "or", "directory", "from", "the", "Repository", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1110-L1129
[ "def", "get_parent_directory_info", "(", "self", ",", "relativePath", ")", ":", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "# if root directory", "if", "relativePath", "in", "(", "''", ",", "'.'", ")", ":", "return", "...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_file_info
get file information dict from the repository given its relative path and name. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file is. #. name (string): The file name. If None is given, name will be split from relati...
OldRepository.py
def get_file_info(self, relativePath, name=None): """ get file information dict from the repository given its relative path and name. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file is. #. name (string): The file...
def get_file_info(self, relativePath, name=None): """ get file information dict from the repository given its relative path and name. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file is. #. name (string): The file...
[ "get", "file", "information", "dict", "from", "the", "repository", "given", "its", "relative", "path", "and", "name", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1136-L1168
[ "def", "get_file_info", "(", "self", ",", "relativePath", ",", "name", "=", "None", ")", ":", "# normalize relative path and name", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "if", "relativePath", "==", "'.'", ":", "rela...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_file_info_by_id
Given an id, get the corresponding file info as the following:\n (relative path joined with file name, file info dict) Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The file relative path joined with file name. ...
OldRepository.py
def get_file_info_by_id(self, id): """ Given an id, get the corresponding file info as the following:\n (relative path joined with file name, file info dict) Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The f...
def get_file_info_by_id(self, id): """ Given an id, get the corresponding file info as the following:\n (relative path joined with file name, file info dict) Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The f...
[ "Given", "an", "id", "get", "the", "corresponding", "file", "info", "as", "the", "following", ":", "\\", "n", "(", "relative", "path", "joined", "with", "file", "name", "file", "info", "dict", ")" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1170-L1188
[ "def", "get_file_info_by_id", "(", "self", ",", "id", ")", ":", "for", "path", ",", "info", "in", "self", ".", "walk_files_info", "(", ")", ":", "if", "info", "[", "'id'", "]", "==", "id", ":", "return", "path", ",", "info", "# none was found", "return...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_file_relative_path_by_id
Given an id, get the corresponding file info relative path joined with file name. Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The file relative path joined with file name. If None, it means file was not found.
OldRepository.py
def get_file_relative_path_by_id(self, id): """ Given an id, get the corresponding file info relative path joined with file name. Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The file relative path joined with file n...
def get_file_relative_path_by_id(self, id): """ Given an id, get the corresponding file info relative path joined with file name. Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The file relative path joined with file n...
[ "Given", "an", "id", "get", "the", "corresponding", "file", "info", "relative", "path", "joined", "with", "file", "name", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1190-L1205
[ "def", "get_file_relative_path_by_id", "(", "self", ",", "id", ")", ":", "for", "path", ",", "info", "in", "self", ".", "walk_files_info", "(", ")", ":", "if", "info", "[", "'id'", "]", "==", "id", ":", "return", "path", "# none was found", "return", "No...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_file_relative_path_by_name
Get file relative path given the file name. If file name is redundant in different directories in the repository, this method ensures to return all or some of the files according to skip value. Parameters: #. name (string): The file name. #. skip (None, integer): As file...
OldRepository.py
def get_file_relative_path_by_name(self, name, skip=0): """ Get file relative path given the file name. If file name is redundant in different directories in the repository, this method ensures to return all or some of the files according to skip value. Parameters: #...
def get_file_relative_path_by_name(self, name, skip=0): """ Get file relative path given the file name. If file name is redundant in different directories in the repository, this method ensures to return all or some of the files according to skip value. Parameters: #...
[ "Get", "file", "relative", "path", "given", "the", "file", "name", ".", "If", "file", "name", "is", "redundant", "in", "different", "directories", "in", "the", "repository", "this", "method", "ensures", "to", "return", "all", "or", "some", "of", "the", "fi...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1207-L1238
[ "def", "get_file_relative_path_by_name", "(", "self", ",", "name", ",", "skip", "=", "0", ")", ":", "if", "skip", "is", "None", ":", "paths", "=", "[", "]", "else", ":", "paths", "=", "None", "for", "path", ",", "info", "in", "self", ".", "walk_files...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.add_directory
Adds a directory in the repository and creates its attribute in the Repository with utc timestamp. It insures adding all the missing directories in the path. :Parameters: #. relativePath (string): The relative to the repository path of the directory to add in the repository. ...
OldRepository.py
def add_directory(self, relativePath, info=None): """ Adds a directory in the repository and creates its attribute in the Repository with utc timestamp. It insures adding all the missing directories in the path. :Parameters: #. relativePath (string): The relative to ...
def add_directory(self, relativePath, info=None): """ Adds a directory in the repository and creates its attribute in the Repository with utc timestamp. It insures adding all the missing directories in the path. :Parameters: #. relativePath (string): The relative to ...
[ "Adds", "a", "directory", "in", "the", "repository", "and", "creates", "its", "attribute", "in", "the", "Repository", "with", "utc", "timestamp", ".", "It", "insures", "adding", "all", "the", "missing", "directories", "in", "the", "path", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1282-L1322
[ "def", "add_directory", "(", "self", ",", "relativePath", ",", "info", "=", "None", ")", ":", "path", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "# create directories", "currentDir", "=", "self", ".", "path", "currentDict", "=", "se...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.remove_directory
Remove directory from repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory to remove from the repository. #. removeFromSystem (boolean): Whether to also remove directory and all files from the system.\n Only files saved i...
OldRepository.py
def remove_directory(self, relativePath, removeFromSystem=False): """ Remove directory from repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory to remove from the repository. #. removeFromSystem (boolean): Whether to al...
def remove_directory(self, relativePath, removeFromSystem=False): """ Remove directory from repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory to remove from the repository. #. removeFromSystem (boolean): Whether to al...
[ "Remove", "directory", "from", "repository", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1326-L1370
[ "def", "remove_directory", "(", "self", ",", "relativePath", ",", "removeFromSystem", "=", "False", ")", ":", "# get parent directory info", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "parentDirInfoDict", ",", "errorMessage", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.move_directory
Move a directory in the repository from one place to another. It insures moving all the files and subdirectories in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory to be moved. #. relativeDestination (string): The new relat...
OldRepository.py
def move_directory(self, relativePath, relativeDestination, replace=False, verbose=True): """ Move a directory in the repository from one place to another. It insures moving all the files and subdirectories in the system. :Parameters: #. relativePath (string): The relative t...
def move_directory(self, relativePath, relativeDestination, replace=False, verbose=True): """ Move a directory in the repository from one place to another. It insures moving all the files and subdirectories in the system. :Parameters: #. relativePath (string): The relative t...
[ "Move", "a", "directory", "in", "the", "repository", "from", "one", "place", "to", "another", ".", "It", "insures", "moving", "all", "the", "files", "and", "subdirectories", "in", "the", "system", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1374-L1418
[ "def", "move_directory", "(", "self", ",", "relativePath", ",", "relativeDestination", ",", "replace", "=", "False", ",", "verbose", "=", "True", ")", ":", "# normalize path", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.rename_directory
Rename a directory in the repository. It insures renaming the directory in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory to be renamed. #. newName (string): The new directory name. #. replace (boolean): Whether to for...
OldRepository.py
def rename_directory(self, relativePath, newName, replace=False, verbose=True): """ Rename a directory in the repository. It insures renaming the directory in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory to be renamed. ...
def rename_directory(self, relativePath, newName, replace=False, verbose=True): """ Rename a directory in the repository. It insures renaming the directory in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory to be renamed. ...
[ "Rename", "a", "directory", "in", "the", "repository", ".", "It", "insures", "renaming", "the", "directory", "in", "the", "system", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1422-L1461
[ "def", "rename_directory", "(", "self", ",", "relativePath", ",", "newName", ",", "replace", "=", "False", ",", "verbose", "=", "True", ")", ":", "# normalize path", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "parentDi...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.rename_file
Rename a directory in the repository. It insures renaming the file in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file is located. #. name (string): The file name. #. newName (string): The file new name. ...
OldRepository.py
def rename_file(self, relativePath, name, newName, replace=False, verbose=True): """ Rename a directory in the repository. It insures renaming the file in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file is locate...
def rename_file(self, relativePath, name, newName, replace=False, verbose=True): """ Rename a directory in the repository. It insures renaming the file in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file is locate...
[ "Rename", "a", "directory", "in", "the", "repository", ".", "It", "insures", "renaming", "the", "file", "in", "the", "system", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1465-L1505
[ "def", "rename_file", "(", "self", ",", "relativePath", ",", "name", ",", "newName", ",", "replace", "=", "False", ",", "verbose", "=", "True", ")", ":", "# normalize path", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.remove_file
Remove file from repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file should be dumped. If relativePath does not exist, it will be created automatically. #. name (string): The file name. If N...
OldRepository.py
def remove_file(self, relativePath, name=None, removeFromSystem=False): """ Remove file from repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file should be dumped. If relativePath does not exist, it wil...
def remove_file(self, relativePath, name=None, removeFromSystem=False): """ Remove file from repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file should be dumped. If relativePath does not exist, it wil...
[ "Remove", "file", "from", "repository", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1509-L1544
[ "def", "remove_file", "(", "self", ",", "relativePath", ",", "name", "=", "None", ",", "removeFromSystem", "=", "False", ")", ":", "# get relative path normalized", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ")", "if", "relat...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.dump_copy
Copy an exisitng system file to the repository. attribute in the Repository with utc timestamp. :Parameters: #. path (str): The full path of the file to copy into the repository. #. relativePath (str): The relative to the repository path of the directory where the file should be...
OldRepository.py
def dump_copy(self, path, relativePath, name=None, description=None, replace=False, verbose=False): """ Copy an exisitng system file to the repository. attribute in the Repository with utc timestamp. :Parameters: #. path (str):...
def dump_copy(self, path, relativePath, name=None, description=None, replace=False, verbose=False): """ Copy an exisitng system file to the repository. attribute in the Repository with utc timestamp. :Parameters: #. path (str):...
[ "Copy", "an", "exisitng", "system", "file", "to", "the", "repository", ".", "attribute", "in", "the", "Repository", "with", "utc", "timestamp", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1548-L1602
[ "def", "dump_copy", "(", "self", ",", "path", ",", "relativePath", ",", "name", "=", "None", ",", "description", "=", "None", ",", "replace", "=", "False", ",", "verbose", "=", "False", ")", ":", "relativePath", "=", "os", ".", "path", ".", "normpath",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.dump_file
Dump a file using its value to the system and creates its attribute in the Repository with utc timestamp. :Parameters: #. value (object): The value of a file to dump and add to the repository. It is any python object or file. #. relativePath (str): The relative to the repository...
OldRepository.py
def dump_file(self, value, relativePath, name=None, description=None, klass=None, dump=None, pull=None, replace=False, ACID=None, verbose=False): """ Dump a file using its value to the system and creates its attribute in the...
def dump_file(self, value, relativePath, name=None, description=None, klass=None, dump=None, pull=None, replace=False, ACID=None, verbose=False): """ Dump a file using its value to the system and creates its attribute in the...
[ "Dump", "a", "file", "using", "its", "value", "to", "the", "system", "and", "creates", "its", "attribute", "in", "the", "Repository", "with", "utc", "timestamp", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1606-L1709
[ "def", "dump_file", "(", "self", ",", "value", ",", "relativePath", ",", "name", "=", "None", ",", "description", "=", "None", ",", "klass", "=", "None", ",", "dump", "=", "None", ",", "pull", "=", "None", ",", "replace", "=", "False", ",", "ACID", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.update_file
Update the value and the utc timestamp of a file that is already in the Repository.\n If file is not registered in repository, and error will be thrown.\n If file is missing in the system, it will be regenerated as dump method is called. :Parameters: #. value (object): The value of ...
OldRepository.py
def update_file(self, value, relativePath, name=None, description=False, klass=False, dump=False, pull=False, ACID=None, verbose=False): """ Update the value and the utc timestamp of a file that is already in the Repository.\n...
def update_file(self, value, relativePath, name=None, description=False, klass=False, dump=False, pull=False, ACID=None, verbose=False): """ Update the value and the utc timestamp of a file that is already in the Repository.\n...
[ "Update", "the", "value", "and", "the", "utc", "timestamp", "of", "a", "file", "that", "is", "already", "in", "the", "Repository", ".", "\\", "n", "If", "file", "is", "not", "registered", "in", "repository", "and", "error", "will", "be", "thrown", ".", ...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1717-L1803
[ "def", "update_file", "(", "self", ",", "value", ",", "relativePath", ",", "name", "=", "None", ",", "description", "=", "False", ",", "klass", "=", "False", ",", "dump", "=", "False", ",", "pull", "=", "False", ",", "ACID", "=", "None", ",", "verbos...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.pull_file
Pull a file's data from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file should be pulled. #. name (string): The file name. If None is given, name will be split from relativePath. #. pul...
OldRepository.py
def pull_file(self, relativePath, name=None, pull=None, update=True): """ Pull a file's data from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file should be pulled. #. name (string): The file name....
def pull_file(self, relativePath, name=None, pull=None, update=True): """ Pull a file's data from the Repository. :Parameters: #. relativePath (string): The relative to the repository path of the directory where the file should be pulled. #. name (string): The file name....
[ "Pull", "a", "file", "s", "data", "from", "the", "Repository", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/OldRepository.py#L1809-L1861
[ "def", "pull_file", "(", "self", ",", "relativePath", ",", "name", "=", "None", ",", "pull", "=", "None", ",", "update", "=", "True", ")", ":", "# get relative path normalized", "relativePath", "=", "os", ".", "path", ".", "normpath", "(", "relativePath", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
ensure_str
Ensure value is string.
pathlib_mate/helper.py
def ensure_str(value): """ Ensure value is string. """ if isinstance(value, six.string_types): return value else: return six.text_type(value)
def ensure_str(value): """ Ensure value is string. """ if isinstance(value, six.string_types): return value else: return six.text_type(value)
[ "Ensure", "value", "is", "string", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/helper.py#L6-L13
[ "def", "ensure_str", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "return", "value", "else", ":", "return", "six", ".", "text_type", "(", "value", ")" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ensure_list
Pre-process input argument, whether if it is: 1. abspath 2. Path instance 3. string 4. list or set of any of them It returns list of path. :return path_or_path_list: always return list of path in string **中文文档** 预处理输入参数。
pathlib_mate/helper.py
def ensure_list(path_or_path_list): """ Pre-process input argument, whether if it is: 1. abspath 2. Path instance 3. string 4. list or set of any of them It returns list of path. :return path_or_path_list: always return list of path in string **中文文档** 预处理输入参数。 """ if...
def ensure_list(path_or_path_list): """ Pre-process input argument, whether if it is: 1. abspath 2. Path instance 3. string 4. list or set of any of them It returns list of path. :return path_or_path_list: always return list of path in string **中文文档** 预处理输入参数。 """ if...
[ "Pre", "-", "process", "input", "argument", "whether", "if", "it", "is", ":" ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/helper.py#L16-L36
[ "def", "ensure_list", "(", "path_or_path_list", ")", ":", "if", "isinstance", "(", "path_or_path_list", ",", "(", "tuple", ",", "list", ",", "set", ")", ")", ":", "return", "[", "ensure_str", "(", "path", ")", "for", "path", "in", "path_or_path_list", "]",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
PrometheusPushGatewayDriver.stream
Stream reports to application logs
aiometrics.py
def stream(self, report): """Stream reports to application logs""" with self.ClientSession() as session: lines = [] for job in report['traces']: key = '%s:%s' % (self.name, job) for minute in report['traces'][job]: for k, v in r...
def stream(self, report): """Stream reports to application logs""" with self.ClientSession() as session: lines = [] for job in report['traces']: key = '%s:%s' % (self.name, job) for minute in report['traces'][job]: for k, v in r...
[ "Stream", "reports", "to", "application", "logs" ]
dmonroy/aiometrics
python
https://github.com/dmonroy/aiometrics/blob/c33c7f86c372f8d2f30ac9bde3811993821a6f25/aiometrics.py#L56-L71
[ "def", "stream", "(", "self", ",", "report", ")", ":", "with", "self", ".", "ClientSession", "(", ")", "as", "session", ":", "lines", "=", "[", "]", "for", "job", "in", "report", "[", "'traces'", "]", ":", "key", "=", "'%s:%s'", "%", "(", "self", ...
c33c7f86c372f8d2f30ac9bde3811993821a6f25
valid
NewRelicPluginCollector.stream
Stream reports to application logs
aiometrics.py
def stream(self, report): """Stream reports to application logs""" payload = { "agent": { "host": report['instance']['hostname'], "version": "1.0.0" }, "components": [ { "name": self.name, ...
def stream(self, report): """Stream reports to application logs""" payload = { "agent": { "host": report['instance']['hostname'], "version": "1.0.0" }, "components": [ { "name": self.name, ...
[ "Stream", "reports", "to", "application", "logs" ]
dmonroy/aiometrics
python
https://github.com/dmonroy/aiometrics/blob/c33c7f86c372f8d2f30ac9bde3811993821a6f25/aiometrics.py#L83-L127
[ "def", "stream", "(", "self", ",", "report", ")", ":", "payload", "=", "{", "\"agent\"", ":", "{", "\"host\"", ":", "report", "[", "'instance'", "]", "[", "'hostname'", "]", ",", "\"version\"", ":", "\"1.0.0\"", "}", ",", "\"components\"", ":", "[", "{...
c33c7f86c372f8d2f30ac9bde3811993821a6f25
valid
TraceCollector.stats
Build per minute stats for each key
aiometrics.py
def stats(cls, traces): """Build per minute stats for each key""" data = {} stats = {} # Group traces by key and minute for trace in traces: key = trace['key'] if key not in data: data[key] = [] stats[key] = {} ...
def stats(cls, traces): """Build per minute stats for each key""" data = {} stats = {} # Group traces by key and minute for trace in traces: key = trace['key'] if key not in data: data[key] = [] stats[key] = {} ...
[ "Build", "per", "minute", "stats", "for", "each", "key" ]
dmonroy/aiometrics
python
https://github.com/dmonroy/aiometrics/blob/c33c7f86c372f8d2f30ac9bde3811993821a6f25/aiometrics.py#L241-L265
[ "def", "stats", "(", "cls", ",", "traces", ")", ":", "data", "=", "{", "}", "stats", "=", "{", "}", "# Group traces by key and minute", "for", "trace", "in", "traces", ":", "key", "=", "trace", "[", "'key'", "]", "if", "key", "not", "in", "data", ":"...
c33c7f86c372f8d2f30ac9bde3811993821a6f25
valid
FilesDataSource.no_error_extract_data_from_file
Proxy for `extract_data_from_file` that suppresses any errors and instead just returning an empty list. :param file_path: see `extract_data_from_file` :return: see `extract_data_from_file`
hgicommon/data_source/static_from_file.py
def no_error_extract_data_from_file(self, file_path: str) -> Iterable[DataSourceType]: """ Proxy for `extract_data_from_file` that suppresses any errors and instead just returning an empty list. :param file_path: see `extract_data_from_file` :return: see `extract_data_from_file` ...
def no_error_extract_data_from_file(self, file_path: str) -> Iterable[DataSourceType]: """ Proxy for `extract_data_from_file` that suppresses any errors and instead just returning an empty list. :param file_path: see `extract_data_from_file` :return: see `extract_data_from_file` ...
[ "Proxy", "for", "extract_data_from_file", "that", "suppresses", "any", "errors", "and", "instead", "just", "returning", "an", "empty", "list", ".", ":", "param", "file_path", ":", "see", "extract_data_from_file", ":", "return", ":", "see", "extract_data_from_file" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L72-L82
[ "def", "no_error_extract_data_from_file", "(", "self", ",", "file_path", ":", "str", ")", "->", "Iterable", "[", "DataSourceType", "]", ":", "try", ":", "return", "self", ".", "extract_data_from_file", "(", "file_path", ")", "except", "Exception", "as", "e", "...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
FilesDataSource._load_all_in_directory
Loads all of the data from the files in directory location. :return: a origin map of all the loaded data
hgicommon/data_source/static_from_file.py
def _load_all_in_directory(self) -> Dict[str, Iterable[DataSourceType]]: """ Loads all of the data from the files in directory location. :return: a origin map of all the loaded data """ origin_mapped_data = dict() # type: Dict[str, Iterable[DataSourceType]] for file_pa...
def _load_all_in_directory(self) -> Dict[str, Iterable[DataSourceType]]: """ Loads all of the data from the files in directory location. :return: a origin map of all the loaded data """ origin_mapped_data = dict() # type: Dict[str, Iterable[DataSourceType]] for file_pa...
[ "Loads", "all", "of", "the", "data", "from", "the", "files", "in", "directory", "location", ".", ":", "return", ":", "a", "origin", "map", "of", "all", "the", "loaded", "data" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L84-L93
[ "def", "_load_all_in_directory", "(", "self", ")", "->", "Dict", "[", "str", ",", "Iterable", "[", "DataSourceType", "]", "]", ":", "origin_mapped_data", "=", "dict", "(", ")", "# type: Dict[str, Iterable[DataSourceType]]", "for", "file_path", "in", "glob", ".", ...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
FilesDataSource._extract_data_from_origin_map
Extracts the data from a data origin map. :param origin_mapped_data: a map containing the origin of the data as the key string and the data as the value :return: the data contained within the map
hgicommon/data_source/static_from_file.py
def _extract_data_from_origin_map(origin_mapped_data: Dict[str, Iterable[DataSourceType]]) \ -> Iterable[DataSourceType]: """ Extracts the data from a data origin map. :param origin_mapped_data: a map containing the origin of the data as the key string and the data as the value ...
def _extract_data_from_origin_map(origin_mapped_data: Dict[str, Iterable[DataSourceType]]) \ -> Iterable[DataSourceType]: """ Extracts the data from a data origin map. :param origin_mapped_data: a map containing the origin of the data as the key string and the data as the value ...
[ "Extracts", "the", "data", "from", "a", "data", "origin", "map", ".", ":", "param", "origin_mapped_data", ":", "a", "map", "containing", "the", "origin", "of", "the", "data", "as", "the", "key", "string", "and", "the", "data", "as", "the", "value", ":", ...
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L96-L106
[ "def", "_extract_data_from_origin_map", "(", "origin_mapped_data", ":", "Dict", "[", "str", ",", "Iterable", "[", "DataSourceType", "]", "]", ")", "->", "Iterable", "[", "DataSourceType", "]", ":", "data", "=", "[", "]", "for", "_", ",", "data_item", "in", ...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
SynchronisedFilesDataSource.start
Monitors data kept in files in the predefined directory in a new thread. Note: Due to the underlying library, it may take a few milliseconds after this method is started for changes to start to being noticed.
hgicommon/data_source/static_from_file.py
def start(self): """ Monitors data kept in files in the predefined directory in a new thread. Note: Due to the underlying library, it may take a few milliseconds after this method is started for changes to start to being noticed. """ with self._status_lock: i...
def start(self): """ Monitors data kept in files in the predefined directory in a new thread. Note: Due to the underlying library, it may take a few milliseconds after this method is started for changes to start to being noticed. """ with self._status_lock: i...
[ "Monitors", "data", "kept", "in", "files", "in", "the", "predefined", "directory", "in", "a", "new", "thread", "." ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L156-L174
[ "def", "start", "(", "self", ")", ":", "with", "self", ".", "_status_lock", ":", "if", "self", ".", "_running", ":", "raise", "RuntimeError", "(", "\"Already running\"", ")", "self", ".", "_running", "=", "True", "# Cannot re-use Observer after stopped", "self",...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
SynchronisedFilesDataSource.stop
Stops monitoring the predefined directory.
hgicommon/data_source/static_from_file.py
def stop(self): """ Stops monitoring the predefined directory. """ with self._status_lock: if self._running: assert self._observer is not None self._observer.stop() self._running = False self._origin_mapped_data ...
def stop(self): """ Stops monitoring the predefined directory. """ with self._status_lock: if self._running: assert self._observer is not None self._observer.stop() self._running = False self._origin_mapped_data ...
[ "Stops", "monitoring", "the", "predefined", "directory", "." ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L176-L185
[ "def", "stop", "(", "self", ")", ":", "with", "self", ".", "_status_lock", ":", "if", "self", ".", "_running", ":", "assert", "self", ".", "_observer", "is", "not", "None", "self", ".", "_observer", ".", "stop", "(", ")", "self", ".", "_running", "="...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
SynchronisedFilesDataSource._on_file_created
Called when a file in the monitored directory has been created. :param event: the file system event
hgicommon/data_source/static_from_file.py
def _on_file_created(self, event: FileSystemEvent): """ Called when a file in the monitored directory has been created. :param event: the file system event """ if not event.is_directory and self.is_data_file(event.src_path): assert event.src_path not in self._origin_m...
def _on_file_created(self, event: FileSystemEvent): """ Called when a file in the monitored directory has been created. :param event: the file system event """ if not event.is_directory and self.is_data_file(event.src_path): assert event.src_path not in self._origin_m...
[ "Called", "when", "a", "file", "in", "the", "monitored", "directory", "has", "been", "created", ".", ":", "param", "event", ":", "the", "file", "system", "event" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L187-L195
[ "def", "_on_file_created", "(", "self", ",", "event", ":", "FileSystemEvent", ")", ":", "if", "not", "event", ".", "is_directory", "and", "self", ".", "is_data_file", "(", "event", ".", "src_path", ")", ":", "assert", "event", ".", "src_path", "not", "in",...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
SynchronisedFilesDataSource._on_file_modified
Called when a file in the monitored directory has been modified. :param event: the file system event
hgicommon/data_source/static_from_file.py
def _on_file_modified(self, event: FileSystemEvent): """ Called when a file in the monitored directory has been modified. :param event: the file system event """ if not event.is_directory and self.is_data_file(event.src_path): assert event.src_path in self._origin_map...
def _on_file_modified(self, event: FileSystemEvent): """ Called when a file in the monitored directory has been modified. :param event: the file system event """ if not event.is_directory and self.is_data_file(event.src_path): assert event.src_path in self._origin_map...
[ "Called", "when", "a", "file", "in", "the", "monitored", "directory", "has", "been", "modified", ".", ":", "param", "event", ":", "the", "file", "system", "event" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L197-L205
[ "def", "_on_file_modified", "(", "self", ",", "event", ":", "FileSystemEvent", ")", ":", "if", "not", "event", ".", "is_directory", "and", "self", ".", "is_data_file", "(", "event", ".", "src_path", ")", ":", "assert", "event", ".", "src_path", "in", "self...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
SynchronisedFilesDataSource._on_file_deleted
Called when a file in the monitored directory has been deleted. :param event: the file system event
hgicommon/data_source/static_from_file.py
def _on_file_deleted(self, event: FileSystemEvent): """ Called when a file in the monitored directory has been deleted. :param event: the file system event """ if not event.is_directory and self.is_data_file(event.src_path): assert event.src_path in self._origin_mappe...
def _on_file_deleted(self, event: FileSystemEvent): """ Called when a file in the monitored directory has been deleted. :param event: the file system event """ if not event.is_directory and self.is_data_file(event.src_path): assert event.src_path in self._origin_mappe...
[ "Called", "when", "a", "file", "in", "the", "monitored", "directory", "has", "been", "deleted", ".", ":", "param", "event", ":", "the", "file", "system", "event" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L207-L215
[ "def", "_on_file_deleted", "(", "self", ",", "event", ":", "FileSystemEvent", ")", ":", "if", "not", "event", ".", "is_directory", "and", "self", ".", "is_data_file", "(", "event", ".", "src_path", ")", ":", "assert", "event", ".", "src_path", "in", "self"...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
SynchronisedFilesDataSource._on_file_moved
Called when a file in the monitored directory has been moved. Breaks move down into a delete and a create (which it is sometimes detected as!). :param event: the file system event
hgicommon/data_source/static_from_file.py
def _on_file_moved(self, event: FileSystemMovedEvent): """ Called when a file in the monitored directory has been moved. Breaks move down into a delete and a create (which it is sometimes detected as!). :param event: the file system event """ if not event.is_directory an...
def _on_file_moved(self, event: FileSystemMovedEvent): """ Called when a file in the monitored directory has been moved. Breaks move down into a delete and a create (which it is sometimes detected as!). :param event: the file system event """ if not event.is_directory an...
[ "Called", "when", "a", "file", "in", "the", "monitored", "directory", "has", "been", "moved", "." ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/static_from_file.py#L217-L231
[ "def", "_on_file_moved", "(", "self", ",", "event", ":", "FileSystemMovedEvent", ")", ":", "if", "not", "event", ".", "is_directory", "and", "self", ".", "is_data_file", "(", "event", ".", "src_path", ")", ":", "delete_event", "=", "FileSystemEvent", "(", "e...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
TempManager.tear_down
Tears down all temp files and directories.
hgicommon/managers.py
def tear_down(self): """ Tears down all temp files and directories. """ while len(self._temp_directories) > 0: directory = self._temp_directories.pop() shutil.rmtree(directory, ignore_errors=True) while len(self._temp_files) > 0: file = self._t...
def tear_down(self): """ Tears down all temp files and directories. """ while len(self._temp_directories) > 0: directory = self._temp_directories.pop() shutil.rmtree(directory, ignore_errors=True) while len(self._temp_files) > 0: file = self._t...
[ "Tears", "down", "all", "temp", "files", "and", "directories", "." ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/managers.py#L29-L41
[ "def", "tear_down", "(", "self", ")", ":", "while", "len", "(", "self", ".", "_temp_directories", ")", ">", "0", ":", "directory", "=", "self", ".", "_temp_directories", ".", "pop", "(", ")", "shutil", ".", "rmtree", "(", "directory", ",", "ignore_errors...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
TempManager.create_temp_directory
Creates a temp directory. :param mkdtemp_kwargs: named arguments to be passed to `tempfile.mkdtemp` :return: the location of the temp directory
hgicommon/managers.py
def create_temp_directory(self, **mkdtemp_kwargs) -> str: """ Creates a temp directory. :param mkdtemp_kwargs: named arguments to be passed to `tempfile.mkdtemp` :return: the location of the temp directory """ kwargs = {**self.default_mkdtemp_kwargs, **mkdtemp_kwargs} ...
def create_temp_directory(self, **mkdtemp_kwargs) -> str: """ Creates a temp directory. :param mkdtemp_kwargs: named arguments to be passed to `tempfile.mkdtemp` :return: the location of the temp directory """ kwargs = {**self.default_mkdtemp_kwargs, **mkdtemp_kwargs} ...
[ "Creates", "a", "temp", "directory", ".", ":", "param", "mkdtemp_kwargs", ":", "named", "arguments", "to", "be", "passed", "to", "tempfile", ".", "mkdtemp", ":", "return", ":", "the", "location", "of", "the", "temp", "directory" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/managers.py#L43-L52
[ "def", "create_temp_directory", "(", "self", ",", "*", "*", "mkdtemp_kwargs", ")", "->", "str", ":", "kwargs", "=", "{", "*", "*", "self", ".", "default_mkdtemp_kwargs", ",", "*", "*", "mkdtemp_kwargs", "}", "location", "=", "tempfile", ".", "mkdtemp", "("...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
TempManager.create_temp_file
Creates a temp file. :param mkstemp_kwargs: named arguments to be passed to `tempfile.mkstemp` :return: tuple where the first element is the file handle and the second is the location of the temp file
hgicommon/managers.py
def create_temp_file(self, **mkstemp_kwargs) -> Tuple[int, str]: """ Creates a temp file. :param mkstemp_kwargs: named arguments to be passed to `tempfile.mkstemp` :return: tuple where the first element is the file handle and the second is the location of the temp file """ ...
def create_temp_file(self, **mkstemp_kwargs) -> Tuple[int, str]: """ Creates a temp file. :param mkstemp_kwargs: named arguments to be passed to `tempfile.mkstemp` :return: tuple where the first element is the file handle and the second is the location of the temp file """ ...
[ "Creates", "a", "temp", "file", ".", ":", "param", "mkstemp_kwargs", ":", "named", "arguments", "to", "be", "passed", "to", "tempfile", ".", "mkstemp", ":", "return", ":", "tuple", "where", "the", "first", "element", "is", "the", "file", "handle", "and", ...
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/managers.py#L54-L63
[ "def", "create_temp_file", "(", "self", ",", "*", "*", "mkstemp_kwargs", ")", "->", "Tuple", "[", "int", ",", "str", "]", ":", "kwargs", "=", "{", "*", "*", "self", ".", "default_mkstemp_kwargs", ",", "*", "*", "mkstemp_kwargs", "}", "handle", ",", "lo...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
MutateMethods.change
Return a new :class:`pathlib_mate.pathlib2.Path` object with updated information.
pathlib_mate/mate_mutate_methods.py
def change(self, new_abspath=None, new_dirpath=None, new_dirname=None, new_basename=None, new_fname=None, new_ext=None): """ Return a new :class:`pathlib_mate.pathlib2.Path` object with updated information. ...
def change(self, new_abspath=None, new_dirpath=None, new_dirname=None, new_basename=None, new_fname=None, new_ext=None): """ Return a new :class:`pathlib_mate.pathlib2.Path` object with updated information. ...
[ "Return", "a", "new", ":", "class", ":", "pathlib_mate", ".", "pathlib2", ".", "Path", "object", "with", "updated", "information", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_mutate_methods.py#L52-L89
[ "def", "change", "(", "self", ",", "new_abspath", "=", "None", ",", "new_dirpath", "=", "None", ",", "new_dirname", "=", "None", ",", "new_basename", "=", "None", ",", "new_fname", "=", "None", ",", "new_ext", "=", "None", ")", ":", "if", "new_abspath", ...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
MutateMethods.is_not_exist_or_allow_overwrite
Test whether a file target is not exists or it exists but allow overwrite.
pathlib_mate/mate_mutate_methods.py
def is_not_exist_or_allow_overwrite(self, overwrite=False): """ Test whether a file target is not exists or it exists but allow overwrite. """ if self.exists() and overwrite is False: return False else: # pragma: no cover return True
def is_not_exist_or_allow_overwrite(self, overwrite=False): """ Test whether a file target is not exists or it exists but allow overwrite. """ if self.exists() and overwrite is False: return False else: # pragma: no cover return True
[ "Test", "whether", "a", "file", "target", "is", "not", "exists", "or", "it", "exists", "but", "allow", "overwrite", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_mutate_methods.py#L91-L99
[ "def", "is_not_exist_or_allow_overwrite", "(", "self", ",", "overwrite", "=", "False", ")", ":", "if", "self", ".", "exists", "(", ")", "and", "overwrite", "is", "False", ":", "return", "False", "else", ":", "# pragma: no cover", "return", "True" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
MutateMethods.moveto
An advanced :meth:`pathlib_mate.pathlib2.Path.rename` method provide ability to rename by each components of a path. A new ``Path`` instance will returns. **中文文档** 高级重命名函数, 允许用于根据路径的各个组成部分进行重命名。但和os.rename 方法一样, 需要保证母文件夹存在。
pathlib_mate/mate_mutate_methods.py
def moveto(self, new_abspath=None, new_dirpath=None, new_dirname=None, new_basename=None, new_fname=None, new_ext=None, overwrite=False, makedirs=False): """ An advanced :meth:`pathlib...
def moveto(self, new_abspath=None, new_dirpath=None, new_dirname=None, new_basename=None, new_fname=None, new_ext=None, overwrite=False, makedirs=False): """ An advanced :meth:`pathlib...
[ "An", "advanced", ":", "meth", ":", "pathlib_mate", ".", "pathlib2", ".", "Path", ".", "rename", "method", "provide", "ability", "to", "rename", "by", "each", "components", "of", "a", "path", ".", "A", "new", "Path", "instance", "will", "returns", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_mutate_methods.py#L101-L138
[ "def", "moveto", "(", "self", ",", "new_abspath", "=", "None", ",", "new_dirpath", "=", "None", ",", "new_dirname", "=", "None", ",", "new_basename", "=", "None", ",", "new_fname", "=", "None", ",", "new_ext", "=", "None", ",", "overwrite", "=", "False",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
MutateMethods.copyto
Copy this file to other place.
pathlib_mate/mate_mutate_methods.py
def copyto(self, new_abspath=None, new_dirpath=None, new_dirname=None, new_basename=None, new_fname=None, new_ext=None, overwrite=False, makedirs=False): """ Copy this file to other pl...
def copyto(self, new_abspath=None, new_dirpath=None, new_dirname=None, new_basename=None, new_fname=None, new_ext=None, overwrite=False, makedirs=False): """ Copy this file to other pl...
[ "Copy", "this", "file", "to", "other", "place", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_mutate_methods.py#L140-L174
[ "def", "copyto", "(", "self", ",", "new_abspath", "=", "None", ",", "new_dirpath", "=", "None", ",", "new_dirname", "=", "None", ",", "new_basename", "=", "None", ",", "new_fname", "=", "None", ",", "new_ext", "=", "None", ",", "overwrite", "=", "False",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
_create_client
Creates a Docker client with the given details. :param base_url: the base URL of the Docker daemon :param tls: the Docker daemon's TLS config (if any) :return: the created client else None if unable to connect the client to the daemon
hgicommon/docker/client.py
def _create_client(base_url: str, tls: TLSConfig=False) -> Optional[APIClient]: """ Creates a Docker client with the given details. :param base_url: the base URL of the Docker daemon :param tls: the Docker daemon's TLS config (if any) :return: the created client else None if unable to connect the cl...
def _create_client(base_url: str, tls: TLSConfig=False) -> Optional[APIClient]: """ Creates a Docker client with the given details. :param base_url: the base URL of the Docker daemon :param tls: the Docker daemon's TLS config (if any) :return: the created client else None if unable to connect the cl...
[ "Creates", "a", "Docker", "client", "with", "the", "given", "details", ".", ":", "param", "base_url", ":", "the", "base", "URL", "of", "the", "Docker", "daemon", ":", "param", "tls", ":", "the", "Docker", "daemon", "s", "TLS", "config", "(", "if", "any...
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/docker/client.py#L17-L28
[ "def", "_create_client", "(", "base_url", ":", "str", ",", "tls", ":", "TLSConfig", "=", "False", ")", "->", "Optional", "[", "APIClient", "]", ":", "try", ":", "client", "=", "APIClient", "(", "base_url", "=", "base_url", ",", "tls", "=", "tls", ",", ...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
create_client
Clients a Docker client. Will raise a `ConnectionError` if the Docker daemon is not accessible. :return: the Docker client
hgicommon/docker/client.py
def create_client() -> APIClient: """ Clients a Docker client. Will raise a `ConnectionError` if the Docker daemon is not accessible. :return: the Docker client """ global _client client = _client() if client is None: # First try looking at the environment variables for specific...
def create_client() -> APIClient: """ Clients a Docker client. Will raise a `ConnectionError` if the Docker daemon is not accessible. :return: the Docker client """ global _client client = _client() if client is None: # First try looking at the environment variables for specific...
[ "Clients", "a", "Docker", "client", "." ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/docker/client.py#L31-L62
[ "def", "create_client", "(", ")", "->", "APIClient", ":", "global", "_client", "client", "=", "_client", "(", ")", "if", "client", "is", "None", ":", "# First try looking at the environment variables for specification of the daemon's location", "docker_environment", "=", ...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
get_dump_method
Get dump function code string
Repository.py
def get_dump_method(dump, protocol=-1): """Get dump function code string""" if dump is None: dump = 'pickle' if dump.startswith('pickle'): if dump == 'pickle': proto = protocol else: proto = dump.strip('pickle') try: proto = int(proto) ...
def get_dump_method(dump, protocol=-1): """Get dump function code string""" if dump is None: dump = 'pickle' if dump.startswith('pickle'): if dump == 'pickle': proto = protocol else: proto = dump.strip('pickle') try: proto = int(proto) ...
[ "Get", "dump", "function", "code", "string" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L295-L362
[ "def", "get_dump_method", "(", "dump", ",", "protocol", "=", "-", "1", ")", ":", "if", "dump", "is", "None", ":", "dump", "=", "'pickle'", "if", "dump", ".", "startswith", "(", "'pickle'", ")", ":", "if", "dump", "==", "'pickle'", ":", "proto", "=", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
get_pull_method
Get pull function code string
Repository.py
def get_pull_method(pull): """Get pull function code string""" if pull is None or pull.startswith('pickle'): code = """ import os try: import cPickle as pickle except: import pickle with open('$FILE_PATH', 'rb') as fd: PULLED_DATA = pickle.load( fd ) """ elif pull.startswith('dill'): ...
def get_pull_method(pull): """Get pull function code string""" if pull is None or pull.startswith('pickle'): code = """ import os try: import cPickle as pickle except: import pickle with open('$FILE_PATH', 'rb') as fd: PULLED_DATA = pickle.load( fd ) """ elif pull.startswith('dill'): ...
[ "Get", "pull", "function", "code", "string" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L367-L410
[ "def", "get_pull_method", "(", "pull", ")", ":", "if", "pull", "is", "None", "or", "pull", ".", "startswith", "(", "'pickle'", ")", ":", "code", "=", "\"\"\"\nimport os\ntry:\n import cPickle as pickle\nexcept:\n import pickle\nwith open('$FILE_PATH', 'rb') as fd:\n ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
path_required
Decorate methods when repository path is required.
Repository.py
def path_required(func): """Decorate methods when repository path is required.""" @wraps(func) def wrapper(self, *args, **kwargs): if self.path is None: warnings.warn('Must load (Repository.load_repository) or initialize (Repository.create_repository) the repository first !') ...
def path_required(func): """Decorate methods when repository path is required.""" @wraps(func) def wrapper(self, *args, **kwargs): if self.path is None: warnings.warn('Must load (Repository.load_repository) or initialize (Repository.create_repository) the repository first !') ...
[ "Decorate", "methods", "when", "repository", "path", "is", "required", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L413-L421
[ "def", "path_required", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "path", "is", "None", ":", "warnings", ".", "warn", "(", "'Must ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.__clean_before_after
clean repository given before and after states
Repository.py
def __clean_before_after(self, stateBefore, stateAfter, keepNoneEmptyDirectory=True): """clean repository given before and after states""" # prepare after for faster search errors = [] afterDict = {} [afterDict.setdefault(list(aitem)[0],[]).append(aitem) for aitem in stateAfte...
def __clean_before_after(self, stateBefore, stateAfter, keepNoneEmptyDirectory=True): """clean repository given before and after states""" # prepare after for faster search errors = [] afterDict = {} [afterDict.setdefault(list(aitem)[0],[]).append(aitem) for aitem in stateAfte...
[ "clean", "repository", "given", "before", "and", "after", "states" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L597-L647
[ "def", "__clean_before_after", "(", "self", ",", "stateBefore", ",", "stateAfter", ",", "keepNoneEmptyDirectory", "=", "True", ")", ":", "# prepare after for faster search", "errors", "=", "[", "]", "afterDict", "=", "{", "}", "[", "afterDict", ".", "setdefault", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_stats
Get repository descriptive stats :Returns: #. numberOfDirectories (integer): Number of diretories in repository #. numberOfFiles (integer): Number of files in repository
Repository.py
def get_stats(self): """ Get repository descriptive stats :Returns: #. numberOfDirectories (integer): Number of diretories in repository #. numberOfFiles (integer): Number of files in repository """ if self.__path is None: return 0,0 n...
def get_stats(self): """ Get repository descriptive stats :Returns: #. numberOfDirectories (integer): Number of diretories in repository #. numberOfFiles (integer): Number of files in repository """ if self.__path is None: return 0,0 n...
[ "Get", "repository", "descriptive", "stats" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L800-L822
[ "def", "get_stats", "(", "self", ")", ":", "if", "self", ".", "__path", "is", "None", ":", "return", "0", ",", "0", "nfiles", "=", "0", "ndirs", "=", "0", "for", "fdict", "in", "self", ".", "get_repository_state", "(", ")", ":", "fdname", "=", "lis...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.reset
Reset repository instance.
Repository.py
def reset(self): """Reset repository instance. """ self.__path = None self.__repo = {'repository_unique_name': str(uuid.uuid1()), 'create_utctime': time.time(), 'last_update_utctime': None, 'pyrep_version': st...
def reset(self): """Reset repository instance. """ self.__path = None self.__repo = {'repository_unique_name': str(uuid.uuid1()), 'create_utctime': time.time(), 'last_update_utctime': None, 'pyrep_version': st...
[ "Reset", "repository", "instance", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L824-L833
[ "def", "reset", "(", "self", ")", ":", "self", ".", "__path", "=", "None", "self", ".", "__repo", "=", "{", "'repository_unique_name'", ":", "str", "(", "uuid", ".", "uuid1", "(", ")", ")", ",", "'create_utctime'", ":", "time", ".", "time", "(", ")",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.is_repository
Check if there is a Repository in path. :Parameters: #. path (string): The real path of the directory where to check if there is a repository. :Returns: #. result (boolean): Whether it's a repository or not.
Repository.py
def is_repository(self, path): """ Check if there is a Repository in path. :Parameters: #. path (string): The real path of the directory where to check if there is a repository. :Returns: #. result (boolean): Whether it's a repository or not. ...
def is_repository(self, path): """ Check if there is a Repository in path. :Parameters: #. path (string): The real path of the directory where to check if there is a repository. :Returns: #. result (boolean): Whether it's a repository or not. ...
[ "Check", "if", "there", "is", "a", "Repository", "in", "path", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L836-L862
[ "def", "is_repository", "(", "self", ",", "path", ")", ":", "if", "path", ".", "strip", "(", ")", "in", "(", "''", ",", "'.'", ")", ":", "path", "=", "os", ".", "getcwd", "(", ")", "repoPath", "=", "os", ".", "path", ".", "realpath", "(", "os",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.load_repository
Load repository from a directory path and update the current instance. First, new repository still will be loaded. If failed, then old style repository load will be tried. :Parameters: #. path (string): The path of the directory from where to load the repository from....
Repository.py
def load_repository(self, path, verbose=True, ntrials=3): """ Load repository from a directory path and update the current instance. First, new repository still will be loaded. If failed, then old style repository load will be tried. :Parameters: #. path (string): Th...
def load_repository(self, path, verbose=True, ntrials=3): """ Load repository from a directory path and update the current instance. First, new repository still will be loaded. If failed, then old style repository load will be tried. :Parameters: #. path (string): Th...
[ "Load", "repository", "from", "a", "directory", "path", "and", "update", "the", "current", "instance", ".", "First", "new", "repository", "still", "will", "be", "loaded", ".", "If", "failed", "then", "old", "style", "repository", "load", "will", "be", "tried...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L865-L912
[ "def", "load_repository", "(", "self", ",", "path", ",", "verbose", "=", "True", ",", "ntrials", "=", "3", ")", ":", "assert", "isinstance", "(", "ntrials", ",", "int", ")", ",", "\"ntrials must be integer\"", "assert", "ntrials", ">", "0", ",", "\"ntrials...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.create_repository
create a repository in a directory. This method insures the creation of the directory in the system if it is missing.\n **N.B. If replace is True and existing repository is found in path, create_repository erases all existing files and directories in path.** :Parameters: #. path (s...
Repository.py
def create_repository(self, path, info=None, description=None, replace=True, allowNoneEmpty=True, raiseError=True): """ create a repository in a directory. This method insures the creation of the directory in the system if it is missing.\n **N.B. If replace is True and existing reposito...
def create_repository(self, path, info=None, description=None, replace=True, allowNoneEmpty=True, raiseError=True): """ create a repository in a directory. This method insures the creation of the directory in the system if it is missing.\n **N.B. If replace is True and existing reposito...
[ "create", "a", "repository", "in", "a", "directory", ".", "This", "method", "insures", "the", "creation", "of", "the", "directory", "in", "the", "system", "if", "it", "is", "missing", ".", "\\", "n" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L914-L989
[ "def", "create_repository", "(", "self", ",", "path", ",", "info", "=", "None", ",", "description", "=", "None", ",", "replace", "=", "True", ",", "allowNoneEmpty", "=", "True", ",", "raiseError", "=", "True", ")", ":", "assert", "isinstance", "(", "rais...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.remove_repository
Remove all repository from path along with all repository tracked files. :Parameters: #. path (None, string): The path the repository to remove. #. removeEmptyDirs (boolean): Whether to remove remaining empty directories.
Repository.py
def remove_repository(self, path=None, removeEmptyDirs=True): """ Remove all repository from path along with all repository tracked files. :Parameters: #. path (None, string): The path the repository to remove. #. removeEmptyDirs (boolean): Whether to remove remaining em...
def remove_repository(self, path=None, removeEmptyDirs=True): """ Remove all repository from path along with all repository tracked files. :Parameters: #. path (None, string): The path the repository to remove. #. removeEmptyDirs (boolean): Whether to remove remaining em...
[ "Remove", "all", "repository", "from", "path", "along", "with", "all", "repository", "tracked", "files", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L991-L1035
[ "def", "remove_repository", "(", "self", ",", "path", "=", "None", ",", "removeEmptyDirs", "=", "True", ")", ":", "assert", "isinstance", "(", "removeEmptyDirs", ",", "bool", ")", ",", "\"removeEmptyDirs must be boolean\"", "if", "path", "is", "not", "None", "...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.save
Save repository '.pyreprepo' to disk and create (if missing) or update (if description is not None) '.pyrepdirinfo'. :Parameters: #. description (None, str): Repository main directory information. If given will be replaced. #. raiseError (boolean): Whether to rais...
Repository.py
def save(self, description=None, raiseError=True, ntrials=3): """ Save repository '.pyreprepo' to disk and create (if missing) or update (if description is not None) '.pyrepdirinfo'. :Parameters: #. description (None, str): Repository main directory information. ...
def save(self, description=None, raiseError=True, ntrials=3): """ Save repository '.pyreprepo' to disk and create (if missing) or update (if description is not None) '.pyrepdirinfo'. :Parameters: #. description (None, str): Repository main directory information. ...
[ "Save", "repository", ".", "pyreprepo", "to", "disk", "and", "create", "(", "if", "missing", ")", "or", "update", "(", "if", "description", "is", "not", "None", ")", ".", "pyrepdirinfo", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1038-L1106
[ "def", "save", "(", "self", ",", "description", "=", "None", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":", "assert", "isinstance", "(", "raiseError", ",", "bool", ")", ",", "\"raiseError must be boolean\"", "assert", "isinstance", "(", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.is_name_allowed
Get whether creating a file or a directory from the basenane of the given path is allowed :Parameters: #. path (str): The absolute or relative path or simply the file or directory name. :Returns: #. allowed (bool): Whether name is allowed. #. ...
Repository.py
def is_name_allowed(self, path): """ Get whether creating a file or a directory from the basenane of the given path is allowed :Parameters: #. path (str): The absolute or relative path or simply the file or directory name. :Returns: #. all...
def is_name_allowed(self, path): """ Get whether creating a file or a directory from the basenane of the given path is allowed :Parameters: #. path (str): The absolute or relative path or simply the file or directory name. :Returns: #. all...
[ "Get", "whether", "creating", "a", "file", "or", "a", "directory", "from", "the", "basenane", "of", "the", "given", "path", "is", "allowed" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1109-L1135
[ "def", "is_name_allowed", "(", "self", ",", "path", ")", ":", "assert", "isinstance", "(", "path", ",", "basestring", ")", ",", "\"given path must be a string\"", "name", "=", "os", ".", "path", ".", "basename", "(", "path", ")", "if", "not", "len", "(", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.to_repo_relative_path
Given a path, return relative path to diretory :Parameters: #. path (str): Path as a string #. split (boolean): Whether to split path to its components :Returns: #. relativePath (str, list): Relative path as a string or as a list of components if spli...
Repository.py
def to_repo_relative_path(self, path, split=False): """ Given a path, return relative path to diretory :Parameters: #. path (str): Path as a string #. split (boolean): Whether to split path to its components :Returns: #. relativePath (str, list): Rel...
def to_repo_relative_path(self, path, split=False): """ Given a path, return relative path to diretory :Parameters: #. path (str): Path as a string #. split (boolean): Whether to split path to its components :Returns: #. relativePath (str, list): Rel...
[ "Given", "a", "path", "return", "relative", "path", "to", "diretory" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1137-L1156
[ "def", "to_repo_relative_path", "(", "self", ",", "path", ",", "split", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "normpath", "(", "path", ")", "if", "path", "==", "'.'", ":", "path", "=", "''", "path", "=", "path", ".", "split",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_repository_state
Get a list representation of repository state along with useful information. List state is ordered relativeley to directories level :Parameters: #. relaPath (None, str): relative directory path from where to start. If None all repository representation is returned. :...
Repository.py
def get_repository_state(self, relaPath=None): """ Get a list representation of repository state along with useful information. List state is ordered relativeley to directories level :Parameters: #. relaPath (None, str): relative directory path from where to s...
def get_repository_state(self, relaPath=None): """ Get a list representation of repository state along with useful information. List state is ordered relativeley to directories level :Parameters: #. relaPath (None, str): relative directory path from where to s...
[ "Get", "a", "list", "representation", "of", "repository", "state", "along", "with", "useful", "information", ".", "List", "state", "is", "ordered", "relativeley", "to", "directories", "level" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1159-L1232
[ "def", "get_repository_state", "(", "self", ",", "relaPath", "=", "None", ")", ":", "state", "=", "[", "]", "def", "_walk_dir", "(", "relaPath", ",", "dirList", ")", ":", "dirDict", "=", "{", "'type'", ":", "'dir'", ",", "'exists'", ":", "os", ".", "...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.get_file_info
Get file information dict from the repository given its relative path. :Parameters: #. relativePath (string): The relative to the repository path of the file. :Returns: #. info (None, dictionary): The file information dictionary. If None, it means ...
Repository.py
def get_file_info(self, relativePath): """ Get file information dict from the repository given its relative path. :Parameters: #. relativePath (string): The relative to the repository path of the file. :Returns: #. info (None, dictionary): The fil...
def get_file_info(self, relativePath): """ Get file information dict from the repository given its relative path. :Parameters: #. relativePath (string): The relative to the repository path of the file. :Returns: #. info (None, dictionary): The fil...
[ "Get", "file", "information", "dict", "from", "the", "repository", "given", "its", "relative", "path", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1248-L1274
[ "def", "get_file_info", "(", "self", ",", "relativePath", ")", ":", "relativePath", "=", "self", ".", "to_repo_relative_path", "(", "path", "=", "relativePath", ",", "split", "=", "False", ")", "fileName", "=", "os", ".", "path", ".", "basename", "(", "rel...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.is_repository_file
Check whether a given relative path is a repository file path :Parameters: #. relativePath (string): File relative path :Returns: #. isRepoFile (boolean): Whether file is a repository file. #. isFileOnDisk (boolean): Whether file is found on disk. #. isF...
Repository.py
def is_repository_file(self, relativePath): """ Check whether a given relative path is a repository file path :Parameters: #. relativePath (string): File relative path :Returns: #. isRepoFile (boolean): Whether file is a repository file. #. isFileOnD...
def is_repository_file(self, relativePath): """ Check whether a given relative path is a repository file path :Parameters: #. relativePath (string): File relative path :Returns: #. isRepoFile (boolean): Whether file is a repository file. #. isFileOnD...
[ "Check", "whether", "a", "given", "relative", "path", "is", "a", "repository", "file", "path" ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1290-L1328
[ "def", "is_repository_file", "(", "self", ",", "relativePath", ")", ":", "relativePath", "=", "self", ".", "to_repo_relative_path", "(", "path", "=", "relativePath", ",", "split", "=", "False", ")", "if", "relativePath", "==", "''", ":", "return", "False", "...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_files_path
Walk the repository relative path and yield file relative/full path. :parameters: #. relativePath (string): The relative path from which start the walk. #. fullPath (boolean): Whether to return full or relative path. #. recursive (boolean): Whether walk all directories files...
Repository.py
def walk_files_path(self, relativePath="", fullPath=False, recursive=False): """ Walk the repository relative path and yield file relative/full path. :parameters: #. relativePath (string): The relative path from which start the walk. #. fullPath (boolean): Whether to ret...
def walk_files_path(self, relativePath="", fullPath=False, recursive=False): """ Walk the repository relative path and yield file relative/full path. :parameters: #. relativePath (string): The relative path from which start the walk. #. fullPath (boolean): Whether to ret...
[ "Walk", "the", "repository", "relative", "path", "and", "yield", "file", "relative", "/", "full", "path", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1331-L1361
[ "def", "walk_files_path", "(", "self", ",", "relativePath", "=", "\"\"", ",", "fullPath", "=", "False", ",", "recursive", "=", "False", ")", ":", "assert", "isinstance", "(", "fullPath", ",", "bool", ")", ",", "\"fullPath must be boolean\"", "assert", "isinsta...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_files_info
Walk the repository relative path and yield tuple of two items where first item is file relative/full path and second item is file info. If file info is not found on disk, second item will be None. :parameters: #. relativePath (string): The relative path from which start the walk. ...
Repository.py
def walk_files_info(self, relativePath="", fullPath=False, recursive=False): """ Walk the repository relative path and yield tuple of two items where first item is file relative/full path and second item is file info. If file info is not found on disk, second item will be None. ...
def walk_files_info(self, relativePath="", fullPath=False, recursive=False): """ Walk the repository relative path and yield tuple of two items where first item is file relative/full path and second item is file info. If file info is not found on disk, second item will be None. ...
[ "Walk", "the", "repository", "relative", "path", "and", "yield", "tuple", "of", "two", "items", "where", "first", "item", "is", "file", "relative", "/", "full", "path", "and", "second", "item", "is", "file", "info", ".", "If", "file", "info", "is", "not"...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1363-L1388
[ "def", "walk_files_info", "(", "self", ",", "relativePath", "=", "\"\"", ",", "fullPath", "=", "False", ",", "recursive", "=", "False", ")", ":", "assert", "isinstance", "(", "fullPath", ",", "bool", ")", ",", "\"fullPath must be boolean\"", "assert", "isinsta...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.walk_directories_info
Walk the repository relative path and yield tuple of two items where first item is directory relative/full path and second item is directory info. If directory file info is not found on disk, second item will be None. :parameters: #. relativePath (string): The relative path from whi...
Repository.py
def walk_directories_info(self, relativePath="", fullPath=False, recursive=False): """ Walk the repository relative path and yield tuple of two items where first item is directory relative/full path and second item is directory info. If directory file info is not found on disk, second it...
def walk_directories_info(self, relativePath="", fullPath=False, recursive=False): """ Walk the repository relative path and yield tuple of two items where first item is directory relative/full path and second item is directory info. If directory file info is not found on disk, second it...
[ "Walk", "the", "repository", "relative", "path", "and", "yield", "tuple", "of", "two", "items", "where", "first", "item", "is", "directory", "relative", "/", "full", "path", "and", "second", "item", "is", "directory", "info", ".", "If", "directory", "file", ...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1424-L1449
[ "def", "walk_directories_info", "(", "self", ",", "relativePath", "=", "\"\"", ",", "fullPath", "=", "False", ",", "recursive", "=", "False", ")", ":", "assert", "isinstance", "(", "fullPath", ",", "bool", ")", ",", "\"fullPath must be boolean\"", "assert", "i...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.create_package
Create a tar file package of all the repository files and directories. Only files and directories that are tracked in the repository are stored in the package tar file. **N.B. On some systems packaging requires root permissions.** :Parameters: #. path (None, string): The re...
Repository.py
def create_package(self, path=None, name=None, mode=None): """ Create a tar file package of all the repository files and directories. Only files and directories that are tracked in the repository are stored in the package tar file. **N.B. On some systems packaging requires root ...
def create_package(self, path=None, name=None, mode=None): """ Create a tar file package of all the repository files and directories. Only files and directories that are tracked in the repository are stored in the package tar file. **N.B. On some systems packaging requires root ...
[ "Create", "a", "tar", "file", "package", "of", "all", "the", "repository", "files", "and", "directories", ".", "Only", "files", "and", "directories", "that", "are", "tracked", "in", "the", "repository", "are", "stored", "in", "the", "package", "tar", "file",...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1452-L1517
[ "def", "create_package", "(", "self", ",", "path", "=", "None", ",", "name", "=", "None", ",", "mode", "=", "None", ")", ":", "# check mode", "assert", "mode", "in", "(", "None", ",", "'w'", ",", "'w:'", ",", "'w:gz'", ",", "'w:bz2'", ")", ",", "'u...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.add_directory
Add a directory in the repository and creates its attribute in the Repository with utc timestamp. It insures adding all the missing directories in the path. :Parameters: #. relativePath (string): The relative to the repository path to where directory must be added. ...
Repository.py
def add_directory(self, relativePath, description=None, clean=False, raiseError=True, ntrials=3): """ Add a directory in the repository and creates its attribute in the Repository with utc timestamp. It insures adding all the missing directories in the path. ...
def add_directory(self, relativePath, description=None, clean=False, raiseError=True, ntrials=3): """ Add a directory in the repository and creates its attribute in the Repository with utc timestamp. It insures adding all the missing directories in the path. ...
[ "Add", "a", "directory", "in", "the", "repository", "and", "creates", "its", "attribute", "in", "the", "Repository", "with", "utc", "timestamp", ".", "It", "insures", "adding", "all", "the", "missing", "directories", "in", "the", "path", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1617-L1757
[ "def", "add_directory", "(", "self", ",", "relativePath", ",", "description", "=", "None", ",", "clean", "=", "False", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":", "assert", "isinstance", "(", "raiseError", ",", "bool", ")", ",", ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.remove_directory
Remove directory from repository tracking. :Parameters: #. relativePath (string): The relative to the repository path of the directory to remove from the repository. #. clean (boolean): Whether to os remove directory. If False only tracked files will be rem...
Repository.py
def remove_directory(self, relativePath, clean=False, raiseError=True, ntrials=3): """ Remove directory from repository tracking. :Parameters: #. relativePath (string): The relative to the repository path of the directory to remove from the repository. #. ...
def remove_directory(self, relativePath, clean=False, raiseError=True, ntrials=3): """ Remove directory from repository tracking. :Parameters: #. relativePath (string): The relative to the repository path of the directory to remove from the repository. #. ...
[ "Remove", "directory", "from", "repository", "tracking", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1774-L1863
[ "def", "remove_directory", "(", "self", ",", "relativePath", ",", "clean", "=", "False", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":", "assert", "isinstance", "(", "raiseError", ",", "bool", ")", ",", "\"raiseError must be boolean\"", "...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.rename_directory
Rename a directory in the repository. It insures renaming the directory in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory to be renamed. #. newName (string): The new directory name. #. raiseError (boolea...
Repository.py
def rename_directory(self, relativePath, newName, raiseError=True, ntrials=3): """ Rename a directory in the repository. It insures renaming the directory in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory to be ...
def rename_directory(self, relativePath, newName, raiseError=True, ntrials=3): """ Rename a directory in the repository. It insures renaming the directory in the system. :Parameters: #. relativePath (string): The relative to the repository path of the directory to be ...
[ "Rename", "a", "directory", "in", "the", "repository", ".", "It", "insures", "renaming", "the", "directory", "in", "the", "system", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1867-L1968
[ "def", "rename_directory", "(", "self", ",", "relativePath", ",", "newName", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":", "assert", "isinstance", "(", "raiseError", ",", "bool", ")", ",", "\"raiseError must be boolean\"", "assert", "isin...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.copy_directory
Copy a directory in the repository. New directory must not exist. :Parameters: #. relativePath (string): The relative to the repository path of the directory to be copied. #. newRelativePath (string): The new directory relative path. #. overwrite (boolean): Wh...
Repository.py
def copy_directory(self, relativePath, newRelativePath, overwrite=False, raiseError=True, ntrials=3): """ Copy a directory in the repository. New directory must not exist. :Parameters: #. relativePath (string): The relative to the repository path of ...
def copy_directory(self, relativePath, newRelativePath, overwrite=False, raiseError=True, ntrials=3): """ Copy a directory in the repository. New directory must not exist. :Parameters: #. relativePath (string): The relative to the repository path of ...
[ "Copy", "a", "directory", "in", "the", "repository", ".", "New", "directory", "must", "not", "exist", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L1971-L2120
[ "def", "copy_directory", "(", "self", ",", "relativePath", ",", "newRelativePath", ",", "overwrite", "=", "False", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":", "#from distutils.dir_util import copy_tree", "assert", "isinstance", "(", "raiseE...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.dump_file
Dump a file using its value to the system and creates its attribute in the Repository with utc timestamp. :Parameters: #. value (object): The value of a file to dump and add to the repository. It is any python object or file. #. relativePath (str): The relative to...
Repository.py
def dump_file(self, value, relativePath, description=None, dump=None, pull=None, replace=False, raiseError=True, ntrials=3): """ Dump a file using its value to the system and creates its attribute in the Repository with utc ...
def dump_file(self, value, relativePath, description=None, dump=None, pull=None, replace=False, raiseError=True, ntrials=3): """ Dump a file using its value to the system and creates its attribute in the Repository with utc ...
[ "Dump", "a", "file", "using", "its", "value", "to", "the", "system", "and", "creates", "its", "attribute", "in", "the", "Repository", "with", "utc", "timestamp", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L2124-L2297
[ "def", "dump_file", "(", "self", ",", "value", ",", "relativePath", ",", "description", "=", "None", ",", "dump", "=", "None", ",", "pull", "=", "None", ",", "replace", "=", "False", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":",...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.update_file
Update the value of a file that is already in the Repository.\n If file is not registered in repository, and error will be thrown.\n If file is missing in the system, it will be regenerated as dump method is called. Unlike dump_file, update_file won't block the whole repository but only ...
Repository.py
def update_file(self, value, relativePath, description=False, dump=False, pull=False, raiseError=True, ntrials=3): """ Update the value of a file that is already in the Repository.\n If file is not registered in repository, and error will be thrown.\n If file is...
def update_file(self, value, relativePath, description=False, dump=False, pull=False, raiseError=True, ntrials=3): """ Update the value of a file that is already in the Repository.\n If file is not registered in repository, and error will be thrown.\n If file is...
[ "Update", "the", "value", "of", "a", "file", "that", "is", "already", "in", "the", "Repository", ".", "\\", "n", "If", "file", "is", "not", "registered", "in", "repository", "and", "error", "will", "be", "thrown", ".", "\\", "n", "If", "file", "is", ...
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L2418-L2555
[ "def", "update_file", "(", "self", ",", "value", ",", "relativePath", ",", "description", "=", "False", ",", "dump", "=", "False", ",", "pull", "=", "False", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":", "# check arguments", "assert...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.pull_file
Pull a file's data from the Repository. :Parameters: #. relativePath (string): The relative to the repository path from where to pull the file. #. pull (None, string): The pulling method. If None, the pull method saved in the file info will be used. ...
Repository.py
def pull_file(self, relativePath, pull=None, update=True, ntrials=3): """ Pull a file's data from the Repository. :Parameters: #. relativePath (string): The relative to the repository path from where to pull the file. #. pull (None, string): The pulling me...
def pull_file(self, relativePath, pull=None, update=True, ntrials=3): """ Pull a file's data from the Repository. :Parameters: #. relativePath (string): The relative to the repository path from where to pull the file. #. pull (None, string): The pulling me...
[ "Pull", "a", "file", "s", "data", "from", "the", "Repository", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L2563-L2641
[ "def", "pull_file", "(", "self", ",", "relativePath", ",", "pull", "=", "None", ",", "update", "=", "True", ",", "ntrials", "=", "3", ")", ":", "assert", "isinstance", "(", "ntrials", ",", "int", ")", ",", "\"ntrials must be integer\"", "assert", "ntrials"...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.rename_file
Rename a file in the repository. It insures renaming the file in the system. :Parameters: #. relativePath (string): The relative to the repository path of the file that needst to be renamed. #. newRelativePath (string): The new relative to the repository path ...
Repository.py
def rename_file(self, relativePath, newRelativePath, force=False, raiseError=True, ntrials=3): """ Rename a file in the repository. It insures renaming the file in the system. :Parameters: #. relativePath (string): The relative to the repository path of ...
def rename_file(self, relativePath, newRelativePath, force=False, raiseError=True, ntrials=3): """ Rename a file in the repository. It insures renaming the file in the system. :Parameters: #. relativePath (string): The relative to the repository path of ...
[ "Rename", "a", "file", "in", "the", "repository", ".", "It", "insures", "renaming", "the", "file", "in", "the", "system", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L2649-L2768
[ "def", "rename_file", "(", "self", ",", "relativePath", ",", "newRelativePath", ",", "force", "=", "False", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":", "assert", "isinstance", "(", "raiseError", ",", "bool", ")", ",", "\"raiseError ...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Repository.remove_file
Remove file from repository. :Parameters: #. relativePath (string): The relative to the repository path of the file to remove. #. removeFromSystem (boolean): Whether to remove file from disk as well. #. raiseError (boolean): Whether to raise enc...
Repository.py
def remove_file(self, relativePath, removeFromSystem=False, raiseError=True, ntrials=3): """ Remove file from repository. :Parameters: #. relativePath (string): The relative to the repository path of the file to remove. #. removeF...
def remove_file(self, relativePath, removeFromSystem=False, raiseError=True, ntrials=3): """ Remove file from repository. :Parameters: #. relativePath (string): The relative to the repository path of the file to remove. #. removeF...
[ "Remove", "file", "from", "repository", "." ]
bachiraoun/pyrep
python
https://github.com/bachiraoun/pyrep/blob/0449bf2fad3e3e8dda855d4686a8869efeefd433/Repository.py#L2772-L2850
[ "def", "remove_file", "(", "self", ",", "relativePath", ",", "removeFromSystem", "=", "False", ",", "raiseError", "=", "True", ",", "ntrials", "=", "3", ")", ":", "assert", "isinstance", "(", "raiseError", ",", "bool", ")", ",", "\"removeFromSystem must be boo...
0449bf2fad3e3e8dda855d4686a8869efeefd433
valid
Metadata.rename
Renames an item in this collection as a transaction. Will override if new key name already exists. :param key: the current name of the item :param new_key: the new name that the item should have
hgicommon/collections.py
def rename(self, key: Any, new_key: Any): """ Renames an item in this collection as a transaction. Will override if new key name already exists. :param key: the current name of the item :param new_key: the new name that the item should have """ if new_key == key:...
def rename(self, key: Any, new_key: Any): """ Renames an item in this collection as a transaction. Will override if new key name already exists. :param key: the current name of the item :param new_key: the new name that the item should have """ if new_key == key:...
[ "Renames", "an", "item", "in", "this", "collection", "as", "a", "transaction", "." ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/collections.py#L66-L89
[ "def", "rename", "(", "self", ",", "key", ":", "Any", ",", "new_key", ":", "Any", ")", ":", "if", "new_key", "==", "key", ":", "return", "required_locks", "=", "[", "self", ".", "_key_locks", "[", "key", "]", ",", "self", ".", "_key_locks", "[", "n...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
get_text_fingerprint
Use default hash method to return hash value of a piece of string default setting use 'utf-8' encoding.
pathlib_mate/hashes.py
def get_text_fingerprint(text, hash_meth, encoding="utf-8"): # pragma: no cover """ Use default hash method to return hash value of a piece of string default setting use 'utf-8' encoding. """ m = hash_meth() m.update(text.encode(encoding)) return m.hexdigest()
def get_text_fingerprint(text, hash_meth, encoding="utf-8"): # pragma: no cover """ Use default hash method to return hash value of a piece of string default setting use 'utf-8' encoding. """ m = hash_meth() m.update(text.encode(encoding)) return m.hexdigest()
[ "Use", "default", "hash", "method", "to", "return", "hash", "value", "of", "a", "piece", "of", "string", "default", "setting", "use", "utf", "-", "8", "encoding", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/hashes.py#L8-L15
[ "def", "get_text_fingerprint", "(", "text", ",", "hash_meth", ",", "encoding", "=", "\"utf-8\"", ")", ":", "# pragma: no cover", "m", "=", "hash_meth", "(", ")", "m", ".", "update", "(", "text", ".", "encode", "(", "encoding", ")", ")", "return", "m", "....
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
md5file
Return md5 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file CPU = i7-4600U 2.10GHz - 2.70GHz, RAM = 8.00 GB 1 second can process 0.25GB data - 0.59G ...
pathlib_mate/hashes.py
def md5file(abspath, nbytes=0, chunk_size=DEFAULT_CHUNK_SIZE): """ Return md5 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file CPU = i7-4600U 2.10GHz ...
def md5file(abspath, nbytes=0, chunk_size=DEFAULT_CHUNK_SIZE): """ Return md5 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file CPU = i7-4600U 2.10GHz ...
[ "Return", "md5", "hash", "value", "of", "a", "piece", "of", "a", "file" ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/hashes.py#L51-L70
[ "def", "md5file", "(", "abspath", ",", "nbytes", "=", "0", ",", "chunk_size", "=", "DEFAULT_CHUNK_SIZE", ")", ":", "return", "get_file_fingerprint", "(", "abspath", ",", "hashlib", ".", "md5", ",", "nbytes", "=", "nbytes", ",", "chunk_size", "=", "chunk_size...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
sha256file
Return sha256 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file
pathlib_mate/hashes.py
def sha256file(abspath, nbytes=0, chunk_size=DEFAULT_CHUNK_SIZE): """ Return sha256 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file """ return get...
def sha256file(abspath, nbytes=0, chunk_size=DEFAULT_CHUNK_SIZE): """ Return sha256 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file """ return get...
[ "Return", "sha256", "hash", "value", "of", "a", "piece", "of", "a", "file" ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/hashes.py#L73-L83
[ "def", "sha256file", "(", "abspath", ",", "nbytes", "=", "0", ",", "chunk_size", "=", "DEFAULT_CHUNK_SIZE", ")", ":", "return", "get_file_fingerprint", "(", "abspath", ",", "hashlib", ".", "sha256", ",", "nbytes", "=", "nbytes", ",", "chunk_size", "=", "chun...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
sha512file
Return sha512 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file
pathlib_mate/hashes.py
def sha512file(abspath, nbytes=0, chunk_size=DEFAULT_CHUNK_SIZE): """ Return sha512 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file """ return get...
def sha512file(abspath, nbytes=0, chunk_size=DEFAULT_CHUNK_SIZE): """ Return sha512 hash value of a piece of a file Estimate processing time on: :param abspath: the absolute path to the file :param nbytes: only has first N bytes of the file. if 0 or None, hash all file """ return get...
[ "Return", "sha512", "hash", "value", "of", "a", "piece", "of", "a", "file" ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/hashes.py#L86-L96
[ "def", "sha512file", "(", "abspath", ",", "nbytes", "=", "0", ",", "chunk_size", "=", "DEFAULT_CHUNK_SIZE", ")", ":", "return", "get_file_fingerprint", "(", "abspath", ",", "hashlib", ".", "sha512", ",", "nbytes", "=", "nbytes", ",", "chunk_size", "=", "chun...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
register
Registers an object, notifying any listeners that may be interested in it. :param registerable: the object to register
hgicommon/data_source/dynamic_from_file.py
def register(registerable: Any): """ Registers an object, notifying any listeners that may be interested in it. :param registerable: the object to register """ listenable = registration_event_listenable_map[type(registerable)] event = RegistrationEvent(registerable, RegistrationEvent.Type.REGIST...
def register(registerable: Any): """ Registers an object, notifying any listeners that may be interested in it. :param registerable: the object to register """ listenable = registration_event_listenable_map[type(registerable)] event = RegistrationEvent(registerable, RegistrationEvent.Type.REGIST...
[ "Registers", "an", "object", "notifying", "any", "listeners", "that", "may", "be", "interested", "in", "it", ".", ":", "param", "registerable", ":", "the", "object", "to", "register" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/dynamic_from_file.py#L41-L48
[ "def", "register", "(", "registerable", ":", "Any", ")", ":", "listenable", "=", "registration_event_listenable_map", "[", "type", "(", "registerable", ")", "]", "event", "=", "RegistrationEvent", "(", "registerable", ",", "RegistrationEvent", ".", "Type", ".", ...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
unregister
Unregisters an object, notifying any listeners that may be interested in it. :param registerable: the object to unregister
hgicommon/data_source/dynamic_from_file.py
def unregister(registerable: Any): """ Unregisters an object, notifying any listeners that may be interested in it. :param registerable: the object to unregister """ listenable = registration_event_listenable_map[type(registerable)] event = RegistrationEvent(registerable, RegistrationEvent.Type....
def unregister(registerable: Any): """ Unregisters an object, notifying any listeners that may be interested in it. :param registerable: the object to unregister """ listenable = registration_event_listenable_map[type(registerable)] event = RegistrationEvent(registerable, RegistrationEvent.Type....
[ "Unregisters", "an", "object", "notifying", "any", "listeners", "that", "may", "be", "interested", "in", "it", ".", ":", "param", "registerable", ":", "the", "object", "to", "unregister" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/dynamic_from_file.py#L51-L58
[ "def", "unregister", "(", "registerable", ":", "Any", ")", ":", "listenable", "=", "registration_event_listenable_map", "[", "type", "(", "registerable", ")", "]", "event", "=", "RegistrationEvent", "(", "registerable", ",", "RegistrationEvent", ".", "Type", ".", ...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
RegisteringDataSource._load_module
Dynamically loads the python module at the given path. :param path: the path to load the module from
hgicommon/data_source/dynamic_from_file.py
def _load_module(path: str): """ Dynamically loads the python module at the given path. :param path: the path to load the module from """ spec = spec_from_file_location(os.path.basename(path), path) module = module_from_spec(spec) spec.loader.exec_module(module)
def _load_module(path: str): """ Dynamically loads the python module at the given path. :param path: the path to load the module from """ spec = spec_from_file_location(os.path.basename(path), path) module = module_from_spec(spec) spec.loader.exec_module(module)
[ "Dynamically", "loads", "the", "python", "module", "at", "the", "given", "path", ".", ":", "param", "path", ":", "the", "path", "to", "load", "the", "module", "from" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/data_source/dynamic_from_file.py#L114-L121
[ "def", "_load_module", "(", "path", ":", "str", ")", ":", "spec", "=", "spec_from_file_location", "(", "os", ".", "path", ".", "basename", "(", "path", ")", ",", "path", ")", "module", "=", "module_from_spec", "(", "spec", ")", "spec", ".", "loader", "...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
ToolBox.is_empty
- If it's a file, check if it is a empty file. (0 bytes content) - If it's a directory, check if there's no file and dir in it. But if ``strict = False``, then only check if there's no file in it. :param strict: only useful when it is a directory. if True, only return True if th...
pathlib_mate/mate_tool_box.py
def is_empty(self, strict=True): """ - If it's a file, check if it is a empty file. (0 bytes content) - If it's a directory, check if there's no file and dir in it. But if ``strict = False``, then only check if there's no file in it. :param strict: only useful when it is a d...
def is_empty(self, strict=True): """ - If it's a file, check if it is a empty file. (0 bytes content) - If it's a directory, check if there's no file and dir in it. But if ``strict = False``, then only check if there's no file in it. :param strict: only useful when it is a d...
[ "-", "If", "it", "s", "a", "file", "check", "if", "it", "is", "a", "empty", "file", ".", "(", "0", "bytes", "content", ")", "-", "If", "it", "s", "a", "directory", "check", "if", "there", "s", "no", "file", "and", "dir", "in", "it", ".", "But",...
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L33-L55
[ "def", "is_empty", "(", "self", ",", "strict", "=", "True", ")", ":", "if", "self", ".", "exists", "(", ")", ":", "if", "self", ".", "is_file", "(", ")", ":", "return", "self", ".", "size", "==", "0", "elif", "self", ".", "is_dir", "(", ")", ":...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.auto_complete_choices
A command line auto complete similar behavior. Find all item with same prefix of this one. :param case_sensitive: toggle if it is case sensitive. :return: list of :class:`pathlib_mate.pathlib2.Path`.
pathlib_mate/mate_tool_box.py
def auto_complete_choices(self, case_sensitive=False): """ A command line auto complete similar behavior. Find all item with same prefix of this one. :param case_sensitive: toggle if it is case sensitive. :return: list of :class:`pathlib_mate.pathlib2.Path`. """ ...
def auto_complete_choices(self, case_sensitive=False): """ A command line auto complete similar behavior. Find all item with same prefix of this one. :param case_sensitive: toggle if it is case sensitive. :return: list of :class:`pathlib_mate.pathlib2.Path`. """ ...
[ "A", "command", "line", "auto", "complete", "similar", "behavior", ".", "Find", "all", "item", "with", "same", "prefix", "of", "this", "one", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L57-L87
[ "def", "auto_complete_choices", "(", "self", ",", "case_sensitive", "=", "False", ")", ":", "self_basename", "=", "self", ".", "basename", "self_basename_lower", "=", "self", ".", "basename", ".", "lower", "(", ")", "if", "case_sensitive", ":", "# pragma: no cov...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.print_big_dir
Print ``top_n`` big dir in this dir.
pathlib_mate/mate_tool_box.py
def print_big_dir(self, top_n=5): """ Print ``top_n`` big dir in this dir. """ self.assert_is_dir_and_exists() size_table = sorted( [(p, p.dirsize) for p in self.select_dir(recursive=False)], key=lambda x: x[1], reverse=True, ) ...
def print_big_dir(self, top_n=5): """ Print ``top_n`` big dir in this dir. """ self.assert_is_dir_and_exists() size_table = sorted( [(p, p.dirsize) for p in self.select_dir(recursive=False)], key=lambda x: x[1], reverse=True, ) ...
[ "Print", "top_n", "big", "dir", "in", "this", "dir", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L90-L102
[ "def", "print_big_dir", "(", "self", ",", "top_n", "=", "5", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "size_table", "=", "sorted", "(", "[", "(", "p", ",", "p", ".", "dirsize", ")", "for", "p", "in", "self", ".", "select_dir", "("...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.print_big_file
Print ``top_n`` big file in this dir.
pathlib_mate/mate_tool_box.py
def print_big_file(self, top_n=5): """ Print ``top_n`` big file in this dir. """ self.assert_is_dir_and_exists() size_table = sorted( [(p, p.size) for p in self.select_file(recursive=True)], key=lambda x: x[1], reverse=True, ) ...
def print_big_file(self, top_n=5): """ Print ``top_n`` big file in this dir. """ self.assert_is_dir_and_exists() size_table = sorted( [(p, p.size) for p in self.select_file(recursive=True)], key=lambda x: x[1], reverse=True, ) ...
[ "Print", "top_n", "big", "file", "in", "this", "dir", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L104-L116
[ "def", "print_big_file", "(", "self", ",", "top_n", "=", "5", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "size_table", "=", "sorted", "(", "[", "(", "p", ",", "p", ".", "size", ")", "for", "p", "in", "self", ".", "select_file", "(",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.print_big_dir_and_big_file
Print ``top_n`` big dir and ``top_n`` big file in each dir.
pathlib_mate/mate_tool_box.py
def print_big_dir_and_big_file(self, top_n=5): """Print ``top_n`` big dir and ``top_n`` big file in each dir. """ self.assert_is_dir_and_exists() size_table1 = sorted( [(p, p.dirsize) for p in self.select_dir(recursive=False)], key=lambda x: x[1], rev...
def print_big_dir_and_big_file(self, top_n=5): """Print ``top_n`` big dir and ``top_n`` big file in each dir. """ self.assert_is_dir_and_exists() size_table1 = sorted( [(p, p.dirsize) for p in self.select_dir(recursive=False)], key=lambda x: x[1], rev...
[ "Print", "top_n", "big", "dir", "and", "top_n", "big", "file", "in", "each", "dir", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L118-L137
[ "def", "print_big_dir_and_big_file", "(", "self", ",", "top_n", "=", "5", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "size_table1", "=", "sorted", "(", "[", "(", "p", ",", "p", ".", "dirsize", ")", "for", "p", "in", "self", ".", "sele...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.file_stat_for_all
Find out how many files, directories and total size (Include file in it's sub-folder) it has for each folder and sub-folder. :returns: stat, a dict like ``{"directory path": { "file": number of files, "dir": number of directories, "size": total size in bytes}}`` **中文文档** ...
pathlib_mate/mate_tool_box.py
def file_stat_for_all(self, filters=all_true): # pragma: no cover """ Find out how many files, directories and total size (Include file in it's sub-folder) it has for each folder and sub-folder. :returns: stat, a dict like ``{"directory path": { "file": number of files, "dir"...
def file_stat_for_all(self, filters=all_true): # pragma: no cover """ Find out how many files, directories and total size (Include file in it's sub-folder) it has for each folder and sub-folder. :returns: stat, a dict like ``{"directory path": { "file": number of files, "dir"...
[ "Find", "out", "how", "many", "files", "directories", "and", "total", "size", "(", "Include", "file", "in", "it", "s", "sub", "-", "folder", ")", "it", "has", "for", "each", "folder", "and", "sub", "-", "folder", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L139-L185
[ "def", "file_stat_for_all", "(", "self", ",", "filters", "=", "all_true", ")", ":", "# pragma: no cover", "self", ".", "assert_is_dir_and_exists", "(", ")", "from", "collections", "import", "OrderedDict", "stat", "=", "OrderedDict", "(", ")", "stat", "[", "self"...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.file_stat
Find out how many files, directorys and total size (Include file in it's sub-folder). :returns: stat, a dict like ``{"file": number of files, "dir": number of directorys, "size": total size in bytes}`` **中文文档** 返回一个目录中的文件, 文件夹, 大小的统计数据。
pathlib_mate/mate_tool_box.py
def file_stat(self, filters=all_true): """Find out how many files, directorys and total size (Include file in it's sub-folder). :returns: stat, a dict like ``{"file": number of files, "dir": number of directorys, "size": total size in bytes}`` **中文文档** 返回一个目录中的文件, 文件...
def file_stat(self, filters=all_true): """Find out how many files, directorys and total size (Include file in it's sub-folder). :returns: stat, a dict like ``{"file": number of files, "dir": number of directorys, "size": total size in bytes}`` **中文文档** 返回一个目录中的文件, 文件...
[ "Find", "out", "how", "many", "files", "directorys", "and", "total", "size", "(", "Include", "file", "in", "it", "s", "sub", "-", "folder", ")", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L187-L209
[ "def", "file_stat", "(", "self", ",", "filters", "=", "all_true", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "stat", "=", "{", "\"file\"", ":", "0", ",", "\"dir\"", ":", "0", ",", "\"size\"", ":", "0", "}", "for", "p", "in", "self",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.mirror_to
Create a new folder having exactly same structure with this directory. However, all files are just empty file with same file name. :param dst: destination directory. The directory can't exists before you execute this. **中文文档** 创建一个目录的镜像拷贝, 与拷贝操作不同的是, 文件的副本只是在文件名上 与原件一致...
pathlib_mate/mate_tool_box.py
def mirror_to(self, dst): # pragma: no cover """ Create a new folder having exactly same structure with this directory. However, all files are just empty file with same file name. :param dst: destination directory. The directory can't exists before you execute this. **...
def mirror_to(self, dst): # pragma: no cover """ Create a new folder having exactly same structure with this directory. However, all files are just empty file with same file name. :param dst: destination directory. The directory can't exists before you execute this. **...
[ "Create", "a", "new", "folder", "having", "exactly", "same", "structure", "with", "this", "directory", ".", "However", "all", "files", "are", "just", "empty", "file", "with", "same", "file", "name", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L211-L243
[ "def", "mirror_to", "(", "self", ",", "dst", ")", ":", "# pragma: no cover", "self", ".", "assert_is_dir_and_exists", "(", ")", "src", "=", "self", ".", "abspath", "dst", "=", "os", ".", "path", ".", "abspath", "(", "dst", ")", "if", "os", ".", "path",...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.execute_pyfile
Execute every ``.py`` file as main script. :param py_exe: str, python command or python executable path. **中文文档** 将目录下的所有Python文件作为主脚本用当前解释器运行。
pathlib_mate/mate_tool_box.py
def execute_pyfile(self, py_exe=None): # pragma: no cover """ Execute every ``.py`` file as main script. :param py_exe: str, python command or python executable path. **中文文档** 将目录下的所有Python文件作为主脚本用当前解释器运行。 """ import subprocess self.assert_is_dir_and_...
def execute_pyfile(self, py_exe=None): # pragma: no cover """ Execute every ``.py`` file as main script. :param py_exe: str, python command or python executable path. **中文文档** 将目录下的所有Python文件作为主脚本用当前解释器运行。 """ import subprocess self.assert_is_dir_and_...
[ "Execute", "every", ".", "py", "file", "as", "main", "script", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L245-L266
[ "def", "execute_pyfile", "(", "self", ",", "py_exe", "=", "None", ")", ":", "# pragma: no cover", "import", "subprocess", "self", ".", "assert_is_dir_and_exists", "(", ")", "if", "py_exe", "is", "None", ":", "if", "six", ".", "PY2", ":", "py_exe", "=", "\"...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.trail_space
Trail white space at end of each line for every ``.py`` file. **中文文档** 将目录下的所有被选择的文件中行末的空格删除。
pathlib_mate/mate_tool_box.py
def trail_space(self, filters=lambda p: p.ext == ".py"): # pragma: no cover """ Trail white space at end of each line for every ``.py`` file. **中文文档** 将目录下的所有被选择的文件中行末的空格删除。 """ self.assert_is_dir_and_exists() for p in self.select_file(filters): tr...
def trail_space(self, filters=lambda p: p.ext == ".py"): # pragma: no cover """ Trail white space at end of each line for every ``.py`` file. **中文文档** 将目录下的所有被选择的文件中行末的空格删除。 """ self.assert_is_dir_and_exists() for p in self.select_file(filters): tr...
[ "Trail", "white", "space", "at", "end", "of", "each", "line", "for", "every", ".", "py", "file", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L268-L289
[ "def", "trail_space", "(", "self", ",", "filters", "=", "lambda", "p", ":", "p", ".", "ext", "==", "\".py\"", ")", ":", "# pragma: no cover", "self", ".", "assert_is_dir_and_exists", "(", ")", "for", "p", "in", "self", ".", "select_file", "(", "filters", ...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
ToolBox.autopep8
Auto convert your python code in a directory to pep8 styled code. :param kwargs: arguments for ``autopep8.fix_code`` method. **中文文档** 将目录下的所有Python文件用pep8风格格式化。增加其可读性和规范性。
pathlib_mate/mate_tool_box.py
def autopep8(self, **kwargs): # pragma: no cover """ Auto convert your python code in a directory to pep8 styled code. :param kwargs: arguments for ``autopep8.fix_code`` method. **中文文档** 将目录下的所有Python文件用pep8风格格式化。增加其可读性和规范性。 """ self.assert_is_dir_and_exists()...
def autopep8(self, **kwargs): # pragma: no cover """ Auto convert your python code in a directory to pep8 styled code. :param kwargs: arguments for ``autopep8.fix_code`` method. **中文文档** 将目录下的所有Python文件用pep8风格格式化。增加其可读性和规范性。 """ self.assert_is_dir_and_exists()...
[ "Auto", "convert", "your", "python", "code", "in", "a", "directory", "to", "pep8", "styled", "code", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_tool_box.py#L291-L310
[ "def", "autopep8", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# pragma: no cover", "self", ".", "assert_is_dir_and_exists", "(", ")", "for", "p", "in", "self", ".", "select_by_ext", "(", "\".py\"", ")", ":", "with", "open", "(", "p", ".", "abspath"...
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
Listenable.notify_listeners
Notify event listeners, passing them the given data (if any). :param data: the data to pass to the event listeners
hgicommon/mixable/listenable.py
def notify_listeners(self, data: Optional[_ListenableDataType]=_NO_DATA_MARKER): """ Notify event listeners, passing them the given data (if any). :param data: the data to pass to the event listeners """ for listener in self._listeners: if data is not Listenable._NO_D...
def notify_listeners(self, data: Optional[_ListenableDataType]=_NO_DATA_MARKER): """ Notify event listeners, passing them the given data (if any). :param data: the data to pass to the event listeners """ for listener in self._listeners: if data is not Listenable._NO_D...
[ "Notify", "event", "listeners", "passing", "them", "the", "given", "data", "(", "if", "any", ")", ".", ":", "param", "data", ":", "the", "data", "to", "pass", "to", "the", "event", "listeners" ]
wtsi-hgi/python-common
python
https://github.com/wtsi-hgi/python-common/blob/0376a6b574ff46e82e509e90b6cb3693a3dbb577/hgicommon/mixable/listenable.py#L58-L67
[ "def", "notify_listeners", "(", "self", ",", "data", ":", "Optional", "[", "_ListenableDataType", "]", "=", "_NO_DATA_MARKER", ")", ":", "for", "listener", "in", "self", ".", "_listeners", ":", "if", "data", "is", "not", "Listenable", ".", "_NO_DATA_MARKER", ...
0376a6b574ff46e82e509e90b6cb3693a3dbb577
valid
AttrAccessor.size
File size in bytes.
pathlib_mate/mate_attr_accessor.py
def size(self): """ File size in bytes. """ try: return self._stat.st_size except: # pragma: no cover self._stat = self.stat() return self.size
def size(self): """ File size in bytes. """ try: return self._stat.st_size except: # pragma: no cover self._stat = self.stat() return self.size
[ "File", "size", "in", "bytes", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_attr_accessor.py#L110-L118
[ "def", "size", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_stat", ".", "st_size", "except", ":", "# pragma: no cover", "self", ".", "_stat", "=", "self", ".", "stat", "(", ")", "return", "self", ".", "size" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
AttrAccessor.mtime
Get most recent modify time in timestamp.
pathlib_mate/mate_attr_accessor.py
def mtime(self): """ Get most recent modify time in timestamp. """ try: return self._stat.st_mtime except: # pragma: no cover self._stat = self.stat() return self.mtime
def mtime(self): """ Get most recent modify time in timestamp. """ try: return self._stat.st_mtime except: # pragma: no cover self._stat = self.stat() return self.mtime
[ "Get", "most", "recent", "modify", "time", "in", "timestamp", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_attr_accessor.py#L128-L136
[ "def", "mtime", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_stat", ".", "st_mtime", "except", ":", "# pragma: no cover", "self", ".", "_stat", "=", "self", ".", "stat", "(", ")", "return", "self", ".", "mtime" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
AttrAccessor.atime
Get most recent access time in timestamp.
pathlib_mate/mate_attr_accessor.py
def atime(self): """ Get most recent access time in timestamp. """ try: return self._stat.st_atime except: # pragma: no cover self._stat = self.stat() return self.atime
def atime(self): """ Get most recent access time in timestamp. """ try: return self._stat.st_atime except: # pragma: no cover self._stat = self.stat() return self.atime
[ "Get", "most", "recent", "access", "time", "in", "timestamp", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_attr_accessor.py#L139-L147
[ "def", "atime", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_stat", ".", "st_atime", "except", ":", "# pragma: no cover", "self", ".", "_stat", "=", "self", ".", "stat", "(", ")", "return", "self", ".", "atime" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
AttrAccessor.ctime
Get most recent create time in timestamp.
pathlib_mate/mate_attr_accessor.py
def ctime(self): """ Get most recent create time in timestamp. """ try: return self._stat.st_ctime except: # pragma: no cover self._stat = self.stat() return self.ctime
def ctime(self): """ Get most recent create time in timestamp. """ try: return self._stat.st_ctime except: # pragma: no cover self._stat = self.stat() return self.ctime
[ "Get", "most", "recent", "create", "time", "in", "timestamp", "." ]
MacHu-GWU/pathlib_mate-project
python
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_attr_accessor.py#L150-L158
[ "def", "ctime", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_stat", ".", "st_ctime", "except", ":", "# pragma: no cover", "self", ".", "_stat", "=", "self", ".", "stat", "(", ")", "return", "self", ".", "ctime" ]
f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1
valid
get_terminal_size
Return current terminal size (cols, rows) or a default if detect fails. This snippet comes from color ls by Chuck Blake: http://pdos.csail.mit.edu/~cblake/cls/cls.py
tui/__init__.py
def get_terminal_size(default_cols=80, default_rows=25): """Return current terminal size (cols, rows) or a default if detect fails. This snippet comes from color ls by Chuck Blake: http://pdos.csail.mit.edu/~cblake/cls/cls.py """ def ioctl_GWINSZ(fd): """Get (cols, rows) from a putative fd...
def get_terminal_size(default_cols=80, default_rows=25): """Return current terminal size (cols, rows) or a default if detect fails. This snippet comes from color ls by Chuck Blake: http://pdos.csail.mit.edu/~cblake/cls/cls.py """ def ioctl_GWINSZ(fd): """Get (cols, rows) from a putative fd...
[ "Return", "current", "terminal", "size", "(", "cols", "rows", ")", "or", "a", "default", "if", "detect", "fails", "." ]
yohell/python-tui
python
https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L460-L486
[ "def", "get_terminal_size", "(", "default_cols", "=", "80", ",", "default_rows", "=", "25", ")", ":", "def", "ioctl_GWINSZ", "(", "fd", ")", ":", "\"\"\"Get (cols, rows) from a putative fd to a tty.\"\"\"", "try", ":", "rows_cols", "=", "struct", ".", "unpack", "(...
de2e678e2f00e5940de52c000214dbcb8812a222
valid
get_metainfo
Dumb helper for pulling metainfo from a script __doc__ string. Returns a metainfo dict with command, description, progname and the given keywords (if present). This function will only make minimal efforts to succeed. If you need anything else: roll your own. The docstring needs to b...
tui/__init__.py
def get_metainfo(scriptfile, keywords=['author', 'contact', 'copyright', 'download', 'git', 'subversion', 'version', 'website'], special={}, first_line_pattern=r'^(?P<progname>.+)(\s+v(?P<version>\S+))?', keyword_pattern_template=r'^\s*%(pretty)s:\s*(?...
def get_metainfo(scriptfile, keywords=['author', 'contact', 'copyright', 'download', 'git', 'subversion', 'version', 'website'], special={}, first_line_pattern=r'^(?P<progname>.+)(\s+v(?P<version>\S+))?', keyword_pattern_template=r'^\s*%(pretty)s:\s*(?...
[ "Dumb", "helper", "for", "pulling", "metainfo", "from", "a", "script", "__doc__", "string", ".", "Returns", "a", "metainfo", "dict", "with", "command", "description", "progname", "and", "the", "given", "keywords", "(", "if", "present", ")", ".", "This", "fun...
yohell/python-tui
python
https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L493-L562
[ "def", "get_metainfo", "(", "scriptfile", ",", "keywords", "=", "[", "'author'", ",", "'contact'", ",", "'copyright'", ",", "'download'", ",", "'git'", ",", "'subversion'", ",", "'version'", ",", "'website'", "]", ",", "special", "=", "{", "}", ",", "first...
de2e678e2f00e5940de52c000214dbcb8812a222
valid
StrictConfigParser.unusedoptions
Lists options that have not been used to format other values in their sections. Good for finding out if the user has misspelled any of the options.
tui/__init__.py
def unusedoptions(self, sections): """Lists options that have not been used to format other values in their sections. Good for finding out if the user has misspelled any of the options. """ unused = set([]) for section in _list(sections): if not sel...
def unusedoptions(self, sections): """Lists options that have not been used to format other values in their sections. Good for finding out if the user has misspelled any of the options. """ unused = set([]) for section in _list(sections): if not sel...
[ "Lists", "options", "that", "have", "not", "been", "used", "to", "format", "other", "values", "in", "their", "sections", ".", "Good", "for", "finding", "out", "if", "the", "user", "has", "misspelled", "any", "of", "the", "options", "." ]
yohell/python-tui
python
https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L439-L458
[ "def", "unusedoptions", "(", "self", ",", "sections", ")", ":", "unused", "=", "set", "(", "[", "]", ")", "for", "section", "in", "_list", "(", "sections", ")", ":", "if", "not", "self", ".", "has_section", "(", "section", ")", ":", "continue", "opti...
de2e678e2f00e5940de52c000214dbcb8812a222
valid
Option.parse
Consume and process arguments and store the result. ARGS: argv <list str>: The argument list to parse. usedname <str>: The string used by the user to invoke the option. location <str>: A user friendly sring describing where the parser got this ...
tui/__init__.py
def parse(self, argv, usedname, location): """Consume and process arguments and store the result. ARGS: argv <list str>: The argument list to parse. usedname <str>: The string used by the user to invoke the option. location <str>: A user friend...
def parse(self, argv, usedname, location): """Consume and process arguments and store the result. ARGS: argv <list str>: The argument list to parse. usedname <str>: The string used by the user to invoke the option. location <str>: A user friend...
[ "Consume", "and", "process", "arguments", "and", "store", "the", "result", ".", "ARGS", ":", "argv", "<list", "str", ">", ":", "The", "argument", "list", "to", "parse", ".", "usedname", "<str", ">", ":", "The", "string", "used", "by", "the", "user", "t...
yohell/python-tui
python
https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L657-L679
[ "def", "parse", "(", "self", ",", "argv", ",", "usedname", ",", "location", ")", ":", "try", ":", "value", "=", "self", ".", "format", ".", "parse", "(", "argv", ")", "except", "formats", ".", "BadNumberOfArguments", ",", "e", ":", "raise", "BadNumberO...
de2e678e2f00e5940de52c000214dbcb8812a222
valid
Option.parsestr
Parse a string lexically and store the result. ARGS: argsstr <str>: The string to parse. usedname <str>: The string used by the user to invoke the option. location <str>: A user friendly sring describing where the parser got this data from.
tui/__init__.py
def parsestr(self, argsstr, usedname, location): """Parse a string lexically and store the result. ARGS: argsstr <str>: The string to parse. usedname <str>: The string used by the user to invoke the option. location <str>: A user friendly sring...
def parsestr(self, argsstr, usedname, location): """Parse a string lexically and store the result. ARGS: argsstr <str>: The string to parse. usedname <str>: The string used by the user to invoke the option. location <str>: A user friendly sring...
[ "Parse", "a", "string", "lexically", "and", "store", "the", "result", ".", "ARGS", ":", "argsstr", "<str", ">", ":", "The", "string", "to", "parse", ".", "usedname", "<str", ">", ":", "The", "string", "used", "by", "the", "user", "to", "invoke", "the",...
yohell/python-tui
python
https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L681-L703
[ "def", "parsestr", "(", "self", ",", "argsstr", ",", "usedname", ",", "location", ")", ":", "try", ":", "value", "=", "self", ".", "format", ".", "parsestr", "(", "argsstr", ")", "except", "formats", ".", "BadNumberOfArguments", ",", "e", ":", "raise", ...
de2e678e2f00e5940de52c000214dbcb8812a222
valid
PositionalArgument.parse
Consume and process arguments and store the result. argv is the list of arguments to parse (will be modified). Recurring PositionalArgumants get a list as .value. Optional PositionalArguments that do not get any arguments to parse get None as .value, or [] if r...
tui/__init__.py
def parse(self, argv): """Consume and process arguments and store the result. argv is the list of arguments to parse (will be modified). Recurring PositionalArgumants get a list as .value. Optional PositionalArguments that do not get any arguments to parse get ...
def parse(self, argv): """Consume and process arguments and store the result. argv is the list of arguments to parse (will be modified). Recurring PositionalArgumants get a list as .value. Optional PositionalArguments that do not get any arguments to parse get ...
[ "Consume", "and", "process", "arguments", "and", "store", "the", "result", ".", "argv", "is", "the", "list", "of", "arguments", "to", "parse", "(", "will", "be", "modified", ")", ".", "Recurring", "PositionalArgumants", "get", "a", "list", "as", ".", "valu...
yohell/python-tui
python
https://github.com/yohell/python-tui/blob/de2e678e2f00e5940de52c000214dbcb8812a222/tui/__init__.py#L756-L780
[ "def", "parse", "(", "self", ",", "argv", ")", ":", "if", "not", "argv", "and", "self", ".", "optional", ":", "self", ".", "value", "=", "[", "]", "if", "self", ".", "recurring", "else", "None", "return", "try", ":", "value", "=", "self", ".", "f...
de2e678e2f00e5940de52c000214dbcb8812a222