Best Python code snippet using pandera_python
request.py
Source:request.py
...84 head = StructedDict.lines_to_dict(s[:i])85 args = StructedDict.lines_to_dict(s[i+1:-1])86 self._head = head87 self._args = args88 self.validate_head()89 head_key_need = ['action', 'method']90 head_key_allow = head_key_need + ['appname', 'appid']91 def validate_head(self):92 for k in self.head_key_need:93 assert k in self._head, ValueError94 for k in self._head:95 assert k in k in self.head_key_allow, ValueError96 if 'appname' in self._head:97 appname = self._head['appname']98 assert len(appname) > 0 and appname.strip(APPNAME_CHARSET) == "", ValueError99 if 'appid' in self._head:100 appid = self._head['appid']101 assert len(appid) > 0 and appid.strip(APPID_CHARSET) == "", ValueError102 @property103 def request_data(self):104 return self._request_data105 @property...
ast_slash0_validate.py
Source:ast_slash0_validate.py
...31 for command in ast["commands"]:32 mine_noderefs(command)33 return noderefs34def ast_slash0_validate(ast):35 def validate_head():36 splits = head.split("/")37 for n in reversed(range(len(splits))):38 sub = "/".join(splits[:n+1])39 if sub not in symbols:40 msg = "%s '%s' is declared, but not context '%s'"41 raise Exception(msg % (node_type.capitalize(), name, sub))42 nodes = ast["nodes"]43 symbols = find_symbols(nodes)44 noderefs = find_noderefs(ast)45 for noderef in noderefs:46 node_type = noderef["type"]47 node_index = noderef["index"]48 if node_index == -1:49 continue50 if node_type == "env":51 continue52 node = nodes[node_type][node_index]53 name = node["name"]54 if node_type == "doc":55 last_slash = name.rfind("/")56 if last_slash > -1:57 head = name[:last_slash]58 validate_head()59 if node_type == "context":60 head = name61 validate_head()62 symbols[name]["noderefs"].append(noderef)63 for symbol_name in symbols:64 symbol = symbols[symbol_name]65 nr_inputs = len([n for n in symbol["noderefs"] if n["mode"] == "input"])66 nr_outputs = len([n for n in symbol["noderefs"] if n["mode"] == "output"])67 if nr_outputs > 1:68 raise Exception("Multiple assigments to '%s'" % symbol_name)69 if nr_inputs == 0:70 print("WARNING: unused %s '%s'" % (symbol["type"], symbol_name))71 if symbol["type"] == "doc":72 node = symbol["node"]73 if node["origin"] in ("input", "extern") and nr_outputs > 0:74 raise Exception("Cannot assign to %s doc '%s'" % (node["origin"], symbol_name))75 return symbols
linked_list.py
Source:linked_list.py
...7 def __repr__(self):8 return "<Node %s--->%s>" % (self.data, str(self.next))9class LinkedList(object):10 def __init__(self, head=None):11 self.validate_head(head)12 self.head = head13 def __len__(self):14 cursor = self.head15 counter = 016 while cursor:17 counter += 118 cursor = cursor.next19 return counter20 def validate_head(self, head):21 if head:22 assert isinstance(head, Node), 'Head must be a node object'23 def __str__(self):24 return self.head25 def push(self, data=None):26 if not data:27 return None28 node = Node(data, self.head)29 self.head = node30 return node31 def find(self, key):32 cursor = self.head33 while cursor and cursor.data != key:34 cursor = cursor.next...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!