Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and ianhi committed Feb 3, 2022
1 parent 3f8c921 commit 816493c
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 47 deletions.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ipycytoscape documentation build configuration file
#
Expand Down Expand Up @@ -35,7 +34,8 @@

# Ensure our extension is available:
import sys
from os.path import dirname, join as pjoin
from os.path import dirname
from os.path import join as pjoin

docs = dirname(dirname(__file__))
root = dirname(docs)
Expand Down
6 changes: 3 additions & 3 deletions dodo.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# this uses https://pydoit.org/ to run tasks/chores
# pip install doit
# $ doit
import pkg_resources
from ipycytoscape._version import __version__ as version
import re

from ipycytoscape._version import __version__ as version


def task_mybinder():
"""Make the mybinder files up to date"""
Expand All @@ -14,7 +14,7 @@ def action(targets):
with open(filename) as f:
content = f.read()
content = re.sub(
"cytoscape(?P<cmp>[^0-9]*)([0-9\.].*)",
r"cytoscape(?P<cmp>[^0-9]*)([0-9\.].*)",
rf"cytoscape\g<cmp>{version}",
content,
)
Expand Down
5 changes: 1 addition & 4 deletions ipycytoscape/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.

from .cytoscape import *

from ._version import __version__, version_info

from .cytoscape import *
from .nbextension import _jupyter_nbextension_paths

npm_pkg_name = "jupyter-cytoscape"
Expand Down
1 change: 0 additions & 1 deletion ipycytoscape/_frontend.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
Expand Down
1 change: 0 additions & 1 deletion ipycytoscape/_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
Expand Down
26 changes: 12 additions & 14 deletions ipycytoscape/cytoscape.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.

from os import path

import copy
import json
from os import path


from ipywidgets import CallbackDispatcher, DOMWidget, Widget, widget_serialization
from spectate import mvc
from traitlets import TraitType, TraitError

from ipywidgets import DOMWidget, Widget, widget_serialization, CallbackDispatcher
from traitlets import (
Unicode,
Bool,
CaselessStrEnum,
CFloat,
Integer,
Instance,
Dict,
Instance,
Integer,
List,
TraitError,
TraitType,
Unicode,
Union,
CaselessStrEnum,
)

from ._frontend import module_name, module_version

try:
Expand Down Expand Up @@ -587,7 +585,7 @@ def add_graph_from_df(
for i, name in enumerate(grouped.groups):
if not isinstance(name, tuple):
name = (name,)
group_nodes[name] = Node(data={"id": "parent-{}".format(i), "name": name})
group_nodes[name] = Node(data={"id": f"parent-{i}", "name": name})

graph_nodes = []
graph_edges = []
Expand All @@ -597,7 +595,7 @@ def add_graph_from_df(
# Includes content to tips
tip_content = ""
for attribute in attribute_list:
tip_content += "{}: {}\n".format(attribute, row[attribute])
tip_content += f"{attribute}: {row[attribute]}\n"

# Creates a list with all nodes adding them in the correct node parents
graph_nodes.append(
Expand Down Expand Up @@ -853,7 +851,7 @@ def __init__(self, graph=None, **kwargs):
The graph to initialize with. Equivalent to calling the
appropriate ``CytoscapeWidget.graph.add_graph_from_` method.
"""
super(CytoscapeWidget, self).__init__(**kwargs)
super().__init__(**kwargs)

self.on_msg(self._handle_interaction)
self.graph = Graph()
Expand Down
1 change: 0 additions & 1 deletion ipycytoscape/nbextension/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
Expand Down
4 changes: 1 addition & 3 deletions ipycytoscape/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
Expand All @@ -8,7 +7,6 @@
# The full license is in the file LICENSE, distributed with this software.

import pytest

from ipykernel.comm import Comm
from ipywidgets import Widget

Expand All @@ -26,7 +24,7 @@ def __init__(self, *args, **kwargs):
self.log_open = []
self.log_send = []
self.log_close = []
super(MockComm, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

def open(self, *args, **kwargs):
self.log_open.append((args, kwargs))
Expand Down
5 changes: 2 additions & 3 deletions ipycytoscape/tests/test_graph_creation.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.

import pytest

from ipycytoscape.cytoscape import Graph, Node, Edge
import networkx as nx

from ipycytoscape.cytoscape import Edge, Graph, Node


def compare_nodes(expected_nodes, actual_nodes):
for expected, actual in zip(expected_nodes, actual_nodes):
Expand Down
6 changes: 2 additions & 4 deletions ipycytoscape/tests/test_graph_deletion.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.

import pytest

from ipycytoscape.cytoscape import Graph, Node, Edge
import networkx as nx

from ipycytoscape.cytoscape import Graph, Node


class TestNetworkx:
def test_lonely_nodes(self):
Expand Down Expand Up @@ -58,4 +57,3 @@ def test_lonely_nodes(self):

# remove all nodes of the graph
graph.clear()
expected_nodes = []
5 changes: 2 additions & 3 deletions ipycytoscape/tests/test_graph_methods.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2021, QuantStack and ipycytoscape Contributors
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.

import pytest

import copy
from ipycytoscape.cytoscape import Graph, Node, Edge

from ipycytoscape.cytoscape import Edge, Graph, Node


def compare_nodes(expected_nodes, actual_nodes):
Expand Down
1 change: 0 additions & 1 deletion ipycytoscape/tests/test_nbextension_path.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
Expand Down
11 changes: 4 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
#!/usr/bin/env python
# coding: utf-8

# Copyright (c) 2020, QuantStack, Mariana Meireles and ipycytoscape Contributors
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.

from glob import glob
import os
from glob import glob
from os import path

from jupyter_packaging import (
combine_commands,
create_cmdclass,
install_npm,
ensure_targets,
combine_commands,
get_version,
install_npm,
)

from setuptools import setup, find_packages

from setuptools import find_packages, setup

# The name of the project
name = "ipycytoscape"
Expand Down

0 comments on commit 816493c

Please sign in to comment.