D7937: python-zstandard: blacken at 80 characters

2020-01-23 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I'm -0 on auto-formatting third-party code at all, and that includes 
zstandard stuff. Why do we care if it's in the ignorelist?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7937/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7937

To: indygreg, #hg-reviewers, mharbison72, pulkit
Cc: durin42, mharbison72, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7937: python-zstandard: blacken at 80 characters

2020-01-23 Thread indygreg (Gregory Szorc)
Closed by commit rHG5e84a96d865b: python-zstandard: blacken at 80 characters 
(authored by indygreg).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7937?vs=19525&id=19535

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7937/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7937

AFFECTED FILES
  black.toml
  contrib/examples/fix.hgrc
  contrib/python-zstandard/make_cffi.py
  contrib/python-zstandard/setup.py
  contrib/python-zstandard/setup_zstd.py
  contrib/python-zstandard/tests/common.py
  contrib/python-zstandard/tests/test_buffer_util.py
  contrib/python-zstandard/tests/test_compressor.py
  contrib/python-zstandard/tests/test_compressor_fuzzing.py
  contrib/python-zstandard/tests/test_data_structures.py
  contrib/python-zstandard/tests/test_data_structures_fuzzing.py
  contrib/python-zstandard/tests/test_decompressor.py
  contrib/python-zstandard/tests/test_decompressor_fuzzing.py
  contrib/python-zstandard/tests/test_train_dictionary.py
  contrib/python-zstandard/zstandard/cffi.py
  tests/test-check-format.t

CHANGE DETAILS

diff --git a/tests/test-check-format.t b/tests/test-check-format.t
--- a/tests/test-check-format.t
+++ b/tests/test-check-format.t
@@ -1,5 +1,5 @@
 #require black
 
   $ cd $RUNTESTDIR/..
-  $ black --config=black.toml --check --diff `hg files 'set:(**.py + 
grep("^#!.*python")) - mercurial/thirdparty/** - "contrib/python-zstandard/**"'`
+  $ black --config=black.toml --check --diff `hg files 'set:(**.py + 
grep("^#!.*python")) - mercurial/thirdparty/**'`
 
diff --git a/contrib/python-zstandard/zstandard/cffi.py 
b/contrib/python-zstandard/zstandard/cffi.py
--- a/contrib/python-zstandard/zstandard/cffi.py
+++ b/contrib/python-zstandard/zstandard/cffi.py
@@ -299,10 +299,14 @@
 _set_compression_parameter(params, lib.ZSTD_c_chainLog, chain_log)
 _set_compression_parameter(params, lib.ZSTD_c_searchLog, search_log)
 _set_compression_parameter(params, lib.ZSTD_c_minMatch, min_match)
-_set_compression_parameter(params, lib.ZSTD_c_targetLength, 
target_length)
+_set_compression_parameter(
+params, lib.ZSTD_c_targetLength, target_length
+)
 
 if strategy != -1 and compression_strategy != -1:
-raise ValueError("cannot specify both compression_strategy and 
strategy")
+raise ValueError(
+"cannot specify both compression_strategy and strategy"
+)
 
 if compression_strategy != -1:
 strategy = compression_strategy
@@ -313,12 +317,16 @@
 _set_compression_parameter(
 params, lib.ZSTD_c_contentSizeFlag, write_content_size
 )
-_set_compression_parameter(params, lib.ZSTD_c_checksumFlag, 
write_checksum)
+_set_compression_parameter(
+params, lib.ZSTD_c_checksumFlag, write_checksum
+)
 _set_compression_parameter(params, lib.ZSTD_c_dictIDFlag, 
write_dict_id)
 _set_compression_parameter(params, lib.ZSTD_c_jobSize, job_size)
 
 if overlap_log != -1 and overlap_size_log != -1:
-raise ValueError("cannot specify both overlap_log and 
overlap_size_log")
+raise ValueError(
+"cannot specify both overlap_log and overlap_size_log"
+)
 
 if overlap_size_log != -1:
 overlap_log = overlap_size_log
@@ -326,12 +334,16 @@
 overlap_log = 0
 
 _set_compression_parameter(params, lib.ZSTD_c_overlapLog, overlap_log)
-_set_compression_parameter(params, lib.ZSTD_c_forceMaxWindow, 
force_max_window)
+_set_compression_parameter(
+params, lib.ZSTD_c_forceMaxWindow, force_max_window
+)
 _set_compression_parameter(
 params, lib.ZSTD_c_enableLongDistanceMatching, enable_ldm
 )
 _set_compression_parameter(params, lib.ZSTD_c_ldmHashLog, ldm_hash_log)
-_set_compression_parameter(params, lib.ZSTD_c_ldmMinMatch, 
ldm_min_match)
+_set_compression_parameter(
+params, lib.ZSTD_c_ldmMinMatch, ldm_min_match
+)
 _set_compression_parameter(
 params, lib.ZSTD_c_ldmBucketSizeLog, ldm_bucket_size_log
 )
@@ -346,7 +358,9 @@
 elif ldm_hash_rate_log == -1:
 ldm_hash_rate_log = 0
 
-_set_compression_parameter(params, lib.ZSTD_c_ldmHashRateLog, 
ldm_hash_rate_log)
+_set_compression_parameter(
+params, lib.ZSTD_c_ldmHashRateLog, ldm_hash_rate_log
+)
 
 @property
 def format(self):
@@ -354,7 +368,9 @@
 
 @property
 def compression_level(self):
-return _get_compression_parameter(self._params, 
lib.ZSTD_c_compressionLevel)
+return _get_compression_parameter(
+self._params, lib.ZSTD_c_compress

D7937: python-zstandard: blacken at 80 characters

2020-01-22 Thread indygreg (Gregory Szorc)
indygreg updated this revision to Diff 19525.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7937?vs=19441&id=19525

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7937/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7937

AFFECTED FILES
  black.toml
  contrib/examples/fix.hgrc
  contrib/python-zstandard/make_cffi.py
  contrib/python-zstandard/setup.py
  contrib/python-zstandard/setup_zstd.py
  contrib/python-zstandard/tests/common.py
  contrib/python-zstandard/tests/test_buffer_util.py
  contrib/python-zstandard/tests/test_compressor.py
  contrib/python-zstandard/tests/test_compressor_fuzzing.py
  contrib/python-zstandard/tests/test_data_structures.py
  contrib/python-zstandard/tests/test_data_structures_fuzzing.py
  contrib/python-zstandard/tests/test_decompressor.py
  contrib/python-zstandard/tests/test_decompressor_fuzzing.py
  contrib/python-zstandard/tests/test_train_dictionary.py
  contrib/python-zstandard/zstandard/cffi.py
  tests/test-check-format.t

CHANGE DETAILS

diff --git a/tests/test-check-format.t b/tests/test-check-format.t
--- a/tests/test-check-format.t
+++ b/tests/test-check-format.t
@@ -1,5 +1,5 @@
 #require black
 
   $ cd $RUNTESTDIR/..
-  $ black --config=black.toml --check --diff `hg files 'set:(**.py + 
grep("^#!.*python")) - mercurial/thirdparty/** - "contrib/python-zstandard/**"'`
+  $ black --config=black.toml --check --diff `hg files 'set:(**.py + 
grep("^#!.*python")) - mercurial/thirdparty/**'`
 
diff --git a/contrib/python-zstandard/zstandard/cffi.py 
b/contrib/python-zstandard/zstandard/cffi.py
--- a/contrib/python-zstandard/zstandard/cffi.py
+++ b/contrib/python-zstandard/zstandard/cffi.py
@@ -299,10 +299,14 @@
 _set_compression_parameter(params, lib.ZSTD_c_chainLog, chain_log)
 _set_compression_parameter(params, lib.ZSTD_c_searchLog, search_log)
 _set_compression_parameter(params, lib.ZSTD_c_minMatch, min_match)
-_set_compression_parameter(params, lib.ZSTD_c_targetLength, 
target_length)
+_set_compression_parameter(
+params, lib.ZSTD_c_targetLength, target_length
+)
 
 if strategy != -1 and compression_strategy != -1:
-raise ValueError("cannot specify both compression_strategy and 
strategy")
+raise ValueError(
+"cannot specify both compression_strategy and strategy"
+)
 
 if compression_strategy != -1:
 strategy = compression_strategy
@@ -313,12 +317,16 @@
 _set_compression_parameter(
 params, lib.ZSTD_c_contentSizeFlag, write_content_size
 )
-_set_compression_parameter(params, lib.ZSTD_c_checksumFlag, 
write_checksum)
+_set_compression_parameter(
+params, lib.ZSTD_c_checksumFlag, write_checksum
+)
 _set_compression_parameter(params, lib.ZSTD_c_dictIDFlag, 
write_dict_id)
 _set_compression_parameter(params, lib.ZSTD_c_jobSize, job_size)
 
 if overlap_log != -1 and overlap_size_log != -1:
-raise ValueError("cannot specify both overlap_log and 
overlap_size_log")
+raise ValueError(
+"cannot specify both overlap_log and overlap_size_log"
+)
 
 if overlap_size_log != -1:
 overlap_log = overlap_size_log
@@ -326,12 +334,16 @@
 overlap_log = 0
 
 _set_compression_parameter(params, lib.ZSTD_c_overlapLog, overlap_log)
-_set_compression_parameter(params, lib.ZSTD_c_forceMaxWindow, 
force_max_window)
+_set_compression_parameter(
+params, lib.ZSTD_c_forceMaxWindow, force_max_window
+)
 _set_compression_parameter(
 params, lib.ZSTD_c_enableLongDistanceMatching, enable_ldm
 )
 _set_compression_parameter(params, lib.ZSTD_c_ldmHashLog, ldm_hash_log)
-_set_compression_parameter(params, lib.ZSTD_c_ldmMinMatch, 
ldm_min_match)
+_set_compression_parameter(
+params, lib.ZSTD_c_ldmMinMatch, ldm_min_match
+)
 _set_compression_parameter(
 params, lib.ZSTD_c_ldmBucketSizeLog, ldm_bucket_size_log
 )
@@ -346,7 +358,9 @@
 elif ldm_hash_rate_log == -1:
 ldm_hash_rate_log = 0
 
-_set_compression_parameter(params, lib.ZSTD_c_ldmHashRateLog, 
ldm_hash_rate_log)
+_set_compression_parameter(
+params, lib.ZSTD_c_ldmHashRateLog, ldm_hash_rate_log
+)
 
 @property
 def format(self):
@@ -354,7 +368,9 @@
 
 @property
 def compression_level(self):
-return _get_compression_parameter(self._params, 
lib.ZSTD_c_compressionLevel)
+return _get_compression_parameter(
+self._params, lib.ZSTD_c_compressionLevel
+)
 
 @property
 def window_log(self):
@@ -386,7 +402,9 @@
 
 @property
 def write_content_size(self):
-return _get_compression_parameter(self._params, 
l

D7937: python-zstandard: blacken at 80 characters

2020-01-20 Thread mharbison72 (Matt Harbison)
This revision now requires changes to proceed.
mharbison72 added a comment.
mharbison72 requested changes to this revision.


  "contrib/examples/fix.hgrc" also skips "contrib/python-zstandard/**".  It 
seems like the intent of this is to allow local edits to python-zstandard (or 
we wouldn't start checking the format), so maybe it should be covered by fix 
too?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7937/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7937

To: indygreg, #hg-reviewers, mharbison72
Cc: mharbison72, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7937: python-zstandard: blacken at 80 characters

2020-01-17 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I made this change upstream and it will make it into the next
  release of python-zstandard. I figured I'd send it Mercurial's
  way because it will allow us to drop this directory from the black
  exclusion list.
  
  1. skip-blame blackening

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7937

AFFECTED FILES
  black.toml
  contrib/python-zstandard/make_cffi.py
  contrib/python-zstandard/setup.py
  contrib/python-zstandard/setup_zstd.py
  contrib/python-zstandard/tests/common.py
  contrib/python-zstandard/tests/test_buffer_util.py
  contrib/python-zstandard/tests/test_compressor.py
  contrib/python-zstandard/tests/test_compressor_fuzzing.py
  contrib/python-zstandard/tests/test_data_structures.py
  contrib/python-zstandard/tests/test_data_structures_fuzzing.py
  contrib/python-zstandard/tests/test_decompressor.py
  contrib/python-zstandard/tests/test_decompressor_fuzzing.py
  contrib/python-zstandard/tests/test_train_dictionary.py
  contrib/python-zstandard/zstandard/cffi.py
  tests/test-check-format.t

CHANGE DETAILS

diff --git a/tests/test-check-format.t b/tests/test-check-format.t
--- a/tests/test-check-format.t
+++ b/tests/test-check-format.t
@@ -1,5 +1,5 @@
 #require black
 
   $ cd $RUNTESTDIR/..
-  $ black --config=black.toml --check --diff `hg files 'set:(**.py + 
grep("^#!.*python")) - mercurial/thirdparty/** - "contrib/python-zstandard/**"'`
+  $ black --config=black.toml --check --diff `hg files 'set:(**.py + 
grep("^#!.*python")) - mercurial/thirdparty/**'`
 
diff --git a/contrib/python-zstandard/zstandard/cffi.py 
b/contrib/python-zstandard/zstandard/cffi.py
--- a/contrib/python-zstandard/zstandard/cffi.py
+++ b/contrib/python-zstandard/zstandard/cffi.py
@@ -299,10 +299,14 @@
 _set_compression_parameter(params, lib.ZSTD_c_chainLog, chain_log)
 _set_compression_parameter(params, lib.ZSTD_c_searchLog, search_log)
 _set_compression_parameter(params, lib.ZSTD_c_minMatch, min_match)
-_set_compression_parameter(params, lib.ZSTD_c_targetLength, 
target_length)
+_set_compression_parameter(
+params, lib.ZSTD_c_targetLength, target_length
+)
 
 if strategy != -1 and compression_strategy != -1:
-raise ValueError("cannot specify both compression_strategy and 
strategy")
+raise ValueError(
+"cannot specify both compression_strategy and strategy"
+)
 
 if compression_strategy != -1:
 strategy = compression_strategy
@@ -313,12 +317,16 @@
 _set_compression_parameter(
 params, lib.ZSTD_c_contentSizeFlag, write_content_size
 )
-_set_compression_parameter(params, lib.ZSTD_c_checksumFlag, 
write_checksum)
+_set_compression_parameter(
+params, lib.ZSTD_c_checksumFlag, write_checksum
+)
 _set_compression_parameter(params, lib.ZSTD_c_dictIDFlag, 
write_dict_id)
 _set_compression_parameter(params, lib.ZSTD_c_jobSize, job_size)
 
 if overlap_log != -1 and overlap_size_log != -1:
-raise ValueError("cannot specify both overlap_log and 
overlap_size_log")
+raise ValueError(
+"cannot specify both overlap_log and overlap_size_log"
+)
 
 if overlap_size_log != -1:
 overlap_log = overlap_size_log
@@ -326,12 +334,16 @@
 overlap_log = 0
 
 _set_compression_parameter(params, lib.ZSTD_c_overlapLog, overlap_log)
-_set_compression_parameter(params, lib.ZSTD_c_forceMaxWindow, 
force_max_window)
+_set_compression_parameter(
+params, lib.ZSTD_c_forceMaxWindow, force_max_window
+)
 _set_compression_parameter(
 params, lib.ZSTD_c_enableLongDistanceMatching, enable_ldm
 )
 _set_compression_parameter(params, lib.ZSTD_c_ldmHashLog, ldm_hash_log)
-_set_compression_parameter(params, lib.ZSTD_c_ldmMinMatch, 
ldm_min_match)
+_set_compression_parameter(
+params, lib.ZSTD_c_ldmMinMatch, ldm_min_match
+)
 _set_compression_parameter(
 params, lib.ZSTD_c_ldmBucketSizeLog, ldm_bucket_size_log
 )
@@ -346,7 +358,9 @@
 elif ldm_hash_rate_log == -1:
 ldm_hash_rate_log = 0
 
-_set_compression_parameter(params, lib.ZSTD_c_ldmHashRateLog, 
ldm_hash_rate_log)
+_set_compression_parameter(
+params, lib.ZSTD_c_ldmHashRateLog, ldm_hash_rate_log
+)
 
 @property
 def format(self):
@@ -354,7 +368,9 @@
 
 @property
 def compression_level(self):
-return _get_compression_parameter(self._params, 
lib.ZSTD_c_compressionLevel)
+return _get_compression_parameter(
+self._params, lib.ZSTD_c_compressionLevel
+)
 
 @property
 def