potassco / potassco/constraint-handler

Conventions for python names

Open
#58 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3
Forks
0
Avg merge
1d 19h
Merged PRs (30d)
20

Description

By default, we should strive to follow PEP8 :

  • Class names should normally use the CapWords convention
  • Function and method names should be lowercase, with words separated by underscores
  • Variable names follow the same convention as function names

The above conventions do not apply to functions and classes that interface with ASP:

  • functions that are called from asp
    • start with python
    • use mixed case
    • are located in a #script (python) section of some .lp file
  • asp predicates or function symbol of arity zero
    • are typically member of an enumeration class
    • are uncapitalized
    • use the same name as the corresponding asp name
    • use that name for the enumeration member whenever possible
  • classes that correspond to asp predicates or function symbol of non-zero arity
    • typically derive from NamedTuple
    • start with an uppercase letter
    • using the same name as the corresponding asp name (the capitalization of the first letter notwithstanding)

Examples:

  • evaluate_expr is function that is not interfacing with asp
  • pythonEvalExpr is an interface function
  • the python class Set_value derives from NamedTuple and has 3 attributes. It corresponds to the asp set_value/3 predicate;
  • the enumeration member SetOperator.fold corresponds to the asp fold predcate. Its name is "fold"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. First inspect the repository's Python sources and determine whether the conventions are intended to be documented or applied across existing code. The issue does not define a verifiable done state.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.