Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The heuristics used by the analyzer are based on detecting (unit-test) library imports, and file and path naming conventions as summarized in the table below: 

Type

Value

HeaderLines

MinimumCount

FilePath**/test_*.py

FilePath**/*_test.py

FilePath**/*_test_*.py

FilePath**/test/*.py

FilePath**/tests/*.py

FileContentimport unittest12
FileContentfrom unittest import12
FileContentfrom nose.tools import12
FileContentself.assert
2
FilePath**/site-packages/**

FilePath**/dist-packages/**

FilePath**/Python*/Lib/**

FilePath**/Python*/Scripts/**

FilePath**/Python*/Include/**

FilePath**/Python*/Bin/**


Info
  • The ** symbol represents any arbitrary path string, whereas * represents any string without directory slashes.
  • The heuristics above should also similarly valid for .jy (jython) files.
  • FilePath match is case-insensitive

What results can you expect?

...

The following structural rules are provided:

...

falcon

NOTE: Support for Falcon is expected to be released in 1.4.0-beta6beta7.

Falcon route annotations for web service operations (GET, PUT, POST, DELETE) are supported. 

In the following example, a default GET operation is ascribed to the functionon_get from GetResourceclass,and the POST and PUT operations to the on_putandon_postfunctions fromPut_PostResourcewith two differents urls routing:

The link between the GET operation named after the routing URL "/"  and the called functionon_get is represented by an arrow pointing to the function:

The name of a saved Web Service Operation object will be generated from the routing URL by adding a final slash when not present. In this example the name of the POST operations is "/url/example/1/" and  "/url/example/2/" after the routing url "/url/example/1" and "/url/example/2".

Sinks are supported with the following rules : If no route matches a request, but the path in the requested URI matches a sink prefix, Falcon will pass control to the associated sink, regardless of the HTTP method requested. If the prefix overlaps a registered route template, the route will take precedence and mask the sink.

In this case Web Service Operation objects generated as sinks will be named as/that/, and not as/this/since another Web Service Operation object exists with an overlapping url.

Code Block
languagepy
importfalcon
 
app=falcon.App()
 
class GetResource():
def on_get():
print('on_get function')
 
def sink_method(resp,**kwargs):
resp.body="Sink"
pass
 
app.add_route('this/is/the/way', GetResource())
app.add_sink(sink_method, prefix='/that') # get, post, put & delete routes will be created and linked to sink_method
app.add_sink(sink_method, prefix='/this') # no routes created because Url overlaps another route

The optional suffix keyword argument of Falcon add_route is supported. In this way, multiple closely-related routes can be mapped to the same resource.

...