Skip to content

Commit

Permalink
sort imports via isort
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s committed Jan 21, 2022
1 parent 8c9136e commit 66b1780
Show file tree
Hide file tree
Showing 654 changed files with 1,928 additions and 1,608 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ jobs:
run: |
yamllint .
isort:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
pip install isort
- name: Run linting
run: |
isort --check-only .
pylint:
runs-on: ubuntu-latest

Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ repos:
hooks:
- id: yapf
name: Format code

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: Sort imports
7 changes: 4 additions & 3 deletions benchmark/citation/appnp.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import argparse

import torch
from torch.nn import Linear
import torch.nn.functional as F
from torch_geometric.nn import APPNP

from citation import get_planetoid_dataset, random_planetoid_splits, run
from torch.nn import Linear

from torch_geometric.nn import APPNP

parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, required=True)
Expand Down
5 changes: 3 additions & 2 deletions benchmark/citation/arma.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import argparse

import torch
import torch.nn.functional as F
from torch_geometric.nn import ARMAConv

from citation import get_planetoid_dataset, random_planetoid_splits, run

from torch_geometric.nn import ARMAConv

parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, required=True)
parser.add_argument('--random_splits', type=bool, default=False)
Expand Down
5 changes: 3 additions & 2 deletions benchmark/citation/cheb.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import argparse

import torch
import torch.nn.functional as F
from torch_geometric.nn import ChebConv

from citation import get_planetoid_dataset, random_planetoid_splits, run

from torch_geometric.nn import ChebConv

parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, required=True)
parser.add_argument('--random_splits', type=bool, default=False)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/citation/datasets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os.path as osp

from torch_geometric.datasets import Planetoid
import torch_geometric.transforms as T
from torch_geometric.datasets import Planetoid


def get_planetoid_dataset(name, normalize_features=False, transform=None):
Expand Down
5 changes: 3 additions & 2 deletions benchmark/citation/gat.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import argparse

import torch
import torch.nn.functional as F
from torch_geometric.nn import GATConv

from citation import get_planetoid_dataset, random_planetoid_splits, run

from torch_geometric.nn import GATConv

parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, required=True)
parser.add_argument('--random_splits', type=bool, default=False)
Expand Down
5 changes: 3 additions & 2 deletions benchmark/citation/gcn.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import argparse

import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv

from citation import get_planetoid_dataset, random_planetoid_splits, run

from torch_geometric.nn import GCNConv

parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, required=True)
parser.add_argument('--random_splits', type=bool, default=False)
Expand Down
5 changes: 3 additions & 2 deletions benchmark/citation/sgc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import argparse

import torch
import torch.nn.functional as F
from torch_geometric.nn import SGConv

from citation import get_planetoid_dataset, random_planetoid_splits, run

from torch_geometric.nn import SGConv

parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, required=True)
parser.add_argument('--random_splits', type=bool, default=False)
Expand Down
5 changes: 3 additions & 2 deletions benchmark/kernel/asap.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import (ASAPooling, GraphConv, global_mean_pool,
JumpingKnowledge)

from torch_geometric.nn import (ASAPooling, GraphConv, JumpingKnowledge,
global_mean_pool)


class ASAP(torch.nn.Module):
Expand Down
3 changes: 2 additions & 1 deletion benchmark/kernel/datasets.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os.path as osp

import torch

import torch_geometric.transforms as T
from torch_geometric.datasets import TUDataset
from torch_geometric.utils import degree
import torch_geometric.transforms as T


class NormalizedDegree(object):
Expand Down
3 changes: 2 additions & 1 deletion benchmark/kernel/diff_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import DenseSAGEConv, dense_diff_pool, JumpingKnowledge

from torch_geometric.nn import DenseSAGEConv, JumpingKnowledge, dense_diff_pool


class Block(torch.nn.Module):
Expand Down
5 changes: 3 additions & 2 deletions benchmark/kernel/edge_pool.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import (GraphConv, EdgePooling, global_mean_pool,
JumpingKnowledge)

from torch_geometric.nn import (EdgePooling, GraphConv, JumpingKnowledge,
global_mean_pool)


class EdgePool(torch.nn.Module):
Expand Down
3 changes: 2 additions & 1 deletion benchmark/kernel/gcn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import GCNConv, global_mean_pool, JumpingKnowledge

from torch_geometric.nn import GCNConv, JumpingKnowledge, global_mean_pool


class GCN(torch.nn.Module):
Expand Down
6 changes: 4 additions & 2 deletions benchmark/kernel/gin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear, Sequential, ReLU, BatchNorm1d as BN
from torch_geometric.nn import GINConv, global_mean_pool, JumpingKnowledge
from torch.nn import BatchNorm1d as BN
from torch.nn import Linear, ReLU, Sequential

from torch_geometric.nn import GINConv, JumpingKnowledge, global_mean_pool


class GIN0(torch.nn.Module):
Expand Down
3 changes: 2 additions & 1 deletion benchmark/kernel/global_attention.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import SAGEConv, GlobalAttention

from torch_geometric.nn import GlobalAttention, SAGEConv


class GlobalAttentionNet(torch.nn.Module):
Expand Down
5 changes: 3 additions & 2 deletions benchmark/kernel/graclus.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear

from torch_geometric.data import Batch
from torch_geometric.nn import (GraphConv, graclus, max_pool, global_mean_pool,
JumpingKnowledge)
from torch_geometric.nn import (GraphConv, JumpingKnowledge, global_mean_pool,
graclus, max_pool)


class Graclus(torch.nn.Module):
Expand Down
3 changes: 2 additions & 1 deletion benchmark/kernel/graph_sage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import SAGEConv, global_mean_pool, JumpingKnowledge

from torch_geometric.nn import JumpingKnowledge, SAGEConv, global_mean_pool


class GraphSAGE(torch.nn.Module):
Expand Down
19 changes: 9 additions & 10 deletions benchmark/kernel/main.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import argparse
from itertools import product

import argparse
from asap import ASAP
from datasets import get_dataset
from train_eval import cross_validation_with_val_set

from gcn import GCN, GCNWithJK
from graph_sage import GraphSAGE, GraphSAGEWithJK
from gin import GIN0, GIN0WithJK, GIN, GINWithJK
from graclus import Graclus
from top_k import TopK
from sag_pool import SAGPool
from diff_pool import DiffPool
from edge_pool import EdgePool
from gcn import GCN, GCNWithJK
from gin import GIN, GIN0, GIN0WithJK, GINWithJK
from global_attention import GlobalAttentionNet
from graclus import Graclus
from graph_sage import GraphSAGE, GraphSAGEWithJK
from sag_pool import SAGPool
from set2set import Set2SetNet
from sort_pool import SortPool
from asap import ASAP
from top_k import TopK
from train_eval import cross_validation_with_val_set

parser = argparse.ArgumentParser()
parser.add_argument('--epochs', type=int, default=100)
Expand Down
14 changes: 6 additions & 8 deletions benchmark/kernel/main_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@
from itertools import product

import torch

from torch_geometric import seed_everything
from torch_geometric.loader import DataLoader
from torch_geometric.profile import profileit, timeit, get_stats_summary

from datasets import get_dataset
from train_eval import train, eval_acc

from gcn import GCN
from graph_sage import GraphSAGE
from gin import GIN
from graph_sage import GraphSAGE
from train_eval import eval_acc, train

from torch_geometric import seed_everything
from torch_geometric.loader import DataLoader
from torch_geometric.profile import get_stats_summary, profileit, timeit

seed_everything(0)

Expand Down
5 changes: 3 additions & 2 deletions benchmark/kernel/sag_pool.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import (GraphConv, SAGPooling, global_mean_pool,
JumpingKnowledge)

from torch_geometric.nn import (GraphConv, JumpingKnowledge, SAGPooling,
global_mean_pool)


class SAGPool(torch.nn.Module):
Expand Down
1 change: 1 addition & 0 deletions benchmark/kernel/set2set.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear

from torch_geometric.nn import SAGEConv, Set2Set


Expand Down
3 changes: 2 additions & 1 deletion benchmark/kernel/sort_pool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear, Conv1d
from torch.nn import Conv1d, Linear

from torch_geometric.nn import SAGEConv, global_sort_pool


Expand Down
5 changes: 3 additions & 2 deletions benchmark/kernel/top_k.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import (GraphConv, TopKPooling, global_mean_pool,
JumpingKnowledge)

from torch_geometric.nn import (GraphConv, JumpingKnowledge, TopKPooling,
global_mean_pool)


class TopK(torch.nn.Module):
Expand Down
6 changes: 4 additions & 2 deletions benchmark/kernel/train_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import torch
import torch.nn.functional as F
from sklearn.model_selection import StratifiedKFold
from torch import tensor
from torch.optim import Adam
from sklearn.model_selection import StratifiedKFold
from torch_geometric.loader import DataLoader, DenseDataLoader as DenseLoader

from torch_geometric.loader import DataLoader
from torch_geometric.loader import DenseDataLoader as DenseLoader

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

Expand Down
2 changes: 1 addition & 1 deletion benchmark/points/datasets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os.path as osp

from torch_geometric.datasets import ModelNet
import torch_geometric.transforms as T
from torch_geometric.datasets import ModelNet


def get_dataset(num_points):
Expand Down
9 changes: 6 additions & 3 deletions benchmark/points/edge_cnn.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import argparse

import torch
import torch.nn.functional as F
from torch.nn import Sequential as Seq, Linear as Lin, ReLU
from torch_geometric.nn import DynamicEdgeConv, global_max_pool

from points.datasets import get_dataset
from points.train_eval import run
from torch.nn import Linear as Lin
from torch.nn import ReLU
from torch.nn import Sequential as Seq

from torch_geometric.nn import DynamicEdgeConv, global_max_pool

parser = argparse.ArgumentParser()
parser.add_argument('--epochs', type=int, default=200)
Expand Down
9 changes: 6 additions & 3 deletions benchmark/points/mpnn.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import argparse

import torch
import torch.nn.functional as F
from torch.nn import Sequential as Seq, Linear as Lin, ReLU
from torch_geometric.nn import NNConv, radius_graph, fps, global_mean_pool

from points.datasets import get_dataset
from points.train_eval import run
from torch.nn import Linear as Lin
from torch.nn import ReLU
from torch.nn import Sequential as Seq

from torch_geometric.nn import NNConv, fps, global_mean_pool, radius_graph

parser = argparse.ArgumentParser()
parser.add_argument('--epochs', type=int, default=200)
Expand Down
Loading

0 comments on commit 66b1780

Please sign in to comment.