Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
class Document: def __init__(self, id, category_id, topic_id, file_name): self.id = id self.category_id = category_id self.topic_id = topic_id self.file_name = file_name self.tags = [] @classmethod def from_instances(cls, id, category: Category, topic: Topic, file_name): return cls(id, category.id, topic.id, file_name) def add_tag(self, tag_content): if tag_content in self.tags: return self.tags.append(tag_content) def remove_tag(self, tag_content): if tag_content not in self.tags: return self.tags.remove(tag_content) def edit(self, file_name): self.file_name = file_name def __repr__(self): tags_joined = ', '.join(self.tags) return f"Document {self.id}: {self.file_name}; category {self.category_id}, topic {self.topic_id}, tags: {tags_joined}"
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)