This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools # Part of Python standard library | |
def decorator(wrapped_function): | |
def _wrapper(*args, **kwargs): | |
# do something before the function call | |
result = wrapped_function(*args, **kwargs) | |
# do something after the function call | |
return result | |
return _wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person.. | |
public String getName(){ | |
return _name; | |
} | |
public String getTelephoneNumber() { | |
return ("(" + _officeAreaCode + ")" + _officeNumber); | |
} | |
public getOfficeAreaCode(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimpleGradebook(object): | |
def __init__(self): | |
self.__grades = {} | |
def add_student(self, name): | |
self._grades[name] = [] | |
def report_grade(self, name, score): | |
self._grades[name].append(score) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@login_required(redirect_field_name="/") | |
def uploaded_pictures(request): | |
pictures = AdPicture.objects.filter(user=request.user, ad__isnull=True) | |
json_pics = [{'name': pic.picture.name.split("/")[-1], | |
'uuid': pic.uuid, | |
'size': pic.picture.size, | |
'thumbnailUrl': pic.picture.url} for pic in pictures] | |
return JsonResponse(json_pics, safe=False) |
OlderNewer