text stringlengths 0 828 |
|---|
body = None |
downloaded = True |
return url, body" |
4131,"def tgcanrecruit(self, region=None): |
""""""Whether the nation will receive a recruitment telegram. |
Useful in conjunction with the Telegrams API. |
Parameters |
---------- |
region : str |
Name of the region you are recruiting for. |
Returns |
------- |
an :class:`ApiQuery` of bool |
"""""" |
params = {'from': normalize(region)} if region is not None else {} |
@api_query('tgcanrecruit', **params) |
async def result(_, root): |
return bool(int(root.find('TGCANRECRUIT').text)) |
return result(self)" |
4132,"async def freedom(self, root): |
""""""Nation's `Freedoms`: three basic indicators of the nation's |
Civil Rights, Economy, and Political Freedom, as expressive |
adjectives. |
Returns |
------- |
an :class:`ApiQuery` of :class:`collections.OrderedDict` with \ |
keys and values of str |
Keys being, in order: ``Civil Rights``, ``Economy``, and |
``Political Freedom``. |
"""""" |
elem = root.find('FREEDOM') |
result = OrderedDict() |
result['Civil Rights'] = elem.find('CIVILRIGHTS').text |
result['Economy'] = elem.find('ECONOMY').text |
result['Political Freedom'] = elem.find('POLITICALFREEDOM').text |
return result" |
4133,"async def freedomscores(self, root): |
""""""Nation's `Freedoms`: three basic indicators of the nation's |
Civil Rights, Economy, and Political Freedom, as percentages. |
Returns |
------- |
an :class:`ApiQuery` of :class:`collections.OrderedDict` with \ |
keys of str and values of int |
Keys being, in order: ``Civil Rights``, ``Economy``, and |
``Political Freedom``. |
"""""" |
elem = root.find('FREEDOMSCORES') |
result = OrderedDict() |
result['Civil Rights'] = int(elem.find('CIVILRIGHTS').text) |
result['Economy'] = int(elem.find('ECONOMY').text) |
result['Political Freedom'] = int(elem.find('POLITICALFREEDOM').text) |
return result" |
4134,"async def govt(self, root): |
""""""Nation's government expenditure, as percentages. |
Returns |
------- |
an :class:`ApiQuery` of :class:`collections.OrderedDict` with \ |
keys of str and values of float |
Keys being, in order: ``Administration``, ``Defense``, |
``Education``, ``Environment``, ``Healthcare``, ``Industry``, |
``International Aid``, ``Law & Order``, ``Public Transport``, |
``Social Policy``, ``Spirituality``, and ``Welfare``. |
"""""" |
elem = root.find('GOVT') |
result = OrderedDict() |
result['Administration'] = float(elem.find('ADMINISTRATION').text) |
result['Defense'] = float(elem.find('DEFENCE').text) # match the web UI |
result['Education'] = float(elem.find('EDUCATION').text) |
result['Environment'] = float(elem.find('ENVIRONMENT').text) |
result['Healthcare'] = float(elem.find('HEALTHCARE').text) |
result['Industry'] = float(elem.find('COMMERCE').text) # Don't ask |
result['International Aid'] = float(elem.find('INTERNATIONALAID').text) |
result['Law & Order'] = float(elem.find('LAWANDORDER').text) |
result['Public Transport'] = float(elem.find('PUBLICTRANSPORT').text) |
result['Social Policy'] = float(elem.find('SOCIALEQUALITY').text) # Shh |
result['Spirituality'] = float(elem.find('SPIRITUALITY').text) |
result['Welfare'] = float(elem.find('WELFARE').text) |
return result" |
4135,"async def sectors(self, root): |
""""""Components of the nation's economy, as percentages. |
Returns |
------- |
an :class:`ApiQuery` of :class:`collections.OrderedDict` with \ |
keys of str and values of float |
Keys being, in order: ``Black Market (estimated)``, ``Government``, |
``Private Industry``, and ``State-Owned Industry``. |
"""""" |
elem = root.find('SECTORS') |
result = OrderedDict() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.