Skip to main content

Karmaşık ve popüler kodları tek tıkla kullanabileceğiniz Python kütüphanesi

Project description

PyBasics

Karmaşık ve popüler kodları tek tıkla kullanabileceğiniz Python kütüphanesi.

Özellikler

  • Matematik Hesapları: Asal sayılar, kombinasyon, permütasyon, istatistik, lineer regresyon, matris işlemleri
  • Basit AI: RAM tabanlı öğrenme ve cevaplama sistemi
  • Algoritmalar: Sıralama, arama, graf algoritmaları, dinamik programlama
  • String İşlemleri: Palindrom, anagram, metin analizi, regex işlemleri
  • Dosya İşlemleri: JSON, CSV, pickle, dosya yönetimi
  • Veri İşlemleri: List/dict manipülasyonu, gruplama, filtreleme

Kurulum

pip install pybasics

Veya geliştirme modunda:

git clone https://github.com/kullanici/pybasics.git
cd pybasics
pip install -e .

Hızlı Başlangıç

Matematik İşlemleri

import pybasics as pb

# Asal sayı kontrolü
print(pb.is_prime(17))  # True

# Asal sayılar aralığında
print(pb.primes(1, 50))  # [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]

# Kombinasyon ve permütasyon
print(pb.combination(5, 2))  # 10
print(pb.permutation(5, 2))  # 20

# İstatistik
data = [1, 2, 3, 4, 5]
print(pb.average(data))  # 3.0
print(pb.median(data))   # 3
print(pb.std_dev(data))  # 1.414...

# Fibonacci ve faktöriyel
print(pb.fibonacci(10))    # [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
print(pb.factorial(5))   # 120

AI Öğrenme Sistemi

import pybasics as pb

# Veri öğretme
pb.ai_learn("Python programlama dili 1991'de Guido van Rossum tarafından oluşturuldu.")
pb.ai_learn("Python nesne yönelimli, yorumlanan bir dildir.")
pb.ai_learn("Makine öğrenmesi yapay zekanın bir alt dalıdır.")

# Soru sorma
cevap = pb.ai_answer("Python nedir?")
print(cevap)

# AI istatistikleri
print(pb.ai.get_stats())

Algoritmalar

import pybasics as pb

# Sıralama
arr = [64, 34, 25, 12, 22, 11, 90]
print(pb.quick_sort(arr))   # [11, 12, 22, 25, 34, 64, 90]
print(pb.merge_sort(arr))   # [11, 12, 22, 25, 34, 64, 90]

# Arama
print(pb.binary_search([1, 2, 3, 4, 5], 3))  # 2
print(pb.linear_search([1, 2, 3, 4, 5], 4))  # 3

# Graf algoritmaları
graph = pb.Graph()
graph.add_edge('A', 'B')
graph.add_edge('B', 'C')
graph.add_edge('A', 'C')

print(graph.bfs('A'))  # ['A', 'B', 'C']
print(graph.dfs('A'))  # ['A', 'B', 'C']
print(graph.shortest_path('A', 'C'))  # ['A', 'C']

# Dinamik programlama
print(pb.knapsack_01([1, 2, 3], [6, 10, 12], 5))  # 22
print(pb.coin_change([1, 2, 5], 11))  # 3 (5+5+1)
print(pb.climb_stairs(10))  # 89

String İşlemleri

import pybasics as pb

# Temel işlemler
print(pb.reverse_string("Merhaba"))  # abahreM
print(pb.is_palindrome("ana"))       # True
print(pb.count_vowels("Merhaba"))    # 3

# Metin analizi
text = "Python çok güzel bir dil. Python öğrenmesi kolaydır."
print(pb.most_common_word(text))  # python
print(pb.word_frequency(text))    # {'python': 2, 'çok': 1, ...}
print(pb.longest_word(text))      # öğrenmesi

# Format dönüşümleri
print(pb.camel_case("merhaba dünya"))  # merhabaDünya
print(pb.snake_case("merhaba dünya"))  # merhaba_dünya
print(pb.kebab_case("merhaba dünya"))  # merhaba-dünya
print(pb.slugify("Merhaba Dünya!"))    # merhaba-dunya

# Bilgi çıkarma
text = "İletişim: test@email.com veya https://site.com"
print(pb.extract_emails(text))  # ['test@email.com']
print(pb.extract_urls(text))    # ['https://site.com']

# Benzerlik hesaplama
print(pb.levenshtein_distance("kedi", "keli"))  # 1
print(pb.similarity_ratio("python", "python"))  # 1.0

Dosya İşlemleri

import pybasics as pb

# Temel okuma/yazma
pb.write_file("test.txt", "Merhaba Dünya!")
content = pb.read_file("test.txt")

# JSON
pb.write_json("data.json", {"isim": "Ali", "yaş": 25})
data = pb.read_json("data.json")

# CSV
records = [{"ad": "Ali", "yaş": 25}, {"ad": "Veli", "yaş": 30}]
pb.write_csv("data.csv", records)
rows = pb.read_csv("data.csv")

# Dosya yönetimi
print(pb.file_exists("test.txt"))      # True
print(pb.get_file_size("test.txt"))    # 15
print(pb.list_files("."))              # ['./test.txt', ...]

# Dosya arama
py_files = pb.find_files(".", "*.py")

# Yedekleme
pb.backup_file("test.txt")

Veri İşlemleri

import pybasics as pb

# List işlemleri
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(pb.chunk_list(data, 3))      # [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]
print(pb.flatten_list([[1, 2], [3, 4]]))  # [1, 2, 3, 4]

# Dict işlemleri
users = [
    {"isim": "Ali", "şehir": "İstanbul", "yaş": 25},
    {"isim": "Veli", "şehir": "Ankara", "yaş": 30},
    {"isim": "Ayşe", "şehir": "İstanbul", "yaş": 28}
]

# Gruplama
by_city = pb.group_by(users, "şehir")
# {'İstanbul': [{...Ali...}, {...Ayşe...}], 'Ankara': [{...Veli...}]}

# Sıralama ve filtreleme
sorted_users = pb.sort_by(users, "yaş", reverse=True)
istanbul_users = pb.filter_by(users, "şehir", "İstanbul")

# Veri çekme
isimler = pb.pluck(users, "isim")  # ['Ali', 'Veli', 'Ayşe']

# İstatistiksel işlemler
numbers = [1, 2, 3, 4, 5, 100]
print(pb.normalize(numbers))       # [0.0, 0.01..., 0.02..., 0.03..., 0.04..., 1.0]
print(pb.standardize(numbers))     # Z-score normalizasyonu
print(pb.outliers(numbers))        # [100]
print(pb.quartiles(numbers))       # {'q1': 2.0, 'q2': 3.5, 'q3': 4.75}

# Train/test bölme
train, test = pb.split_train_test(data, 0.8)

Modüller

Modül Açıklama
math_utils Matematik ve istatistik fonksiyonları
ai_simple Basit AI öğrenme ve cevaplama sistemi
algorithms Sıralama, arama, graf ve DP algoritmaları
string_utils Metin işleme ve analiz fonksiyonları
file_utils Dosya okuma/yazma ve yönetimi
data_utils Liste ve dict manipülasyon araçları

Gereksinimler

  • Python 3.7+

Lisans

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pbasic-1.0.1.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pbasic-1.0.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file pbasic-1.0.1.tar.gz.

File metadata

  • Download URL: pbasic-1.0.1.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pbasic-1.0.1.tar.gz
Algorithm Hash digest
SHA256 802b00a20c867ca922c790c6f0966e3b591a915761c03114b2536b141080fccc
MD5 13a9b941820c9e331be668845a40cbed
BLAKE2b-256 4140692ba31b10385c5ef6fdb1944679f4c00097421c688056c9b0b478799fe2

See more details on using hashes here.

File details

Details for the file pbasic-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pbasic-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pbasic-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 412c3fab20443d01a1a309e8974f34fed39bfb02d63fa9dc25217f0e53e10f9a
MD5 13243d8db4968364428932f5160d576d
BLAKE2b-256 60bbc480f453529ddc144c77be2274311910979639f11db2195a784973ff78f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page