python: fix help-lint warnings.

db4
John Benediktsson 2014-03-04 11:06:55 -08:00
parent 04a4e0ed5c
commit abf610b2e4
3 changed files with 11 additions and 6 deletions

View File

@ -1,27 +1,32 @@
USING: math help.markup help.syntax ;
IN: python.errors IN: python.errors
USING: python.errors help.markup help.syntax ;
HELP: check-zero HELP: check-zero
{ $values { "code" integer } }
{ $description { $description
"Verifies that the return code is 0 and throws an error otherwise." "Verifies that the return code is 0 and throws an error otherwise."
} ; } ;
HELP: (check-ref) HELP: (check-ref)
{ $values { "ref" "a python object" } }
{ $description { $description
"Verifies that the reference is not f and throws an error if it is." "Verifies that the reference is not f and throws an error if it is."
} ; } ;
HELP: check-new-ref HELP: check-new-ref
{ $values { "ref" "a python object" } }
{ $description { $description
"Adds reference counting to the returned python object which is assumed to be a new reference. An error is thrown if the object is f. This word is used to wrap Python functions that return new references." "Adds reference counting to the returned python object which is assumed to be a new reference. An error is thrown if the object is f. This word is used to wrap Python functions that return new references."
} ; } ;
HELP: check-borrowed-ref HELP: check-borrowed-ref
{ $values { "ref" "a python object" } }
{ $description { $description
"Adds reference counting to the returned python object which is assumed to be a borrowed reference. An error is thrown if the object is f. This word is used to wrap Python functions that return borrowed references." "Adds reference counting to the returned python object which is assumed to be a borrowed reference. An error is thrown if the object is f. This word is used to wrap Python functions that return borrowed references."
} ; } ;
HELP: unsteal-ref HELP: unsteal-ref
{ $values { "ref" "a python object" } }
{ $description { $description
"Increases the objects reference count. Used by wrappers that call Python functions that steal references." "Increases the objects reference count. Used by wrappers that call Python functions that steal references."
} ; } ;

View File

@ -14,17 +14,17 @@ ERROR: python-error type message ;
PRIVATE> PRIVATE>
: (check-ref) ( ref -- ref' ) : (check-ref) ( ref -- ref )
[ get-error throw-error f ] unless* ; [ get-error throw-error f ] unless* ;
: check-new-ref ( ref -- ref' ) : check-new-ref ( ref -- ref )
&Py_DecRef (check-ref) ; &Py_DecRef (check-ref) ;
: check-borrowed-ref ( ref -- ref' ) : check-borrowed-ref ( ref -- ref )
dup Py_IncRef &Py_DecRef (check-ref) ; dup Py_IncRef &Py_DecRef (check-ref) ;
: check-zero ( code -- ) : check-zero ( code -- )
0 = [ get-error throw-error ] unless ; 0 = [ get-error throw-error ] unless ;
: unsteal-ref ( ref -- ref' ) : unsteal-ref ( ref -- ref )
dup Py_IncRef ; dup Py_IncRef ;

View File

@ -12,7 +12,7 @@ HELP: >py
{ $description "Converts a factor objects to its most fitting python representation." } { $description "Converts a factor objects to its most fitting python representation." }
{ $examples { $examples
{ $example { $example
"USING: python ;" "USING: arrays prettyprint python sequences ;"
"10 iota >array >py py> ." "10 iota >array >py py> ."
"{ 0 1 2 3 4 5 6 7 8 9 }" "{ 0 1 2 3 4 5 6 7 8 9 }"
} }