sa-code
sa-code
MModular
Created by sa-code on 6/21/2024 in #community-showcase
arrow.mojo
https://github.com/mojo-data/arrow.mojo/ A WIP implementation of the Apache Arrow spec
4 replies
MModular
Created by sa-code on 6/11/2024 in #questions
Importing package in test
Hey - not sure if I'm doing something wrong with my env setup but my tests in my test/ folder can't seem to import from package_name/. My folder structure is
repo/
package_name/
test/
repo/
package_name/
test/
And in my test files I write
from package_name import stuff
from package_name import stuff
LSP always redlines package_name and says unable to locate module. However everything works just fine from the command line when I run mojo test -I . How have you solved this? Link to my repo if you'd like to try it out: https://github.com/mojo-data/arrow.mojo
3 replies
MModular
Created by sa-code on 9/18/2023 in #questions
Calling mktime from mojo
I'm trying to call C's mktime from mojo but I seem to get a negative number. Here's the code, is the external call correct? mktime returns a time_t which should be a positive int, but I see a negative value. https://github.com/sa-/mo-time/blob/02cf8d1ccdd92ab1ca0863f1538d342d48b18f59/mo_time/date_time.mojo#L73
16 replies
MModular
Created by sa-code on 9/18/2023 in #questions
Branchless way to convert bool to int?
Right now I do something like
# assuming b is a bool
let x = 1 if b else 0
# assuming b is a bool
let x = 1 if b else 0
Is there a way to do this in a branchless way? b.to_int() doesn't exist
9 replies
MModular
Created by sa-code on 9/9/2023 in #questions
Is there a way to create lists of Strings yet?
No description
23 replies
MModular
Created by sa-code on 9/9/2023 in #questions
Is there an equivalent of PYTHONPATH? I would like to separate my test directory
I would like to setup my folder structure like this:
.
├── LICENSE
├── src
│ └── arrow.mojo
└── test
└── test.mojo

2 directories, 3 files
.
├── LICENSE
├── src
│ └── arrow.mojo
└── test
└── test.mojo

2 directories, 3 files
However I can't seem to import arrow from test.mojo unless they are in the same directory. The error is cannot import relative to a top-level package
8 replies