MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / unArrayizeValue

Function unArrayizeValue

lib/core/common.py:3666–3693  ·  view source on GitHub ↗

Makes a value out of iterable if it is a list or tuple itself >>> unArrayizeValue(['1']) '1' >>> unArrayizeValue('1') '1' >>> unArrayizeValue(['1', '2']) '1' >>> unArrayizeValue([['a', 'b'], 'c']) 'a' >>> unArrayizeValue(_ for _ in xrange(10)) 0

(value)

Source from the content-addressed store, hash-verified

3664 return value
3665
3666def unArrayizeValue(value):
3667 """
3668 Makes a value out of iterable if it is a list or tuple itself
3669
3670 >>> unArrayizeValue(['1'])
3671 '1'
3672 >>> unArrayizeValue('1')
3673 '1'
3674 >>> unArrayizeValue(['1', '2'])
3675 '1'
3676 >>> unArrayizeValue([['a', 'b'], 'c'])
3677 'a'
3678 >>> unArrayizeValue(_ for _ in xrange(10))
3679 0
3680 """
3681
3682 if isListLike(value):
3683 if not value:
3684 value = None
3685 elif len(value) == 1 and not isListLike(value[0]):
3686 value = value[0]
3687 else:
3688 value = [_ for _ in flattenValue(value) if _ is not None]
3689 value = value[0] if len(value) > 0 else None
3690 elif inspect.isgenerator(value):
3691 value = unArrayizeValue([_ for _ in value])
3692
3693 return value
3694
3695def flattenValue(value):
3696 """

Callers 15

_Function · 0.90
pivotDumpTableFunction · 0.90
initialize_optionsMethod · 0.90
fileExistsThreadFunction · 0.90
checkSqlInjectionFunction · 0.90
getPageMethod · 0.90
checkCharEncodingFunction · 0.90
stringMethod · 0.90
getFieldsMethod · 0.90
concatQueryMethod · 0.90
initTargetEnvFunction · 0.90
configFileParserFunction · 0.90

Calls 2

flattenValueFunction · 0.85
isListLikeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…