Что-то вы гоните насчет "привычного вида формата 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
DRDO Chief Dr. Samir V Kamat has inaugurated a Compo-Rheo Die Casting (CRDC) facility at IISc-Bengaluru Campus for producing high-performance alloys.
CRDC is an advanced hybrid metallurgical process that combines elements of Composite material fabrication & Rheocasting to produce high-performance metal matrix composites.
#aatmarnirbharbharat
Mishra Dhatu Nigam Limited (MIDHANI) has inaugurated a state-of-the-art Aerospace Fasteners Facility in Hyderabad, marking its transition into a fully integrated manufacturer of high-precision components for extreme environments, including titanium and superalloy fasteners. By maintaining 100% in-house production and hosting resident inspection agencies, the facility ensures stringent quality control and compliance for the defense and aerospace sectors.
Source
#aatmarnirbharbharat#defence
DRDO Chairman Dr Samir V Kamat said the Ghatak UCAV will be comparable to a stealth fighter in capability. "They will be like fighters, they would be a stealth fighter... about a 13-ton class... LCA type fighter aircraft," Kamat said, adding that a recent proposal cleared by the Defence Procurement Board envisages induction of around 67 such systems. #Defence#aatmarnirbharbharat
BDL achieved a major milestone in indigenous defence manufacturing with the delivery of India’s first Production-Grade Wire Guided Heavy Weight Torpedo to NSTL at Visakhapatnam. #Defence#aatmarnirbharbharat
Vadodara-based INOX India has flagged-off the 'simulated Liquid Oxygen (LOX) Storage Module' to DRDO (NMRL) for India’s first indigenous AIP System. #Defence#aatmarnirbharbharat
Hyderabad-based ZenT echnologies has received a licence to manufacture 12.7mm, 23mm, 30mm & 40mm air defence guns to defend from low flying targets. #Defence#aatmarnirbharbharat
HAL has inaugurated a LCH Prachand (156 on order) Structure Assembly Line and an Automated Storage & Retrieval System (ASRS) at Tumakuru (Karnataka) today. #Defence#aatmarnirbharbharat
Union Cabinet approves Bharat Maritime Insurance pool (BMI pool) with a sovereign guarantee of Rs 12,980 crore to facilitate continuous maritime insurance coverages: I&B Minister Ashvini Vaishnav
This will reduce dependence on foreign insurance providers for maritime transport #Policy#aatmarnirbharbharat
Atomberg Tech introduces 1st Generation Drone Propulsion Systems.
An excellent step towards becoming 'Atmanirbhar' in #drones. Presently most of these propulsion systems are imported. #aatmarnirbharbharat
Delhi-based dpropulse is building India's first rotating detonation engine (RDE).
#Aviation#aatmarnirbharbharat
https://fxtwitter.com/i/status/2044030717123014797