randomcode 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. randomcode/__init__.py +0 -0
  2. randomcode/anthropic.py +30 -0
  3. randomcode/anyscale.py +23 -0
  4. randomcode/azure_openai.py +23 -0
  5. randomcode/azureml_endpoint.py +30 -0
  6. randomcode/baichuan.py +23 -0
  7. randomcode/baidu_qianfan_endpoint.py +27 -0
  8. randomcode/base_language.py +7 -0
  9. randomcode/bedrock.py +27 -0
  10. randomcode/cache.py +72 -0
  11. randomcode/cohere.py +23 -0
  12. randomcode/databricks.py +23 -0
  13. randomcode/env.py +17 -0
  14. randomcode/ernie.py +23 -0
  15. randomcode/everlyai.py +23 -0
  16. randomcode/example_generator.py +5 -0
  17. randomcode/fake.py +30 -0
  18. randomcode/fireworks.py +23 -0
  19. randomcode/formatting.py +5 -0
  20. randomcode/gigachat.py +23 -0
  21. randomcode/google_palm.py +30 -0
  22. randomcode/human.py +23 -0
  23. randomcode/hunyuan.py +23 -0
  24. randomcode/input.py +15 -0
  25. randomcode/javelin_ai_gateway.py +30 -0
  26. randomcode/jinachat.py +23 -0
  27. randomcode/konko.py +23 -0
  28. randomcode/litellm.py +30 -0
  29. randomcode/meta.py +25 -0
  30. randomcode/minimax.py +23 -0
  31. randomcode/mlflow.py +23 -0
  32. randomcode/mlflow_ai_gateway.py +30 -0
  33. randomcode/ollama.py +23 -0
  34. randomcode/openai.py +23 -0
  35. randomcode/pai_eas_endpoint.py +25 -0
  36. randomcode/promptlayer_openai.py +25 -0
  37. randomcode/python.py +19 -0
  38. randomcode/requests.py +35 -0
  39. randomcode/s1.py +28 -0
  40. randomcode/s10.py +56 -0
  41. randomcode/s2.py +49 -0
  42. randomcode/s3.py +37 -0
  43. randomcode/s4.py +19 -0
  44. randomcode/s5.py +28 -0
  45. randomcode/s6.py +44 -0
  46. randomcode/s7.py +46 -0
  47. randomcode/s8.py +53 -0
  48. randomcode/s9.py +45 -0
  49. randomcode/serpapi.py +25 -0
  50. randomcode/sql_database.py +25 -0
  51. randomcode/tongyi.py +23 -0
  52. randomcode/vertexai.py +23 -0
  53. randomcode/volcengine_maas.py +30 -0
  54. randomcode/yandex.py +23 -0
  55. randomcode-0.1.0.dist-info/METADATA +84 -0
  56. randomcode-0.1.0.dist-info/RECORD +59 -0
  57. randomcode-0.1.0.dist-info/WHEEL +5 -0
  58. randomcode-0.1.0.dist-info/licenses/LICENSE.txt +7 -0
  59. randomcode-0.1.0.dist-info/top_level.txt +1 -0
randomcode/s9.py ADDED
@@ -0,0 +1,45 @@
1
+ # Genetic Algorithm- I
2
+
3
+ import random
4
+
5
+ POP_SIZE = 6
6
+ CHROM_LEN = 5
7
+ GENERATIONS = 10
8
+ MUT_RATE = 0.1
9
+
10
+ population = [[random.randint(0,1) for _ in range(CHROM_LEN)]
11
+ for _ in range(POP_SIZE)]
12
+
13
+ def decode(chrom):
14
+ return int("".join(map(str, chrom)), 2)
15
+
16
+ for gen in range(GENERATIONS):
17
+
18
+ values = [decode(c) for c in population]
19
+ fitness = [x**2 for x in values]
20
+
21
+ best_index = fitness.index(max(fitness))
22
+ print("Generation", gen+1,
23
+ "Best x =", values[best_index],
24
+ "Fitness =", fitness[best_index])
25
+
26
+ total = sum(fitness)
27
+ probs = [f/total for f in fitness]
28
+
29
+ new_pop = []
30
+ while len(new_pop) < POP_SIZE:
31
+ p1 = population[random.choices(range(POP_SIZE), probs)[0]]
32
+ p2 = population[random.choices(range(POP_SIZE), probs)[0]]
33
+
34
+ point = random.randint(1, CHROM_LEN-1)
35
+ c1 = p1[:point] + p2[point:]
36
+ c2 = p2[:point] + p1[point:]
37
+
38
+ new_pop.extend([c1, c2])
39
+
40
+ for chrom in new_pop:
41
+ for i in range(CHROM_LEN):
42
+ if random.random() < MUT_RATE:
43
+ chrom[i] ^= 1
44
+
45
+ population = new_pop[:POP_SIZE]
randomcode/serpapi.py ADDED
@@ -0,0 +1,25 @@
1
+ """For backwards compatibility."""
2
+
3
+ from typing import TYPE_CHECKING, Any
4
+
5
+ from langchain._api import create_importer
6
+
7
+ if TYPE_CHECKING:
8
+ from langchain_community.utilities import SerpAPIWrapper
9
+
10
+ # Create a way to dynamically look up deprecated imports.
11
+ # Used to consolidate logic for raising deprecation warnings and
12
+ # handling optional imports.
13
+ DEPRECATED_LOOKUP = {"SerpAPIWrapper": "langchain_community.utilities"}
14
+
15
+ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
16
+
17
+
18
+ def __getattr__(name: str) -> Any:
19
+ """Look up attributes dynamically."""
20
+ return _import_attribute(name)
21
+
22
+
23
+ __all__ = [
24
+ "SerpAPIWrapper",
25
+ ]
@@ -0,0 +1,25 @@
1
+ """Keep here for backwards compatibility."""
2
+
3
+ from typing import TYPE_CHECKING, Any
4
+
5
+ from langchain._api import create_importer
6
+
7
+ if TYPE_CHECKING:
8
+ from langchain_community.utilities import SQLDatabase
9
+
10
+ # Create a way to dynamically look up deprecated imports.
11
+ # Used to consolidate logic for raising deprecation warnings and
12
+ # handling optional imports.
13
+ DEPRECATED_LOOKUP = {"SQLDatabase": "langchain_community.utilities"}
14
+
15
+ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
16
+
17
+
18
+ def __getattr__(name: str) -> Any:
19
+ """Look up attributes dynamically."""
20
+ return _import_attribute(name)
21
+
22
+
23
+ __all__ = [
24
+ "SQLDatabase",
25
+ ]
randomcode/tongyi.py ADDED
@@ -0,0 +1,23 @@
1
+ from typing import TYPE_CHECKING, Any
2
+
3
+ from langchain._api import create_importer
4
+
5
+ if TYPE_CHECKING:
6
+ from langchain_community.chat_models.tongyi import ChatTongyi
7
+
8
+ # Create a way to dynamically look up deprecated imports.
9
+ # Used to consolidate logic for raising deprecation warnings and
10
+ # handling optional imports.
11
+ DEPRECATED_LOOKUP = {"ChatTongyi": "langchain_community.chat_models.tongyi"}
12
+
13
+ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
14
+
15
+
16
+ def __getattr__(name: str) -> Any:
17
+ """Look up attributes dynamically."""
18
+ return _import_attribute(name)
19
+
20
+
21
+ __all__ = [
22
+ "ChatTongyi",
23
+ ]
randomcode/vertexai.py ADDED
@@ -0,0 +1,23 @@
1
+ from typing import TYPE_CHECKING, Any
2
+
3
+ from langchain._api import create_importer
4
+
5
+ if TYPE_CHECKING:
6
+ from langchain_community.chat_models.vertexai import ChatVertexAI
7
+
8
+ # Create a way to dynamically look up deprecated imports.
9
+ # Used to consolidate logic for raising deprecation warnings and
10
+ # handling optional imports.
11
+ DEPRECATED_LOOKUP = {"ChatVertexAI": "langchain_community.chat_models.vertexai"}
12
+
13
+ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
14
+
15
+
16
+ def __getattr__(name: str) -> Any:
17
+ """Look up attributes dynamically."""
18
+ return _import_attribute(name)
19
+
20
+
21
+ __all__ = [
22
+ "ChatVertexAI",
23
+ ]
@@ -0,0 +1,30 @@
1
+ from typing import TYPE_CHECKING, Any
2
+
3
+ from langchain._api import create_importer
4
+
5
+ if TYPE_CHECKING:
6
+ from langchain_community.chat_models.volcengine_maas import (
7
+ VolcEngineMaasChat,
8
+ convert_dict_to_message,
9
+ )
10
+
11
+ # Create a way to dynamically look up deprecated imports.
12
+ # Used to consolidate logic for raising deprecation warnings and
13
+ # handling optional imports.
14
+ DEPRECATED_LOOKUP = {
15
+ "convert_dict_to_message": "langchain_community.chat_models.volcengine_maas",
16
+ "VolcEngineMaasChat": "langchain_community.chat_models.volcengine_maas",
17
+ }
18
+
19
+ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
20
+
21
+
22
+ def __getattr__(name: str) -> Any:
23
+ """Look up attributes dynamically."""
24
+ return _import_attribute(name)
25
+
26
+
27
+ __all__ = [
28
+ "VolcEngineMaasChat",
29
+ "convert_dict_to_message",
30
+ ]
randomcode/yandex.py ADDED
@@ -0,0 +1,23 @@
1
+ from typing import TYPE_CHECKING, Any
2
+
3
+ from langchain._api import create_importer
4
+
5
+ if TYPE_CHECKING:
6
+ from langchain_community.chat_models.yandex import ChatYandexGPT
7
+
8
+ # Create a way to dynamically look up deprecated imports.
9
+ # Used to consolidate logic for raising deprecation warnings and
10
+ # handling optional imports.
11
+ DEPRECATED_LOOKUP = {"ChatYandexGPT": "langchain_community.chat_models.yandex"}
12
+
13
+ _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
14
+
15
+
16
+ def __getattr__(name: str) -> Any:
17
+ """Look up attributes dynamically."""
18
+ return _import_attribute(name)
19
+
20
+
21
+ __all__ = [
22
+ "ChatYandexGPT",
23
+ ]
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: randomcode
3
+ Version: 0.1.0
4
+ Summary: A lightweight personal Python utility package for modular experimentation and structured development.
5
+ Home-page: https://github.com/EchoCode/randomcode
6
+ Author: EchoCode
7
+ Author-email: echocodepackage@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE.txt
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: license
26
+ Dynamic: license-file
27
+ Dynamic: requires-python
28
+ Dynamic: summary
29
+
30
+ # randomcode
31
+
32
+ A lightweight personal Python utility package designed to organize modular components for experimentation and structured development.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install randomcode
38
+ ```
39
+
40
+ ## Features
41
+
42
+ - Clean modular architecture
43
+ - Organized file structure
44
+ - Lightweight and dependency-free
45
+ - Compatible with Python 3.8+
46
+
47
+ ## Publish to PyPI
48
+
49
+ 1. Build artifacts:
50
+
51
+ ```bash
52
+ python -m build
53
+ ```
54
+
55
+ 2. Create `%USERPROFILE%\\.pypirc` (not inside this repo):
56
+
57
+ ```ini
58
+ [distutils]
59
+ index-servers =
60
+ pypi
61
+
62
+ [pypi]
63
+ repository = https://upload.pypi.org/legacy/
64
+ username = __token__
65
+ password = ${PYPI_TOKEN}
66
+ ```
67
+
68
+ 3. Set token in your shell and upload:
69
+
70
+ ```powershell
71
+ $env:PYPI_TOKEN = "pypi-<YOUR_NEW_TOKEN>"
72
+ python -m twine upload -r pypi dist/*
73
+ ```
74
+
75
+ 4. Clear the token from the session after upload:
76
+
77
+ ```powershell
78
+ Remove-Item Env:PYPI_TOKEN
79
+ ```
80
+
81
+ ## License
82
+
83
+ MIT
84
+
@@ -0,0 +1,59 @@
1
+ randomcode/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ randomcode/anthropic.py,sha256=hyYjSNH39gkLV8FDHGH8oZWB-bvOfo-aCk9oyjd0k8g,851
3
+ randomcode/anyscale.py,sha256=CrGuU-IWl8ROf6syQJ3EhtnsuDfCmpEEUY3_dCq4T2w,643
4
+ randomcode/azure_openai.py,sha256=aRNol2PNC49PmvdZnwjhQeMFRDOOelPNAXzRv6J6eoI,660
5
+ randomcode/azureml_endpoint.py,sha256=O7JE_ZQuMzZl96xawYEvtT-IZ4panSkv_NogSvNg7pA,863
6
+ randomcode/baichuan.py,sha256=3-GveFoF5ZNyLdRNK6V4i3EDDjdseOTFWbCMhDbtO9w,643
7
+ randomcode/baidu_qianfan_endpoint.py,sha256=Iw79vVh_pRhdyCsqU5s_Bjy_p9r2oIujJhTkPZRPhQM,716
8
+ randomcode/base_language.py,sha256=SN3vhbLbZwevAoddtq3xZeEqbaDWrRVCoNZYLgGmVA4,218
9
+ randomcode/bedrock.py,sha256=JyXm9AUU4OcK7qsvr2ZUO7VbGHJg6Yl9UiLrtdzX0jk,757
10
+ randomcode/cache.py,sha256=fBdvTi71nIZYt7P50AzH65jw82hNBp0cLZYWuXJpq38,2155
11
+ randomcode/cohere.py,sha256=EYOECHX-nKRhZVfCfmFGZ2lr51PzaB5OvOEqmBCu1fI,633
12
+ randomcode/databricks.py,sha256=5_QkC5lG4OldaHC2FS0XylirJouyZx1YT95SKwc12M0,653
13
+ randomcode/env.py,sha256=fucAbfcmwiN1CjKSg5l2lzquRVoE7wqfuMMlaByuyEk,476
14
+ randomcode/ernie.py,sha256=dgN4ML_uLdZTqNb53zGfgx6-0_UrxEsUuLpzrSkwPjo,637
15
+ randomcode/everlyai.py,sha256=ozp9Rr03bmARG6ion-EKx7ccmPGSLf36e3LFNNwgCfo,643
16
+ randomcode/example_generator.py,sha256=q_JvQKn2pgJOHcBeFc851GpaR4seOZXDe9TISAJheEY,142
17
+ randomcode/fake.py,sha256=R27uJ-h8mX0pGDD17VwQJkCtm41GL1fdmvnEh-ptYGU,815
18
+ randomcode/fireworks.py,sha256=VBimPMxZsSkvxiVc8qFk3gm5zJQ3xkcyUSStg5pijEI,648
19
+ randomcode/formatting.py,sha256=4s5AwApo_6t2pVfoFXOgFU9sNNdpVDD44B4ryOwJMJo,168
20
+ randomcode/gigachat.py,sha256=5I19_9xUw-VTw5kdomERLPbQmVLRfvmcGGkhgarGE4g,631
21
+ randomcode/google_palm.py,sha256=w28OSz00ZVX8xP6diG2Py9xnhjh81pgfrfOL8GZZv0A,809
22
+ randomcode/human.py,sha256=dCwqG2zwmvliGWPj2X3WIm6_qKg0Ne7_1ULIRXmQUk8,658
23
+ randomcode/hunyuan.py,sha256=NYwIgLZBFq4B026WeeKz0PgEg0tHz-YowPgsl5pzgF8,638
24
+ randomcode/input.py,sha256=9OczJo7x4KQPqxSxihmP8hDsl7j14xosDrid-6hrjRY,283
25
+ randomcode/javelin_ai_gateway.py,sha256=PFQb39cKIfSio_GELYWOz_bjT-DYCKTN6OpmCJ2YH0E,821
26
+ randomcode/jinachat.py,sha256=C_0kKRLs3i6Hc6RH8Rr_BySTpNahJRaJazDfCKpZjeU,631
27
+ randomcode/konko.py,sha256=0OrSCG3H6IE3fU3swGDGM5HetoCsaHRby3KMnrK6F10,628
28
+ randomcode/litellm.py,sha256=ksSUdn4lnvRN8ePk5C8U3WoDjH2XZpzQYGlcrWgJFRE,791
29
+ randomcode/meta.py,sha256=lhYHypxY2AmieGHJyi4MQouaL6gvuEBwDxKePR8A6kw,702
30
+ randomcode/minimax.py,sha256=ogZyvwn9Bm4EDJw9_64QDk1n3gwDcNLthEQ9r7-4ogk,638
31
+ randomcode/mlflow.py,sha256=h8Pe8gBwkfX9eWRdhUfYWTr551DH_RzQceAEtMCDrxA,633
32
+ randomcode/mlflow_ai_gateway.py,sha256=m5k5_n9Tc6v82KeoKSf6UHgJz3Zok50G7dqdER6-XJc,815
33
+ randomcode/ollama.py,sha256=w6eoHkXJJMAtofV8Vt4SgTMbvdJ9fWpy_yJsTOJWMFk,633
34
+ randomcode/openai.py,sha256=mS7lY-vF1L2cuNP1hVhGETyiqyPsRUsQRddgMEuuo00,633
35
+ randomcode/pai_eas_endpoint.py,sha256=RNa-3d0fe6RbuzFJgdF6NL4IHpzYYw91AHOYQoGB3e8,684
36
+ randomcode/promptlayer_openai.py,sha256=-lAtSynPHVCRRsash_TVDlbG-XtYtoJ0srl_4G9YU7g,697
37
+ randomcode/python.py,sha256=TxVqzUU1IjM8WSmM73FEw5KxpEWhXG4OKq8sAJ9yJnU,555
38
+ randomcode/requests.py,sha256=PezKhBbDty3VXl5vl7K6aKacNFcIvFGy22SgtaW0AYQ,906
39
+ randomcode/s1.py,sha256=yFCvJnUymxoKsmr1mCfrZcmGi0vlluWfERhVFyVk4es,566
40
+ randomcode/s10.py,sha256=JG_WZG3BFCzWy_FmHQeISiBdwSq23PDglFQ1hB_oVrg,1433
41
+ randomcode/s2.py,sha256=pFqzciMQGJpvX6xLfXUkLj1RognEfyrT8ZQ9fJo-r7s,912
42
+ randomcode/s3.py,sha256=makXNBhvxwdcdoLyOd67rQrguXo_GJhbPdC-Qx4_hLs,640
43
+ randomcode/s4.py,sha256=f06iuOG4bxtvdPxOj-LZzVoT68MYX93yX8U5nXMOjdA,483
44
+ randomcode/s5.py,sha256=0biLPSwaa1w4xpV179hB9NKK_VXhDJVjlffE3ZcfHnk,570
45
+ randomcode/s6.py,sha256=veTMEd4wxTHjyiK_P8Km5N58BQfPA8ciqywEKD_mCTo,645
46
+ randomcode/s7.py,sha256=UpDBdVEGfGqx6KJpDAIh3sIx_B2ahnNEdG-iaeEeN3U,817
47
+ randomcode/s8.py,sha256=w2Y0A3cbQxX7RsK1YHUJg4Yi6hkLm2b-mqrcMcXxt6M,839
48
+ randomcode/s9.py,sha256=89IFQcJkx8mvOYeiszmcCWTYWhnWdtua4ULCUydT0gs,1167
49
+ randomcode/serpapi.py,sha256=puHG-Hq7j3GNpG8F3DhqslTs716Nilp0uTDQjfAsR7U,663
50
+ randomcode/sql_database.py,sha256=PbNTfJjIUemMO9ZkLiMIpKF-9GJ7Kto3ShcQrLPoOqk,664
51
+ randomcode/tongyi.py,sha256=axW-CVKM6oHHlMTtoEgfs5D_wD0wJEcU_7Sq2z7I8Xo,633
52
+ randomcode/vertexai.py,sha256=3E5aWHZLZ_Fgheaka_blMRvexaOyu6L60dPh6pFZzXg,643
53
+ randomcode/volcengine_maas.py,sha256=7_8NUxIua9AKo9mqbsZUIEMAbIgr2u7sTdv9VaKZYS8,845
54
+ randomcode/yandex.py,sha256=39Cqo09E6yyU6VD7wrPvmi00dYPOmgAIL1roUF7-5Jo,642
55
+ randomcode-0.1.0.dist-info/licenses/LICENSE.txt,sha256=YaxmTDBfi1WGhWZGY_6-yZCwg3N9z0nhOUX3BMW9xxs,1061
56
+ randomcode-0.1.0.dist-info/METADATA,sha256=uFfjEJBSuCzOxFomGVF9Tf_GGuWZrc2zdLYZBPVdXvU,1889
57
+ randomcode-0.1.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
58
+ randomcode-0.1.0.dist-info/top_level.txt,sha256=4ouoG9l5UqkPcRLpCep3FdEWYwlxU578LdH7B_TlnmU,11
59
+ randomcode-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,7 @@
1
+ Copyright 2024 EchoCode
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ randomcode