Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(10)  |  Derive(0)  |  Import(2)

src/o/s/osc2-HEAD/osc2/oscargs.py   osc2(Download)
from osc2.wc.project import Project
from osc2.wc.package import Package
from osc2.wc.util import (wc_is_project, wc_is_package, wc_read_project,
                          wc_read_package, wc_read_apiurl, wc_parent)
 
        project = package = filename = None
        project_path = package_path = filename_path = None
        par_dir = wc_parent(path)
        if not path:
            path = os.getcwd()
                package_path = par_dir
                # check if package has a parent
                par_dir = wc_parent(package_path)
                if par_dir is not None and wc_is_project(par_dir):
                    project_path = par_dir

src/o/s/osc2-HEAD/test/wc/test_util.py   osc2(Download)
import os
import unittest
 
from test.osctest import OscTest
from osc2.wc.util import (wc_is_project, wc_is_package, wc_read_project,
    def test22(self):
        """test wc_parent (package)"""
        path = self.fixture_file('prj1', 'added')
        self.assertTrue(os.path.isdir(path))
        par_dir = wc_parent(path)
            os.chdir(pkg_path)
            self.assertTrue(os.path.isdir(path))
            par_dir = wc_parent(path)
            self.assertIsNotNone(par_dir)
            self.assertTrue(wc_is_project(par_dir))
    def test24(self):
        """test wc_parent (package/file)"""
        path = self.fixture_file('prj1', 'added', 'foo')
        self.assertTrue(os.path.isfile(path))
        par_dir = wc_parent(path)
    def test25(self):
        """test wc_parent (package/non_existent)"""
        path = self.fixture_file('prj1', 'added', 'non_existent')
        self.assertFalse(os.path.exists(path))
        par_dir = wc_parent(path)