Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format whole *.py codes #1687

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/get_merged_prs.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Get all merged PRs since last release, save them to a JSON file"""

import httpx
import json
from datetime import datetime

import httpx

r = httpx.get(
"https://api.github.com/repos/rdflib/rdflib/pulls",
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import re
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
11 changes: 6 additions & 5 deletions examples/berkeleydb_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
* does not delete the DB at the end so you can see it on disk
"""
import os
from rdflib import ConjunctiveGraph, Namespace, Literal
from rdflib.store import NO_STORE, VALID_STORE
from tempfile import mktemp

from rdflib import ConjunctiveGraph, Literal, Namespace
from rdflib.store import NO_STORE, VALID_STORE


def example_1():
"""Creates a ConjunctiveGraph and performs some BerkeleyDB tasks with it"""
Expand Down Expand Up @@ -98,10 +99,10 @@ def example_2():
9719
...
"""
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import base64
import json
from urllib.error import HTTPError
from urllib.request import Request, urlopen

g = ConjunctiveGraph("BerkeleyDB")
g.open("gsg_vocabs", create=True)
Expand Down
4 changes: 2 additions & 2 deletions examples/conjunctive_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
conjunction (union) of all the graphs.
"""

from rdflib import Namespace, Literal, URIRef
from rdflib.graph import Graph, ConjunctiveGraph
from rdflib import Literal, Namespace, URIRef
from rdflib.graph import ConjunctiveGraph, Graph
from rdflib.plugins.stores.memory import Memory

if __name__ == "__main__":
Expand Down
3 changes: 1 addition & 2 deletions examples/custom_datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"""


from rdflib import Graph, Literal, Namespace, XSD
from rdflib import term
from rdflib import XSD, Graph, Literal, Namespace, term

if __name__ == "__main__":

Expand Down
3 changes: 1 addition & 2 deletions examples/custom_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
"""

import rdflib

from rdflib.plugins.sparql.evaluate import evalBGP
from rdflib.namespace import FOAF, RDF, RDFS
from rdflib.plugins.sparql.evaluate import evalBGP

inferredSubClass = RDFS.subClassOf * "*" # any number of rdfs.subClassOf

Expand Down
2 changes: 1 addition & 1 deletion examples/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
and remove things from it.
"""

from rdflib import Dataset, URIRef, Literal, Namespace
from rdflib import Dataset, Literal, Namespace, URIRef

#
# Create & Add
Expand Down
6 changes: 3 additions & 3 deletions examples/film.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"""
import datetime
import os
import sys
import re
import sys
import time

try:
import imdb
except ImportError:
imdb = None

from rdflib import BNode, ConjunctiveGraph, URIRef, Literal, Namespace
from rdflib.namespace import FOAF, DC, RDF
from rdflib import BNode, ConjunctiveGraph, Literal, Namespace, URIRef
from rdflib.namespace import DC, FOAF, RDF

storefn = os.path.expanduser("~/movies.n3")
# storefn = '/home/simon/codes/film.dev/movies.n3'
Expand Down
2 changes: 1 addition & 1 deletion examples/foafpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
This example shows how to get the name of friends (i.e values two steps away x knows y, y name z) with a single query.
"""

from rdflib import URIRef, Graph
from rdflib import Graph, URIRef
from rdflib.namespace import FOAF

if __name__ == "__main__":
Expand Down
3 changes: 1 addition & 2 deletions examples/prepared_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"""

import rdflib
from rdflib.plugins.sparql import prepareQuery
from rdflib.namespace import FOAF

from rdflib.plugins.sparql import prepareQuery

if __name__ == "__main__":

Expand Down
2 changes: 1 addition & 1 deletion examples/resource_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
This example shows g.resource() in action.
"""

from rdflib import Graph, RDF, RDFS, Literal
from rdflib import RDF, RDFS, Graph, Literal
from rdflib.namespace import FOAF

if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions examples/simple_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from rdflib import Graph, Literal, BNode, RDF
from rdflib.namespace import FOAF, DC
from rdflib import RDF, BNode, Graph, Literal
from rdflib.namespace import DC, FOAF

if __name__ == "__main__":

Expand Down
2 changes: 1 addition & 1 deletion examples/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
See :meth:`rdflib.graph.Graph.__getitem__` for details
"""

from rdflib import Graph, RDF
from rdflib import RDF, Graph
from rdflib.namespace import FOAF

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion examples/sparqlstore_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Simple examples showing how to use the SPARQLStore
"""

from rdflib import Graph, URIRef, Namespace
from rdflib import Graph, Namespace, URIRef
from rdflib.plugins.stores.sparqlstore import SPARQLStore

if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions examples/swap_primer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
http://www.w3.org/2000/10/swap/Primer
"""

from rdflib import ConjunctiveGraph, Namespace, Literal
from rdflib.namespace import OWL, DC
from rdflib import ConjunctiveGraph, Literal, Namespace
from rdflib.namespace import DC, OWL

if __name__ == "__main__":

Expand Down
45 changes: 7 additions & 38 deletions rdflib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
"util",
]

import sys
import logging
import sys

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -156,47 +156,16 @@
Literal work, eq, __neq__, __lt__, etc.
"""

from rdflib.term import URIRef, BNode, IdentifiedNode, Literal, Variable

from rdflib.graph import Dataset, Graph, ConjunctiveGraph

from rdflib import plugin
from rdflib import query

from rdflib.namespace import (
BRICK,
CSVW,
DC,
DCAT,
DCMITYPE,
DCTERMS,
DOAP,
FOAF,
ODRL2,
ORG,
OWL,
PROF,
PROV,
QB,
RDF,
RDFS,
SDO,
SH,
SKOS,
SOSA,
SSN,
TIME,
VANN,
VOID,
XMLNS,
XSD,
Namespace,
)
from rdflib import plugin, query
from rdflib.graph import ConjunctiveGraph, Dataset, Graph
from rdflib.namespace import (BRICK, CSVW, DC, DCAT, DCMITYPE, DCTERMS, DOAP, FOAF,
ODRL2, ORG, OWL, PROF, PROV, QB, RDF, RDFS, SDO, SH, SKOS,
SOSA, SSN, TIME, VANN, VOID, XMLNS, XSD, Namespace)
from rdflib.term import BNode, IdentifiedNode, Literal, URIRef, Variable

# tedious sop to flake8
assert plugin
assert query

from rdflib import util

from rdflib.container import *
4 changes: 1 addition & 3 deletions rdflib/collection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from rdflib.namespace import RDF
from rdflib.term import BNode
from rdflib.term import Literal

from rdflib.term import BNode, Literal

__all__ = ["Collection"]

Expand Down
26 changes: 7 additions & 19 deletions rdflib/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@
_:cb558f30e21ddfc05ca53108348338ade8
<http://example.org/ns#label> "B" .
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from __future__ import absolute_import, division, print_function

# TODO:
# - Doesn't handle quads.
Expand All @@ -92,23 +89,14 @@
"similar",
]

from rdflib.graph import Graph, ConjunctiveGraph, ReadOnlyGraphAggregate
from rdflib.term import BNode, Node, URIRef
from collections import defaultdict
from datetime import datetime
from hashlib import sha256
from typing import (TYPE_CHECKING, Callable, Dict, Iterator, List, Optional, Set, Tuple,
Union)

from datetime import datetime
from collections import defaultdict
from typing import (
Set,
Dict,
TYPE_CHECKING,
Union,
List,
Tuple,
Callable,
Optional,
Iterator,
)
from rdflib.graph import ConjunctiveGraph, Graph, ReadOnlyGraphAggregate
from rdflib.term import BNode, Node, URIRef

if TYPE_CHECKING:
from _hashlib import HASH
Expand Down
3 changes: 1 addition & 2 deletions rdflib/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
and different versions of support libraries.
"""

import re
import codecs
import re
import warnings
from typing import TYPE_CHECKING, Match


if TYPE_CHECKING:
import xml.etree.ElementTree as etree
else:
Expand Down
3 changes: 2 additions & 1 deletion rdflib/container.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from random import randint

from rdflib.namespace import RDF
from rdflib.term import BNode, URIRef
from random import randint

__all__ = ["Container", "Bag", "Seq", "Alt", "NoElementException"]

Expand Down
6 changes: 3 additions & 3 deletions rdflib/extras/cmdlineutils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import codecs
import getopt
import sys
import time
import getopt
import rdflib
import codecs

import rdflib
from rdflib.util import guess_format


Expand Down
6 changes: 2 additions & 4 deletions rdflib/extras/describer.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@
"""

from contextlib import contextmanager

from rdflib.graph import Graph
from rdflib.namespace import RDF
from rdflib.term import BNode
from rdflib.term import Identifier
from rdflib.term import Literal
from rdflib.term import URIRef
from rdflib.term import BNode, Identifier, Literal, URIRef


class Describer(object):
Expand Down
10 changes: 4 additions & 6 deletions rdflib/extras/infixowl.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,15 @@
"""

import itertools
import logging

from rdflib import BNode, Literal, Namespace, RDF, RDFS, URIRef, Variable
from rdflib.graph import Graph
from rdflib import RDF, RDFS, BNode, Literal, Namespace, URIRef, Variable
from rdflib.collection import Collection
from rdflib.namespace import OWL, XSD
from rdflib.namespace import NamespaceManager
from rdflib.graph import Graph
from rdflib.namespace import OWL, XSD, NamespaceManager
from rdflib.term import Identifier
from rdflib.util import first

import logging

logger = logging.getLogger(__name__)


Expand Down
Loading