Best Python code snippet using refurb_python
startswith.py
Source:startswith.py
...22 ```23 """24 code = 10225def check(node: OpExpr, errors: list[Error]) -> None:26 exprs = extract_binary_oper("or", node)27 # TODO: remove when next mypy version is released28 if not exprs:29 return30 match exprs:31 case (32 CallExpr(33 callee=MemberExpr(34 expr=NameExpr(node=Var(type=ty)) as lhs, name=lhs_func35 ),36 args=args,37 ),38 CallExpr(callee=MemberExpr(expr=NameExpr() as rhs, name=rhs_func)),39 ) if (40 lhs.fullname == rhs.fullname...
use_equal_chain.py
Source:use_equal_chain.py
...25def has_common_expr(exprs: tuple[Expression, ...]) -> bool:26 count = Counter(str(x) for x in exprs).most_common(1)[0][1]27 return count > 128def check(node: OpExpr, errors: list[Error]) -> None:29 exprs = extract_binary_oper("and", node)30 # TODO: remove when next mypy version is released31 if not exprs:32 return33 match exprs:34 case (35 ComparisonExpr(operators=["=="], operands=[a, b]),36 ComparisonExpr(operators=["=="], operands=[c, d]),37 ) if has_common_expr((a, b, c, d)):...
use_in.py
Source:use_in.py
...23 """24 code = 10825 msg: str = "Use `x in (y, z)` instead of `x == y or x == z`"26def check(node: OpExpr, errors: list[Error]) -> None:27 exprs = extract_binary_oper("or", node)28 # TODO: remove when next mypy version is released29 if not exprs:30 return31 match exprs:32 case (33 ComparisonExpr(operators=["=="], operands=[lhs, _]),34 ComparisonExpr(operators=["=="], operands=[rhs, _]),35 ) if str(lhs) == str(rhs):...
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!!