idx int64 0 251k | question stringlengths 53 3.53k | target stringlengths 5 1.23k | len_question int64 20 893 | len_target int64 3 238 |
|---|---|---|---|---|
225,700 | async def process_response ( self , response : Response , request_context : Optional [ RequestContext ] = None , ) -> Response : request_ = ( request_context or _request_ctx_stack . top ) . request functions = ( request_context or _request_ctx_stack . top ) . _after_request_functions blueprint = request_ . blueprint if blueprint is not None : functions = chain ( functions , self . after_request_funcs [ blueprint ] ) functions = chain ( functions , self . after_request_funcs [ None ] ) for function in functions : response = await function ( response ) session_ = ( request_context or _request_ctx_stack . top ) . session if not self . session_interface . is_null_session ( session_ ) : await self . save_session ( session_ , response ) return response | Postprocess the request acting on the response . | 183 | 9 |
225,701 | async def full_dispatch_websocket ( self , websocket_context : Optional [ WebsocketContext ] = None , ) -> Optional [ Response ] : await self . try_trigger_before_first_request_functions ( ) await websocket_started . send ( self ) try : result = await self . preprocess_websocket ( websocket_context ) if result is None : result = await self . dispatch_websocket ( websocket_context ) except Exception as error : result = await self . handle_user_exception ( error ) return await self . finalize_websocket ( result , websocket_context ) | Adds pre and post processing to the websocket dispatching . | 139 | 12 |
225,702 | async def preprocess_websocket ( self , websocket_context : Optional [ WebsocketContext ] = None , ) -> Optional [ ResponseReturnValue ] : websocket_ = ( websocket_context or _websocket_ctx_stack . top ) . websocket blueprint = websocket_ . blueprint processors = self . url_value_preprocessors [ None ] if blueprint is not None : processors = chain ( processors , self . url_value_preprocessors [ blueprint ] ) # type: ignore for processor in processors : processor ( websocket_ . endpoint , websocket_ . view_args ) functions = self . before_websocket_funcs [ None ] if blueprint is not None : functions = chain ( functions , self . before_websocket_funcs [ blueprint ] ) # type: ignore for function in functions : result = await function ( ) if result is not None : return result return None | Preprocess the websocket i . e . call before_websocket functions . | 196 | 17 |
225,703 | async def dispatch_websocket ( self , websocket_context : Optional [ WebsocketContext ] = None , ) -> None : websocket_ = ( websocket_context or _websocket_ctx_stack . top ) . websocket if websocket_ . routing_exception is not None : raise websocket_ . routing_exception handler = self . view_functions [ websocket_ . url_rule . endpoint ] return await handler ( * * websocket_ . view_args ) | Dispatch the websocket to the view function . | 108 | 9 |
225,704 | async def postprocess_websocket ( self , response : Optional [ Response ] , websocket_context : Optional [ WebsocketContext ] = None , ) -> Response : websocket_ = ( websocket_context or _websocket_ctx_stack . top ) . websocket functions = ( websocket_context or _websocket_ctx_stack . top ) . _after_websocket_functions blueprint = websocket_ . blueprint if blueprint is not None : functions = chain ( functions , self . after_websocket_funcs [ blueprint ] ) functions = chain ( functions , self . after_websocket_funcs [ None ] ) for function in functions : response = await function ( response ) session_ = ( websocket_context or _request_ctx_stack . top ) . session if not self . session_interface . is_null_session ( session_ ) : if response is None and isinstance ( session_ , SecureCookieSession ) and session_ . modified : self . logger . exception ( "Secure Cookie Session modified during websocket handling. " "These modifications will be lost as a cookie cannot be set." ) else : await self . save_session ( session_ , response ) return response | Postprocess the websocket acting on the response . | 262 | 10 |
225,705 | def after_this_request ( func : Callable ) -> Callable : _request_ctx_stack . top . _after_request_functions . append ( func ) return func | Schedule the func to be called after the current request . | 39 | 12 |
225,706 | def after_this_websocket ( func : Callable ) -> Callable : _websocket_ctx_stack . top . _after_websocket_functions . append ( func ) return func | Schedule the func to be called after the current websocket . | 45 | 13 |
225,707 | def copy_current_app_context ( func : Callable ) -> Callable : if not has_app_context ( ) : raise RuntimeError ( 'Attempt to copy app context outside of a app context' ) app_context = _app_ctx_stack . top . copy ( ) @ wraps ( func ) async def wrapper ( * args : Any , * * kwargs : Any ) -> Any : async with app_context : return await func ( * args , * * kwargs ) return wrapper | Share the current app context with the function decorated . | 107 | 10 |
225,708 | def copy_current_request_context ( func : Callable ) -> Callable : if not has_request_context ( ) : raise RuntimeError ( 'Attempt to copy request context outside of a request context' ) request_context = _request_ctx_stack . top . copy ( ) @ wraps ( func ) async def wrapper ( * args : Any , * * kwargs : Any ) -> Any : async with request_context : return await func ( * args , * * kwargs ) return wrapper | Share the current request context with the function decorated . | 107 | 10 |
225,709 | def copy_current_websocket_context ( func : Callable ) -> Callable : if not has_websocket_context ( ) : raise RuntimeError ( 'Attempt to copy websocket context outside of a websocket context' ) websocket_context = _websocket_ctx_stack . top . copy ( ) @ wraps ( func ) async def wrapper ( * args : Any , * * kwargs : Any ) -> Any : async with websocket_context : return await func ( * args , * * kwargs ) return wrapper | Share the current websocket context with the function decorated . | 117 | 11 |
225,710 | def match_request ( self ) -> None : try : self . request_websocket . url_rule , self . request_websocket . view_args = self . url_adapter . match ( ) # noqa except ( NotFound , MethodNotAllowed , RedirectRequired ) as error : self . request_websocket . routing_exception = error | Match the request against the adapter . | 80 | 7 |
225,711 | def get ( self , name : str , default : Optional [ Any ] = None ) -> Any : return self . __dict__ . get ( name , default ) | Get a named attribute of this instance or return the default . | 34 | 12 |
225,712 | def pop ( self , name : str , default : Any = _sentinel ) -> Any : if default is _sentinel : return self . __dict__ . pop ( name ) else : return self . __dict__ . pop ( name , default ) | Pop get and remove the named attribute of this instance . | 53 | 11 |
225,713 | def setdefault ( self , name : str , default : Any = None ) -> Any : return self . __dict__ . setdefault ( name , default ) | Set an attribute with a default value . | 33 | 8 |
225,714 | def get_cookie_domain ( self , app : 'Quart' ) -> Optional [ str ] : if app . config [ 'SESSION_COOKIE_DOMAIN' ] is not None : return app . config [ 'SESSION_COOKIE_DOMAIN' ] elif app . config [ 'SERVER_NAME' ] is not None : return '.' + app . config [ 'SERVER_NAME' ] . rsplit ( ':' , 1 ) [ 0 ] else : return None | Helper method to return the Cookie Domain for the App . | 108 | 11 |
225,715 | def get_expiration_time ( self , app : 'Quart' , session : SessionMixin ) -> Optional [ datetime ] : if session . permanent : return datetime . utcnow ( ) + app . permanent_session_lifetime else : return None | Helper method to return the Session expiration time . | 57 | 9 |
225,716 | def should_set_cookie ( self , app : 'Quart' , session : SessionMixin ) -> bool : if session . modified : return True save_each = app . config [ 'SESSION_REFRESH_EACH_REQUEST' ] return save_each and session . permanent | Helper method to return if the Set Cookie header should be present . | 63 | 13 |
225,717 | def get_signing_serializer ( self , app : 'Quart' ) -> Optional [ URLSafeTimedSerializer ] : if not app . secret_key : return None options = { 'key_derivation' : self . key_derivation , 'digest_method' : self . digest_method , } return URLSafeTimedSerializer ( app . secret_key , salt = self . salt , serializer = self . serializer , signer_kwargs = options , ) | Return a serializer for the session that also signs data . | 109 | 12 |
225,718 | async def open_session ( self , app : 'Quart' , request : BaseRequestWebsocket , ) -> Optional [ SecureCookieSession ] : signer = self . get_signing_serializer ( app ) if signer is None : return None cookie = request . cookies . get ( app . session_cookie_name ) if cookie is None : return self . session_class ( ) try : data = signer . loads ( cookie , max_age = app . permanent_session_lifetime . total_seconds ( ) , ) return self . session_class ( * * data ) except BadSignature : return self . session_class ( ) | Open a secure cookie based session . | 141 | 7 |
225,719 | async def save_session ( # type: ignore self , app : 'Quart' , session : SecureCookieSession , response : Response , ) -> None : domain = self . get_cookie_domain ( app ) path = self . get_cookie_path ( app ) if not session : if session . modified : response . delete_cookie ( app . session_cookie_name , domain = domain , path = path ) return if session . accessed : response . vary . add ( 'Cookie' ) if not self . should_set_cookie ( app , session ) : return data = self . get_signing_serializer ( app ) . dumps ( dict ( session ) ) response . set_cookie ( app . session_cookie_name , data , expires = self . get_expiration_time ( app , session ) , httponly = self . get_cookie_httponly ( app ) , domain = domain , path = path , secure = self . get_cookie_secure ( app ) , ) | Saves the session to the response in a secure cookie . | 214 | 12 |
225,720 | async def get_data ( self , raw : bool = True ) -> AnyStr : if self . implicit_sequence_conversion : self . response = self . data_body_class ( await self . response . convert_to_sequence ( ) ) result = b'' if raw else '' async with self . response as body : # type: ignore async for data in body : if raw : result += data else : result += data . decode ( self . charset ) return result | Return the body data . | 101 | 5 |
225,721 | def set_data ( self , data : AnyStr ) -> None : if isinstance ( data , str ) : bytes_data = data . encode ( self . charset ) else : bytes_data = data self . response = self . data_body_class ( bytes_data ) if self . automatically_set_content_length : self . content_length = len ( bytes_data ) | Set the response data . | 83 | 5 |
225,722 | async def make_conditional ( self , request_range : Range , max_partial_size : Optional [ int ] = None , ) -> None : self . accept_ranges = "bytes" # Advertise this ability if len ( request_range . ranges ) == 0 : # Not a conditional request return if request_range . units != "bytes" or len ( request_range . ranges ) > 1 : from . . exceptions import RequestRangeNotSatisfiable raise RequestRangeNotSatisfiable ( ) begin , end = request_range . ranges [ 0 ] try : complete_length = await self . response . make_conditional ( # type: ignore begin , end , max_partial_size , ) except AttributeError : self . response = self . data_body_class ( await self . response . convert_to_sequence ( ) ) return await self . make_conditional ( request_range , max_partial_size ) else : self . content_length = self . response . end - self . response . begin # type: ignore if self . content_length != complete_length : self . content_range = ContentRange ( request_range . units , self . response . begin , self . response . end - 1 , # type: ignore complete_length , ) self . status_code = 206 | Make the response conditional to the | 280 | 6 |
225,723 | def set_cookie ( # type: ignore self , key : str , value : AnyStr = '' , max_age : Optional [ Union [ int , timedelta ] ] = None , expires : Optional [ datetime ] = None , path : str = '/' , domain : Optional [ str ] = None , secure : bool = False , httponly : bool = False , ) -> None : if isinstance ( value , bytes ) : value = value . decode ( ) # type: ignore cookie = create_cookie ( key , value , max_age , expires , path , domain , secure , httponly ) # type: ignore # noqa: E501 self . headers . add ( 'Set-Cookie' , cookie . output ( header = '' ) ) | Set a cookie in the response headers . | 159 | 8 |
225,724 | def match ( self , path : str ) -> Tuple [ Optional [ Dict [ str , Any ] ] , bool ] : match = self . _pattern . match ( path ) if match is not None : # If the route is a branch (not leaf) and the path is # missing a trailing slash then it needs one to be # considered a match in the strict slashes mode. needs_slash = ( self . strict_slashes and not self . is_leaf and match . groupdict ( ) [ '__slash__' ] != '/' ) try : converted_varaibles = { name : self . _converters [ name ] . to_python ( value ) for name , value in match . groupdict ( ) . items ( ) if name != '__slash__' } except ValidationError : # Doesn't meet conversion rules, no match return None , False else : return { * * self . defaults , * * converted_varaibles } , needs_slash else : return None , False | Check if the path matches this Rule . | 218 | 8 |
225,725 | def provides_defaults_for ( self , rule : 'Rule' , * * values : Any ) -> bool : defaults_match = all ( values [ key ] == self . defaults [ key ] for key in self . defaults if key in values # noqa: S101, E501 ) return self != rule and bool ( self . defaults ) and defaults_match | Returns true if this rule provides defaults for the argument and values . | 77 | 13 |
225,726 | def build ( self , * * values : Any ) -> str : converted_values = { key : self . _converters [ key ] . to_url ( value ) for key , value in values . items ( ) if key in self . _converters } result = self . _builder . format ( * * converted_values ) . split ( '|' , 1 ) [ 1 ] query_string = urlencode ( { key : value for key , value in values . items ( ) if key not in self . _converters and key not in self . defaults } , doseq = True , ) if query_string : result = "{}?{}" . format ( result , query_string ) return result | Build this rule into a path using the values given . | 154 | 11 |
225,727 | def buildable ( self , values : Optional [ dict ] = None , method : Optional [ str ] = None ) -> bool : if method is not None and method not in self . methods : return False defaults_match = all ( values [ key ] == self . defaults [ key ] for key in self . defaults if key in values # noqa: S101, E501 ) return defaults_match and set ( values . keys ( ) ) >= set ( self . _converters . keys ( ) ) | Return True if this rule can build with the values and method . | 106 | 13 |
225,728 | def bind ( self , map : Map ) -> None : if self . map is not None : raise RuntimeError ( f"{self!r} is already bound to {self.map!r}" ) self . map = map pattern = '' builder = '' full_rule = "{}\\|{}" . format ( self . host or '' , self . rule ) for part in _parse_rule ( full_rule ) : if isinstance ( part , VariablePart ) : converter = self . map . converters [ part . converter ] ( * part . arguments [ 0 ] , * * part . arguments [ 1 ] , ) pattern += f"(?P<{part.name}>{converter.regex})" self . _converters [ part . name ] = converter builder += '{' + part . name + '}' self . _weights . append ( WeightedPart ( True , converter . weight ) ) else : builder += part pattern += part self . _weights . append ( WeightedPart ( False , - len ( part ) ) ) if not self . is_leaf or not self . strict_slashes : # Pattern should match with or without a trailing slash pattern = f"{pattern.rstrip('/')}(?<!/)(?P<__slash__>/?)$" else : pattern = f"{pattern}$" self . _pattern = re . compile ( pattern ) self . _builder = builder | Bind the Rule to a Map and compile it . | 310 | 10 |
225,729 | def match_key ( self ) -> Tuple [ bool , bool , int , List [ WeightedPart ] ] : if self . map is None : raise RuntimeError ( f"{self!r} is not bound to a Map" ) complex_rule = any ( weight . converter for weight in self . _weights ) return ( not bool ( self . defaults ) , complex_rule , - len ( self . _weights ) , self . _weights ) | A Key to sort the rules by weight for matching . | 96 | 11 |
225,730 | def build_key ( self ) -> Tuple [ bool , int ] : if self . map is None : raise RuntimeError ( f"{self!r} is not bound to a Map" ) return ( not bool ( self . defaults ) , - sum ( 1 for weight in self . _weights if weight . converter ) ) | A Key to sort the rules by weight for building . | 69 | 11 |
225,731 | def get_tile ( tile_number ) : tile_number = int ( tile_number ) max_tiles = app . max_tiles if tile_number > max_tiles * max_tiles : raise TileOutOfBoundsError ( 'Requested an out of bounds tile' ) tile_size = Point ( app . img . size [ 0 ] // max_tiles , app . img . size [ 1 ] // max_tiles ) tile_coords = Point ( tile_number % max_tiles , tile_number // max_tiles ) crop_box = ( tile_coords . x * tile_size . x , tile_coords . y * tile_size . y , tile_coords . x * tile_size . x + tile_size . x , tile_coords . y * tile_size . y + tile_size . y , ) return app . img . crop ( crop_box ) | Returns a crop of img based on a sequence number tile_number . | 204 | 14 |
225,732 | async def tile ( tile_number ) : try : tile = get_tile ( tile_number ) except TileOutOfBoundsError : abort ( 404 ) buf = BytesIO ( tile . tobytes ( ) ) tile . save ( buf , 'JPEG' ) content = buf . getvalue ( ) response = await make_response ( content ) response . headers [ 'Content-Type' ] = 'image/jpg' response . headers [ 'Accept-Ranges' ] = 'bytes' response . headers [ 'Content-Length' ] = str ( len ( content ) ) return response | Handles GET requests for a tile number . | 126 | 9 |
225,733 | def is_json ( self ) -> bool : content_type = self . mimetype if content_type == 'application/json' or ( content_type . startswith ( 'application/' ) and content_type . endswith ( '+json' ) ) : return True else : return False | Returns True if the content_type is json like . | 66 | 11 |
225,734 | async def get_json ( self , force : bool = False , silent : bool = False , cache : bool = True , ) -> Any : if cache and self . _cached_json is not sentinel : return self . _cached_json if not ( force or self . is_json ) : return None data = await self . _load_json_data ( ) try : result = loads ( data ) except ValueError as error : if silent : result = None else : self . on_json_loading_failed ( error ) if cache : self . _cached_json = result return result | Parses the body data as JSON and returns it . | 129 | 12 |
225,735 | def mimetype ( self , value : str ) -> None : if ( value . startswith ( 'text/' ) or value == 'application/xml' or ( value . startswith ( 'application/' ) and value . endswith ( '+xml' ) ) ) : mimetype = f"{value}; charset={self.charset}" else : mimetype = value self . headers [ 'Content-Type' ] = mimetype | Set the mimetype to the value . | 102 | 9 |
225,736 | def blueprint ( self ) -> Optional [ str ] : if self . endpoint is not None and '.' in self . endpoint : return self . endpoint . rsplit ( '.' , 1 ) [ 0 ] else : return None | Returns the blueprint the matched endpoint belongs to . | 46 | 9 |
225,737 | def base_url ( self ) -> str : return urlunparse ( ParseResult ( self . scheme , self . host , self . path , '' , '' , '' ) ) | Returns the base url without query string or fragments . | 38 | 10 |
225,738 | def url ( self ) -> str : return urlunparse ( ParseResult ( self . scheme , self . host , self . path , '' , self . query_string . decode ( 'ascii' ) , '' , ) , ) | Returns the full url requested . | 51 | 6 |
225,739 | def cookies ( self ) -> Dict [ str , str ] : cookies = SimpleCookie ( ) cookies . load ( self . headers . get ( 'Cookie' , '' ) ) return { key : cookie . value for key , cookie in cookies . items ( ) } | The parsed cookies attached to this request . | 57 | 8 |
225,740 | def from_envvar ( self , variable_name : str , silent : bool = False ) -> None : value = os . environ . get ( variable_name ) if value is None and not silent : raise RuntimeError ( f"Environment variable {variable_name} is not present, cannot load config" , ) return self . from_pyfile ( value ) | Load the configuration from a location specified in the environment . | 77 | 11 |
225,741 | def from_pyfile ( self , filename : str , silent : bool = False ) -> None : file_path = self . root_path / filename try : spec = importlib . util . spec_from_file_location ( "module.name" , file_path ) # type: ignore if spec is None : # Likely passed a cfg file parser = ConfigParser ( ) parser . optionxform = str # type: ignore # Prevents lowercasing of keys with open ( file_path ) as file_ : config_str = '[section]\n' + file_ . read ( ) parser . read_string ( config_str ) self . from_mapping ( parser [ 'section' ] ) else : module = importlib . util . module_from_spec ( spec ) spec . loader . exec_module ( module ) # type: ignore self . from_object ( module ) except ( FileNotFoundError , IsADirectoryError ) : if not silent : raise | Load the configuration from a Python cfg or py file . | 210 | 12 |
225,742 | def from_object ( self , instance : Union [ object , str ] ) -> None : if isinstance ( instance , str ) : try : path , config = instance . rsplit ( '.' , 1 ) except ValueError : path = instance instance = importlib . import_module ( path ) else : module = importlib . import_module ( path ) instance = getattr ( module , config ) for key in dir ( instance ) : if key . isupper ( ) : self [ key ] = getattr ( instance , key ) | Load the configuration from a Python object . | 112 | 8 |
225,743 | def from_json ( self , filename : str , silent : bool = False ) -> None : file_path = self . root_path / filename try : with open ( file_path ) as file_ : data = json . loads ( file_ . read ( ) ) except ( FileNotFoundError , IsADirectoryError ) : if not silent : raise else : self . from_mapping ( data ) | Load the configuration values from a JSON formatted file . | 87 | 10 |
225,744 | def from_mapping ( self , mapping : Optional [ Mapping [ str , Any ] ] = None , * * kwargs : Any ) -> None : mappings : Dict [ str , Any ] = { } if mapping is not None : mappings . update ( mapping ) mappings . update ( kwargs ) for key , value in mappings . items ( ) : if key . isupper ( ) : self [ key ] = value | Load the configuration values from a mapping . | 95 | 8 |
225,745 | def get_namespace ( self , namespace : str , lowercase : bool = True , trim_namespace : bool = True , ) -> Dict [ str , Any ] : config = { } for key , value in self . items ( ) : if key . startswith ( namespace ) : if trim_namespace : new_key = key [ len ( namespace ) : ] else : new_key = key if lowercase : new_key = new_key . lower ( ) config [ new_key ] = value return config | Return a dictionary of keys within a namespace . | 113 | 9 |
225,746 | async def make_response ( * args : Any ) -> Response : if not args : return current_app . response_class ( ) if len ( args ) == 1 : args = args [ 0 ] return await current_app . make_response ( args ) | Create a response a simple wrapper function . | 55 | 8 |
225,747 | def get_flashed_messages ( with_categories : bool = False , category_filter : List [ str ] = [ ] , ) -> Union [ List [ str ] , List [ Tuple [ str , str ] ] ] : flashes = session . pop ( '_flashes' ) if '_flashes' in session else [ ] if category_filter : flashes = [ flash for flash in flashes if flash [ 0 ] in category_filter ] if not with_categories : flashes = [ flash [ 1 ] for flash in flashes ] return flashes | Retrieve the flashed messages stored in the session . | 118 | 10 |
225,748 | def url_for ( endpoint : str , * , _anchor : Optional [ str ] = None , _external : Optional [ bool ] = None , _method : Optional [ str ] = None , _scheme : Optional [ str ] = None , * * values : Any , ) -> str : app_context = _app_ctx_stack . top request_context = _request_ctx_stack . top if request_context is not None : url_adapter = request_context . url_adapter if endpoint . startswith ( '.' ) : if request . blueprint is not None : endpoint = request . blueprint + endpoint else : endpoint = endpoint [ 1 : ] if _external is None : _external = False elif app_context is not None : url_adapter = app_context . url_adapter if _external is None : _external = True else : raise RuntimeError ( 'Cannot create a url outside of an application context' ) if url_adapter is None : raise RuntimeError ( 'Unable to create a url adapter, try setting the the SERVER_NAME config variable.' ) if _scheme is not None and not _external : raise ValueError ( 'External must be True for scheme usage' ) app_context . app . inject_url_defaults ( endpoint , values ) try : url = url_adapter . build ( endpoint , values , method = _method , scheme = _scheme , external = _external , ) except BuildError as error : return app_context . app . handle_url_build_error ( error , endpoint , values ) if _anchor is not None : quoted_anchor = quote ( _anchor ) url = f"{url}#{quoted_anchor}" return url | Return the url for a specific endpoint . | 375 | 8 |
225,749 | def stream_with_context ( func : Callable ) -> Callable : request_context = _request_ctx_stack . top . copy ( ) @ wraps ( func ) async def generator ( * args : Any , * * kwargs : Any ) -> Any : async with request_context : async for data in func ( * args , * * kwargs ) : yield data return generator | Share the current request context with a generator . | 83 | 9 |
225,750 | def safe_join ( directory : FilePath , * paths : FilePath ) -> Path : try : safe_path = file_path_to_path ( directory ) . resolve ( strict = True ) full_path = file_path_to_path ( directory , * paths ) . resolve ( strict = True ) except FileNotFoundError : raise NotFound ( ) try : full_path . relative_to ( safe_path ) except ValueError : raise NotFound ( ) return full_path | Safely join the paths to the known directory to return a full path . | 104 | 15 |
225,751 | async def send_from_directory ( directory : FilePath , file_name : str , * , mimetype : Optional [ str ] = None , as_attachment : bool = False , attachment_filename : Optional [ str ] = None , add_etags : bool = True , cache_timeout : Optional [ int ] = None , conditional : bool = True , last_modified : Optional [ datetime ] = None , ) -> Response : file_path = safe_join ( directory , file_name ) if not file_path . is_file ( ) : raise NotFound ( ) return await send_file ( file_path , mimetype = mimetype , as_attachment = as_attachment , attachment_filename = attachment_filename , add_etags = add_etags , cache_timeout = cache_timeout , conditional = conditional , last_modified = last_modified , ) | Send a file from a given directory . | 193 | 8 |
225,752 | async def send_file ( filename : FilePath , mimetype : Optional [ str ] = None , as_attachment : bool = False , attachment_filename : Optional [ str ] = None , add_etags : bool = True , cache_timeout : Optional [ int ] = None , conditional : bool = False , last_modified : Optional [ datetime ] = None , ) -> Response : file_path = file_path_to_path ( filename ) if attachment_filename is None : attachment_filename = file_path . name if mimetype is None : mimetype = mimetypes . guess_type ( attachment_filename ) [ 0 ] or DEFAULT_MIMETYPE file_body = current_app . response_class . file_body_class ( file_path ) response = current_app . response_class ( file_body , mimetype = mimetype ) if as_attachment : response . headers . add ( 'Content-Disposition' , 'attachment' , filename = attachment_filename ) if last_modified is not None : response . last_modified = last_modified else : response . last_modified = datetime . fromtimestamp ( file_path . stat ( ) . st_mtime ) response . cache_control . public = True cache_timeout = cache_timeout or current_app . get_send_file_max_age ( file_path ) if cache_timeout is not None : response . cache_control . max_age = cache_timeout response . expires = datetime . utcnow ( ) + timedelta ( seconds = cache_timeout ) if add_etags : response . set_etag ( '{}-{}-{}' . format ( file_path . stat ( ) . st_mtime , file_path . stat ( ) . st_size , adler32 ( bytes ( file_path ) ) , ) , ) if conditional : await response . make_conditional ( request . range ) return response | Return a Reponse to send the filename given . | 430 | 10 |
225,753 | def _render_frame ( self ) : frame = self . frame ( ) output = '\r{0}' . format ( frame ) self . clear ( ) try : self . _stream . write ( output ) except UnicodeEncodeError : self . _stream . write ( encode_utf_8_text ( output ) ) | Renders the frame on the line after clearing it . | 70 | 11 |
225,754 | def get_environment ( ) : try : from IPython import get_ipython except ImportError : return 'terminal' try : shell = get_ipython ( ) . __class__ . __name__ if shell == 'ZMQInteractiveShell' : # Jupyter notebook or qtconsole return 'jupyter' elif shell == 'TerminalInteractiveShell' : # Terminal running IPython return 'ipython' else : return 'terminal' # Other type (?) except NameError : return 'terminal' | Get the environment in which halo is running | 115 | 9 |
225,755 | def is_text_type ( text ) : if isinstance ( text , six . text_type ) or isinstance ( text , six . string_types ) : return True return False | Check if given parameter is a string or not | 39 | 9 |
225,756 | def find_stateless_by_name ( name ) : try : dsa_app = StatelessApp . objects . get ( app_name = name ) # pylint: disable=no-member return dsa_app . as_dash_app ( ) except : # pylint: disable=bare-except pass dash_app = get_stateless_by_name ( name ) dsa_app = StatelessApp ( app_name = name ) dsa_app . save ( ) return dash_app | Find stateless app given its name | 112 | 7 |
225,757 | def as_dash_app ( self ) : dateless_dash_app = getattr ( self , '_stateless_dash_app_instance' , None ) if not dateless_dash_app : dateless_dash_app = get_stateless_by_name ( self . app_name ) setattr ( self , '_stateless_dash_app_instance' , dateless_dash_app ) return dateless_dash_app | Return a DjangoDash instance of the dash application | 98 | 9 |
225,758 | def handle_current_state ( self ) : if getattr ( self , '_current_state_hydrated_changed' , False ) and self . save_on_change : new_base_state = json . dumps ( getattr ( self , '_current_state_hydrated' , { } ) ) if new_base_state != self . base_state : self . base_state = new_base_state self . save ( ) | Check to see if the current hydrated state and the saved state are different . | 97 | 16 |
225,759 | def have_current_state_entry ( self , wid , key ) : cscoll = self . current_state ( ) c_state = cscoll . get ( wid , { } ) return key in c_state | Return True if there is a cached current state for this app | 48 | 12 |
225,760 | def current_state ( self ) : c_state = getattr ( self , '_current_state_hydrated' , None ) if not c_state : c_state = json . loads ( self . base_state ) setattr ( self , '_current_state_hydrated' , c_state ) setattr ( self , '_current_state_hydrated_changed' , False ) return c_state | Return the current internal state of the model instance . | 91 | 10 |
225,761 | def as_dash_instance ( self , cache_id = None ) : dash_app = self . stateless_app . as_dash_app ( ) # pylint: disable=no-member base = self . current_state ( ) return dash_app . do_form_dash_instance ( replacements = base , specific_identifier = self . slug , cache_id = cache_id ) | Return a dash application instance for this model instance | 87 | 9 |
225,762 | def _get_base_state ( self ) : base_app_inst = self . stateless_app . as_dash_app ( ) . as_dash_instance ( ) # pylint: disable=no-member # Get base layout response, from a base object base_resp = base_app_inst . locate_endpoint_function ( 'dash-layout' ) ( ) base_obj = json . loads ( base_resp . data . decode ( 'utf-8' ) ) # Walk the base layout and find all values; insert into base state map obj = { } base_app_inst . walk_tree_and_extract ( base_obj , obj ) return obj | Get the base state of the object as defined by the app . layout code as a python dict | 149 | 19 |
225,763 | def populate_values ( self ) : obj = self . _get_base_state ( ) self . base_state = json . dumps ( obj ) | Add values from the underlying dash layout configuration | 32 | 8 |
225,764 | def locate_item ( ident , stateless = False , cache_id = None ) : if stateless : dash_app = find_stateless_by_name ( ident ) else : dash_app = get_object_or_404 ( DashApp , slug = ident ) app = dash_app . as_dash_instance ( cache_id = cache_id ) return dash_app , app | Locate a dash application given either the slug of an instance or the name for a stateless app | 85 | 20 |
225,765 | def send_to_pipe_channel ( channel_name , label , value ) : async_to_sync ( async_send_to_pipe_channel ) ( channel_name = channel_name , label = label , value = value ) | Send message through pipe to client component | 51 | 7 |
225,766 | async def async_send_to_pipe_channel ( channel_name , label , value ) : pcn = _form_pipe_channel_name ( channel_name ) channel_layer = get_channel_layer ( ) await channel_layer . group_send ( pcn , { "type" : "pipe.value" , "label" : label , "value" : value } ) | Send message asynchronously through pipe to client component | 85 | 10 |
225,767 | def pipe_value ( self , message ) : jmsg = json . dumps ( message ) self . send ( jmsg ) | Send a new value into the ws pipe | 26 | 9 |
225,768 | def update_pipe_channel ( self , uid , channel_name , label ) : # pylint: disable=unused-argument pipe_group_name = _form_pipe_channel_name ( channel_name ) if self . channel_layer : current = self . channel_maps . get ( uid , None ) if current != pipe_group_name : if current : async_to_sync ( self . channel_layer . group_discard ) ( current , self . channel_name ) self . channel_maps [ uid ] = pipe_group_name async_to_sync ( self . channel_layer . group_add ) ( pipe_group_name , self . channel_name ) | Update this consumer to listen on channel_name for the js widget associated with uid | 153 | 17 |
225,769 | def store_initial_arguments ( request , initial_arguments = None ) : if initial_arguments is None : return None # Generate a cache id cache_id = "dpd-initial-args-%s" % str ( uuid . uuid4 ( ) ) . replace ( '-' , '' ) # Store args in json form in cache if initial_argument_location ( ) : cache . set ( cache_id , initial_arguments , cache_timeout_initial_arguments ( ) ) else : request . session [ cache_id ] = initial_arguments return cache_id | Store initial arguments if any and return a cache identifier | 129 | 10 |
225,770 | def get_initial_arguments ( request , cache_id = None ) : if cache_id is None : return None if initial_argument_location ( ) : return cache . get ( cache_id ) return request . session [ cache_id ] | Extract initial arguments for the dash app | 53 | 8 |
225,771 | def dependencies ( request , ident , stateless = False , * * kwargs ) : _ , app = DashApp . locate_item ( ident , stateless ) with app . app_context ( ) : view_func = app . locate_endpoint_function ( 'dash-dependencies' ) resp = view_func ( ) return HttpResponse ( resp . data , content_type = resp . mimetype ) | Return the dependencies | 90 | 3 |
225,772 | def layout ( request , ident , stateless = False , cache_id = None , * * kwargs ) : _ , app = DashApp . locate_item ( ident , stateless ) view_func = app . locate_endpoint_function ( 'dash-layout' ) resp = view_func ( ) initial_arguments = get_initial_arguments ( request , cache_id ) response_data , mimetype = app . augment_initial_layout ( resp , initial_arguments ) return HttpResponse ( response_data , content_type = mimetype ) | Return the layout of the dash application | 125 | 7 |
225,773 | def update ( request , ident , stateless = False , * * kwargs ) : dash_app , app = DashApp . locate_item ( ident , stateless ) request_body = json . loads ( request . body . decode ( 'utf-8' ) ) if app . use_dash_dispatch ( ) : # Force call through dash view_func = app . locate_endpoint_function ( 'dash-update-component' ) import flask with app . test_request_context ( ) : # Fudge request object # pylint: disable=protected-access flask . request . _cached_json = ( request_body , flask . request . _cached_json [ True ] ) resp = view_func ( ) else : # Use direct dispatch with extra arguments in the argMap app_state = request . session . get ( "django_plotly_dash" , dict ( ) ) arg_map = { 'dash_app_id' : ident , 'dash_app' : dash_app , 'user' : request . user , 'session_state' : app_state } resp = app . dispatch_with_args ( request_body , arg_map ) request . session [ 'django_plotly_dash' ] = app_state dash_app . handle_current_state ( ) # Special for ws-driven edge case if str ( resp ) == 'EDGECASEEXIT' : return HttpResponse ( "" ) # Change in returned value type try : rdata = resp . data rtype = resp . mimetype except : rdata = resp rtype = "application/json" return HttpResponse ( rdata , content_type = rtype ) | Generate update json response | 368 | 5 |
225,774 | def main_view ( request , ident , stateless = False , cache_id = None , * * kwargs ) : _ , app = DashApp . locate_item ( ident , stateless , cache_id = cache_id ) view_func = app . locate_endpoint_function ( ) resp = view_func ( ) return HttpResponse ( resp ) | Main view for a dash app | 79 | 6 |
225,775 | def app_assets ( request , * * kwargs ) : get_params = request . GET . urlencode ( ) extra_part = "" if get_params : redone_url = "/static/dash/assets/%s?%s" % ( extra_part , get_params ) else : redone_url = "/static/dash/assets/%s" % extra_part return HttpResponseRedirect ( redirect_to = redone_url ) | Return a local dash app asset served up through the Django static framework | 102 | 13 |
225,776 | def add_to_session ( request , template_name = "index.html" , * * kwargs ) : django_plotly_dash = request . session . get ( "django_plotly_dash" , dict ( ) ) session_add_count = django_plotly_dash . get ( 'add_counter' , 0 ) django_plotly_dash [ 'add_counter' ] = session_add_count + 1 request . session [ 'django_plotly_dash' ] = django_plotly_dash return TemplateResponse ( request , template_name , { } ) | Add some info to a session in a place that django - plotly - dash can pass to a callback | 135 | 22 |
225,777 | def asset_redirection ( request , path , ident = None , stateless = False , * * kwargs ) : X , app = DashApp . locate_item ( ident , stateless ) # Redirect to a location based on the import path of the module containing the DjangoDash app static_path = X . get_asset_static_url ( path ) return redirect ( static_path ) | Redirect static assets for a component | 85 | 7 |
225,778 | def dash_example_1_view ( request , template_name = "demo_six.html" , * * kwargs ) : context = { } # create some context to send over to Dash: dash_context = request . session . get ( "django_plotly_dash" , dict ( ) ) dash_context [ 'django_to_dash_context' ] = "I am Dash receiving context from Django" request . session [ 'django_plotly_dash' ] = dash_context return render ( request , template_name = template_name , context = context ) | Example view that inserts content into the dash context passed to the dash application | 129 | 14 |
225,779 | def session_state_view ( request , template_name , * * kwargs ) : session = request . session demo_count = session . get ( 'django_plotly_dash' , { } ) ind_use = demo_count . get ( 'ind_use' , 0 ) ind_use += 1 demo_count [ 'ind_use' ] = ind_use context = { 'ind_use' : ind_use } session [ 'django_plotly_dash' ] = demo_count return render ( request , template_name = template_name , context = context ) | Example view that exhibits the use of sessions to store state | 129 | 11 |
225,780 | def adjust_response ( self , response ) : try : c1 = self . _replace ( response . content , self . header_placeholder , self . embedded_holder . css ) response . content = self . _replace ( c1 , self . footer_placeholder , "\n" . join ( [ self . embedded_holder . config , self . embedded_holder . scripts ] ) ) except AttributeError : # Catch the "FileResponse instance has no `content` attribute" error when serving media files in the Django development server. pass return response | Locate placeholder magic strings and replace with content | 118 | 9 |
225,781 | def callback_c ( * args , * * kwargs ) : #da = kwargs['dash_app'] session_state = kwargs [ 'session_state' ] calls_so_far = session_state . get ( 'calls_so_far' , 0 ) session_state [ 'calls_so_far' ] = calls_so_far + 1 user_counts = session_state . get ( 'user_counts' , None ) user_name = str ( kwargs [ 'user' ] ) if user_counts is None : user_counts = { user_name : 1 } session_state [ 'user_counts' ] = user_counts else : user_counts [ user_name ] = user_counts . get ( user_name , 0 ) + 1 return "Args are [%s] and kwargs are %s" % ( "," . join ( args ) , str ( kwargs ) ) | Update the output following a change of the input selection | 215 | 10 |
225,782 | def callback_liveIn_button_press ( red_clicks , blue_clicks , green_clicks , rc_timestamp , bc_timestamp , gc_timestamp , * * kwargs ) : # pylint: disable=unused-argument if not rc_timestamp : rc_timestamp = 0 if not bc_timestamp : bc_timestamp = 0 if not gc_timestamp : gc_timestamp = 0 if ( rc_timestamp + bc_timestamp + gc_timestamp ) < 1 : change_col = None timestamp = 0 else : if rc_timestamp > bc_timestamp : change_col = "red" timestamp = rc_timestamp else : change_col = "blue" timestamp = bc_timestamp if gc_timestamp > timestamp : timestamp = gc_timestamp change_col = "green" value = { 'red_clicks' : red_clicks , 'blue_clicks' : blue_clicks , 'green_clicks' : green_clicks , 'click_colour' : change_col , 'click_timestamp' : timestamp , 'user' : str ( kwargs . get ( 'user' , 'UNKNOWN' ) ) } send_to_pipe_channel ( channel_name = "live_button_counter" , label = "named_counts" , value = value ) return "Number of local clicks so far is %s red and %s blue; last change is %s at %s" % ( red_clicks , blue_clicks , change_col , datetime . fromtimestamp ( 0.001 * timestamp ) ) | Input app button pressed so do something interesting | 363 | 8 |
225,783 | def generate_liveOut_layout ( ) : return html . Div ( [ dpd . Pipe ( id = "named_count_pipe" , value = None , label = "named_counts" , channel_name = "live_button_counter" ) , html . Div ( id = "internal_state" , children = "No state has been computed yet" , style = { 'display' : 'none' } ) , dcc . Graph ( id = "timeseries_plot" ) , dcc . Input ( value = str ( uuid . uuid4 ( ) ) , id = "state_uid" , style = { 'display' : 'none' } , ) ] ) | Generate the layout per - app generating each tine a new uuid for the state_uid argument | 150 | 21 |
225,784 | def callback_liveOut_pipe_in ( named_count , state_uid , * * kwargs ) : cache_key = _get_cache_key ( state_uid ) state = cache . get ( cache_key ) # If nothing in cache, prepopulate if not state : state = { } # Guard against missing input on startup if not named_count : named_count = { } # extract incoming info from the message and update the internal state user = named_count . get ( 'user' , None ) click_colour = named_count . get ( 'click_colour' , None ) click_timestamp = named_count . get ( 'click_timestamp' , 0 ) if click_colour : colour_set = state . get ( click_colour , None ) if not colour_set : colour_set = [ ( None , 0 , 100 ) for i in range ( 5 ) ] _ , last_ts , prev = colour_set [ - 1 ] # Loop over all existing timestamps and find the latest one if not click_timestamp or click_timestamp < 1 : click_timestamp = 0 for _ , the_colour_set in state . items ( ) : _ , lts , _ = the_colour_set [ - 1 ] if lts > click_timestamp : click_timestamp = lts click_timestamp = click_timestamp + 1000 if click_timestamp > last_ts : colour_set . append ( ( user , click_timestamp , prev * random . lognormvariate ( 0.0 , 0.1 ) ) , ) colour_set = colour_set [ - 100 : ] state [ click_colour ] = colour_set cache . set ( cache_key , state , 3600 ) return "(%s,%s)" % ( cache_key , click_timestamp ) | Handle something changing the value of the input pipe or the associated state uid | 400 | 15 |
225,785 | def callback_show_timeseries ( internal_state_string , state_uid , * * kwargs ) : cache_key = _get_cache_key ( state_uid ) state = cache . get ( cache_key ) # If nothing in cache, prepopulate if not state : state = { } colour_series = { } colors = { 'red' : '#FF0000' , 'blue' : '#0000FF' , 'green' : '#00FF00' , 'yellow' : '#FFFF00' , 'cyan' : '#00FFFF' , 'magenta' : '#FF00FF' , 'black' : '#000000' , } for colour , values in state . items ( ) : timestamps = [ datetime . fromtimestamp ( int ( 0.001 * ts ) ) for _ , ts , _ in values if ts > 0 ] #users = [user for user, ts, _ in values if ts > 0] levels = [ level for _ , ts , level in values if ts > 0 ] if colour in colors : colour_series [ colour ] = pd . Series ( levels , index = timestamps ) . groupby ( level = 0 ) . first ( ) df = pd . DataFrame ( colour_series ) . fillna ( method = "ffill" ) . reset_index ( ) [ - 25 : ] traces = [ go . Scatter ( y = df [ colour ] , x = df [ 'index' ] , name = colour , line = dict ( color = colors . get ( colour , '#000000' ) ) , ) for colour in colour_series ] return { 'data' : traces , #'layout': go.Layout } | Build a timeseries from the internal state | 372 | 8 |
225,786 | def session_demo_danger_callback ( da_children , session_state = None , * * kwargs ) : if not session_state : return "Session state not yet available" return "Session state contains: " + str ( session_state . get ( 'bootstrap_demo_state' , "NOTHING" ) ) + " and the page render count is " + str ( session_state . get ( "ind_use" , "NOT SET" ) ) | Update output based just on state | 104 | 6 |
225,787 | def session_demo_alert_callback ( n_clicks , session_state = None , * * kwargs ) : if session_state is None : raise NotImplementedError ( "Cannot handle a missing session state" ) csf = session_state . get ( 'bootstrap_demo_state' , None ) if not csf : csf = dict ( clicks = 0 ) session_state [ 'bootstrap_demo_state' ] = csf else : csf [ 'clicks' ] = n_clicks return "Button has been clicked %s times since the page was rendered" % n_clicks | Output text based on both app state and session state | 139 | 10 |
225,788 | def add_usable_app ( name , app ) : name = slugify ( name ) global usable_apps # pylint: disable=global-statement usable_apps [ name ] = app return name | Add app to local registry by name | 43 | 7 |
225,789 | def get_base_pathname ( self , specific_identifier , cache_id ) : if not specific_identifier : app_pathname = "%s:app-%s" % ( app_name , main_view_label ) ndid = self . _uid else : app_pathname = "%s:%s" % ( app_name , main_view_label ) ndid = specific_identifier kwargs = { 'ident' : ndid } if cache_id : kwargs [ 'cache_id' ] = cache_id app_pathname = app_pathname + "--args" full_url = reverse ( app_pathname , kwargs = kwargs ) if full_url [ - 1 ] != '/' : full_url = full_url + '/' return ndid , full_url | Base path name of this instance taking into account any state or statelessness | 184 | 14 |
225,790 | def do_form_dash_instance ( self , replacements = None , specific_identifier = None , cache_id = None ) : ndid , base_pathname = self . get_base_pathname ( specific_identifier , cache_id ) return self . form_dash_instance ( replacements , ndid , base_pathname ) | Perform the act of constructing a Dash instance taking into account state | 74 | 13 |
225,791 | def form_dash_instance ( self , replacements = None , ndid = None , base_pathname = None ) : if ndid is None : ndid = self . _uid rd = WrappedDash ( base_pathname = base_pathname , expanded_callbacks = self . _expanded_callbacks , replacements = replacements , ndid = ndid , serve_locally = self . _serve_locally ) rd . layout = self . layout rd . config [ 'suppress_callback_exceptions' ] = self . _suppress_callback_exceptions for cb , func in self . _callback_sets : rd . callback ( * * cb ) ( func ) for s in self . css . items : rd . css . append_css ( s ) for s in self . scripts . items : rd . scripts . append_script ( s ) return rd | Construct a Dash instance taking into account state | 199 | 8 |
225,792 | def callback ( self , output , inputs = None , state = None , events = None ) : callback_set = { 'output' : output , 'inputs' : inputs and inputs or dict ( ) , 'state' : state and state or dict ( ) , 'events' : events and events or dict ( ) } def wrap_func ( func , callback_set = callback_set , callback_sets = self . _callback_sets ) : # pylint: disable=dangerous-default-value, missing-docstring callback_sets . append ( ( callback_set , func ) ) return func return wrap_func | Form a callback function by wrapping in the same way as the underlying Dash application would | 133 | 16 |
225,793 | def expanded_callback ( self , output , inputs = [ ] , state = [ ] , events = [ ] ) : # pylint: disable=dangerous-default-value self . _expanded_callbacks = True return self . callback ( output , inputs , state , events ) | Form an expanded callback . | 61 | 5 |
225,794 | def augment_initial_layout ( self , base_response , initial_arguments = None ) : if self . use_dash_layout ( ) and not initial_arguments and False : return base_response . data , base_response . mimetype # Adjust the base layout response baseDataInBytes = base_response . data baseData = json . loads ( baseDataInBytes . decode ( 'utf-8' ) ) # Also add in any initial arguments if initial_arguments : if isinstance ( initial_arguments , str ) : initial_arguments = json . loads ( initial_arguments ) # Walk tree. If at any point we have an element whose id # matches, then replace any named values at this level reworked_data = self . walk_tree_and_replace ( baseData , initial_arguments ) response_data = json . dumps ( reworked_data , cls = PlotlyJSONEncoder ) return response_data , base_response . mimetype | Add application state to initial values | 212 | 6 |
225,795 | def walk_tree_and_extract ( self , data , target ) : if isinstance ( data , dict ) : for key in [ 'children' , 'props' , ] : self . walk_tree_and_extract ( data . get ( key , None ) , target ) ident = data . get ( 'id' , None ) if ident is not None : idVals = target . get ( ident , { } ) for key , value in data . items ( ) : if key not in [ 'props' , 'options' , 'children' , 'id' ] : idVals [ key ] = value if idVals : target [ ident ] = idVals if isinstance ( data , list ) : for element in data : self . walk_tree_and_extract ( element , target ) | Walk tree of properties and extract identifiers and associated values | 178 | 10 |
225,796 | def walk_tree_and_replace ( self , data , overrides ) : if isinstance ( data , dict ) : response = { } replacements = { } # look for id entry thisID = data . get ( 'id' , None ) if thisID is not None : replacements = overrides . get ( thisID , None ) if overrides else None if not replacements : replacements = self . _replacements . get ( thisID , { } ) # walk all keys and replace if needed for k , v in data . items ( ) : r = replacements . get ( k , None ) if r is None : r = self . walk_tree_and_replace ( v , overrides ) response [ k ] = r return response if isinstance ( data , list ) : # process each entry in turn and return return [ self . walk_tree_and_replace ( x , overrides ) for x in data ] return data | Walk the tree . Rely on json decoding to insert instances of dict and list ie we use a dna test for anatine rather than our eyes and ears ... | 196 | 33 |
225,797 | def locate_endpoint_function ( self , name = None ) : if name is not None : ep = "%s_%s" % ( self . _base_pathname , name ) else : ep = self . _base_pathname return self . _notflask . endpoints [ ep ] [ 'view_func' ] | Locate endpoint function given name of view | 72 | 8 |
225,798 | def layout ( self , value ) : if self . _adjust_id : self . _fix_component_id ( value ) return Dash . layout . fset ( self , value ) | Overloaded layout function to fix component names as needed | 39 | 10 |
225,799 | def _fix_component_id ( self , component ) : theID = getattr ( component , "id" , None ) if theID is not None : setattr ( component , "id" , self . _fix_id ( theID ) ) try : for c in component . children : self . _fix_component_id ( c ) except : #pylint: disable=bare-except pass | Fix name of component ad all of its children | 87 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.