profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/tirkarthi/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Karthikeyan Singaravelan tirkarthi Visa Inc. Bangalore, India tirkarthi.github.io life (master) $ perl6 -e 'say qw<computers failure lazy lambda xkcd curious>.pick(*)' # :)

tirkarthi/clj-foundationdb 13

A Clojure wrapper for FoundationDB

tirkarthi/clj-http-ssrf 7

A clj-http middleware to prevent SSRF attacks

tirkarthi/chat-analyzer 6

A simple script to analyze WhatsApp and Hike chats. You can export chat as text file through email chat option.

stonecharioteer/canonical-interview-test 0

This is my solution to the standard problem that canonical gives interview candidates.

tirkarthi/airflow 0

Apache Airflow

tirkarthi/ama 0

Ask me anything! Thanks to Sindre Sorhus

tirkarthi/anaconda-client 0

Anaconda Server Client

fork mtlynch/gridsome-plugin-sentry

Sentry error tracking for Gridsome projects

fork in 3 minutes

startedag91/code-compass

started time in 37 minutes

startedkushaldas/workshops

started time in 39 minutes

startedorvillem/workingwithme

started time in 40 minutes

startedpromethial/paxedit

started time in 7 hours

startedscicloj/scicloj.ml

started time in 9 hours

startednums-project/nums

started time in 9 hours

startedorvillem/workingwithme

started time in 11 hours

startedgorzell/intellij-codespaces

started time in 17 hours

startedsshaw/export-pull-requests

started time in 17 hours

startedopensearch-project/OpenSearch

started time in 17 hours

push eventtirkarthi/cpython

Guido van Rossum

commit sha 3623477637cdaef000555d0067e5d78ab857acf2

Fix markup in news item Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>

view details

push time in 19 hours

created repositorykushaldas/workshops

created time in 20 hours

startedrclone/rclone

started time in 21 hours

MemberEvent

startedAnySoftKeyboard/AnySoftKeyboard

started time in a day

fork mjpieters/apispec

A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..

https://apispec.readthedocs.io/

fork in a day

fork purcell/sorri

Just Add Water direnv support for the nix-shell

fork in a day

created repositorypurcell/ocp-indent-el

Reformat OCaml within Emacs using ocp-indent

created time in 2 days

created repositorypurcell/dune-format-el

Reformat dune files from within Emacs

created time in 2 days

startedFelienne/hedy

started time in 2 days

startedFelienne/hedy

started time in 2 days

startedRayhanADev/ReplAPI.it

started time in 2 days

startedpsamim/dotfiles

started time in 2 days

pull request commenttesting-cabal/mock

Py39 fixes

Thanks for the fix! It solved the original problem but introduced a new one: mock may now either refer to mock or mock.mock which leads to a failure of test_filter_dir() see above.

I skimmed through the file and marked all potential changes (applying C name shadowing guidelines) with # POTENTIAL clash. Since I cannot push to this pull request, I'll include a diff inline here.

I don't know Python's rules for this, so I cannot comment on suitable workarounds or solutions.

From 1b1df2f6cf29bac5604664ae6d46004a808703ed Mon Sep 17 00:00:00 2001
From: Len Chambley <79108256+len-chambley@users.noreply.github.com>
Date: Sun, 11 Apr 2021 10:28:24 +0000
Subject: [PATCH] Potential name clashes of mock and mock.mock

---
 mock/tests/testmock.py | 72 +++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/mock/tests/testmock.py b/mock/tests/testmock.py
index 942746a..7bc401e 100644
--- a/mock/tests/testmock.py
+++ b/mock/tests/testmock.py
@@ -48,7 +48,7 @@ class MockTest(unittest.TestCase):
         # if __all__ is badly defined then import * will raise an error
         # We have to exec it because you can't import * inside a method
         # in Python 3
-        exec("from mock import *")
+        exec("from mock import *") # POTENTIAL clash
 
 
     def test_constructor(self):
@@ -249,7 +249,7 @@ class MockTest(unittest.TestCase):
         mock.reset_mock()
 
     def test_reset_mock_on_mock_open_issue_18622(self):
-        a = mock.mock_open()
+        a = mock.mock_open() # POTENTIAL clash
         a.reset_mock()
 
     def test_call(self):
@@ -315,20 +315,20 @@ class MockTest(unittest.TestCase):
     def test_calls_equal_with_any(self):
         # Check that equality and non-equality is consistent even when
         # comparing with mock.ANY
-        mm = mock.MagicMock()
+        mm = mock.MagicMock() # POTENTIAL clash
         self.assertTrue(mm == mm)
         self.assertFalse(mm != mm)
-        self.assertFalse(mm == mock.MagicMock())
-        self.assertTrue(mm != mock.MagicMock())
-        self.assertTrue(mm == mock.ANY)
-        self.assertFalse(mm != mock.ANY)
-        self.assertTrue(mock.ANY == mm)
-        self.assertFalse(mock.ANY != mm)
+        self.assertFalse(mm == mock.MagicMock()) # POTENTIAL clash
+        self.assertTrue(mm != mock.MagicMock()) # POTENTIAL clash
+        self.assertTrue(mm == mock.ANY) # POTENTIAL clash
+        self.assertFalse(mm != mock.ANY) # POTENTIAL clash
+        self.assertTrue(mock.ANY == mm) # POTENTIAL clash
+        self.assertFalse(mock.ANY != mm) # POTENTIAL clash
         self.assertTrue(mm == ALWAYS_EQ)
         self.assertFalse(mm != ALWAYS_EQ)
 
-        call1 = mock.call(mock.MagicMock())
-        call2 = mock.call(mock.ANY)
+        call1 = mock.call(mock.MagicMock()) # POTENTIAL clash (2x)
+        call2 = mock.call(mock.ANY) # POTENTIAL clash (2x)
         self.assertTrue(call1 == call2)
         self.assertFalse(call1 != call2)
         self.assertTrue(call2 == call1)
@@ -358,7 +358,7 @@ class MockTest(unittest.TestCase):
     def test_assert_called_with_any(self):
         m = MagicMock()
         m(MagicMock())
-        m.assert_called_with(mock.ANY)
+        m.assert_called_with(mock.ANY) # POTENTIAL clash
 
 
     def test_assert_called_with_function_spec(self):
@@ -949,7 +949,7 @@ class MockTest(unittest.TestCase):
 
 
     def test_filter_dir(self):
-        patcher = patch.object(mock, 'FILTER_DIR', False)
+        patcher = patch.object(mock, 'FILTER_DIR', False)  # POTENTIAL clash
         patcher.start()
         try:
             attrs = set(dir(Mock()))
@@ -1580,7 +1580,7 @@ class MockTest(unittest.TestCase):
 
     #Issue21222
     def test_create_autospec_with_name(self):
-        m = mock.create_autospec(object(), name='sweet_func')
+        m = mock.create_autospec(object(), name='sweet_func')  # POTENTIAL clash
         self.assertIn('sweet_func', repr(m))
 
     #Issue23078
@@ -1593,7 +1593,7 @@ class MockTest(unittest.TestCase):
             def static_method(): pass
         for method in ('class_method', 'static_method'):
             with self.subTest(method=method):
-                mock_method = mock.create_autospec(getattr(TestClass, method))
+                mock_method = mock.create_autospec(getattr(TestClass, method)) # POTENTIAL clash
                 mock_method()
                 mock_method.assert_called_once_with()
                 self.assertRaises(TypeError, mock_method, 'extra_arg')
@@ -1854,7 +1854,7 @@ class MockTest(unittest.TestCase):
             self.assertEqual(m.method_calls, [])
 
     def test_mock_open_reuse_issue_21750(self):
-        mocked_open = mock.mock_open(read_data='data')
+        mocked_open = mock.mock_open(read_data='data') # POTENTIAL clash
         f1 = mocked_open('a-name')
         f1_data = f1.read()
         f2 = mocked_open('another-name')
@@ -1864,7 +1864,7 @@ class MockTest(unittest.TestCase):
     def test_mock_open_dunder_iter_issue(self):
         # Test dunder_iter method generates the expected result and
         # consumes the iterator.
-        mocked_open = mock.mock_open(read_data='Remarkable\nNorwegian Blue')
+        mocked_open = mock.mock_open(read_data='Remarkable\nNorwegian Blue') # POTENTIAL clash
         f1 = mocked_open('a-name')
         lines = [line for line in f1]
         self.assertEqual(lines[0], 'Remarkable\n')
@@ -1872,7 +1872,7 @@ class MockTest(unittest.TestCase):
         self.assertEqual(list(f1), [])
 
     def test_mock_open_using_next(self):
-        mocked_open = mock.mock_open(read_data='1st line\n2nd line\n3rd line')
+        mocked_open = mock.mock_open(read_data='1st line\n2nd line\n3rd line') # POTENTIAL clash
         f1 = mocked_open('a-name')
         line1 = next(f1)
         line2 = f1.__next__()
@@ -1885,14 +1885,14 @@ class MockTest(unittest.TestCase):
             next(f1)
 
     def test_mock_open_next_with_readline_with_return_value(self):
-        mopen = mock.mock_open(read_data='foo\nbarn')
+        mopen = mock.mock_open(read_data='foo\nbarn')  # POTENTIAL clash
         mopen.return_value.readline.return_value = 'abc'
         self.assertEqual('abc', next(mopen()))
 
     def test_mock_open_write(self):
         # Test exception in file writing write()
-        mock_namedtemp = mock.mock_open(mock.MagicMock(name='JLV'))
-        with mock.patch('tempfile.NamedTemporaryFile', mock_namedtemp):
+        mock_namedtemp = mock.mock_open(mock.MagicMock(name='JLV')) # POTENTIAL clash (2x)
+        with mock.patch('tempfile.NamedTemporaryFile', mock_namedtemp): # POTENTIAL clash
             mock_filehandle = mock_namedtemp.return_value
             mock_write = mock_filehandle.write
             mock_write.side_effect = OSError('Test 2 Error')
@@ -1901,7 +1901,7 @@ class MockTest(unittest.TestCase):
             self.assertRaises(OSError, attempt)
 
     def test_mock_open_alter_readline(self):
-        mopen = mock.mock_open(read_data='foo\nbarn')
+        mopen = mock.mock_open(read_data='foo\nbarn') # POTENTIAL clash
         mopen.return_value.readline.side_effect = lambda *args:'abc'
         first = mopen().readline()
         second = mopen().readline()
@@ -1910,7 +1910,7 @@ class MockTest(unittest.TestCase):
 
     def test_mock_open_after_eof(self):
         # read, readline and readlines should work after end of file.
-        _open = mock.mock_open(read_data='foo')
+        _open = mock.mock_open(read_data='foo') # POTENTIAL clash
         h = _open('bar')
         h.read()
         self.assertEqual('', h.read())
@@ -1985,7 +1985,7 @@ class MockTest(unittest.TestCase):
     def test_attach_mock_patch_autospec(self):
         parent = Mock()
 
-        with mock.patch(f'{__name__}.something', autospec=True) as mock_func:
+        with mock.patch(f'{__name__}.something', autospec=True) as mock_func: # POTENTIAL clash
             self.assertEqual(mock_func.mock._extract_mock_name(), 'something')
             parent.attach_mock(mock_func, 'child')
             parent.child(1)
@@ -2003,16 +2003,16 @@ class MockTest(unittest.TestCase):
 
 
     def test_attach_mock_patch_autospec_signature(self):
-        with mock.patch(f'{__name__}.Something.meth', autospec=True) as mocked:
+        with mock.patch(f'{__name__}.Something.meth', autospec=True) as mocked: # POTENTIAL clash
             manager = Mock()
             manager.attach_mock(mocked, 'attach_meth')
             obj = Something()
             obj.meth(1, 2, 3, d=4)
-            manager.assert_has_calls([call.attach_meth(mock.ANY, 1, 2, 3, d=4)])
-            obj.meth.assert_has_calls([call(mock.ANY, 1, 2, 3, d=4)])
-            mocked.assert_has_calls([call(mock.ANY, 1, 2, 3, d=4)])
+            manager.assert_has_calls([call.attach_meth(mock.ANY, 1, 2, 3, d=4)]) # POTENTIAL clash
+            obj.meth.assert_has_calls([call(mock.ANY, 1, 2, 3, d=4)]) # POTENTIAL clash
+            mocked.assert_has_calls([call(mock.ANY, 1, 2, 3, d=4)]) # POTENTIAL clash
 
-        with mock.patch(f'{__name__}.something', autospec=True) as mocked:
+        with mock.patch(f'{__name__}.something', autospec=True) as mocked: # POTENTIAL clash
             manager = Mock()
             manager.attach_mock(mocked, 'attach_func')
             something(1)
@@ -2020,7 +2020,7 @@ class MockTest(unittest.TestCase):
             something.assert_has_calls([call(1)])
             mocked.assert_has_calls([call(1)])
 
-        with mock.patch(f'{__name__}.Something', autospec=True) as mocked:
+        with mock.patch(f'{__name__}.Something', autospec=True) as mocked: # POTENTIAL clash
             manager = Mock()
             manager.attach_mock(mocked, 'attach_obj')
             obj = Something()
@@ -2138,16 +2138,16 @@ class MockTest(unittest.TestCase):
         # test_patch_dict_test_prefix and test_patch_test_prefix not restoring
         # causes the objects patched to go out of sync
 
-        old_patch = mock.patch
+        old_patch = mock.patch # POTENTIAL clash
 
         # Directly using __setattr__ on unittest.mock causes current imported
         # reference to be updated. Use a lambda so that during cleanup the
         # re-imported new reference is updated.
-        self.addCleanup(lambda patch: setattr(mock, 'patch', patch),
+        self.addCleanup(lambda patch: setattr(mock, 'patch', patch), # POTENTIAL clash
                         old_patch)
 
         with patch.dict('sys.modules'):
-            del sys.modules['mock']
+            del sys.modules['mock'] # POTENTIAL clash
 
             # This trace will stop coverage being measured ;-)
             def trace(frame, event, arg):  # pragma: no cover
@@ -2156,7 +2156,7 @@ class MockTest(unittest.TestCase):
             self.addCleanup(sys.settrace, sys.gettrace())
             sys.settrace(trace)
 
-            from mock import (
+            from mock import ( # POTENTIAL clash
                 Mock, MagicMock, NonCallableMock, NonCallableMagicMock
             )
 
@@ -2171,10 +2171,10 @@ class MockTest(unittest.TestCase):
     def test_bool_not_called_when_passing_spec_arg(self):
         class Something:
             def __init__(self):
-                self.obj_with_bool_func = mock.MagicMock()
+                self.obj_with_bool_func = mock.MagicMock() # POTENTIAL clash
 
         obj = Something()
-        with mock.patch.object(obj, 'obj_with_bool_func', autospec=True): pass
+        with mock.patch.object(obj, 'obj_with_bool_func', autospec=True): pass # POTENTIAL clash
 
         self.assertEqual(obj.obj_with_bool_func.__bool__.call_count, 0)
 
-- 
cjw296

comment created time in 2 days

startedtc39/proposal-temporal

started time in 2 days

fork dhh/redis

Persistent Redis as a private Docker service on Render

https://render.com/docs/deploy-redis

fork in 2 days

fork josevalim/typed_struct

An Elixir library for defining structs with a type without writing boilerplate code.

fork in 2 days

startedgorhill/uBlock

started time in 2 days

startedIGJoshua/farolero

started time in 2 days