text stringlengths 0 828 |
|---|
'suffixe': '-a0', |
}, |
'TCOMCOMENQ': { |
'repertoire': 'ta-commission', |
'prefixe': 'r', |
'suffixe': '-a0', |
}, |
'TADO': { |
'repertoire': 'ta', |
'prefixe': 'ta', |
'suffixe': '', |
}, |
# NOT IN NATIONAL ASSEMBLY PHP CODE |
'RAPP': { |
'repertoire': 'rapports', |
'prefixe': 'r', |
'suffixe': '', |
}, |
'RINF': { |
'repertoire': 'rapports', |
'prefixe': 'r', |
'suffixe': '', |
} |
} |
match = re.match(r'(.{4})([ANS]*)(R[0-9])([LS]*)([0-9]*)([BTACP]*)(.*)', identifiant) |
leg = match.group(5) |
typeTa = match.group(6) |
num = match.group(7) |
if typeTa == 'BTC': |
type = 'TCOM' |
elif typeTa == 'BTA': |
type = 'TADO' |
else: |
type = code |
host = ""http://www.assemblee-nationale.fr/"" |
if type not in datas: |
# ex: ALCNANR5L15B0002 (allocution du président) |
raise Exception('Unknown document type for %s' % identifiant) |
return host + leg + ""/"" + datas[type]['repertoire'] + ""/"" + datas[type]['prefixe'] + num + datas[type]['suffixe'] + "".asp""" |
768,"def queryByPortSensor(portiaConfig, edgeId, port, sensor, last=False, params={ 'from': None, 'to': None, 'order': None, 'precision': 'ms', 'limit': None }): |
""""""Returns a pandas data frame with the portia select resultset"""""" |
header = {'Accept': 'text/csv'} |
if last == False: |
endpoint = '/select/device/{0}/port/{1}/sensor/{2}{3}'.format( edgeId, port, sensor, utils.buildGetParams(params) ) |
else: |
endpoint = '/select/device/{0}/port/{1}/sensor/{2}/last{3}'.format( edgeId, port, sensor, utils.buildGetParams(params) ) |
response = utils.httpGetRequest(portiaConfig, endpoint, header) |
if response.status_code == 200: |
try: |
dimensionSeries = pandas.read_csv( StringIO(response.text), sep=';' ) |
if portiaConfig['debug']: |
print( '[portia-debug]: {0} rows'.format( len(dimensionSeries.index) ) ) |
return dimensionSeries |
except: |
raise Exception('couldn\'t create pandas data frame') |
else: |
raise Exception('couldn\'t retrieve data')" |
769,"def try_parse_num_and_booleans(num_str): |
"""""" |
Tries to parse the provided string as a number or boolean |
:param num_str: |
:return: |
"""""" |
if isinstance(num_str, str): |
# bool |
if num_str.lower() == 'true': |
return True |
elif num_str.lower() == 'false': |
return False |
# int |
if num_str.isdigit(): |
return int(num_str) |
# float |
try: |
return float(num_str) |
except ValueError: |
# give up |
return num_str |
else: |
# dont try |
return num_str" |
770,"def read_dict_from_properties(desired_type: Type[dict], file_object: TextIOBase, |
logger: Logger, conversion_finder: ConversionFinder, **kwargs) -> Dict[str, Any]: |
"""""" |
Helper method to read a dictionary from a .properties file (java-style) using jprops. |
Since jprops does not provide automatic handling for boolean and numbers, this tries to add the feature. |
:param file_object: |
:return: |
"""""" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.