From d2d31ec87289003908f5c16271c5a28785620301 Mon Sep 17 00:00:00 2001 From: Sermet Pekin Date: Fri, 19 Apr 2024 20:05:41 +0300 Subject: [PATCH] reg --- .../EVDSlocal/index_requests/user_requests.py | 103 +------------- .../index_requests/user_requests_2.py | 133 ++++++++++++++++++ .../requests_/test_reg_result.pickle | Bin 0 -> 10279 bytes 3 files changed, 134 insertions(+), 102 deletions(-) create mode 100644 evdspy/EVDSlocal/index_requests/user_requests_2.py create mode 100644 evdspy/EVDSlocal/requests_/test_reg_result.pickle diff --git a/evdspy/EVDSlocal/index_requests/user_requests.py b/evdspy/EVDSlocal/index_requests/user_requests.py index 20a64db..1f7a043 100644 --- a/evdspy/EVDSlocal/index_requests/user_requests.py +++ b/evdspy/EVDSlocal/index_requests/user_requests.py @@ -248,108 +248,7 @@ def url(self) -> str: "type=json" ) return "&".join(parts) -""" -class UrlSeries: - @property - def domain(self) -> str: - return "https://evds2.tcmb.gov.tr/service/evds" - @property - def alias(self): - return "series=" -""" -class CategoriesMetadata(UrlSeries): - def get_url(self): - return f"{self.domain}/categories/type=json" - @property - def url(self): - return self.get_url() -class DataGroup_info(): - def __init__(self, table_name): - self.table_name = table_name -class DatagroupsMetadata(UrlSeries): - def __init__(self, data_group: DataGroup_info): - self.data_group = data_group - def get_url(self): - # "https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=1&code=bie_yssk&type=json" - # self.table_name = self.table_name # "bie_yssk" - return f"{self.domain}/datagroups/mode=1&code={self.data_group.table_name}&type=json" - @property - def url(self): - return self.get_url() -def test_CategoriesMetadata(capsys): - with capsys.disabled(): - d = DataGroup_info("bie_yssk") - assert d.table_name == "bie_yssk" - a = DatagroupsMetadata(d) - print(a.url) - b = CategoriesMetadata() - print(b.url) -class UrlBuilderMetadata(UrlBuilder): - ... - def get_url(self): - ... - def categories(self): - """""" - # 4.1 Category Service - # https://evds2.tcmb.gov.tr/service/evds/categories/type=json - def datagroups_mode_1(self, name="bie_yssk"): - """ - https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=1&code=bie_yssk&type=json - :return: - """ - ... - def datagroups_mode_2(self, code=1): - """ - https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=2&code=2&type=json - :return: - """ - ... - def data_group_service(self): - """data_group_service""" - """ - The data group listing is based on the following filtering: - mode=0 Returns all data groups under all categories. - mode=1 Returns data group information according to a data group selection. - mode=2 Returns all data groups information according to a category - mode 1 - code=data group code - mode 2 - code=category code - https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=1&code=bie_yssk&type=json - https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=2&code=2&type=xml - DATAGROUP_CODE Data Group Code - DATAGROUP_NAME Data Group Name (Turkish) - DATAGROUP_NAME_ENG Data Group Name (English) - START_DATE Data Start Date - END_DATE Date End Date - FREQUENCY Original Frequency - FREQUENCY_STR Original Frequency Desc. - DATASOURCE Data Source (Turkish) - DATASOURCE_ENG Data Source (English) - METADATA_LINK Metadata Link (Turkish) - METADATA_LINK_ENG Metadata Link (English) - REV_POL_LINK Revision Policy Link (Turkish) - REV_POL_LINK_ENG Revision Policy Link (English) - APP_CHA_LINK Application Change Link (Turkish) - APP_CHA_LINK_ENG Application Change Link (English) - NOTE Information Note (Turkish) - NOTE_ENG Information Note (English) - """ - # 4.2 Data Group Service -from abc import ABC, abstractmethod -class GuideMetadata: - def get_meta(self): - ... - def display_meta(self): - ... -class UrlBuilderMetadataCategories(UrlBuilderMetadata, GuideMetadata): - """ - UrlBuilderMetadataCategories - """ -class UrlBuilderMetadataDataGroup(UrlBuilderMetadata, GuideMetadata): - """ - UrlBuilderMetadataCategories - """ + def create_cache_version(fnc: Callable): @MyCache().cache def fnc_cache(*args, **kw): diff --git a/evdspy/EVDSlocal/index_requests/user_requests_2.py b/evdspy/EVDSlocal/index_requests/user_requests_2.py new file mode 100644 index 0000000..5bc9d55 --- /dev/null +++ b/evdspy/EVDSlocal/index_requests/user_requests_2.py @@ -0,0 +1,133 @@ +""" +class UrlSeries: + @property + def domain(self) -> str: + return "https://evds2.tcmb.gov.tr/service/evds" + @property + def alias(self): + return "series=" + + + +""" +from evdspy.EVDSlocal.index_requests.user_requests import UrlSeries, UrlBuilder + + +class CategoriesMetadata(UrlSeries): + def get_url(self): + return f"{self.domain}/categories/type=json" + + @property + def url(self): + return self.get_url() + + +class DataGroup_info(): + def __init__(self, table_name): + self.table_name = table_name + + +class DatagroupsMetadata(UrlSeries): + def __init__(self, data_group: DataGroup_info): + self.data_group = data_group + + def get_url(self): + # "https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=1&code=bie_yssk&type=json" + # self.table_name = self.table_name # "bie_yssk" + return f"{self.domain}/datagroups/mode=1&code={self.data_group.table_name}&type=json" + + @property + def url(self): + return self.get_url() + + +def test_CategoriesMetadata(capsys): + with capsys.disabled(): + d = DataGroup_info("bie_yssk") + assert d.table_name == "bie_yssk" + a = DatagroupsMetadata(d) + print(a.url) + b = CategoriesMetadata() + print(b.url) + + +class UrlBuilderMetadata(UrlBuilder): + ... + + def get_url(self): + ... + + def categories(self): + """""" + # 4.1 Category Service + # https://evds2.tcmb.gov.tr/service/evds/categories/type=json + + def datagroups_mode_1(self, name="bie_yssk"): + """ + https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=1&code=bie_yssk&type=json + :return: + """ + ... + + def datagroups_mode_2(self, code=1): + """ + https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=2&code=2&type=json + :return: + """ + ... + + def data_group_service(self): + """data_group_service""" + """ + The data group listing is based on the following filtering: + mode=0 Returns all data groups under all categories. + mode=1 Returns data group information according to a data group selection. + mode=2 Returns all data groups information according to a category + mode 1 + code=data group code + mode 2 + code=category code + https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=1&code=bie_yssk&type=json + https://evds2.tcmb.gov.tr/service/evds/datagroups/mode=2&code=2&type=xml + DATAGROUP_CODE Data Group Code + DATAGROUP_NAME Data Group Name (Turkish) + DATAGROUP_NAME_ENG Data Group Name (English) + START_DATE Data Start Date + END_DATE Date End Date + FREQUENCY Original Frequency + FREQUENCY_STR Original Frequency Desc. + DATASOURCE Data Source (Turkish) + DATASOURCE_ENG Data Source (English) + METADATA_LINK Metadata Link (Turkish) + METADATA_LINK_ENG Metadata Link (English) + REV_POL_LINK Revision Policy Link (Turkish) + REV_POL_LINK_ENG Revision Policy Link (English) + APP_CHA_LINK Application Change Link (Turkish) + APP_CHA_LINK_ENG Application Change Link (English) + NOTE Information Note (Turkish) + NOTE_ENG Information Note (English) + """ + # 4.2 Data Group Service + + +from abc import ABC, abstractmethod + + +class GuideMetadata: + def get_meta(self): + ... + + def display_meta(self): + ... + + +class UrlBuilderMetadataCategories(UrlBuilderMetadata, GuideMetadata): + """ + UrlBuilderMetadataCategories + """ + + +class UrlBuilderMetadataDataGroup(UrlBuilderMetadata, GuideMetadata): + """ + UrlBuilderMetadataCategories + """ diff --git a/evdspy/EVDSlocal/requests_/test_reg_result.pickle b/evdspy/EVDSlocal/requests_/test_reg_result.pickle new file mode 100644 index 0000000000000000000000000000000000000000..78cacabb3e49de3aaf40b2a0c695d30cb5a33454 GIT binary patch literal 10279 zcmeHN-EZ606;}|)cHKI55+J~^7SQ}KB&GF5S+W$vz+_2v99fhq$%)-AY0ZHBE&B(y$DPX$OKvvIS&O0t6a*sgIpwN}d)-=K^IoU^{$5?G9?0EZ zhnrLmc6S%IG}T5Qtl^eVfRX5~Ly@j=jNz?BdKZ`EGD_}d>> zlUtVa#h<~u)RyzbU)XALQoI_O$Bu407Nx7n`Z2?fi3~8teduzr{ntMQ9zd$Pt-Ve) zOk=gVbx|4*S>5XNxCUaW@bt>NJ5qzYM;No|y-eol=qSyUVLv^vMrr0`j%=DaQid6r zHxnx?)9YkftSYYGRh!vs~Qx~U>l=%RsvRDGZe4F{{b0C`i~%qyP@-B6$_KHSaTY0|vUx6*?_Bz0pzbveQ;S|)SpcZ5D1X4{w z?SH;hrl9s!KrPR)@O40K?XsW-hEq_Rg4z_+{-2%l6x6;7sI9#&s1+^?YG618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