Working with workspace
171112
def workspace_cli(ctx, directory, mets_basename, backup):
    
    ctx.obj = WorkspaceCtx(os.path.abspath(directory), mets_basename, automatic_backup=backup)
52274
def ensure_workspace(self, target):
    
    gopath = self.get_gopath(target)
    for d in ('bin', 'pkg', 'src'):
      safe_mkdir(os.path.join(gopath, d))
    required_links = set()
    for dep in target.closure():
      if not isinstance(dep, GoTarget):
        continue
      if self.is_remote_lib(dep):
        self._symlink_remote_lib(gopath, dep, required_links)
      else:
        self._symlink_local_src(gopath, dep, required_links)
    self.remove_unused_links(os.path.join(gopath, 'src'), required_links)
132590
def my_workspaces(context):
    
    pc = api.portal.get_tool('portal_catalog')
    brains = pc(
        portal_type="ploneintranet.workspace.workspacefolder",
        sort_on="modified",
        sort_order="reversed",
    )
    workspaces = [
        {
            'id': brain.getId,
            'title': brain.Title,
            'description': brain.Description,
            'url': brain.getURL(),
            'activities': get_workspace_activities(brain),
            'class': escape_id_to_class(brain.getId),
        } for brain in brains
    ]
    return workspaces
621981
public void write(Workspace workspace) {
        StringWriter stringWriter = new StringWriter();
        write(workspace, stringWriter);
        System.out.println(stringWriter.toString());
    }
1340331
public function publishWorkspaceAction(Workspace $workspace)
    {
        if (($targetWorkspace = $workspace->getBaseWorkspace()) === null) {
            $targetWorkspace = $this->workspaceRepository->findOneByName('live');
        }
        $this->publishingService->publishNodes($this->publishingService->getUnpublishedNodes($workspace), $targetWorkspace);
        $this->addFlashMessage($this->translator->translateById('workspaces.allChangesInWorkspaceHaveBeenPublished', [htmlspecialchars($workspace->getTitle()), htmlspecialchars($targetWorkspace->getTitle())], null, null, 'Modules', 'Neos.Neos'));
        $this->redirect('index');
    }
625735
def find_workspace params={}
      workspaces.find do |ws|
        matches = true

        # match each key to the given workspace
        params.keys.each do |key|
          matches = matches && (ws.send(key.to_sym) == params[key])
        end

        matches
      end
    end
309732
public function cleanRecentWorkspaces()
    {
        $this->log('Cleaning recent workspaces entries that are older than six months');

        /** @var WorkspaceRecentRepository $recentWorkspaceRepo */
        $recentWorkspaceRepo = $this->om->getRepository('ClarolineCoreBundle:Workspace\WorkspaceRecent');
        $recentWorkspaceRepo->removeAllEntriesBefore(new \DateTime('-6 months'));
    }
619905
def _apply_workspaces(self, combination, mode):
        
        if len(combination) > 1 and mode == "extend":
            sleep(3)
            for output in combination:
                workspaces = getattr(self, "{}_workspaces".format(output), "").split(
                    ","
                )
                for workspace in workspaces:
                    if not workspace:
                        continue
                    # switch to workspace
                    cmd = '{} workspace "{}"'.format(self.py3.get_wm_msg(), workspace)
                    self.py3.command_run(cmd)
                    # move it to output
                    cmd = '{} move workspace to output "{}"'.format(
                        self.py3.get_wm_msg(), output
                    )
                    self.py3.command_run(cmd)
                    # log this
                    self.py3.log(
                        "moved workspace {} to output {}".format(workspace, output)
                    )
477686
def find_by_workspace(self, workspace, params={}, **options): 
        
        path = "/workspaces/%s/tags" % (workspace)
        return self.client.get_collection(path, params, **options)
160105
def clone_workspace(self) -> None:
        

        def clone_clicked(text):
            if text:
                command = Workspace.CloneWorkspaceCommand(self, text)
                command.perform()
                self.document_controller.push_undo_command(command)

        self.pose_get_string_message_box(caption=_("Enter a name for the workspace"), text=self.__workspace.name,
                                         accepted_fn=clone_clicked, accepted_text=_("Clone"),
                                         message_box_id="clone_workspace")
911676
public CollectionRequest<Project> findByWorkspace(String workspace) {
    
        String path = String.format("/workspaces/%s/projects", workspace);
        return new CollectionRequest<Project>(this, Project.class, path, "GET");
    }
1354976
def unlock(self):
        """"""
        r = fapi.unlock_workspace(self.namespace, self.name, self.api_url)
        fapi._check_response_code(r, 204)
        self.data['workspace']['isLocked'] = False
        return self
1281666
def add_left_space(self, nspace=1):
        """"""
        sp = ' ' * nspace
        for item in self._rows:
            item[0] = sp + item[0]
873186
def get_workspaces(self):
        
        data = self.message(MessageType.GET_WORKSPACES, '')
        return json.loads(data, object_hook=WorkspaceReply)
368092
def build(self, *args, **kwargs):
        """"""
        # Create the directories of the work.
        self.indir.makedirs()
        self.outdir.makedirs()
        self.tmpdir.makedirs()

        # Build dirs and files of each task.
        for task in self:
            task.build(*args, **kwargs)

        # Connect signals within the work.
        self.connect_signals()
558146
function getSharedWorkspace(req, res) {
		return sharedUtil.getSharedProjects(req, res, function(projects) {
				var workspaces = [];
				projects.forEach(function(project){
					var projectSegs = project.Location.split("/");
					var projectBelongingWorkspaceId = sharedUtil.getWorkspaceIdFromprojectLocation(project.Location);
					if(!workspaces.some(function(workspace){
						return workspace.Id === projectBelongingWorkspaceId;
					})){
						workspaces.push({
							Id: projectBelongingWorkspaceId,
							Location: api.join(sharedWorkspaceFileRoot, projectBelongingWorkspaceId),
							Name: projectSegs[2] + "'s " + projectSegs[3]
						});
					}
				});
				writeResponse(null, res, null, {
					Id: req.user.username,
					Name: req.user.username,
					UserName: req.user.fullname || req.user.username,
					Workspaces: workspaces
				}, true);
		});
	}
1101473
function processFileForWorkspace(info, method) {
    var workspaceObject = null;

    switch (method) {
    case 'createWorkspace':
    case 'updateWorkspace':
    case 'createIntent':
    case 'updateIntent':
    case 'createEntity':
    case 'updateEntity':
    case 'updateEntityValue':
    case 'createDialogNode':
    case 'updateDialogNode':
      try {
        workspaceObject = JSON.parse(fs.readFileSync(info.path, 'utf8'));
      } catch (err) {
        workspaceObject = fs.createReadStream(info.path);
      }
    }

    return Promise.resolve(workspaceObject);
  }