TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #121 · 20 јул.

Регулярно требуется преобразовать какой-либо текст в максимально совместимый текст для URL, имени файла, имени объекта в каком-то софте и тд. Требования совместимости простые: в тексте должны быть только допустимые символы. Обычно это a-z, 0-9 и "_" или "-". То есть, только прописные буквы латинского алфавита и цифры (как пример). Допустим, нам нужно название статьи в блоге преобразовать в slug для добавления его в URL этой статьи. Как это лучше всего сделать? В Django по умолчанию есть готовая функция slugify для таких случаев. Но я её никогда не использую. Почему? Потому что её недостаточно! Приведём пример >>> from django.utils.text import slugify >>> slugify('This is a Title') 'this-is-a-title' Пока всё отлично >>> slugify('This is a "Title!"') 'this-is-a-title' Спец символы удалились, всё хорошо. >>> slugify('Это заголовок статьи') '' Вот и приехали 😢. Если текст не английский то буквы просто игнорируются. Можно это поправить >>> slugify('Это заголовок статьи', allow_unicode=True) 'это-заголовок-статьи' Но тогда мы не вписываемся в условие. У нас появилась кириллица в тексте. Так как я часто пишу сайты для русскоязычных пользователей эта проблема весьма актуальна. Я не использую стандартную функцию и всегда пишу свою. Оригинал я не беру в расчёт и пишу полностью свою функцию. И так, по порядку: 🔸1. Исходный текст: >>> text = 'Мой заголовок №10 😁!' Взял специально посложней со специальными символами. 🔸2. Транслит Необходимо сделать транслит всех символов в латиницу. Здесь очень выручает библиотека unidecode. Помимо простого транслита кириллицы в латиницу она умеет преобразовывать спец символы и иероглифы в текстовые аналоги. from unidecode import unidecode >>> unidecode("Ñ Σ ® µ ¶ ¼ 月 山") 'N S (r) u P 1/4 Yue Shan' Очень крутая библиотека, советую👍 В нашем случае получаем такое преобразование: >>> text = unidecode(text) >>> print(text) 'Moi zagolovok No. 10 !' Отличный транслит. Смайл просто удалился, хотя я ждал что-то вроде :). Ну и ладно, всë равно невалидные символы. А еще наш код уже поддерживает любой язык, будь то хинди или корейский. 🔸4. Фильтр символов Unidecode не занимается фильтрацией по недопустимым символам. Это мы делаем в следующем шаге через regex. Просто заменим все символы на "_" если они вне указанного диапазона. >>> text = re.sub(r'[^a-zA-Z0-9]+', '_', text) >>> print(text) 'Moi_zagolovok_No_10_' Символ "+" в паттерне выручает когда несколько недопустимых символов идут рядом. Все они заменяются на один символ "_". 🔸5. Slugify Осталось удалить лишние символы по краям и сделать нижний регистр >>> text = text.strip('_').lower() >>> print(text) 'moi_zagolovok_no_10' Получаем отличный slug! 😎 🌎 Полный код в виде функции. ______________ PS. Проверку что в строке остался хоть один допустимый символ я бы вынес в отдельную функцию. #libs#tricks#django

Резултати

Пронајдени 7 слични објави

Пребарај: #audit

当前筛选 #audit清除筛选
Uzbekneftgaz | Расмий канал

@ao_uzbekneftegaz · Post #9856 · 02.10.2025 г., 11:00

#Audit Korrupsiya xavfini boshqarish tizimi xalqaro darajada qayta tasdiqlandi “O‘zbekneftgaz” AJning “ISO 37001:2016” xalqaro standart talablariga muvofiq joriy etgan Korrupsiyaga qarshi menejment tizimi navbatdagi auditdan muvaffaqiyatli o‘tdi. 👉Batafsil _____ Система управления коррупционными рисками подтверждена на международном уровне Акционерное общество «Узбекнефтегаз» успешно прошло очередной аудит Системы менеджмента противодействия коррупции, внедренной в соответствии с требованиями международного стандарта ISO 37001:2016. 👉Подробно 👇Bizni kuzating: 🌐web-sayt | 📷instagram | 👉telegram | ▶️youtube | 💬facebook

Hashtags

Compliance Hub Association

@hub_compliance · Post #66 · 18.10.2023 г., 06:26

Третьей линией защиты в системе управления комплаенс-риском выступает внутренний аудит. Поздравляем коллег с Днем аудитора! #audit#internalaudit

IRAS

@irassg · Post #1001 · 08.05.2024 г., 07:40

Ever wonder what's behind the scenes of tax investigation? 🕵️‍♂️ Our investigator, Jeremy, reveals his most intriguing tool – a door ram! 🚪 Watch the full video as Jeremy and Juliana explain the difference between a tax investigator and a tax auditor. Find your role with us at go.gov.sg/lifeatiras💡⭐️ #WhyIDoWhatIDo#IRASGameOn#irassg#taxtech#investigation#audit#careerideas#lifeatIRAS

😇EVAA Updates: New Integrations, Expanded Features & Security Focus 🪙Integration with SafePal EVAA is now available in the TON DeFi Collection section of the SafePal wallet. Through #TON Connect, users can work with basic assets, take and issue loans, as well as use lending in various LP pairs. The team has prepared a detailed text guide on connecting and using the protocol. ☕️Partnership with Swap Coffee The protocol is integrated into the Swap Coffee aggregator. In the #Yield tab, you can now: • track the current APR for EVAA pools; • deposit and withdraw assets; • manage deposits and loans. 🪙Temporary suspension of collateral in $CATI Since Friday, July 11, support for the $CATI token in the ALTs pool has been temporarily disabled due to low liquidity. All active positions are safe and not subject to liquidation; however, opening new collateral in $CATI is currently not allowed. This decision was made to increase the protocol's stability. 🛡Trail of Bits audit completed EVAA successfully passed the final stage of the audit at Trail of Bits. Despite recent criticism of this company's address due to an incident with another project, the #EVAA team emphasizes that reliability and transparency remain its priority. EVAA app | News | Chat | Website #EVAA#SafePal#CATI#Audit#Security#DeFi#Toncoin

🗿STON.fi v2 Successfully Passed Trail of Bits Audit Trail of Bits recently conducted a comprehensive audit of the new STON.fi v2. ℹ️ Trail of Bits is an experienced auditor who has audited such well-known platforms as: #Uniswap, #Ethereum 2.0, #Matic, #Chainlink and more! The audit includes: ✔️ DEX User Experience Overview ✔️ Pools code analysis ✔️ Testing administrative and command messages between contracts ✔️ Checking tokens for compliance with the jetton standard Most of the shortcomings identified in the audit have now been corrected. You can read the report in more detail at the link: ✅Audit results 📱 The DEX team also announced their intention to publish the smart contract code and launch a bug bounty program. This will not only allow everyone to test the reliability of STON.fi, but will also help young developers by demonstrating the standard of a smart contract. #Stonfi#DEX#Audit#TON

Venture Village Wall 🦄

@venturevillagewall · Post #4179 · 18.02.2025 г., 07:00

Investors Flock to Legal Tech Startups Despite a downturn in the venture capital market, record investments were made last year in legal tech startups focusing on AI solutions. These startups are securing rounds of $50-100 million as investor interest surges. Read more here: FastFounder article In other news, President Javier Milei of Argentina clarified that he only disseminated information about the LIBRA token, not promoted it, and confirmed meetings with individuals involved in its launch. This comes after a brief spike in LIBRA's price following his shared purchase instructions. Additionally, the CEO of Jupiter, Ben Chow, has resigned amid a rising scrutiny of the LIBRA project. Full News #AI#Crypto#VC#LegalTech#StartupInvestment#Argentina#LIBRA#VentureCapital#Investment#Technology#M&A #Blockchain#XRP#SEC#Audit#Innovation#TechTrends#MarketTrends

Crypto M - Crypto News

@CryptoM · Post #65305 · 12.04.2026 г., 18:10

🚀 CMDSS Employee Accused of Misappropriating $46 Million in Seized Digital Assets A federal indictment has been filed against John Daghita, an employee of CMDSS, accusing him of transferring approximately $46 million in seized digital assets from U.S. Marshals Service (USMS) wallets to wallets under his control. According to NS3.AI, Daghita was apprehended by French Gendarmerie officers on March 4 in Saint Martin. Prosecutors allege that these unauthorized transfers took place in December and January. The case has reignited concerns previously raised by the Department of Justice (DOJ) inspector general and industry participants regarding the vulnerabilities in the USMS's crypto custody controls, procurement processes, and audit systems. These issues highlight the need for improved security measures and oversight in handling digital assets. #CMDSS#JohnDaghita#USMS#digitalassets#crypto#seizedassets#fraud#misappropriation#federalindictment#FrenchGendarmerie#NS3AI#DOJ#cryptosecurity#vulnerabilities#audit#procurement#oversight