sud-cli 0.1.1__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 (74) hide show
  1. sud_cli/__init__.py +3 -0
  2. sud_cli/__main__.py +4 -0
  3. sud_cli/_wm.py +118 -0
  4. sud_cli/agenda.py +90 -0
  5. sud_cli/autofill.py +192 -0
  6. sud_cli/autofill_markers.json +56 -0
  7. sud_cli/backup.py +256 -0
  8. sud_cli/calendar_ics.py +191 -0
  9. sud_cli/case_diff.py +165 -0
  10. sud_cli/case_search_bridge.py +1322 -0
  11. sud_cli/chain.py +226 -0
  12. sud_cli/cli.py +3721 -0
  13. sud_cli/completeness.py +105 -0
  14. sud_cli/config.py +20 -0
  15. sud_cli/conflict.py +210 -0
  16. sud_cli/conflicts.py +207 -0
  17. sud_cli/court_alerts.py +156 -0
  18. sud_cli/court_source.py +108 -0
  19. sud_cli/data/completeness_rules.json +18 -0
  20. sud_cli/data/key_rates.json +59 -0
  21. sud_cli/data/npa_historical_editions.json +19 -0
  22. sud_cli/db.py +2072 -0
  23. sud_cli/deadline_matrix.py +99 -0
  24. sud_cli/deadline_state.py +25 -0
  25. sud_cli/deadlines.py +8 -0
  26. sud_cli/deadlines_state.py +1 -0
  27. sud_cli/deferral.py +5 -0
  28. sud_cli/efrsb_manual.py +85 -0
  29. sud_cli/efrsb_public.py +210 -0
  30. sud_cli/egrul_nalog.py +150 -0
  31. sud_cli/explain.py +190 -0
  32. sud_cli/fees_extra.py +104 -0
  33. sud_cli/forms.py +204 -0
  34. sud_cli/fssp_manual.py +91 -0
  35. sud_cli/fssp_semi.py +285 -0
  36. sud_cli/fssp_stats.py +105 -0
  37. sud_cli/government_transfers.json +8 -0
  38. sud_cli/holidays_rf.json +62 -0
  39. sud_cli/idempotency.py +78 -0
  40. sud_cli/importing.py +575 -0
  41. sud_cli/interest.py +144 -0
  42. sud_cli/jurisdiction.py +177 -0
  43. sud_cli/jurisdiction_rules.json +265 -0
  44. sud_cli/legal_deadlines.py +278 -0
  45. sud_cli/legal_engine.py +558 -0
  46. sud_cli/legal_rules.json +1058 -0
  47. sud_cli/limitation.py +70 -0
  48. sud_cli/mcp_server.py +1594 -0
  49. sud_cli/metrics.py +142 -0
  50. sud_cli/npa_as_of.py +21 -0
  51. sud_cli/output.py +89 -0
  52. sud_cli/payment.py +24 -0
  53. sud_cli/pdn.py +259 -0
  54. sud_cli/plenum_corpus.py +134 -0
  55. sud_cli/plenums_seed.json +45 -0
  56. sud_cli/practice_status.py +136 -0
  57. sud_cli/pravo_publication.py +361 -0
  58. sud_cli/pretrial.py +151 -0
  59. sud_cli/production_calendar.py +233 -0
  60. sud_cli/providers.py +95 -0
  61. sud_cli/readiness.py +234 -0
  62. sud_cli/regional_holidays.py +37 -0
  63. sud_cli/reminders.py +92 -0
  64. sud_cli/reports.py +349 -0
  65. sud_cli/sud_netguard.py +943 -0
  66. sud_cli/timeline_audit.py +80 -0
  67. sud_cli/verify.py +201 -0
  68. sud_cli-0.1.1.dist-info/METADATA +119 -0
  69. sud_cli-0.1.1.dist-info/RECORD +74 -0
  70. sud_cli-0.1.1.dist-info/WHEEL +4 -0
  71. sud_cli-0.1.1.dist-info/entry_points.txt +2 -0
  72. sud_cli-0.1.1.dist-info/licenses/AUTHORS +5 -0
  73. sud_cli-0.1.1.dist-info/licenses/LICENSE.md +661 -0
  74. sud_cli-0.1.1.dist-info/licenses/NOTICE +7 -0
sud_cli/limitation.py ADDED
@@ -0,0 +1,70 @@
1
+ """Calculation of civil limitation periods (ст. 196, 200, 202 ГК РФ)."""
2
+
3
+ from calendar import monthrange
4
+ from dataclasses import dataclass, field
5
+ from datetime import date, timedelta
6
+
7
+ from .production_calendar import is_working_day
8
+
9
+
10
+ PERIODS = {
11
+ "general": (3, 0, "ст. 196, 200 ГК РФ"),
12
+ "contract_work": (1, 0, "ст. 725 ГК РФ"),
13
+ "carriage": (1, 0, "ст. 797 ГК РФ"),
14
+ "voidable_deal": (1, 0, "ст. 181 ГК РФ"),
15
+ }
16
+
17
+
18
+ @dataclass
19
+ class LimitationResult:
20
+ status: str
21
+ is_expired: bool = False
22
+ expiry_date: str | None = None
23
+ days_left: int = 0
24
+ days_overdue: int = 0
25
+ legal_basis: list[str] = field(default_factory=list)
26
+ trace: list[dict] = field(default_factory=list)
27
+ detail: str = ""
28
+
29
+ def to_dict(self):
30
+ return self.__dict__.copy()
31
+
32
+
33
+ def _add_months(day: date, months: int) -> date:
34
+ total = day.year * 12 + day.month - 1 + months
35
+ year, month = divmod(total, 12)
36
+ month += 1
37
+ return date(year, month, min(day.day, monthrange(year, month)[1]))
38
+
39
+
40
+ def calculate_limitation(*, start: date, period_type: str = "general",
41
+ claim_notice_days: int = 0, check_date: date | None = None,
42
+ custom_years: int = 0, custom_months: int = 0) -> LimitationResult:
43
+ if check_date is None:
44
+ check_date = date.today()
45
+ if period_type in PERIODS:
46
+ years, months, basis = PERIODS[period_type]
47
+ elif period_type == "custom_years" and custom_years > 0:
48
+ years, months, basis = custom_years, 0, "ст. 196 ГК РФ (индивидуальный срок)"
49
+ elif period_type == "custom_months" and custom_months > 0:
50
+ years, months, basis = 0, custom_months, "ст. 192 ГК РФ (индивидуальный срок)"
51
+ else:
52
+ return LimitationResult("error", detail="unknown period type or non-positive custom duration")
53
+
54
+ expiry = _add_months(start, years * 12 + months)
55
+ trace = [{"step": f"начало срока: {start.isoformat()} (ст. 200 ГК РФ)"}]
56
+ if years or months:
57
+ trace.append({"step": f"добавлен срок: {years} лет, {months} мес."})
58
+ if claim_notice_days:
59
+ expiry += timedelta(days=claim_notice_days)
60
+ basis += "; п. 3 ст. 202 ГК РФ"
61
+ trace.append({"step": f"досудебный порядок: +{claim_notice_days} календарных дней"})
62
+ while not is_working_day(expiry):
63
+ expiry += timedelta(days=1)
64
+ trace.append({"step": f"дата окончания после переноса: {expiry.isoformat()} (ст. 193 ГК РФ)"})
65
+ expired = check_date > expiry
66
+ delta = (check_date - expiry).days
67
+ return LimitationResult(
68
+ "ok", expired, expiry.isoformat(), max(0, -delta), max(0, delta),
69
+ [basis, "ст. 191 ГК РФ", "ст. 193 ГК РФ"], trace,
70
+ )