MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / path_shift

Method path_shift

21-async/mojifinder/bottle.py:1295–1303  ·  view source on GitHub ↗

Shift path segments from :attr:`path` to :attr:`script_name` and vice versa. :param shift: The number of path segments to shift. May be negative to change the shift direction. (default: 1)

(self, shift=1)

Source from the content-addressed store, hash-verified

1293 return '/' + script_name + '/' if script_name else '/'
1294
1295 def path_shift(self, shift=1):
1296 ''' Shift path segments from :attr:`path` to :attr:`script_name` and
1297 vice versa.
1298
1299 :param shift: The number of path segments to shift. May be negative
1300 to change the shift direction. (default: 1)
1301 '''
1302 script = self.environ.get('SCRIPT_NAME','/')
1303 self['SCRIPT_NAME'], self['PATH_INFO'] = path_shift(script, self.path, shift)
1304
1305 @property
1306 def content_length(self):

Callers 1

mountpoint_wrapperMethod · 0.80

Calls 2

path_shiftFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected