MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/dialects/postgresql/ext.py:501–539  ·  lib/sqlalchemy/dialects/postgresql/ext.py::ts_headline.__init__
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

499 type = TEXT
500
501 def __init__(self, *args, **kwargs):
502 args = list(args)
503
504 class="cm"># parse types according to
505 class="cm"># https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE
506 if len(args) < 2:
507 class="cm"># invalid args; don't do anything
508 has_regconfig = False
509 elif (
510 isinstance(args[1], elements.ColumnElement)
511 and args[1].type._type_affinity is types.TSQUERY
512 ):
513 class="cm"># tsquery is second argument, no regconfig argument
514 has_regconfig = False
515 else:
516 has_regconfig = True
517
518 if has_regconfig:
519 initial_arg = coercions.expect(
520 roles.ExpressionElementRole,
521 args.pop(0),
522 apply_propagate_attrs=self,
523 name=getattr(self, class="st">"name", None),
524 type_=types.REGCONFIG,
525 )
526 initial_arg = [initial_arg]
527 else:
528 initial_arg = []
529
530 addtl_args = [
531 coercions.expect(
532 roles.ExpressionElementRole,
533 c,
534 name=getattr(self, class="st">"name", None),
535 apply_propagate_attrs=self,
536 )
537 for c in args
538 ]
539 super().__init__(*(initial_arg + addtl_args), **kwargs)
540
541
542def distinct_on(*expr: _ColumnExpressionArgument[Any]) -> DistinctOnClause:

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 1

popMethod · 0.45

Tested by

no test coverage detected