Skip to content

allprod/mortise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mortice

Mortice is a file locking utility that provides both a functional interface and a context manager for use in locking files.

Usage

  1. To use the context management API you have a choice of either synchronous or asynchronous use.
  • For asynchronous context management use as follows:
async with Mortice(
    file, 
    open_mode, 
    blocking_status, 
    wait_time_for_blocked_calls
) as f:
    f.read()
  • For synchronous context management use as follows:
with Mortice(
    file, 
    open_mode, 
    blocking_status, 
    wait_time_for_blocked_calls
) as f:
    f.read()
  1. For usage of the functional API call as follows:
  • For locking operations call:
Mortice.lock_file(
    open_file: io.TextIOWrapper,
    file_open_mode: str = 'r',
    blocking: bool = True
)
  • For unlocking operations call:
Mortice.unlock_file(
    open_file: io.TextIOWrapper,
)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages