idx int64 0 252k | question stringlengths 48 5.28k | target stringlengths 5 1.23k |
|---|---|---|
231,900 | def authn_request ( self , context , entity_id ) : if self . idp_blacklist_file : with open ( self . idp_blacklist_file ) as blacklist_file : blacklist_array = json . load ( blacklist_file ) [ 'blacklist' ] if entity_id in blacklist_array : satosa_logging ( logger , logging . DEBUG , "IdP with EntityID {} is blackliste... | Do an authorization request on idp with given entity id . This is the start of the authorization . |
231,901 | def disco_response ( self , context ) : info = context . request state = context . state try : entity_id = info [ "entityID" ] except KeyError as err : satosa_logging ( logger , logging . DEBUG , "No IDP chosen for state" , state , exc_info = True ) raise SATOSAAuthenticationError ( state , "No IDP chosen" ) from err r... | Endpoint for the discovery server response |
231,902 | def _translate_response ( self , response , state ) : if self . encryption_keys : response . parse_assertion ( self . encryption_keys ) authn_info = response . authn_info ( ) [ 0 ] auth_class_ref = authn_info [ 0 ] timestamp = response . assertion . authn_statement [ 0 ] . authn_instant issuer = response . response . i... | Translates a saml authorization response to an internal response |
231,903 | def to_internal_filter ( self , attribute_profile , external_attribute_names ) : try : profile_mapping = self . to_internal_attributes [ attribute_profile ] except KeyError : logger . warn ( "no attribute mapping found for the given attribute profile '%s'" , attribute_profile ) return [ ] internal_attribute_names = set... | Converts attribute names from external type to internal |
231,904 | def to_internal ( self , attribute_profile , external_dict ) : internal_dict = { } for internal_attribute_name , mapping in self . from_internal_attributes . items ( ) : if attribute_profile not in mapping : logger . debug ( "no attribute mapping found for internal attribute '%s' the attribute profile '%s'" % ( interna... | Converts the external data from type to internal |
231,905 | def from_internal ( self , attribute_profile , internal_dict ) : external_dict = { } for internal_attribute_name in internal_dict : try : attribute_mapping = self . from_internal_attributes [ internal_attribute_name ] except KeyError : logger . debug ( "no attribute mapping found for the internal attribute '%s'" , inte... | Converts the internal data to type |
231,906 | def _serialize ( self , version , serialize_format , context , raise_if_incomplete = False ) : values = context . copy ( ) for k in version : values [ k ] = version [ k ] try : serialized = serialize_format . format ( ** values ) except KeyError as e : missing_key = getattr ( e , "message" , e . args [ 0 ] ) raise Miss... | Attempts to serialize a version with the given serialization format . |
231,907 | def value_text ( self ) : search = self . _selected . get ( ) for item in self . _rbuttons : if item . value == search : return item . text return "" | Sets or returns the option selected in a ButtonGroup by its text value . |
231,908 | def append ( self , option ) : self . _options . append ( self . _parse_option ( option ) ) self . _refresh_options ( ) self . resize ( self . _width , self . _height ) | Appends a new option to the end of the ButtonGroup . |
231,909 | def insert ( self , index , option ) : self . _options . insert ( index , self . _parse_option ( option ) ) self . _refresh_options ( ) self . resize ( self . _width , self . _height ) | Insert a new option in the ButtonGroup at index . |
231,910 | def remove ( self , option ) : for existing_option in self . _options : if existing_option [ 1 ] == option : self . _options . remove ( existing_option ) self . _refresh_options ( ) return True return False | Removes the first option from the ButtonGroup . |
231,911 | def update_command ( self , command , args = None ) : if command is None : self . _command = lambda : None else : if args is None : self . _command = command else : self . _command = utils . with_args ( command , * args ) | Updates the callback command which is called when the ButtonGroup changes . |
231,912 | def insert ( self , index , option ) : option = str ( option ) self . _options . insert ( index , option ) if len ( self . _options ) == 1 : self . value = option self . _refresh_options ( ) | Insert a new option in the Combo at index . |
231,913 | def remove ( self , option ) : if option in self . _options : if len ( self . _options ) == 1 : self . clear ( ) else : self . _options . remove ( option ) self . _refresh_options ( ) if option == self . value : self . _set_option ( self . _options [ 0 ] ) return True else : return False | Removes the first option from the Combo . |
231,914 | def clear ( self ) : self . _options = [ ] self . _combo_menu . tk . delete ( 0 , END ) self . _selected . set ( "" ) | Clears all the options in a Combo |
231,915 | def _set_option ( self , value ) : if len ( self . _options ) > 0 : if value in self . _options : self . _selected . set ( value ) return True else : return False else : return False | Sets a single option in the Combo returning True if it was able too . |
231,916 | def _set_option_by_index ( self , index ) : if index < len ( self . _options ) : self . _selected . set ( self . _options [ index ] ) return True else : return False | Sets a single option in the Combo by its index returning True if it was able too . |
231,917 | def after ( self , time , function , args = [ ] ) : callback_id = self . tk . after ( time , self . _call_wrapper , time , function , * args ) self . _callback [ function ] = [ callback_id , False ] | Call function after time milliseconds . |
231,918 | def repeat ( self , time , function , args = [ ] ) : callback_id = self . tk . after ( time , self . _call_wrapper , time , function , * args ) self . _callback [ function ] = [ callback_id , True ] | Repeat function every time milliseconds . |
231,919 | def cancel ( self , function ) : if function in self . _callback . keys ( ) : callback_id = self . _callback [ function ] [ 0 ] self . tk . after_cancel ( callback_id ) self . _callback . pop ( function ) else : utils . error_format ( "Could not cancel function - it doesnt exist, it may have already run" ) | Cancel the scheduled function calls . |
231,920 | def _call_wrapper ( self , time , function , * args ) : function ( * args ) if function in self . _callback . keys ( ) : repeat = self . _callback [ function ] [ 1 ] if repeat : callback_id = self . tk . after ( time , self . _call_wrapper , time , function , * args ) self . _callback [ function ] [ 0 ] = callback_id e... | Fired by tk . after gets the callback and either executes the function and cancels or repeats |
231,921 | def rebind ( self , tks ) : self . _tks = tks for tk in self . _tks : tk . unbind_all ( self . _tk_event ) func_id = tk . bind ( self . _tk_event , self . _event_callback ) self . _func_ids . append ( func_id ) | Rebinds the tk event only used if a widget has been destroyed and recreated . |
231,922 | def rebind_events ( self , * tks ) : for ref in self . _refs : self . _refs [ ref ] . rebind ( tks ) | Rebinds all the tk events only used if a tk widget has been destroyed and recreated . |
231,923 | def set_border ( self , thickness , color = "black" ) : self . _set_tk_config ( "highlightthickness" , thickness ) self . _set_tk_config ( "highlightbackground" , utils . convert_color ( color ) ) | Sets the border thickness and color . |
231,924 | def hide ( self ) : self . tk . withdraw ( ) self . _visible = False if self . _modal : self . tk . grab_release ( ) | Hide the window . |
231,925 | def show ( self , wait = False ) : self . tk . deiconify ( ) self . _visible = True self . _modal = wait if self . _modal : self . tk . grab_set ( ) | Show the window . |
231,926 | def destroy ( self ) : if self == App . _main_app : App . _main_app = None self . tk . destroy ( ) | Destroy and close the App . |
231,927 | def line ( self , x1 , y1 , x2 , y2 , color = "black" , width = 1 ) : return self . tk . create_line ( x1 , y1 , x2 , y2 , width = width , fill = "" if color is None else utils . convert_color ( color ) ) | Draws a line between 2 points |
231,928 | def oval ( self , x1 , y1 , x2 , y2 , color = "black" , outline = False , outline_color = "black" ) : return self . tk . create_oval ( x1 , y1 , x2 , y2 , outline = utils . convert_color ( outline_color ) if outline else "" , width = int ( outline ) , fill = "" if color is None else utils . convert_color ( color ) ) | Draws an oval between 2 points |
231,929 | def rectangle ( self , x1 , y1 , x2 , y2 , color = "black" , outline = False , outline_color = "black" ) : return self . tk . create_rectangle ( x1 , y1 , x2 , y2 , outline = utils . convert_color ( outline_color ) if outline else "" , width = int ( outline ) , fill = "" if color is None else utils . convert_color ( co... | Draws a rectangle between 2 points |
231,930 | def polygon ( self , * coords , color = "black" , outline = False , outline_color = "black" ) : return self . tk . create_polygon ( * coords , outline = utils . convert_color ( outline_color ) if outline else "" , width = int ( outline ) , fill = "" if color is None else utils . convert_color ( color ) ) | Draws a polygon from an list of co - ordinates |
231,931 | def triangle ( self , x1 , y1 , x2 , y2 , x3 , y3 , color = "black" , outline = False , outline_color = "black" ) : return self . polygon ( x1 , y1 , x2 , y2 , x3 , y3 , color = color , outline = outline , outline_color = outline_color ) | Draws a triangle between 3 points |
231,932 | def _get_tk_config ( self , key , default = False ) : if default : return self . _tk_defaults [ key ] else : return self . tk [ key ] | Gets the config from the widget s tk object . |
231,933 | def _set_tk_config ( self , keys , value ) : if isinstance ( keys , str ) : keys = [ keys ] for key in keys : if key in self . tk . keys ( ) : if value is None : self . tk [ key ] = self . _tk_defaults [ key ] else : self . tk [ key ] = value | Gets the config from the widget s tk object |
231,934 | def destroy ( self ) : if self . master is not None : self . master . _remove_child ( self ) self . tk . destroy ( ) | Destroy the tk widget . |
231,935 | def add_tk_widget ( self , tk_widget , grid = None , align = None , visible = True , enabled = None , width = None , height = None ) : return Widget ( self , tk_widget , "tk widget" , grid , align , visible , enabled , width , height ) | Adds a tk widget into a guizero container . |
231,936 | def display_widgets ( self ) : for child in self . children : if child . displayable : if self . layout != "grid" : child . tk . pack_forget ( ) else : child . tk . grid_forget ( ) if child . visible : if self . layout != "grid" : self . _pack_widget ( child ) else : self . _grid_widget ( child ) | Displays all the widgets associated with this Container . |
231,937 | def disable ( self ) : self . _enabled = False for child in self . children : if isinstance ( child , ( Container , Widget ) ) : child . disable ( ) | Disable all the widgets in this container |
231,938 | def enable ( self ) : self . _enabled = True for child in self . children : if isinstance ( child , ( Container , Widget ) ) : child . enable ( ) | Enable all the widgets in this container |
231,939 | def exit_full_screen ( self ) : self . tk . attributes ( "-fullscreen" , False ) self . _full_screen = False self . events . remove_event ( "<FullScreen.Escape>" ) | Change from full screen to windowed mode and remove key binding |
231,940 | def _set_propagation ( self , width , height ) : if width is None : width = 0 if height is None : height = 0 propagate_function = self . tk . pack_propagate if self . layout == "grid" : propagate_function = self . tk . grid_propagate propagate_value = True if isinstance ( width , int ) : if width > 0 : propagate_value ... | Set the propagation value of the tk widget dependent on the width and height |
231,941 | def load ( self , addr , ty ) : rdt = self . irsb_c . load ( addr . rdt , ty ) return VexValue ( self . irsb_c , rdt ) | Load a value from memory into a VEX temporary register . |
231,942 | def constant ( self , val , ty ) : if isinstance ( val , VexValue ) and not isinstance ( val , IRExpr ) : raise Exception ( 'Constant cannot be made from VexValue or IRExpr' ) rdt = self . irsb_c . mkconst ( val , ty ) return VexValue ( self . irsb_c , rdt ) | Creates a constant as a VexValue |
231,943 | def put ( self , val , reg ) : offset = self . lookup_register ( self . irsb_c . irsb . arch , reg ) self . irsb_c . put ( val . rdt , offset ) | Puts a value from a VEX temporary register into a machine register . This is how the results of operations done to registers get committed to the machine s state . |
231,944 | def put_conditional ( self , cond , valiftrue , valiffalse , reg ) : val = self . irsb_c . ite ( cond . rdt , valiftrue . rdt , valiffalse . rdt ) offset = self . lookup_register ( self . irsb_c . irsb . arch , reg ) self . irsb_c . put ( val , offset ) | Like put except it checks a condition to decide what to put in the destination register . |
231,945 | def store ( self , val , addr ) : self . irsb_c . store ( addr . rdt , val . rdt ) | Store a VexValue in memory at the specified loaction . |
231,946 | def jump ( self , condition , to_addr , jumpkind = JumpKind . Boring , ip_offset = None ) : to_addr_ty = None if isinstance ( to_addr , VexValue ) : to_addr_rdt = to_addr . rdt to_addr_ty = to_addr . ty elif isinstance ( to_addr , int ) : to_addr_ty = vex_int_class ( self . irsb_c . irsb . arch . bits ) . type to_addr ... | Jump to a specified destination under the specified condition . Used for branches jumps calls returns etc . |
231,947 | def register ( lifter , arch_name ) : if issubclass ( lifter , Lifter ) : l . debug ( "Registering lifter %s for architecture %s." , lifter . __name__ , arch_name ) lifters [ arch_name ] . append ( lifter ) if issubclass ( lifter , Postprocessor ) : l . debug ( "Registering postprocessor %s for architecture %s." , lift... | Registers a Lifter or Postprocessor to be used by pyvex . Lifters are are given priority based on the order in which they are registered . Postprocessors will be run in registration order . |
231,948 | def child_expressions ( self ) : expressions = [ ] for k in self . __slots__ : v = getattr ( self , k ) if isinstance ( v , IRExpr ) : expressions . append ( v ) expressions . extend ( v . child_expressions ) return expressions | A list of all of the expressions that this expression ends up evaluating . |
231,949 | def constants ( self ) : constants = [ ] for k in self . __slots__ : v = getattr ( self , k ) if isinstance ( v , IRExpr ) : constants . extend ( v . constants ) elif isinstance ( v , IRConst ) : constants . append ( v ) return constants | A list of all of the constants that this expression ends up using . |
231,950 | def expressions ( self ) : for s in self . statements : for expr_ in s . expressions : yield expr_ yield self . next | Return an iterator of all expressions contained in the IRSB . |
231,951 | def instructions ( self ) : if self . _instructions is None : if self . statements is None : self . _instructions = 0 else : self . _instructions = len ( [ s for s in self . statements if type ( s ) is stmt . IMark ] ) return self . _instructions | The number of instructions in this block |
231,952 | def instruction_addresses ( self ) : if self . _instruction_addresses is None : if self . statements is None : self . _instruction_addresses = [ ] else : self . _instruction_addresses = [ ( s . addr + s . delta ) for s in self . statements if type ( s ) is stmt . IMark ] return self . _instruction_addresses | Addresses of instructions in this block . |
231,953 | def size ( self ) : if self . _size is None : self . _size = sum ( s . len for s in self . statements if type ( s ) is stmt . IMark ) return self . _size | The size of this block in bytes |
231,954 | def operations ( self ) : ops = [ ] for e in self . expressions : if hasattr ( e , 'op' ) : ops . append ( e . op ) return ops | A list of all operations done by the IRSB as libVEX enum names |
231,955 | def constant_jump_targets ( self ) : exits = set ( ) if self . exit_statements : for _ , _ , stmt_ in self . exit_statements : exits . add ( stmt_ . dst . value ) default_target = self . default_exit_target if default_target is not None : exits . add ( default_target ) return exits | A set of the static jump targets of the basic block . |
231,956 | def constant_jump_targets_and_jumpkinds ( self ) : exits = dict ( ) if self . exit_statements : for _ , _ , stmt_ in self . exit_statements : exits [ stmt_ . dst . value ] = stmt_ . jumpkind default_target = self . default_exit_target if default_target is not None : exits [ default_target ] = self . jumpkind return exi... | A dict of the static jump targets of the basic block to their jumpkind . |
231,957 | def _pp_str ( self ) : sa = [ ] sa . append ( "IRSB {" ) if self . statements is not None : sa . append ( " %s" % self . tyenv ) sa . append ( "" ) if self . statements is not None : for i , s in enumerate ( self . statements ) : if isinstance ( s , stmt . Put ) : stmt_str = s . __str__ ( reg_name = self . arch . tra... | Return the pretty - printed IRSB . |
231,958 | def _is_defaultexit_direct_jump ( self ) : if not ( self . jumpkind == 'Ijk_InvalICache' or self . jumpkind == 'Ijk_Boring' or self . jumpkind == 'Ijk_Call' ) : return False target = self . default_exit_target return target is not None | Checks if the default of this IRSB a direct jump or not . |
231,959 | def lookup ( self , tmp ) : if tmp < 0 or tmp > self . types_used : l . debug ( "Invalid temporary number %d" , tmp ) raise IndexError ( tmp ) return self . types [ tmp ] | Return the type of temporary variable tmp as an enum string |
231,960 | def _lift ( self , data , bytes_offset = None , max_bytes = None , max_inst = None , opt_level = 1 , traceflags = None , allow_arch_optimizations = None , strict_block_end = None , skip_stmts = False , collect_data_refs = False ) : irsb = IRSB . empty_block ( self . arch , self . addr ) self . data = data self . bytes_... | Wrapper around the lift method on Lifters . Should not be overridden in child classes . |
231,961 | def exp_backoff ( attempt , cap = 3600 , base = 300 ) : max_attempts = math . log ( cap / base , 2 ) if attempt <= max_attempts : return base * 2 ** attempt return cap | Exponential backoff time |
231,962 | def get_proxy ( self , proxy_address ) : if not proxy_address : return None hostport = extract_proxy_hostport ( proxy_address ) return self . proxies_by_hostport . get ( hostport , None ) | Return complete proxy name associated with a hostport of a given proxy_address . If proxy_address is unkonwn or empty return None . |
231,963 | def mark_dead ( self , proxy , _time = None ) : if proxy not in self . proxies : logger . warn ( "Proxy <%s> was not found in proxies list" % proxy ) return if proxy in self . good : logger . debug ( "GOOD proxy became DEAD: <%s>" % proxy ) else : logger . debug ( "Proxy <%s> is DEAD" % proxy ) self . unchecked . disca... | Mark a proxy as dead |
231,964 | def mark_good ( self , proxy ) : if proxy not in self . proxies : logger . warn ( "Proxy <%s> was not found in proxies list" % proxy ) return if proxy not in self . good : logger . debug ( "Proxy <%s> is GOOD" % proxy ) self . unchecked . discard ( proxy ) self . dead . discard ( proxy ) self . good . add ( proxy ) sel... | Mark a proxy as good |
231,965 | def reanimate ( self , _time = None ) : n_reanimated = 0 now = _time or time . time ( ) for proxy in list ( self . dead ) : state = self . proxies [ proxy ] assert state . next_check is not None if state . next_check <= now : self . dead . remove ( proxy ) self . unchecked . add ( proxy ) n_reanimated += 1 return n_rea... | Move dead proxies to unchecked if a backoff timeout passes |
231,966 | def reset ( self ) : for proxy in list ( self . dead ) : self . dead . remove ( proxy ) self . unchecked . add ( proxy ) | Mark all dead proxies as unchecked |
231,967 | def on_change ( self , path , event_type ) : sql = cursor = self . _execute ( sql , ( path , ) ) results = cursor . fetchall ( ) for result in results : collection_id = result [ 0 ] sql = cursor = self . _execute ( sql , ( collection_id , ) ) self . _load_keywords ( collection_id , path = path ) | Respond to changes in the file system |
231,968 | def _load_keywords ( self , collection_id , path = None , libdoc = None ) : if libdoc is None and path is None : raise ( Exception ( "You must provide either a path or libdoc argument" ) ) if libdoc is None : libdoc = LibraryDocumentation ( path ) if len ( libdoc . keywords ) > 0 : for keyword in libdoc . keywords : se... | Load a collection of keywords |
231,969 | def add_file ( self , path ) : libdoc = LibraryDocumentation ( path ) if len ( libdoc . keywords ) > 0 : if libdoc . doc . startswith ( "Documentation for resource file" ) : libdoc . doc = "" collection_id = self . add_collection ( path , libdoc . name , libdoc . type , libdoc . doc , libdoc . version , libdoc . scope ... | Add a resource file or library file to the database |
231,970 | def add_library ( self , name ) : libdoc = LibraryDocumentation ( name ) if len ( libdoc . keywords ) > 0 : collection_id = self . add_collection ( None , libdoc . name , libdoc . type , libdoc . doc , libdoc . version , libdoc . scope , libdoc . named_args , libdoc . doc_format ) self . _load_keywords ( collection_id ... | Add a library to the database |
231,971 | def add_folder ( self , dirname , watch = True ) : ignore_file = os . path . join ( dirname , ".rfhubignore" ) exclude_patterns = [ ] try : with open ( ignore_file , "r" ) as f : exclude_patterns = [ ] for line in f . readlines ( ) : line = line . strip ( ) if ( re . match ( r'^\s*#' , line ) ) : continue if len ( line... | Recursively add all files in a folder to the database |
231,972 | def add_installed_libraries ( self , extra_libs = [ "Selenium2Library" , "SudsLibrary" , "RequestsLibrary" ] ) : libdir = os . path . dirname ( robot . libraries . __file__ ) loaded = [ ] for filename in os . listdir ( libdir ) : if filename . endswith ( ".py" ) or filename . endswith ( ".pyc" ) : libname , ext = os . ... | Add any installed libraries that we can find |
231,973 | def get_collection ( self , collection_id ) : sql = cursor = self . _execute ( sql , ( collection_id , collection_id ) ) sql_result = cursor . fetchone ( ) return { "collection_id" : sql_result [ 0 ] , "type" : sql_result [ 1 ] , "name" : sql_result [ 2 ] , "path" : sql_result [ 3 ] , "doc" : sql_result [ 4 ] , "versio... | Get a specific collection |
231,974 | def get_keyword ( self , collection_id , name ) : sql = cursor = self . _execute ( sql , ( collection_id , name ) ) row = cursor . fetchone ( ) if row is not None : return { "name" : row [ 0 ] , "args" : json . loads ( row [ 1 ] ) , "doc" : row [ 2 ] , "collection_id" : collection_id } return { } | Get a specific keyword from a library |
231,975 | def _looks_like_libdoc_file ( self , name ) : if name . lower ( ) . endswith ( ".xml" ) : with open ( name , "r" ) as f : data = f . read ( 200 ) index = data . lower ( ) . find ( "<keywordspec " ) if index > 0 : return True return False | Return true if an xml file looks like a libdoc file |
231,976 | def _looks_like_resource_file ( self , name ) : if ( re . search ( r'__init__.(txt|robot|html|tsv)$' , name ) ) : return False found_keyword_table = False if ( name . lower ( ) . endswith ( ".robot" ) or name . lower ( ) . endswith ( ".txt" ) or name . lower ( ) . endswith ( ".tsv" ) ) : with open ( name , "r" ) as f :... | Return true if the file has a keyword table but not a testcase table |
231,977 | def _should_ignore ( self , name ) : _name = name . lower ( ) return ( _name . startswith ( "deprecated" ) or _name . startswith ( "_" ) or _name in ( "remote" , "reserved" , "dialogs_py" , "dialogs_ipy" , "dialogs_jy" ) ) | Return True if a given library name should be ignored |
231,978 | def _execute ( self , * args ) : cursor = self . db . cursor ( ) cursor . execute ( * args ) return cursor | Execute an SQL query |
231,979 | def _glob_to_sql ( self , string ) : table = ( ( r'\\' , chr ( 1 ) ) , ( r'\*' , chr ( 2 ) ) , ( r'\?' , chr ( 3 ) ) , ( r'%' , r'\%' ) , ( r'?' , '_' ) , ( r'*' , '%' ) , ( chr ( 1 ) , r'\\' ) , ( chr ( 2 ) , r'\*' ) , ( chr ( 3 ) , r'\?' ) ) for ( a , b ) in table : string = string . replace ( a , b ) string = string... | Convert glob - like wildcards to SQL wildcards |
231,980 | def doc ( ) : kwdb = current_app . kwdb libraries = get_collections ( kwdb , libtype = "library" ) resource_files = get_collections ( kwdb , libtype = "resource" ) hierarchy = get_navpanel_data ( kwdb ) return flask . render_template ( "home.html" , data = { "libraries" : libraries , "version" : __version__ , "libdoc" ... | Show a list of libraries along with the nav panel on the left |
231,981 | def index ( ) : kwdb = current_app . kwdb libraries = get_collections ( kwdb , libtype = "library" ) resource_files = get_collections ( kwdb , libtype = "resource" ) return flask . render_template ( "libraryNames.html" , data = { "libraries" : libraries , "version" : __version__ , "resource_files" : resource_files } ) | Show a list of available libraries and resource files |
231,982 | def search ( ) : pattern = flask . request . args . get ( 'pattern' , "*" ) . strip ( ) . lower ( ) collections = [ c [ "name" ] . lower ( ) for c in current_app . kwdb . get_collections ( ) ] words = [ ] filters = [ ] if pattern . startswith ( "name:" ) : pattern = pattern [ 5 : ] . strip ( ) mode = "name" else : mode... | Show all keywords that match a pattern |
231,983 | def get_collections ( kwdb , libtype = "*" ) : collections = kwdb . get_collections ( libtype = libtype ) for result in collections : url = flask . url_for ( ".doc_for_library" , collection_id = result [ "collection_id" ] ) result [ "url" ] = url return collections | Get list of collections from kwdb then add urls necessary for hyperlinks |
231,984 | def get_navpanel_data ( kwdb ) : data = kwdb . get_keyword_hierarchy ( ) for library in data : library [ "url" ] = flask . url_for ( ".doc_for_library" , collection_id = library [ "collection_id" ] ) for keyword in library [ "keywords" ] : url = flask . url_for ( ".doc_for_library" , collection_id = library [ "collecti... | Get navpanel data from kwdb and add urls necessary for hyperlinks |
231,985 | def doc_to_html ( doc , doc_format = "ROBOT" ) : from robot . libdocpkg . htmlwriter import DocToHtml return DocToHtml ( doc_format ) ( doc ) | Convert documentation to HTML |
231,986 | def start ( self ) : if self . args . debug : self . app . run ( port = self . args . port , debug = self . args . debug , host = self . args . interface ) else : root = "http://%s:%s" % ( self . args . interface , self . args . port ) print ( "tornado web server running on " + root ) self . shutdown_requested = False ... | Start the app |
231,987 | def check_shutdown_flag ( self ) : if self . shutdown_requested : tornado . ioloop . IOLoop . instance ( ) . stop ( ) print ( "web server stopped." ) | Shutdown the server if the flag has been set |
231,988 | def coords ( obj ) : if 'features' in obj : for f in obj [ 'features' ] : for c in coords ( f ) : yield c else : if isinstance ( obj , ( tuple , list ) ) : coordinates = obj elif 'geometry' in obj : coordinates = obj [ 'geometry' ] [ 'coordinates' ] else : coordinates = obj . get ( 'coordinates' , obj ) for e in coordi... | Yields the coordinates from a Feature or Geometry . |
231,989 | def map_tuples ( func , obj ) : if obj [ 'type' ] == 'Point' : coordinates = tuple ( func ( obj [ 'coordinates' ] ) ) elif obj [ 'type' ] in [ 'LineString' , 'MultiPoint' ] : coordinates = [ tuple ( func ( c ) ) for c in obj [ 'coordinates' ] ] elif obj [ 'type' ] in [ 'MultiLineString' , 'Polygon' ] : coordinates = [ ... | Returns the mapped coordinates from a Geometry after applying the provided function to each coordinate . |
231,990 | def map_geometries ( func , obj ) : simple_types = [ 'Point' , 'LineString' , 'MultiPoint' , 'MultiLineString' , 'Polygon' , 'MultiPolygon' , ] if obj [ 'type' ] in simple_types : return func ( obj ) elif obj [ 'type' ] == 'GeometryCollection' : geoms = [ func ( geom ) if geom else None for geom in obj [ 'geometries' ]... | Returns the result of passing every geometry in the given geojson object through func . |
231,991 | def to_instance ( cls , ob , default = None , strict = False ) : if ob is None and default is not None : instance = default ( ) elif isinstance ( ob , GeoJSON ) : instance = ob else : mapping = to_mapping ( ob ) d = { } for k in mapping : d [ k ] = mapping [ k ] try : type_ = d . pop ( "type" ) try : type_ = str ( type... | Encode a GeoJSON dict into an GeoJSON object . Assumes the caller knows that the dict should satisfy a GeoJSON type . |
231,992 | def check_list_errors ( self , checkFunc , lst ) : results = ( checkFunc ( i ) for i in lst ) return [ err for err in results if err ] | Validation helper function . |
231,993 | def run_only_once ( self , keyword ) : lock_name = 'pabot_run_only_once_%s' % keyword try : self . acquire_lock ( lock_name ) passed = self . get_parallel_value_for_key ( lock_name ) if passed != '' : if passed == 'FAILED' : raise AssertionError ( 'Keyword failed in other process' ) return BuiltIn ( ) . run_keyword ( k... | Runs a keyword only once in one of the parallel processes . As the keyword will be called only in one process and the return value could basically be anything . The Run Only Once can t return the actual return value . If the keyword fails Run Only Once fails . Others executing Run Only Once wait before going through th... |
231,994 | def set_parallel_value_for_key ( self , key , value ) : if self . _remotelib : self . _remotelib . run_keyword ( 'set_parallel_value_for_key' , [ key , value ] , { } ) else : _PabotLib . set_parallel_value_for_key ( self , key , value ) | Set a globally available key and value that can be accessed from all the pabot processes . |
231,995 | def get_parallel_value_for_key ( self , key ) : if self . _remotelib : return self . _remotelib . run_keyword ( 'get_parallel_value_for_key' , [ key ] , { } ) return _PabotLib . get_parallel_value_for_key ( self , key ) | Get the value for a key . If there is no value for the key then empty string is returned . |
231,996 | def acquire_lock ( self , name ) : if self . _remotelib : try : while not self . _remotelib . run_keyword ( 'acquire_lock' , [ name , self . _my_id ] , { } ) : time . sleep ( 0.1 ) logger . debug ( 'waiting for lock to release' ) return True except RuntimeError : logger . warn ( 'no connection' ) self . __remotelib = N... | Wait for a lock with name . This will prevent other processes from acquiring the lock with the name while it is held . Thus they will wait in the position where they are acquiring the lock until the process that has it releases it . |
231,997 | def release_lock ( self , name ) : if self . _remotelib : self . _remotelib . run_keyword ( 'release_lock' , [ name , self . _my_id ] , { } ) else : _PabotLib . release_lock ( self , name , self . _my_id ) | Release a lock with name . This will enable others to acquire the lock . |
231,998 | def release_locks ( self ) : if self . _remotelib : self . _remotelib . run_keyword ( 'release_locks' , [ self . _my_id ] , { } ) else : _PabotLib . release_locks ( self , self . _my_id ) | Release all locks called by instance . |
231,999 | def acquire_value_set ( self , * tags ) : setname = self . _acquire_value_set ( * tags ) if setname is None : raise ValueError ( "Could not aquire a value set" ) return setname | Reserve a set of values for this execution . No other process can reserve the same set of values while the set is reserved . Acquired value set needs to be released after use to allow other processes to access it . Add tags to limit the possible value sets that this returns . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.