Returns a function that serializes container start/end.

    Args:
        suffix (str): The suffix to name the function with.
        container_map (Dictionary[core.IonType, bytes]): The

    Returns:
        function: The closure for serialization.
517377
def _serialize_container_factory(suffix, container_map):
    
    def serialize(ion_event):
        if not ion_event.ion_type.is_container:
            raise TypeError('Expected container type')
        return container_map[ion_event.ion_type]
    serialize.__name__ = '_serialize_container_' + suffix
    return serialize
1269139
def suffix(filename,suffix):
    '''  '''
    return os.path.split(re.sub(_afni_suffix_regex,"%s\g<1>" % suffix,str(filename)))[1]
144432
function(fn, suffix) {
	if(suffix.charAt(0) !== '.') {
		suffix = '.' + suffix;
	}
	
	if(fn.length <= suffix.length) {
		return false;
	}
	
	var str = fn.substring(fn.length - suffix.length).toLowerCase();
	suffix = suffix.toLowerCase();
	return str === suffix;
}
234393
def bind(self, container):
        

        def clone(prototype):
            if prototype.is_bound():
                raise RuntimeError('Cannot `bind` a bound extension.')

            cls = type(prototype)
            args, kwargs = prototype.__params
            instance = cls(*args, **kwargs)
            # instance.container must be a weakref to avoid a strong reference
            # from value to key in the `shared_extensions` weakkey dict
            # see test_extension_sharing.py: test_weakref
            instance.container = weakref.proxy(container)
            return instance

        instance = clone(self)

        # recurse over sub-extensions
        for name, ext in inspect.getmembers(self, is_extension):
            setattr(instance, name, ext.bind(container))
        return instance
568010
def p_end_function(p):
    
    p[0] = p[1]
    p[0].append(node.return_stmt(ret=ret_expr))
    p[0].append(node.comment_stmt("\nif __name__ == '__main__':\n    pass"))
1262263
def name_append_suffix(records, suffix):
    
    logging.info('Applying _name_append_suffix generator: '
                 'Appending suffix ' + suffix + ' to all '
                 'sequence IDs.')
    for record in records:
        new_id = record.id + suffix
        _update_id(record, new_id)
        yield record
42043
def extend_name(suffix):
    

    def dec(cls):
        name = '{}{}'.format(cls.__name__, suffix)
        setattr(cls, '__name__', name)
        return cls

    return dec
794871
public static Predicate<String> endsWith(final String suffix) {
		return new Predicate<String>() {
			@Override
			public boolean apply(final String input) {
				return input.endsWith(suffix);
			}
		};
	}
265455
def basename(self, suffix=''):
		''' '''
		return os.path.basename(self._file, suffix) if self._file else None
629685
public boolean endsWith(Bytes suffix) {
    Objects.requireNonNull(suffix, "endsWith(Bytes suffix) cannot have null parameter");
    int startOffset = this.length - suffix.length;

    if (startOffset < 0) {
      return false;
    } else {
      int end = startOffset + this.offset + suffix.length;
      for (int i = startOffset + this.offset, j = suffix.offset; i < end; i++, j++) {
        if (this.data[i] != suffix.data[j]) {
          return false;
        }
      }
    }
    return true;
  }
1291441
def _versioned_lib_suffix(env, suffix, version):
    """'"""
    Verbose = False
    if Verbose:
        print("_versioned_lib_suffix: suffix={:r}".format(suffix))
        print("_versioned_lib_suffix: version={:r}".format(version))
    if not suffix.endswith(version):
        suffix = suffix + '.' + version
    if Verbose:
        print("_versioned_lib_suffix: return suffix={:r}".format(suffix))
    return suffix
759340
def from_prefix(cls, container, prefix):
        """"""
        if cls._is_gs_folder(prefix):
            name, suffix, extra = prefix.name.partition(cls._gs_folder_suffix)
            if (suffix, extra) == (cls._gs_folder_suffix, ''):
                # Patch GS specific folder to remove suffix.
                prefix.name = name

        return super(GsObject, cls).from_prefix(container, prefix)
188600
public static Predicate<File> endsWithPredicate(final String suffix) {
    checkArgument(!suffix.isEmpty());

    return new EndsWithPredicate(suffix);
  }
862927
def remove_vectored_io_slice_suffix_from_name(name, slice):
    # type: (str, int) -> str
    
    suffix = '.bxslice-{}'.format(slice)
    if name.endswith(suffix):
        return name[:-len(suffix)]
    else:
        return name
473490
def get(self, suffix, params=None):
        

        url = self.base + suffix
        params = filter_params(params)

        response = self.session.get(url=url, params=params)

        return self._handler_response(response)
505893
private function getFunctionName($prefix, $file, $suffix, $key = 0)
    {
        if (preg_match(self::getRegex(), strtolower($file), $matches)) {
            $format = self::$suffixes[$matches[1]];

            if (is_array($format)) {
                $format = $format[$key];
            }

            return sprintf('%s%s%s', $prefix, $format, $suffix);
        }
    }
246142
def rdf_suffix(fmt: str) -> str:
    
    for k, v in SUFFIX_FORMAT_MAP.items():
        if fmt == v:
            return k
    return 'rdf'