Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)

        def set_time(path, accessed, modified):
    # This doesn't seem to work on directories
    if isinstance(accessed, datetime.datetime):
        accessed = time.mktime(accessed.timetuple())
    if isinstance(modified, datetime.datetime):
        modified = time.mktime(modified.timetuple())
    if not isinstance(accessed, (int, float)):
        raise Exception('Expected a datatime, int or float object to set the accessed time for %r, not %r'%(path, accessed))
    if not isinstance(modified, (int, float)):
        raise Exception('Expected a datatime, int or float object to set the modified time for %r, not %r'%(path, modified))
    log.debug('Setting %r accessed time to %s and modified time to %s', path, accessed, modified)
    os.utime(
        path,
        (
            accessed,
            modified,
        )
    )
        


src/a/r/Archiver-0.2.2/archiver/api.py   Archiver(Download)
from sqlalchemy.sql import func
 
from archiver.helper import sha1, set_time
 
log = logging.getLogger(__name__)
        # directories, just their owner
        chmod(path, permission)
        set_time(path, accessed, modified)
 
# We use 16*1024 as the size because that's what shutil.copyfileobj() uses,
            try:
                set_time(
                    src, 
                    stat_src.st_atime, 
                    stat_src.st_mtime,
                    log.error('Could not apply metadata to directory %r; %r', directory_record.path, e)
        if source_time:
            set_time(base, source_time, source_time)
 
    def extras_update(