MCPcopy Create free account
hub / github.com/python-hyper/uritemplate / expansion_separator

Method expansion_separator

uritemplate/variable.py:87–137  ·  view source on GitHub ↗

Identify the separator used during expansion. Per `Section 3.2.1. Variable Expansion`_: ====== =========== ========= Type Separator ====== =========== ========= ``","`` (default) ``+`` ``","`` ``#`` ``","``

(self)

Source from the content-addressed store, hash-verified

85 return ""
86
87 def expansion_separator(self) -> str:
88 """Identify the separator used during expansion.
89
90 Per `Section 3.2.1. Variable Expansion`_:
91
92 ====== =========== =========
93 Type Separator
94 ====== =========== =========
95 ``","`` (default)
96 ``+`` ``","``
97 ``#`` ``","``
98 ``.`` ``"."``
99 ``/`` ``"/"``
100 ``;`` ``";"``
101 ``?`` ``"&"``
102 ``&`` ``"&"``
103 ====== =========== =========
104
105 .. _`Section 3.2.1. Variable Expansion`:
106 https://www.rfc-editor.org/rfc/rfc6570#section-3.2.1
107 """
108 if self == Operator.label_with_dot_prefix:
109 return "."
110 if self == Operator.path_segment:
111 return "/"
112 if self == Operator.path_style_parameter:
113 return ";"
114 if (
115 self == Operator.form_style_query
116 or self == Operator.form_style_query_continuation
117 ):
118 return "&"
119 # if self == Operator.reserved or self == Operator.fragment:
120 # return ","
121 return ","
122 # match self:
123 # case Operator.label_with_dot_prefix:
124 # return "."
125 # case Operator.path_segment:
126 # return "/"
127 # case Operator.path_style_parameter:
128 # return ";"
129 # case (
130 # Operator.form_style_query |
131 # Operator.form_style_query_continuation
132 # ):
133 # return "&"
134 # case Operator.reserved | Operator.fragment:
135 # return ","
136 # case _:
137 # return ","
138
139 def variable_prefix(self) -> str:
140 if self == Operator.reserved:

Callers 4

_query_expansionMethod · 0.80
_label_path_expansionMethod · 0.80
_semi_path_expansionMethod · 0.80
expandMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected