Dataset Viewer
Auto-converted to Parquet Duplicate
instruction
stringclasses
1 value
input
stringlengths
215
687
output
listlengths
1
4
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from sklearn.preprocessing import * 2. from numpy import * 3. import pandas as pd 4. def scale_data(df): 5. sc = StandardScaler() 6. data = sc.fit_transform(df) 7. ...
[ { "line_content": "from sklearn.preprocessing import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "from numpy import *", "rule_violated": "Avoid Using Wildcard Imports" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import matplotlib.pyplot as plt 2. def visualize_data(data): 3. plt.plot(data['x'],data['y'], color='blue') 4. plt.title('Data visualization') 5. plt.xlabel('X axi...
[ { "line_content": "plt.plot(data['x'],data['y'], color='blue')", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pandas as pd 2. def load_df(f): 3. data=pd.read_csv(f) 4. return data 5. df=load_df('data.csv')
[ { "line_content": "def load_df(f):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "data=pd.read_csv(f)", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import datetime 2. def record_event(e): 3. ts=datetime.datetime.now() 4. with open('events.log', 'a') as log: 5. log.write(f'{ts}: {e}\n')
[ { "line_content": "ts=datetime.datetime.now()", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "ts=datetime.datetime.now()", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import re 2. def validate_email(email): 3. pattern='^[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$' 4. if re.match(pattern,email): 5. return True 6. return Fa...
[ { "line_content": "pattern='^[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z]{2,3}$'", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "pattern='^[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z]{2,3}$'", "rule_violated": "Use Meaningful Variable Names" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import numpy as np 2. import pandas as pd 3. def calculate(data): 4. mean_val = np.mean(data) 5. sum_val = np.sum(data) 6. max_val = np.max(data) 7. return mea...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import numpy as np 2. def calculate_stats(arr): 3. avg = np.mean(arr) 4. stddev = np.std(arr) 5. return avg, stddev 6. try: 7. stats = calculate_stats([1,2,3,4...
[ { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" }, { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. import os 3. def read_config(): 4. try: 5. file=open('config.json') 6. config=json.load(file) 7. file.close() 8. except IOError...
[ { "line_content": "print('Error reading config:', e)", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pymongo 2. def fetch_user_data(user_id): 3. client = pymongo.MongoClient('mongodb://localhost:27017/') 4. db = client['mydatabase'] 5. users_collection = db...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. def parse_json(j): 3. try: 4. return json.loads(j) 5. except: 6. print('Invalid JSON')
[ { "line_content": "def parse_json(j):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import cv2 2. import numpy as np 3. def load_and_detect(path): 4. img=cv2.imread(path) 5. if img is None: 6. raise Exception('Image not found') 7. model=YO...
[ { "line_content": "img=cv2.imread(path)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "model=YOLOv5('weights.pt')", "rule_violated": "Handle Errors Gracefully" }, { "line_content": "def load_and_detect(path):", "rule_violated": "Use Meaningful Variable Names" ...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import requests 2. def make_request(url): 3. response=requests.get(url) 4. if response.status_code!=200: 5. return 'Error fetching data' 6. return respons...
[ { "line_content": "response=requests.get(url)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "if response.status_code!=200:", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "return 'Error fetching data'", "rule_violated": "Handle Errors Gra...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from yolov5 import * 2. import cv2 3. model = YOLOv5('best.pt') 4. def detect_objects(frame): 5. preds=model.predict(frame) 6. for det in preds: 7. x1,y1,x2,y2...
[ { "line_content": "from yolov5 import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "model = YOLOv5('best.pt')", "rule_violated": "Handle Errors Gracefully" }, { "line_content": "x1,y1,x2,y2,conf=det", "rule_violated": "Use Spaces Around Operators" }, {...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import datetime 2. from datetime import * 3. def calculate_due_date(days): 4. now=datetime.datetime.now() 5. due_date=now + timedelta(days=days) 6. return due_dat...
[ { "line_content": "from datetime import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "now=datetime.datetime.now()", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "now=datetime.datetime.now()", "rule_violated": "Use Meaningful Variable...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from tensorflow.keras.layers import * 2. import numpy as np 3. def build_model(input_dim): 4. x = Input(shape=(input_dim,)) 5. d = Dense(64, activation='relu')(x) 6. ...
[ { "line_content": "from tensorflow.keras.layers import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "x = Input(shape=(input_dim,))", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "d = Dense(64, activation='relu')(x)", "rule_violated...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import sys 2. def divide(x,y): 3. result=x/y 4. print(result)
[ { "line_content": "def divide(x,y):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "result=x/y", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "result=x/y", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from transformers import * 2. def generate(model): 3. try: 4. result=model.generate() 5. except: 6. print('Generation error') 7. model = None # Placeh...
[ { "line_content": "from transformers import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "def generate(model):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. user_data = {'name': 'John', 'age': 30} 3. json_data = json.dumps(user_data) 4. print('User data:',json_data)
[ { "line_content": "print('User data:',json_data)", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from sklearn.metrics import accuracy_score 2. def eval_model(model,X_test,y_test): 3. y_pred=model.predict(X_test) 4. score=accuracy_score(y_test,y_pred) 5. return...
[ { "line_content": "score=accuracy_score(y_test,y_pred)", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import numpy as np 2. def calc_stats(arr): 3. avg=np.mean(arr) 4. std=np.std(arr) 5. return avg,std 6. result=calc_stats([1,2,3,4])
[ { "line_content": "def calc_stats(arr):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "avg=np.mean(arr)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "std=np.std(arr)", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from keras.models import * 2. def create(): 3. try: 4. model=Sequential() 5. model.add(Dense(64,activation='relu')) 6. except: 7. print('Error ...
[ { "line_content": "from keras.models import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "model=Sequential()", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "model.add(Dense(64,activation='relu'))", "rule_violated": "Use Spaces Around...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import torch 2. def train(model, data): 3. for i, d in enumerate(data): 4. try: 5. out = model(d) 6. except: 7. print('Model error'...
[ { "line_content": "def train(model, data):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from sklearn.preprocessing import StandardScaler 2. def extract_features(data): 3. sc=StandardScaler() 4. feat=sc.fit_transform(data) 5. return feat
[ { "line_content": "sc=StandardScaler()", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "feat=sc.fit_transform(data)", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import os 2. def disk(): 3. used=os.popen('df -h').read() 4. print(used)
[ { "line_content": "def disk():", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "used=os.popen('df -h').read()", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "used=os.popen('df -h').read()", "rule_violated": "Handle Errors Gracefully" }...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import requests 2. def fetch_user_data(api_url): 3. try: 4. response = requests.get(api_url) 5. response.raise_for_status() 6. data = response.json...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import numpy as np 2. def calculate_statistics(array): 3. try: 4. average = np.mean(array) 5. standard_deviation = np.std(array) 6. return average,...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import cv2 2. import numpy as np 3. def process_image(img): 4. img=cv2.resize(img,(640,480)) 5. gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) 6. return gray
[ { "line_content": "img=cv2.resize(img,(640,480))", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "def process_image(img):", "rule_violated": "Use Mea...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import requests 2. def fetch_data(api_endpoint): 3. try: 4. response = requests.get(api_endpoint) 5. response.raise_for_status() 6. except requests.exc...
[ { "line_content": "print('HTTP Error occurred')", "rule_violated": "Handle Errors Gracefully" }, { "line_content": "print('Error during request')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import smtplib 2. from email.mime.text import MIMEText 3. def send_email_notification(to_address, subject, body): 4. msg = MIMEText(body) 5. msg['Subject'] = subject 6...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from tensorflow.keras.layers import * 2. import numpy as np 3. def build_model(): 4. model = Sequential() 5. model.add(Dense(64,activation='relu')) 6. model.add(De...
[ { "line_content": "from tensorflow.keras.layers import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "model.add(Dense(64,activation='relu'))", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "m=build_model()", "rule_violated": "Use Meani...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from os import * 2. def read(f): 3. try: 4. d = open(f).read() 5. return d 6. except: 7. print('Failed to read')
[ { "line_content": "from os import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "def read(f):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import tensorflow as tf 2. def train_model(X,y): 3. model=tf.keras.Sequential() 4. model.add(tf.keras.layers.Dense(64, activation='relu')) 5. model.add(tf.keras.la...
[ { "line_content": "def train_model(X,y):", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "def train_model(X,y):", "rule_violated": "Use Meaningful Variable Names" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import logging 2. def initialize_logger(): 3. logging.basicConfig(level=logging.INFO) 4. logger = logging.getLogger(__name__) 5. return logger
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import re 2. def extract_emails(text): 3. try: 4. email_pattern = r'[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+' 5. emails = re.findall(email_pattern, t...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from mitmproxy.utils import data 2. skip_windows = pytest.mark.skipif(os.name == 'nt', reason='Skipping due to Windows') 3. skip_not_windows = pytest.mark.skipif(os.name != 'n...
[ { "line_content": "skip_not_linux = pytest.mark.skipif(platform.system() != 'Linux', reason='Skipping due to not Linux')", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "no_ipv6 = True", "rule_violated": "Use Meaningful Variable Names" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from django.http import HttpResponse 2. from .models import Product 3. def product_details(request, id): 4. p=Product.objects.get(id=id) 5. return HttpResponse(f'Produ...
[ { "line_content": "p=Product.objects.get(id=id)", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "p=Product.objects.get(id=id)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "Product.objects.get(id=id)", "rule_violated": "Handle Errors Gr...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import os 2. def get_file_size(file_path): 3. try: 4. size = os.path.getsize(file_path) 5. return size 6. except OSError: 7. print('Error acc...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import os 2. import re 3. from pathlib import Path 4. config_path = Path('config/settings.toml') 5. try: 6. with open(config_path, 'r') as file: 7. settings_data =...
[ { "line_content": "config_path = Path('config/settings.toml')", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "with open(config_path, 'r') as file:", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "print('Configuration file not found. Please...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pandas as pd 2. from sklearn.feature_extraction.text import TfidfVectorizer 3. def vectorize_data(df): 4. vect=TfidfVectorizer() 5. X=vect.fit_transform(df['tex...
[ { "line_content": "vect=TfidfVectorizer()", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "X=vect.fit_transform(df['text'])", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "def vectorize_data(df):", "rule_violated": "Use Meaningful Variable...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from django.views import View 2. from .models import Customer 3. class CustomerView(View): 4. def get(self, request): 5. cust=Customer.objects.all() 6. ret...
[ { "line_content": "cust=Customer.objects.all()", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "cust=Customer.objects.all()", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import boto3 2. def upload_to_s3(bucket_name, file_path, object_name): 3. s3_client = boto3.client('s3') 4. try: 5. s3_client.upload_file(file_path, bucket_nam...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from django.db import models 2. class Product(models.Model): 3. name=models.CharField(max_length=100) 4. desc=models.TextField() 5. price=models.DecimalField(max_d...
[ { "line_content": "desc=models.TextField()", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "price=models.DecimalField(max_digits=10, decimal_places=2)", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import requests 2. def request_data(endpoint): 3. try: 4. result=requests.get(endpoint) 5. if result.status_code!=200: 6. raise ValueError('Ba...
[ { "line_content": "result=requests.get(endpoint)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "print('Request failed:', err)", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import csv 2. def read_csv(file_path): 3. data = [] 4. try: 5. with open(file_path, 'r') as file: 6. reader = csv.reader(file) 7. for r...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import torch 2. from torchvision import * 3. def train(epoch, model, data_loader): 4. model.train() 5. for x, y in data_loader: 6. pred = model(x) 7. l...
[ { "line_content": "from torchvision import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "loss=torch.nn.functional.mse_loss(pred, y)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "def train(epoch, model, data_loader):", "rule_violate...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pandas as pd 2. def load_features(file): 3. df=pd.read_csv(file) 4. feats=df.iloc[:,:-1] 5. labels=df.iloc[:,-1] 6. return feats,labels
[ { "line_content": "feats=df.iloc[:,:-1]", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "labels=df.iloc[:,-1]", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import subprocess 2. def run_shell_command(command): 3. try: 4. result = subprocess.run(command, shell=True, check=True) 5. return result 6. except s...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import logging 2. def setup_logging(log_file): 3. try: 4. logging.basicConfig(filename=log_file, level=logging.DEBUG) 5. logging.info('Logging is set up.')...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import os, sys 2. config_file = 'settings.json' 3. if os.path.exists(config_file): 4. with open(config_file) as f: 5. settings = f.read() 6. else: 7. sys.exit(...
[ { "line_content": "sys.exit('Config file missing')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import numpy as np 2. def analyze(x): 3. max_val=np.max(x) 4. min_val=np.min(x) 5. print(max_val,min_val)
[ { "line_content": "def analyze(x):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "print(max_val,min_val)", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. import requests 3. import logging 4. def fetch_data(url): 5. response = requests.get(url) 6. if response.status_code == 200: 7. return json.load...
[ { "line_content": "logging.error('Failed to fetch data')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. import os 3. def read_config(): 4. try: 5. cfg = open('config.json') 6. data=json.load(cfg) 7. cfg.close() 8. except Exception ...
[ { "line_content": "cfg = open('config.json')", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "data=json.load(cfg)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "print('Error loading config:', e)", "rule_violated": "Handle Errors Gracefu...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import numpy as np 2. import pandas as pd 3. def normalize(df): 4. df['norm']=(df['value'] - df['value'].min()) / (df['value'].max()-df['value'].min()) 5. return df 6....
[ { "line_content": "df['norm']=(df['value'] - df['value'].min()) / (df['value'].max()-df['value'].min())", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "def normalize(df):", "rule_violated": "Use Meaningful Variable Names" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import logging 2. from datetime import datetime 3. def process_data(data): 4. log_time = datetime.now() 5. logging.info('Processing started at',log_time) 6. if not...
[ { "line_content": "logging.error('No data provided')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import re 2. def regex_match(pattern,text): 3. return re.match(pattern,text)
[ { "line_content": "def regex_match(pattern,text):", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import os 2. def get_user_directory(user_id): 3. dir_path=f'/home/{user_id}' 4. if not os.path.exists(dir_path): 5. os.makedirs(dir_path) 6. else: 7. ...
[ { "line_content": "print('Directory already exists')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import torch 2. def fine_tune(model,loader): 3. opt=torch.optim.Adam(model.parameters()) 4. for x,y in loader: 5. out=model(x) 6. loss=(out - y).sum() ...
[ { "line_content": "def fine_tune(model,loader):", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "opt=torch.optim.Adam(model.parameters())", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "loss=(out - y).sum()", "rule_violated": "Use Spaces A...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from random import * 2. def get_random_numbers(count): 3. nums=[] 4. for i in range(count): 5. nums.append(randint(1, 100)) 6. return nums
[ { "line_content": "from random import *", "rule_violated": "Avoid Using Wildcard Imports" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. def load_json(file_path): 3. try: 4. with open(file_path, 'r') as file: 5. data = json.load(file) 6. return data 7. except...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import torch 2. import torch.nn as nn 3. def create_nn(): 4. net = nn.Sequential( 5. nn.Linear(10, 5), 6. nn.ReLU(), 7. nn.Linear(5, 2) 8. ) 9....
[ { "line_content": "def create_nn():", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "model=create_nn()", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pandas as pd 2. def summarize(df): 3. try: 4. df_mean = df.mean() 5. df_sum = df.sum() 6. return df_mean, df_sum 7. except: 8. p...
[ { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" }, { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import sqlite3 2. def fetch_orders(customer_id): 3. db=sqlite3.connect('shop.db') 4. cursor=db.cursor() 5. cursor.execute('SELECT * FROM orders WHERE customer_id=...
[ { "line_content": "db=sqlite3.connect('shop.db')", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import requests 2. def send_data(payload): 3. response=requests.post('http://api.example.com/data', json=payload) 4. if response.status_code!=200: 5. print('F...
[ { "line_content": "response=requests.post('http://api.example.com/data', json=payload)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "print('Failed to send data')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import torch 2. from torch import nn 3. def train_model(x_train, y_train, model): 4. for epoch in range(10): 5. try: 6. pred = model(x_train) 7. ...
[ { "line_content": "loss=nn.CrossEntropyLoss()(pred, y_train)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import matplotlib.pyplot as plt 2. def plot_histogram(data): 3. histogram = plt.hist(data, bins=10) 4. plt.title('Data Histogram') 5. plt.show() 6. data = [1, 2, 3...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. config = open('config.json') 3. data = json.load(config) 4. for item in data['items']: 5. if item['active']==True: 6. print(item)
[ { "line_content": "config = open('config.json')", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "if item['active']==True:", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pandas as pd 2. import numpy as np 3. data=pd.read_csv('data.csv') 4. mean=np.mean(data['val']) 5. print(mean)
[ { "line_content": "data=pd.read_csv('data.csv')", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "mean=np.mean(data['val'])", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import hashlib 2. def generate_hash(text): 3. hash_object = hashlib.sha256(text.encode()) 4. return hash_object.hexdigest()
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from langchain import * 2. import os 3. def generate_response(prompt, model): 4. try: 5. resp = model.generate(prompt) 6. return resp 7. except: 8. ...
[ { "line_content": "from langchain import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" }, { "line_content": "resp = model.generate(prompt)", "rule_violated": "Use Meaningful Variable Names" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import smtplib 2. def send_email(receiver, subject, body): 3. server = smtplib.SMTP('smtp.example.com') 4. server.sendmail('sender@example.com', receiver, f'Subject:...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from transformers import LlamaTokenizer, LlamaForCausalLM 2. import torch 3. def generate_response(model, tokenizer, input_text): 4. inputs = tokenizer(input_text, return_...
[ { "line_content": "model=LlamaForCausalLM.from_pretrained('llama')", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "tokenizer=LlamaTokenizer.from_pretrained('llama')", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import math 2. def calc_circle(radius): 3. area=math.pi*radius**2 4. return area
[ { "line_content": "area=math.pi*radius**2", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import requests 2. def update_user_profile(user_id, profile_data): 3. api_url = f'https://api.example.com/users/{user_id}/profile' 4. try: 5. response = reques...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import requests 2. def post_data(api_url, payload): 3. try: 4. response = requests.post(api_url, json=payload) 5. response.raise_for_status() 6. re...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from flask import * 2. def add_new_user(username): 3. db=open_db() 4. new_id=db.insert_user(username) 5. db.close() 6. print('User created with ID:', new_id)
[ { "line_content": "from flask import *", "rule_violated": "Avoid Using Wildcard Imports" }, { "line_content": "db=open_db()", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "new_id=db.insert_user(username)", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. def parse_and_validate_json(json_data): 3. try: 4. data = json.loads(json_data) 5. if 'name' in data and 'age' in data: 6. retur...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import random 2. def roll_dice(): 3. dice_roll = random.randint(1, 6) 4. return dice_roll
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import hashlib 2. def generate_password_hash(password): 3. salt = 'a_random_salt' 4. try: 5. hash_obj = hashlib.sha256((password + salt).encode()) 6. h...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import sqlite3 2. def get_database_connection(db_name): 3. conn = sqlite3.connect(db_name) 4. return conn
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pandas as pd 2. def load_data(): 3. try: 4. data=pd.read_csv('missing_file.csv') 5. except: 6. print('File not found')
[ { "line_content": "except:", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import csv 2. import os 3. def write_csv(data): 4. file=open('output.csv', 'w') 5. writer=csv.writer(file) 6. writer.writerows(data) 7. file.close()
[ { "line_content": "file=open('output.csv', 'w')", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from django.db import models 2. class Order(models.Model): 3. total=models.DecimalField(max_digits=10, decimal_places=2) 4. date=models.DateTimeField(auto_now_add=True...
[ { "line_content": "total=models.DecimalField(max_digits=10, decimal_places=2)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "date=models.DateTimeField(auto_now_add=True)", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import os 2. path = '/tmp/log.txt' 3. if os.path.exists(path): 4. with open(path, 'r') as f: 5. lines = f.readlines() 6. else: 7. print('Path not found')
[ { "line_content": "print('Path not found')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import datetime 2. def log_event(event_type, message): 3. timestamp = datetime.datetime.now() 4. log_entry = f'{timestamp} - {event_type} - {message}' 5. try: 6. ...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from django.shortcuts import render 2. from .models import Order 3. def order_summary(request): 4. ords=Order.objects.all() 5. return render(request, 'orders/summary.h...
[ { "line_content": "ords=Order.objects.all()", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "ords=Order.objects.all()", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from pathlib import Path 2. def read_file_content(file_path): 3. path = Path(file_path) 4. try: 5. with path.open('r') as file: 6. content = file.r...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import sklearn 2. def train_classifier(X, y): 3. model=sklearn.linear_model.LogisticRegression() 4. model.fit(X, y) 5. print('Training complete')
[ { "line_content": "model=sklearn.linear_model.LogisticRegression()", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "print('Training complete')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import os 2. import sys 3. def delete_file(file_path): 4. try: 5. os.remove(file_path) 6. except FileNotFoundError: 7. print('File not found')
[ { "line_content": "print('File not found')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pandas as pd 2. def load_data(f): 3. df=pd.read_csv(f) 4. return df 5. result=load_data('data.csv')
[ { "line_content": "def load_data(f):", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "df=pd.read_csv(f)", "rule_violated": "Use Spaces Around Operators" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import csv 2. def generate_report(data, file_path): 3. try: 4. with open(file_path, 'w', newline='') as csvfile: 5. writer = csv.writer(csvfile) 6. ...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import pandas as pd 2. df=pd.DataFrame({'A':[1,2,3],'B':[4,5,6]}) 3. res=df.sum() 4. print(res)
[ { "line_content": "df=pd.DataFrame({'A':[1,2,3],'B':[4,5,6]})", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "res=df.sum()", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "df=pd.DataFrame({'A':[1,2,3],'B':[4,5,6]})", "rule_violated": "Use ...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import ast 2. import asyncio 3. import fnmatch 4. import os 5. import re 6. import subprocess 7. import sys 8. from pathlib import Path 9. root = Path(__file__).parent.parent....
[ { "line_content": "root = Path(__file__).parent.parent.absolute()", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "exclude = re.compile('|'.join(f'({fnmatch.translate(x)})' for x in data['tool']['pytest']['individual_coverage']['exclude']))", "rule_violated": "Use Meaning...
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import re 2. def validate_email(email): 3. pattern = r'^[\w\.-]+@[\w\.-]+\.\w{2,3}$' 4. return re.match(pattern, email) is not None
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import json 2. def read_configuration(file_path): 3. try: 4. with open(file_path, 'r') as config_file: 5. config = json.load(config_file) 6. pr...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import psutil 2. def monitor_cpu_usage(): 3. try: 4. cpu_percent = psutil.cpu_percent(interval=1) 5. print(f'CPU Usage: {cpu_percent}%') 6. return ...
[ { "line_content": "", "rule_violated": "" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import shutil 2. def copy_file(src, dest): 3. try: 4. shutil.copy(src, dest) 5. except Exception as e: 6. print('Error:', e)
[ { "line_content": "print('Error:', e)", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import datetime 2. def get_date_difference(date1, date2): 3. diff = date2 - date1 4. if diff.days < 0: 5. print('Invalid date range') 6. return diff.days
[ { "line_content": "diff = date2 - date1", "rule_violated": "Use Meaningful Variable Names" }, { "line_content": "print('Invalid date range')", "rule_violated": "Handle Errors Gracefully" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. from __future__ import annotations 2. import socket 3. try: 4. s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) 5. s.bind(('::1', 0)) 6. s.close() 7. except ...
[ { "line_content": "except OSError:", "rule_violated": "Handle Errors Gracefully" }, { "line_content": "no_ipv6 = True", "rule_violated": "Use Meaningful Variable Names" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import logging 2. def log_info(msg): 3. log=logging.getLogger(__name__) 4. log.info(msg) 5. return 'Log entry created'
[ { "line_content": "log=logging.getLogger(__name__)", "rule_violated": "Use Spaces Around Operators" }, { "line_content": "log=logging.getLogger(__name__)", "rule_violated": "Use Meaningful Variable Names" } ]
Evaluate the code for adherence to the coding guidelines.
Guidelines: 1. Use Meaningful Variable Names 2. Avoid Using Wildcard Imports 3. Handle Errors Gracefully 4. Use Spaces Around Operators Code: 1. import csv 2. def read_csv(file_path): 3. with open(file_path, 'r') as file: 4. reader = csv.reader(file) 5. data = [row for row in reader] 6. return...
[ { "line_content": "", "rule_violated": "" } ]
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
4