示例#1
0
    def __getattr__(self, name):
        #print("Checking for attr %s..."%(name))
        #print self.info_array.keys()
        value = None

        if name in self.labels:
            value = self.labels[name]

        name = name.upper().replace(' ','_').replace(':','')
        #print("Checking for attr %s..."%(name))
        if name in self.attrs:
            attr = self.attrs[name]
            try:
                value = str(self.info_array[attr])
            except:
                value = str(self.get_custom_field(attr))

        if name == 'TAGS':
            value = str(value).split(",") if value is not None else []

        elif name == 'GITHUB_REPO':
            repo_str = self.get_custom_field('GitHub repository')
            #print repo_str
            value = GitHubRepository.create(repo_str)

        elif name == 'GITHUB_REPO_NAME':
            repo_str = self.get_custom_field('GitHub repository')
            if repo_str:
                value = repo_str.split('/')[-1].replace('.git','')
            else:
                value = ''

        #print("  --- value: %s"%str(value))
        if value is None: 
            try:
                value = super(Project,self).__getattr__(name)
            except Exception as e:
                #print e
                #print("  --- Could not find attribute in Project: %s"%name)
                pass

        try:
            v = float(value)
            if v == int(v):
                return int(v)
            else:
                return v
        except ValueError:
            return value
        except TypeError:
            return value
fresh_clones = True

if fresh_clones:
    if os.path.exists(test_dir):
        shutil.rmtree(test_dir)

os.makedirs(test_dir)

ignores = ['neurosciences-repository', 'brunel2000']

all_repos = {}

additional_repos = {
    'NeuroML2':
    GitHubRepository.create('https://github.com/NeuroML/NeuroML2'),
    'osb-model-validation':
    GitHubRepository.create(
        'https://github.com/OpenSourceBrain/osb-model-validation')
}

branches = {'NeuroML2': 'development'}

all_repos.update(additional_repos)

projects = len(all_repos.keys())

if __name__ == "__main__":
    start = datetime.datetime.now()

    project_num = 1000
os.makedirs(test_dir)

ignores = ['neurosciences-repository', 'drosophila-acc-l3-motoneuron-gunay-et-al-2014','d-olfactory-bulb-network']

if '-q' in sys.argv:
    ignores.append('pospischiletal2008')  # Slow...
    ignores.append('blue-brain-project-showcase')  # Slow...
    ignores.append('acnet2')  # Slow...
    ignores.append('granulecell')  # Slow...

ignores.append('l23dendriticspikes')

all_repos = {  }

additional_repos = { 'NeuroML2':             GitHubRepository.create('https://github.com/NeuroML/NeuroML2') ,
                     'osb-model-validation': GitHubRepository.create('https://github.com/OpenSourceBrain/osb-model-validation') }
                     
branches = { 'NeuroML2': 'development' }

all_repos.update(additional_repos)

projects = len(all_repos.keys())

if __name__ == "__main__":
    start = datetime.datetime.now()

    project_num = 1000
    if len(sys.argv) == 2:
        try:
            project_num = int(sys.argv[1])