Enable key lookup after the key is found #7

Closed
opened 2018-10-14 01:43:03 -04:00 by russellballestrini · 1 comment
russellballestrini commented 2018-10-14 01:43:03 -04:00 (Migrated from git2.unturf.com)

Created by: rameshrvr

If the key is found we stoped the lookup inside value of that key.

sample_data = {
    "build_version": {
        "model_name": "MacBook Pro",
        "build_version": {
            "processor_name": "Intel Core i7",
            "processor_speed": "2.7 GHz",
            "core_details": {
                "build_version": "4",
                "l2_cache(per_core)": "256 KB"
            }
        },
        "number_of_cores": "4",
        "memory": "256 KB",
    },
    "os_details": {
        "product_version": "10.13.6",
        "build_version": "17G65"
    },
    "name": "Test",
    "date": "YYYY-MM-DD HH:MM:SS"
}

For the above sample data, lookup for key build_version should return

result = [
    {
        'build_version': {
            'processor_name': 'Intel Core i7',
            'processor_speed': '2.7 GHz',
            'core_details': {
                'build_version': '4',
                'l2_cache(per_core)': '256 KB'
            }
        },
        'memory': '256 KB',
        'model_name': 'MacBook Pro',
        'number_of_cores': '4'
    },
    {
        'processor_name': 'Intel Core i7',
        'processor_speed': '2.7 GHz',
        'core_details': {
            'build_version': '4',
            'l2_cache(per_core)': '256 KB'
        }
    }, '4', '17G65'
]

But it is returning

result = [
    {
        'build_version': {
            'processor_name': 'Intel Core i7',
            'processor_speed': '2.7 GHz',
            'core_details': {
                'build_version': '4',
                'l2_cache(per_core)': '256 KB'
            }
        },
        'memory': '256 KB',
        'model_name': 'MacBook Pro',
        'number_of_cores': '4'
    }, '17G65'
]
*Created by: rameshrvr* If the key is found we stoped the lookup inside value of that key. ``` sample_data = { "build_version": { "model_name": "MacBook Pro", "build_version": { "processor_name": "Intel Core i7", "processor_speed": "2.7 GHz", "core_details": { "build_version": "4", "l2_cache(per_core)": "256 KB" } }, "number_of_cores": "4", "memory": "256 KB", }, "os_details": { "product_version": "10.13.6", "build_version": "17G65" }, "name": "Test", "date": "YYYY-MM-DD HH:MM:SS" } ``` For the above sample data, lookup for key `build_version` should return ``` result = [ { 'build_version': { 'processor_name': 'Intel Core i7', 'processor_speed': '2.7 GHz', 'core_details': { 'build_version': '4', 'l2_cache(per_core)': '256 KB' } }, 'memory': '256 KB', 'model_name': 'MacBook Pro', 'number_of_cores': '4' }, { 'processor_name': 'Intel Core i7', 'processor_speed': '2.7 GHz', 'core_details': { 'build_version': '4', 'l2_cache(per_core)': '256 KB' } }, '4', '17G65' ] ``` But it is returning ``` result = [ { 'build_version': { 'processor_name': 'Intel Core i7', 'processor_speed': '2.7 GHz', 'core_details': { 'build_version': '4', 'l2_cache(per_core)': '256 KB' } }, 'memory': '256 KB', 'model_name': 'MacBook Pro', 'number_of_cores': '4' }, '17G65' ] ```
russellballestrini commented 2018-10-16 08:02:30 -04:00 (Migrated from git2.unturf.com)

Created by: russellballestrini

fixed in #8

*Created by: russellballestrini* fixed in #8
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: python/nested-lookup#7
No description provided.