Create and initializes a new symbol from a string
        :param content: The content of a symbol as read from the text-file in the form <label>:<sequence>:<image>
        :return: The initialized symbol
        :rtype: CapitanSymbol
14598
def initialize_from_string(content: str) -> 'CapitanSymbol':
        

        if content is None or content is "":
            return None

        parts = content.split(":")
        min_x = 100000
        max_x = 0
        min_y = 100000
        max_y = 0

        symbol_name = parts[0]

        sequence = parts[1]
        image_numbers = parts[2].split(',')
        image_data = numpy.asarray(image_numbers, numpy.uint8).reshape((30, 30))

        stroke = []

        for point_string in sequence.split(";"):
            if point_string is "":
                continue  # Skip the last element, that is due to a trailing ; in each line

            point_x, point_y = point_string.split(",")
            x = float(point_x)
            y = float(point_y)
            stroke.append(SimplePoint2D(x, y))

            max_x = max(max_x, x)
            min_x = min(min_x, x)
            max_y = max(max_y, y)
            min_y = min(min_y, y)

        dimensions = Rectangle(Point2D(min_x, min_y), int(max_x - min_x + 1), int(max_y - min_y + 1))
        return CapitanSymbol(content, stroke, image_data, symbol_name, dimensions)
79788
def newComment(content):
    
    ret = libxml2mod.xmlNewComment(content)
    if ret is None:raise treeError('xmlNewComment() failed')
    return xmlNode(_obj=ret)
1001898
def parse(self, contents):
        
        i = 0
        for text in contents.split(self.delim):
            if not len(text.strip()):
                continue
            words = text.split()
            char_offsets = [0] + [
                int(_) for _ in np.cumsum([len(x) + 1 for x in words])[:-1]
            ]
            text = " ".join(words)
            yield {
                "text": text,
                "words": words,
                "pos_tags": [""] * len(words),
                "ner_tags": [""] * len(words),
                "lemmas": [""] * len(words),
                "dep_parents": [0] * len(words),
                "dep_labels": [""] * len(words),
                "char_offsets": char_offsets,
                "abs_char_offsets": char_offsets,
            }
            i += 1
1042394
def fmt_content(text, width = 0, align = '<', padding = None, padding_left = None, padding_right = None, padding_char = ' '):
        
        if padding_left is None:
            padding_left = padding
        if padding_right is None:
            padding_right = padding
        if padding_left is not None:
            text = '{}{}'.format(str(padding_char)[0] * int(padding_left), text)
        if padding_right is not None:
            text = '{}{}'.format(text, str(padding_char)[0] * int(padding_right))
        if width:
            strptrn = '{:' + ('{}{}{}'.format(str(padding_char)[0], str(TEXT_ALIGNMENT[align]), str(width))) + 's}'
            text = strptrn.format(text)
        return text
878245
function(tag, start_line, start_column) {
  return { t: tag,
           open: true,
           last_line_blank: false,
           start_line: start_line,
           start_column: start_column,
           end_line: start_line,
           children: [],
           parent: null,
           // string_content is formed by concatenating strings, in finalize:
           string_content: "",
           strings: [],
           inline_content: []
        };
}
1127428
def gen(self, text, start=0):
        

        for cc in self.chunkComment(text, start):
            c = self.extractChunkContent(cc)
            cc = ''.join(cc)
            m = self.matchComment(c)
            idx = text.index(cc, start)
            e = idx + len(cc)
            if m:
                assert text[idx:e] == cc

                try:
                    end = text.index('\n\n', e - 1) + 1
                except ValueError:
                    end = len(text)
                text = text[:e] + text[end:]
                new = self.genOutputs(self.code(text), m)
                new = ''.join(new)
                text = text[:e] + new + text[e:]

                return self.gen(text, e + len(new))
        return text
1144315
public static function newFromString(string $content): self
    {
        $document = Xml::newDocumentContent($content);
        // populate source since it is already available
        // in this way we avoid the conversion from document to string
        $cfdi = new self($document);
        $cfdi->source = $content;
        return $cfdi;
    }
1265735
def unwrap_raw(content):
    
    starting_symbol = get_start_symbol(content)
    ending_symbol = ']' if starting_symbol == '[' else '}'
    start = content.find(starting_symbol, 0)
    end = content.rfind(ending_symbol)
    return content[start:end+1]
1373784
def body(self, content):
        
        body = Element('Body', ns=envns)
        body.append(content)
        return body
1260892
def new(self, text):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('This File or Text identifier is already initialized')

        if len(text) != 128:
            raise pycdlibexception.PyCdlibInvalidInput('Length of text must be 128')

        self.text = text

        self._initialized = True
477221
def content(self, contents):
        
        if isinstance(contents, list):
            for c in contents:
                self.add_content(c)
        else:
            self.add_content(contents)
1355589
function (content) {
      var innerSelf = this;

      return self._readFile()
        .then(function (fileContent) {
          fileContent.instances = fileContent.instances || {};
          fileContent.instances[innerSelf._id] = _.assign(fileContent.instances[innerSelf._id] || {}, content);

          return self._writeFile(fileContent);
        });
    }
1345315
public static UniversalIdStrMessage newInstance(byte[] content) {
        UniversalIdStrMessage msg = newInstance();
        msg.setContent(content);
        return msg;
    }
285946
public static UniversalIdStrQueueMessage newInstance(String content) {
        UniversalIdStrQueueMessage msg = newInstance();
        msg.setContent(content);
        return msg;
    }
392269
def html_init(name):
    
    result = ""
    result += "<html>\n"
    result += "<head>\n"
    result += "<title>" + str(name) + "</title>\n"
    result += "</head>\n"
    result += "<body>\n"
    result += '<h1 style="border-bottom:1px solid ' \
              'black;text-align:center;">PyCM Report</h1>'
    return result
1275060
public static UniversalIdIntQueueMessage newInstance(byte[] content) {
        UniversalIdIntQueueMessage msg = newInstance();
        msg.setContent(content);
        return msg;
    }
40199
def content_from_string(repo, text)
      mode, type, id, name = text.split(/ |\t/, 4)
      case type
        when "tree"
          Tree.create(repo, :id => id, :mode => mode, :name => name)
        when "blob"
          Blob.create(repo, :id => id, :mode => mode, :name => name)
        when "link"
          Blob.create(repo, :id => id, :mode => mode, :name => name)
        when "commit"
          Submodule.create(repo, :id => id, :mode => mode, :name => name)
        else
          raise Grit::InvalidObjectType, type
      end
    end