Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
da877df2
Unverified
Commit
da877df2
authored
Jan 28, 2022
by
Quan (Andy) Gan
Committed by
GitHub
Jan 28, 2022
Browse files
[CI] Migrate to pylint 2.6.0 (#3698)
* migrate to pylint 2.6.0 * fix * fix? * ??? * oops
parent
268f6176
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
17 deletions
+34
-17
python/dgl/_ffi/object.py
python/dgl/_ffi/object.py
+2
-1
python/dgl/convert.py
python/dgl/convert.py
+1
-1
python/dgl/distributed/graph_partition_book.py
python/dgl/distributed/graph_partition_book.py
+2
-4
python/dgl/distributed/nn/pytorch/sparse_emb.py
python/dgl/distributed/nn/pytorch/sparse_emb.py
+4
-2
python/dgl/distributed/rpc_client.py
python/dgl/distributed/rpc_client.py
+1
-2
python/dgl/distributed/rpc_server.py
python/dgl/distributed/rpc_server.py
+3
-3
tests/distributed/utils.py
tests/distributed/utils.py
+3
-1
tests/lint/pylintrc
tests/lint/pylintrc
+18
-3
No files found.
python/dgl/_ffi/object.py
View file @
da877df2
...
@@ -8,7 +8,8 @@ from .. import _api_internal
...
@@ -8,7 +8,8 @@ from .. import _api_internal
from
.object_generic
import
ObjectGeneric
,
convert_to_object
from
.object_generic
import
ObjectGeneric
,
convert_to_object
from
.base
import
_LIB
,
check_call
,
c_str
,
py_str
,
_FFI_MODE
from
.base
import
_LIB
,
check_call
,
c_str
,
py_str
,
_FFI_MODE
IMPORT_EXCEPT
=
RuntimeError
if
_FFI_MODE
==
"cython"
else
ImportError
IMPORT_EXCEPT
=
RuntimeError
if
_FFI_MODE
==
"cython"
\
else
ImportError
# pylint: disable=invalid-name
try
:
try
:
# pylint: disable=wrong-import-position
# pylint: disable=wrong-import-position
if
_FFI_MODE
==
"ctypes"
:
if
_FFI_MODE
==
"ctypes"
:
...
...
python/dgl/convert.py
View file @
da877df2
...
@@ -794,7 +794,7 @@ def to_heterogeneous(G, ntypes, etypes, ntype_field=NTYPE,
...
@@ -794,7 +794,7 @@ def to_heterogeneous(G, ntypes, etypes, ntype_field=NTYPE,
data_dict
[
canonical_etypes
[
-
1
]]
=
\
data_dict
[
canonical_etypes
[
-
1
]]
=
\
(
src_of_etype
,
dst_of_etype
)
(
src_of_etype
,
dst_of_etype
)
hg
=
heterograph
(
data_dict
,
hg
=
heterograph
(
data_dict
,
{
ntype
:
count
for
ntype
,
count
in
zip
(
ntypes
,
ntype_count
)
}
,
dict
(
zip
(
ntypes
,
ntype_count
)
)
,
idtype
=
idtype
,
device
=
device
)
idtype
=
idtype
,
device
=
device
)
ntype2ngrp
=
{
ntype
:
node_groups
[
ntid
]
for
ntid
,
ntype
in
enumerate
(
ntypes
)}
ntype2ngrp
=
{
ntype
:
node_groups
[
ntid
]
for
ntid
,
ntype
in
enumerate
(
ntypes
)}
...
...
python/dgl/distributed/graph_partition_book.py
View file @
da877df2
...
@@ -740,14 +740,12 @@ class RangePartitionBook(GraphPartitionBook):
...
@@ -740,14 +740,12 @@ class RangePartitionBook(GraphPartitionBook):
nid_range
=
[
None
]
*
len
(
self
.
ntypes
)
nid_range
=
[
None
]
*
len
(
self
.
ntypes
)
for
i
,
ntype
in
enumerate
(
self
.
ntypes
):
for
i
,
ntype
in
enumerate
(
self
.
ntypes
):
nid_range
[
i
]
=
(
ntype
,
self
.
_typed_nid_range
[
ntype
])
nid_range
[
i
]
=
(
ntype
,
self
.
_typed_nid_range
[
ntype
])
nid_range_pickle
=
pickle
.
dumps
(
nid_range
)
nid_range_pickle
=
list
(
pickle
.
dumps
(
nid_range
))
nid_range_pickle
=
[
e
for
e
in
nid_range_pickle
]
eid_range
=
[
None
]
*
len
(
self
.
etypes
)
eid_range
=
[
None
]
*
len
(
self
.
etypes
)
for
i
,
etype
in
enumerate
(
self
.
etypes
):
for
i
,
etype
in
enumerate
(
self
.
etypes
):
eid_range
[
i
]
=
(
etype
,
self
.
_typed_eid_range
[
etype
])
eid_range
[
i
]
=
(
etype
,
self
.
_typed_eid_range
[
etype
])
eid_range_pickle
=
pickle
.
dumps
(
eid_range
)
eid_range_pickle
=
list
(
pickle
.
dumps
(
eid_range
))
eid_range_pickle
=
[
e
for
e
in
eid_range_pickle
]
self
.
_meta
=
_move_metadata_to_shared_mem
(
graph_name
,
self
.
_meta
=
_move_metadata_to_shared_mem
(
graph_name
,
0
,
# We don't need to provide the number of nodes
0
,
# We don't need to provide the number of nodes
...
...
python/dgl/distributed/nn/pytorch/sparse_emb.py
View file @
da877df2
...
@@ -77,8 +77,10 @@ class DistEmbedding:
...
@@ -77,8 +77,10 @@ class DistEmbedding:
if
th
.
distributed
.
is_initialized
():
if
th
.
distributed
.
is_initialized
():
self
.
_rank
=
th
.
distributed
.
get_rank
()
self
.
_rank
=
th
.
distributed
.
get_rank
()
self
.
_world_size
=
th
.
distributed
.
get_world_size
()
self
.
_world_size
=
th
.
distributed
.
get_world_size
()
else
:
# [TODO] The following code is clearly wrong but changing it to "raise DGLError"
assert
'th.distributed shoud be initialized'
# actually fails unit test. ???
# else:
# assert 'th.distributed should be initialized'
self
.
_optm_state
=
None
# track optimizer state
self
.
_optm_state
=
None
# track optimizer state
self
.
_part_policy
=
part_policy
self
.
_part_policy
=
part_policy
...
...
python/dgl/distributed/rpc_client.py
View file @
da877df2
...
@@ -36,7 +36,6 @@ def local_ip4_addr_list():
...
@@ -36,7 +36,6 @@ def local_ip4_addr_list():
"Warning! Interface: %s
\n
"
"Warning! Interface: %s
\n
"
"IP address not available for interface."
,
name
)
"IP address not available for interface."
,
name
)
continue
continue
else
:
raise
e
raise
e
ip_addr
=
socket
.
inet_ntoa
(
ip_of_ni
[
20
:
24
])
ip_addr
=
socket
.
inet_ntoa
(
ip_of_ni
[
20
:
24
])
...
...
python/dgl/distributed/rpc_server.py
View file @
da877df2
...
@@ -78,11 +78,11 @@ def start_server(server_id, ip_config, num_servers, num_clients, server_state, \
...
@@ -78,11 +78,11 @@ def start_server(server_id, ip_config, num_servers, num_clients, server_state, \
ips
=
recv_clients
[
group_id
]
ips
=
recv_clients
[
group_id
]
if
len
(
ips
)
<
rpc
.
get_num_client
():
if
len
(
ips
)
<
rpc
.
get_num_client
():
continue
continue
else
:
del
recv_clients
[
group_id
]
del
recv_clients
[
group_id
]
# a new client group is ready
# a new client group is ready
ips
.
sort
()
ips
.
sort
()
client_namebook
=
{
client_id
:
addr
for
client_id
,
addr
in
enumerate
(
ips
)
}
client_namebook
=
dict
(
enumerate
(
ips
)
)
for
client_id
,
addr
in
client_namebook
.
items
():
for
client_id
,
addr
in
client_namebook
.
items
():
client_ip
,
client_port
=
addr
.
split
(
':'
)
client_ip
,
client_port
=
addr
.
split
(
':'
)
# TODO[Rhett]: server should not be blocked endlessly.
# TODO[Rhett]: server should not be blocked endlessly.
...
...
tests/distributed/utils.py
View file @
da877df2
import
socket
import
socket
import
os
import
os
import
random
def
generate_ip_config
(
file_name
,
num_machines
,
num_servers
):
def
generate_ip_config
(
file_name
,
num_machines
,
num_servers
):
...
@@ -19,7 +20,8 @@ def generate_ip_config(file_name, num_machines, num_servers):
...
@@ -19,7 +20,8 @@ def generate_ip_config(file_name, num_machines, num_servers):
# scan available PORT
# scan available PORT
ports
=
[]
ports
=
[]
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
for
port
in
range
(
10000
,
65535
):
start
=
random
.
randint
(
10000
,
30000
)
for
port
in
range
(
start
,
65535
):
try
:
try
:
sock
.
connect
((
ip
,
port
))
sock
.
connect
((
ip
,
port
))
ports
=
[]
ports
=
[]
...
...
tests/lint/pylintrc
View file @
da877df2
...
@@ -82,6 +82,11 @@ disable=design,
...
@@ -82,6 +82,11 @@ disable=design,
len-as-condition,
len-as-condition,
cyclic-import, # disabled due to the inevitable dgl.graph -> dgl.subgraph loop
cyclic-import, # disabled due to the inevitable dgl.graph -> dgl.subgraph loop
undefined-variable, # disabled due to C extension (should enable)
undefined-variable, # disabled due to C extension (should enable)
raise-missing-from, # meh
import-outside-toplevel, # due to inevitable imports within blocks
using-constant-test, # due to in-place object modification in C
super-with-arguments, # 2.3.0->2.6.0, should enable but there's too many...
not-callable, # due to optional callables that can be None
# Enable the message, report, category or checker with the given id(s). You can
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# either give multiple identifier separated by comma (,) or put this option
...
@@ -192,7 +197,17 @@ function-naming-style=snake_case
...
@@ -192,7 +197,17 @@ function-naming-style=snake_case
#function-rgx=
#function-rgx=
# Good variable names which should always be accepted, separated by a comma.
# Good variable names which should always be accepted, separated by a comma.
good-names=i,j,k,u,v,e,n,m,w,x,y,z,g,G,hg,fn,ex,Run,_,us,vs,gs,op,ty
# f - files
# i, j, k - loop variables
# u, v, e - nodes and edges
# n, m - general integers representing quantity
# w, x, y, z - general math variables
# g, G - graphs
# hg - heterogeneous graphs
# sg - subgraphs
# fn - functions
# us, vs, es, gs - plural form of u, v, g, e
good-names=f,i,j,k,u,v,e,n,m,w,x,y,z,g,G,hg,sg,fn,ex,Run,_,us,vs,gs,es,op,ty
# Include a hint for the correct naming format with invalid-name.
# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
include-naming-hint=no
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment