def main():
    wikimedia_connection.set_cache_location(osm_handling_config.get_wikimedia_connection_cache_location())
    osm = Data(common.get_file_storage_location() + "/" + args.file)
    if args.flush_cache_for_reported_situations:
        osm.iterate_over_data(validate_wikipedia_link_on_element_and_print_problems_refresh_cache_for_reported)
    else:
        osm.iterate_over_data(validate_wikipedia_link_on_element_and_print_problems)
 def test_rejects_links_to_spacecraft(self):
     wikimedia_connection.set_cache_location(
         osm_handling_config.get_wikimedia_connection_cache_location())
     self.assertNotEqual(
         None,
         wikimedia_link_issue_reporter.WikimediaLinkIssueDetector().
         get_error_report_if_property_indicates_that_it_is_unlinkable_as_primary(
             'Q2513'))
def main():
    wikimedia_connection.set_cache_location(osm_handling_config.get_wikimedia_connection_cache_location())
    # for testing: api="https://api06.dev.openstreetmap.org", 
    # website at https://master.apis.dev.openstreetmap.org/
    reported_errors = load_errors()
    #requires manual checking is it operating in Poland #add_wikipedia_tag_from_wikidata_tag(reported_errors)
    add_wikidata_tag_from_wikipedia_tag(reported_errors) #self-checking location based on Wikipedia language code
    for e in reported_errors:
        #handle_follow_wikipedia_redirect(e)
        #change_to_local_language(e)
        pass
 def ensure_that_wikidata_id_is_recognized_as_not_linkable_as_primary(
         self, wikidata_id):
     passed_tags = {}
     wikimedia_connection.set_cache_location(
         osm_handling_config.get_wikimedia_connection_cache_location())
     primary_linkability_status = self.issue_reporter(
     ).get_error_report_if_secondary_wikipedia_tag_should_be_used(
         wikidata_id, passed_tags)
     if primary_linkability_status == None:
         self.issue_reporter().output_debug_about_wikidata_item(wikidata_id)
     self.assertNotEqual(None, primary_linkability_status)
def main():
    wikimedia_connection.set_cache_location(
        osm_handling_config.get_wikimedia_connection_cache_location())
    osm = Data(args.filepath)
    if args.flush_cache_for_reported_situations:
        osm.iterate_over_data(
            validate_wikipedia_link_on_element_and_print_problems_refresh_cache_for_reported
        )
    else:
        osm.iterate_over_data(
            validate_wikipedia_link_on_element_and_print_problems)
def main():
    wikimedia_connection.set_cache_location(
        osm_handling_config.get_wikimedia_connection_cache_location())
    # for testing: api="https://api06.dev.openstreetmap.org",
    # website at https://master.apis.dev.openstreetmap.org/
    reported_errors = load_errors()
    add_wikipedia_tag_from_wikidata_tag(
        reported_errors
    )  # check with is_edit_allowed_object_based_on_location function
    add_wikidata_tag_from_wikipedia_tag(
        reported_errors
    )  # self-checking location based on Wikipedia language code
    for e in reported_errors:
        handle_follow_wikipedia_redirect(
            e
        )  # self-checking location based on Wikipedia language code [pl required]
        #change_to_local_language(e) - discussion missing
        pass
    def test_that_indian_teritory_is_considered_as_linkable_by_passing_tags(
            self):
        wikidata_id = 'Q1516298'
        passed_tags = {}
        wikimedia_connection.set_cache_location(
            osm_handling_config.get_wikimedia_connection_cache_location())
        primary_linkability_status = self.issue_reporter(
        ).get_error_report_if_secondary_wikipedia_tag_should_be_used(
            wikidata_id, passed_tags)
        if primary_linkability_status == None:
            self.issue_reporter().output_debug_about_wikidata_item(wikidata_id)
        self.assertNotEqual(None, primary_linkability_status)

        wikidata_id = 'Q1516298'
        passed_tags = {'boundary': 'aboriginal_lands'}
        wikimedia_connection.set_cache_location(
            osm_handling_config.get_wikimedia_connection_cache_location())
        primary_linkability_status = self.issue_reporter(
        ).get_error_report_if_secondary_wikipedia_tag_should_be_used(
            wikidata_id, passed_tags)
        if primary_linkability_status != None:
            self.issue_reporter().output_debug_about_wikidata_item(wikidata_id)
        self.assertEqual(None, primary_linkability_status)
 def is_unlinkable_check(self, type_id):
     wikimedia_connection.set_cache_location(
         osm_handling_config.get_wikimedia_connection_cache_location())
     return wikimedia_link_issue_reporter.WikimediaLinkIssueDetector(
     ).get_error_report_if_type_unlinkable_as_primary(type_id, {})
 def is_unlinkable_check(self, type_id):
     wikimedia_connection.set_cache_location(osm_handling_config.get_wikimedia_connection_cache_location())
     return wikimedia_link_issue_reporter.WikimediaLinkIssueDetector().get_error_report_if_type_unlinkable_as_primary(type_id)
 def test_rejects_links_to_spacecraft(self):
     wikimedia_connection.set_cache_location(osm_handling_config.get_wikimedia_connection_cache_location())
     self.assertNotEqual(None, wikimedia_link_issue_reporter.WikimediaLinkIssueDetector().get_error_report_if_property_indicates_that_it_is_unlinkable_as_primary('Q2513'))
Beispiel #11
0
import wikimedia_connection.wikimedia_connection as wikimedia_connection
import osm_handling_config.global_config as osm_handling_config
import os

wikimedia_connection.set_cache_location(
    osm_handling_config.get_wikimedia_connection_cache_location())
kill = [""]  #NOT FLUSHED YET!
"""
# use like this:
kill = ["Q45621"]
"""
for id in kill:
    os.remove(wikimedia_connection.get_filename_with_wikidata_entity_by_id(id))
    os.remove(
        wikimedia_connection.get_filename_with_wikidata_by_id_response_code(
            id))
"""
flush.py Q49833

flushes cache of Q49833
"""
 def test_complain_function(self):
     wikimedia_connection.set_cache_location(
         osm_handling_config.get_wikimedia_connection_cache_location())
     self.issue_reporter(
     ).complain_in_stdout_if_wikidata_entry_not_of_known_safe_type(
         'Q824359', "explanation")
 def test_576_in_future(self):
     wikimedia_connection.set_cache_location(
         osm_handling_config.get_wikimedia_connection_cache_location())
     self.assertEqual(
         self.issue_reporter().check_is_object_is_existing('Q650270'), None)
def load_data():
    wikimedia_connection.set_cache_location(osm_handling_config.get_wikimedia_connection_cache_location())
    file = "teryt_simc.osm"
    osm = Data(common.get_file_storage_location() + "/" + file)
    osm.iterate_over_data(record_presence)
    return get_wikidata_OSM_pairs()
 def test_args_depending_code_for_behavior(self):
     wikimedia_connection.set_cache_location(
         osm_handling_config.get_wikimedia_connection_cache_location())
 def test_args_depending_code_for_behavior(self):
     wikimedia_connection.set_cache_location(osm_handling_config.get_wikimedia_connection_cache_location())