text stringlengths 0 828 |
|---|
"""""" |
ids = ','.join([str(i) for i in ids]) |
return pybrightcove.connection.ItemResultSet('find_playlists_by_ids', |
Playlist, connection, page_size, page_number, sort_by, sort_order, |
playlist_ids=ids)" |
1614,"def find_by_reference_ids(reference_ids, connection=None, page_size=100, |
page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): |
"""""" |
List playlists by specific reference_ids. |
"""""" |
reference_ids = ','.join([str(i) for i in reference_ids]) |
return pybrightcove.connection.ItemResultSet( |
""find_playlists_by_reference_ids"", Playlist, connection, page_size, |
page_number, sort_by, sort_order, reference_ids=reference_ids)" |
1615,"def find_for_player_id(player_id, connection=None, page_size=100, |
page_number=0, sort_by=DEFAULT_SORT_BY, sort_order=DEFAULT_SORT_ORDER): |
"""""" |
List playlists for a for given player id. |
"""""" |
return pybrightcove.connection.ItemResultSet( |
""find_playlists_for_player_id"", Playlist, connection, page_size, |
page_number, sort_by, sort_order, player_id=player_id)" |
1616,"def is_any_type_set(sett: Set[Type]) -> bool: |
"""""" |
Helper method to check if a set of types is the {AnyObject} singleton |
:param sett: |
:return: |
"""""" |
return len(sett) == 1 and is_any_type(min(sett))" |
1617,"def get_validated_types(object_types: Set[Type], set_name: str) -> Set[Type]: |
"""""" |
Utility to validate a set of types : |
* None is not allowed as a whole or within the set, |
* object and Any are converted into AnyObject |
* if AnyObject is in the set, it must be the only element |
:param object_types: the set of types to validate |
:param set_name: a name used in exceptions if any |
:return: the fixed set of types |
"""""" |
check_var(object_types, var_types=set, var_name=set_name) |
res = {get_validated_type(typ, set_name + '[x]') for typ in object_types} |
if AnyObject in res and len(res) > 1: |
raise ValueError('The set of types contains \'object\'/\'Any\'/\'AnyObject\', so no other type must be present ' |
'in the set') |
else: |
return res" |
1618,"def get_validated_type(object_type: Type[Any], name: str, enforce_not_joker: bool = True) -> Type[Any]: |
"""""" |
Utility to validate a type : |
* None is not allowed, |
* 'object', 'AnyObject' and 'Any' lead to the same 'AnyObject' type |
* JOKER is either rejected (if enforce_not_joker is True, default) or accepted 'as is' |
:param object_type: the type to validate |
:param name: a name used in exceptions if any |
:param enforce_not_joker: a boolean, set to False to tolerate JOKER types |
:return: the fixed type |
"""""" |
if object_type is object or object_type is Any or object_type is AnyObject: |
return AnyObject |
else: |
# -- !! Do not check TypeVar or Union : this is already handled at higher levels -- |
if object_type is JOKER: |
# optionally check if JOKER is allowed |
if enforce_not_joker: |
raise ValueError('JOKER is not allowed for object_type') |
else: |
# note: we dont check var earlier, since 'typing.Any' is not a subclass of type anymore |
check_var(object_type, var_types=type, var_name=name) |
return object_type" |
1619,"def get_options_for_id(options: Dict[str, Dict[str, Any]], identifier: str): |
"""""" |
Helper method, from the full options dict of dicts, to return either the options related to this parser or an |
empty dictionary. It also performs all the var type checks |
:param options: |
:param identifier: |
:return: |
"""""" |
check_var(options, var_types=dict, var_name='options') |
res = options[identifier] if identifier in options.keys() else dict() |
check_var(res, var_types=dict, var_name='options[' + identifier + ']') |
return res" |
1620,"def is_able_to_convert_detailed(self, strict: bool, from_type: Type[Any], to_type: Type[Any]) \ |
-> Tuple[bool, bool, bool]: |
"""""" |
Utility method to check if a parser is able to convert a given type to the given type, either in |
* strict mode : provided_type and desired_type must be equal to this converter's from_type and to_type |
respectively (or the to_type does not match but this converter is generic |
* inference mode (non-strict) : provided_type may be a subclass of from_type, and to_type may be a subclass |
of desired_type |
If a custom function was provided at construction time, it is called to enable converters to reject some |
conversions based on source and/or dest type provided. |
:param strict: a boolean indicating if matching should be in strict mode or not |
:param from_type: |
:param to_type: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.