This document provides guidelines for maintaining high-quality Python code. These rules MUST be followed by all AI coding agents and contributors.
All code you write MUST be fully optimized.
"Fully optimized" includes:
| function getId() { | |
| /** | |
| * Imported from https://github.com/kyo-ago/UUID | |
| * Robbie Mitchell, @superstrong | |
| */ | |
| /** | |
| * UUID.core.js: The minimal subset of the RFC-compliant UUID generator UUID.js. | |
| * | |
| * @fileOverview |
| from pymongo import Connection | |
| from bson import ObjectId | |
| from itertools import imap | |
| class Model(dict): | |
| """ | |
| A simple model that wraps mongodb document | |
| """ | |
| __getattr__ = dict.get |
| function myFunction() { | |
| var ss = SpreadsheetApp.getActive(); | |
| var sheet = ss.getSheetByName("orange"); | |
| var range = sheet.getRange("1:1").getValues(); | |
| var titles = range[0]; | |
| var a1range = "A1:A"; | |
| var a1array = []; | |
| a1range = a1range +titles.length*titles.length; | |
| var b1range = "B1:B"; |
| // http://stackoverflow.com/questions/11273268/script-import-local-csv-in-google-spreadsheet | |
| function onOpen() { | |
| var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
| var csvMenuEntries = [{name: "Upload CSV file", functionName: "doGet"}]; | |
| ss.addMenu("CSV", csvMenuEntries); | |
| } | |
| function doGet(e) { | |
| var app = UiApp.createApplication().setTitle("Upload CSV to Sheet"); |
| /** | |
| * immersiveMode | |
| * set onPostResume, onSystemUiVisibilityChange | |
| */ | |
| fun immersiveMode(activity: Activity) { | |
| activity.window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) | |
| activity.window | |
| .setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN) | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { |
| Object.defineProperty(Date.prototype,"diff",{ | |
| writable: false, configurable: false, enumerable: true, | |
| /** | |
| * Returns the difference between two Date objects. | |
| * @param {Date} The date to compare to. | |
| * @return {Object} | |
| * @throws {TypeError} | |
| */ | |
| value: function(date) { |
| public class SomeFragment extends Fragment { | |
| MapView mapView; | |
| GoogleMap map; | |
| @Override | |
| public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
| View v = inflater.inflate(R.layout.some_layout, container, false); | |
| public class NonSwipeableViewPager extends ViewPager { | |
| public NonSwipeableViewPager(Context context) { | |
| super(context); | |
| } | |
| public NonSwipeableViewPager(Context context, AttributeSet attrs) { | |
| super(context, attrs); | |
| } |
| #!/usr/bin/env bash | |
| # https://docs.docker.com/install/linux/docker-ce/ubuntu/ | |
| sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | |
| sudo apt-get update | |
| sudo apt-get install docker.io | |
| # https://docs.docker.com/compose/install/ |