软工第一次个人编程作业

这个作业属于哪个课程 https://edu.cnblogs.com/campus/fzu/SE2020
这个作业要求在哪里 https://edu.cnblogs.com/campus/fzu/SE2020/homework/11167
这个作业的目标 初步使用Python编写程序,熟悉GitHub的使用方法
学号 031802406

一、PSP表格

PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟)
Planning 计划
Estimate 估计这个任务需要多少时间
Development 开发
Analysis 需求分析 (包括学习新技术) 800 1800
Design Spec 生成设计文档
Design Review 设计复审
Coding Standard 代码规范 (为目前的开发制定合适的规范)
Design 具体设计
Coding 具体编码 500 1200
Code Review 代码复审
Test 测试(自我测试,修改代码,提交修改)
Reporting 报告
Test Report 测试报告
Size Measurement 计算工作量
Postmortem & Process Improvement Plan 事后总结, 并提出过程改进计划
合计 1300 3000

二、学习过程

一拿到题的时候并没有看懂题目,然后开始纠结到底是要用C++写还是学一下python。想了想迟早要学起来的,于是花了将近五天勉勉强强能看懂python的部分语法,但是要看懂样例还是很吃力的。
在CSDN上找了一些资料,又找了大佬做了参考,总算把json文件读出来了。

三、代码说明。

解析文件夹中的json:
`
def AllJson(self,address:str):

    for root, dic, files in os.walk(address):

        for f in files:

            if f[-5:] == ".json":

                jsonPath = f

                self.OneJson(address, jsonPath )

def OneJson(self, address:str, jPath:str):

    f = open(address + '\\' + jPath, 'r', encoding='utf-8')

    try:

        while True:

            thefile = f.readline()

            if thefile:

                jsLoads = json.loads(thefile)`

                if not jsLoads["type"] in ['PushEvent','IssueCommentEvent',
                                        'IssuesEvent','PullRequestEvent']:
                    continue
                if not jsLoads["actor"]["login"] in self.uEvent.keys():
                    event = {'PushEvent':0,'IssueCommentEvent':0,
                             'IssuesEvent':0,'PullRequestEvent':0}
                    self.uEvent[jsLoads["actor"]["login"]] = event

                if not jsLoads["repo"]["name"] in self.rEvent.keys():
                    event = {'PushEvent':0,'IssueCommentEvent':0,
                             'IssuesEvent':0,'PullRequestEvent':0}
                    self.rEvent[jsLoads["repo"]["name"]] = event

                if not jsLoads["actor"]["login"]+'&'+jsLoads["repo"]["name"] in self.urEvent.keys():
                    event = {'PushEvent': 0, 'IssueCommentEvent': 0,
                             'IssuesEvent': 0, 'PullRequestEvent': 0}
                    self.urEvent[jsLoads["actor"]["login"] + '&' + jsLoads["repo"]["name"]] = event
                self.uEvent[jsLoads["actor"]["login"]][jsLoads['type']] += 1
                self.rEvent[jsLoads["repo"]["name"]][jsLoads['type']] += 1
                self.urEvent[jsLoads["actor"]["login"] + '&' + jsLoads["repo"]["name"]][jsLoads['type']] += 1
            else:
                break
    except:
        pass
    finally:
        f.close()`

四、单元测试截图和描述。

单元测试覆盖率优化和性能测试,性能优化截图和描述。

五、代码规范

https://github.com/Yeah029/test/blob/master/CodeStyle.md

六、总结

过程十分的艰难,但是也在不断尝试的过程中也学习了不少新的知识。刚开始的时候在网上找了一些文本教程,浏览了一遍最基础的表示方法和列表、字典等的使用。但是只看教程的效果不佳。后来找同学询问了一番,分享给我了几个csdn的博客,随后对本次作业中涉及到的json和其他模块进行了有针对性了解,但是我的代码基础比较薄弱,目前还是一知半解,也希望能在实践中不断提高自己吧。

posted @ 2020-09-16 23:48  yeah9999  阅读(198)  评论(2编辑  收藏  举报