联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2021-10-21 10:53

University of Technology Sydney

Faculty of Engineering and Information Technology

Subject 32547 UNIX Systems Programming, Spring 2021

Assignment

Description

This assignment is an individual programming assignment using Python. It addresses objectives 2

and 3 as listed in the Subject Outline document.

No limits apply to the number of lines of code of the program.

Assignments are to be completed individually (this might be checked with the use of anti‐

plagiarism tools such as Turnitin). You should not receive help in the preparation of this

assignment, nor ask anyone else to prepare it on your behalf in any way.

 

Marks

The assignment corresponds to 30% of the total marks.

Submission

The completed assignment is due by 5:00pm of Friday 29 October 2021.

 

PLEASE PAY ATTENTION TO THE FOLLOWING SUBMISSION INSTRUCTIONS:

1. Your Python program has to be submitted on Canvas, following the “Assignments” menu

and then the “Assignment” link by the due date. You can prepare your Python program

anywhere you like, but probably the easiest option is to develop it in Ed STEM.

2. Please submit only your Python program, and nothing else (no data files).

3. Late submissions will be deducted one mark per day late; more than seven days late, the

assignment will receive zero. Special considerations for a late submission must be

arranged in advance with the Subject Coordinator.

 

2

Academic Standards

The assignments in this Subject should be your own original work. Any code taken from a

textbook, journal, the Internet or any other source should be acknowledged. For referencing,

please use the standard referencing conventions (http://www.lib.uts.edu.au/help/referencing).

Marking Scheme

Mark Range    

30 All requirements of the assignment are met. The submitted

program can be executed by the lecturer “as is” and produces the

requested output.

24‐29 The program works correctly with any valid file and for all options,

but its execution experiences some minor problems.

18‐23 The program does not work as expected with one of the options.

0‐17 This range goes from no submission at all (0 marks) to a submission

which does not meet major requirements of the assignment.

Examples:

? the program does not work as expected with two or more

options;

? the program generates unhandled errors;

? the program does not solve the assignment problem.

The assignments will be marked within two weeks from the submission deadline or as soon as

possible.  

Important notes:

? Submission of this assignment is not compulsory to pass the subject; do not feel that you

have to submit it “at all costs” and perhaps be tempted to seek unauthorised assistance.

? There are no minimum requirements on the marks on this assignment to pass the subject.

? This assignment must be your own work and you should not be helped by anyone to prepare

it in any way; your assignment may be tested with anti‐plagiarism software that detects

superficial changes such as changing variable names, swapping lines of code and the like.

? The subject coordinator may ask you to describe your assignment in a “viva voce” in Zoom to

finalise your mark.

? Understanding the assignment specifications is part of the assignment itself and no further

instructions will be provided; on the other hand, whatever is not constrained you can

implement it according to your own best judgment.

3

Title: Partition information with Python

In this assignment, you will use Python for writing a program that can report information about

the partitions of a Unix system. The program will read a pseudo system file containing partition

data and will report the requested information to the user.

These are the specifications for your Python program:

1. It must be named partitionreport.py

2. It must be invoked as:

python partitionreport.py option partition_file

The program must check that argument partition_file exists, is a file and is readable. If not,

it must print a message of your choice to the standard output and exit. The specifications

for the partition_file and option arguments are given below.

3. File partition_file can have any arbitrary name (including the extension). It must be a file of

text with the following format:

a. The file consists of an arbitrary number of lines (including, possibly, zero lines).

Each line corresponds to a partition.

b. Each line must contain six fields separated by a space character.

c. The six fields are: partition, mount point, file system type, permissions, total space

and used space.

d. Fields partition and mount point are standard Unix absolute filenames.

e. Field file system type is a string (of maximum 10 characters). The characters

allowed include lowercase letters, uppercase letters, digits, the underscore (_) and

the hyphen (‐).

f. Field permissions can be either string 'rw' or string 'ro'.

g. Fields total space and used space are positive integers represented as strings of no

more than 10 digits each.

The following example is the reference specification for the format of file partition_file:

/dev/sdb1 / ext3 rw 10317828 4439828

/dev/sda1 /home ext3 rw 2885780 2265324

/dev/sdb2 /usr nfs rw 20635656 446188

/dev/sdc1 /var ext4 rw 2885780 2265324

/dev/sr0 /cdrom iso9660 ro 45684 45684

Fundamental note: your program is not expected to verify that file partition_file complies

with the above specifications. It will only be tested with compliant files.

4

4. Your program can be invoked with option: ‐f. In this case, it must print the names of all the

unique file system types in use, in the order in which they first appear in file partition_file,  

preceded by string 'File system types in use: ' and separated by a space

character.

Example with the example partition_file given above:  

Command line:

python partitionreport.py –f partition_file

Output:

File system types in use: ext3 nfs etx4 iso9660

In the case in which file partition_file is empty, your program will print:

No file system types found in argument file

5. Your program can be invoked with option: ‐a. In this case, it must print the following string:

Overall space available in read-write partitions: <the overall space

available in "rw" partitions in file partition_file, including, possibly, zero>

The space available in a partition is computed as the difference between the total space

and used space fields. The overall space available in read‐write partitions is computed as

the sum of the space available in every read‐write partition.

Example with the example partition_file given above:  

Command line:

python partitionreport.py -a partition_file

Output:

Overall space available in read-write partitions: 27308380

6. Your program can be invoked with option: ‐p partition. The format of string partition is the

same as the partition field in file partition_file (i.e. a standard Unix absolute filename). In

this case, your program must print the following string:

Partition partition is <read-write or read-only> and has <space available>

available space

Example with the example partition_file given above:

Command line:

python partitionreport.py –p /dev/sdb1 partition_file

Output:

Partition /dev/sdb1 is read-write and has 5878000 available space

5

In the case in which file partition_file does not contain the requested partition (including

the case where the file is empty), your program must print:

Partition not found

7. Your program can be invoked with option: ‐v. In this case, it must only print your name,

surname, student ID and date of completion of your assignment, in a format of your choice.

Please note that argument partition_file  is still required.

8. No options can be used simultaneously. This meansthat your program must only be invoked

with one of the options at a time.

9. If your program is invoked with any other syntax than those specified above, it must print a

message of your choice to the standard output and exit.

Examples of incorrect syntax:

python partitionreport.py -Z partition_file    (i.e., wrong option)

python partitionreport.py -a   (i.e., missing the argument file)

python partitionreport.py -p partition_file    (i.e., missing the partition

argument)


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp