### The user guide for the lama2923 library.
Below you can find the guide in Turkish/English.
[![GitHub lama2923](https://img.shields.io/badge/GitHub-lama2923-181717?style=for-the-badge&logo=github)](https://github.com/lama2923)
---
#### Turkish
### Kullanım Kılavuzu
Bu Python kütüphanesi, Discord, llinput gibi API ve Terminal tasarım olarak çeşitlilikler sunar.
#### Kurulum
kütüphaneyi indirin:
```bash
pip install lama2923
```
#### kullanımlar
##### Ekranı Temizleme (clear_screen)
```python
from lama2923 import clear_screen
clear_screen()
```
Ekranı temizler.
##### Geçen Süreyi Hesaplama (calculate_elapsed_time)
```python
from lama2923 import calculate_elapsed_time, get_time
start_time = get_time()
# Code
end_time = get_time()
elapsed_time = calculate_elapsed_time(start_time, end_time)
print(elapsed_time)
```
İki zaman arasındaki geçen süreyi hesaplar ve milisaniye, saniye, dakika, saat, gün cinsinden döndürür.
##### Gökkuşağı Metni (rainbow_text)
```python
from lama2923 import rainbow_text
rainbow_text("Merhaba Dünya", LOOP=3, Speed="Slow", section="Full")
```
Bu bölüm eğlence için yapılmıştır denebilir :D Arkadaşlarınızı şaşırtmak adına kullanabilirsiniz.
##### Port Kontrolü (check_port)
```python
from lama2923 import check_port
port_open = check_port("127.0.0.1", 80)
print(f"Port açık mı? {port_open}")
```
Belirtilen IP adresindeki portun açık olup olmadığını kontrol eder.
##### İnternet Bağlantısı Kontrolü (check_internet)
```python
from lama2923 import check_internet
internet_connected = check_internet()
print(f"İnternet bağlantısı var mı? {internet_connected}")
```
İnternet bağlantısını kontrol eder.
##### animasyonlu print (lprint)
```python
from lama2923 import lprint
lprint("Merhaba Dünya")
```
print fonksiyonu ile aynıdır fakat soldan sağa doğru yazının boyutuna göre, hızlı/yavaş şekilde, animasyonlu bir çıktı verir.
##### animasyonlu input (linput)
```python
from lama2923 import linput
user_input = linput("İsminiz: ", autocorrect=True)
```
linput input ile aynıdır fakat lprint gibi animasyonlu bir şekilde çıktı verir.
autocorrect özelliği şuna yarar: input'dan önceki yazılan yazıların yazılmasını engeller. Yani Yanlışıkla daha input görünmeden 'Enter' basıldığında geçmemesini sağlayabilirsiniz.
##### okunaklı sayı (formatted_number)
```python
from lama2923 import formatted_number
num = formatted_number(100000.1234) # çıktı : 100.000,1234
print(f"Biçimlendirilmiş sayı: {num}")
```
Girilen sayıyı (str kabul edilir) sayı kurallarına uygun biçimde çıktı verir
##### Okunaklı Sayıyı Geri Çevirme (reverse_formatted_number)
```python
from lama2923 import reverse_formatted_number
num = reverse_formatted_number("12.345,678") # 12345.678
print(f"Orijinal sayı: {num}")
```
Girilen sayıyı (str kabul edilir) sayı kurallarına uygun biçimde olan sayıyı ters çevirir
##### Discord Webhook (Discord.Webhook)
```python
from lama2923 import Discord
webhook_url = 'WEBHOOK-URL-HERE'
webhook = Discord.Webhook(webhook_url=webhook_url)
Embed2 = Discord.Embed(title="", description="")
Embed2.set_image(r"https:\\xxxxxxx") # Image URL
Embed = Discord.Embed(title="Merhaba", description="Dünya", color=0x00ff00)
Embed.add_field(name="B-", value="Ben Yaşıyorum!", inline=False)
Embed.set_footer(text="Program")
Embed.set_image("image.png") # Image Path
Status = webhook.send_webhook(Content="Sana yeni bir haberim var! eee" , embeds=[Embed, Embed2])
```
Discord Webhook ile mesaj göndermeye yarar
##### Discord Author (Discord.Author)
```python
from lama2923 import Discord
AUTHOR_TOKEN = "YOUR_TOKEN"
Author = Discord.Author(AUTHOR_TOKEN)
Channel_ID = "YOUR_CHANNEL"
Author.send_message(Channel_ID, "Merhaba Dünya!", files=["src/image.png", ])
status, Messages = Author.get_channel_messages(Channel_ID, limit=10)
for I, Message in enumerate(Messages):
print(f"{I}: {Message['content']}")
```
Discord Author ile Bir kanala mesaj gönderip o kanalın 10 tane mesajını almaya yarar.
##### COLOR MIXER (color_mixer)
```python
from lama2923 import color_mixer
print(color_mixer(["blue"]) + "Bu Yazının Rengi Mavi") # Tek bir renk.
print(color_mixer(["blue", "red"]) + "Bu Yazının Rengi Mor") # 2 Rengin Karışımı.
print(color_mixer({"blue": 15, "green": 35, "red": 100}) + "Bu Yazının Rengi Kahverengi") # 3 Rengin Belirli Oranda Karışımı.
print(color_mixer((0, 255, 0)) + "Bu Yazının Rengi Yeşil") # R.G.B Formatında Renk
print(color_mixer(0xFFA500) + "Bu Yazının Rengi Turuncu") # Hexadecimal Kodu
# --------------
print(color_mixer(["blue"], return_type="hex")) # Çıktı: #0000FF
print(color_mixer(["blue"], return_type="rgb")) # Çıktı: (0, 0, 255)
```
color_mixer ile istediğiniz rengi kolaylıkla Ayarlayabilirsiniz.
##### Basit Hotkey ataması (Hotkey)
```python
from lama2923 import Hotkey
@Hotkey('ctrl', 'shift', 'a')
def function():
print("Hotkey tetiklendi!")
```
##### input özelleştirilebilir versiyonu (llinput)
```python
from lama2923 import llinput
Password = llinput("Şifreni Gir: ", inputtype="password-lastkey-clearend", promptcolor={"blue": 15, "green": 35, "red": 100}, inputcolor={"yellow": 80, "green": 10}, wendcolor=["blue"], endcolor=["blue"], wend=" <", end="!")
print("Şifre Başarıyla Girildi!", Password)
```
llinput çok işlevli özelleştirilebilir linput versiyonudur.
- `sep` ve `end` normal şekilde çalışır.
- `wend` özelliği, `{prompt} [kullanıcı girdisi] + {wend}` formatındadır. `end`'den farklı olarak, kullanıcı girdisini prompt ve wend arasına yerleştirir.
- `max_length`, kullanıcının girebileceği maksimum karakter sayısını sınırlar.
- `min_length`, kullanıcının girebileceği minimum karakter sayısını sınırlar.
- `forceint`, kullanıcının yalnızca sayı girmesini sağlar. | `forcestr` ile aynı anda kullanılamaz. `negativeint` ile birlikte kullanılabilir.
- `negativeint`, kullanıcının yalnızca negatif sayı girmesini sağlar. | `forcestr` ile aynı anda kullanılamaz. `forceint` ile birlikte kullanılabilir.
- `forcestr`, kullanıcının yalnızca harf girmesini sağlar. | `forceint` ve `negativeint` ile aynı anda kullanılamaz.
- `forceinput`, kullanıcının boş girdi göndermesini engeller.
- `startswith` özelliği `("", False)` formatındadır. Kullanıcı girdisinin, atanan yazıyla başlamasını sağlar. Eğer `True` ise bu başlangıç değeri silinemez; `False` ise kullanıcı bu değeri silebilir.
- `forcestartswith`, kullanıcının girdiye başlaması gereken değerlerin listesidir. Örneğin, `["https", "http"]` kullanıcının bir link girmesini zorunlu kılar.
- `forceendswith`, kullanıcının girdiyi bitirmesi gereken değerlerin listesidir. Temel olarak `forcestartswith`'in başlangıç yerine bitiş versiyonudur.
- `choices` `([], False)` formatındadır. Liste değeri, kullanıcının seçebileceği değerleri belirler. Boolean değeri, büyük/küçük harf duyarlılığını belirler; `False` ise büyük/küçük harf duyarlıdır.
- `blockedchars`, kullanıcının giremeyeceği karakterlerin listesidir.
- `availablechars`, kullanıcının girebileceği karakterlerin listesidir. `blockedchars` ile çakışan karakterler yasaklı kabul edilir.
- `forceinputlen`, kullanıcıyı belirli bir girdi uzunluğuna zorlar.
- `inputtype`, input türünü belirler ve `["world", "password", "password-lastkey", "password2", "password2-lastkey"]` türlerinden biri olabilir.
- `inputcolor`, `promptcolor`, `wendcolor`, ve `endcolor` list/tuple/dict değerleridir ve `["red", "green", "yellow", "blue", "magenta", "cyan", "white", "black"]` renklerinden biri olabilir. Örneğin, `["red"]` veya `["red", "blue"]` kullanarak renkleri karıştırabilir veya `{"blue": 15, "green": 35, "red": 100}` formatında hangi oranlarda renk eklemek istediğinizi belirleyebilirsiniz. Ayrıca, bu renkler RGB tuple formatında `(255, 0, 0)` veya hexadecimal formatında `0xFF0000` olarak da belirtilebilir.
- `custom_enter_check_func` Bu değere herhangi bir callable obje atayabilirsiniz, eğer True döndürürse input alınır, ancak False döndürülürse input alınmaz. Sadece input_str argümanı vardır.
- `custom_delete_ch_check_func` Bu değere herhangi bir callable obje atayabilirsiniz, eğer True döndürürse karakter silinmez, ancak False döndürülürse karakter silinir. input_str ve chdata argümanı vardır.
- `custom_press_key_check_func` Bu değere herhangi bir callable obje atayabilirsiniz, eğer True döndürürse karakter eklenir, ancak False döndürülürse karakter eklenmez. input_str ve chdata argümanı vardır.
# custom_enter_check_func, custom_delete_ch_check_func ve custom_press_key_check_func İÇİN ÖRNEK KULLANIM.
### Bazı terminallerde ok tuşları çalışmayabilir.
```python
def check_enter(input_str):
"""
Eğer input_str "lama2923" ise input alınır.
"""
input_str # Girdi olarak verilmek istenen input_str
if input_str == "lama2923":
return True
return False
def check_delete(input_str, chdata):
"""
Eğer silinmeye çalışılan karakter "a" ise silinmez.
"""
ch, pos = chdata
pos # Karakterin input_str'de hangi konumda silinmeye çalışıldığını verir, Örnek input_str: "Selam", ch: "m", pos: 4, olsun bu durumda m karakterinin silineceği yer 4. pozisyon yani "Sela" yazılmaya çalışılıyor.
ch # Silinmeye çalışılan karakter
input_str # Daha karakter silinmemiş olan input_str
if ch == "a":
return False
return True
def check_press_key(input_str, chdata):
import string
"""
Eğer Basılan karakter bir noktalama işareti ise o karakter input'a eklenmez.
"""
ch, pos = chdata
pos # Karakterin input_str'de hangi konuma eklenmeye çalışıldığını verir, Örnek input_str: "Selam", ch: "!", pos: 5, olsun bu durumda ! karakterinin geleceği yer 5. pozisyon yani "Selam!" yazılmaya çalışılıyor.
input_str # Daha karakter eklenmemiş olan input_str
ch # Basılan karakter
if ch in list(string.punctuation):
return False
return True
llinput("Şifreni Gir: ", custom_delete_ch_check_func=check_delete, custom_enter_check_func=check_enter, custom_press_key_check_func=check_press_key)
```
##### klasör görüntüleyici (get_directory_tree)
```python
from lama2923 import get_directory_tree
start_directory = r'data' # Başlangıç dizini
depth = 10 # Derinlik
style = 'normal' # Stil
directory_tree = get_directory_tree(start_directory, depth=depth, style=style)
print(directory_tree)
```
örnek çıktı
```
└── data\
├── src\
| └── Images\
| ├── Images2.png
| └── ımage1.png
└── x.txt
```
get_directory_tree özelliği belirli bir dizindeki dosyaları/klasörleri tasarıma uygun biçimde döndürmektir.
- `startpath`: Başlangıç dizininin yolunu belirtir. Bu, dizin ağacının oluşturulmasına başlanacak kök dizindir. Örneğin `data\src`.
- `depth`: Geçerli derinliği belirtir. Fonksiyonun çağrıldığı sırada dizin ağacının hangi derinlikte olduğunu gösterir. Varsayılan değeri `0` olup, bu da kök dizini temsil eder. Her bir alt dizine geçildiğinde bu değer artırılır.
- `max_depth`: Dizin ağacının oluşturulmasında maksimum derinliği belirtir. Bu, dizin ağacının ne kadar derinlikte gösterileceğini kontrol etmek için kullanılır. Özellikle çok fazla içeriği olan dizinleriniz için bu değeri kullanmanızı performans için öneririm. Varsayılan değeri `float('inf')` olup, bu sonsuz derinlik anlamına gelir. Örneğin, `max_depth=2` sadece kök dizin ve iki alt seviye dizinleri gösterir.
- `prefix`: Geçerli dizin ve dosya adlarının önüne eklenen önek karakterlerdir. Bu önekler, dizin yapısının doğru bir şekilde görselleştirilmesine yardımcı olur ve genellikle boşluk veya dikey çizgiler gibi karakterlerden oluşur. Varsayılan değeri `''`'dır.
- `is_last`: Geçerli dizin veya dosyanın, üst dizindeki son öğe olup olmadığını belirtir. Bu bilgi, doğru biçimlendirme ve önek karakterlerin ayarlanmasında kullanılır. Varsayılan değeri `True`'dır.
- `style`: Dizin ağacının hangi stil ile oluşturulacağını belirtir. Önceden tanımlı stillerden birini seçer. Varsayılan değeri `'normal'`'dir.
- `custom_style`: Kullanıcı tarafından tanımlanan özel bir stil belirtir. Bu, `branch` ve `spacing` gibi öznitelikleri içerir ve fonksiyon, belirtilen bu stili kullanarak dizin ağacını oluşturur. Eğer `custom_style` belirtilmişse, `style` parametresi göz ardı edilir.
örnek `custom_style`
```json
custom_style = {
'branch': ('>>> ', '<<< ', '|||', '\\'),
'spacing': ' '
}
```
çıktı
```
<<< data\
>>> src\
||| <<< Images\
||| >>> Images2.png
||| <<< ımage1.png
<<< x.txt
```
kullanabileceğiniz bütün stiller
- `normal`
- `bold`
- `thin`
- `compact`
- `double`
- `dash`
- `star`
- `plus`
- `wave`
- `hash`
- `dot`
- `pipe`
- `slash`
- `backslash`
- `equal`
- `colon`
- `semicolon`
- `exclamation`
- `question`
- `caret`
- `percent`
- `at`
- `tilde`
- `bracket`
- `brace`
- `paren`
- `angle`
- `quote`
- `apos`
- `underscore`
- `plusminus`
- `doubleangle`
- `box`
- `arrow`
---
#### English
### User Guide
This Python library offers a variety of APIs and Terminal designs such as Discord and llinput.
#### Installation
Install the necessary modules to use this library:
```bash
pip install lama2923
```
#### Functions and Their Uses
##### Clear Screen (clear_screen)
```python
from lama2923 import clear_screen
clear_screen()
```
Clears the screen.
##### Calculate Elapsed Time (calculate_elapsed_time)
```python
from lama2923 import calculate_elapsed_time, get_time
start_time = get_time()
# Code
end_time = get_time()
elapsed_time = calculate_elapsed_time(start_time, end_time)
print(elapsed_time)
```
Calculates the elapsed time between two points and returns it in milliseconds, seconds, minutes, hours, and days.
##### Rainbow Text (rainbow_text)
```python
from lama2923 import rainbow_text
rainbow_text("Hello World", LOOP=3, Speed="Slow", section="Full")
```
This section is for fun! You can use it to surprise your friends.
##### Port Check (check_port)
```python
from lama2923 import check_port
port_open = check_port("127.0.0.1", 80)
print(f"Is the port open? {port_open}")
```
Checks if the specified port on the given IP address is open.
##### Internet Connection Check (check_internet)
```python
from lama2923 import check_internet
internet_connected = check_internet()
print(f"Is there an internet connection? {internet_connected}")
```
Checks for an internet connection.
##### Animated Print (lprint)
```python
from lama2923 import lprint
lprint("Hello World")
```
It works the same as the print function but provides animated output from left to right based on the length of the text.
##### Animated Input (linput)
```python
from lama2923 import linput
user_input = linput("Your name: ", autocorrect=True)
```
linput works the same as input but provides animated output like lprint.
The autocorrect feature prevents writing errors before the input appears. It ensures that pressing 'Enter' mistakenly before the input is shown does not proceed.
##### Formatted Number (formatted_number)
```python
from lama2923 import formatted_number
num = formatted_number(100000.1234) # output: 100.000,1234
print(f"Formatted number: {num}")
```
Takes a number (accepted as a string) and outputs it in a properly formatted manner.
##### Reverse Formatted Number (reverse_formatted_number)
```python
from lama2923 import reverse_formatted_number
num = reverse_formatted_number("12.345,678") # 12345.678
print(f"Original number: {num}")
```
Takes a properly formatted number (accepted as a string) and reverses it.
##### Discord Webhook (Discord.Webhook)
```python
from lama2923 import Discord
webhook_url = 'WEBHOOK-URL-HERE'
webhook = Discord.Webhook(webhook_url=webhook_url)
Embed2 = Discord.Embed(title="", description="")
Embed2.set_image(r"https:\\xxxxxxx") # Image URL
Embed = Discord.Embed(title="Hello", description="World", color=0x00ff00)
Embed.add_field(name="I-", value="I am alive!", inline=False)
Embed.set_footer(text="Program")
Embed.set_image("image.png") # Image Path
Status = webhook.send_webhook(Content="I have news for you! uhh" , embeds=[Embed, Embed2])
```
Sends a message using Discord Webhook.
##### Discord Author (Discord.Author)
```python
from lama2923 import Discord
AUTHOR_TOKEN = "YOUR_TOKEN"
Author = Discord.Author(AUTHOR_TOKEN)
Channel_ID = "YOUR_CHANNEL"
Author.send_message(Channel_ID, "Hello World!", files=["src/image.png", ])
status, Messages = Author.get_channel_messages(Channel_ID, limit=10)
for I, Message in enumerate(Messages):
print(f"{I}: {Message['content']}")
```
Allows sending a message to a channel and retrieving the last 10 messages from that channel using Discord Author.
##### COLOR MIXER (color_mixer)
```python
from lama2923 import color_mixer
print(color_mixer(["blue"]) + "This text is Blue") # Single color.
print(color_mixer(["blue", "red"]) + "This text is Purple") # Mix of 2 colors.
print(color_mixer({"blue": 15, "green": 35, "red": 100}) + "This text is Brown") # Mix of 3 colors with specified proportions.
print(color_mixer((0, 255, 0)) + "This text is Green") # R.G.B format color
print(color_mixer(0xFFA500) + "This text is Orange") # Hexadecimal code
# --------------
print(color_mixer(["blue"], return_type="hex")) # Output: #0000FF
print(color_mixer(["blue"], return_type="rgb")) # Output: (0, 0, 255)
```
With color_mixer, you can easily adjust the desired color.
##### Simple Hotkey Assignment (Hotkey)
```python
from lama2923 import Hotkey
@Hotkey('ctrl', 'shift', 'a')
def function():
print("Hotkey triggered!")
```
##### Enhanced input (llinput)
```python
from lama2923 import llinput
Password = llinput("Enter your Password: ", inputtype="password-lastkey-clearend", promptcolor={"blue": 15, "green": 35, "red": 100}, inputcolor={"yellow": 80, "green": 10}, wendcolor=["blue"], endcolor=["blue"], wend=" <", end="!")
print("Password Entered Successfully!", Password)
```
llinput is a highly functional, customizable version of linput.
- `sep` and `end` work as usual.
- `wend` feature is in the format {prompt} [user input] + {wend}. Unlike `end`, it places the user input between prompt and wend.
- `max_length` limits the maximum number of characters the user can enter.
- `min_length` limits the minimum number of characters the user can enter.
- `forceint` allows the user to enter only numbers. | Cannot be used with `forcestr`. Can be used with `negativeint`.
- `negativeint` allows the user to enter only negative numbers. | Cannot be used with `forcestr`. Can be used with `forceint`.
- `forcestr` allows the user to enter only letters. | Cannot be used with `forceint` and `negativeint`.
- `forceinput` prevents the user from submitting empty input.
- `startswith` is in the format ("", False). It sets the beginning of the user input to the given string. If True, this prefix cannot be deleted; if False, the user can delete it.
- `forcestartswith` is a list of values that the user must start their input with, e.g., ["https", "http"] requires the user to enter a link.
- `forceendswith` is a list of values that the user must end their input with.
- `choices` is in the format ([], False). It provides a list of acceptable choices. The boolean determines case sensitivity; False means case-sensitive.
- `blockedchars` is a string of characters that the user cannot enter.
- `availablechars` is a string of characters that the user can enter. Conflicts with `blockedchars` will result in the character being blocked.
- `forceinputlen` forces the user to enter input of a specific length.
- `inputtype` specifies the type of input and can be one of the following types: `["world", "password", "password-lastkey", "password2", "password2-lastkey"]`.
- `inputcolor`, `promptcolor`, `wendcolor`, and `endcolor` are list/tuple/dict values and can be one of the colors from `["red", "green", "yellow", "blue", "magenta", "cyan", "white", "black"]`. For example, you can use `["red"]` or `["red", "blue"]` to mix colors or specify the ratios of colors you want to add in the format `{"blue": 15, "green": 35, "red": 100}`. Additionally, these colors can also be specified in RGB tuple format as `(255, 0, 0)` or in hexadecimal format as `0xFF0000`.
- `custom_enter_check_func` You can assign any callable object to this value. If it returns True, the input is accepted, but if it returns False, the input is rejected. It only has the input_str argument.
- `custom_delete_ch_check_func` You can assign any callable object to this value. If it returns True, the character is not deleted, but if it returns False, the character is deleted. It has the input_str and chdata arguments.
- `custom_press_key_check_func` You can assign any callable object to this value. If it returns True, the character is added, but if it returns False, the character is not added. It has the input_str and chdata arguments.
# EXAMPLE USAGE FOR custom_enter_check_func, custom_delete_ch_check_func, and custom_press_key_check_func.
### Arrow keys may not work in some terminals.
```python
def check_enter(input_str):
"""
If input_str is "lama2923", input is accepted.
"""
input_str # The input_str intended to be provided as input
if input_str == "lama2923":
return True
return False
def check_delete(input_str, chdata):
"""
If the character being attempted to delete is "a", it will not be deleted.
"""
ch, pos = chdata
pos # Indicates the position in input_str where the character is being attempted to delete. Example: input_str: "Hello", ch: "o", pos: 4, in this case, the "o" character is at position 4 and "Hell" is being attempted to type.
ch # The character being attempted to delete
input_str # The input_str before the character is deleted
if ch == "a":
return False
return True
def check_press_key(input_str, chdata):
import string
"""
If the pressed character is a punctuation mark, it will not be added to the input.
"""
ch, pos = chdata
pos # Indicates the position in input_str where the character is being attempted to add. Example: input_str: "Hello", ch: "!", pos: 5, in this case, the "!" character is at position 5 and "Hello!" is being attempted to type.
input_str # The input_str before the character is added
ch # The pressed character
if ch in list(string.punctuation):
return False
return True
llinput("Enter your password: ", custom_delete_ch_check_func=check_delete, custom_enter_check_func=check_enter, custom_press_key_check_func=check_press_key)
```
##### folder viewer (get_directory_tree)
```python
from lama2923 import get_directory_tree
start_directory = r'data' # Starting directory
depth = 10 # Depth
style = 'normal' # Style
directory_tree = get_directory_tree(start_directory, depth=depth, style=style)
print(directory_tree)
```
example output
```
└── data\
├── src\
| └── Images\
| ├── Images2.png
| └── ımage1.png
└── x.txt
```
The get_directory_tree feature returns the files/folders in a specific directory in a design-friendly format.
- `startpath`: Specifies the path of the starting directory. This is the root directory where the directory tree creation will start. For example `data\src`.
- `depth`: Indicates the current depth. It shows at what depth the directory tree is during the function call. The default value is `0`, representing the root directory. This value increases as it goes down to each subdirectory.
- `max_depth`: Specifies the maximum depth in the creation of the directory tree. It is used to control how deep the directory tree will be displayed. I recommend using this value for directories with a lot of content for performance. The default value is `float('inf')`, meaning infinite depth. For example, `max_depth=2` will only show the root directory and two levels of subdirectories.
- `prefix`: The prefix characters added before the names of the current directories and files. These prefixes help in visualizing the directory structure correctly and usually consist of characters like spaces or vertical lines. The default value is `''`.
- `is_last`: Indicates whether the current directory or file is the last item in its parent directory. This information is used for proper formatting and setting prefix characters. The default value is `True`.
- `style`: Specifies which style the directory tree will be created in. It selects one of the predefined styles. The default value is `'normal'`.
- `custom_style`: Specifies a user-defined custom style. This includes attributes like `branch` and `spacing`, and the function uses the specified style to create the directory tree. If `custom_style` is specified, the `style` parameter is ignored.
example `custom_style`
```json
custom_style = {
'branch': ('>>> ', '<<< ', '|||', '\'),
'spacing': ' '
}
```
output
```
<<< data\
>>> src\
||| <<< Images\
||| >>> Images2.png
||| <<< ımage1.png
<<< x.txt
```
all available styles
- `normal`
- `bold`
- `thin`
- `compact`
- `double`
- `dash`
- `star`
- `plus`
- `wave`
- `hash`
- `dot`
- `pipe`
- `slash`
- `backslash`
- `equal`
- `colon`
- `semicolon`
- `exclamation`
- `question`
- `caret`
- `percent`
- `at`
- `tilde`
- `bracket`
- `brace`
- `paren`
- `angle`
- `quote`
- `apos`
- `underscore`
- `plusminus`
- `doubleangle`
- `box`
- `arrow`
Raw data
{
"_id": null,
"home_page": null,
"name": "lama2923",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "example project evelopment discord lama2923 api design custom custominput customprint",
"author": "lama2923",
"author_email": "lama2923.v2@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/63/7c/995bf8df5349b785b6086028753d8a1041d2772742c1f8df2fcf568f98e9/lama2923-2.0.4.tar.gz",
"platform": null,
"description": "### The user guide for the lama2923 library.\r\n\r\nBelow you can find the guide in Turkish/English.\r\n\r\n\r\n[![GitHub lama2923](https://img.shields.io/badge/GitHub-lama2923-181717?style=for-the-badge&logo=github)](https://github.com/lama2923)\r\n---\r\n\r\n#### Turkish\r\n\r\n### Kullan\u0131m K\u0131lavuzu\r\n\r\nBu Python k\u00fct\u00fcphanesi, Discord, llinput gibi API ve Terminal tasar\u0131m olarak \u00e7e\u015fitlilikler sunar.\r\n\r\n#### Kurulum\r\nk\u00fct\u00fcphaneyi indirin:\r\n```bash\r\npip install lama2923\r\n```\r\n\r\n#### kullan\u0131mlar\r\n\r\n##### Ekran\u0131 Temizleme (clear_screen)\r\n```python\r\nfrom lama2923 import clear_screen\r\nclear_screen()\r\n```\r\nEkran\u0131 temizler.\r\n\r\n##### Ge\u00e7en S\u00fcreyi Hesaplama (calculate_elapsed_time)\r\n```python\r\nfrom lama2923 import calculate_elapsed_time, get_time\r\nstart_time = get_time()\r\n\r\n# Code\r\n\r\nend_time = get_time()\r\nelapsed_time = calculate_elapsed_time(start_time, end_time)\r\nprint(elapsed_time)\r\n```\r\n\u0130ki zaman aras\u0131ndaki ge\u00e7en s\u00fcreyi hesaplar ve milisaniye, saniye, dakika, saat, g\u00fcn cinsinden d\u00f6nd\u00fcr\u00fcr.\r\n\r\n##### G\u00f6kku\u015fa\u011f\u0131 Metni (rainbow_text)\r\n```python\r\nfrom lama2923 import rainbow_text\r\nrainbow_text(\"Merhaba D\u00fcnya\", LOOP=3, Speed=\"Slow\", section=\"Full\")\r\n```\r\nBu b\u00f6l\u00fcm e\u011flence i\u00e7in yap\u0131lm\u0131\u015ft\u0131r denebilir :D Arkada\u015flar\u0131n\u0131z\u0131 \u015fa\u015f\u0131rtmak ad\u0131na kullanabilirsiniz.\r\n\r\n##### Port Kontrol\u00fc (check_port)\r\n```python\r\nfrom lama2923 import check_port\r\nport_open = check_port(\"127.0.0.1\", 80)\r\nprint(f\"Port a\u00e7\u0131k m\u0131? {port_open}\")\r\n```\r\nBelirtilen IP adresindeki portun a\u00e7\u0131k olup olmad\u0131\u011f\u0131n\u0131 kontrol eder.\r\n\r\n##### \u0130nternet Ba\u011flant\u0131s\u0131 Kontrol\u00fc (check_internet)\r\n```python\r\nfrom lama2923 import check_internet\r\ninternet_connected = check_internet()\r\nprint(f\"\u0130nternet ba\u011flant\u0131s\u0131 var m\u0131? {internet_connected}\")\r\n```\r\n\u0130nternet ba\u011flant\u0131s\u0131n\u0131 kontrol eder.\r\n\r\n##### animasyonlu print (lprint)\r\n```python\r\nfrom lama2923 import lprint\r\nlprint(\"Merhaba D\u00fcnya\")\r\n```\r\nprint fonksiyonu ile ayn\u0131d\u0131r fakat soldan sa\u011fa do\u011fru yaz\u0131n\u0131n boyutuna g\u00f6re, h\u0131zl\u0131/yava\u015f \u015fekilde, animasyonlu bir \u00e7\u0131kt\u0131 verir.\r\n\r\n##### animasyonlu input (linput)\r\n```python\r\nfrom lama2923 import linput\r\nuser_input = linput(\"\u0130sminiz: \", autocorrect=True)\r\n```\r\nlinput input ile ayn\u0131d\u0131r fakat lprint gibi animasyonlu bir \u015fekilde \u00e7\u0131kt\u0131 verir.\r\nautocorrect \u00f6zelli\u011fi \u015funa yarar: input'dan \u00f6nceki yaz\u0131lan yaz\u0131lar\u0131n yaz\u0131lmas\u0131n\u0131 engeller. Yani Yanl\u0131\u015f\u0131kla daha input g\u00f6r\u00fcnmeden 'Enter' bas\u0131ld\u0131\u011f\u0131nda ge\u00e7memesini sa\u011flayabilirsiniz.\r\n\r\n\r\n##### okunakl\u0131 say\u0131 (formatted_number)\r\n```python\r\nfrom lama2923 import formatted_number\r\nnum = formatted_number(100000.1234) # \u00e7\u0131kt\u0131 : 100.000,1234\r\nprint(f\"Bi\u00e7imlendirilmi\u015f say\u0131: {num}\")\r\n```\r\nGirilen say\u0131y\u0131 (str kabul edilir) say\u0131 kurallar\u0131na uygun bi\u00e7imde \u00e7\u0131kt\u0131 verir\r\n\r\n##### Okunakl\u0131 Say\u0131y\u0131 Geri \u00c7evirme (reverse_formatted_number)\r\n```python\r\nfrom lama2923 import reverse_formatted_number\r\nnum = reverse_formatted_number(\"12.345,678\") # 12345.678\r\nprint(f\"Orijinal say\u0131: {num}\")\r\n```\r\nGirilen say\u0131y\u0131 (str kabul edilir) say\u0131 kurallar\u0131na uygun bi\u00e7imde olan say\u0131y\u0131 ters \u00e7evirir\r\n\r\n\r\n\r\n##### Discord Webhook (Discord.Webhook)\r\n```python\r\nfrom lama2923 import Discord\r\nwebhook_url = 'WEBHOOK-URL-HERE'\r\nwebhook = Discord.Webhook(webhook_url=webhook_url)\r\n\r\n\r\nEmbed2 = Discord.Embed(title=\"\", description=\"\")\r\nEmbed2.set_image(r\"https:\\\\xxxxxxx\") # Image URL\r\n\r\n\r\nEmbed = Discord.Embed(title=\"Merhaba\", description=\"D\u00fcnya\", color=0x00ff00)\r\nEmbed.add_field(name=\"B-\", value=\"Ben Ya\u015f\u0131yorum!\", inline=False)\r\nEmbed.set_footer(text=\"Program\")\r\nEmbed.set_image(\"image.png\") # Image Path\r\n\r\n\r\nStatus = webhook.send_webhook(Content=\"Sana yeni bir haberim var! eee\" , embeds=[Embed, Embed2])\r\n\r\n\r\n```\r\n\r\nDiscord Webhook ile mesaj g\u00f6ndermeye yarar\r\n\r\n\r\n##### Discord Author (Discord.Author)\r\n\r\n```python\r\nfrom lama2923 import Discord\r\nAUTHOR_TOKEN = \"YOUR_TOKEN\"\r\nAuthor = Discord.Author(AUTHOR_TOKEN)\r\n\r\nChannel_ID = \"YOUR_CHANNEL\"\r\n\r\nAuthor.send_message(Channel_ID, \"Merhaba D\u00fcnya!\", files=[\"src/image.png\", ])\r\n\r\nstatus, Messages = Author.get_channel_messages(Channel_ID, limit=10)\r\n\r\nfor I, Message in enumerate(Messages):\r\n print(f\"{I}: {Message['content']}\")\r\n```\r\n\r\nDiscord Author ile Bir kanala mesaj g\u00f6nderip o kanal\u0131n 10 tane mesaj\u0131n\u0131 almaya yarar.\r\n\r\n\r\n##### COLOR MIXER (color_mixer)\r\n\r\n```python\r\nfrom lama2923 import color_mixer\r\n\r\nprint(color_mixer([\"blue\"]) + \"Bu Yaz\u0131n\u0131n Rengi Mavi\") # Tek bir renk.\r\nprint(color_mixer([\"blue\", \"red\"]) + \"Bu Yaz\u0131n\u0131n Rengi Mor\") # 2 Rengin Kar\u0131\u015f\u0131m\u0131.\r\nprint(color_mixer({\"blue\": 15, \"green\": 35, \"red\": 100}) + \"Bu Yaz\u0131n\u0131n Rengi Kahverengi\") # 3 Rengin Belirli Oranda Kar\u0131\u015f\u0131m\u0131.\r\nprint(color_mixer((0, 255, 0)) + \"Bu Yaz\u0131n\u0131n Rengi Ye\u015fil\") # R.G.B Format\u0131nda Renk\r\nprint(color_mixer(0xFFA500) + \"Bu Yaz\u0131n\u0131n Rengi Turuncu\") # Hexadecimal Kodu\r\n\r\n# --------------\r\n\r\nprint(color_mixer([\"blue\"], return_type=\"hex\")) # \u00c7\u0131kt\u0131: #0000FF\r\nprint(color_mixer([\"blue\"], return_type=\"rgb\")) # \u00c7\u0131kt\u0131: (0, 0, 255)\r\n\r\n\r\n```\r\n\r\ncolor_mixer ile istedi\u011finiz rengi kolayl\u0131kla Ayarlayabilirsiniz.\r\n\r\n\r\n\r\n##### Basit Hotkey atamas\u0131 (Hotkey)\r\n```python\r\nfrom lama2923 import Hotkey\r\n@Hotkey('ctrl', 'shift', 'a')\r\ndef function():\r\n print(\"Hotkey tetiklendi!\")\r\n```\r\n\r\n\r\n\r\n\r\n##### input \u00f6zelle\u015ftirilebilir versiyonu (llinput)\r\n```python\r\nfrom lama2923 import llinput\r\nPassword = llinput(\"\u015eifreni Gir: \", inputtype=\"password-lastkey-clearend\", promptcolor={\"blue\": 15, \"green\": 35, \"red\": 100}, inputcolor={\"yellow\": 80, \"green\": 10}, wendcolor=[\"blue\"], endcolor=[\"blue\"], wend=\" <\", end=\"!\")\r\n\r\nprint(\"\u015eifre Ba\u015far\u0131yla Girildi!\", Password)\r\n```\r\nllinput \u00e7ok i\u015flevli \u00f6zelle\u015ftirilebilir linput versiyonudur.\r\n\r\n- `sep` ve `end` normal \u015fekilde \u00e7al\u0131\u015f\u0131r.\r\n- `wend` \u00f6zelli\u011fi, `{prompt} [kullan\u0131c\u0131 girdisi] + {wend}` format\u0131ndad\u0131r. `end`'den farkl\u0131 olarak, kullan\u0131c\u0131 girdisini prompt ve wend aras\u0131na yerle\u015ftirir.\r\n- `max_length`, kullan\u0131c\u0131n\u0131n girebilece\u011fi maksimum karakter say\u0131s\u0131n\u0131 s\u0131n\u0131rlar.\r\n- `min_length`, kullan\u0131c\u0131n\u0131n girebilece\u011fi minimum karakter say\u0131s\u0131n\u0131 s\u0131n\u0131rlar.\r\n- `forceint`, kullan\u0131c\u0131n\u0131n yaln\u0131zca say\u0131 girmesini sa\u011flar. | `forcestr` ile ayn\u0131 anda kullan\u0131lamaz. `negativeint` ile birlikte kullan\u0131labilir.\r\n- `negativeint`, kullan\u0131c\u0131n\u0131n yaln\u0131zca negatif say\u0131 girmesini sa\u011flar. | `forcestr` ile ayn\u0131 anda kullan\u0131lamaz. `forceint` ile birlikte kullan\u0131labilir.\r\n- `forcestr`, kullan\u0131c\u0131n\u0131n yaln\u0131zca harf girmesini sa\u011flar. | `forceint` ve `negativeint` ile ayn\u0131 anda kullan\u0131lamaz.\r\n- `forceinput`, kullan\u0131c\u0131n\u0131n bo\u015f girdi g\u00f6ndermesini engeller.\r\n- `startswith` \u00f6zelli\u011fi `(\"\", False)` format\u0131ndad\u0131r. Kullan\u0131c\u0131 girdisinin, atanan yaz\u0131yla ba\u015flamas\u0131n\u0131 sa\u011flar. E\u011fer `True` ise bu ba\u015flang\u0131\u00e7 de\u011feri silinemez; `False` ise kullan\u0131c\u0131 bu de\u011feri silebilir.\r\n- `forcestartswith`, kullan\u0131c\u0131n\u0131n girdiye ba\u015flamas\u0131 gereken de\u011ferlerin listesidir. \u00d6rne\u011fin, `[\"https\", \"http\"]` kullan\u0131c\u0131n\u0131n bir link girmesini zorunlu k\u0131lar.\r\n- `forceendswith`, kullan\u0131c\u0131n\u0131n girdiyi bitirmesi gereken de\u011ferlerin listesidir. Temel olarak `forcestartswith`'in ba\u015flang\u0131\u00e7 yerine biti\u015f versiyonudur.\r\n- `choices` `([], False)` format\u0131ndad\u0131r. Liste de\u011feri, kullan\u0131c\u0131n\u0131n se\u00e7ebilece\u011fi de\u011ferleri belirler. Boolean de\u011feri, b\u00fcy\u00fck/k\u00fc\u00e7\u00fck harf duyarl\u0131l\u0131\u011f\u0131n\u0131 belirler; `False` ise b\u00fcy\u00fck/k\u00fc\u00e7\u00fck harf duyarl\u0131d\u0131r.\r\n- `blockedchars`, kullan\u0131c\u0131n\u0131n giremeyece\u011fi karakterlerin listesidir.\r\n- `availablechars`, kullan\u0131c\u0131n\u0131n girebilece\u011fi karakterlerin listesidir. `blockedchars` ile \u00e7ak\u0131\u015fan karakterler yasakl\u0131 kabul edilir.\r\n- `forceinputlen`, kullan\u0131c\u0131y\u0131 belirli bir girdi uzunlu\u011funa zorlar.\r\n- `inputtype`, input t\u00fcr\u00fcn\u00fc belirler ve `[\"world\", \"password\", \"password-lastkey\", \"password2\", \"password2-lastkey\"]` t\u00fcrlerinden biri olabilir.\r\n- `inputcolor`, `promptcolor`, `wendcolor`, ve `endcolor` list/tuple/dict de\u011ferleridir ve `[\"red\", \"green\", \"yellow\", \"blue\", \"magenta\", \"cyan\", \"white\", \"black\"]` renklerinden biri olabilir. \u00d6rne\u011fin, `[\"red\"]` veya `[\"red\", \"blue\"]` kullanarak renkleri kar\u0131\u015ft\u0131rabilir veya `{\"blue\": 15, \"green\": 35, \"red\": 100}` format\u0131nda hangi oranlarda renk eklemek istedi\u011finizi belirleyebilirsiniz. Ayr\u0131ca, bu renkler RGB tuple format\u0131nda `(255, 0, 0)` veya hexadecimal format\u0131nda `0xFF0000` olarak da belirtilebilir.\r\n- `custom_enter_check_func` Bu de\u011fere herhangi bir callable obje atayabilirsiniz, e\u011fer True d\u00f6nd\u00fcr\u00fcrse input al\u0131n\u0131r, ancak False d\u00f6nd\u00fcr\u00fcl\u00fcrse input al\u0131nmaz. Sadece input_str arg\u00fcman\u0131 vard\u0131r.\r\n- `custom_delete_ch_check_func` Bu de\u011fere herhangi bir callable obje atayabilirsiniz, e\u011fer True d\u00f6nd\u00fcr\u00fcrse karakter silinmez, ancak False d\u00f6nd\u00fcr\u00fcl\u00fcrse karakter silinir. input_str ve chdata arg\u00fcman\u0131 vard\u0131r.\r\n- `custom_press_key_check_func` Bu de\u011fere herhangi bir callable obje atayabilirsiniz, e\u011fer True d\u00f6nd\u00fcr\u00fcrse karakter eklenir, ancak False d\u00f6nd\u00fcr\u00fcl\u00fcrse karakter eklenmez. input_str ve chdata arg\u00fcman\u0131 vard\u0131r.\r\n\r\n\r\n# custom_enter_check_func, custom_delete_ch_check_func ve custom_press_key_check_func \u0130\u00c7\u0130N \u00d6RNEK KULLANIM.\r\n\r\n### Baz\u0131 terminallerde ok tu\u015flar\u0131 \u00e7al\u0131\u015fmayabilir.\r\n\r\n```python\r\ndef check_enter(input_str):\r\n \"\"\"\r\n E\u011fer input_str \"lama2923\" ise input al\u0131n\u0131r.\r\n \"\"\"\r\n\r\n input_str # Girdi olarak verilmek istenen input_str\r\n\r\n if input_str == \"lama2923\":\r\n return True\r\n return False\r\n\r\ndef check_delete(input_str, chdata):\r\n \"\"\"\r\n E\u011fer silinmeye \u00e7al\u0131\u015f\u0131lan karakter \"a\" ise silinmez.\r\n \"\"\"\r\n ch, pos = chdata\r\n pos # Karakterin input_str'de hangi konumda silinmeye \u00e7al\u0131\u015f\u0131ld\u0131\u011f\u0131n\u0131 verir, \u00d6rnek input_str: \"Selam\", ch: \"m\", pos: 4, olsun bu durumda m karakterinin silinece\u011fi yer 4. pozisyon yani \"Sela\" yaz\u0131lmaya \u00e7al\u0131\u015f\u0131l\u0131yor.\r\n ch # Silinmeye \u00e7al\u0131\u015f\u0131lan karakter\r\n input_str # Daha karakter silinmemi\u015f olan input_str\r\n if ch == \"a\":\r\n return False\r\n return True\r\n\r\ndef check_press_key(input_str, chdata):\r\n import string\r\n \"\"\"\r\n E\u011fer Bas\u0131lan karakter bir noktalama i\u015fareti ise o karakter input'a eklenmez.\r\n \"\"\"\r\n ch, pos = chdata\r\n pos # Karakterin input_str'de hangi konuma eklenmeye \u00e7al\u0131\u015f\u0131ld\u0131\u011f\u0131n\u0131 verir, \u00d6rnek input_str: \"Selam\", ch: \"!\", pos: 5, olsun bu durumda ! karakterinin gelece\u011fi yer 5. pozisyon yani \"Selam!\" yaz\u0131lmaya \u00e7al\u0131\u015f\u0131l\u0131yor.\r\n input_str # Daha karakter eklenmemi\u015f olan input_str\r\n ch # Bas\u0131lan karakter\r\n\r\n if ch in list(string.punctuation):\r\n return False\r\n return True\r\n\r\nllinput(\"\u015eifreni Gir: \", custom_delete_ch_check_func=check_delete, custom_enter_check_func=check_enter, custom_press_key_check_func=check_press_key)\r\n```\r\n\r\n\r\n\r\n\r\n##### klas\u00f6r g\u00f6r\u00fcnt\u00fcleyici (get_directory_tree)\r\n```python\r\nfrom lama2923 import get_directory_tree\r\n\r\nstart_directory = r'data' # Ba\u015flang\u0131\u00e7 dizini\r\ndepth = 10 # Derinlik\r\nstyle = 'normal' # Stil\r\ndirectory_tree = get_directory_tree(start_directory, depth=depth, style=style)\r\nprint(directory_tree)\r\n```\r\n\r\n\u00f6rnek \u00e7\u0131kt\u0131\r\n\r\n```\r\n\u2514\u2500\u2500 data\\\r\n \u251c\u2500\u2500 src\\\r\n | \u2514\u2500\u2500 Images\\\r\n | \u251c\u2500\u2500 Images2.png\r\n | \u2514\u2500\u2500 \u0131mage1.png\r\n \u2514\u2500\u2500 x.txt\r\n\r\n```\r\n\r\nget_directory_tree \u00f6zelli\u011fi belirli bir dizindeki dosyalar\u0131/klas\u00f6rleri tasar\u0131ma uygun bi\u00e7imde d\u00f6nd\u00fcrmektir.\r\n\r\n\r\n- `startpath`: Ba\u015flang\u0131\u00e7 dizininin yolunu belirtir. Bu, dizin a\u011fac\u0131n\u0131n olu\u015fturulmas\u0131na ba\u015flanacak k\u00f6k dizindir. \u00d6rne\u011fin `data\\src`.\r\n\r\n- `depth`: Ge\u00e7erli derinli\u011fi belirtir. Fonksiyonun \u00e7a\u011fr\u0131ld\u0131\u011f\u0131 s\u0131rada dizin a\u011fac\u0131n\u0131n hangi derinlikte oldu\u011funu g\u00f6sterir. Varsay\u0131lan de\u011feri `0` olup, bu da k\u00f6k dizini temsil eder. Her bir alt dizine ge\u00e7ildi\u011finde bu de\u011fer art\u0131r\u0131l\u0131r.\r\n\r\n- `max_depth`: Dizin a\u011fac\u0131n\u0131n olu\u015fturulmas\u0131nda maksimum derinli\u011fi belirtir. Bu, dizin a\u011fac\u0131n\u0131n ne kadar derinlikte g\u00f6sterilece\u011fini kontrol etmek i\u00e7in kullan\u0131l\u0131r. \u00d6zellikle \u00e7ok fazla i\u00e7eri\u011fi olan dizinleriniz i\u00e7in bu de\u011feri kullanman\u0131z\u0131 performans i\u00e7in \u00f6neririm. Varsay\u0131lan de\u011feri `float('inf')` olup, bu sonsuz derinlik anlam\u0131na gelir. \u00d6rne\u011fin, `max_depth=2` sadece k\u00f6k dizin ve iki alt seviye dizinleri g\u00f6sterir.\r\n\r\n- `prefix`: Ge\u00e7erli dizin ve dosya adlar\u0131n\u0131n \u00f6n\u00fcne eklenen \u00f6nek karakterlerdir. Bu \u00f6nekler, dizin yap\u0131s\u0131n\u0131n do\u011fru bir \u015fekilde g\u00f6rselle\u015ftirilmesine yard\u0131mc\u0131 olur ve genellikle bo\u015fluk veya dikey \u00e7izgiler gibi karakterlerden olu\u015fur. Varsay\u0131lan de\u011feri `''`'d\u0131r.\r\n\r\n- `is_last`: Ge\u00e7erli dizin veya dosyan\u0131n, \u00fcst dizindeki son \u00f6\u011fe olup olmad\u0131\u011f\u0131n\u0131 belirtir. Bu bilgi, do\u011fru bi\u00e7imlendirme ve \u00f6nek karakterlerin ayarlanmas\u0131nda kullan\u0131l\u0131r. Varsay\u0131lan de\u011feri `True`'d\u0131r.\r\n\r\n- `style`: Dizin a\u011fac\u0131n\u0131n hangi stil ile olu\u015fturulaca\u011f\u0131n\u0131 belirtir. \u00d6nceden tan\u0131ml\u0131 stillerden birini se\u00e7er. Varsay\u0131lan de\u011feri `'normal'`'dir.\r\n\r\n- `custom_style`: Kullan\u0131c\u0131 taraf\u0131ndan tan\u0131mlanan \u00f6zel bir stil belirtir. Bu, `branch` ve `spacing` gibi \u00f6znitelikleri i\u00e7erir ve fonksiyon, belirtilen bu stili kullanarak dizin a\u011fac\u0131n\u0131 olu\u015fturur. E\u011fer `custom_style` belirtilmi\u015fse, `style` parametresi g\u00f6z ard\u0131 edilir.\r\n\r\n\u00f6rnek `custom_style`\r\n```json\r\ncustom_style = {\r\n 'branch': ('>>> ', '<<< ', '|||', '\\\\'),\r\n 'spacing': ' '\r\n}\r\n```\r\n\r\n\u00e7\u0131kt\u0131\r\n```\r\n<<< data\\\r\n >>> src\\\r\n ||| <<< Images\\\r\n ||| >>> Images2.png\r\n ||| <<< \u0131mage1.png\r\n <<< x.txt\r\n```\r\nkullanabilece\u011finiz b\u00fct\u00fcn stiller\r\n\r\n- `normal`\r\n- `bold`\r\n- `thin`\r\n- `compact`\r\n- `double`\r\n- `dash`\r\n- `star`\r\n- `plus`\r\n- `wave`\r\n- `hash`\r\n- `dot`\r\n- `pipe`\r\n- `slash`\r\n- `backslash`\r\n- `equal`\r\n- `colon`\r\n- `semicolon`\r\n- `exclamation`\r\n- `question`\r\n- `caret`\r\n- `percent`\r\n- `at`\r\n- `tilde`\r\n- `bracket`\r\n- `brace`\r\n- `paren`\r\n- `angle`\r\n- `quote`\r\n- `apos`\r\n- `underscore`\r\n- `plusminus`\r\n- `doubleangle`\r\n- `box`\r\n- `arrow`\r\n\r\n\r\n\r\n\r\n\r\n---\r\n\r\n#### English\r\n### User Guide\r\n\r\nThis Python library offers a variety of APIs and Terminal designs such as Discord and llinput.\r\n\r\n#### Installation\r\nInstall the necessary modules to use this library:\r\n```bash\r\npip install lama2923\r\n```\r\n\r\n#### Functions and Their Uses\r\n\r\n##### Clear Screen (clear_screen)\r\n```python\r\nfrom lama2923 import clear_screen\r\nclear_screen()\r\n```\r\nClears the screen.\r\n\r\n##### Calculate Elapsed Time (calculate_elapsed_time)\r\n```python\r\nfrom lama2923 import calculate_elapsed_time, get_time\r\nstart_time = get_time()\r\n\r\n# Code\r\n\r\nend_time = get_time()\r\nelapsed_time = calculate_elapsed_time(start_time, end_time)\r\nprint(elapsed_time)\r\n```\r\nCalculates the elapsed time between two points and returns it in milliseconds, seconds, minutes, hours, and days.\r\n\r\n##### Rainbow Text (rainbow_text)\r\n```python\r\nfrom lama2923 import rainbow_text\r\nrainbow_text(\"Hello World\", LOOP=3, Speed=\"Slow\", section=\"Full\")\r\n```\r\nThis section is for fun! You can use it to surprise your friends.\r\n\r\n##### Port Check (check_port)\r\n```python\r\nfrom lama2923 import check_port\r\nport_open = check_port(\"127.0.0.1\", 80)\r\nprint(f\"Is the port open? {port_open}\")\r\n```\r\nChecks if the specified port on the given IP address is open.\r\n\r\n##### Internet Connection Check (check_internet)\r\n```python\r\nfrom lama2923 import check_internet\r\ninternet_connected = check_internet()\r\nprint(f\"Is there an internet connection? {internet_connected}\")\r\n```\r\nChecks for an internet connection.\r\n\r\n##### Animated Print (lprint)\r\n```python\r\nfrom lama2923 import lprint\r\nlprint(\"Hello World\")\r\n```\r\nIt works the same as the print function but provides animated output from left to right based on the length of the text.\r\n\r\n##### Animated Input (linput)\r\n```python\r\nfrom lama2923 import linput\r\nuser_input = linput(\"Your name: \", autocorrect=True)\r\n```\r\nlinput works the same as input but provides animated output like lprint.\r\nThe autocorrect feature prevents writing errors before the input appears. It ensures that pressing 'Enter' mistakenly before the input is shown does not proceed.\r\n\r\n##### Formatted Number (formatted_number)\r\n```python\r\nfrom lama2923 import formatted_number\r\nnum = formatted_number(100000.1234) # output: 100.000,1234\r\nprint(f\"Formatted number: {num}\")\r\n```\r\nTakes a number (accepted as a string) and outputs it in a properly formatted manner.\r\n\r\n##### Reverse Formatted Number (reverse_formatted_number)\r\n```python\r\nfrom lama2923 import reverse_formatted_number\r\nnum = reverse_formatted_number(\"12.345,678\") # 12345.678\r\nprint(f\"Original number: {num}\")\r\n```\r\nTakes a properly formatted number (accepted as a string) and reverses it.\r\n\r\n\r\n##### Discord Webhook (Discord.Webhook)\r\n```python\r\nfrom lama2923 import Discord\r\nwebhook_url = 'WEBHOOK-URL-HERE'\r\nwebhook = Discord.Webhook(webhook_url=webhook_url)\r\n\r\nEmbed2 = Discord.Embed(title=\"\", description=\"\")\r\nEmbed2.set_image(r\"https:\\\\xxxxxxx\") # Image URL\r\n\r\n\r\nEmbed = Discord.Embed(title=\"Hello\", description=\"World\", color=0x00ff00)\r\nEmbed.add_field(name=\"I-\", value=\"I am alive!\", inline=False)\r\nEmbed.set_footer(text=\"Program\")\r\nEmbed.set_image(\"image.png\") # Image Path\r\n\r\n\r\nStatus = webhook.send_webhook(Content=\"I have news for you! uhh\" , embeds=[Embed, Embed2])\r\n\r\n```\r\n\r\nSends a message using Discord Webhook.\r\n\r\n\r\n##### Discord Author (Discord.Author)\r\n\r\n```python\r\nfrom lama2923 import Discord\r\nAUTHOR_TOKEN = \"YOUR_TOKEN\"\r\nAuthor = Discord.Author(AUTHOR_TOKEN)\r\n\r\nChannel_ID = \"YOUR_CHANNEL\"\r\n\r\nAuthor.send_message(Channel_ID, \"Hello World!\", files=[\"src/image.png\", ])\r\n\r\nstatus, Messages = Author.get_channel_messages(Channel_ID, limit=10)\r\n\r\nfor I, Message in enumerate(Messages):\r\n print(f\"{I}: {Message['content']}\")\r\n```\r\n\r\nAllows sending a message to a channel and retrieving the last 10 messages from that channel using Discord Author.\r\n\r\n##### COLOR MIXER (color_mixer)\r\n\r\n```python\r\nfrom lama2923 import color_mixer\r\n\r\nprint(color_mixer([\"blue\"]) + \"This text is Blue\") # Single color.\r\nprint(color_mixer([\"blue\", \"red\"]) + \"This text is Purple\") # Mix of 2 colors.\r\nprint(color_mixer({\"blue\": 15, \"green\": 35, \"red\": 100}) + \"This text is Brown\") # Mix of 3 colors with specified proportions.\r\nprint(color_mixer((0, 255, 0)) + \"This text is Green\") # R.G.B format color\r\nprint(color_mixer(0xFFA500) + \"This text is Orange\") # Hexadecimal code\r\n\r\n# --------------\r\n\r\nprint(color_mixer([\"blue\"], return_type=\"hex\")) # Output: #0000FF\r\nprint(color_mixer([\"blue\"], return_type=\"rgb\")) # Output: (0, 0, 255)\r\n\r\n\r\n```\r\n\r\nWith color_mixer, you can easily adjust the desired color.\r\n\r\n\r\n##### Simple Hotkey Assignment (Hotkey)\r\n```python\r\nfrom lama2923 import Hotkey\r\n@Hotkey('ctrl', 'shift', 'a')\r\ndef function():\r\n print(\"Hotkey triggered!\")\r\n```\r\n\r\n\r\n##### Enhanced input (llinput)\r\n```python\r\nfrom lama2923 import llinput\r\nPassword = llinput(\"Enter your Password: \", inputtype=\"password-lastkey-clearend\", promptcolor={\"blue\": 15, \"green\": 35, \"red\": 100}, inputcolor={\"yellow\": 80, \"green\": 10}, wendcolor=[\"blue\"], endcolor=[\"blue\"], wend=\" <\", end=\"!\")\r\n\r\nprint(\"Password Entered Successfully!\", Password)\r\n```\r\nllinput is a highly functional, customizable version of linput.\r\n\r\n- `sep` and `end` work as usual.\r\n- `wend` feature is in the format {prompt} [user input] + {wend}. Unlike `end`, it places the user input between prompt and wend.\r\n- `max_length` limits the maximum number of characters the user can enter.\r\n- `min_length` limits the minimum number of characters the user can enter.\r\n- `forceint` allows the user to enter only numbers. | Cannot be used with `forcestr`. Can be used with `negativeint`.\r\n- `negativeint` allows the user to enter only negative numbers. | Cannot be used with `forcestr`. Can be used with `forceint`.\r\n- `forcestr` allows the user to enter only letters. | Cannot be used with `forceint` and `negativeint`.\r\n- `forceinput` prevents the user from submitting empty input.\r\n- `startswith` is in the format (\"\", False). It sets the beginning of the user input to the given string. If True, this prefix cannot be deleted; if False, the user can delete it.\r\n- `forcestartswith` is a list of values that the user must start their input with, e.g., [\"https\", \"http\"] requires the user to enter a link.\r\n- `forceendswith` is a list of values that the user must end their input with.\r\n- `choices` is in the format ([], False). It provides a list of acceptable choices. The boolean determines case sensitivity; False means case-sensitive.\r\n- `blockedchars` is a string of characters that the user cannot enter.\r\n- `availablechars` is a string of characters that the user can enter. Conflicts with `blockedchars` will result in the character being blocked.\r\n- `forceinputlen` forces the user to enter input of a specific length.\r\n- `inputtype` specifies the type of input and can be one of the following types: `[\"world\", \"password\", \"password-lastkey\", \"password2\", \"password2-lastkey\"]`.\r\n- `inputcolor`, `promptcolor`, `wendcolor`, and `endcolor` are list/tuple/dict values and can be one of the colors from `[\"red\", \"green\", \"yellow\", \"blue\", \"magenta\", \"cyan\", \"white\", \"black\"]`. For example, you can use `[\"red\"]` or `[\"red\", \"blue\"]` to mix colors or specify the ratios of colors you want to add in the format `{\"blue\": 15, \"green\": 35, \"red\": 100}`. Additionally, these colors can also be specified in RGB tuple format as `(255, 0, 0)` or in hexadecimal format as `0xFF0000`.\r\n- `custom_enter_check_func` You can assign any callable object to this value. If it returns True, the input is accepted, but if it returns False, the input is rejected. It only has the input_str argument.\r\n- `custom_delete_ch_check_func` You can assign any callable object to this value. If it returns True, the character is not deleted, but if it returns False, the character is deleted. It has the input_str and chdata arguments.\r\n- `custom_press_key_check_func` You can assign any callable object to this value. If it returns True, the character is added, but if it returns False, the character is not added. It has the input_str and chdata arguments.\r\n\r\n\r\n# EXAMPLE USAGE FOR custom_enter_check_func, custom_delete_ch_check_func, and custom_press_key_check_func.\r\n\r\n### Arrow keys may not work in some terminals.\r\n\r\n```python\r\ndef check_enter(input_str):\r\n \"\"\"\r\n If input_str is \"lama2923\", input is accepted.\r\n \"\"\"\r\n\r\n input_str # The input_str intended to be provided as input\r\n\r\n if input_str == \"lama2923\":\r\n return True\r\n return False\r\n\r\ndef check_delete(input_str, chdata):\r\n \"\"\"\r\n If the character being attempted to delete is \"a\", it will not be deleted.\r\n \"\"\"\r\n ch, pos = chdata\r\n pos # Indicates the position in input_str where the character is being attempted to delete. Example: input_str: \"Hello\", ch: \"o\", pos: 4, in this case, the \"o\" character is at position 4 and \"Hell\" is being attempted to type.\r\n ch # The character being attempted to delete\r\n input_str # The input_str before the character is deleted\r\n if ch == \"a\":\r\n return False\r\n return True\r\n\r\ndef check_press_key(input_str, chdata):\r\n import string\r\n \"\"\"\r\n If the pressed character is a punctuation mark, it will not be added to the input.\r\n \"\"\"\r\n ch, pos = chdata\r\n pos # Indicates the position in input_str where the character is being attempted to add. Example: input_str: \"Hello\", ch: \"!\", pos: 5, in this case, the \"!\" character is at position 5 and \"Hello!\" is being attempted to type.\r\n input_str # The input_str before the character is added\r\n ch # The pressed character\r\n\r\n if ch in list(string.punctuation):\r\n return False\r\n return True\r\n\r\nllinput(\"Enter your password: \", custom_delete_ch_check_func=check_delete, custom_enter_check_func=check_enter, custom_press_key_check_func=check_press_key)\r\n\r\n```\r\n\r\n##### folder viewer (get_directory_tree)\r\n```python\r\nfrom lama2923 import get_directory_tree\r\n\r\nstart_directory = r'data' # Starting directory\r\ndepth = 10 # Depth\r\nstyle = 'normal' # Style\r\ndirectory_tree = get_directory_tree(start_directory, depth=depth, style=style)\r\nprint(directory_tree)\r\n```\r\n\r\nexample output\r\n\r\n```\r\n\u2514\u2500\u2500 data\\\r\n \u251c\u2500\u2500 src\\\r\n | \u2514\u2500\u2500 Images\\\r\n | \u251c\u2500\u2500 Images2.png\r\n | \u2514\u2500\u2500 \u0131mage1.png\r\n \u2514\u2500\u2500 x.txt\r\n\r\n```\r\n\r\nThe get_directory_tree feature returns the files/folders in a specific directory in a design-friendly format.\r\n\r\n\r\n- `startpath`: Specifies the path of the starting directory. This is the root directory where the directory tree creation will start. For example `data\\src`.\r\n\r\n- `depth`: Indicates the current depth. It shows at what depth the directory tree is during the function call. The default value is `0`, representing the root directory. This value increases as it goes down to each subdirectory.\r\n\r\n- `max_depth`: Specifies the maximum depth in the creation of the directory tree. It is used to control how deep the directory tree will be displayed. I recommend using this value for directories with a lot of content for performance. The default value is `float('inf')`, meaning infinite depth. For example, `max_depth=2` will only show the root directory and two levels of subdirectories.\r\n\r\n- `prefix`: The prefix characters added before the names of the current directories and files. These prefixes help in visualizing the directory structure correctly and usually consist of characters like spaces or vertical lines. The default value is `''`.\r\n\r\n- `is_last`: Indicates whether the current directory or file is the last item in its parent directory. This information is used for proper formatting and setting prefix characters. The default value is `True`.\r\n\r\n- `style`: Specifies which style the directory tree will be created in. It selects one of the predefined styles. The default value is `'normal'`.\r\n\r\n- `custom_style`: Specifies a user-defined custom style. This includes attributes like `branch` and `spacing`, and the function uses the specified style to create the directory tree. If `custom_style` is specified, the `style` parameter is ignored.\r\n\r\nexample `custom_style`\r\n```json\r\ncustom_style = {\r\n 'branch': ('>>> ', '<<< ', '|||', '\\'),\r\n 'spacing': ' '\r\n}\r\n```\r\n\r\noutput\r\n```\r\n<<< data\\\r\n >>> src\\\r\n ||| <<< Images\\\r\n ||| >>> Images2.png\r\n ||| <<< \u0131mage1.png\r\n <<< x.txt\r\n```\r\nall available styles\r\n\r\n- `normal`\r\n- `bold`\r\n- `thin`\r\n- `compact`\r\n- `double`\r\n- `dash`\r\n- `star`\r\n- `plus`\r\n- `wave`\r\n- `hash`\r\n- `dot`\r\n- `pipe`\r\n- `slash`\r\n- `backslash`\r\n- `equal`\r\n- `colon`\r\n- `semicolon`\r\n- `exclamation`\r\n- `question`\r\n- `caret`\r\n- `percent`\r\n- `at`\r\n- `tilde`\r\n- `bracket`\r\n- `brace`\r\n- `paren`\r\n- `angle`\r\n- `quote`\r\n- `apos`\r\n- `underscore`\r\n- `plusminus`\r\n- `doubleangle`\r\n- `box`\r\n- `arrow`\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Sikimsonik bir k\u00fct\u00fcphane",
"version": "2.0.4",
"project_urls": {
"Author GitHub": "https://github.com/lama2923"
},
"split_keywords": [
"example",
"project",
"evelopment",
"discord",
"lama2923",
"api",
"design",
"custom",
"custominput",
"customprint"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c5c0380428bb5df16ee0af3529b635f8341665a8c7299fe7c9f2a602febd9a60",
"md5": "bdd33768408f99d342f137e73ca2d9fe",
"sha256": "c639c8f2aad00859d1211f1528008858a29f96497fcf2a6d724c64a177393c26"
},
"downloads": -1,
"filename": "lama2923-2.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bdd33768408f99d342f137e73ca2d9fe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 17398,
"upload_time": "2024-09-29T19:48:14",
"upload_time_iso_8601": "2024-09-29T19:48:14.494961Z",
"url": "https://files.pythonhosted.org/packages/c5/c0/380428bb5df16ee0af3529b635f8341665a8c7299fe7c9f2a602febd9a60/lama2923-2.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "637c995bf8df5349b785b6086028753d8a1041d2772742c1f8df2fcf568f98e9",
"md5": "e9a87ace6fcacf12fc01ddebf33c8845",
"sha256": "0652d4acba3c6f33c33ea76bd3b3f30a97d1293657a147949dfcea37557cee1d"
},
"downloads": -1,
"filename": "lama2923-2.0.4.tar.gz",
"has_sig": false,
"md5_digest": "e9a87ace6fcacf12fc01ddebf33c8845",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 25162,
"upload_time": "2024-09-29T19:48:16",
"upload_time_iso_8601": "2024-09-29T19:48:16.244351Z",
"url": "https://files.pythonhosted.org/packages/63/7c/995bf8df5349b785b6086028753d8a1041d2772742c1f8df2fcf568f98e9/lama2923-2.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-29 19:48:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "lama2923"
}