Skip to content
Merged
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
11 changes: 8 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,14 @@ Development
<https://github.com/hazelcast/hazelcast-python-client.git>`__.
2. Run ``python setup.py install`` to install the Python client.

If you are planning to contribute, please make sure that it fits the
guidelines described in
`PEP8 <https://www.python.org/dev/peps/pep-0008/>`__.
If you are planning to contribute:

1. Run ``pip install -r requirements-dev.txt`` to install development
dependencies.
2. Use `black <https://pypi.org/project/black/>`__ to reformat the code
by running the ``black .`` command.
3. Make sure that tests are passing by following the steps described
in the next section.

Testing
^^^^^^^
Expand Down
81 changes: 43 additions & 38 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# 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
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))

# -- General configuration ------------------------------------------------

Expand All @@ -29,17 +29,17 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx.ext.autosectionlabel',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.autosectionlabel",
]

autodoc_default_options = {
'members': None,
'undoc-members': None,
'show-inheritance': None,
"members": None,
"undoc-members": None,
"show-inheritance": None,
}

# Autosummary on
Expand All @@ -49,35 +49,35 @@
autosectionlabel_prefix_document = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'Hazelcast Python Client'
copyright = u'2020, Hazelcast Inc.'
author = u'Hazelcast Inc. Developers'
project = u"Hazelcast Python Client"
copyright = u"2020, Hazelcast Inc."
author = u"Hazelcast Inc. Developers"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '4.0.0'
version = "4.0.0"
# The full version, including alpha/beta/rc tags.
release = '4.0.0b1'
release = "4.0.0b1"

autodoc_member_order = 'bysource'
autoclass_content = 'both'
autodoc_member_order = "bysource"
autoclass_content = "both"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -95,7 +95,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -113,7 +113,7 @@
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -128,7 +128,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = "default"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -222,20 +222,17 @@
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'hazelcast-python-clientdoc'
htmlhelp_basename = "hazelcast-python-clientdoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
# 'preamble': '',

# Latex figure (float) alignment
# 'figure_align': 'htbp',
}
Expand All @@ -244,8 +241,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'hazelcast-python-client.tex', u'Hazelcast Python Client Documentation',
author, 'manual'),
(
master_doc,
"hazelcast-python-client.tex",
u"Hazelcast Python Client Documentation",
author,
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -274,8 +276,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'hazelcast-python-client', u'Hazelcast Python Client Documentation',
[author], 1)
(master_doc, "hazelcast-python-client", u"Hazelcast Python Client Documentation", [author], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -288,9 +289,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'hazelcast-python-client', u'Hazelcast Python Client Documentation',
author, 'hazelcast-python-client', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"hazelcast-python-client",
u"Hazelcast Python Client Documentation",
author,
"hazelcast-python-client",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand All @@ -305,12 +312,10 @@
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False

on_rtd = os.environ.get('READTHEDOCS') == 'True'
on_rtd = os.environ.get("READTHEDOCS") == "True"

if not on_rtd:
# If we are building locally, import the RTD theme
# and use it

import sphinx_rtd_theme
extensions.append('sphinx_rtd_theme')
html_theme = 'sphinx_rtd_theme'
extensions.append("sphinx_rtd_theme")
html_theme = "sphinx_rtd_theme"
11 changes: 8 additions & 3 deletions docs/development_and_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ its source:
(https://github.com/hazelcast/hazelcast-python-client.git).
2. Run ``python setup.py install`` to install the Python client.

If you are planning to contribute, please make sure that it fits the
guidelines described in
`PEP8 <https://www.python.org/dev/peps/pep-0008/>`__.
If you are planning to contribute:

1. Run ``pip install -r requirements-dev.txt`` to install development
dependencies.
2. Use `black <https://pypi.org/project/black/>`__ to reformat the code
by running the ``black .`` command.
3. Make sure that tests are passing by following the steps described
in the :ref:`development_and_testing:testing` section.

Testing
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ssl_cafile="/path/to/ca.pem",
ssl_certfile="/path/to/cert.pem",
ssl_keyfile="/path/to/key.pem",
ssl_password="YOUR_KEY_STORE_PASSWORD"
ssl_password="YOUR_KEY_STORE_PASSWORD",
)

my_map = client.get_map("map-on-the-cloud").blocking()
Expand Down
12 changes: 7 additions & 5 deletions examples/flake-id-generator/flake_id_generator_example.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import hazelcast

client = hazelcast.HazelcastClient(flake_id_generators={
"id-generator": {
"prefetch_count": 50,
"prefetch_validity": 30,
client = hazelcast.HazelcastClient(
flake_id_generators={
"id-generator": {
"prefetch_count": 50,
"prefetch_validity": 30,
}
}
})
)

generator = client.get_flake_id_generator("id-generator").blocking()

Expand Down
4 changes: 2 additions & 2 deletions examples/hazelcast-json-value/hazelcast_json_value_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
client = hazelcast.HazelcastClient()
employees_map = client.get_map("employees").blocking()

alice = "{\"name\": \"Alice\", \"age\": 35}"
andy = "{\"name\": \"Andy\", \"age\": 22}"
alice = '{"name": "Alice", "age": 35}'
andy = '{"name": "Andy", "age": 22}'
bob = {"name": "Bob", "age": 37}

# HazelcastJsonValue can be constructed from JSON strings
Expand Down
6 changes: 1 addition & 5 deletions examples/learning-basics/2-create_a_map.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import hazelcast

# Connect
client = hazelcast.HazelcastClient(
cluster_members=[
"127.0.0.1:5701"
]
)
client = hazelcast.HazelcastClient(cluster_members=["127.0.0.1:5701"])

# Get a map that is stored on the server side. We can access it from the client
greetings_map = client.get_map("greetings-map").blocking()
Expand Down
6 changes: 1 addition & 5 deletions examples/learning-basics/3-read_from_a_map.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import hazelcast

# Connect
client = hazelcast.HazelcastClient(
cluster_members=[
"127.0.0.1:5701"
]
)
client = hazelcast.HazelcastClient(cluster_members=["127.0.0.1:5701"])

# We can access maps on the server from the client. Let's access the greetings map that we created already
greetings_map = client.get_map("greetings-map").blocking()
Expand Down
9 changes: 7 additions & 2 deletions examples/map/map_listener_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ def entry_removed(event):


def entry_updated(event):
print("Entry updated with key: %s, old value: %s, new value: %s" % (event.key, event.old_value, event.value))
print(
"Entry updated with key: %s, old value: %s, new value: %s"
% (event.key, event.old_value, event.value)
)


client = hazelcast.HazelcastClient()

my_map = client.get_map("listener-map").blocking()

my_map.add_entry_listener(True, added_func=entry_added, removed_func=entry_removed, updated_func=entry_updated)
my_map.add_entry_listener(
True, added_func=entry_added, removed_func=entry_removed, updated_func=entry_updated
)

my_map.put("key", "value")
my_map.put("key", "new value")
Expand Down
22 changes: 13 additions & 9 deletions examples/map/map_paging_predicate_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@

m1 = client.get_map("m1").blocking()

m1.put_all({
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6,
"g": 7,
})
m1.put_all(
{
"a": 1,
"b": 2,
"c": 3,
"d": 4,
"e": 5,
"f": 6,
"g": 7,
}
)

size = m1.size()
print("Added %s elements" % size)
Expand All @@ -39,6 +41,7 @@
# server side and registered as a Portable or IdentifiedDataSerializable
# before the server starts.


class ReversedKeyComparator(IdentifiedDataSerializable):
"""
This class is simply a marker implementation
Expand All @@ -47,6 +50,7 @@ class ReversedKeyComparator(IdentifiedDataSerializable):
server side. A sample server side implementation
is provided at the end of file.
"""

def get_class_id(self):
return 1

Expand Down
8 changes: 3 additions & 5 deletions examples/map/map_portable_query_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ def __eq__(self, other):
return isinstance(other, Employee) and self.name == other.name and self.age == other.age


client = hazelcast.HazelcastClient(portable_factories={
Employee.FACTORY_ID: {
Employee.CLASS_ID: Employee
}
})
client = hazelcast.HazelcastClient(
portable_factories={Employee.FACTORY_ID: {Employee.CLASS_ID: Employee}}
)

my_map = client.get_map("employee-map")

Expand Down
Loading