Search is not available for this dataset
text
stringlengths
75
104k
def create_ticket(self, ticket=None, **kwargs): """ Create a new ``Ticket``. Additional arguments are passed to the ``create()`` function. Return the newly created ``Ticket``. """ if not ticket: ticket = self.create_ticket_str() if 'service' in kwargs: ...
def create_ticket_str(self, prefix=None): """ Generate a sufficiently opaque ticket string to ensure the ticket is not guessable. If a prefix is provided, prepend it to the string. """ if not prefix: prefix = self.model.TICKET_PREFIX return "%s-%d-%s" % (prefi...
def validate_ticket(self, ticket, service, renew=False, require_https=False): """ Given a ticket string and service identifier, validate the corresponding ``Ticket``. If validation succeeds, return the ``Ticket``. If validation fails, raise an appropriate error. If ``renew`` is ...
def delete_invalid_tickets(self): """ Delete consumed or expired ``Ticket``s that are not referenced by other ``Ticket``s. Invalid tickets are no longer valid for authentication and can be safely deleted. A custom management command is provided that executes this method ...
def consume_tickets(self, user): """ Consume all valid ``Ticket``s for a specified user. This is run when the user logs out to ensure all issued tickets are no longer valid for future authentication attempts. """ for ticket in self.filter(user=user, consumed__isnull=True,...
def request_sign_out(self, user): """ Send a single logout request to each service accessed by a specified user. This is called at logout when single logout is enabled. If requests-futures is installed, asynchronous requests will be sent. Otherwise, synchronous requests ...
def request_sign_out(self, session=requests): """ Send a POST request to the ``ServiceTicket``s logout URL to request sign-out. """ if logout_allowed(self.service): request = SingleSignOutRequest(context={'ticket': self}) url = get_logout_url(self.service)...
def create_ticket(self, service, pgturl, **kwargs): """ When a ``pgtUrl`` parameter is provided to ``/serviceValidate`` or ``/proxyValidate``, attempt to create a new ``ProxyGrantingTicket``. If validation succeeds, create and return the ``ProxyGrantingTicket``. If validation fai...
def validate_callback(self, service, pgturl, pgtid, pgtiou): """Verify the provided proxy callback URL.""" if not proxy_allowed(service): raise UnauthorizedServiceProxy("%s is not authorized to use proxy authentication" % service) if not is_scheme_https(pgturl): raise In...
def _get_backends(): """Retrieve the list of configured service backends.""" backends = [] backend_paths = getattr( settings, 'MAMA_CAS_SERVICE_BACKENDS', ['mama_cas.services.backends.SettingsBackend'] ) for backend_path in backend_paths: backend = import_string(backend_path)...
def _is_allowed(attr, *args): """ Test if a given attribute is allowed according to the current set of configured service backends. """ for backend in _get_backends(): try: if getattr(backend, attr)(*args): return True except AttributeError: ra...
def _is_valid_service_url(url): """Access services list from ``MAMA_CAS_VALID_SERVICES``.""" valid_services = getattr(settings, 'MAMA_CAS_VALID_SERVICES', ()) if not valid_services: return True warnings.warn( 'The MAMA_CAS_VALID_SERVICES setting is deprecated. Services ' 'should ...
def get_backend_path(service): """Return the dotted path of the matching backend.""" for backend in _get_backends(): try: if backend.service_allowed(service): return "%s.%s" % (backend.__class__.__module__, backend.__class__.__name__) except AttributeError: ...
def get_callbacks(service): """Get configured callbacks list for a given service identifier.""" callbacks = list(getattr(settings, 'MAMA_CAS_ATTRIBUTE_CALLBACKS', [])) if callbacks: warnings.warn( 'The MAMA_CAS_ATTRIBUTE_CALLBACKS setting is deprecated. Service callbacks ' 's...
def get_logout_url(service): """Get the configured logout URL for a given service identifier, if any.""" for backend in _get_backends(): try: return backend.get_logout_url(service) except AttributeError: raise NotImplementedError("%s.%s.get_logout_url() not implemented" %...
def logout_allowed(service): """Check if a given service identifier should be sent a logout request.""" if hasattr(settings, 'MAMA_CAS_SERVICES'): return _is_allowed('logout_allowed', service) if hasattr(settings, 'MAMA_CAS_ENABLE_SINGLE_SIGN_OUT'): warnings.warn( 'The MAMA_CAS_...
def proxy_callback_allowed(service, pgturl): """Check if a given proxy callback is allowed for the given service identifier.""" if hasattr(settings, 'MAMA_CAS_SERVICES'): return _is_allowed('proxy_callback_allowed', service, pgturl) return _is_valid_service_url(service)
def clean(self): """ Pass the provided username and password to the active authentication backends and verify the user account is not disabled. If authentication succeeds, the ``User`` object is assigned to the form so it can be accessed in the view. """ username ...
def clean_username(self): """ Remove an '@<domain>' suffix if present and return only the username. """ username = self.cleaned_data.get('username').split('@')[0] if not username: raise forms.ValidationError(_('Invalid username provided')) return usern...
def ns(self, prefix, tag): """ Given a prefix and an XML tag, output the qualified name for proper namespace handling on output. """ return etree.QName(self.prefixes[prefix], tag)
def validate_service_ticket(service, ticket, pgturl=None, renew=False, require_https=False): """ Validate a service ticket string. Return a triplet containing a ``ServiceTicket`` and an optional ``ProxyGrantingTicket``, or a ``ValidationError`` if ticket validation failed. """ logger.debug("Serv...
def validate_proxy_ticket(service, ticket, pgturl=None): """ Validate a proxy ticket string. Return a 4-tuple containing a ``ProxyTicket``, an optional ``ProxyGrantingTicket`` and a list of proxies through which authentication proceeded, or a ``ValidationError`` if ticket validation failed. """ ...
def validate_proxy_granting_ticket(pgt, target_service): """ Validate a proxy granting ticket string. Return an ordered pair containing a ``ProxyTicket``, or a ``ValidationError`` if ticket validation failed. """ logger.debug("Proxy ticket request received for %s using %s" % (target_service, pgt...
def get_attributes(user, service): """ Return a dictionary of user attributes from the set of configured callback functions. """ attributes = {} for path in get_callbacks(service): callback = import_string(path) attributes.update(callback(user, service)) return attributes
def logout_user(request): """End a single sign-on session for the current user.""" logger.debug("Logout request received for %s" % request.user) if is_authenticated(request.user): ServiceTicket.objects.consume_tickets(request.user) ProxyTicket.objects.consume_tickets(request.user) Pr...
def user_name_attributes(user, service): """Return all available user name related fields and methods.""" attributes = {} attributes['username'] = user.get_username() attributes['full_name'] = user.get_full_name() attributes['short_name'] = user.get_short_name() return attributes
def user_model_attributes(user, service): """ Return all fields on the user object that are not in the list of fields to ignore. """ ignore_fields = ['id', 'password'] attributes = {} for field in user._meta.fields: if field.name not in ignore_fields: attributes[field.nam...
def add_query_params(url, params): """ Inject additional query parameters into an existing URL. If parameters already exist with the same name, they will be overwritten. Parameters with empty values are ignored. Return the modified URL as a string. """ def encode(s): return force_byt...
def clean_service_url(url): """ Return only the scheme, hostname (with optional port) and path components of the parameter URL. """ parts = urlparse(url) return urlunparse((parts.scheme, parts.netloc, parts.path, '', '', ''))
def match_service(service1, service2): """ Compare two service URLs. Return ``True`` if the scheme, hostname, optional port and path match. """ s1, s2 = urlparse(service1), urlparse(service2) try: return (s1.scheme, s1.netloc, s1.path) == (s2.scheme, s2.netloc, s2.path) except ValueE...
def redirect(to, *args, **kwargs): """ Similar to the Django ``redirect`` shortcut but with altered functionality. If an optional ``params`` argument is provided, the dictionary items will be injected as query parameters on the redirection URL. """ params = kwargs.pop('params', {}) try:...
def get_config(self, service, setting): """ Access the configuration for a given service and setting. If the service is not found, return a default value. """ try: return self.get_service(service)[setting] except KeyError: return getattr(self, sett...
def get_status(self, status_value, message=None): """ Build a Status XML block for a SAML 1.1 Response. """ status = etree.Element('Status') status_code = etree.SubElement(status, 'StatusCode') status_code.set('Value', 'samlp:' + status_value) if message: ...
def get_assertion(self, ticket, attributes): """ Build a SAML 1.1 Assertion XML block. """ assertion = etree.Element('Assertion') assertion.set('xmlns', 'urn:oasis:names:tc:SAML:1.0:assertion') assertion.set('AssertionID', self.generate_id()) assertion.set('IssueI...
def get_conditions(self, service_id): """ Build a Conditions XML block for a SAML 1.1 Assertion. """ conditions = etree.Element('Conditions') conditions.set('NotBefore', self.instant()) conditions.set('NotOnOrAfter', self.instant(offset=30)) restriction = etree.Su...
def get_attribute_statement(self, subject, attributes): """ Build an AttributeStatement XML block for a SAML 1.1 Assertion. """ attribute_statement = etree.Element('AttributeStatement') attribute_statement.append(subject) for name, value in attributes.items(): ...
def get_authentication_statement(self, subject, ticket): """ Build an AuthenticationStatement XML block for a SAML 1.1 Assertion. """ authentication_statement = etree.Element('AuthenticationStatement') authentication_statement.set('AuthenticationInstant', ...
def get_subject(self, identifier): """ Build a Subject XML block for a SAML 1.1 AuthenticationStatement or AttributeStatement. """ subject = etree.Element('Subject') name = etree.SubElement(subject, 'NameIdentifier') name.text = identifier subject_confirma...
def is_bytes(string): """Check if a string is a bytes instance :param Union[str, bytes] string: A string that may be string or bytes like :return: Whether the provided string is a bytes type or not :rtype: bool """ if six.PY3 and isinstance(string, (bytes, memoryview, bytearray)): # noqa ...
def fs_encode(path): """ Encode a filesystem path to the proper filesystem encoding :param Union[str, bytes] path: A string-like path :returns: A bytes-encoded filesystem path representation """ path = _get_path(path) if path is None: raise TypeError("expected a valid path to encod...
def fs_decode(path): """ Decode a filesystem path using the proper filesystem encoding :param path: The filesystem path to decode from bytes or string :return: The filesystem path, decoded with the determined encoding :rtype: Text """ path = _get_path(path) if path is None: rai...
def colored(text, color=None, on_color=None, attrs=None): """Colorize text using a reimplementation of the colorizer from https://github.com/pavdmyt/yaspin so that it works on windows. Available text colors: red, green, yellow, blue, magenta, cyan, white. Available text highlights: on_...
def partialclass(cls, *args, **kwargs): """Returns a partially instantiated class :return: A partial class instance :rtype: cls >>> source = partialclass(Source, url="https://pypi.org/simple") >>> source <class '__main__.Source'> >>> source(name="pypi") >>> source.__dict__ mappingp...
def to_bytes(string, encoding="utf-8", errors=None): """Force a value to bytes. :param string: Some input that can be converted to a bytes. :type string: str or bytes unicode or a memoryview subclass :param encoding: The encoding to use for conversions, defaults to "utf-8" :param encoding: str, opt...
def to_text(string, encoding="utf-8", errors=None): """Force a value to a text-type. :param string: Some input that can be converted to a unicode representation. :type string: str or bytes unicode :param encoding: The encoding to use for conversions, defaults to "utf-8" :param encoding: str, option...
def get_wrapped_stream(stream, encoding=None, errors="replace"): """ Given a stream, wrap it in a `StreamWrapper` instance and return the wrapped stream. :param stream: A stream instance to wrap :param str encoding: The encoding to use for the stream :param str errors: The error handler to use, def...
def get_text_stream(stream="stdout", encoding=None): """Retrieve a unicode stream wrapper around **sys.stdout** or **sys.stderr**. :param str stream: The name of the stream to wrap from the :mod:`sys` module. :param str encoding: An optional encoding to use. :return: A new :class:`~vistir.misc.StreamWr...
def replace_with_text_stream(stream_name): """Given a stream name, replace the target stream with a text-converted equivalent :param str stream_name: The name of a target stream, such as **stdout** or **stderr** :return: None """ new_stream = TEXT_STREAMS.get(stream_name) if new_stream is not N...
def echo(text, fg=None, bg=None, style=None, file=None, err=False, color=None): """Write the given text to the provided stream or **sys.stdout** by default. Provides optional foreground and background colors from the ansi defaults: **grey**, **red**, **green**, **yellow**, **blue**, **magenta**, **cyan** ...
def get_stream_handle(stream=sys.stdout): """ Get the OS appropriate handle for the corresponding output stream. :param str stream: The the stream to get the handle for :return: A handle to the appropriate stream, either a ctypes buffer or **sys.stdout** or **sys.stderr**. """ hand...
def hide_cursor(stream=sys.stdout): """ Hide the console cursor on the given stream :param stream: The name of the stream to get the handle for :return: None :rtype: None """ handle = get_stream_handle(stream=stream) if os.name == "nt": from ._winconsole import hide_cursor ...
def clean(ctx): """Clean previously built package artifacts. """ ctx.run(f"python setup.py clean") dist = ROOT.joinpath("dist") print(f"[clean] Removing {dist}") if dist.exists(): shutil.rmtree(str(dist))
def _sanitize_params(prefix, suffix, dir): """Common parameter processing for most APIs in this module.""" output_type = _infer_return_type(prefix, suffix, dir) if suffix is None: suffix = output_type() if prefix is None: if output_type is str: prefix = "tmp" else: ...
def register_surrogateescape(): """ Registers the surrogateescape error handler on Python 2 (only) """ if six.PY3: return try: codecs.lookup_error(FS_ERRORS) except LookupError: codecs.register_error(FS_ERRORS, surrogateescape_handler)
def set_write_bit(fn): # type: (str) -> None """ Set read-write permissions for the current user on the target path. Fail silently if the path doesn't exist. :param str fn: The target filename or path :return: None """ fn = fs_encode(fn) if not os.path.exists(fn): return ...
def arg_to_dict(arg): """Convert an argument that can be None, list/tuple or dict to dict Example:: >>> arg_to_dict(None) [] >>> arg_to_dict(['a', 'b']) {'a':{},'b':{}} >>> arg_to_dict({'a':{'only': 'id'}, 'b':{'only': 'id'}}) {'a':{'only':'id'},'b':{'only':'id'...
def asdict(model, exclude=None, exclude_underscore=None, exclude_pk=None, follow=None, include=None, only=None, method='asdict', **kwargs): """Get a dict from a model Using the `method` parameter makes it possible to have multiple methods that formats the result. Additional keyword argument...
def fromdict(model, data, exclude=None, exclude_underscore=None, allow_pk=None, follow=None, include=None, only=None): """Update a model from a dict Works almost identically as :meth:`dictalchemy.utils.asdict`. However, it will not create missing instances or update collections. This meth...
def make_class_dictable( cls, exclude=constants.default_exclude, exclude_underscore=constants.default_exclude_underscore, fromdict_allow_pk=constants.default_fromdict_allow_pk, include=None, asdict_include=None, fromdict_include=None): """Make a class dictable...
def parse_GFF_attribute_string(attrStr, extra_return_first_value=False): """Parses a GFF attribute string and returns it as a dictionary. If 'extra_return_first_value' is set, a pair is returned: the dictionary and the value of the first attribute. This might be useful if this is the ID. """ if...
def make_feature_dict(feature_sequence): """A feature dict is a convenient way to organize a sequence of Feature object (which you have got, e.g., from parse_GFF). The function returns a dict with all the feature types as keys. Each value of this dict is again a dict, now of feature names. The values o...
def pair_SAM_alignments( alignments, bundle=False, primary_only=False): '''Iterate over SAM aligments, name-sorted paired-end Args: alignments (iterator of SAM/BAM alignments): the alignments to wrap bundle (bool): if True, bundle all alignments from one read pair into a...
def create( cls, length = sys.maxint, typecode = 'd', start_index = 0 ): """Construct a StepVector of the given length, with indices starting at the given start_index and counting up to (but not including) start_index + length. The typecode may be: 'd' for float values (C type 'double')...
def get_steps( self, values_only = False, merge_steps=True ): """To get a succinct representation of the StepVector's content, call the 'get_steps' method. It returns an iterator that generates triples of values. Each triple contains one step, giving first the start index of the step, then the s...
def bundle_multiple_alignments(sequence_of_alignments): """Some alignment programs, e.g., Bowtie, can output multiple alignments, i.e., the same read is reported consecutively with different alignments. This function takes an iterator over alignments and bundles consecutive alignments regarding the same...
def pair_SAM_alignments_with_buffer( alignments, max_buffer_size=30000000, primary_only=False): '''Iterate over SAM aligments with buffer, position-sorted paired-end Args: alignments (iterator of SAM/BAM alignments): the alignments to wrap max_buffer_size (int): maxmal n...
def ensure_v8_src(): """ Ensure that v8 src are presents and up-to-date """ path = local_path('v8') if not os.path.isdir(path): fetch_v8(path) else: update_v8(path) checkout_v8_version(local_path("v8/v8"), V8_VERSION) dependencies_sync(path)
def get_filenames(directory): """Get all the file to copy""" for filename in os.listdir(directory): if re.search(r"cp\d{2}mu?-manylinux1_\S+\.whl", filename): yield filename
def copy_file(filename): """Copy the file and put the correct tag""" print("Updating file %s" % filename) out_dir = os.path.abspath(DIRECTORY) tags = filename[:-4].split("-") tags[-2] = tags[-2].replace("m", "") new_name = "-".join(tags) + ".whl" wheel_flag = "-".join(tags[2:]) with...
def is_unicode(value): """ Check if a value is a valid unicode string, compatible with python 2 and python 3 >>> is_unicode(u'foo') True >>> is_unicode(u'✌') True >>> is_unicode(b'foo') False >>> is_unicode(42) False >>> is_unicode(('abc',)) False """ python_version ...
def execute(self, js_str, timeout=0, max_memory=0): """ Exec the given JS value """ wrapped = "(function(){return (%s)})()" % js_str return self.eval(wrapped, timeout, max_memory)
def eval(self, js_str, timeout=0, max_memory=0): """ Eval the JavaScript string """ if is_unicode(js_str): bytes_val = js_str.encode("utf8") else: bytes_val = js_str res = None self.lock.acquire() try: res = self.ext.mr_eval_context(s...
def call(self, identifier, *args, **kwargs): """ Call the named function with provided arguments You can pass a custom JSON encoder by passing it in the encoder keyword only argument. """ encoder = kwargs.get('encoder', None) timeout = kwargs.get('timeout', 0) ma...
def heap_stats(self): """ Return heap statistics """ self.lock.acquire() res = self.ext.mr_heap_stats(self.ctx) self.lock.release() python_value = res.contents.to_python() self.free(res) return python_value
def heap_snapshot(self): """ Return heap snapshot """ self.lock.acquire() res = self.ext.mr_heap_snapshot(self.ctx) self.lock.release() python_value = res.contents.to_python() self.free(res) return python_value
def to_python(self): """ Return an object as native Python """ result = None if self.type == PythonTypes.null: result = None elif self.type == PythonTypes.bool: result = self.value == 1 elif self.type == PythonTypes.integer: if self.value is N...
def libv8_object(object_name): """ Return a path for object_name which is OS independent """ filename = join(V8_LIB_DIRECTORY, 'out.gn/x64.release/obj/{}'.format(object_name)) if not isfile(filename): filename = join(local_path('vendor/v8/out.gn/libv8/obj/{}'.format(object_name))) if not ...
def get_static_lib_paths(): """ Return the required static libraries path """ libs = [] is_linux = sys.platform.startswith('linux') if is_linux: libs += ['-Wl,--start-group'] libs += get_raw_static_lib_path() if is_linux: libs += ['-Wl,--end-group'] return libs
def build_extension(self, ext): """ Compile manually the py_mini_racer extension, bypass setuptools """ try: if not is_v8_built(): self.run_command('build_v8') self.debug = True if V8_PATH: dest_filename = join(self.build_lib, ...
def babel_transform(es_string): """ Transform the provided string using babel.transform """ path_to_babel = os.path.join(os.path.dirname(__file__), '..', 'tests', 'fixtures', 'babel.js') es6 = '[1,2,3].map(n => n + 1);' babel_source = open(path_to_babel, "r").read() ...
def gifs_categories_category_get(self, api_key, category, **kwargs): """ Category Tags Endpoint. Returns a list of tags for a given category. NOTE `limit` and `offset` must both be set; otherwise they're ignored. This method makes a synchronous HTTP request by default. To make an ...
def gifs_categories_category_tag_get(self, api_key, category, tag, **kwargs): """ Tagged Gifs Endpoint. Returns a list of gifs for a given tag (alias to `/gif/search`). This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a ...
def gifs_categories_get(self, api_key, **kwargs): """ Categories Endpoint. Returns a list of categories. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the res...
def gifs_get(self, api_key, ids, **kwargs): """ Get GIFs by ID Endpoint A multiget version of the get GIF by ID endpoint. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when ...
def gifs_gif_id_get(self, api_key, gif_id, **kwargs): """ Get GIF by ID Endpoint Returns a GIF given that GIF's unique ID This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when ...
def gifs_random_get(self, api_key, **kwargs): """ Random Endpoint Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, plea...
def gifs_search_get(self, api_key, q, **kwargs): """ Search Endpoint Search all Giphy GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho. This method makes a synchronous HTTP reques...
def gifs_translate_get(self, api_key, s, **kwargs): """ Translate Endpoint The translate API draws on search, but uses the Giphy `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. This method makes a synchronous HTTP request by ...
def gifs_trending_get(self, api_key, **kwargs): """ Trending GIFs Endpoint Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the <a href = \"http://www.giphy.com\">GIPHY homepage</a>. Returns 25 results by default. ...
def stickers_random_get(self, api_key, **kwargs): """ Random Sticker Endpoint Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP r...
def stickers_search_get(self, api_key, q, **kwargs): """ Sticker Search Endpoint Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs. This method makes a synchronous HTTP request by default. To make an asynchro...
def stickers_translate_get(self, api_key, s, **kwargs): """ Sticker Translate Endpoint The translate API draws on search, but uses the Giphy `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. This method makes a synchronous HTTP...
def stickers_trending_get(self, api_key, **kwargs): """ Trending Stickers Endpoint Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the <a href = \"http://www.giphy.com\">GIPHY homepage</a>. Returns 25 results by defa...
def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, response_type=None, auth_settings=None, callback=None, _return_http_data_only=None, collection_formats=None, _pr...
def update_params_for_auth(self, headers, querys, auth_settings): """ Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentica...
def get_dag_params(self) -> Dict[str, Any]: """ Merges default config with dag config, sets dag_id, and extropolates dag_start_date :returns: dict of dag parameters """ try: dag_params: Dict[str, Any] = utils.merge_configs(self.dag_config, self.default_config) ...
def make_task(operator: str, task_params: Dict[str, Any]) -> BaseOperator: """ Takes an operator and params and creates an instance of that operator. :returns: instance of operator object """ try: # class is a Callable https://stackoverflow.com/a/34578836/3679900 ...
def build(self) -> Dict[str, Union[str, DAG]]: """ Generates a DAG from the DAG parameters. :returns: dict with dag_id and DAG object :type: Dict[str, Union[str, DAG]] """ dag_params: Dict[str, Any] = self.get_dag_params() dag: DAG = DAG( dag_id=dag_p...
def get_start_date(date_value: Union[str, datetime, date], timezone: str = "UTC") -> datetime: """ Takes value from DAG config and generates valid start_date. Defaults to today, if not a valid date or relative time (1 hours, 1 days, etc.) :param date_value: either a datetime (or date) or a relative tim...
def get_time_delta(time_string: str) -> timedelta: """ Takes a time string (1 hours, 10 days, etc.) and returns a python timedelta object :param time_string: the time value to convert to a timedelta :type time_string: str :returns: datetime.timedelta for relative time :type datetime.timedel...