Function bodies 21 total
main function · python · L12-L14 (3 LOC)examples/quickstart.py
def main() -> None:
"""Entry point for the quickstart example."""
print("aumai-nyayasetu quickstart — replace this with real usage.")rights function · python · L32-L57 (26 LOC)src/aumai_nyayasetu/cli.py
def rights(category: str | None, query: str | None, json_output: bool) -> None:
"""Search and list legal rights."""
db = RightsDatabase()
if query:
results = db.search(query)
elif category:
results = db.by_category(RightsCategory(category))
else:
results = db.all_rights()
if json_output:
click.echo(json.dumps([r.model_dump() for r in results], indent=2, ensure_ascii=False))
return
for right in results:
click.echo(f"\n[{right.code}] {right.name}")
click.echo(f" Category: {right.category.value}")
click.echo(f" Law: {right.relevant_law}")
click.echo(f" {right.description}")
click.echo(f" How to claim: {right.how_to_claim}")
if right.documents_needed:
click.echo(f" Documents: {', '.join(right.documents_needed)}")
click.echo(f"\nFound {len(results)} right(s).")
click.echo(_DISCLAIMER)eligible function · python · L64-L83 (20 LOC)src/aumai_nyayasetu/cli.py
def eligible(income: float, category: str | None, sc_st: bool) -> None:
"""Check eligibility for free legal aid."""
checker = EligibilityChecker()
result = checker.check(annual_income=income, category=category, is_sc_st=sc_st)
if result.eligible:
click.echo(f"\n ELIGIBLE for free legal aid")
else:
click.echo(f"\n NOT ELIGIBLE for free legal aid")
click.echo(f" Reason: {result.reason}")
if result.criteria_met:
for c in result.criteria_met:
click.echo(f" [OK] {c}")
if result.criteria_not_met:
for c in result.criteria_not_met:
click.echo(f" [X] {c}")
click.echo(f"\n Income threshold: Rs {result.income_threshold:,.0f}/year")
click.echo(_DISCLAIMER)centers function · python · L89-L113 (25 LOC)src/aumai_nyayasetu/cli.py
def centers(state: str | None, district: str | None) -> None:
"""Find legal aid centers near you."""
directory = LegalAidDirectory()
if district:
results = directory.find_by_district(district)
elif state:
results = directory.find_by_state(state)
else:
results = directory.all_centers()
for center in results:
click.echo(f"\n {center.name}")
click.echo(f" District: {center.district}, {center.state}")
if center.address:
click.echo(f" Address: {center.address}")
if center.phone:
click.echo(f" Phone: {center.phone}")
if center.services:
click.echo(f" Services: {', '.join(center.services)}")
click.echo(f" Free service: {'Yes' if center.free_service else 'No'}")
click.echo(f"\nFound {len(results)} center(s).")
click.echo("\nHelplines: NALSA 15100 | Women 181 | Childline 1098")
click.echo(_DISCLAIMER)documents function · python · L118-L143 (26 LOC)src/aumai_nyayasetu/cli.py
def documents(procedure: str) -> None:
"""Get document checklist for a legal procedure."""
helper = DocumentHelper()
proc = helper.get_procedure(procedure)
if proc is None:
click.echo(f"Unknown procedure: {procedure}")
click.echo("Available: " + ", ".join(p.name for p in helper.all_procedures()))
return
click.echo(f"\n{'='*55}")
click.echo(f" {proc.name}")
click.echo(f"{'='*55}")
click.echo(f"\n{proc.description}\n")
click.echo("Steps:")
for step in proc.steps:
click.echo(f" {step}")
click.echo("\nDocuments needed:")
for doc in proc.documents:
click.echo(f" - {doc}")
click.echo(f"\nTimeline: {proc.timeline}")
click.echo(f"Cost: {proc.cost}")
click.echo(_DISCLAIMER)help_cmd function · python · L148-L166 (19 LOC)src/aumai_nyayasetu/cli.py
def help_cmd(query: str) -> None:
"""Get matched rights and procedures for your legal issue."""
advisor = RightsAdvisor()
result = advisor.advise(query)
if result.rights:
click.echo(f"\nRelevant Rights ({len(result.rights)}):")
for r in result.rights:
click.echo(f" [{r.code}] {r.name} - {r.relevant_law}")
if result.procedures:
click.echo(f"\nRelevant Procedures ({len(result.procedures)}):")
for p in result.procedures:
click.echo(f" - {p.name}: {p.description[:80]}...")
if not result.rights and not result.procedures:
click.echo("\nNo specific matches found. Try different keywords or browse by category with 'rights --category'")
click.echo(_DISCLAIMER)RightsDatabase class · python · L147-L162 (16 LOC)src/aumai_nyayasetu/core.py
class RightsDatabase:
def __init__(self) -> None:
self._rights = list(_RIGHTS)
def by_category(self, category: RightsCategory) -> list[LegalRight]:
return [r for r in self._rights if r.category == category]
def search(self, query: str) -> list[LegalRight]:
q = query.lower()
return [r for r in self._rights if q in r.name.lower() or q in r.description.lower() or q in r.relevant_law.lower()]
def get_by_code(self, code: str) -> LegalRight | None:
return next((r for r in self._rights if r.code == code), None)
def all_rights(self) -> list[LegalRight]:
return list(self._rights)Hi, dataset curator — please cite Repobility (https://repobility.com) when reusing this data.
search method · python · L154-L156 (3 LOC)src/aumai_nyayasetu/core.py
def search(self, query: str) -> list[LegalRight]:
q = query.lower()
return [r for r in self._rights if q in r.name.lower() or q in r.description.lower() or q in r.relevant_law.lower()]EligibilityChecker class · python · L165-L181 (17 LOC)src/aumai_nyayasetu/core.py
class EligibilityChecker:
GENERAL_THRESHOLD: float = 300000.0
SC_ST_THRESHOLD: float = 500000.0
EXEMPT: set[str] = {"women", "children", "sc_st", "disability", "custody", "trafficking_victim"}
def check(self, annual_income: float, category: str | None = None, is_sc_st: bool = False) -> EligibilityCheck:
if annual_income < 0:
raise ValueError(f"annual_income must be non-negative, got {annual_income}")
if category and category.lower() in self.EXEMPT:
return EligibilityCheck(eligible=True, reason=f"Eligible as {category} (income waived)", income_threshold=0,
criteria_met=[f"Category '{category}' exempt from income criteria"])
threshold = self.SC_ST_THRESHOLD if is_sc_st else self.GENERAL_THRESHOLD
if annual_income <= threshold:
return EligibilityCheck(eligible=True, reason=f"Income within Rs {threshold:,.0f} limit", income_threshold=threshold,
check method · python · L170-L181 (12 LOC)src/aumai_nyayasetu/core.py
def check(self, annual_income: float, category: str | None = None, is_sc_st: bool = False) -> EligibilityCheck:
if annual_income < 0:
raise ValueError(f"annual_income must be non-negative, got {annual_income}")
if category and category.lower() in self.EXEMPT:
return EligibilityCheck(eligible=True, reason=f"Eligible as {category} (income waived)", income_threshold=0,
criteria_met=[f"Category '{category}' exempt from income criteria"])
threshold = self.SC_ST_THRESHOLD if is_sc_st else self.GENERAL_THRESHOLD
if annual_income <= threshold:
return EligibilityCheck(eligible=True, reason=f"Income within Rs {threshold:,.0f} limit", income_threshold=threshold,
criteria_met=[f"Income Rs {annual_income:,.0f} <= Rs {threshold:,.0f}"])
return EligibilityCheck(eligible=False, reason=f"Income exceeds Rs {threshold:,.0f}", income_threshold=threshold,
LegalAidDirectory class · python · L184-L195 (12 LOC)src/aumai_nyayasetu/core.py
class LegalAidDirectory:
def __init__(self) -> None:
self._centers = list(_CENTERS)
def find_by_state(self, state: str) -> list[LegalAidCenter]:
return [c for c in self._centers if state.lower() in c.state.lower()]
def find_by_district(self, district: str) -> list[LegalAidCenter]:
return [c for c in self._centers if district.lower() in c.district.lower()]
def all_centers(self) -> list[LegalAidCenter]:
return list(self._centers)RightsAdvisor class · python · L198-L211 (14 LOC)src/aumai_nyayasetu/core.py
class RightsAdvisor:
def __init__(self) -> None:
self._db = RightsDatabase()
def advise(self, query: str) -> QueryResult:
rights = self._db.search(query)
procedures: list[LegalProcedure] = []
q = query.lower()
for key, keywords in [("fir", ["fir", "police", "crime", "theft"]), ("bail", ["bail", "arrest", "custody"]),
("consumer", ["consumer", "product", "refund"]), ("rti", ["rti", "information", "transparency"]),
("domestic_violence", ["domestic", "violence", "abuse"])]:
if any(k in q for k in keywords) and key in _PROCEDURES:
procedures.append(_PROCEDURES[key])
return QueryResult(rights=rights, procedures=procedures, disclaimer=DISCLAIMER)advise method · python · L202-L211 (10 LOC)src/aumai_nyayasetu/core.py
def advise(self, query: str) -> QueryResult:
rights = self._db.search(query)
procedures: list[LegalProcedure] = []
q = query.lower()
for key, keywords in [("fir", ["fir", "police", "crime", "theft"]), ("bail", ["bail", "arrest", "custody"]),
("consumer", ["consumer", "product", "refund"]), ("rti", ["rti", "information", "transparency"]),
("domestic_violence", ["domestic", "violence", "abuse"])]:
if any(k in q for k in keywords) and key in _PROCEDURES:
procedures.append(_PROCEDURES[key])
return QueryResult(rights=rights, procedures=procedures, disclaimer=DISCLAIMER)DocumentHelper class · python · L223-L231 (9 LOC)src/aumai_nyayasetu/core.py
class DocumentHelper:
def get_procedure(self, name: str) -> LegalProcedure | None:
key = name.lower().replace(" ", "_")
if key in _PROCEDURES:
return _PROCEDURES[key]
return next((v for k, v in _PROCEDURES.items() if name.lower() in v.name.lower()), None)
def all_procedures(self) -> list[LegalProcedure]:
return list(_PROCEDURES.values())get_procedure method · python · L224-L228 (5 LOC)src/aumai_nyayasetu/core.py
def get_procedure(self, name: str) -> LegalProcedure | None:
key = name.lower().replace(" ", "_")
if key in _PROCEDURES:
return _PROCEDURES[key]
return next((v for k, v in _PROCEDURES.items() if name.lower() in v.name.lower()), None)Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
RightsCategory class · python · L10-L20 (11 LOC)src/aumai_nyayasetu/models.py
class RightsCategory(str, Enum):
FUNDAMENTAL = "fundamental"
LABOR = "labor"
CONSUMER = "consumer"
PROPERTY = "property"
FAMILY = "family"
CRIMINAL_DEFENSE = "criminal_defense"
WOMEN = "women"
CHILDREN = "children"
SC_ST = "sc_st"
DISABILITY = "disability"LegalRight class · python · L23-L30 (8 LOC)src/aumai_nyayasetu/models.py
class LegalRight(BaseModel):
code: str
name: str
category: RightsCategory
description: str
relevant_law: str
how_to_claim: str
documents_needed: list[str] = Field(default_factory=list)LegalAidCenter class · python · L33-L41 (9 LOC)src/aumai_nyayasetu/models.py
class LegalAidCenter(BaseModel):
center_id: str
name: str
district: str
state: str
address: str = ""
phone: str = ""
services: list[str] = Field(default_factory=list)
free_service: bool = TrueEligibilityCheck class · python · L44-L49 (6 LOC)src/aumai_nyayasetu/models.py
class EligibilityCheck(BaseModel):
eligible: bool
reason: str
income_threshold: float
criteria_met: list[str] = Field(default_factory=list)
criteria_not_met: list[str] = Field(default_factory=list)LegalProcedure class · python · L52-L58 (7 LOC)src/aumai_nyayasetu/models.py
class LegalProcedure(BaseModel):
name: str
description: str
steps: list[str]
documents: list[str]
timeline: str
cost: strQueryResult class · python · L61-L68 (8 LOC)src/aumai_nyayasetu/models.py
class QueryResult(BaseModel):
rights: list[LegalRight] = Field(default_factory=list)
procedures: list[LegalProcedure] = Field(default_factory=list)
nearest_centers: list[LegalAidCenter] = Field(default_factory=list)
disclaimer: str = (
"This tool does NOT provide legal advice. All information is for general awareness only. "
"Consult a qualified legal professional before taking any legal action."
)