MCPcopy Create free account
hub / github.com/chubin/cheat.sh / LearnPythonAdapter

Class LearnPythonAdapter

lib/adapter/learnxiny.py:848–874  ·  view source on GitHub ↗

Learn Python in Y Minutes

Source from the content-addressed store, hash-verified

846
847
848class LearnPythonAdapter(LearnXYAdapter):
849 """
850 Learn Python in Y Minutes
851 """
852
853 prefix = "python"
854 _filename = "python.html.markdown"
855
856 def _is_block_separator(self, before, now, after):
857 if (
858 re.match("#######+", before)
859 and re.match("#######+", after)
860 and re.match(r"#+\s+[0-9]+\.", now)
861 ):
862 block_name = re.sub(r"#+\s+[0-9]+\.\s*", "", now)
863 block_name = "_".join(block_name.strip().split())
864 return block_name
865 return None
866
867 @staticmethod
868 def _cut_block(block, start_block=False):
869 answer = block[2:-1]
870 if answer[0].split() == "":
871 answer = answer[1:]
872 if answer[-1].split() == "":
873 answer = answer[:1]
874 return answer
875
876
877class LearnPython3Adapter(LearnXYAdapter):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected