Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
General
-------
- use speaking identifiers as much as possible for self documentation of code
SQL
---
- use COUNT(*) rather than COUNT(1) or COUNT(some_column) unless you know why
Python
------
classes:
normal classes:
cCamelCase
singleton classes:
gmCamelCase
methods, functions:
- prefer keyword arguments
- lower case
- snake_style
def what_this_function_returns(...):
assert
def what_this_method_returns(self, ...):
assert
constants:
UPPER_CASE_NAME_SNAKE_STYLE
Python module file layout:
-------------------------------------------------------------
# -*- coding: utf-8 -*-
"""line 1
line 2
line 3
"""
#============================================================
# SPDX-License-Identifier: GPL-2.0-or-later
__author__ = "..."
__license__ = "..."
# standard library imports
import sys
# 3rd party library imports
import ...
if __name__ == '__main__':
sys.path.insert(0, '../../')
# GNUmed module imports
from Gnumed.pycommon import ...
# CONSTANTS
A_FIXED_VALUE = 'abc'
# globals
_log = logging.getLogger('gm.ABCD')
#============================================================
... code ...
#============================================================
# main
#------------------------------------------------------------
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.exit()
if sys.argv[1] != 'test':
sys.exit()
#--------------------------------------------------------
def test1():
...
#--------------------------------------------------------
def test2():
...
#--------------------------------------------------------
...
#--------------------------------------------------------
#test1()
test2()
...
#=== snip =========================================================================
LaTeX:
use {} after commands to prevent run-in with surrounding text
#=== snip =========================================================================
SQL
IN / OUT: _variable_name
DECLARE: __variable_name
primary key: .pk
foreign key in table: .fk_remote_column_name
foreign key in view: .pk_remote_column_name
table name: schema.table_name (singular, such that schema.table_name.column_name makes sense)
view name: schema.v_table_name+s_or_purpose
add identifying "-- this is a comment" comments to SQL being sent to the server
plpgsql
USING HINT
USING ERRCODE
USING MESSAGE