Test if comic name already exists.
322719
def has_gocomics_comic(name):
    """"""
    cname = "Gocomics/%s" % name
    for scraperclass in get_scraperclasses():
        lname = scraperclass.getName().lower()
        if lname == cname.lower():
            return True
    return False
124310
def exists(name, delimiter=DEFAULT_TARGET_DELIM):
    '''
    
    '''
    name = re.sub(delimiter, DEFAULT_TARGET_DELIM, name)
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'Grain exists'}
    _non_existent = object()
    existing = __salt__['grains.get'](name, _non_existent)
    if existing is _non_existent:
        ret['result'] = False
        ret['comment'] = 'Grain does not exist'
    return ret
1272703
def check_scrapers():
    """"""
    d = {}
    for scraperclass in _scraperclasses:
        name = scraperclass.getName().lower()
        if name in d:
            name1 = scraperclass.getName()
            name2 = d[name].getName()
            raise ValueError('duplicate scrapers %s and %s found' % (name1, name2))
        d[name] = scraperclass
1015001
def exists(self, fileDirSpec, **kwargs):
            

            str_path        = self.cwd()
            for k,v in kwargs.items():
                if k == 'path': str_path    = v
            if fileDirSpec in self.lstr_lsnode(str_path):
                return True
            if fileDirSpec in self.lsf(str_path):
                return True
            return False
186930
def exists(self, filename):
        """"""
        client = boto3.client("s3")
        bucket, path = self.bucket_and_path(filename)
        r = client.list_objects(Bucket=bucket, Prefix=path, Delimiter="/")
        if r.get("Contents") or r.get("CommonPrefixes"):
            return True
        return False
793520
def comicDownloaded(self, comic, filename, text=None):
        """"""
        if self.lastComic != comic.name:
            self.newComic(comic)
        size = None
        if self.allowdownscale:
            size = getDimensionForImage(filename, MaxImageSize)
        imageUrl = self.getUrlFromFilename(filename)
        pageUrl = comic.referrer
        if pageUrl != self.lastUrl:
            self.html.write(u'<li><a href="%s">%s</a>\n' % (pageUrl, pageUrl))
        self.html.write(u'<br/><img src="%s"' % imageUrl)
        if size:
            self.html.write(' width="%d" height="%d"' % size)
        self.html.write('/>\n')
        if text:
            self.html.write(u'<br/>%s\n' % text)
        self.lastComic = comic.name
        self.lastUrl = pageUrl
354998
def detect_file(filename):
    """"""
    image_format = get_image_format(filename)

    if image_format in Settings.formats:
        return image_format

    if image_format in (NONE_FORMAT, ERROR_FORMAT):
        return None

    if Settings.verbose > 1 and not Settings.list_only:
        print(filename, image_format, 'is not a enabled image or '
              'comic archive type.')
    return None
1103174
def _exists_with_etag(self, name, content):
        
        url = self._get_url(name)
        response = requests.head(url)
        if response.status_code == 404:
            return False
        etag = response.headers['ETAG'].split('"')[1]
        hash = self.file_hash(name, content)
        return etag.startswith(hash)
390969
def exists(self, pattern, **match_kwargs):
        
        ret = self.match(pattern, **match_kwargs)
        if ret is None:
            return None
        if not ret.matched:
            return None
        return ret
1126036
def check_files_exist(filenames):
    ''''''
    files_not_found = [x for x in filenames if not os.path.exists(x)]
    if len(files_not_found):
        for filename in files_not_found:
            print('File not found: "', filename, '"', sep='', file=sys.stderr)
        raise Error('File(s) not found. Cannot continue')
727962
def do_files_exist(filenames):
  """"""
  preexisting = [tf.io.gfile.exists(f) for f in filenames]
  return any(preexisting)
813678
def image_exists(self, image_id):
        
        logger.info("checking whether image '%s' exists", image_id)
        logger.debug("image_id = '%s'", image_id)
        try:
            response = self.d.inspect_image(image_id)
        except APIError as ex:
            logger.warning(repr(ex))
            response = False
        else:
            response = response is not None
        logger.debug("image exists: %s", response)
        return response
236549
def could_be(self, other):
        """"""
        # TODO: Some suffix and title differences should be allowed
        if type(other) is not type(self):
            return NotImplemented
        if self == other:
            return True
        for attr in ['title', 'firstname', 'middlename', 'nickname', 'prefix', 'lastname', 'suffix']:
            if attr not in self or attr not in other:
                continue
            puncmap = dict((ord(char), None) for char in string.punctuation)
            s = self[attr].lower().translate(puncmap)
            o = other[attr].lower().translate(puncmap)
            if s == o:
                continue
            if attr in {'firstname', 'middlename', 'lastname'}:
                if (({len(comp) for comp in s.split()} == {1} and [el[0] for el in o.split()] == s.split()) or
                        ({len(comp) for comp in o.split()} == {1} and [el[0] for el in s.split()] == o.split())):
                    continue
            return False
        return True
659537
def newComic(self, comic):
        """"""
        if self.lastUrl is not None:
            self.html.write(u'</li>\n')
        if self.lastComic is not None:
            self.html.write(u'</ul>\n')
        self.html.write(u'<li>%s</li>\n' % comic.name)
        self.html.write(u'<ul>\n')
872281
def _file_exists(path, filename):
  """"""
  return os.path.isfile(os.path.join(path, filename))
265268
def getScrapers(comics, basepath=None, adult=True, multiple_allowed=False, listing=False):
    """"""
    if '@' in comics:
        # only scrapers whose directory already exists
        if len(comics) > 1:
            out.warn(u"using '@' as comic name ignores all other specified comics.")
        for scraperclass in scraper.get_scraperclasses():
            dirname = getDirname(scraperclass.getName())
            if os.path.isdir(os.path.join(basepath, dirname)):
                if shouldRunScraper(scraperclass, adult, listing):
                    yield scraperclass()
    elif '@@' in comics:
        # all scrapers
        for scraperclass in scraper.get_scraperclasses():
            if shouldRunScraper(scraperclass, adult, listing):
                yield scraperclass()
    else:
        # get only selected comic scrapers
        # store them in a set to eliminate duplicates
        scrapers = set()
        for comic in comics:
            # Helpful when using shell completion to pick comics to get
            comic = comic.rstrip(os.path.sep)
            if basepath and comic.startswith(basepath):
                # make the following command work:
                # find Comics -type d | xargs -n1 -P10 dosage -b Comics
                comic = comic[len(basepath):].lstrip(os.sep)
            if ':' in comic:
                name, index = comic.split(':', 1)
                indexes = index.split(',')
            else:
                name = comic
                indexes = None
            scraperclasses = scraper.find_scraperclasses(name, multiple_allowed=multiple_allowed)
            for scraperclass in scraperclasses:
                if shouldRunScraper(scraperclass, adult, listing):
                    scraperobj = scraperclass(indexes=indexes)
                    if scraperobj not in scrapers:
                        scrapers.add(scraperobj)
                        yield scraperobj
130981
function isExist(dir) {
  dir = path.normalize(dir);
  try {
    fs.accessSync(dir, fs.R_OK);
    return true;
  } catch (e) {
    return false;
  }
}