]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix PEP8 warning E302 expected 2 blank lines
authorTim Beale <timbeale@catalyst.net.nz>
Fri, 27 Jul 2018 01:42:18 +0000 (13:42 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 17 Aug 2018 00:58:27 +0000 (02:58 +0200)
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/netcmd/pso.py
python/samba/tests/pso.py
python/samba/tests/samba_tool/passwordsettings.py
source4/dsdb/tests/python/password_settings.py
source4/torture/drs/python/getncchanges.py
source4/torture/drs/python/link_conflicts.py

index 468967348b81e084513f28a7de9602e78bb8830c..8f027b4927c8c770f3e6068645c99c6e36c9567d 100644 (file)
@@ -24,9 +24,11 @@ from samba.auth import system_session
 
 NEVER_TIMESTAMP = int(-0x8000000000000000)
 
+
 def pso_container(samdb):
     return "CN=Password Settings Container,CN=System,%s" % samdb.domain_dn()
 
+
 def timestamp_to_mins(timestamp_str):
     """Converts a timestamp in -100 nanosecond units to minutes"""
     # treat a timestamp of 'never' the same as zero (this should work OK for
@@ -37,20 +39,24 @@ def timestamp_to_mins(timestamp_str):
     else:
         return abs(int(timestamp_str)) / (1e7 * 60)
 
+
 def timestamp_to_days(timestamp_str):
     """Converts a timestamp in -100 nanosecond units to days"""
     return timestamp_to_mins(timestamp_str) / (60 * 24)
 
+
 def mins_to_timestamp(mins):
     """Converts a value in minutes to -100 nanosecond units"""
     timestamp = -int((1e7) * 60 * mins)
     return str(timestamp)
 
+
 def days_to_timestamp(days):
     """Converts a value in days to -100 nanosecond units"""
     timestamp = mins_to_timestamp(days * 60 * 24)
     return str(timestamp)
 
+
 def show_pso_by_dn(outf, samdb, dn, show_applies_to=True):
     """Displays the password settings for a PSO specified by DN"""
 
@@ -100,6 +106,7 @@ def show_pso_by_dn(outf, samdb, dn, show_applies_to=True):
         else:
             outf.write("\nNote: PSO does not apply to any users or groups.\n")
 
+
 def check_pso_valid(samdb, pso_dn, name):
     """Gracefully bail out if we can't view/modify the PSO specified"""
     # the base scope search for the PSO throws an error if it doesn't exist
@@ -116,6 +123,7 @@ def check_pso_valid(samdb, pso_dn, name):
     if 'msDS-PasswordSettingsPrecedence' not in res[0]:
         raise CommandError("You may not have permission to view/modify PSOs")
 
+
 def show_pso_for_user(outf, samdb, username):
     """Displays the password settings for a specific user"""
 
@@ -146,6 +154,7 @@ def show_pso_for_user(outf, samdb, username):
         else:
             outf.write("\nPSO applies to user via group membership.\n")
 
+
 def make_pso_ldb_msg(outf, samdb, pso_dn, create, lockout_threshold=None,
                      complexity=None, precedence=None, store_plaintext=None,
                      history_length=None, min_pwd_length=None,
@@ -217,6 +226,7 @@ def make_pso_ldb_msg(outf, samdb, pso_dn, create, lockout_threshold=None,
 
     return m
 
+
 def check_pso_constraints(min_pwd_length=None, history_length=None,
                           min_pwd_age=None, max_pwd_age=None):
     """Checks PSO settings fall within valid ranges"""
@@ -255,6 +265,7 @@ pwd_settings_options = [
     Option("--reset-account-lockout-after",
       help="After this time is elapsed, the recorded number of attempts restarts from zero (<integer in mins>). Default is domain setting.", type=int)]
 
+
 def num_options_in_args(options, args):
     """
     Returns the number of options specified that are present in the args.
@@ -269,6 +280,7 @@ def num_options_in_args(options, args):
                 num_opts += 1
     return num_opts
 
+
 class cmd_domain_pwdsettings_pso_create(Command):
     """Creates a new Password Settings Object (PSO).
 
@@ -412,6 +424,7 @@ class cmd_domain_pwdsettings_pso_create(Command):
                 raise CommandError("Failed to create PSO '%s': %s" % (pso_dn,
                                                                       msg))
 
+
 class cmd_domain_pwdsettings_pso_set(Command):
     """Modifies a Password Settings Object (PSO)."""
 
@@ -529,6 +542,7 @@ def pso_cmp(a, b):
     b_precedence = int(b['msDS-PasswordSettingsPrecedence'][0])
     return a_precedence - b_precedence
 
+
 class cmd_domain_pwdsettings_pso_list(Command):
     """Lists all Password Settings Objects (PSOs)."""
 
@@ -572,6 +586,7 @@ class cmd_domain_pwdsettings_pso_list(Command):
             precedence = pso['msDS-PasswordSettingsPrecedence']
             self.outf.write("%-10s | %s\n" % (precedence, pso['name']))
 
+
 class cmd_domain_pwdsettings_pso_show(Command):
     """Display a Password Settings Object's details."""
 
@@ -755,6 +770,7 @@ class cmd_domain_pwdsettings_pso_unapply(Command):
         self.message("PSO '%s' no longer applies to '%s'" % (psoname,
                                                              user_or_group))
 
+
 class cmd_domain_passwordsettings_pso(SuperCommand):
     """Manage fine-grained Password Settings Objects (PSOs)."""
 
index ef365d9effc882ff19bc512cb168ba31e1bd13c6..0d37108e06023690b346105405efd2f10980d736 100644 (file)
@@ -25,6 +25,7 @@ from ldb import FLAG_MOD_DELETE, FLAG_MOD_ADD, FLAG_MOD_REPLACE
 from samba.dcerpc.samr import (DOMAIN_PASSWORD_COMPLEX,
                                DOMAIN_PASSWORD_STORE_CLEARTEXT)
 
+
 class TestUser:
     def __init__(self, username, samdb, userou=None):
         initial_password = "Initial12#"
@@ -145,6 +146,7 @@ userPassword: %s
                                                  "primaryGroupID")
         self.ldb.modify(m)
 
+
 class PasswordSettings:
     def default_settings(self, samdb):
         """
index e8eb084c0870a4ce74d7ce609d3f55d411030bbc..9c934b41dc91ab307b65c98c769751bddace0f31 100644 (file)
@@ -21,6 +21,7 @@ import ldb
 from samba.tests.samba_tool.base import SambaToolCmdTest
 from samba.tests.pso import PasswordSettings, TestUser
 
+
 class PwdSettingsCmdTestCase(SambaToolCmdTest):
     """Tests for 'samba-tool domain passwordsettings' subcommands"""
 
index d46528e25c5fffbb44d37c166b18ab89961e4733..9b1f833acfb63ab31d5a45eca8e02d6be48f459f 100644 (file)
@@ -41,6 +41,7 @@ from samba.credentials import Credentials
 from samba import gensec
 import base64
 
+
 class PasswordSettingsTestCase(PasswordTestCase):
     def setUp(self):
         super(PasswordSettingsTestCase, self).setUp()
index 123a19cc3de894218e2f0e0f998c73d61aee332e..ef3e2fdcee0b9823751373456d6eba15cd0f7def 100644 (file)
@@ -36,6 +36,7 @@ import random
 
 from samba.dcerpc import drsuapi
 
+
 class DrsReplicaSyncIntegrityTestCase(drs_base.DrsBaseTestCase):
     def setUp(self):
         super(DrsReplicaSyncIntegrityTestCase, self).setUp()
index 347298b5885f8320c8842cc0067c7c2cb69ca8e4..5f4c555e9dec610a568142267bd1726cc73d8a03 100644 (file)
@@ -42,6 +42,7 @@ from samba.dcerpc import drsuapi, misc
 DC1_TO_DC2 = 1
 DC2_TO_DC1 = 2
 
+
 class DrsReplicaLinkConflictTestCase(drs_base.DrsBaseTestCase):
     def setUp(self):
         super(DrsReplicaLinkConflictTestCase, self).setUp()