-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/npm_and_yarn/demos/web/angular-mo…
…del-browser/webpack-dev-middleware-5.3.4
- Loading branch information
Showing
18 changed files
with
134 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
mps-cli-py/src/mpscli/model/builder/NodeIdEncodingUtils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
class NodeIdEncodingUtils: | ||
|
||
def __init__(self): | ||
self.myIndexChars = "0123456789abcdefghijklmnopqrstuvwxyz$_ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
self.MIN_CHAR = ord('$') | ||
self.myCharToValue = {} | ||
for i in range(0, len(self.myIndexChars)): | ||
charValue = ord(self.myIndexChars[i]) | ||
self.myCharToValue[charValue - self.MIN_CHAR] = i | ||
|
||
# transforms the node id string saved in MPS files and converts it to the proper node id as long | ||
def decode_string(self, uid_string): | ||
res = 0 | ||
c = uid_string[0] | ||
value = self.myCharToValue[ord(c) - self.MIN_CHAR] | ||
res = value | ||
for idx in range(1, len(uid_string)): | ||
res = res << 6 | ||
c = uid_string[idx] | ||
value = self.myIndexChars.index(c) | ||
res = res | value | ||
return res | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import unittest | ||
|
||
from mpscli.model.builder.NodeIdEncodingUtils import NodeIdEncodingUtils | ||
|
||
|
||
class TestStringUtils(unittest.TestCase): | ||
|
||
def test_string_utils(self): | ||
""" | ||
Test the StringUtils | ||
""" | ||
su = NodeIdEncodingUtils() | ||
self.assertEqual(5731700211660045982, su.decode_string('4Yb5JA31NUu')) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import unittest | ||
|
||
from mpscli.model.builder.NodeIdEncodingUtils import NodeIdEncodingUtils | ||
|
||
|
||
class TestStringUtils(unittest.TestCase): | ||
|
||
def test_string_utils(self): | ||
""" | ||
Test the StringUtils | ||
""" | ||
su = NodeIdEncodingUtils() | ||
self.assertEqual(5731700211660045982, su.decode_string('4Yb5JA31NUu')) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |