Clean title with the use of og:site_name
        in this case try to get rid of site name
        and use TITLE_SPLITTERS to reformat title
969979
def clean_title(self, title):
        
        # check if we have the site name in opengraph data
        if "site_name" in self.article.opengraph.keys():
            site_name = self.article.opengraph['site_name']
            # remove the site name from title
            title = title.replace(site_name, '').strip()

        # try to remove the domain from url
        if self.article.domain:
            pattern = re.compile(self.article.domain, re.IGNORECASE)
            title = pattern.sub("", title).strip()

        # split the title in words
        # TechCrunch | my wonderfull article
        # my wonderfull article | TechCrunch
        title_words = title.split()

        # check for an empty title
        # so that we don't get an IndexError below
        if len(title_words) == 0:
            return u""

        # check if first letter is in TITLE_SPLITTERS
        # if so remove it
        if title_words[0] in TITLE_SPLITTERS:
            title_words.pop(0)

        # check if last letter is in TITLE_SPLITTERS
        # if so remove it
        if title_words[-1] in TITLE_SPLITTERS:
            title_words.pop(-1)

        # rebuild the title
        title = u" ".join(title_words).strip()

        return title
1061424
def cleanse(self):
        """"""
        from .util import slugify

        self.ensure_identifier()

        try:
            self.update_name()
        except MetatabError:

            identifier = self['Root'].find_first('Root.Identifier')

            name = self['Root'].find_first('Root.Name')

            if name and name.value:
                name.value = slugify(name.value)
            elif name:
                name.value = slugify(identifier.value)
            else:
                self['Root'].get_or_new_term('Root.Name').value = slugify(identifier.value)
1222945
def clean_name(self, suffix=True, prefix=False, middle=False, multi=False):
		""

		name = self.business_name

		# Run it through the string_stripper once more
		name = self.string_stripper(name)
		loname = name.lower()
		
		# return name without suffixed/prefixed/middle type term(s)

		for item in suffix_sort:
			if suffix:
				if loname.endswith(" " + item):
					start = loname.find(item)
					end = len(item)
					name = name[0:-end-1]
					name = self.string_stripper(name)
					if multi==False:
						break
			if prefix:
				if loname.startswith(item+' '):
					name = name[len(item)+1:]
					if multi==False:
						break
			if middle:
				term = ' ' + item + ' '
				if term in loname:
					start = loname.find(term)
					end = start + len(term)
					name = name[:start] + " " + name[end:]
					if multi==False:
						break

		return self.string_stripper(name)
967854
def derive_title(self):
        
        if not self.title:
            return _("Create %s") % force_text(self.model._meta.verbose_name).title()
        else:
            return self.title
1291823
function clean(test) {
  var err = test.err || {};
  if (err instanceof Error) {
    err = errorJSON(err);
  }

  return {
    title: test.title,
    fullTitle: test.fullTitle(),
    duration: test.duration,
    currentRetry: test.currentRetry(),
    err: cleanCycles(err)
  };
}
855943
def site_cleanup(sender, action, instance, **kwargs):
    
    if action == 'post_add':
        if isinstance(instance, Preferences) \
            and hasattr(instance.__class__, 'objects'):
            site_conflicts = instance.__class__.objects.filter(
                sites__in=instance.sites.all()
            ).only('id').distinct()

            for conflict in site_conflicts:
                if conflict.id != instance.id:
                    for site in instance.sites.all():
                        conflict.sites.remove(site)
239908
function reformatFormIdAndName(submission) {
  var formName = "Unknown";
  if (submission && submission.formId && submission.formId.name) {
    formName = submission.formId.name;
  }

  if (submission && submission.formSubmittedAgainst) {
    formName = submission.formSubmittedAgainst.name;
  }

  submission.formName = formName;
  submission.formId = submission.formId.toString();
  return submission;
}
584020
def clean_names(lines, ensure_unique_names=False, strip_prefix=False,
                make_database_safe=False):
    
    names = {}

    for row in lines:
        if strip_prefix:
            row['name'] = row['name'][row['name'].find('-') + 1:]

            if row['indexed_by'] is not None:
                row['indexed_by'] = row['indexed_by'][row['indexed_by'].find(
                    '-') + 1:]

        if ensure_unique_names:
            i = 1
            while (row['name'] if i == 1 else
                   row['name'] + "-" + str(i)) in names:
                i += 1

            names[row['name'] if i == 1 else row['name'] + "-" + str(i)] = 1

            if i > 1:
                row['name'] = row['name'] + "-" + str(i)

        if make_database_safe:
            row['name'] = row['name'].replace("-", "_")
    return lines
1175735
def CleanName(name):
        """"""
        name = re.sub('[^_A-Za-z0-9]', '_', name)
        if name[0].isdigit():
            name = '_%s' % name
        while keyword.iskeyword(name):
            name = '%s_' % name
        # If we end up with __ as a prefix, we'll run afoul of python
        # field renaming, so we manually correct for it.
        if name.startswith('__'):
            name = 'f%s' % name
        return name
987124
function() {
  var title = this.match(reLinkTitle);
  if (title) {
    // chop off quotes from title and unescape:
    return unescape(title.substr(1, title.length - 2));
  } else {
    return null;
  }
}
743751
def site_name(self, site_name):
        
        # Set base class property site_name
        _Pybooru.site_name.fset(self, site_name)

        if ('api_version' and 'hashed_string') in SITE_LIST[site_name]:
            self.api_version = SITE_LIST[site_name]['api_version']
            self.hash_string = SITE_LIST[site_name]['hashed_string']
262901
public function cleanUrlHandler(): void
    {
        global $pretext;

        $basename = explode('?', (string) $pretext['request_uri']);
        $basename = basename(array_shift($basename));

        if ($basename === 'robots.txt') {
            $this->sendRobots();
        }

        if ($basename === 'sitemap.xml' || $basename === 'sitemap.xml.gz') {
            $this->populateArticleFields()->sendSitemap();
        }
    }
171962
def __StripName(self, name):
        """"""
        if not name:
            return name
        for prefix in self.__strip_prefixes:
            if name.startswith(prefix):
                return name[len(prefix):]
        return name
1078129
def split_title(title, width, title_fs):
    """"""
    titles = []
    if not title:
        return titles
    size = reverse_text_len(width, title_fs * 1.1)
    title_lines = title.split("\n")
    for title_line in title_lines:
        while len(title_line) > size:
            title_part = title_line[:size]
            i = title_part.rfind(' ')
            if i == -1:
                i = len(title_part)
            titles.append(title_part[:i])
            title_line = title_line[i:].strip()
        titles.append(title_line)
    return titles
170888
def format_as_title(str, io)
      if Cri::Platform.color?(io)
        bold(red(str.upcase))
      else
        str.upcase
      end
    end
164223
function cleanTitle( el ) {
		var txt = cleanPath( el.innerHTML );
		var idx = txt.indexOf( 'stdlib' );
		if ( idx === -1 || idx === 1 ) { // e.g., '@stdlib/types/iter'
			txt = 'stdlib | ' + txt;
		} else if ( txt.indexOf( ' | stdlib' ) === txt.length-9 ) { // e.g., 'foo/bar | stdlib'
			txt = 'stdlib | ' + txt.slice( 0, -9 );
		}
		el.innerHTML = txt;
	}
1020146
def clean_filename(s, minimal_change=False):
    

    # First, deal with URL encoded strings
    h = html_parser.HTMLParser()
    s = h.unescape(s)
    s = unquote_plus(s)

    # Strip forbidden characters
    # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
    s = (
        s.replace(':', '-')
        .replace('/', '-')
        .replace('<', '-')
        .replace('>', '-')
        .replace('"', '-')
        .replace('\\', '-')
        .replace('|', '-')
        .replace('?', '-')
        .replace('*', '-')
        .replace('\x00', '-')
        .replace('\n', ' ')
    )

    # Remove trailing dots and spaces; forbidden on Windows
    s = s.rstrip(' .')

    if minimal_change:
        return s

    s = s.replace('(', '').replace(')', '')
    s = s.rstrip('.')  # Remove excess of trailing dots

    s = s.strip().replace(' ', '_')
    valid_chars = '-_.()%s%s' % (string.ascii_letters, string.digits)
    return ''.join(c for c in s if c in valid_chars)