idx int64 0 24.9k | question stringlengths 68 4.14k | target stringlengths 9 749 |
|---|---|---|
9,400 | def reduce? case size when IIIF :: Image :: Size :: Full , IIIF :: Image :: Size :: Max false when IIIF :: Image :: Size :: Absolute aspect_ratio = width . to_f / height in_delta? ( image_info . aspect , aspect_ratio , 0.001 ) else true end end | Should we reduce this image with KDU? |
9,401 | def post_process ( intermediate_file , reduction_factor ) transformation = if reduction_factor reduce ( without_crop , reduction_factor ) else without_crop end Riiif :: File . new ( intermediate_file ) . extract ( transformation , image_info ) end | The data we get back from kdu_expand is a bmp and we need to change it to the requested format by calling Imagemagick . |
9,402 | def without_crop IIIF :: Image :: Transformation . new ( region : IIIF :: Image :: Region :: Full . new , size : transformation . size . dup , quality : transformation . quality , rotation : transformation . rotation , format : transformation . format ) end | Create a clone of the Transformation without the crop |
9,403 | def reduce ( transformation , factor ) resize = Resize . new ( transformation . size , image_info ) IIIF :: Image :: Transformation . new ( region : transformation . region . dup , size : resize . reduce ( factor ) , quality : transformation . quality , rotation : transformation . rotation , format : transformation . f... | Create a clone of this Transformation scaled by the factor |
9,404 | def setup @announce_timer = @timers . every ( 30 ) do if @state == :unannounced if host_agent_available? && announce_sensor transition_to ( :announced ) :: Instana . logger . info "Host agent available. We're in business. (#{@state} pid:#{Process.pid} #{@process[:name]})" end end end @collect_timer = @timers . every ( ... | Sets up periodic timers and starts the agent in a background thread . |
9,405 | def start if ! host_agent_available? if ! ENV . key? ( "INSTANA_QUIET" ) :: Instana . logger . warn "Host agent not available. Will retry periodically. (Set env INSTANA_QUIET=1 to shut these messages off)" end end loop do if @state == :unannounced @collect_timer . pause @announce_timer . resume else @announce_timer . ... | Starts the timer loop for the timers that were initialized in the setup method . This is blocking and should only be called from an already initialized background thread . |
9,406 | def announce_sensor unless @discovered :: Instana . logger . debug ( "#{__method__} called but discovery hasn't run yet!" ) return false end @process = :: Instana :: Util . collect_process_info announce_payload = { } announce_payload [ :pid ] = pid_namespace? ? get_real_pid : Process . pid announce_payload [ :name ] = ... | Collect process ID name and arguments to notify the host agent . |
9,407 | def report_metrics ( payload ) unless @discovered :: Instana . logger . debug ( "#{__method__} called but discovery hasn't run yet!" ) return false end path = "com.instana.plugin.ruby.#{@process[:report_pid]}" uri = URI . parse ( "http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}" ) req = Net :: HT... | Method to report metrics data to the host agent . |
9,408 | def report_spans ( spans ) return unless @state == :announced unless @discovered :: Instana . logger . debug ( "#{__method__} called but discovery hasn't run yet!" ) return false end path = "com.instana.plugin.ruby/traces.#{@process[:report_pid]}" uri = URI . parse ( "http://#{@discovered[:agent_host]}:#{@discovered[:a... | Accept and report spans to the host agent . |
9,409 | def host_agent_available? @discovered ||= run_discovery if @discovered uri = URI . parse ( "http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/" ) req = Net :: HTTP :: Get . new ( uri ) response = make_host_agent_request ( req ) if response && ( response . code . to_i == 200 ) return true end end false resc... | Check that the host agent is available and can be contacted . This will first check localhost and if not then attempt on the default gateway for docker in bridged mode . |
9,410 | def start_or_continue_trace ( name , kvs = { } , incoming_context = { } , & block ) log_start_or_continue ( name , kvs , incoming_context ) block . call rescue Exception => e log_error ( e ) raise ensure log_end ( name ) end | Tracing blocks API methods |
9,411 | def trace ( name , kvs = { } , & block ) log_entry ( name , kvs ) result = block . call result rescue Exception => e log_error ( e ) raise ensure log_exit ( name ) end | Trace a block of code within the context of the exiting trace |
9,412 | def log_start_or_continue ( name , kvs = { } , incoming_context = { } ) return if ! :: Instana . agent . ready? || ! :: Instana . config [ :tracing ] [ :enabled ] :: Instana . logger . debug "#{__method__} passed a block. Use `start_or_continue` instead!" if block_given? self . current_trace = :: Instana :: Trace . ne... | Lower level tracing API methods |
9,413 | def log_exit ( name , kvs = { } ) return unless tracing? if :: Instana . debug? || :: Instana . test? unless current_span_name? ( name ) :: Instana . logger . debug "Span mismatch: Attempt to exit #{name} span but #{current_span.name} is active." end end self . current_trace . end_span ( kvs ) end | Closes out the current span |
9,414 | def log_end ( name , kvs = { } , end_time = :: Instana :: Util . now_in_ms ) return unless tracing? if :: Instana . debug? || :: Instana . test? unless current_span_name? ( name ) :: Instana . logger . debug "Span mismatch: Attempt to end #{name} span but #{current_span.name} is active." end end self . current_trace . ... | Closes out the current span in the current trace and queues the trace for reporting |
9,415 | def log_async_info ( kvs , span ) if tracing? && self . current_trace . id == span . context . trace_id self . current_trace . add_async_info ( kvs , span ) else trace = :: Instana . processor . staged_trace ( span . context . trace_id ) if trace trace . add_async_info ( kvs , span ) else :: Instana . logger . debug "#... | Add info to an asynchronous span |
9,416 | def log_async_error ( e , span ) if tracing? && self . current_trace . id == span . context . trace_id self . current_trace . add_async_error ( e , span ) else trace = :: Instana . processor . staged_trace ( span . context . trace_id ) if trace trace . add_async_error ( e , span ) else :: Instana . logger . debug "#{__... | Add an error to an asynchronous span |
9,417 | def log_async_exit ( _name , kvs , span ) if tracing? && self . current_trace . id == span . context . trace_id self . current_trace . end_async_span ( kvs , span ) else trace = :: Instana . processor . staged_trace ( span . context . trace_id ) if trace trace . end_async_span ( kvs , span ) else :: Instana . logger . ... | Closes out an asynchronous span |
9,418 | def inject ( span_context , format , carrier ) case format when OpenTracing :: FORMAT_TEXT_MAP , OpenTracing :: FORMAT_BINARY :: Instana . logger . debug 'Unsupported inject format' when OpenTracing :: FORMAT_RACK carrier [ 'X-Instana-T' ] = :: Instana :: Util . id_to_header ( span_context . trace_id ) carrier [ 'X-Ins... | Inject a span into the given carrier |
9,419 | def extract ( format , carrier ) case format when OpenTracing :: FORMAT_TEXT_MAP , OpenTracing :: FORMAT_BINARY :: Instana . logger . debug 'Unsupported extract format' when OpenTracing :: FORMAT_RACK :: Instana :: SpanContext . new ( :: Instana :: Util . header_to_id ( carrier [ 'HTTP_X_INSTANA_T' ] ) , :: Instana :: ... | Extract a span from a carrier |
9,420 | def add ( trace ) if :: Instana . agent . collect_thread . nil? || ! :: Instana . agent . collect_thread . alive? :: Instana . agent . spawn_background_thread end @queue . push ( trace ) end | Adds a trace to the queue to be processed and sent to the host agent |
9,421 | def staged_trace ( trace_id ) candidate = nil @staging_lock . synchronize { @staging_queue . each do | trace | if trace . id == trace_id candidate = trace break end end } unless candidate :: Instana . logger . debug ( "Couldn't find staged trace with trace_id: #{trace_id}" ) end candidate end | Retrieves a single staged trace from the staging queue . Staged traces are traces that have completed but may have outstanding asynchronous spans . |
9,422 | def new_span ( name , kvs = nil , start_time = :: Instana :: Util . now_in_ms , child_of = nil ) return unless @current_span if child_of && child_of . is_a? ( :: Instana :: Span ) new_span = Span . new ( name , @id , parent_id : child_of . id , start_time : start_time ) new_span . parent = child_of new_span . baggage =... | Initializes a new instance of Trace |
9,423 | def add_error ( e , span = nil ) return if e && e . instance_variable_get ( :@instana_logged ) || @current_span . nil? span ||= @current_span span . add_error ( e ) end | Log an error into the current span |
9,424 | def end_span ( kvs = { } , end_time = :: Instana :: Util . now_in_ms ) return unless @current_span @current_span . close ( end_time ) add_info ( kvs ) if kvs && ! kvs . empty? @current_span = @current_span . parent unless @current_span . is_root? end | Close out the current span and set the parent as the current span |
9,425 | def end_async_span ( kvs = { } , span ) span . set_tags ( kvs ) unless kvs . empty? span . close end | End an asynchronous span |
9,426 | def add_backtrace_to_span ( bt , limit = nil , span ) frame_count = 0 span [ :stack ] = [ ] bt . each do | i | if ! i . match ( / \/ \/ / ) . nil? || ( i . match ( :: Instana :: VERSION_FULL ) . nil? && i . match ( 'lib/instana/' ) . nil? ) break if limit && frame_count >= limit x = i . split ( ':' ) span [ :stack ] <<... | Adds the passed in backtrace to the specified span . Backtrace can be one generated from Kernel . caller or one attached to an exception |
9,427 | def param? ( name ) _param = name . to_s =~ / / ? name . to_s : 'params.' + name . to_s begin val = eval ( "self.#{_param}" ) rescue nil else val end end | Return value of param if it exists nil otherwise . |
9,428 | def model @model ||= begin if self . class . path_to_model m = eval ( self . class . path_to_model ) if m if m . respond_to? ( :_controller= ) m . send ( :_controller= , self ) end else fail "No model object found at path: #{self.class.path_to_model}" end m end end end | Returns the controller s model |
9,429 | def method_missing ( method , * args , & block ) if model . respond_to? ( method ) if method . to_sym == :base_address define_singleton_method ( method ) do model . send ( method ) end base_address else define_singleton_method ( method ) do | * args , & block | model . send ( method , * args , & block ) end send ( meth... | Used to proxy all method and attribute requests not implemented on the controller to the model . |
9,430 | def has_chip? ( s , options = { } ) _chips options = { group : nil , family : nil , performance : nil , chip : nil , creating_spec : false } . update ( options ) options [ :chip ] = s ! ! show_chips ( options ) end | Check if the current IP has a spec |
9,431 | def filter_hash ( hash , filter ) fail 'Hash argument is not a Hash!' unless hash . is_a? Hash filtered_hash = { } select_logic = case filter when String then 'k[Regexp.new(filter)]' when ( Fixnum || Integer || Float || Numeric ) then "k[Regexp.new('#{filter}')]" when Regexp then 'k[filter]' when Symbol then 'k == filt... | Return a hash based on the filter provided |
9,432 | def add_reg_with_block_format add_reg :dreg , 0x1000 , size : 16 do | reg | reg . bit 15 , :bit15 , reset : 1 reg . bits 14 , :bit14 reg . bits 13 .. 8 , :upper reg . bit 7 .. 0 , :lower , writable : false , reset : 0x55 end reg :dreg2 , 0x1000 , size : 16 do bit 15 , :bit15 , reset : 1 bits 14 .. 8 , :upper bit 7 .. 0... | Tests that the block format for defining registers works |
9,433 | def add_reg ( id , address , size = nil , bit_info = { } , & _block ) if address . is_a? ( Hash ) fail 'add_reg requires the address to be supplied as the 2nd argument, e.g. add_reg :my_reg, 0x1000' end size , bit_info = nil , size if size . is_a? ( Hash ) size ||= bit_info . delete ( :size ) || 32 description = bit_in... | Add a register . When adding a register you must supply a name an address size in bits and bit definitions any bits that are not declared will be filled with dummy bit objects that are not writable and will read back as 0 . |
9,434 | def bit ( index , name , attrs = { } ) if index . is_a? ( Range ) msb = index . first lsb = index . last msb , lsb = lsb , msb if lsb > msb pos = lsb bits = ( msb - lsb ) . abs + 1 elsif index . is_a? ( Numeric ) pos = index bits = 1 else fail 'No valid index supplied when defining a register bit!' end attrs = attrs . ... | Called within an add_reg block to define bits |
9,435 | def default_reg_metadata Origen :: Registers . reg_metadata [ self . class ] ||= { } if block_given? collector = Origen :: Utility :: Collector . new yield collector Origen :: Registers . reg_metadata [ self . class ] . merge! ( collector . to_h ) end Origen :: Registers . reg_metadata [ self . class ] end | Can be called to add app specific meta data that is isolated to all registers defined within a given class |
9,436 | def has_reg? ( name , params = { } ) params = { test_for_true_false : true } . update ( params ) if params . key? ( :enabled_features ) || params . key? ( :enabled_feature ) return ! ! get_registers ( params ) . include? ( name ) else params [ :enabled_features ] = :default return ! ! get_registers ( params ) . include... | Returns true if the object contains a register matching the given name |
9,437 | def reg ( * args , & block ) if block_given? || ( args [ 1 ] . is_a? ( Integer ) && ! try ( :_initialized? ) ) @reg_define_file = define_file ( caller [ 0 ] ) add_reg ( * args , & block ) else if ! args . empty? && args . size == 1 && ( args [ 0 ] . class != Hash || ( args [ 0 ] . key? ( :name ) && args [ 0 ] . size ==... | Returns - the register object matching the given name - or a hash of all registes matching a given regular expression - or a hash of all registers associated with a feature if no name is specified . |
9,438 | def prepare_targets ( options ) targets = [ options [ :target ] , options [ :targets ] ] . flatten . compact if targets . empty? puts 'You must supply the targets you are going to run in the options' puts 'passed to regression_manager.run.' fail end Origen . target . loop ( options ) { | _options | } targets end | Cycle through all targets in the upcoming run to ensure that all output directories exist |
9,439 | def regression_command_file first_call = caller . find { | line | line =~ / / } app_caller_line = caller [ caller . index ( first_call ) + 1 ] app_caller_line =~ / \. / path = Pathname . new ( Regexp . last_match [ 1 ] ) end | Returns a full path to the regression command file within the local application |
9,440 | def _add ( name , options = { } , & block ) options = { name : name , parent : parent } . merge ( options ) options = Origen :: Utility . collector ( hash : options , merge_method : :keep_hash , & block ) . to_h _instantiate_class ( name , options ) _push_accessor ( name , options ) @_componentable_container [ name ] e... | Adds a new item to the componentable container . |
9,441 | def move ( to_move , new_name , options = { } ) overwrite = options [ :overwrite ] || false if @_componentable_container . key? ( new_name ) && ! overwrite fail Origen :: Componentable :: NameInUseError , "#{_singleton_name} name :#{new_name} is already in use" end unless @_componentable_container . key? ( to_move ) fa... | Moves a component object from one name to another . |
9,442 | def delete ( to_delete ) obj = delete! ( to_delete ) fail Origen :: Componentable :: NameDoesNotExistError , "#{_singleton_name} name :#{to_delete} does not exist" if obj . nil? obj end | Deletes a component from the componentable container |
9,443 | def delete_all returns = { } @_componentable_container . each do | key , val | delete! ( key ) returns [ key ] = val end returns end | Deletes all of the components in the container . |
9,444 | def init_sub_blocks ( * args ) options = args . find { | a | a . is_a? ( Hash ) } @custom_attrs = ( options ? options . dup : { } ) . with_indifferent_access %w( parent name base_address reg_base_address base ) . each do | key | @custom_attrs . delete ( key ) end if options @reg_base_address = options . delete ( :reg_b... | This will be called whenever an object that includes this module is instantiated |
9,445 | def owns_registers? if regs regs . is_a? ( Origen :: Registers :: RegCollection ) && ! regs . empty? else false end end | Returns true if the given sub block owns at least one register |
9,446 | def method_missing ( method , * args , & block ) super rescue NoMethodError return regs ( method ) if self . has_reg? ( method ) return ports ( method ) if self . has_port? ( method ) if method . to_s =~ / / define_singleton_method ( method ) do | val | instance_variable_set ( "@#{method.to_s.sub('=', '')}" , val ) end... | Used to create attribute accessors on the fly . |
9,447 | def documentation ( header_info , selection , applicable_devices , link ) _documentation @_documentation [ header_info [ :section ] ] [ header_info [ :subsection ] ] [ selection [ :interface ] ] [ selection [ :type ] ] [ selection [ :sub_type ] ] [ selection [ :mode ] ] [ selection [ :audience ] ] = Documentation . new... | Adds a new documentation notion to the block |
9,448 | def spec_feature ( id , attrs , device , text , internal_comment ) _spec_features @_spec_features [ id ] [ device ] = Spec_Features . new ( id , attrs , device , text , internal_comment ) end | Adds a new feature to the block |
9,449 | def notes ( options = { } ) options = { id : nil , type : nil } . update ( options ) return nil if @_notes . nil? return nil if @_notes . empty? notes_found = Hash . new do | h , k | h [ k ] = { } end filter_hash ( @_notes , options [ :id ] ) . each do | id , hash | filter_hash ( hash , options [ :type ] ) . each do | ... | Returns a Note object from the notes hash |
9,450 | def specs_to_table_string ( specs_to_be_shown ) whitespace_padding = 3 table = [ ] attrs_to_be_shown = { name : SpecTableAttr . new ( 'Name' , true , 'Name' . length + whitespace_padding ) , symbol : SpecTableAttr . new ( 'Symbol' , false , 'Symbol' . length + whitespace_padding ) , mode : SpecTableAttr . new ( 'Mode' ... | Method to print a spec table to the console |
9,451 | def maillist_parse ( file ) maillist = [ ] if File . exist? ( file ) File . readlines ( file ) . each do | line | if index = ( line =~ / \# / ) unless line [ 0 , index ] . strip . empty? maillist << Origen :: Users :: User . new ( line [ 0 , index ] . strip ) . email end else unless line . strip . empty? maillist << Or... | Parses maillist file and returns an array of email address |
9,452 | def server_data if name == :origen @server_data ||= Origen . client . origen else @server_data ||= Origen . client . plugins . find { | p | p [ :origen_name ] . downcase == name . to_s . downcase } end end | Returns the server data packet available for the given application returns nil if none is found |
9,453 | def release_date ( version = Origen . app . version . prefixed ) time = release_time ( version ) time ? time . to_date : nil end | Returns the release date for the current or given application version |
9,454 | def dynamic_resource ( name , default , options = { } ) @static_resources ||= { } @transient_resources ||= { } if @load_event == :static || ( ! @load_event && options [ :adding ] ) if options [ :set ] @static_resources [ name ] = default else @static_resources [ name ] ||= default end elsif @load_event == :transient if... | Enable for debugging to see what the currently tracked objects are def object_store [ |
9,455 | def release! version = Origen . app . version body = { version : version . to_s } if version . production? body [ :type ] = :production else body [ :type ] = :development end post ( "plugins/#{Origen.app.name}/release" , body : body ) end | This will be called by the Origen release process to post the latest app version information to the server |
9,456 | def current_mode = ( id ) @current_mode = id . is_a? ( ChipMode ) ? id . id : id Origen . app . listeners_for ( :on_mode_changed ) . each do | listener | listener . on_mode_changed ( mode : @current_mode , instance : self ) end @current_mode end | Set the current mode configuration of the current model |
9,457 | def modes ( id = nil , _options = { } ) id = nil if id . is_a? ( Hash ) if id _modes [ id ] else _modes . ids end end | Returns an array containing the IDs of all known modes if no ID is supplied otherwise returns an object representing the given mode ID |
9,458 | def with_each_mode begin orig = current_mode rescue orig = nil end modes . each do | _id , mode | self . current_mode = mode yield mode end self . current_mode = orig end | Executes the given block of code for each known chip mode inside the block the current mode of the top level block will be set to the given mode . |
9,459 | def find_specs specs_found = [ ] if self . respond_to? :specs object_specs = specs unless object_specs . nil? if object_specs . class == Origen :: Specs :: Spec specs_found << object_specs else specs_found . concat ( object_specs ) end end end sub_blocks . each do | _name , sb | next unless sb . respond_to? :specs chil... | Returns all specs found for the model . if none found it returns an empty array |
9,460 | def delete_all_specs_and_notes ( obj = nil ) obj = self if obj . nil? obj . delete_all_specs obj . delete_all_notes obj . delete_all_exhibits obj . children . each do | _name , child | next unless child . has_specs? delete_all_specs_and_notes ( child ) end end | Delete all specs and notes for self recursively |
9,461 | def method_missing ( method , * args , & block ) if controller . respond_to? ( method ) define_singleton_method ( method ) do | * args , & block | controller . send ( method , * args , & block ) end send ( method , * args , & block ) else super end end | Used to proxy all method and attribute requests not implemented on the model to the controller . |
9,462 | def current_user core_id = Origen :: Users :: User . current_user_id user = app_users . find { | user | user . core_id == core_id } user || User . new ( core_id ) end | Returns a user object representing the current user will return a default user object if the current user is not known to the generator |
9,463 | def numeric if latest? 1_000_000_000_000_000_000_000_000_000 elsif semantic? if development? self =~ / \d \d \d \d / ( Regexp . last_match [ 1 ] . to_i * 1000 * 1000 * 1000 ) + ( Regexp . last_match [ 2 ] . to_i * 1000 * 1000 ) + ( Regexp . last_match [ 3 ] . to_i * 1000 ) + Regexp . last_match [ 5 ] . to_i else self =... | Returns a numeric representation of the version this can be used for chronological comparison with other versions |
9,464 | def to_time if latest? Time . new ( 10_000 , 1 , 1 ) elsif timestamp? if development? self =~ / \w \d \d \d \d \d \d \d \d \d \d \d \d / Time . new ( Regexp . last_match [ 1 ] , Regexp . last_match [ 2 ] , Regexp . last_match [ 3 ] , Regexp . last_match [ 4 ] , Regexp . last_match [ 5 ] ) else self =~ / \d \d \d \d \d ... | Returns the version as a time only applicable for timestamps otherwise an error will be raised |
9,465 | def validate_condition! ( condition , tag ) tag = VersionString . new ( tag ) tag . validate! ( "The version condition, #{condition}, is not valid!" ) tag end | Validates the given condition and the extracted tag returns the tag wrapped in a VersionString if valid will raise an error if not |
9,466 | def delete_symlink ( path ) if Origen . running_on_windows? system ( "call cmd /c rmdir #{path.to_s.gsub('/', '\\')}" ) FileUtils . rm_f ( "#{path}_is_a_symlink" ) else FileUtils . rm_f ( path ) end end | Manually handle symlink deletion to support windows |
9,467 | def process_remotes remotes . each do | _name , remote | dir = workspace_of ( remote ) rc_url = remote [ :rc_url ] || remote [ :vault ] tag = remote [ :tag ] . nil? ? Origen :: VersionString . new ( remote [ :version ] ) : Origen :: VersionString . new ( remote [ :tag ] ) version_file = dir . to_s + '/.current_version'... | Process each remote |
9,468 | def path_enabled? ( remote ) dir = workspace_of ( remote ) File . exist? ( dir ) && symlink? ( dir ) end | Returns true if the given import is currently setup as a path |
9,469 | def update! ensure_remotes_directory dirty_remotes . each do | _name , remote | dir = workspace_of ( remote ) if remote [ :path ] || path_enabled? ( remote ) if symlink? ( dir ) delete_symlink ( dir ) else FileUtils . rm_rf ( dir ) if File . exist? ( dir ) end end if remote [ :path ] create_symlink ( remote [ :path ] ,... | Makes all dirty remotes clean |
9,470 | def prefix_tag ( tag ) tag = Origen :: VersionString . new ( tag ) if tag . semantic? tag . prefixed else tag end end | If the supplied tag looks like a semantic version number then make sure it has the v prefix |
9,471 | def current_package = ( val ) @current_package_id = case val when ChipPackage val . id else packages . include? ( val ) ? val : nil end end | Use this to specify the current package option for the given SoC . |
9,472 | def packages ( id = nil , _options = { } ) id , options = nil , id if id . is_a? ( Hash ) if id _packages [ id ] else _packages . ids end end | Returns an array containing the IDs of all known configurations if no ID is supplied otherwise returns an object representing the given package ID |
9,473 | def erratum ( id , ip_block , overview = { } , status = { } , sw_workaround = { } ) _errata @_errata [ id ] [ ip_block ] [ status [ :disposition ] ] = HwErratum . new ( id , ip_block , overview , status , sw_workaround ) end | Define and instantiate an erratum object |
9,474 | def errata ( options = { } ) options = { id : nil , ip_block : nil , disposition : nil } . update ( options ) return nil if @_errata . nil? return nil if @_errata . empty? errata_found = Hash . new do | h , k | h [ k ] = Hash . new do | hh , kk | hh [ kk ] = { } end end filter_hash ( @_errata , options [ :id ] ) . each... | Returns an erratum or list of erratum that meet a specific criteria |
9,475 | def sw_workaround ( id , overview = { } , resolution = { } ) _sw_workarounds @_sw_workarounds [ id ] = SwErratumWorkaround . new ( id , overview , resolution ) end | Define and instantiate a sw_workaround object |
9,476 | def sw_workarounds ( options = { } ) options = { id : nil } . update ( options ) return nil if @_sw_workarounds . nil? return nil if @_sw_workarounds . empty? sw_workarounds_found = Hash . new do | h , k | h [ k ] = { } end filter_hash ( @_sw_workarounds , options [ :id ] ) . each do | id , workarounds | sw_workarounds... | Returns a sw_workaround object with a specific id |
9,477 | def add_as_highest ( var , value ) c = Config . new ( path : :runtime , parent : self , values : { var . to_s => value } ) configs . prepend ( Config . new ( path : :runtime , parent : self , values : { var . to_s => value } ) ) end | Dynamically add a new site variable at the highest priority . |
9,478 | def add_as_lowest ( var , value ) configs . append ( Config . new ( path : :runtime , parent : self , values : { var . to_s => value } ) ) end | Dynamically add a new site variable at the lowest priority . Essentially this sets a new default value . |
9,479 | def vars_by_configs vars = { } configs . each do | c | vars = c . values . map { | k , v | [ k , c ] } . to_h . merge ( vars ) end vars end | Gets all config variables as a hash but the hash s values are the Config instances which defines the highest priority of each var instead of the var s value itself . |
9,480 | def configs! path = $_origen_invocation_pwd @configs = [ ] until path . root? load_directory ( path ) path = path . parent end path = Pathname . new ( $LOAD_PATH . last ) until path . root? load_directory ( path ) path = path . parent end load_directory ( File . expand_path ( '../../../' , __FILE__ ) ) load_directory (... | Forces a reparse of the site configs . This will set the configs along the current path first then using those values will add a site config at the home directory . |
9,481 | def open_list ( file ) f = clean_path_to ( file , allow_missing : true ) if f f = File . open ( f , 'r' ) elsif File . exist? ( "#{Origen.root}/list/#{File.basename(file)}" ) f = File . open ( "#{Origen.root}/list/#{File.basename(file)}" , 'r' ) elsif @last_opened_list_dir && File . exist? ( "#{@last_opened_list_dir}/#... | Returns the contents of the given list file in an array if it can be found if not will raise an error |
9,482 | def clean_path_to ( file , options = { } ) if options [ :load_paths ] [ options [ :load_paths ] ] . each do | root | if File . exist? ( "#{root}/#{file}" ) return Pathname . new ( "#{root}/#{file}" ) end end end if File . exist? ( file ) if Pathname . new ( file ) . absolute? Pathname . new ( file ) else Pathname . new... | Returns a full path to the given file or directory raises an error if it can t be resolved |
9,483 | def relative_to_absolute ( path ) if Pathname . new ( path ) . absolute? Pathname . new ( path ) else Pathname . new ( "#{Pathname.pwd}/#{path}" ) end end | Returns an absolute path for the given |
9,484 | def inject_import_path ( path , options = { } ) path = path . to_s unless path . is_a? ( String ) if path =~ / \/ / import_name = Regexp . last_match [ 1 ] . downcase . to_sym if import_name == :origen || import_name == :origen_core || Origen . app . plugins . names . include? ( import_name ) || import_name == :doc_hel... | If the current path looks like it is a reference to an import the path will be replaced with the absolute path to the local import directory |
9,485 | def add_underscore_to ( file ) f = Pathname . new ( file ) if f . basename . to_s =~ / / file else "#{f.dirname}/_#{f.basename}" end end | Insert _ in file name if not present |
9,486 | def sub_dir_of ( file , base = base_directory ) file = Pathname . new ( file ) unless file . respond_to? ( :relative_path_from ) base = Pathname . new ( base ) unless base . respond_to? ( :relative_path_from ) rel = file . relative_path_from ( base ) if file . directory? rel else rel . dirname end end | Returns the sub directory of the current base directory that the given file is in |
9,487 | def open_for_write ( path ) dir = Pathname . new ( path ) . dirname FileUtils . mkdir_p ( dir ) unless File . exist? ( dir ) File . open ( path , 'w' ) do | f | yield f end end | Convenience method to use when you want to write to a file this takes care of ensuring that the directory exists prior to attempting to open the file |
9,488 | def has_bug? ( name , _options = { } ) unless self . respond_to? ( :version ) && version puts 'To test for the presence of a bug the object must implement an attribute' puts "called 'version' which returns the IP version represented by the the object." fail 'Version undefined!' end name = name . to_s . downcase . to_sy... | Returns true if the version of the IP represented by the object has the bug of the given name |
9,489 | def level = ( val ) unless LEVELS . include? ( val ) fail "Unknown log level, valid values are: #{LEVELS}" end case val when :normal console . level = Logger :: INFO log_files ( :level= , Logger :: DEBUG ) unless console_only? when :verbose console . level = Logger :: DEBUG log_files ( :level= , Logger :: DEBUG ) unles... | Set the logger level for valid values see LEVELS |
9,490 | def log_files ( method , * args ) last_file . send ( method , * args ) unless Origen . running_remotely? @job_file . send ( method , * args ) if @job_file end | Sends the given method and arguments to all file logger instances |
9,491 | def pin_pattern_order ( * pin_ids ) if pin_ids . last . is_a? ( Hash ) options = pin_ids . pop else options = { } end pin_ids . each do | id | if pin_aliases [ id ] Origen . app . pin_names [ pin_aliases [ id ] . first ] = id id = pin_aliases [ id ] . first end Origen . app . pin_pattern_order << id end Origen . app . ... | Specify the order that pins will appear in the output pattern unspecified pins will appear in an arbitrary order at the end |
9,492 | def all_power_pins ( id = nil , _options = { } , & _block ) if id pin = Origen . pin_bank . find ( id , ignore_context : true , power_pin : true ) else Origen . pin_bank . all_power_pins end end | Equivalent to the all_pins method but considers power pins rather than regular pins |
9,493 | def all_other_pins ( id = nil , _options = { } , & _block ) if id pin = Origen . pin_bank . find ( id , ignore_context : true , other_pin : true ) else Origen . pin_bank . all_other_pins end end | Equivalent to the all_pins method but considers other pins rather than regular pins |
9,494 | def power_pins ( id = nil , options = { } , & block ) id , options = nil , id if id . is_a? ( Hash ) options = { power_pin : true } . merge ( options ) pins ( id , options , & block ) end | Equivalent to the pins method but considers power pins rather than regular pins |
9,495 | def ground_pins ( id = nil , options = { } , & block ) id , options = nil , id if id . is_a? ( Hash ) options = { ground_pin : true } . merge ( options ) pins ( id , options , & block ) end | Equivalent to the pins method but considers ground pins rather than regular pins |
9,496 | def other_pins ( id = nil , options = { } , & block ) id , options = nil , id if id . is_a? ( Hash ) options = { other_pin : true } . merge ( options ) pins ( id , options , & block ) end | Equivalent to the pins method but considers other pins rather than regular pins |
9,497 | def virtual_pins ( id = nil , options = { } , & block ) id , options = nil , id if id . is_a? ( Hash ) options = { virtual_pin : true } . merge ( options ) pins ( id , options , & block ) end | Equivalent to the pins method but considers virtual pins rather than regular pins |
9,498 | def delete_pin ( id , options = { } ) id = id . to_sym if pin_groups . key? id Origen . pin_bank . delete_pingroup ( Origen . pin_bank . find_pin_group ( id , options ) ) elsif pins ( id ) . class . to_s . match ( / / ) Origen . pin_bank . delete_pin ( Origen . pin_bank . find ( id , options ) ) else fail "Error: the o... | Delete any pin or pin group . If arg is a pin then delete the pin and any instances of it in any pin groups |
9,499 | def render ( * args , & block ) if $_compiler_stack && $_compiler_stack . last $_compiler_stack . last . render ( * args , & block ) else Origen . generator . compiler . render ( * args , & block ) end end | Render an ERB template |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.