Process API paths, returning an object with descriptors keyed by tag name.
It is required that operations define a single tag, or they are ignored.
330457
function processServices(swagger, models, options) {
  var param, name, i, j;
  var services = {};
  var minParamsForContainer = options.minParamsForContainer || 2;
  var sortParams = options.sortParams || 'desc';
  for (var url in swagger.paths) {
    var path = swagger.paths[url];
	  var methodParameters = path.parameters;
    for (var method in path || {}) {
      var def = path[method];
      if (!def || method == 'parameters') {
        continue;
      }
      var tags = def.tags || [];
      var tag = tagName(tags.length == 0 ? null : tags[0], options);
      var descriptor = services[tag];
      if (descriptor == null) {
        var serviceClass = toClassName(tag);
        descriptor = {
          serviceName: tag,
          serviceClass: serviceClass + 'Service',
          serviceFile: toFileName(serviceClass) + '.service',
          operationIds: new Set(),
          serviceOperations: [],
        };
        services[tag] = descriptor;
      }

      var id = operationId(
        def.operationId,
        method,
        url,
        descriptor.operationIds
      );

      var parameters = def.parameters || [];

      if (methodParameters) {
        parameters = parameters.concat(methodParameters);
      }

      var paramsClass = null;
      var paramsClassComments = null;
      if (parameters.length >= minParamsForContainer) {
        paramsClass = id.charAt(0).toUpperCase() + id.substr(1) + 'Params';
        paramsClassComments = toComments('Parameters for ' + id, 1);
      }

      var operationParameters = [];
      for (var p = 0; p < parameters.length; p++) {
        param = parameters[p];
        if (param.$ref) {
          param = resolveRef(swagger, param.$ref);
        }
        var paramType;
        if (param.schema) {
          paramType = propertyType(param.schema);
        } else {
          paramType = propertyType(param);
        }
        var paramTypeNoNull = removeBrackets(paramType, true);
        var paramVar = toIdentifier(param.name);
        var paramDescriptor = {
          paramName: param.name,
          paramIn: param.in,
          paramVar: paramVar,
          paramFullVar: (paramsClass == null ? '' : 'params.') + paramVar,
          paramRequired: param.required === true || param.in === 'path',
          paramIsQuery: param.in === 'query',
          paramIsPath: param.in === 'path',
          paramIsHeader: param.in === 'header',
          paramIsBody: param.in === 'body',
          paramIsFormData: param.in === 'formData',
          paramIsArray: param.type === 'array',
          paramToJson: param.in === 'formData' && paramTypeNoNull !== 'Blob' &&
            paramTypeNoNull !== 'string',
          paramDescription: param.description,
          paramComments: toComments(param.description, 2),
          paramType: paramType,
          paramCollectionFormat: param.collectionFormat,
        };
        operationParameters.push(paramDescriptor);
      }
      operationParameters.sort((a, b) => {
        if (a.paramRequired && !b.paramRequired) return -1;
        if (!a.paramRequired && b.paramRequired) return 1;
        switch (sortParams) {
          case 'asc':
            return a.paramName > b.paramName ? 1 :
              a.paramName < b.paramName ? -1 : 0;
          case 'desc':
            return a.paramName > b.paramName ? -1 :
              a.paramName < b.paramName ? 1 : 0;
          default:
            return 0;
        }
      });
      if (operationParameters.length > 0) {
        operationParameters[operationParameters.length - 1].paramIsLast = true;
      }
      var operationResponses = processResponses(swagger, def, path, models);
      var resultType = operationResponses.resultType;
      var isMultipart = false;
      for (i = 0; i < operationParameters.length; i++) {
        if (operationParameters[i].paramIsFormData) {
          isMultipart = true;
          break;
        }
      }
      var docString = (def.description || '').trim();
      if (paramsClass == null) {
        for (i = 0; i < operationParameters.length; i++) {
          param = operationParameters[i];
          docString +=
            '\n@param ' + param.paramName + ' ' + param.paramDescription;
        }
      } else {
        docString +=
          '\n@param params The `' +
          descriptor.serviceClass +
          '.' +
          paramsClass +
          '` containing the following parameters:\n';
        for (i = 0; i < operationParameters.length; i++) {
          param = operationParameters[i];
          docString += '\n- `' + param.paramName + '`: ';
          var lines = (param.paramDescription || '').trim().split('\n');
          for (var l = 0; l < lines.length; l++) {
            var line = lines[l];
            if (line === '') {
              docString += '\n';
            } else {
              docString += (l == 0 ? '' : '  ') + line + '\n';
            }
          }
        }
      }
      if (operationResponses.resultDescription) {
        docString += '\n@return ' + operationResponses.resultDescription;
      }
      function getOperationName(string) {
        if (options.camelCase) return string.charAt(0).toLowerCase() + string.slice(1);
        else return string;
      }
      var operation = {
        operationName: getOperationName(id),
        operationParamsClass: paramsClass,
        operationParamsClassComments: paramsClassComments,
        operationMethod: method.toLocaleUpperCase(),
        operationPath: url,
        operationPathExpression:
          toPathExpression(operationParameters, paramsClass, url),
        operationResultType: resultType,
        operationHttpResponseType: '__StrictHttpResponse<' + resultType + '>',
        operationComments: toComments(docString, 1),
        operationParameters: operationParameters,
        operationResponses: operationResponses,
      };
      var modelResult = models[removeBrackets(resultType)];
      var actualType = resultType;
      if (modelResult && modelResult.modelIsSimple) {
        actualType = modelResult.modelSimpleType;
      }
      operation.operationIsMultipart = isMultipart;
      operation.operationIsVoid = actualType === 'void';
      operation.operationIsString = actualType === 'string';
      operation.operationIsNumber = actualType === 'number';
      operation.operationIsOther =
        !['void', 'number', 'boolean'].includes(actualType);
      operation.operationIsBoolean = actualType === 'boolean';
      operation.operationIsEnum = modelResult && modelResult.modelIsEnum;
      operation.operationIsObject = modelResult && modelResult.modelIsObject;
      operation.operationIsPrimitiveArray =
        !modelResult && (resultType.toString().includes('Array<') ||
          resultType.toString().includes('[]'));
      operation.operationIsFile = actualType === 'Blob';
      operation.operationResponseType =
        operation.operationIsFile ? 'blob' :
        operation.operationIsVoid ||
        operation.operationIsString ||
        operation.operationIsNumber ||
        operation.operationIsBoolean ||
        operation.operationIsEnum ?
          'text' : 'json';
      operation.operationIsUnknown = !(
        operation.operationIsVoid ||
        operation.operationIsString ||
        operation.operationIsNumber ||
        operation.operationIsBoolean ||
        operation.operationIsEnum ||
        operation.operationIsObject ||
        operation.operationIsFile ||
        operation.operationIsPrimitiveArray
      );
      descriptor.serviceOperations.push(operation);
    }
  }

  // Read the comments of each tag to use for service comments
  if (swagger.tags && swagger.tags.length > 0) {
    for (i = 0; i < swagger.tags.length; i++) {
      const tag = swagger.tags[i];
      const name = tagName(tag.name);
      const service = services[name];
      if (service && tag.description) {
        service.serviceComments = toComments(tag.description);
      }
    }
  }

  // Resolve the models used by each service
  for (name in services) {
    var service = services[name];
    var dependencies = new DependenciesResolver(models);
    var errorDependencies = new DependenciesResolver(models);
    for (i = 0; i < service.serviceOperations.length; i++) {
      var op = service.serviceOperations[i];
      for (var code in op.operationResponses) {
        var status = Number(code);
        var actualDeps = (status < 200 || status >= 300)
          ? errorDependencies : dependencies;
        var response = op.operationResponses[code];
        if (response.type) {
          var type = response.type;
          if (type && type.allTypes) {
            // This is an inline object. Append all types
            type.allTypes.forEach(t => actualDeps.add(t));
          } else {
            actualDeps.add(type);
          }
        }
      }
      for (j = 0; j < op.operationParameters.length; j++) {
        param = op.operationParameters[j];
        dependencies.add(param.paramType);
      }
    }
    service.serviceDependencies = dependencies.get();
    service.serviceErrorDependencies = errorDependencies.get();
  }

  return services;
}
513432
def get_object_type_by_name(object_type_name):
    
    if object_type_name == b"commit":
        from . import commit
        return commit.Commit
    elif object_type_name == b"tag":
        from . import tag
        return tag.TagObject
    elif object_type_name == b"blob":
        from . import blob
        return blob.Blob
    elif object_type_name == b"tree":
        from . import tree
        return tree.Tree
    else:
        raise ValueError("Cannot handle unknown object type: %s" % object_type_name)
415287
def find_by_tag(self, tag, params={}, **options): 
        
        path = "/tags/%s/tasks" % (tag)
        return self.client.get_collection(path, params, **options)
1062013
def process_post_tag(self, bulk_mode, api_tag):
        
        tag = None

        # try to get from the ref data map if in bulk mode
        if bulk_mode:
            tag = self.ref_data_map["tags"].get(api_tag["ID"])

        # double check the db before giving up, we may have sync'd it in a previous run
        if not tag:
            tag, created = Tag.objects.get_or_create(site_id=self.site_id,
                                                     wp_id=api_tag["ID"],
                                                     defaults=self.api_object_data("tag", api_tag))
            if tag and not created:
                self.update_existing_tag(tag, api_tag)

            # add to ref data map so later lookups work
            if tag:
                self.ref_data_map["tags"][api_tag["ID"]] = tag

        return tag
264395
function processResponse(obj) {
	for (var m in obj.nitro.results.items) {
		var mb = obj.nitro.results.items[m];
		//if (mb.partner != 's0000001') {
		console.log(mb.mid+','+mb.url_key+','+(mb.title ? mb.title : mb.name)+','+mb.partner);
		//}
	}
	var dest = {};
	if ((obj.nitro.pagination) && (obj.nitro.pagination.next)) {
		dest.query = nitro.queryFrom(obj.nitro.pagination.next.href,true);
		dest.path = path;
		dest.callback = processResponse;
	}
	nitro.setReturn(dest);
	return true;
}
1290041
function processAPI (ns, obj) {
  const context = obj.context
  const type = context.type
  const name = context.name

  if (ns === name) {
    obj.context.anchor = ns.toLowerCase()
    obj.context.path = ns
  }
  else {
    obj.context.anchor = (`${ns}-${name}`).toLowerCase()
    obj.context.path = (type === 'class' ?
      (ns.split('.').slice(0, -1).join('.') + '.') : (ns + '.')) +
      `<span class="key">${name}</span>`
  }

  if (type === 'class')
    obj.context.isClass = true

  if (type === 'property')
    obj.context.isProperty = true

  if (type === 'method' || type === 'function' || type === 'constructor')
    obj.context.isFunction = true

  if (type === 'constructor' ||
    (name === 'constructor' && obj.context.isFunction))
    obj.context.isConstructor = true

  const getName = element => {
    if (element.type === 'AllLiteral') return 'any type'
    if (element.name) return element.name
    if (element.applications) return 'an array of ' +
      element.applications.map(getName)
      .map(s => inflection.pluralize(s)).join(' or ')
    return ''
  }
  const setArray = str => `${str} (array)`
  const params = []

  for (let tag of obj.comment.tags) {
    if (tag.title === 'return') {
      obj.comment.returnType = tag.type.name
      if (tag.type.elements) obj.comment.returnType =
        tag.type.elements.map(getName).join(' | ')
      if (tag.type.applications) obj.comment.returnType =
        tag.type.applications.map(getName).map(setArray).join(' | ')
      continue
    }
    if (tag.title === 'param') {
      let name = tag.name
      let type = tag.type.name
      const description = tag.description
      const isOptional = tag.type.type === 'OptionalType'
      const isArray = tag.type.expression &&
        (tag.type.expression.expression || tag.type.expression)
        .name === 'Array'
      const isUnion = tag.type.type === 'UnionType' ||
        (tag.type.expression && tag.type.expression.type === 'UnionType')
      const isRest = tag.type.expression &&
        tag.type.expression.type === 'RestType'

      if (isOptional)
        type = tag.type.expression.name

      if (isArray) {
        type = 'Array of ' + inflection.pluralize(
          (tag.type.expression.applications || tag.type.applications ||
            [ { type: 'AllLiteral' } ])
          .map(getName).map(inflection.pluralize.bind(inflection)).join(', '))
      }

      if (isUnion)
        type = 'Either ' + (tag.type.elements || tag.type.expression.elements)
          .map(getName).join(', or ')

      if (isRest) {
        type = `Arbitrary number of ` + getName(
          tag.type.expression.expression || tag.type.expression)
        name = `&hellip;${name}`
      }

      params.push(`<span class="parameter" title="${type}` + (description ?
        `. ${description}` : '') + `">` +
        (isOptional ? `[${name}]` : name) + '</span>')
    }
  }

  if (params.length) obj.comment.params = params.join(', ')

  return obj
}
907216
def from_dict(d):
        
        i = Tags()
        for k, v in d.items():
            if k not in ("@module", "@class"):
                i[k] = v
        return i
868316
def process_tag(node):
    
    text = ''

    exceptions = ['table']

    for element in node.children:
        if isinstance(element, NavigableString):
            text += element
        elif not node.name in exceptions:
            text += process_tag(element)

    try:
        convert_fn = globals()["convert_%s" % node.name.lower()]
        text = convert_fn(node, text)

    except KeyError:
        pass

    return text
1213097
def project_remove_tags(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/removeTags' % object_id, input_params, always_retry=always_retry, **kwargs)
860889
def match_path_to_api_path(path_definitions, target_path, base_path='',
                           context=None):
    
    if context is None:
        context = {}
    assert isinstance(context, collections.Mapping)
    if target_path.startswith(base_path):
        # Convert all of the api paths into Path instances for easier regex
        # matching.
        normalized_target_path = re.sub(NORMALIZE_SLASH_REGEX, '/',
                                        target_path)
        matching_api_paths = list()
        matching_api_paths_regex = list()
        for p, v in path_definitions.items():
            # Doing this to help with case where we might have base_path
            # being just /, and then the path starts with / as well.
            full_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + p)
            r = path_to_regex(
                api_path=full_path,
                path_parameters=extract_path_parameters(v),
                operation_parameters=extract_operation_parameters(v),
                context=context,
            )
            if full_path == normalized_target_path:
                matching_api_paths.append(p)
            elif r.match(normalized_target_path):
                matching_api_paths_regex.\
                    append((p, r.match(normalized_target_path)))

        # Keep it consistent with the previous behavior
        target_path = target_path[len(base_path):]
    else:
        matching_api_paths = []
        matching_api_paths_regex = []

    if not matching_api_paths and not matching_api_paths_regex:
        fstr = MESSAGES['path']['no_matching_paths_found'].format(target_path)
        raise LookupError(fstr)
    elif len(matching_api_paths) == 1:
        return matching_api_paths[0]
    elif len(matching_api_paths) > 1:
        raise MultiplePathsFound(
            MESSAGES['path']['multiple_paths_found'].format(
                target_path, [v[0] for v in matching_api_paths],
            )
        )
    elif len(matching_api_paths_regex) == 1:
        return matching_api_paths_regex[0][0]
    elif len(matching_api_paths_regex) > 1:
        # TODO: This area needs improved logic.
        # We check to see if any of the matched paths is longers than
        # the others.  If so, we *assume* it is the correct match.  This is
        # going to be prone to false positives. in certain cases.
        matches_by_path_size = collections.defaultdict(list)
        for path, match in matching_api_paths_regex:
            matches_by_path_size[len(path)].append(path)
        longest_match = max(matches_by_path_size.keys())
        if len(matches_by_path_size[longest_match]) == 1:
            return matches_by_path_size[longest_match][0]
        raise MultiplePathsFound(
            MESSAGES['path']['multiple_paths_found'].format(
                target_path, [v[0] for v in matching_api_paths_regex],
            )
        )
    else:
        return matching_api_paths_regex[0][0]
526572
def _handle_tag_definesprite(self):
        """"""
        obj = _make_object("DefineSprite")
        obj.CharacterID = unpack_ui16(self._src)
        obj.FrameCount = unpack_ui16(self._src)
        tags = self._process_tags()
        obj.ControlTags = tags
        return obj
709579
def _get_tag(repo, name):
    '''
    
    '''
    try:
        return [x for x in _all_tags(repo) if x[0] == name][0]
    except IndexError:
        return False
446481
def tags(self, extra_params=None):
        "
        return self.api._get_json(
            Tag,
            space=self,
            rel_path=self._build_rel_path('tags'),
            extra_params=extra_params,
        )
1088848
def handle_tags(repo, **kwargs):
    """"""
    log.info('tags: %s %s' %(repo, kwargs))
    return [str(t) for t in repo.tags(**kwargs)]
1343868
def _get_object(self):
        
        # have to be dynamic here as we may be a tag which can point to anything
        # Our path will be resolved to the hexsha which will be used accordingly
        return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
612292
function processProperties(swagger, properties, requiredProperties) {
  var result = {};
  for (var name in properties) {
    var property = properties[name];
    var descriptor = {
      propertyName: name.indexOf('-') === -1 ? name : `"${name}"`,
      propertyComments: toComments(property.description, 1),
      propertyRequired: requiredProperties.indexOf(name) >= 0,
      propertyType: propertyType(property),
    };
    result[name] = descriptor;
  }
  return result;
}
2189
def _from_objects(cls, objects):
        
        vertices = ElementTransformSet(transform=id)
        out_edges = KeyTransformDict(transform=id)
        in_edges = KeyTransformDict(transform=id)
        for obj in objects:
            vertices.add(obj)
            out_edges[obj] = []
            in_edges[obj] = []

        # Edges are identified by simple integers, so
        # we can use plain dictionaries for mapping
        # edges to their heads and tails.
        edge_label = itertools.count()
        edges = set()
        head = {}
        tail = {}

        for referrer in vertices:
            for referent in gc.get_referents(referrer):
                if referent not in vertices:
                    continue
                edge = next(edge_label)
                edges.add(edge)
                tail[edge] = referrer
                head[edge] = referent
                out_edges[referrer].append(edge)
                in_edges[referent].append(edge)

        return cls._raw(
            vertices=vertices,
            edges=edges,
            out_edges=out_edges,
            in_edges=in_edges,
            head=head,
            tail=tail,
        )