TGTGInsightinteligencia telegramLIVE / telegram public index
← Python Academy

TGINSIGHT SIMILAR POSTS

Buscar contenido similar

Canal fuente @python_academy · Post #1529 · 21 nov

Исследование структуры кода с помощью модуля ast При работе с кодом на Python, иногда возникает необходимость анализа его структуры. Для этого идеально подходит модуль ast (Abstract Syntax Trees), который предоставляет мощные инструменты для работы с абстрактными синтаксическими деревьями. Что такое ast? ast - это модуль Python, который позволяет разбирать и анализировать исходный код на Python, представляя его в виде абстрактного синтаксического дерева (AST). AST представляет собой структурированное представление кода, которое легко интерпретировать и анализировать. Пример использования модуля ast: import ast code = "print('Hello, ast!')" tree = ast.parse(code) print(ast.dump(tree)) В данном примере мы использовали функцию ast.parse для разбора строки кода с помощью модуля ast. Функция ast.dump выводит структуру AST в удобочитаемом формате. Анализ структуры кода: import ast code = """ def greet(name): print(f'Hello, {name}!') """ tree = ast.parse(code) for node in ast.walk(tree): if isinstance(node, ast.FunctionDef): print(f"Найдена функция: {node.name}") elif isinstance(node, ast.Print): print("Обнаружен оператор печати") В данном примере мы использовали модуль ast для анализа структуры кода. Функция ast.walk позволяет обойти все узлы AST, а затем мы проверяем их типы для выделения определенных элементов, таких как функции или операторы. Модуль ast также предоставляет возможности для более сложных операций, таких как изменение кода, создание новых выражений и многое другое. #python#ast#анализкода

Resultados

1,005 posts similares encontrados

Búsqueda global general

Am Neumarkt 😱

@amneumarkt · Post #322 · 03/03/2022, 07:29

#python I find poetry a great tool to manage Python requirements. I used to manage Python requirements using requirements.txt(environment.yaml) and install them using pip(conda). The thing is, in this stack, we have to pin the version ranges manually. It is quite tedious, and we easily run into version problems for a large project. Poetry is the savior here. When developing a package, we add some initial dependencies to the pyproject.yaml, a PEP standard. Whenever a new package is needed, we run poetry add package-name. Poetry tries to figure out the compatible versions. A lock file for the dependencies with restricted versions will be created or updated. To recreate an identical python environment, we only need to run poetry install. There's one drawback and may be quite painful at some point. Recreating the lock file for dependencies is extremely slow when the complexity grows in the requirements. But this is not a problem if poetry but rather constraints from pypi. One solution to this problem is to use cache. https://python-poetry.org/

Hashtags

Am Neumarkt 😱

@amneumarkt · Post #311 · 17/01/2022, 21:15

#python I thought it was a trivial talk in the beginning. But I quickly realized that I may know every each piece of the code mentioned in the video but the philosophy is what makes it exciting. He talked about some fundamental ideas of Python, e.g., protocols. After watching this video, an idea came to me. Pytorch lightning has implanted a lot of hooks in a very pythonic way. This is what makes pytorch lightning easy to use. (So if you do a lot of machine learning experiments, pytorch lightning is worth a try.) https://youtu.be/cKPlPJyQrt4

Hashtags

Linuxgram 🐧

@linuxgram · Post #18747 · 11/05/2026, 14:45

📰 Feature freeze for Python 3.15 as first beta released JIT compiler much improved, but no reinstatement for leaky incremental garbage collector. 🔗 Source: https://www.theregister.com/devops/2026/05/11/feature-freeze-for-python-315-as-first-beta-released/5237934 #python

Hashtags

Linuxgram 🐧

@linuxgram · Post #18631 · 30/04/2026, 15:35

📰 New Python Backdoor Uses Tunneling Service to Steal Browser and Cloud Credentials Cybersecurity researchers have disclosed details of a stealthy Python-based backdoor framework called DEEP#DOOR that comes with capabilities to establish persistent access and harvest a wide range of sensitive information from compromised hosts."The intrusion chain begins with execution of a batch script ('install_obf.bat') that disables Windows security controls, dynamically extracts an. 🔗 Source: https://thehackernews.com/2026/04/new-python-backdoor-uses-tunneling.html #python

Hashtags

Linuxgram 🐧

@linuxgram · Post #18589 · 27/04/2026, 17:17

📰 PyPI package with 1.1M monthly downloads hacked to push infostealer An attacker pushed a malicious version of the popular elementary-data package Python Package Index (PyPI) to steal sensitive developer data and cryptocurrency wallets. 🔗 Source: https://www.bleepingcomputer.com/news/security/pypi-package-with-11m-monthly-downloads-hacked-to-push-infostealer/ #python

Hashtags

Yiove 资讯频道

@yiovenews · Post #8709 · 12/10/2022, 16:37

#Python crawlTelegraph 【简介】:一个批量爬取 Telegra.ph 中图片的程序 【起因】: 因为看到一个COSER挺漂亮的,所以想下载她的资源。但是呢,找是找到了,只不过是放在Telegraph中的。这如果是一张一张下吧,效率特别低。要是用浏览器插件吧,我又不太乐意。 所以就自己动手用Python写了一个爬虫。 【查看详情】:https://www.skyqian.com/archives/crawlTelegraph.html

Hashtags

Yiove 资讯频道

@yiovenews · Post #8707 · 11/10/2022, 15:43

#Python 写了一个【阅读书源校验工具】 【查看详情】:https://www.qian.blue/archives/verifyBookSource.html

Hashtags

Repositorio data science

@repo_science · Post #4106 · 25/04/2024, 00:44

#Python 🖥 Curso de Python de 16 días ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----

Hashtags

Repositorio data science

@repo_science · Post #4105 · 22/04/2024, 21:43

#python 🖥 The Complete Python Course 2024 ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----

Hashtags

12•••5•••89101112•••15•••20•••25•••30•••35•••40•••45•••50•••55•••60•••65•••70•••75•••80•••8384