Что-то вы гоните насчет "привычного вида формата 755 и 644". Я вот вообще не понял что это!😳
Действительно, что означают цифры которые мы получили в прошлом посте?
Это кодировка, заключающая в себе режимы доступа к файлу.
Подробней можно почитать в статье про chmod.
Там можно увидеть альтернативное обозначение того же самого с помощью символов r w x, что значит чтение, запись, исполнение.
Чтобы преобразовать восьмеричное число в такое обозначение в Python есть готовая функция
>>> stat.filemode(0o755)
'?rwxr-xr-x'
Мы видим 3 группы по 3 символа, дающие 3 типа доступа для 3 типов юзеров.
А что за знак вопроса в начале?
Давайте передадим в эту функцию необрезанное значение от os.stat
>>> stat.filemode(os.stat(path).st_mode)
'drwxr-xr-x'
Это данные, которые мы безжалостно обрезали в прошлый раз😼
Первый символ обозначает тип объекта. Это может быть файл (-), директория (d) или симлинк (l).
Вот простая схема данной кодировки
[1][3][3][3]
│ │ │ │
│ │ │ └──> Others Permissions
│ │ └─────> Group Permissions
│ └────────> Owner Permissions
└───────────> File Type
(разверните экран если вы с телефона)
Если вы попробуете получить пермишены для симлинка то получите пермишены для файла
>>> path = '.venv/bin/python3'
>>> stat.filemode(os.stat(path).st_mode)
'-rwxr-xr-x'
Чтобы получить свойства именно симлинка, нужно это явно указать
>>> stat.filemode(os.stat(path, follow_symlinks=False).st_mode)
'lrwxrwxrwx'
#tricks#basic
🚘 Cybercab announced: Elon Musk’s robotaxi is finally here
📍 Tesla boss Elon Musk has unveiled the firm's long-awaited robotaxi, the Cybercab, at the Warner Bros Studios in Burbank, California.
🚕 The robotaxi is a purpose-built autonomous vehicle, lacking a steering wheel or pedals, meaning it will need approval from regulators before going into production. The design was futuristic, with doors that open upward like butterfly wings and a small cabin with only enough space for two passengers. There was no steering wheel or pedals, nor was there a plug — Musk said the vehicle charges inductively to regain power wirelessly.
🚐 In a surprise, the company also revealed a "robovan," a self-driving van capable of carrying up to 20 passengers or being configured for cargo purposes.
🪙 Musk said that autonomous cars are expected to be 10–20 times safer than human-driven vehicles and could cost as little as 20 cents per mile, compared to the $1 per mile for city buses.
@CarsNews
#Tesla#driverless
New 🚘 electric cars will get Chinese autopilot
It will be developed by startup Momenta and will debut on the CLA electric sedan. The hardware will be based on Nvidia's Orin X chip.
The all-electric CLA will be equipped with a high-level intelligent driving system that does not rely on high-definition maps. This advanced system will provide navigation in the city, and mass production of the electric car is scheduled for April 2025.
Mercedes-Benz is one of Momenta's investors, along with GM and SAIC.
@CarsNews
#Mercedes#EV#driverless
🚕Waymo robotaxis are back at the center of a scandal
📍 This time, the vehicles caused chaos on the streets of San Francisco.
🚥 The autonomous taxis use the traffic-light system for navigation, so when it goes down, route planning breaks as well.
⛔ For several hours, Waymo cars stood on the roads like bricks, blocking other drivers from getting through.
Is rise of the the machines beginning?
#driverless#incidents@Car_News
😰Three Waymo robotaxis caused a “standoff” and blocked a street in San Francisco
📰 In the northern part of San Francisco, three Waymo autonomous taxis got stuck on a narrow street, completely blocking traffic. Two cars lightly collided while trying to maneuver, after which both went into emergency mode, and the third stopped right in front of them, creating a full traffic jam.
😤 Because of this, residents couldn’t leave their driveways and had to wait for company engineers to intervene and resolve the situation. All vehicles were empty — no passengers were inside.
💬 Waymo commented on the incident, calling it a “learning moment” for improving their autonomous driving system.
#driverless#incidents@Car_News