Commit 3f33909
authored
Major Refactor to Codebase Directory (#615)
**Existing Implementation:**
- Mirrors how `codebase.files` operates
- `dir.files` returns a recursive list of all source files
- `dir.subdirectories` returns a recursive list of all directories
- A reference between the file and directory is built during parse time
(files hold a reference to dir, and dirs hold references to files)
**New Implementation:**
- Mirrors more closely to the conceptual idea of a directory
- `dir.files` returns all top level source files
- `dir.files` now has a `extensions` argument just like codebase
- `dir.subdirectories` returns all top level directories
- Both `dir.files` and `dir.subdirectories` have a `recursive=True` flag
to get everything (similar to old behaviour)
- Introduces a `dir.tree` api to recursively list everything
- `dir.items` is now a list
- Directories and files are grabbed on the fly instead of being linked
during parse time (file grabs directories using ctx.get_directory on the
fly and vice versa)1 parent 3bb79bf commit 3f33909
File tree
10 files changed
+410
-484
lines changed- src/codegen
- extensions/tools
- git/repo_operator
- sdk
- codebase
- core
- typescript
- tests/unit/codegen/sdk
- core
- python/directory
10 files changed
+410
-484
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
574 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
575 | 579 | | |
576 | 580 | | |
577 | 581 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
375 | 357 | | |
376 | 358 | | |
377 | 359 | | |
| |||
399 | 381 | | |
400 | 382 | | |
401 | 383 | | |
402 | | - | |
| 384 | + | |
403 | 385 | | |
404 | 386 | | |
405 | 387 | | |
406 | 388 | | |
407 | 389 | | |
408 | 390 | | |
409 | | - | |
| 391 | + | |
410 | 392 | | |
411 | | - | |
| 393 | + | |
412 | 394 | | |
413 | 395 | | |
414 | 396 | | |
| |||
514 | 496 | | |
515 | 497 | | |
516 | 498 | | |
517 | | - | |
| 499 | + | |
518 | 500 | | |
519 | 501 | | |
520 | 502 | | |
| |||
613 | 595 | | |
614 | 596 | | |
615 | 597 | | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
623 | 612 | | |
624 | 613 | | |
625 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | 525 | | |
534 | 526 | | |
535 | 527 | | |
536 | 528 | | |
| 529 | + | |
537 | 530 | | |
538 | | - | |
539 | | - | |
540 | 531 | | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
556 | 543 | | |
557 | 544 | | |
558 | 545 | | |
| |||
0 commit comments