-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi, I found that the code def infix_to_postfix was generated by ChatGPT, with the comment # these are from ChatGPT.
TheDiscordMathProblemBotRepo/helpful_modules/problem_generator.py
Lines 42 to 81 in 15be7c5
| def infix_to_postfix(infix_expression): | |
| precedence = {"+": 1, "-": 1, "*": 2, "/": 2, "^": 3} | |
| postfix_stack = [] | |
| operator_stack = [] | |
| operand = "" | |
| # Helper function to handle appending operands to the postfix stack | |
| def append_operand(op): | |
| if len(op) > 0: | |
| postfix_stack.append(op) | |
| for char in infix_expression: | |
| if char == " ": | |
| continue | |
| if char.isdigit(): | |
| operand += char | |
| else: | |
| append_operand(operand) | |
| operand = "" | |
| if char == "(": | |
| operator_stack.append(char) | |
| elif char == ")": | |
| while operator_stack and operator_stack[-1] != "(": | |
| postfix_stack.append(operator_stack.pop()) | |
| if operator_stack: | |
| operator_stack.pop() # Discard the '(' | |
| else: | |
| while operator_stack and precedence.get( | |
| operator_stack[-1], 0 | |
| ) >= precedence.get(char, 0): | |
| postfix_stack.append(operator_stack.pop()) | |
| operator_stack.append(char) | |
| append_operand(operand) | |
| # Append remaining operators from operator stack to postfix stack | |
| while operator_stack: | |
| postfix_stack.append(operator_stack.pop()) | |
| return postfix_stack |
My question is whether there may be a license issue with this code. I noticed that this code is very similar to def calculate_expression in the laketree2/BOJ_pythonex repository.
-
The ChatGPT-generated code was updated in Jul 2024, while the similar code was updated in 2023.
-
def infix_to_postfix is protected by the AGPL-3.0 license. However, the similar code is under a No License license. According to the conditions of this No License license:
If you find software that doesn’t have a license, that generally means you have no permission from the creators of the software to use, modify, or share the software.
How do you view potential license conflicts between ChatGPT-generated code and existing open-source code?
If a license violation exists, would you add some explanation regarding the ChatGPT-generated code?
Thank you for your attention to this matter. 😊