Code Duplication    Length = 18-31 lines in 2 locations

pylast/__init__.py 2 locations

@@ 496-526 (lines=31) @@
493
        if location:
494
            params["location"] = location
495
        if limit:
496
            params["limit"] = limit
497
        if distance:
498
            params["distance"] = distance
499
        if tag:
500
            params["tag"] = tag
501
        if festivalsonly:
502
            params["festivalsonly"] = 1
503
        elif not festivalsonly:
504
            params["festivalsonly"] = 0
505
506
        doc = _Request(self, "geo.getEvents", params).execute(cacheable)
507
508
        return _extract_events_from_doc(doc, self)
509
510
    def get_metro_weekly_chart_dates(self, cacheable=True):
511
        """
512
        Returns a list of From and To tuples for the available metro charts.
513
        """
514
515
        doc = _Request(self, "geo.getMetroWeeklyChartlist").execute(cacheable)
516
517
        seq = []
518
        for node in doc.getElementsByTagName("chart"):
519
            seq.append((node.getAttribute("from"), node.getAttribute("to")))
520
521
        return seq
522
523
    def get_metros(self, country=None, cacheable=True):
524
        """
525
        Get a list of valid countries and metros for use in the other
526
        webservices.
527
        Parameters:
528
        country (Optional) : Optionally restrict the results to those Metros
529
            from a particular country, as defined by the ISO 3166-1 country
@@ 359-376 (lines=18) @@
356
357
            ...and provide us with the name of your client and its homepage
358
            address.
359
        """
360
361
        _deprecation_warning(
362
            "Use _Network.scrobble(...), _Network.scrobble_many(...),"
363
            " and Network.update_now_playing(...) instead")
364
365
        return Scrobbler(self, client_id, client_version)
366
367
    def _get_language_domain(self, domain_language):
368
        """
369
            Returns the mapped domain name of the network to a DOMAIN_* value
370
        """
371
372
        if domain_language in self.domain_names:
373
            return self.domain_names[domain_language]
374
375
    def _get_url(self, domain, url_type):
376
        return "http://%s/%s" % (
377
            self._get_language_domain(domain), self.urls[url_type])
378
379
    def _get_ws_auth(self):