Opened 4 years ago

Closed 4 years ago

# pep8 cleaning in eccentricity, center, radius, diameter, periphery

Reported by: Owned by: David Coudert major sage-8.6 graph theory py3, graph David Coudert Vincent Klein N/A 63b1806 63b18061fc519b53b6c44ce364f363a7d8943a3f

### Description

PEP8 cleaning in methods `eccentricity`, `radius`, `diameter`, `center`, `periphery`. On the way, we do:

• in `radius`, `center`, `periphery`: replace the long description of the list of algorithms by a forward to method `eccentricity`
• in `radius`, `diameter`, `center`, `periphery`: set parameter `v` when calling method `eccentricity` in order to avoid calls to `.vertices()`

### comment:1 Changed 4 years ago by David Coudert

Branch: → public/26820_eccentricity → dd570a5bffd26e2411e18d8fc47edb33629badf6 new → needs_review

New commits:

 ​dd570a5 `trac #26820: clean eccentricity, radius, diameter, center, periphery`

### comment:2 Changed 4 years ago by vklein

Hi,

What is the goal of this ticket? Is it to enhance compatibility with pep8 or to be fully compatible with pep8?

In the second case i have the following remarks:

• 1. line 14069: `weight_function = lambda e: e[2]`. Do not assign a lambda expression use a def.

Pep8 quote:

Always use a def statement instead of an assignment statement that binds a lambda
expression directly to an identifier.

Yes:

def f(x): return 2*x

No:

f = lambda x: 2*x

• 2. lines 14122 and 14123: continuation line under-indented for visual indent

for example you can do this :

```                length = self.shortest_path_lengths(u, by_weight=by_weight,
algorithm=algorithm,
weight_function=weight_function,
check_weight=check_weight)
```

```                length = self.shortest_path_lengths(u, by_weight=by_weight,
algorithm=algorithm, weight_function=weight_function,
check_weight=check_weight)
```
• 3. line 14135: Need two spaces before inline comment.
Last edited 4 years ago by vklein (previous) (diff)

### comment:3 Changed 4 years ago by vklein

Reviewers: → Vincent Klein

### comment:4 Changed 4 years ago by git

Branch pushed to git repo; I updated commit sha1. New commits:

 ​63b1806 `trac #26820: reviewer's comments`

### comment:5 Changed 4 years ago by David Coudert

The goal is to do significant enhancements, and if possible to reach 100% pep8 compatibility (a lot to do for that).

### comment:6 Changed 4 years ago by vklein

Green bot => positive review

### comment:7 Changed 4 years ago by vklein

Status: needs_review → positive_review

### comment:8 Changed 4 years ago by Volker Braun

Branch: public/26820_eccentricity → 63b18061fc519b53b6c44ce364f363a7d8943a3f → fixed positive_review → closed

### comment:9 Changed 4 years ago by Erik Bray

Milestone: sage-8.5 → sage-8.6

This tickets were closed as fixed after the Sage 8.5 release.

Note: See TracTickets for help on using tickets.