Skip to content

Commit

Permalink
move the position of get_first_group in utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Lesmiscore committed Sep 2, 2022
1 parent 4ee41f0 commit cc6d68d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions yt_dlp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5737,17 +5737,6 @@ def parse_args(self):
return self.parser.parse_args(self.all_args)


def get_first_group(match, *groups, default=None):
for g in groups:
try:
m = match.group(g)
if m:
return m
except IndexError:
continue
return default


def merge_headers(*dicts):
"""Merge dicts of http headers case insensitively, prioritizing the latter ones"""
return {k.title(): v for k, v in itertools.chain.from_iterable(map(dict.items, dicts))}
Expand Down Expand Up @@ -5882,6 +5871,17 @@ def truncate_string(s, left, right=0):
return f'{s[:left-3]}...{s[-right:]}'


def get_first_group(match, *groups, default=None):
for g in groups:
try:
m = match.group(g)
if m:
return m
except IndexError:
continue
return default


def orderedSet_from_options(options, alias_dict, *, use_regex=False, start=None):
assert 'all' in alias_dict, '"all" alias is required'
requested = list(start or [])
Expand Down

0 comments on commit cc6d68d

Please sign in to comment.