def new_artifact_content name, type, content=nil, &block
489964
def new_artifact_content name, options = {}, &block
      type = get_type(options)
      content = extract_content type, options, &block
      %Q{class #{marker(name, type)}
  #{content}
end}
    end
1352885
def upload(local_path, remote_path, properties = {}, headers = {})
      artifact = Resource::Artifact.new(local_path: local_path)
      artifact.upload(key, remote_path, properties, headers)
    end
51877
def Add(self, artifact=None, target=None, callback=None):
    
    # Cases where a target field is undefined or empty need special handling.
    # Repeated field helper in target yields results, so expand this out into a
    # list. If the attribute doesn't exist, default to an empty list.
    # Then, in either case, replace the empty list with one containing a single
    # None value.
    if target is None:
      target = Target()
    os_name = target.Get("os") or [None]
    cpe = target.Get("cpe") or [None]
    label = target.Get("label") or [None]
    attributes = itertools.product(os_name, cpe, label)
    new_conditions = [Condition(artifact, *attr) for attr in attributes]
    self.conditions.update(new_conditions)
    self._Register(new_conditions, callback)
549212
def newDocComment(self, content):
        
        ret = libxml2mod.xmlNewDocComment(self._o, content)
        if ret is None:raise treeError('xmlNewDocComment() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
817463
def contents(revision=nil, cmd_options={})
      revision ||= 'tip'
      hg(manifest_cmd(revision), cmd_options).tap do |res|
        if RUBY_VERSION >= '1.9.1'
          res.force_encoding('utf-8')
        end
      end
    end
54073
def upload_with_checksum(local_path, remote_path, checksum, properties = {})
      artifact = Resource::Artifact.new(local_path: local_path)
      artifact.upload_with_checksum(key, remote_path, checksum, properties)
    end
551226
def DumpArtifactsToYaml(self, sort_by_os=True):
    """"""
    artifact_list = self.GetArtifacts()
    if sort_by_os:
      # Sort so its easier to split these if necessary.
      yaml_list = []
      done_set = set()
      for os_name in rdf_artifacts.Artifact.SUPPORTED_OS_LIST:
        done_set = set(a for a in artifact_list if a.supported_os == [os_name])
        # Separate into knowledge_base and non-kb for easier sorting.
        done_set = sorted(done_set, key=lambda x: x.name)
        yaml_list.extend(x.ToYaml() for x in done_set if x.provides)
        yaml_list.extend(x.ToYaml() for x in done_set if not x.provides)
        artifact_list = artifact_list.difference(done_set)
      yaml_list.extend(x.ToYaml() for x in artifact_list)  # The rest.
    else:
      yaml_list = [x.ToYaml() for x in artifact_list]

    return "---\n\n".join(yaml_list)
546044
def create
      @block = Block.builder(params)

      if @block.save
        render json: { status: :success }, status: :ok
      else
        render json: @block.errors, status: :unprocessable_entity
      end
    end
971369
def new(partname, content_type):
        
        xml = '<Override xmlns="%s"/>' % nsmap['ct']
        override = parse_xml(xml)
        override.set('PartName', partname)
        override.set('ContentType', content_type)
        return override
1241028
def new
      @placement = Placement.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render :json => @placement }
      end
    end
764843
function () {
      var doUniqueArtifactIdsCheck = function (artifactsIds) {
        var duplicateArtifactIds = [];
        artifactsIds.forEach(function (artifactId) {
          var artifactIdUnderTest = artifactId;

          function filterById (id) {
            return id === artifactIdUnderTest;
          }

          var arrayByUniqueArtifactIds = artifactsIds.filter(filterById);
          if (arrayByUniqueArtifactIds.length > 1 && duplicateArtifactIds.indexOf(artifactIdUnderTest) < 0) {
            duplicateArtifactIds.push(artifactIdUnderTest);
          }
        });
        duplicateArtifactIds.forEach(function (artifactId) {
          errors.push(
            'RuleViolation identified: WebPackage contains multiple artifacts with \'artifactId\'=\'' +
            artifactId + '\'');
        });
      };
      //
      var collectArtifactIds = function (next) {
        var artifactsIds = [];
        if (doc.artifacts) {
          Object.keys(doc.artifacts).forEach(function (artifactType) {
            doc.artifacts[ artifactType ].forEach(function (artifact) {
              artifactsIds.push(artifact.artifactId);
            });
          });
        }
        next(artifactsIds);
      };
      collectArtifactIds(doUniqueArtifactIdsCheck);
    }
1188523
function artifact(the_token) {

// Return a string representing an artifact.

    if (the_token === undefined) {
        the_token = next_token;
    }
    return (
        (the_token.id === "(string)" || the_token.id === "(number)")
        ? String(the_token.value)
        : the_token.id
    );
}
720869
def new
      @news = News.new
      @news.assets.build
      @news.category = Category.find params[:category_id]
      
      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @news }
      end
    end
190401
def new(attributes = {})
      resource = repository.scope { model.new(attributes) }
      self << resource
      resource
    end
900571
def add_resource(type, title, params = {})
      catalog.add_resource(new_resource(type, title, params))
    end
674486
def new(path='.', template=None):
    
    path = abspath(path.rstrip(sep))
    template = template or DEFAULT_TEMPLATE_URL
    render_skeleton(
        template, path,
        include_this=['.gitignore'],
        filter_this=[
            '~*', '*.py[co]',
            '__pycache__', '__pycache__/*',
            '.git', '.git/*',
            '.hg', '.hg/*',
            '.svn', '.svn/*',
        ]
    )
    print(HELP_MSG % (path,))
612463
private synchronized void set( Artifact artifact, Content content )
    {
        Map<String, Map<String, Map<Artifact, Content>>> artifactMap = contents.get( artifact.getGroupId() );
        if ( artifactMap == null )
        {
            artifactMap = new HashMap<String, Map<String, Map<Artifact, Content>>>();
            contents.put( artifact.getGroupId(), artifactMap );
        }
        Map<String, Map<Artifact, Content>> versionMap = artifactMap.get( artifact.getArtifactId() );
        if ( versionMap == null )
        {
            versionMap = new HashMap<String, Map<Artifact, Content>>();
            artifactMap.put( artifact.getArtifactId(), versionMap );
        }
        Map<Artifact, Content> filesMap = versionMap.get( artifact.getVersion() );
        if ( filesMap == null )
        {
            filesMap = new HashMap<Artifact, Content>();
            versionMap.put( artifact.getVersion(), filesMap );
        }
        filesMap.put( artifact, content );
    }