| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
MojoINI is a simple, lightweight INI file parser written in Mojo. It allows you to read and process INI configuration files with support for sections and key-value pairs.
Following are the results of running a test involving MojoINI and python's configparser parsing the file 'monster.ini' with 5000 sections and 20keys per section (100,000 keys)
src/mojoini/ # Main package
__init__.mojo # INIParser and main logic
lines.mojo # INI parsing helpers
SDict.mojo # Simple dictionary wrapper
test/ # Test suite
test_parser.mojo # Basic tests for the parser
samples/ # Sample INI files for testing
sample1.ini
sample2.ini
Simple INI (sample1.ini):
name="John Doe"
msg="Hello World!"INI with Section (sample2.ini):
special_number=0
[section1]
field1="some key"
field2="a serious value!"from mojoini import INIParser
var parser = INIParser()
var parsed = parser.read_file("./samples/sample1.ini")
print(parsed.getItem('name')['value']) # Output: John Doe
print(parsed.getItem('msg')['value']) # Output: Hello World!var parser = INIParser()
var parsed = parser.read_file("./samples/sample2.ini")
var section1 = parsed.getItem('section1')
print(section1['field1']) # Output: some key
print(section1['field2']) # Output: a serious value!To run the test suite:
(MojoINI/src) ~ mojo test MIT License
| Back | FazBrowse Home | New Git URL |