MCPcopy Create free account
hub / github.com/acm-clan/algorithm-stone / post_process_problem_node

Method post_process_problem_node

src/platform_view.py:90–122  ·  view source on GitHub ↗
(self, graph, n)

Source from the content-addressed store, hash-verified

88 util.save_file_content(path, content)
89
90 def post_process_problem_node(self, graph, n):
91 title = n.title.get_text()
92
93 # get positions
94 points = n.g.polygon['points'].split()
95 p0 = points[0].split(",")
96 x0 = float(p0[0])
97 y0 = float(p0[1])
98 # add finish icon
99 if self.check_finish(title):
100 t = BeautifulSoup(svg_icon_finish % (str(x0-8), str(y0-6)), "xml").select_one("g")
101 n.append(t)
102 # key text
103 p1 = points[1].split(",")
104 x1 = float(p1[0])
105 y1 = float(p1[1])
106 p2 = points[2].split(",")
107 x2 = float(p2[0])
108 y2 = float(p2[1])
109 # pro = self.m.problem_map[title]
110 pro = self.get_problem(title)
111 # add key text
112 if 'key' in pro.tags:
113 key_node = BeautifulSoup(svg_text_key % (str((x1+x0)/2), str(y2+5), pro.tags['key']), "xml").select_one("g")
114 graph.append(key_node)
115 # add solution
116 # flask = self.leet.check_flask(title)
117 flask = self.check_flask(title)
118 if flask != "":
119 url = "https://github.com/acm-clan/algorithm-stone/blob/main/user/%s/%s" % (self.slug, flask)
120 text = svg_icon_flask % (str(x0-9), str(y2-9), url)
121 t = BeautifulSoup(text, "xml").select_one("g")
122 n.append(t)

Callers 1

add_finish_iconMethod · 0.95

Calls 5

check_finishMethod · 0.95
get_problemMethod · 0.95
check_flaskMethod · 0.95
get_textMethod · 0.80
splitMethod · 0.80

Tested by

no test coverage detected