hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 98
values | lang stringclasses 21
values | max_stars_repo_path stringlengths 3 945 | max_stars_repo_name stringlengths 4 118 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 945 | max_issues_repo_name stringlengths 4 118 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 945 | max_forks_repo_name stringlengths 4 135 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1 1.03M | max_line_length int64 2 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e4b9203ca91be6d2657b5c545a7a9ed0b9c9fd0d | 521 | go | Go | formatters/csv.go | pd93/plog | 5d9c6df10cf0caf6f6cba75e972ad64aab7277d0 | [
"MIT"
] | null | null | null | formatters/csv.go | pd93/plog | 5d9c6df10cf0caf6f6cba75e972ad64aab7277d0 | [
"MIT"
] | 9 | 2019-08-26T03:00:18.000Z | 2020-12-21T18:21:44.000Z | formatters/csv.go | pd93/plog | 5d9c6df10cf0caf6f6cba75e972ad64aab7277d0 | [
"MIT"
] | null | null | null | package formatters
import (
"fmt"
"strings"
)
// CSV will format a log into a comma-separated value (CSV) string.
func CSV(timestamp, logLevel string, variables []interface{}, tags []string) (string, error) {
strVariables := make([]string, len(variables))
// Loop through the variables and format them
for i, variable := range variables {
strVariables[i] = fmt.Sprintf("%v", variable)
}
return fmt.Sprintf(`%s,%s,%s,%s`, timestamp, logLevel, strings.Join(strVariables, " "), strings.Join(tags, ":")), nil
}
| 26.05 | 118 | 0.68714 |
287d21fd40db8f42b02d13c8449dda6683a369c9 | 481 | rb | Ruby | app/models/contact.rb | dwilkie/somleng-simple-cfm | 55833d65512f46c16c70c9f470f4086224833267 | [
"MIT"
] | 21 | 2018-07-19T15:36:55.000Z | 2021-11-14T18:12:48.000Z | app/models/contact.rb | dwilkie/somleng-simple-cfm | 55833d65512f46c16c70c9f470f4086224833267 | [
"MIT"
] | 931 | 2017-09-27T02:23:03.000Z | 2022-03-30T21:56:14.000Z | app/models/contact.rb | dwilkie/somleng-simple-cfm | 55833d65512f46c16c70c9f470f4086224833267 | [
"MIT"
] | 14 | 2017-10-05T09:14:48.000Z | 2020-12-11T10:22:43.000Z | class Contact < ApplicationRecord
include MsisdnHelpers
include MetadataHelpers
belongs_to :account
has_many :callout_participations,
dependent: :restrict_with_error
has_many :callouts,
through: :callout_participations
has_many :phone_calls,
dependent: :restrict_with_error
has_many :remote_phone_call_events,
through: :phone_calls
delegate :call_flow_logic,
to: :account,
allow_nil: true
end
| 20.913043 | 43 | 0.698545 |
80a8fd13c3668f22067dae1075133553dac3f72d | 3,771 | java | Java | com/b/a/b.java | MewX/contendo-viewer-v1.6.3 | 69fba3cea4f9a43e48f43148774cfa61b388e7de | [
"Apache-2.0"
] | 2 | 2021-07-16T10:43:25.000Z | 2021-12-15T13:54:10.000Z | com/b/a/b.java | MewX/contendo-viewer-v1.6.3 | 69fba3cea4f9a43e48f43148774cfa61b388e7de | [
"Apache-2.0"
] | 1 | 2021-10-12T22:24:55.000Z | 2021-10-12T22:24:55.000Z | com/b/a/b.java | MewX/contendo-viewer-v1.6.3 | 69fba3cea4f9a43e48f43148774cfa61b388e7de | [
"Apache-2.0"
] | null | null | null | package com.b.a;
import com.b.a.a.a.a.a;
import com.b.a.a.a.b.b;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.zip.CRC32;
import java.util.zip.CheckedOutputStream;
public class b {
public byte[] a(String... paramVarArgs) {
byte[] arrayOfByte = null;
b b1 = new b();
int[] arrayOfInt = b1.b();
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
CRC32 cRC32 = new CRC32();
DataOutputStream dataOutputStream = new DataOutputStream(new CheckedOutputStream(byteArrayOutputStream, cRC32));
dataOutputStream.writeInt(2);
dataOutputStream.writeInt(arrayOfInt.length);
for (int k : arrayOfInt)
dataOutputStream.writeInt(k);
dataOutputStream.flush();
int i = byteArrayOutputStream.size();
if (paramVarArgs == null) {
dataOutputStream.writeInt(0);
} else {
dataOutputStream.writeInt(paramVarArgs.length);
for (String str : paramVarArgs)
dataOutputStream.writeUTF(str);
}
dataOutputStream.flush();
dataOutputStream.writeLong(cRC32.getValue());
dataOutputStream.close();
int j = byteArrayOutputStream.size();
arrayOfByte = byteArrayOutputStream.toByteArray();
byte[] arrayOfByte1 = new byte[i];
(new b(305419896, 396776, 1040058, -1745425238)).nextBytes(arrayOfByte1);
byte b2;
for (b2 = 8; b2 < arrayOfByte1.length; b2++)
arrayOfByte[b2] = (byte)((arrayOfByte[b2] ^ arrayOfByte1[b2]) & 0xFF);
byte[] arrayOfByte2 = new byte[j];
b1.nextBytes(arrayOfByte2);
while (b2 < arrayOfByte2.length) {
arrayOfByte[b2] = (byte)((arrayOfByte[b2] ^ arrayOfByte2[b2]) & 0xFF);
b2++;
}
} catch (IOException iOException) {
throw new RuntimeException(iOException);
}
return arrayOfByte;
}
public String[] a(byte[] paramArrayOfbyte) {
String[] arrayOfString = null;
byte[] arrayOfByte = null;
DataInputStream dataInputStream = new DataInputStream(new ByteArrayInputStream(paramArrayOfbyte));
try {
int i = dataInputStream.readInt();
int j = dataInputStream.readInt();
arrayOfByte = new byte[8 + j * 4];
(new b(305419896, 396776, 1040058, -1745425238)).nextBytes(arrayOfByte);
for (byte b1 = 8; b1 < arrayOfByte.length; b1++)
paramArrayOfbyte[b1] = (byte)((paramArrayOfbyte[b1] ^ arrayOfByte[b1]) & 0xFF);
int[] arrayOfInt = new int[j];
for (byte b2 = 0; b2 < j; b2++)
arrayOfInt[b2] = dataInputStream.readInt();
byte[] arrayOfByte1 = new byte[paramArrayOfbyte.length];
(new b(arrayOfInt)).nextBytes(arrayOfByte1);
int k;
for (k = arrayOfByte.length; k < arrayOfByte1.length; k++)
paramArrayOfbyte[k] = (byte)((paramArrayOfbyte[k] ^ arrayOfByte1[k]) & 0xFF);
if (i >= 2) {
CRC32 cRC32 = new CRC32();
cRC32.update(paramArrayOfbyte, 0, paramArrayOfbyte.length - 8);
if (cRC32.getValue() != a.d(paramArrayOfbyte, paramArrayOfbyte.length - 8))
throw new IOException("CRC error!!");
}
k = dataInputStream.readInt();
arrayOfString = new String[k];
for (byte b3 = 0; b3 < k; b3++)
arrayOfString[b3] = dataInputStream.readUTF();
} catch (IOException iOException) {
throw new RuntimeException(iOException);
} finally {
try {
dataInputStream.close();
} catch (Exception exception) {}
}
return arrayOfString;
}
}
/* Location: /mnt/r/ConTenDoViewer.jar!/com/b/a/b.class
* Java compiler version: 11 (55.0)
* JD-Core Version: 1.1.3
*/ | 37.336634 | 118 | 0.6428 |
12b1910147c627826b199a75fea35771a412e50b | 1,309 | h | C | kobold2d/cocos2d-ext/CCAnimationExtensions.h | MakeSchool/Kobold2D | 487401773bbbf3604f62b247afeac0c1d6e5f38b | [
"MIT"
] | 1 | 2015-04-17T16:35:08.000Z | 2015-04-17T16:35:08.000Z | Kobold2D/__Kobold2D__/kobold2d/cocos2d-ext/CCAnimationExtensions.h | LiamInJapan/Kobold2D | 8347f38b3d7fc39bbc265a9a414c27f3be280a45 | [
"Unlicense"
] | null | null | null | Kobold2D/__Kobold2D__/kobold2d/cocos2d-ext/CCAnimationExtensions.h | LiamInJapan/Kobold2D | 8347f38b3d7fc39bbc265a9a414c27f3be280a45 | [
"Unlicense"
] | 2 | 2021-07-21T23:16:05.000Z | 2021-07-29T00:55:14.000Z | /*
* Kobold2D™ --- http://www.kobold2d.org
*
* Copyright (c) 2010-2011 Steffen Itterheim.
* Released under MIT License in Germany (LICENSE-Kobold2D.txt).
*/
#import "cocos2d.h"
/** extends CCAnimation */
@interface CCAnimation (KoboldExtensions)
/** Creates a CCAnimation with name, a format string for the consecutively numbered files (eg @"frames_%i.png"), the number of frames,
the first index (from where to count numFrames), and delay between frames. */
+(id) animationWithName:(NSString*)name format:(NSString*)format numFrames:(int)numFrames firstIndex:(int)firstIndex delay:(float)delay;
/** Creates a CCAnimation from individual files. The name is the base name of the files which must be suffixed with consecutive numbers.
For example: ship0.png, ship1.png, ship2.png ... (name:@"ship" frameCount:3) */
+(CCAnimation*) animationWithFiles:(NSString*)name frameCount:(int)frameCount delay:(float)delay;
/** Creates a CCAnimation from individual sprite frames. Assumes the sprite frames have already been loaded. The name is the base name of the files which must be suffixed with consecutive numbers.
For example: ship0.png, ship1.png, ship2.png ... (name:@"ship" frameCount:3) */
+(CCAnimation*) animationWithFrames:(NSString*)frame frameCount:(int)frameCount delay:(float)delay;
@end
| 50.346154 | 196 | 0.753247 |
9ac51c95dff1ef9d2fdd570044fcf2a6276a1a26 | 35,241 | sql | SQL | Blog/admin.sql | wzk3396957/phpStudy | a399ba8d02a08fcbb2b49beca6a5938981accc20 | [
"Apache-2.0"
] | null | null | null | Blog/admin.sql | wzk3396957/phpStudy | a399ba8d02a08fcbb2b49beca6a5938981accc20 | [
"Apache-2.0"
] | null | null | null | Blog/admin.sql | wzk3396957/phpStudy | a399ba8d02a08fcbb2b49beca6a5938981accc20 | [
"Apache-2.0"
] | null | null | null | /*
Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50553
Source Host : localhost:3306
Source Database : my_db
Target Server Type : MYSQL
Target Server Version : 50553
File Encoding : 65001
Date: 2018-12-08 11:41:13
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`username` varchar(25) NOT NULL,
`password` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES ('1', 'admin', '123456');
-- ----------------------------
-- Table structure for article
-- ----------------------------
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`title` varchar(20) NOT NULL,
`image` varchar(255) NOT NULL,
`author` varchar(10) NOT NULL,
`content` text NOT NULL,
`time` varchar(10) NOT NULL,
`art_type` varchar(10) NOT NULL,
`sort` int(10) NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0下架1发布',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of article
-- ----------------------------
INSERT INTO `article` VALUES ('13', '蔡当局多名高官选后辞职 被曝为再捞30万', '\\upload\\1543680000\\154374307093.gif', '魏', '<p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\">原标题:蔡当局多名高官选后辞职,但被曝疑为“再捞30万”故意拖延</p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> [环球网综合报道]台湾“九合一”选举后,台当局“中选会”主委陈英钤等多个高官陆续请辞。不过国民党发言人洪孟楷质疑,多位官员11月24日请辞,却在12月1日后才正式辞职,多等一个礼拜就是要每人“多捞”年终奖新台币30万元(约合人民币6.75万元)。</p><p><img src=\"https://n.sinaimg.cn/translate/612/w1279h933/20181202/6Iwy-hpevhcm7646584.jpg\" alt=\"陈英钤已辞职(图片来源:台湾《联合报》)\" style=\"margin: 0px auto; padding: 0px; border: 0px none; vertical-align: top; display: block; max-width: 640px;\"/><span class=\"img_descr\" style=\"margin: 5px auto; padding: 6px 0px; line-height: 20px; font-size: 16px; display: inline-block; zoom: 1; text-align: left; font-weight: 700;\">陈英钤已辞职(图片来源:台湾《联合报》)</span></p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> 据台湾“中时电子报”12月2日报道,陈英钤11月25日请辞,但至今他仍为休假状态,岛内舆论质疑他“假请辞真休假”是为领30万元年终奖金。</p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> 另外,台当局“行政院”12月1日表示,“环保署署长”李应元、“农委会主委”林聪贤、“交通部长”吴宏谋3人在“九合一”开票当天已向“行政院长”赖清德请辞。然而,这三个人却在12月1日才被准许辞职。</p><p><img src=\"https://n.sinaimg.cn/translate/331/w656h475/20181202/45V6-hpevhcm7646609.jpg\" alt=\"吴宏谋(左)、林聪贤(中)、李应元(右)(图片来源:台湾“中时电子报”)\" style=\"margin: 0px auto; padding: 0px; border: 0px none; vertical-align: top; display: block; max-width: 640px;\"/><span class=\"img_descr\" style=\"margin: 5px auto; padding: 6px 0px; line-height: 20px; font-size: 16px; display: inline-block; zoom: 1; text-align: left; font-weight: 700;\">吴宏谋(左)、林聪贤(中)、李应元(右)(图片来源:台湾“中时电子报”)</span></p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> 对此,洪孟楷说,依照台当局相关规定,只要12月1日在职,则可以领取该年度的年终奖金,如果11月30日以前离职则无法领取。因此这三位负责人将分别都能领民众纳税钱所给予的奖金30万元。</p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> 虽然他们声称为了民进党的败选负责,但临走前还能够领取年终奖金。洪孟楷质疑,这跟陈英钤11月25日对外宣称请辞却拖到12月3日有何不同,“蔡英文当局内到底还藏有多少厚颜无耻的‘陈英钤们’”?</p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> “这三位政务官硬是多等一个礼拜才准辞,分明就是要多花100万给赖清德做人情,让三位政务官多捞30万”。</p><p><img src=\"https://n.sinaimg.cn/translate/76/w488h388/20181202/DUij-hpevhcm7646654.png\" alt=\" 洪孟楷发文质疑台当局辞职官员(Facebook截图)\" style=\"margin: 0px auto; padding: 0px; border: 0px none; vertical-align: top; display: block; max-width: 640px;\"/><span class=\"img_descr\" style=\"margin: 5px auto; padding: 6px 0px; line-height: 20px; font-size: 16px; display: inline-block; zoom: 1; text-align: left; font-weight: 700;\">洪孟楷发文质疑台当局辞职官员(Facebook截图)</span></p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> 洪说,如果官员做得好,即便加薪相信人民也甘之如饴;但若是做不好要下台,且还是要为民进党的败选负责,公私是否分明暂且不管,做不好还能厚顏无耻的多领年终奖金,“蔡英文当局的官员真的为所欲为也无所谓?”</p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> 民进党当局官员辞职还要多捞钱的做法也引起了岛内民众反感。有人讽,这种做法就是想吃民众的纳税钱。</p><p><img src=\"https://n.sinaimg.cn/translate/734/w576h158/20181202/xr5V-hpevhcm7646675.png\" alt=\"\" style=\"margin: 0px auto; padding: 0px; border: 0px none; vertical-align: top; display: block; max-width: 640px;\"/><span class=\"img_descr\" style=\"margin: 5px auto; padding: 6px 0px; line-height: 20px; font-size: 16px; display: inline-block; zoom: 1; text-align: left; font-weight: 700;\"></span></p><p style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\"> 也有人痛骂民进党吃相难看,临走还要捞一把。更有人直言:吃干抹净,舔不知耻。</p><p><img src=\"https://n.sinaimg.cn/translate/427/w258h169/20181202/XAy9-hpevhcm7646700.png\" alt=\"\" style=\"margin: 0px auto; padding: 0px; border: 0px none; vertical-align: top; display: block; max-width: 640px;\"/><span class=\"img_descr\" style=\"margin: 5px auto; padding: 6px 0px; line-height: 20px; font-size: 16px; display: inline-block; zoom: 1; text-align: left; font-weight: 700;\"></span></p><p><ins class=\"sinaads sinaads-done\" id=\"Sinads49447\" data-ad-pdps=\"PDPS000000044086\" data-ad-status=\"done\" style=\"display: block; overflow: hidden; text-decoration-line: none;\"><ins style=\"text-decoration-line: none; margin: 0px auto; width: 300px; display: block; position: relative; overflow: hidden;\"><iframe width=\"300px\" height=\"250px\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" vspace=\"0\" hspace=\"0\" allowtransparency=\"true\" scrolling=\"no\" id=\"sinaadtk_sandbox_id_11\" name=\"sinaadtk_sandbox_id_11\" __idm_frm__=\"224\" style=\"float: left;\"></iframe></ins></ins></p><p class=\"show_author\" style=\"margin-top: 0px; margin-bottom: 18px; padding: 0px; text-align: right; color: rgb(77, 79, 83); font-family: "Microsoft Yahei", "\\\\5FAE软雅黑", "STHeiti Light", "\\\\534E文细黑", SimSun, "\\\\5B8B体", Arial, sans-serif; font-size: 18px; letter-spacing: 1px; white-space: normal; background-color: rgb(255, 255, 255);\">责任编辑:吴金明</p><p><br/></p>', '1543825009', '0', '0', '1');
INSERT INTO `article` VALUES ('9', '广电总局局长:短视频平台管理规范近期将公', '\\upload\\1543766400\\154382751541.jpg', '0', '<p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\"><strong>广电总局局长:短视频平台管理规范和内容审核标准近期将公布</strong></p><p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\"><img src=\"https://t1.huanqiu.cn/5297c08d456029eb18045ce449ce2b2c.jpg\" style=\"border: none; max-width: 100%; display: block; height: auto; margin: 10px auto 20px;\"/></p><p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\">11月29日,第六届中国网络视听大会在成都举办,国家广播电视总局党组书记、局长聂辰席出席大会开幕式并发表讲话。</p><p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\">聂辰席表示,我国网络视听行业取得了显著成绩,主要体现在服务大局能力显著增加、节目数量质量不断提升、产业规模不断壮大、产业秩序日益规范等方面。</p><p><span class=\"a\" style=\"float: right;\">责编:韩雯雯</span></p><p><br/></p>', '1544060745', '0', '0', '1');
INSERT INTO `article` VALUES ('10', '韩媒:朴槿惠两年量刑定了!系首个获得最终', '\\upload\\1543766400\\154382444037.jpg', '0', '<p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\"><img src=\"https://t1.huanqiu.cn/955fcfa05b42b38038d968967bcc16e8.jpg\" alt=\"\" style=\"border: none; max-width: 100%; display: block; height: auto; margin: 10px auto 20px;\"/></p><p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\">朴槿惠 资料图 图源:东方IC</p><p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\">【环球网报道 实习记者 王玮彬 记者 杨菲菲】韩国首尔高等法院于11月21日对韩国前总统朴槿惠涉嫌非法介入韩国新世界党(现自由韩国党)国会议员公推案作出二审判决,法院决定维持一审判决,判处朴槿惠有期徒刑两年。截至28日,朴槿惠未提请上诉。</p><p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\">据韩联社28日报道,因宣判日期为21日,朴槿惠可在28日24时前提请上诉。但据韩国法律界人士28日透露,朴槿惠直至当日依旧未向韩国首尔高等法院提交上诉书。报道认为,这实际等同于朴槿惠已放弃了上诉。</p><p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\">报道称,又因法院已在一审与二审中判定朴槿惠的罪名成立,且二审的量刑不满十年,检方无法再度提请上诉。至此,朴槿惠因国会议员公推案而被判处的两年有期徒刑将得以最终确认。这是朴槿惠被起诉的案件中首个获得最终确认的判决。</p><p style=\"margin-top: 10px; margin-bottom: 20px; padding: 0px; list-style: none; line-height: 30px; word-break: break-all; color: rgb(25, 25, 25); font-family: "\\"PingFang SC\\",Arial,\\"Microsoft yahei\\",simsun,\\"sans-serif\\""; white-space: normal; background-color: rgb(249, 249, 249);\">据报道,朴槿惠还因涉嫌从韩国国家情报院收取特殊活动费而被起诉,且在一审中被判有罪。检方随后提请上诉,但韩国首尔高等法院至今未对此案进行二审判决。</p><p><span class=\"a\" style=\"float: right;\">责编:刘婕</span></p><p><br/></p>', '1543824440', '0', '0', '1');
INSERT INTO `article` VALUES ('11', '正式成为世界非遗中国“藏医药浴法”申遗经', '\\upload\\1543420800\\154348559410.jpg', '魏子康', '<p style=\"margin-top: 0px; margin-bottom: 0px; padding: 12px 0px; outline: 0px; text-indent: 2em; font-size: 18px; color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);\">中国西藏网讯 28日,中国“藏医药浴法”被正式列入联合国教科文组织人类非物质文化遗产代表作名录。</p><p><img data-src=\"https://res.youth.cn/article_201811_29_296_5bff63f73b0a9.jpg\" width=\"600\" height=\"485\" img_width=\"600\" img_height=\"485\" src=\"https://res.youth.cn/article_201811_29_296_5bff63f73b0a9.jpg\" style=\"border: none; display: block; margin-left: auto; margin-right: auto; max-width: 100%; background-color: rgb(241, 240, 240); color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; font-size: 14px; white-space: normal; height: auto !important;\"/></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 12px 0px; outline: 0px; text-indent: 2em; font-size: 18px; color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);\">图片来源:央视新闻客户端</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 12px 0px; outline: 0px; text-indent: 2em; font-size: 18px; color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);\">据悉,当地时间28日,在联合国教科文组织保护非物质文化遗产政府间委员会第十三届常会上,中国申报的“藏医药浴法——中国藏族有关生命健康和疾病防治的知识与实践”通过审议,列入人类非物质文化遗产代表作名录,这也是中国第40个入选《非遗公约》名录的遗产项目。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 12px 0px; outline: 0px; text-indent: 2em; font-size: 18px; color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);\">浴兰汤兮沐芳华,不被人熟知的中国“藏医药浴法”,经历了怎样的申遗之路?又有何神奇之处?</p><p><img data-src=\"https://res.youth.cn/article_201811_29_29o_5bff63f7aedc8.jpg\" width=\"600\" height=\"338\" img_width=\"600\" img_height=\"338\" src=\"https://res.youth.cn/article_201811_29_29o_5bff63f7aedc8.jpg\" style=\"border: none; display: block; margin-left: auto; margin-right: auto; max-width: 100%; background-color: rgb(241, 240, 240); color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; font-size: 14px; white-space: normal; height: auto !important;\"/></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 12px 0px; outline: 0px; text-indent: 2em; font-size: 18px; color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);\">图为北京藏医院药浴科。摄影:杨悦笙</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 12px 0px; outline: 0px; text-indent: 2em; font-size: 18px; color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);\"><strong>印度与中国竞争藏医药申遗,专家:其发展过程以藏区为中心</strong></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 12px 0px; outline: 0px; text-indent: 2em; font-size: 18px; color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);\">“藏医药浴法”的申遗之路,还得从藏医药的申遗说起。我国一直在争取藏医药的所有权。据悉,2006年,藏医药经国务院批准列入第一批国家级非物质文化遗产名录。2014年,西藏自治区就已经将藏医药申报联合国人类非物质文化遗产代表作名录。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 12px 0px; outline: 0px; text-indent: 2em; font-size: 18px; color: rgb(51, 51, 51); font-family: 微软雅黑, "Microsoft YaHei", arial, sans-serif; white-space: normal; background-color: rgb(255, 255, 255);\">而在2017年3月,印度也正式向联合国教科文组织提出将藏医药列入非物质文化遗产名录。</p><p><br/></p>', '1543824287', '0', '111', '1');
INSERT INTO `article` VALUES ('14', '一片空白 PHP时间戳和日期相互转换', '\\upload\\1543680000\\154374430563.jpg', '魏', '<p class=\"reader-word-layer reader-word-s1-1\" style=\"margin: 10px auto; line-height: 1.5;\">在php中我们要把时间戳转换日期可以直接使用date函数来实现,如果要把日期转换成时间戳可以使用strtotime()函数实现,下面我来给大家举例说明。</p><p class=\"reader-word-layer reader-word-s1-6\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">1.php中时间转换函数</p><p class=\"reader-word-layer reader-word-s1-24\" style=\"margin: 10px auto; line-height: 1.5;\">strtotime</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">(date()) </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">date("Y-m-d H:i",$unixtime) </p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">2.php中获得今天零点的时间戳 要获得零点的unix时间戳,可以使用</p><p class=\"reader-word-layer reader-word-s1-16\" style=\"margin: 10px auto; line-height: 1.5;\">$todaytime=strtotime(“today”),</p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">然后再使用</p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">date("Y-m-d H:i",$todaytime)转换为日期。</p><p class=\"reader-word-layer reader-word-s1-12\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s1-29\" style=\"margin: 10px auto; line-height: 1.5;\">时间戳转换为日期</p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">时间戳转换函数:</p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">date("Y-m-d H:i:s",time()),"Y-m-d H:i:s"是转换后的日期格式,time()是获得当前时间的时间戳。如果是date("Y-m-d H:i:s",time()),则小时分秒一起显示;如果是</p><p class=\"reader-word-layer reader-word-s1-12\" style=\"margin: 10px auto; line-height: 1.5;\">date("Y-m-d ", time()),只显示年月日。例如:</p><p class=\"reader-word-layer reader-word-s1-12\" style=\"margin: 10px auto; line-height: 1.5;\">date("Y-m-d H:i:s",time())</p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">转换后为:</p><p class=\"reader-word-layer reader-word-s1-12 reader-word-s1-31\" style=\"margin: 10px auto; line-height: 1.5;\">2010-07-18 18:42:48 </p><p class=\"reader-word-layer reader-word-s1-12\" style=\"margin: 10px auto; line-height: 1.5;\">date("Y-m-d",time())</p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">转换后为:</p><p class=\"reader-word-layer reader-word-s1-30\" style=\"margin: 10px auto; line-height: 1.5;\">2010-07-18 日期转换为时间戳 .</p><p class=\"reader-word-layer reader-word-s1-30\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">class SaonekController extends Controller { </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> public function index</p><p class=\"reader-word-layer reader-word-s1-10 reader-word-s1-24\" style=\"margin: 10px auto; line-height: 1.5;\">Action</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">(){ </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">/*</p><p class=\"reader-word-layer reader-word-s1-32\" style=\"margin: 10px auto; line-height: 1.5;\">时间戳转换成日期不用说了</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s1-32\" style=\"margin: 10px auto; line-height: 1.5;\">但是日期要转成时间戳的话就要用到</p><p class=\"reader-word-layer reader-word-s1-33\" style=\"margin: 10px auto; line-height: 1.5;\">strtotime() </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">*/ </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> $time = time();//</p><p class=\"reader-word-layer reader-word-s1-32\" style=\"margin: 10px auto; line-height: 1.5;\">时间戳</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> $nowtime = date('Y-m-d H:i:s',$time);//</p><p class=\"reader-word-layer reader-word-s1-32\" style=\"margin: 10px auto; line-height: 1.5;\">生成带格式的日期</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> $oldtime = '2010-11-10 22:19:21'; </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> $catime = strtotime($oldtime);//</p><p class=\"reader-word-layer reader-word-s1-32\" style=\"margin: 10px auto; line-height: 1.5;\">日期转换为时间戳</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> $nowtimes = date('Y-m-d H:i:s',$catime);//</p><p class=\"reader-word-layer reader-word-s1-32\" style=\"margin: 10px auto; line-height: 1.5;\">时间戳又转回日期了</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s1-33\" style=\"margin: 10px auto; line-height: 1.5;\"> echo $nowtimes; </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\"> } </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">} </p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">?> </p><p class=\"reader-word-layer reader-word-s1-15\" style=\"margin: 10px auto; line-height: 1.5;\">3.php中时间戳转换为日期,并按照时间显示不同的内容,如刚刚,分钟前,小时前,今天,昨天等</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">/*</p><p class=\"reader-word-layer reader-word-s1-32\" style=\"margin: 10px auto; line-height: 1.5;\">时间转换函数</p><p class=\"reader-word-layer reader-word-s1-25\" style=\"margin: 10px auto; line-height: 1.5;\">*/</p><p class=\"reader-word-layer reader-word-s2-2\" style=\"margin: 10px auto; line-height: 1.5;\">function transTime($ustime) { </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$ytime = date("Y-m-d H:i",$ustime);</p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$rtime = date("n月j日 H:i",$ustime); </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$htime = date("H:i",$ustime); </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-2\" style=\"margin: 10px auto; line-height: 1.5;\">$time = time() - $ustime; </p><p class=\"reader-word-layer reader-word-s2-2\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$todaytime = strtotime("today"); </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$time1 = time() - $todaytime; </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">if($time < 60){ </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$str = '刚刚'; </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-2\" style=\"margin: 10px auto; line-height: 1.5;\">}else if($time < 60 * 60){ </p><p class=\"reader-word-layer reader-word-s2-2\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-2\" style=\"margin: 10px auto; line-height: 1.5;\">$min = floor($time/60); </p><p><br class=\"reader-word-layer reader-word-s2-0\"/></p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$str = $min.'分钟前'; </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">}else if($time < $time1){ </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$str = '今天'.$htime; </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">}else{ </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">$str = $rtime; </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\"> </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">} </p><p><br class=\"reader-word-layer reader-word-s2-0\"/></p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">return $str; </p><p class=\"reader-word-layer reader-word-s2-0\" style=\"margin: 10px auto; line-height: 1.5;\">} </p><p class=\"reader-word-layer reader-word-s2-13\" style=\"margin: 10px auto; line-height: 1.5;\">其它的参考</p><p class=\"reader-word-layer reader-word-s2-16\" style=\"margin: 10px auto; line-height: 1.5;\">使用date将当时间戳与指定时间戳转换成系统时间</p><p><br/></p>', '1543744305', '0', '0', '1');
INSERT INTO `article` VALUES ('17', 'ss', '\\upload\\1544025600\\154405961576.png', 'ss', '<p>dddd</p>', '1544059615', '0', '0', '1');
-- ----------------------------
-- Table structure for category
-- ----------------------------
DROP TABLE IF EXISTS `category`;
CREATE TABLE `category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sort` int(10) DEFAULT NULL,
`category` varchar(25) DEFAULT NULL,
`pid` int(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=45 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of category
-- ----------------------------
INSERT INTO `category` VALUES ('15', '0', '串串香', '10');
INSERT INTO `category` VALUES ('16', '0', '信息', '0');
INSERT INTO `category` VALUES ('17', '0', 'IIS', '0');
INSERT INTO `category` VALUES ('18', '0', '啧啧啧', '0');
INSERT INTO `category` VALUES ('19', '0', '天天', '0');
INSERT INTO `category` VALUES ('38', '0', 'hhh', '18');
INSERT INTO `category` VALUES ('42', '0', '22', '0');
-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL,
`content` varchar(255) NOT NULL,
`time` varchar(20) NOT NULL,
`art_id` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of comment
-- ----------------------------
INSERT INTO `comment` VALUES ('1', 'David Beckham', 'ccccc', '1544085636', '9');
INSERT INTO `comment` VALUES ('2', 'David Beckham', 'fffff', '1544085734', '9');
INSERT INTO `comment` VALUES ('3', 'David Beckham', '23222', '1544085833', '9');
INSERT INTO `comment` VALUES ('4', 'David Beckham', 'dsadsa', '1544086249', '9');
INSERT INTO `comment` VALUES ('5', 'David Beckham', 'asdasd', '1544086369', '13');
INSERT INTO `comment` VALUES ('6', 'David Beckham', 'ffff', '1544086452', '13');
INSERT INTO `comment` VALUES ('7', 'David Beckham', 'ddddd', '1544086513', '13');
INSERT INTO `comment` VALUES ('8', 'David Beckham', 'ffffff', '1544086819', '13');
INSERT INTO `comment` VALUES ('9', 'David Beckham', 'dddddd', '1544087545', '13');
INSERT INTO `comment` VALUES ('10', 'David Beckham', 'vvvvv', '1544087636', '13');
INSERT INTO `comment` VALUES ('11', 'David Beckham', 'gggg', '1544087847', '13');
INSERT INTO `comment` VALUES ('12', 'David Beckham', 'wwwww', '1544088092', '13');
INSERT INTO `comment` VALUES ('13', 'David Beckham', 'ffff', '1544088181', '13');
-- ----------------------------
-- Table structure for comment_son
-- ----------------------------
DROP TABLE IF EXISTS `comment_son`;
CREATE TABLE `comment_son` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL,
`content` varchar(255) NOT NULL,
`pid` int(10) NOT NULL,
`time` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of comment_son
-- ----------------------------
INSERT INTO `comment_son` VALUES ('2', '子评论', '回复@David Beckham : fffwww', '13', '1544088184');
INSERT INTO `comment_son` VALUES ('3', '子评论', '回复@子评论 : ffffff', '13', '1544088189');
INSERT INTO `comment_son` VALUES ('4', '子评论', '回复@子评论 : eeeee', '13', '1544088196');
INSERT INTO `comment_son` VALUES ('5', '子评论', '回复@子评论 : qqqq', '13', '1544088203');
-- ----------------------------
-- Table structure for contact
-- ----------------------------
DROP TABLE IF EXISTS `contact`;
CREATE TABLE `contact` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL,
`email` varchar(50) NOT NULL,
`message` varchar(255) NOT NULL,
`userid` varchar(50) DEFAULT NULL,
`time` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of contact
-- ----------------------------
INSERT INTO `contact` VALUES ('3', '魏子康', '1783486028@qq.com', 'asdasdasdasdasdasd', null, '1544234079');
INSERT INTO `contact` VALUES ('2', '魏子康', '1783486028@qq.com', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', null, '1544233953');
INSERT INTO `contact` VALUES ('4', '魏子康', '1783486028@qq.com', 'ddddddddddddddddddddd', null, '1544234469');
INSERT INTO `contact` VALUES ('5', '魏子康', '997097287@qq.com', 'ffffffffffffffffffffffffffffffffff', null, '1544234476');
INSERT INTO `contact` VALUES ('6', '魏子康', '997097287@qq.com', 'fffffffffffffffffffffffffffffffffffffff', null, '1544234483');
INSERT INTO `contact` VALUES ('7', '魏子康', '1783486028@qq.com', 'dddddddddddddddddddddddcccccccccccccccccccccc', null, '1544234499');
| 223.044304 | 12,956 | 0.677762 |
9c7bbdb6126ba173b0983efab4108f531372dcab | 7,947 | cpp | C++ | src/gui/editorwidgets/qgsexternalresourcewidgetwrapper.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | null | null | null | src/gui/editorwidgets/qgsexternalresourcewidgetwrapper.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | null | null | null | src/gui/editorwidgets/qgsexternalresourcewidgetwrapper.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | 1 | 2021-12-25T08:40:30.000Z | 2021-12-25T08:40:30.000Z | /***************************************************************************
qgsexternalresourcewidgetwrapper.cpp
--------------------------------------
begin : 16.12.2015
copyright : (C) 2015 by Denis Rouzaud
email : denis.rouzaud@gmail.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsexternalresourcewidgetwrapper.h"
#include <QPushButton>
#include <QSettings>
#include <QLabel>
#include "qgsproject.h"
#include "qgsexternalresourcewidget.h"
#include "qgsfilterlineedit.h"
#include "qgsapplication.h"
#include "qgsexpressioncontextutils.h"
QgsExternalResourceWidgetWrapper::QgsExternalResourceWidgetWrapper( QgsVectorLayer *layer, int fieldIdx, QWidget *editor, QWidget *parent )
: QgsEditorWidgetWrapper( layer, fieldIdx, editor, parent )
{
}
QVariant QgsExternalResourceWidgetWrapper::value() const
{
if ( mQgsWidget )
{
return mQgsWidget->documentPath( field().type() );
}
if ( mLineEdit )
{
if ( mLineEdit->text().isEmpty() || mLineEdit->text() == QgsApplication::nullRepresentation() )
{
return QVariant( field().type() );
}
else
{
return mLineEdit->text();
}
}
return QVariant( field().type() );
}
void QgsExternalResourceWidgetWrapper::showIndeterminateState()
{
if ( mLineEdit )
{
whileBlocking( mLineEdit )->clear();
}
if ( mLabel )
{
mLabel->clear();
}
if ( mQgsWidget )
{
whileBlocking( mQgsWidget )->setDocumentPath( QString() );
}
}
bool QgsExternalResourceWidgetWrapper::valid() const
{
return mLineEdit || mLabel || mQgsWidget;
}
void QgsExternalResourceWidgetWrapper::setFeature( const QgsFeature &feature )
{
if ( mQgsWidget && mPropertyCollection.hasActiveProperties() )
{
QgsExpressionContext expressionContext( QgsExpressionContextUtils::globalProjectLayerScopes( layer() ) );
expressionContext.setFeature( feature );
bool ok = false;
if ( mPropertyCollection.isActive( QgsEditorWidgetWrapper::RootPath ) )
{
QString path = mPropertyCollection.valueAsString( QgsEditorWidgetWrapper::RootPath, expressionContext, QString(), &ok );
if ( ok )
{
mQgsWidget->setDefaultRoot( path );
}
}
if ( mPropertyCollection.isActive( QgsEditorWidgetWrapper::DocumentViewerContent ) )
{
QString dvcString = mPropertyCollection.valueAsString( QgsEditorWidgetWrapper::DocumentViewerContent, expressionContext, QStringLiteral( "NoContent" ), &ok );
if ( ok )
{
QgsExternalResourceWidget::DocumentViewerContent dvc;
if ( dvcString.compare( QLatin1String( "image" ), Qt::CaseInsensitive ) == 0 )
{
dvc = QgsExternalResourceWidget::Image;
}
else if ( dvcString.compare( QLatin1String( "web" ), Qt::CaseInsensitive ) == 0 )
{
dvc = QgsExternalResourceWidget::Web;
}
else
{
dvc = QgsExternalResourceWidget::NoContent;
}
mQgsWidget->setDocumentViewerContent( dvc );
}
}
}
QgsEditorWidgetWrapper::setFeature( feature );
}
QWidget *QgsExternalResourceWidgetWrapper::createWidget( QWidget *parent )
{
return new QgsExternalResourceWidget( parent );
}
void QgsExternalResourceWidgetWrapper::initWidget( QWidget *editor )
{
mLineEdit = qobject_cast<QLineEdit *>( editor );
mLabel = qobject_cast<QLabel *>( editor );
mQgsWidget = qobject_cast<QgsExternalResourceWidget *>( editor );
if ( mLineEdit )
{
QgsFilterLineEdit *fle = qobject_cast<QgsFilterLineEdit *>( editor );
if ( fle )
{
fle->setNullValue( QgsApplication::nullRepresentation() );
}
}
else
mLineEdit = editor->findChild<QLineEdit *>();
if ( mQgsWidget )
{
mQgsWidget->fileWidget()->setStorageMode( QgsFileWidget::GetFile );
QVariantMap cfg = config();
if ( cfg.contains( QStringLiteral( "UseLink" ) ) )
{
mQgsWidget->fileWidget()->setUseLink( cfg.value( QStringLiteral( "UseLink" ) ).toBool() );
}
if ( cfg.contains( QStringLiteral( "FullUrl" ) ) )
{
mQgsWidget->fileWidget()->setFullUrl( cfg.value( QStringLiteral( "FullUrl" ) ).toBool() );
}
mPropertyCollection.loadVariant( cfg.value( QStringLiteral( "PropertyCollection" ) ), propertyDefinitions() );
if ( !mPropertyCollection.isActive( QgsWidgetWrapper::RootPath ) )
{
mQgsWidget->setDefaultRoot( cfg.value( QStringLiteral( "DefaultRoot" ) ).toString() );
}
if ( cfg.contains( QStringLiteral( "StorageMode" ) ) )
{
mQgsWidget->fileWidget()->setStorageMode( ( QgsFileWidget::StorageMode )cfg.value( QStringLiteral( "StorageMode" ) ).toInt() );
}
if ( cfg.contains( QStringLiteral( "RelativeStorage" ) ) )
{
mQgsWidget->setRelativeStorage( ( QgsFileWidget::RelativeStorage )cfg.value( QStringLiteral( "RelativeStorage" ) ).toInt() );
}
if ( cfg.contains( QStringLiteral( "FileWidget" ) ) )
{
mQgsWidget->setFileWidgetVisible( cfg.value( QStringLiteral( "FileWidget" ) ).toBool() );
}
if ( cfg.contains( QStringLiteral( "FileWidgetButton" ) ) )
{
mQgsWidget->fileWidget()->setFileWidgetButtonVisible( cfg.value( QStringLiteral( "FileWidgetButton" ) ).toBool() );
}
if ( cfg.contains( QStringLiteral( "DocumentViewer" ) ) )
{
mQgsWidget->setDocumentViewerContent( ( QgsExternalResourceWidget::DocumentViewerContent )cfg.value( QStringLiteral( "DocumentViewer" ) ).toInt() );
}
if ( cfg.contains( QStringLiteral( "FileWidgetFilter" ) ) )
{
mQgsWidget->fileWidget()->setFilter( cfg.value( QStringLiteral( "FileWidgetFilter" ) ).toString() );
}
}
if ( mLineEdit )
connect( mLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & value ) { emit valueChanged( value ); } );
}
void QgsExternalResourceWidgetWrapper::setValue( const QVariant &value )
{
if ( mLineEdit )
{
if ( value.isNull() )
{
mLineEdit->setText( QgsApplication::nullRepresentation() );
}
else
{
mLineEdit->setText( value.toString() );
}
}
if ( mLabel )
{
mLabel->setText( value.toString() );
emit valueChanged( value.toString() ); // emit signal that value has changed, do not do it for other widgets
}
if ( mQgsWidget )
{
if ( value.isNull() )
{
mQgsWidget->setDocumentPath( QgsApplication::nullRepresentation() );
}
else
{
mQgsWidget->setDocumentPath( value.toString() );
}
}
}
void QgsExternalResourceWidgetWrapper::setEnabled( bool enabled )
{
if ( mLineEdit )
mLineEdit->setReadOnly( !enabled );
if ( mQgsWidget )
mQgsWidget->setReadOnly( !enabled );
}
void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
{
if ( mLineEdit )
{
if ( !constraintResultVisible() )
{
widget()->setStyleSheet( QString() );
}
else
{
switch ( constraintResult() )
{
case ConstraintResultPass:
mLineEdit->setStyleSheet( QString() );
break;
case ConstraintResultFailHard:
mLineEdit->setStyleSheet( QStringLiteral( "QgsFilterLineEdit { background-color: #dd7777; }" ) );
break;
case ConstraintResultFailSoft:
mLineEdit->setStyleSheet( QStringLiteral( "QgsFilterLineEdit { background-color: #ffd85d; }" ) );
break;
}
}
}
}
| 29.988679 | 164 | 0.621744 |
93b337679c35cd31277ee5131337875e8b172958 | 567 | html | HTML | js-demo/www/index_functions.html | t4d-classes/javascript_06072021 | ac8ac07e2801385dc4c707efeaf506c4deab6480 | [
"MIT"
] | null | null | null | js-demo/www/index_functions.html | t4d-classes/javascript_06072021 | ac8ac07e2801385dc4c707efeaf506c4deab6480 | [
"MIT"
] | null | null | null | js-demo/www/index_functions.html | t4d-classes/javascript_06072021 | ac8ac07e2801385dc4c707efeaf506c4deab6480 | [
"MIT"
] | 1 | 2021-06-07T17:05:23.000Z | 2021-06-07T17:05:23.000Z | <h1>Here is some content...</h1>
<script>
"use strict";
const h = true;
const j = false;
// all values are truthy except:
// "" (empty string)
// 0 (includes number and bigint)
// false
// undefined
// null
// NaN
if (true) {
console.log("truthy");
} else {
console.log("falsy");
}
console.log(!true);
console.log(!false);
console.log(!0);
console.log(!"");
console.log(!1);
console.log(!"some value");
console.log(!!"some value");
console.log(0 || "this is cool");
console.log(1 && "this is cool");
</script>
| 17.181818 | 35 | 0.573192 |
758cb399a6ba7136ea0c9ae07b0a877bb2c25d03 | 43 | cs | C# | ClubPenguin.UI/CoinsDisplay.cs | smdx24/CPI-Source-Code | 7602749d447dc73f24ecd9e08c50d2031721abf4 | [
"MIT"
] | 8 | 2019-06-04T19:49:27.000Z | 2022-03-19T13:39:41.000Z | ClubPenguin.UI/CoinsDisplay.cs | smdx24/CPI-Source-Code | 7602749d447dc73f24ecd9e08c50d2031721abf4 | [
"MIT"
] | null | null | null | ClubPenguin.UI/CoinsDisplay.cs | smdx24/CPI-Source-Code | 7602749d447dc73f24ecd9e08c50d2031721abf4 | [
"MIT"
] | 5 | 2020-05-05T04:06:29.000Z | 2022-02-09T21:12:34.000Z | // CoinsDisplay
Decompiled was cancelled.
| 10.75 | 25 | 0.790698 |
805cf26a7265d2c5c5fe303f1bd5e439e3dd2e16 | 1,440 | java | Java | Thread/src/main/java/SemaphoreDemo.java | skdwangming/JavaLearn2.0 | 70d38f6885f085a9cc7a2c58c15c8c8355fd673c | [
"Apache-2.0"
] | null | null | null | Thread/src/main/java/SemaphoreDemo.java | skdwangming/JavaLearn2.0 | 70d38f6885f085a9cc7a2c58c15c8c8355fd673c | [
"Apache-2.0"
] | null | null | null | Thread/src/main/java/SemaphoreDemo.java | skdwangming/JavaLearn2.0 | 70d38f6885f085a9cc7a2c58c15c8c8355fd673c | [
"Apache-2.0"
] | null | null | null | import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
public class SemaphoreDemo {
// 排队总人数(请求总数)
public static int clientTotal = 10;
// 可同时受理业务的窗口数量(同时并发执行的线程数)
public static int threadTotal = 2;
public static void main(String[] args) throws Exception {
ExecutorService executorService = Executors.newCachedThreadPool();
final Semaphore semaphore = new Semaphore(2);
// final CountDownLatch countDownLatch = new CountDownLatch(10);
for (int i = 0; i < 10; i++) {
final int count = i;
executorService.execute(() -> {
try {
semaphore.acquire();
resolve(count);
semaphore.release();
} catch (Exception e) {
e.printStackTrace();
}
// countDownLatch.countDown();
});
}
// countDownLatch.await();
// executorService.shutdown();
}
private static void resolve(int i) throws InterruptedException {
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
System.out.println(format+"服务号{"+i+"},受理业务中。。。");
Thread.sleep(2000);
}
}
| 30.638298 | 87 | 0.600694 |
8d6089620414944cbb9c68ea731469b83f1aee71 | 2,108 | dart | Dart | lib/src/sdk/model/receipt/inflation_receipt.dart | fajarvm/nem2-sdk-dart | 3e1b16269c7c422f1bcf692e8636e2591eb48319 | [
"Apache-2.0",
"MIT"
] | 5 | 2019-05-03T17:29:30.000Z | 2019-07-23T08:15:51.000Z | lib/src/sdk/model/receipt/inflation_receipt.dart | fajarvm/symbol-sdk-dart | 3e1b16269c7c422f1bcf692e8636e2591eb48319 | [
"Apache-2.0",
"MIT"
] | 2 | 2019-12-27T17:50:11.000Z | 2019-12-27T17:52:51.000Z | lib/src/sdk/model/receipt/inflation_receipt.dart | fajarvm/nem2-sdk-dart | 3e1b16269c7c422f1bcf692e8636e2591eb48319 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-07-24T07:02:01.000Z | 2021-07-24T07:02:01.000Z | //
// Copyright (c) 2020 Fajar van Megen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
library symbol_sdk_dart.sdk.model.receipt.inflation_receipt;
import 'dart:typed_data' show Uint8List;
import '../common/uint64.dart';
import '../mosaic/mosaic_id.dart';
import 'receipt.dart';
import 'receipt_type.dart';
import 'receipt_version.dart';
/// A receipt that is created when there is an increase to the native currency supply due to
/// inflation.
class InflationReceipt extends Receipt {
/// The mosaic id.
final MosaicId mosaicId;
/// The amount of mosaic.
final Uint64 amount;
InflationReceipt._(this.mosaicId, this.amount, ReceiptType type, ReceiptVersion version, int size)
: super(type, version, size);
factory InflationReceipt(final MosaicId mosaicId, final Uint64 amount, final ReceiptType type,
final ReceiptVersion version,
[int size]) {
ArgumentError.checkNotNull(mosaicId);
ArgumentError.checkNotNull(type);
ArgumentError.checkNotNull(version);
_validate(type);
return InflationReceipt._(mosaicId, amount, type, version, size);
}
/// Validates the receipt type.
static void _validate(ReceiptType type) {
if (ReceiptType.INFLATION != type) {
throw new ArgumentError('Invalid receipt type: $type');
}
}
@override
Uint8List serialize() {
final Uint8List result = Uint8List(20);
// version and type part
result.setAll(0, super.serialize());
// mosaic part
result.setAll(4, mosaicId.id.toBytes());
// amount part
result.setAll(12, amount.toBytes());
return result;
}
}
| 31 | 100 | 0.718691 |
0bbed5740a97a41857483f9ef024c02ec566cb29 | 237,826 | html | HTML | application/third_party/PHPExcel/Documentation/API/classes/PHPExcel_Reader_Excel5.html | dineshkummarc/phpmyRequirement | 591f538dc83d3086ad0f31f175cc3cf0a53f2116 | [
"MIT"
] | null | null | null | application/third_party/PHPExcel/Documentation/API/classes/PHPExcel_Reader_Excel5.html | dineshkummarc/phpmyRequirement | 591f538dc83d3086ad0f31f175cc3cf0a53f2116 | [
"MIT"
] | 61 | 2020-09-30T04:18:04.000Z | 2020-10-02T17:44:36.000Z | application/third_party/PHPExcel/Documentation/API/classes/PHPExcel_Reader_Excel5.html | dineshkummarc/feedbacker | 591f538dc83d3086ad0f31f175cc3cf0a53f2116 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>PHPExcel classes » \PHPExcel_Reader_Excel5</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<script src="../js/jquery.mousewheel.min.js" type="text/javascript"></script>
<script src="../js/bootstrap.js" type="text/javascript"></script>
<script src="../js/template.js" type="text/javascript"></script>
<script src="../js/prettify/prettify.min.js" type="text/javascript"></script>
<link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72"
href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114"
href="../img/apple-touch-icon-114x114.png">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse"
data-target=".nav-collapse"><span class="icon-bar"></span><span
class="icon-bar"></span><span class="icon-bar"></span></a><a
class="brand" href="../index.html">PHPExcel classes</a>
<div class="nav-collapse">
<ul class="nav">
<li class="dropdown"><a href="#api" class="dropdown-toggle"
data-toggle="dropdown"> API Documentation <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a>Packages</a></li>
<li><a href="../packages/Default.html"><i
class="icon-folder-open"></i> Default</a></li>
<li><a href="../packages/JAMA.html"><i
class="icon-folder-open"></i> JAMA</a></li>
<li><a
href="../packages/JAMA%0D%0ACholesky%20decomposition%20class%0D%0AFor%20a%20symmetric,%20positive%20definite%20matrix%20A,%20the%20Cholesky%20decomposition%0D%0Ais%20an%20lower%20triangular%20matrix%20L%20so%20that%20A%20=%20L*L'.html"><i
class="icon-folder-open"></i> JAMA Cholesky decomposition
class For a symmetric, positive definite matrix A, the
Cholesky decomposition is an lower triangular matrix L so that
A = L*L'</a></li>
<li><a
href="../packages/JAMA%0D%0AClass%20to%20obtain%20eigenvalues%20and%20eigenvectors%20of%20a%20real%20matrix.html"><i
class="icon-folder-open"></i> JAMA Class to obtain eigenvalues
and eigenvectors of a real matrix</a></li>
<li><a href="../packages/JAMA%0D%0AError%20handling.html"><i
class="icon-folder-open"></i> JAMA Error handling</a></li>
<li><a
href="../packages/JAMA%0D%0AFor%20an%20m-by-n%20matrix%20A%20with%20m%20>=%20n,%20the%20LU%20decomposition%20is%20an%20m-by-n%0D%0Aunit%20lower%20triangular%20matrix%20L,%20an%20n-by-n%20upper%20triangular%20matrix%20U,%0D%0Aand%20a%20permutation%20vector%20piv%20of%20length%20m%20so%20that%20A(piv,:)%20=%20L*U.html"><i
class="icon-folder-open"></i> JAMA For an m-by-n matrix A with
m >= n, the LU decomposition is an m-by-n unit lower
triangular matrix L, an n-by-n upper triangular matrix U, and
a permutation vector piv of length m so that A(piv,:) = L*U</a></li>
<li><a
href="../packages/JAMA%0D%0AFor%20an%20m-by-n%20matrix%20A%20with%20m%20>=%20n,%20the%20QR%20decomposition%20is%20an%20m-by-n%0D%0Aorthogonal%20matrix%20Q%20and%20an%20n-by-n%20upper%20triangular%20matrix%20R%20so%20that%0D%0AA%20=%20Q*R.html"><i
class="icon-folder-open"></i> JAMA For an m-by-n matrix A with
m >= n, the QR decomposition is an m-by-n orthogonal matrix
Q and an n-by-n upper triangular matrix R so that A = Q*R</a></li>
<li><a
href="../packages/JAMA%0D%0AFor%20an%20m-by-n%20matrix%20A%20with%20m%20>=%20n,%20the%20singular%20value%20decomposition%20is%0D%0Aan%20m-by-n%20orthogonal%20matrix%20U,%20an%20n-by-n%20diagonal%20matrix%20S,%20and%0D%0Aan%20n-by-n%20orthogonal%20matrix%20V%20so%20that%20A%20=%20U*S*V'.html"><i
class="icon-folder-open"></i> JAMA For an m-by-n matrix A with
m >= n, the singular value decomposition is an m-by-n
orthogonal matrix U, an n-by-n diagonal matrix S, and an
n-by-n orthogonal matrix V so that A = U*S*V'</a></li>
<li><a
href="../packages/JAMA%0D%0APythagorean%20Theorem:%0D%0Aa%20=%203%0D%0Ab%20=%204%0D%0Ar%20=%20sqrt(square(a)%20+%20square(b))%0D%0Ar%20=%205%0D%0Ar%20=%20sqrt(a%5E2%20+%20b%5E2)%20without%20under.overflow.html"><i
class="icon-folder-open"></i> JAMA Pythagorean Theorem: a = 3
b = 4 r = sqrt(square(a) + square(b)) r = 5 r = sqrt(a^2 +
b^2) without under/overflow</a></li>
<li><a href="../packages/PHPExcel.html"><i
class="icon-folder-open"></i> PHPExcel</a></li>
</ul></li>
<li class="dropdown" id="charts-menu"><a href="#charts"
class="dropdown-toggle" data-toggle="dropdown"> Charts <b
class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="../graph_class.html"><i
class="icon-list-alt"></i> Class hierarchy diagram</a></li>
</ul></li>
<li class="dropdown" id="reports-menu"><a href="#reports"
class="dropdown-toggle" data-toggle="dropdown"> Reports <b
class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="../errors.html"><i
class="icon-remove-sign"></i> Errors <span
class="label label-info">551</span></a></li>
<li><a href="../markers.html"><i
class="icon-map-marker"></i> Markers
<ul>
<li>todo <span class="label label-info">19</span>
</li>
<li>fixme <span class="label label-info">10</span>
</li>
</ul></a></li>
<li><a href="../deprecated.html"><i class="icon-stop"></i> Deprecated
elements <span class="label label-info">12</span></a></li>
</ul></li>
</ul>
</div>
</div>
</div>
<div class="go_to_top">
<a href="#___" style="color: inherit">Back to top <i
class="icon-upload icon-white"></i></a>
</div>
</div>
<div id="___" class="container">
<noscript>
<div class="alert alert-warning">Javascript is disabled;
several features are only available if Javascript is enabled.</div>
</noscript>
<div class="row">
<div class="span4">
<span class="btn-group visibility" data-toggle="buttons-checkbox"><button
class="btn public active" title="Show public elements">Public</button>
<button class="btn protected" title="Show protected elements">Protected</button>
<button class="btn private" title="Show private elements">Private</button>
<button class="btn inherited active"
title="Show inherited elements">Inherited</button></span>
<div class="btn-group view pull-right" data-toggle="buttons-radio">
<button class="btn details"
title="Show descriptions and method names">
<i class="icon-list"></i>
</button>
<button class="btn simple" title="Show only method names">
<i class="icon-align-justify"></i>
</button>
</div>
<ul class="side-nav nav nav-list">
<li class="nav-header"><i class="icon-custom icon-method"></i> Methods
<ul>
<li class="method public "><a href="#method__GetInt2d"
title="_GetInt2d :: Read 16-bit unsigned integer"><span
class="description">Read 16-bit unsigned integer</span>
<pre>_GetInt2d()</pre></a></li>
<li class="method public "><a href="#method__GetInt4d"
title="_GetInt4d :: Read 32-bit signed integer"><span
class="description">Read 32-bit signed integer</span>
<pre>_GetInt4d()</pre></a></li>
<li class="method public "><a href="#method___construct"
title="__construct :: Create a new PHPExcel_Reader_Excel5 instance"><span
class="description">Create a new PHPExcel_Reader_Excel5
instance</span>
<pre>__construct()</pre></a></li>
<li class="method public "><a href="#method_canRead"
title="canRead :: Can the current PHPExcel_Reader_IReader read the file?"><span
class="description">Can the current
PHPExcel_Reader_IReader read the file?</span>
<pre>canRead()</pre></a></li>
<li class="method public inherited"><a
href="#method_getIncludeCharts"
title="getIncludeCharts :: Read charts in workbook?
If this is true, then the Reader will include any charts that exist in the workbook."><span
class="description">Read charts in workbook? If this is
true, then the Reader will include any charts that exist in
the workbook.</span>
<pre>getIncludeCharts()</pre></a></li>
<li class="method public inherited"><a
href="#method_getLoadSheetsOnly"
title="getLoadSheetsOnly :: Get which sheets to load
Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
indicating that all worksheets in the workbook should be loaded."><span
class="description">Get which sheets to load Returns
either an array of worksheet names (the list of worksheets
that should be loaded), or a null indicating that all
worksheets in the workbook should be loaded.</span>
<pre>getLoadSheetsOnly()</pre></a></li>
<li class="method public inherited"><a
href="#method_getReadDataOnly"
title="getReadDataOnly :: Read data only?
If this is true, then the Reader will only read data values for cells, it will not read any formatting information."><span
class="description">Read data only? If this is true,
then the Reader will only read data values for cells, it will
not read any formatting information.</span>
<pre>getReadDataOnly()</pre></a></li>
<li class="method public inherited"><a
href="#method_getReadFilter"
title="getReadFilter :: Read filter"><span
class="description">Read filter</span>
<pre>getReadFilter()</pre></a></li>
<li class="method public "><a
href="#method_listWorksheetInfo"
title="listWorksheetInfo :: Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)"><span
class="description">Return worksheet info (Name, Last
Column Letter, Last Column Index, Total Rows, Total Columns)</span>
<pre>listWorksheetInfo()</pre></a></li>
<li class="method public "><a
href="#method_listWorksheetNames"
title="listWorksheetNames :: Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object"><span
class="description">Reads names of the worksheets from a
file, without parsing the whole file to a PHPExcel object</span>
<pre>listWorksheetNames()</pre></a></li>
<li class="method public "><a href="#method_load"
title="load :: Loads PHPExcel from file"><span
class="description">Loads PHPExcel from file</span>
<pre>load()</pre></a></li>
<li class="method public inherited"><a
href="#method_setIncludeCharts"
title="setIncludeCharts :: Set read charts in workbook
Set to true, to advise the Reader to include any charts that exist in the workbook."><span
class="description">Set read charts in workbook Set to
true, to advise the Reader to include any charts that exist in
the workbook.</span>
<pre>setIncludeCharts()</pre></a></li>
<li class="method public inherited"><a
href="#method_setLoadAllSheets"
title="setLoadAllSheets :: Set all sheets to load
Tells the Reader to load all worksheets from the workbook."><span
class="description">Set all sheets to load Tells the
Reader to load all worksheets from the workbook.</span>
<pre>setLoadAllSheets()</pre></a></li>
<li class="method public inherited"><a
href="#method_setLoadSheetsOnly"
title="setLoadSheetsOnly :: Set which sheets to load"><span
class="description">Set which sheets to load</span>
<pre>setLoadSheetsOnly()</pre></a></li>
<li class="method public inherited"><a
href="#method_setReadDataOnly"
title="setReadDataOnly :: Set read data only
Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information."><span
class="description">Set read data only Set to true, to
advise the Reader only to read data values for cells, and to
ignore any formatting information.</span>
<pre>setReadDataOnly()</pre></a></li>
<li class="method public inherited"><a
href="#method_setReadFilter"
title="setReadFilter :: Set read filter"><span
class="description">Set read filter</span>
<pre>setReadFilter()</pre></a></li>
</ul></li>
<li class="nav-header protected">» Protected
<ul>
<li class="method protected inherited"><a
href="#method__openFile"
title="_openFile :: Open file for reading"><span
class="description">Open file for reading</span>
<pre>_openFile()</pre></a></li>
</ul>
</li>
<li class="nav-header private">» Private
<ul>
<li class="method private "><a href="#method__GetIEEE754"
title="_GetIEEE754 :: "><span class="description">_GetIEEE754()
</span>
<pre>_GetIEEE754()</pre></a></li>
<li class="method private "><a
href="#method__UTF8toExcelDoubleQuoted"
title="_UTF8toExcelDoubleQuoted :: Convert UTF-8 string to string surounded by double quotes."><span
class="description">Convert UTF-8 string to string
surounded by double quotes.</span>
<pre>_UTF8toExcelDoubleQuoted()</pre></a></li>
<li class="method private "><a
href="#method__createFormulaFromTokens"
title="_createFormulaFromTokens :: Take array of tokens together with additional data for formula and return human readable formula"><span
class="description">Take array of tokens together with
additional data for formula and return human readable formula</span>
<pre>_createFormulaFromTokens()</pre></a></li>
<li class="method private "><a
href="#method__decodeCodepage"
title="_decodeCodepage :: Convert string to UTF-8."><span
class="description">Convert string to UTF-8.</span>
<pre>_decodeCodepage()</pre></a></li>
<li class="method private "><a href="#method__encodeUTF16"
title="_encodeUTF16 :: Get UTF-8 string from (compressed or uncompressed) UTF-16 string"><span
class="description">Get UTF-8 string from (compressed or
uncompressed) UTF-16 string</span>
<pre>_encodeUTF16()</pre></a></li>
<li class="method private "><a href="#method__extractNumber"
title="_extractNumber :: Reads first 8 bytes of a string and return IEEE 754 float"><span
class="description">Reads first 8 bytes of a string and
return IEEE 754 float</span>
<pre>_extractNumber()</pre></a></li>
<li class="method private "><a
href="#method__getFormulaFromData"
title="_getFormulaFromData :: Take formula data and additional data for formula and return human readable formula"><span
class="description">Take formula data and additional
data for formula and return human readable formula</span>
<pre>_getFormulaFromData()</pre></a></li>
<li class="method private "><a
href="#method__getFormulaFromStructure"
title="_getFormulaFromStructure :: Convert formula structure into human readable Excel formula like 'A3+A5*5'"><span
class="description">Convert formula structure into human
readable Excel formula like 'A3+A5*5'</span>
<pre>_getFormulaFromStructure()</pre></a></li>
<li class="method private "><a href="#method__getNextToken"
title="_getNextToken :: Fetch next token from binary formula data"><span
class="description">Fetch next token from binary formula
data</span>
<pre>_getNextToken()</pre></a></li>
<li class="method private "><a
href="#method__getSplicedRecordData"
title="_getSplicedRecordData :: Reads a record from current position in data stream and continues reading data as long as CONTINUE
records are found."><span
class="description">Reads a record from current position
in data stream and continues reading data as long as CONTINUE
records are found.</span>
<pre>_getSplicedRecordData()</pre></a></li>
<li class="method private "><a
href="#method__includeCellRangeFiltered"
title="_includeCellRangeFiltered :: "><span
class="description">_includeCellRangeFiltered() </span>
<pre>_includeCellRangeFiltered()</pre></a></li>
<li class="method private "><a href="#method__loadOLE"
title="_loadOLE :: Use OLE reader to extract the relevant data streams from the OLE file"><span
class="description">Use OLE reader to extract the
relevant data streams from the OLE file</span>
<pre>_loadOLE()</pre></a></li>
<li class="method private "><a href="#method__makeKey"
title="_makeKey :: Make an RC4 decryptor for the given block"><span
class="description">Make an RC4 decryptor for the given
block</span>
<pre>_makeKey()</pre></a></li>
<li class="method private "><a
href="#method__mapBorderStyle"
title="_mapBorderStyle :: Map border style
OpenOffice documentation: 2.5.11"><span
class="description">Map border style OpenOffice
documentation: 2.5.11</span>
<pre>_mapBorderStyle()</pre></a></li>
<li class="method private "><a
href="#method__mapBuiltInColor"
title="_mapBuiltInColor :: Map built-in color to RGB value"><span
class="description">Map built-in color to RGB value</span>
<pre>_mapBuiltInColor()</pre></a></li>
<li class="method private "><a href="#method__mapColor"
title="_mapColor :: Map color array from BIFF8 built-in color index"><span
class="description">Map color array from BIFF8 built-in
color index</span>
<pre>_mapColor()</pre></a></li>
<li class="method private "><a href="#method__mapColorBIFF5"
title="_mapColorBIFF5 :: Map color array from BIFF5 built-in color index"><span
class="description">Map color array from BIFF5 built-in
color index</span>
<pre>_mapColorBIFF5()</pre></a></li>
<li class="method private "><a href="#method__mapErrorCode"
title="_mapErrorCode :: Map error code, e.g."><span
class="description">Map error code, e.g.</span>
<pre>_mapErrorCode()</pre></a></li>
<li class="method private "><a
href="#method__mapFillPattern"
title="_mapFillPattern :: Get fill pattern from index
OpenOffice documentation: 2.5.12"><span
class="description">Get fill pattern from index
OpenOffice documentation: 2.5.12</span>
<pre>_mapFillPattern()</pre></a></li>
<li class="method private "><a href="#method__parseRichText"
title="_parseRichText :: "><span class="description">_parseRichText()
</span>
<pre>_parseRichText()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF5CellRangeAddressFixed"
title="_readBIFF5CellRangeAddressFixed :: Reads a cell range address in BIFF5 e.g."><span
class="description">Reads a cell range address in BIFF5
e.g.</span>
<pre>_readBIFF5CellRangeAddressFixed()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF5CellRangeAddressList"
title="_readBIFF5CellRangeAddressList :: Read BIFF5 cell range address list
section 2.5.15"><span
class="description">Read BIFF5 cell range address list
section 2.5.15</span>
<pre>_readBIFF5CellRangeAddressList()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF8CellAddress"
title="_readBIFF8CellAddress :: Reads a cell address in BIFF8 e.g."><span
class="description">Reads a cell address in BIFF8 e.g.</span>
<pre>_readBIFF8CellAddress()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF8CellAddressB"
title="_readBIFF8CellAddressB :: Reads a cell address in BIFF8 for shared formulas."><span
class="description">Reads a cell address in BIFF8 for
shared formulas.</span>
<pre>_readBIFF8CellAddressB()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF8CellRangeAddress"
title="_readBIFF8CellRangeAddress :: Reads a cell range address in BIFF8 e.g."><span
class="description">Reads a cell range address in BIFF8
e.g.</span>
<pre>_readBIFF8CellRangeAddress()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF8CellRangeAddressB"
title="_readBIFF8CellRangeAddressB :: Reads a cell range address in BIFF8 for shared formulas."><span
class="description">Reads a cell range address in BIFF8
for shared formulas.</span>
<pre>_readBIFF8CellRangeAddressB()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF8CellRangeAddressFixed"
title="_readBIFF8CellRangeAddressFixed :: Reads a cell range address in BIFF8 e.g."><span
class="description">Reads a cell range address in BIFF8
e.g.</span>
<pre>_readBIFF8CellRangeAddressFixed()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF8CellRangeAddressList"
title="_readBIFF8CellRangeAddressList :: Read BIFF8 cell range address list
section 2.5.15"><span
class="description">Read BIFF8 cell range address list
section 2.5.15</span>
<pre>_readBIFF8CellRangeAddressList()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF8Constant"
title="_readBIFF8Constant :: read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value'
section 2.5.7
returns e.g."><span
class="description">read BIFF8 constant value which may
be 'Empty Value', 'Number', 'String Value', 'Boolean Value',
'Error Value' section 2.5.7 returns e.g.</span>
<pre>_readBIFF8Constant()</pre></a></li>
<li class="method private "><a
href="#method__readBIFF8ConstantArray"
title="_readBIFF8ConstantArray :: read BIFF8 constant value array from array data
returns e.g."><span
class="description">read BIFF8 constant value array from
array data returns e.g.</span>
<pre>_readBIFF8ConstantArray()</pre></a></li>
<li class="method private "><a href="#method__readBlank"
title="_readBlank :: Read BLANK record"><span
class="description">Read BLANK record</span>
<pre>_readBlank()</pre></a></li>
<li class="method private "><a href="#method__readBof"
title="_readBof :: Read BOF"><span class="description">Read
BOF</span>
<pre>_readBof()</pre></a></li>
<li class="method private "><a href="#method__readBoolErr"
title="_readBoolErr :: Read BOOLERR record
This record represents a Boolean value or error value
cell."><span
class="description">Read BOOLERR record This record
represents a Boolean value or error value cell.</span>
<pre>_readBoolErr()</pre></a></li>
<li class="method private "><a
href="#method__readBottomMargin"
title="_readBottomMargin :: Read BOTTOMMARGIN record"><span
class="description">Read BOTTOMMARGIN record</span>
<pre>_readBottomMargin()</pre></a></li>
<li class="method private "><a
href="#method__readByteStringLong"
title="_readByteStringLong :: Read byte string (16-bit string length)
OpenOffice documentation: 2.5.2"><span
class="description">Read byte string (16-bit string
length) OpenOffice documentation: 2.5.2</span>
<pre>_readByteStringLong()</pre></a></li>
<li class="method private "><a
href="#method__readByteStringShort"
title="_readByteStringShort :: Read byte string (8-bit string length)
OpenOffice documentation: 2.5.2"><span
class="description">Read byte string (8-bit string
length) OpenOffice documentation: 2.5.2</span>
<pre>_readByteStringShort()</pre></a></li>
<li class="method private "><a href="#method__readCodepage"
title="_readCodepage :: CODEPAGE"><span class="description">CODEPAGE</span>
<pre>_readCodepage()</pre></a></li>
<li class="method private "><a href="#method__readColInfo"
title="_readColInfo :: Read COLINFO record"><span
class="description">Read COLINFO record</span>
<pre>_readColInfo()</pre></a></li>
<li class="method private "><a href="#method__readColor"
title="_readColor :: Read color"><span class="description">Read
color</span>
<pre>_readColor()</pre></a></li>
<li class="method private "><a href="#method__readContinue"
title="_readContinue :: Read a free CONTINUE record."><span
class="description">Read a free CONTINUE record.</span>
<pre>_readContinue()</pre></a></li>
<li class="method private "><a
href="#method__readDataValidation"
title="_readDataValidation :: Read DATAVALIDATION record"><span
class="description">Read DATAVALIDATION record</span>
<pre>_readDataValidation()</pre></a></li>
<li class="method private "><a
href="#method__readDataValidations"
title="_readDataValidations :: Read DATAVALIDATIONS record"><span
class="description">Read DATAVALIDATIONS record</span>
<pre>_readDataValidations()</pre></a></li>
<li class="method private "><a href="#method__readDateMode"
title="_readDateMode :: DATEMODE"><span class="description">DATEMODE</span>
<pre>_readDateMode()</pre></a></li>
<li class="method private "><a
href="#method__readDefColWidth"
title="_readDefColWidth :: Read DEFCOLWIDTH record"><span
class="description">Read DEFCOLWIDTH record</span>
<pre>_readDefColWidth()</pre></a></li>
<li class="method private "><a href="#method__readDefault"
title="_readDefault :: Reads a general type of BIFF record."><span
class="description">Reads a general type of BIFF record.</span>
<pre>_readDefault()</pre></a></li>
<li class="method private "><a
href="#method__readDefaultRowHeight"
title="_readDefaultRowHeight :: Read DEFAULTROWHEIGHT record"><span
class="description">Read DEFAULTROWHEIGHT record</span>
<pre>_readDefaultRowHeight()</pre></a></li>
<li class="method private "><a
href="#method__readDefinedName"
title="_readDefinedName :: DEFINEDNAME"><span
class="description">DEFINEDNAME</span>
<pre>_readDefinedName()</pre></a></li>
<li class="method private "><a
href="#method__readDocumentSummaryInformation"
title="_readDocumentSummaryInformation :: Read additional document summary information"><span
class="description">Read additional document summary
information</span>
<pre>_readDocumentSummaryInformation()</pre></a></li>
<li class="method private "><a
href="#method__readExternName"
title="_readExternName :: Read EXTERNNAME record."><span
class="description">Read EXTERNNAME record.</span>
<pre>_readExternName()</pre></a></li>
<li class="method private "><a
href="#method__readExternSheet"
title="_readExternSheet :: Read EXTERNSHEET record"><span
class="description">Read EXTERNSHEET record</span>
<pre>_readExternSheet()</pre></a></li>
<li class="method private "><a
href="#method__readExternalBook"
title="_readExternalBook :: Read EXTERNALBOOK record"><span
class="description">Read EXTERNALBOOK record</span>
<pre>_readExternalBook()</pre></a></li>
<li class="method private "><a href="#method__readFilepass"
title="_readFilepass :: FILEPASS"><span class="description">FILEPASS</span>
<pre>_readFilepass()</pre></a></li>
<li class="method private "><a href="#method__readFont"
title="_readFont :: Read a FONT record"><span
class="description">Read a FONT record</span>
<pre>_readFont()</pre></a></li>
<li class="method private "><a href="#method__readFooter"
title="_readFooter :: Read FOOTER record"><span
class="description">Read FOOTER record</span>
<pre>_readFooter()</pre></a></li>
<li class="method private "><a href="#method__readFormat"
title="_readFormat :: FORMAT"><span class="description">FORMAT</span>
<pre>_readFormat()</pre></a></li>
<li class="method private "><a href="#method__readFormula"
title="_readFormula :: Read FORMULA record + perhaps a following STRING record if formula result is a string
This record contains the token array and the result of a
formula cell."><span
class="description">Read FORMULA record + perhaps a
following STRING record if formula result is a string This
record contains the token array and the result of a formula
cell.</span>
<pre>_readFormula()</pre></a></li>
<li class="method private "><a href="#method__readHcenter"
title="_readHcenter :: Read HCENTER record"><span
class="description">Read HCENTER record</span>
<pre>_readHcenter()</pre></a></li>
<li class="method private "><a href="#method__readHeader"
title="_readHeader :: Read HEADER record"><span
class="description">Read HEADER record</span>
<pre>_readHeader()</pre></a></li>
<li class="method private "><a
href="#method__readHorizontalPageBreaks"
title="_readHorizontalPageBreaks :: Read HORIZONTALPAGEBREAKS record"><span
class="description">Read HORIZONTALPAGEBREAKS record</span>
<pre>_readHorizontalPageBreaks()</pre></a></li>
<li class="method private "><a href="#method__readHyperLink"
title="_readHyperLink :: Read HYPERLINK record"><span
class="description">Read HYPERLINK record</span>
<pre>_readHyperLink()</pre></a></li>
<li class="method private "><a href="#method__readImData"
title="_readImData :: Read IMDATA record"><span
class="description">Read IMDATA record</span>
<pre>_readImData()</pre></a></li>
<li class="method private "><a href="#method__readLabel"
title="_readLabel :: Read LABEL record
This record represents a cell that contains a string."><span
class="description">Read LABEL record This record
represents a cell that contains a string.</span>
<pre>_readLabel()</pre></a></li>
<li class="method private "><a href="#method__readLabelSst"
title="_readLabelSst :: Read LABELSST record
This record represents a cell that contains a string."><span
class="description">Read LABELSST record This record
represents a cell that contains a string.</span>
<pre>_readLabelSst()</pre></a></li>
<li class="method private "><a
href="#method__readLeftMargin"
title="_readLeftMargin :: Read LEFTMARGIN record"><span
class="description">Read LEFTMARGIN record</span>
<pre>_readLeftMargin()</pre></a></li>
<li class="method private "><a
href="#method__readMergedCells"
title="_readMergedCells :: MERGEDCELLS"><span
class="description">MERGEDCELLS</span>
<pre>_readMergedCells()</pre></a></li>
<li class="method private "><a
href="#method__readMsoDrawing"
title="_readMsoDrawing :: Read MSODRAWING record"><span
class="description">Read MSODRAWING record</span>
<pre>_readMsoDrawing()</pre></a></li>
<li class="method private "><a
href="#method__readMsoDrawingGroup"
title="_readMsoDrawingGroup :: Read MSODRAWINGGROUP record"><span
class="description">Read MSODRAWINGGROUP record</span>
<pre>_readMsoDrawingGroup()</pre></a></li>
<li class="method private "><a href="#method__readMulBlank"
title="_readMulBlank :: Read MULBLANK record
This record represents a cell range of empty cells."><span
class="description">Read MULBLANK record This record
represents a cell range of empty cells.</span>
<pre>_readMulBlank()</pre></a></li>
<li class="method private "><a href="#method__readMulRk"
title="_readMulRk :: Read MULRK record
This record represents a cell range containing RK value
cells."><span
class="description">Read MULRK record This record
represents a cell range containing RK value cells.</span>
<pre>_readMulRk()</pre></a></li>
<li class="method private "><a href="#method__readNote"
title="_readNote :: The NOTE record specifies a comment associated with a particular cell."><span
class="description">The NOTE record specifies a comment
associated with a particular cell.</span>
<pre>_readNote()</pre></a></li>
<li class="method private "><a href="#method__readNumber"
title="_readNumber :: Read NUMBER record
This record represents a cell that contains a
floating-point value."><span
class="description">Read NUMBER record This record
represents a cell that contains a floating-point value.</span>
<pre>_readNumber()</pre></a></li>
<li class="method private "><a href="#method__readObj"
title="_readObj :: Read OBJ record"><span
class="description">Read OBJ record</span>
<pre>_readObj()</pre></a></li>
<li class="method private "><a
href="#method__readObjectProtect"
title="_readObjectProtect :: OBJECTPROTECT"><span
class="description">OBJECTPROTECT</span>
<pre>_readObjectProtect()</pre></a></li>
<li class="method private "><a
href="#method__readPageLayoutView"
title="_readPageLayoutView :: Read PLV Record(Created by Excel2007 or upper)"><span
class="description">Read PLV Record(Created by Excel2007
or upper)</span>
<pre>_readPageLayoutView()</pre></a></li>
<li class="method private "><a href="#method__readPageSetup"
title="_readPageSetup :: Read PAGESETUP record"><span
class="description">Read PAGESETUP record</span>
<pre>_readPageSetup()</pre></a></li>
<li class="method private "><a href="#method__readPalette"
title="_readPalette :: Read PALETTE record"><span
class="description">Read PALETTE record</span>
<pre>_readPalette()</pre></a></li>
<li class="method private "><a href="#method__readPane"
title="_readPane :: Read PANE record"><span
class="description">Read PANE record</span>
<pre>_readPane()</pre></a></li>
<li class="method private "><a href="#method__readPassword"
title="_readPassword :: PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8)"><span
class="description">PASSWORD - Sheet protection (hashed)
password (BIFF2 through BIFF8)</span>
<pre>_readPassword()</pre></a></li>
<li class="method private "><a
href="#method__readPrintGridlines"
title="_readPrintGridlines :: Read PRINTGRIDLINES record"><span
class="description">Read PRINTGRIDLINES record</span>
<pre>_readPrintGridlines()</pre></a></li>
<li class="method private "><a href="#method__readProtect"
title="_readProtect :: PROTECT - Sheet protection (BIFF2 through BIFF8)
if this record is omitted, then it also means no sheet protection"><span
class="description">PROTECT - Sheet protection (BIFF2
through BIFF8) if this record is omitted, then it also means
no sheet protection</span>
<pre>_readProtect()</pre></a></li>
<li class="method private "><a href="#method__readRGB"
title="_readRGB :: Extract RGB color
OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4"><span
class="description">Extract RGB color OpenOffice.org's
Documentation of the Microsoft Excel File Format, section
2.5.4</span>
<pre>_readRGB()</pre></a></li>
<li class="method private "><a
href="#method__readRangeProtection"
title="_readRangeProtection :: Read RANGEPROTECTION record
Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification,
where it is referred to as FEAT record"><span
class="description">Read RANGEPROTECTION record Reading
of this record is based on Microsoft Office Excel 97-2000
Binary File Format Specification, where it is referred to as
FEAT record</span>
<pre>_readRangeProtection()</pre></a></li>
<li class="method private "><a
href="#method__readRecordData"
title="_readRecordData :: Read record data from stream, decrypting as required"><span
class="description">Read record data from stream,
decrypting as required</span>
<pre>_readRecordData()</pre></a></li>
<li class="method private "><a
href="#method__readRightMargin"
title="_readRightMargin :: Read RIGHTMARGIN record"><span
class="description">Read RIGHTMARGIN record</span>
<pre>_readRightMargin()</pre></a></li>
<li class="method private "><a href="#method__readRk"
title="_readRk :: Read RK record
This record represents a cell that contains an RK value
(encoded integer or floating-point value)."><span
class="description">Read RK record This record
represents a cell that contains an RK value (encoded integer
or floating-point value).</span>
<pre>_readRk()</pre></a></li>
<li class="method private "><a href="#method__readRow"
title="_readRow :: ROW"><span class="description">ROW</span>
<pre>_readRow()</pre></a></li>
<li class="method private "><a
href="#method__readScenProtect"
title="_readScenProtect :: SCENPROTECT"><span
class="description">SCENPROTECT</span>
<pre>_readScenProtect()</pre></a></li>
<li class="method private "><a href="#method__readScl"
title="_readScl :: Read SCL record"><span
class="description">Read SCL record</span>
<pre>_readScl()</pre></a></li>
<li class="method private "><a href="#method__readSelection"
title="_readSelection :: Read SELECTION record."><span
class="description">Read SELECTION record.</span>
<pre>_readSelection()</pre></a></li>
<li class="method private "><a
href="#method__readSharedFmla"
title="_readSharedFmla :: Read a SHAREDFMLA record."><span
class="description">Read a SHAREDFMLA record.</span>
<pre>_readSharedFmla()</pre></a></li>
<li class="method private "><a href="#method__readSheet"
title="_readSheet :: SHEET"><span class="description">SHEET</span>
<pre>_readSheet()</pre></a></li>
<li class="method private "><a
href="#method__readSheetLayout"
title="_readSheetLayout :: Read SHEETLAYOUT record."><span
class="description">Read SHEETLAYOUT record.</span>
<pre>_readSheetLayout()</pre></a></li>
<li class="method private "><a href="#method__readSheetPr"
title="_readSheetPr :: Read SHEETPR record"><span
class="description">Read SHEETPR record</span>
<pre>_readSheetPr()</pre></a></li>
<li class="method private "><a
href="#method__readSheetProtection"
title="_readSheetProtection :: Read SHEETPROTECTION record (FEATHEADR)"><span
class="description">Read SHEETPROTECTION record
(FEATHEADR)</span>
<pre>_readSheetProtection()</pre></a></li>
<li class="method private "><a
href="#method__readSheetRangeByRefIndex"
title="_readSheetRangeByRefIndex :: Get a sheet range like Sheet1:Sheet3 from REF index
Note: If there is only one sheet in the range, one gets e.g Sheet1
It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets,
in which case an PHPExcel_Reader_Exception is thrown"><span
class="description">Get a sheet range like Sheet1:Sheet3
from REF index Note: If there is only one sheet in the range,
one gets e.g Sheet1 It can also happen that the REF structure
uses the -1 (FFFF) code to indicate deleted sheets, in which
case an PHPExcel_Reader_Exception is thrown</span>
<pre>_readSheetRangeByRefIndex()</pre></a></li>
<li class="method private "><a href="#method__readSst"
title="_readSst :: SST - Shared String Table"><span
class="description">SST - Shared String Table</span>
<pre>_readSst()</pre></a></li>
<li class="method private "><a href="#method__readString"
title="_readString :: Read a STRING record from current stream position and advance the stream pointer to next record
This record is used for storing result from FORMULA record when it is a string, and
it occurs directly after the FORMULA record"><span
class="description">Read a STRING record from current
stream position and advance the stream pointer to next record
This record is used for storing result from FORMULA record
when it is a string, and it occurs directly after the FORMULA
record</span>
<pre>_readString()</pre></a></li>
<li class="method private "><a href="#method__readStyle"
title="_readStyle :: Read STYLE record"><span
class="description">Read STYLE record</span>
<pre>_readStyle()</pre></a></li>
<li class="method private "><a
href="#method__readSummaryInformation"
title="_readSummaryInformation :: Read summary information"><span
class="description">Read summary information</span>
<pre>_readSummaryInformation()</pre></a></li>
<li class="method private "><a
href="#method__readTextObject"
title="_readTextObject :: The TEXT Object record contains the text associated with a cell annotation."><span
class="description">The TEXT Object record contains the
text associated with a cell annotation.</span>
<pre>_readTextObject()</pre></a></li>
<li class="method private "><a href="#method__readTopMargin"
title="_readTopMargin :: Read TOPMARGIN record"><span
class="description">Read TOPMARGIN record</span>
<pre>_readTopMargin()</pre></a></li>
<li class="method private "><a
href="#method__readUnicodeString"
title="_readUnicodeString :: Read Unicode string with no string length field, but with known character count
this function is under construction, needs to support rich text, and Asian phonetic settings
OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3"><span
class="description">Read Unicode string with no string
length field, but with known character count this function is
under construction, needs to support rich text, and Asian
phonetic settings OpenOffice.org's Documentation of the
Microsoft Excel File Format, section 2.5.3</span>
<pre>_readUnicodeString()</pre></a></li>
<li class="method private "><a
href="#method__readUnicodeStringLong"
title="_readUnicodeStringLong :: Extracts an Excel Unicode long string (16-bit string length)
OpenOffice documentation: 2.5.3
this function is under construction, needs to support rich text, and Asian phonetic settings"><span
class="description">Extracts an Excel Unicode long
string (16-bit string length) OpenOffice documentation: 2.5.3
this function is under construction, needs to support rich
text, and Asian phonetic settings</span>
<pre>_readUnicodeStringLong()</pre></a></li>
<li class="method private "><a
href="#method__readUnicodeStringShort"
title="_readUnicodeStringShort :: Extracts an Excel Unicode short string (8-bit string length)
OpenOffice documentation: 2.5.3
function will automatically find out where the Unicode string ends."><span
class="description">Extracts an Excel Unicode short
string (8-bit string length) OpenOffice documentation: 2.5.3
function will automatically find out where the Unicode string
ends.</span>
<pre>_readUnicodeStringShort()</pre></a></li>
<li class="method private "><a href="#method__readVcenter"
title="_readVcenter :: Read VCENTER record"><span
class="description">Read VCENTER record</span>
<pre>_readVcenter()</pre></a></li>
<li class="method private "><a
href="#method__readVerticalPageBreaks"
title="_readVerticalPageBreaks :: Read VERTICALPAGEBREAKS record"><span
class="description">Read VERTICALPAGEBREAKS record</span>
<pre>_readVerticalPageBreaks()</pre></a></li>
<li class="method private "><a href="#method__readWindow2"
title="_readWindow2 :: Read WINDOW2 record"><span
class="description">Read WINDOW2 record</span>
<pre>_readWindow2()</pre></a></li>
<li class="method private "><a href="#method__readXf"
title="_readXf :: XF - Extended Format"><span
class="description">XF - Extended Format</span>
<pre>_readXf()</pre></a></li>
<li class="method private "><a href="#method__readXfExt"
title="_readXfExt :: "><span class="description">_readXfExt()
</span>
<pre>_readXfExt()</pre></a></li>
<li class="method private "><a
href="#method__uncompressByteString"
title="_uncompressByteString :: Convert UTF-16 string in compressed notation to uncompressed form."><span
class="description">Convert UTF-16 string in compressed
notation to uncompressed form.</span>
<pre>_uncompressByteString()</pre></a></li>
<li class="method private "><a
href="#method__verifyPassword"
title="_verifyPassword :: Verify RC4 file password"><span
class="description">Verify RC4 file password</span>
<pre>_verifyPassword()</pre></a></li>
</ul>
</li>
<li class="nav-header"><i class="icon-custom icon-property"></i> Properties
<ul></ul></li>
<li class="nav-header protected">» Protected
<ul>
<li class="property protected inherited"><a
href="#property__fileHandle" title="$_fileHandle :: "><span
class="description"></span>
<pre>$_fileHandle</pre></a></li>
<li class="property protected inherited"><a
href="#property__includeCharts"
title="$_includeCharts :: Read charts that are defined in the workbook?
Identifies whether the Reader should read the definitions for any charts that exist in the workbook;"><span
class="description"></span>
<pre>$_includeCharts</pre></a></li>
<li class="property protected inherited"><a
href="#property__loadSheetsOnly"
title="$_loadSheetsOnly :: Restrict which sheets should be loaded?
This property holds an array of worksheet names to be loaded."><span
class="description"></span>
<pre>$_loadSheetsOnly</pre></a></li>
<li class="property protected inherited"><a
href="#property__readDataOnly"
title="$_readDataOnly :: Read data only?
Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
or whether it should read both data and formatting"><span
class="description"></span>
<pre>$_readDataOnly</pre></a></li>
<li class="property protected inherited"><a
href="#property__readFilter"
title="$_readFilter :: PHPExcel_Reader_IReadFilter instance"><span
class="description"></span>
<pre>$_readFilter</pre></a></li>
</ul>
</li>
<li class="nav-header private">» Private
<ul>
<li class="property private "><a href="#property__cellNotes"
title="$_cellNotes :: Cell Annotations (BIFF8)"><span
class="description"></span>
<pre>$_cellNotes</pre></a></li>
<li class="property private "><a href="#property__codepage"
title="$_codepage :: Codepage set in the Excel file being read."><span
class="description"></span>
<pre>$_codepage</pre></a></li>
<li class="property private "><a href="#property__data"
title="$_data :: Workbook stream data."><span
class="description"></span>
<pre>$_data</pre></a></li>
<li class="property private "><a href="#property__dataSize"
title="$_dataSize :: Size in bytes of $this->_data"><span
class="description"></span>
<pre>$_dataSize</pre></a></li>
<li class="property private "><a
href="#property__definedname"
title="$_definedname :: Defined names"><span
class="description"></span>
<pre>$_definedname</pre></a></li>
<li class="property private "><a
href="#property__documentSummaryInformation"
title="$_documentSummaryInformation :: Extended Summary Information stream data."><span
class="description"></span>
<pre>$_documentSummaryInformation</pre></a></li>
<li class="property private "><a
href="#property__drawingData"
title="$_drawingData :: The combined MSODRAWING data (per sheet)"><span
class="description"></span>
<pre>$_drawingData</pre></a></li>
<li class="property private "><a
href="#property__drawingGroupData"
title="$_drawingGroupData :: The combined MSODRAWINGGROUP data"><span
class="description"></span>
<pre>$_drawingGroupData</pre></a></li>
<li class="property private "><a
href="#property__encryption"
title="$_encryption :: The type of encryption in use"><span
class="description"></span>
<pre>$_encryption</pre></a></li>
<li class="property private "><a
href="#property__encryptionStartPos"
title="$_encryptionStartPos :: The position in the stream after which contents are encrypted"><span
class="description"></span>
<pre>$_encryptionStartPos</pre></a></li>
<li class="property private "><a
href="#property__externalBooks"
title="$_externalBooks :: External books"><span
class="description"></span>
<pre>$_externalBooks</pre></a></li>
<li class="property private "><a
href="#property__externalNames"
title="$_externalNames :: External names"><span
class="description"></span>
<pre>$_externalNames</pre></a></li>
<li class="property private "><a href="#property__formats"
title="$_formats :: Shared formats"><span
class="description"></span>
<pre>$_formats</pre></a></li>
<li class="property private "><a href="#property__frozen"
title="$_frozen :: Panes are frozen? (in sheet currently being read)."><span
class="description"></span>
<pre>$_frozen</pre></a></li>
<li class="property private "><a
href="#property__isFitToPages"
title="$_isFitToPages :: Fit printout to number of pages? (in sheet currently being read)."><span
class="description"></span>
<pre>$_isFitToPages</pre></a></li>
<li class="property private "><a
href="#property__mapCellStyleXfIndex"
title="$_mapCellStyleXfIndex :: Mapping of XF index (that is a style XF) to final index in cellStyleXf collection"><span
class="description"></span>
<pre>$_mapCellStyleXfIndex</pre></a></li>
<li class="property private "><a
href="#property__mapCellXfIndex"
title="$_mapCellXfIndex :: Mapping of XF index (that is a cell XF) to final index in cellXf collection"><span
class="description"></span>
<pre>$_mapCellXfIndex</pre></a></li>
<li class="property private "><a href="#property__md5Ctxt"
title="$_md5Ctxt :: The current MD5 context state"><span
class="description"></span>
<pre>$_md5Ctxt</pre></a></li>
<li class="property private "><a href="#property__objFonts"
title="$_objFonts :: Shared fonts"><span class="description"></span>
<pre>$_objFonts</pre></a></li>
<li class="property private "><a href="#property__objs"
title="$_objs :: Objects."><span class="description"></span>
<pre>$_objs</pre></a></li>
<li class="property private "><a href="#property__palette"
title="$_palette :: Color palette"><span class="description"></span>
<pre>$_palette</pre></a></li>
<li class="property private "><a href="#property__phpExcel"
title="$_phpExcel :: Workbook to be returned by the reader."><span
class="description"></span>
<pre>$_phpExcel</pre></a></li>
<li class="property private "><a href="#property__phpSheet"
title="$_phpSheet :: Worksheet that is currently being built by the reader."><span
class="description"></span>
<pre>$_phpSheet</pre></a></li>
<li class="property private "><a href="#property__pos"
title="$_pos :: Current position in stream"><span
class="description"></span>
<pre>$_pos</pre></a></li>
<li class="property private "><a href="#property__rc4Key"
title="$_rc4Key :: The current RC4 decryption object"><span
class="description"></span>
<pre>$_rc4Key</pre></a></li>
<li class="property private "><a href="#property__rc4Pos"
title="$_rc4Pos :: The position in the stream that the RC4 decryption object was left at"><span
class="description"></span>
<pre>$_rc4Pos</pre></a></li>
<li class="property private "><a href="#property__ref"
title="$_ref :: REF structures."><span class="description"></span>
<pre>$_ref</pre></a></li>
<li class="property private "><a
href="#property__sharedFormulaParts"
title="$_sharedFormulaParts :: The shared formula parts in a sheet."><span
class="description"></span>
<pre>$_sharedFormulaParts</pre></a></li>
<li class="property private "><a
href="#property__sharedFormulas"
title="$_sharedFormulas :: The shared formulas in a sheet."><span
class="description"></span>
<pre>$_sharedFormulas</pre></a></li>
<li class="property private "><a href="#property__sheets"
title="$_sheets :: Worksheets"><span class="description"></span>
<pre>$_sheets</pre></a></li>
<li class="property private "><a href="#property__sst"
title="$_sst :: Shared strings."><span class="description"></span>
<pre>$_sst</pre></a></li>
<li class="property private "><a
href="#property__summaryInformation"
title="$_summaryInformation :: Summary Information stream data."><span
class="description"></span>
<pre>$_summaryInformation</pre></a></li>
<li class="property private "><a
href="#property__textObjects"
title="$_textObjects :: Text Objects."><span
class="description"></span>
<pre>$_textObjects</pre></a></li>
<li class="property private "><a
href="#property__userDefinedProperties"
title="$_userDefinedProperties :: User-Defined Properties stream data."><span
class="description"></span>
<pre>$_userDefinedProperties</pre></a></li>
<li class="property private "><a href="#property__version"
title="$_version :: BIFF version"><span class="description"></span>
<pre>$_version</pre></a></li>
<li class="property private "><a href="#property__xfIndex"
title="$_xfIndex :: Keep track of XF index"><span
class="description"></span>
<pre>$_xfIndex</pre></a></li>
</ul>
</li>
<li class="nav-header"><i class="icon-custom icon-constant"></i> Constants
<ul>
<li class="constant "><a
href="#constant_MS_BIFF_CRYPTO_NONE"
title="MS_BIFF_CRYPTO_NONE :: "><span class="description">MS_BIFF_CRYPTO_NONE</span>
<pre>MS_BIFF_CRYPTO_NONE</pre></a></li>
<li class="constant "><a
href="#constant_MS_BIFF_CRYPTO_RC4"
title="MS_BIFF_CRYPTO_RC4 :: "><span class="description">MS_BIFF_CRYPTO_RC4</span>
<pre>MS_BIFF_CRYPTO_RC4</pre></a></li>
<li class="constant "><a
href="#constant_MS_BIFF_CRYPTO_XOR"
title="MS_BIFF_CRYPTO_XOR :: "><span class="description">MS_BIFF_CRYPTO_XOR</span>
<pre>MS_BIFF_CRYPTO_XOR</pre></a></li>
<li class="constant "><a href="#constant_REKEY_BLOCK"
title="REKEY_BLOCK :: "><span class="description">REKEY_BLOCK</span>
<pre>REKEY_BLOCK</pre></a></li>
<li class="constant "><a href="#constant_XLS_BIFF7"
title="XLS_BIFF7 :: "><span class="description">XLS_BIFF7</span>
<pre>XLS_BIFF7</pre></a></li>
<li class="constant "><a href="#constant_XLS_BIFF8"
title="XLS_BIFF8 :: "><span class="description">XLS_BIFF8</span>
<pre>XLS_BIFF8</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_ARRAY"
title="XLS_Type_ARRAY :: "><span class="description">XLS_Type_ARRAY</span>
<pre>XLS_Type_ARRAY</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_BLANK"
title="XLS_Type_BLANK :: "><span class="description">XLS_Type_BLANK</span>
<pre>XLS_Type_BLANK</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_BOF"
title="XLS_Type_BOF :: "><span class="description">XLS_Type_BOF</span>
<pre>XLS_Type_BOF</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_BOOLERR"
title="XLS_Type_BOOLERR :: "><span class="description">XLS_Type_BOOLERR</span>
<pre>XLS_Type_BOOLERR</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_BOTTOMMARGIN"
title="XLS_Type_BOTTOMMARGIN :: "><span class="description">XLS_Type_BOTTOMMARGIN</span>
<pre>XLS_Type_BOTTOMMARGIN</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_CODEPAGE"
title="XLS_Type_CODEPAGE :: "><span class="description">XLS_Type_CODEPAGE</span>
<pre>XLS_Type_CODEPAGE</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_COLINFO"
title="XLS_Type_COLINFO :: "><span class="description">XLS_Type_COLINFO</span>
<pre>XLS_Type_COLINFO</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_CONTINUE"
title="XLS_Type_CONTINUE :: "><span class="description">XLS_Type_CONTINUE</span>
<pre>XLS_Type_CONTINUE</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_DATAVALIDATION"
title="XLS_Type_DATAVALIDATION :: "><span
class="description">XLS_Type_DATAVALIDATION</span>
<pre>XLS_Type_DATAVALIDATION</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_DATAVALIDATIONS"
title="XLS_Type_DATAVALIDATIONS :: "><span
class="description">XLS_Type_DATAVALIDATIONS</span>
<pre>XLS_Type_DATAVALIDATIONS</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_DATEMODE"
title="XLS_Type_DATEMODE :: "><span class="description">XLS_Type_DATEMODE</span>
<pre>XLS_Type_DATEMODE</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_DBCELL"
title="XLS_Type_DBCELL :: "><span class="description">XLS_Type_DBCELL</span>
<pre>XLS_Type_DBCELL</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_DEFAULTROWHEIGHT"
title="XLS_Type_DEFAULTROWHEIGHT :: "><span
class="description">XLS_Type_DEFAULTROWHEIGHT</span>
<pre>XLS_Type_DEFAULTROWHEIGHT</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_DEFCOLWIDTH"
title="XLS_Type_DEFCOLWIDTH :: "><span class="description">XLS_Type_DEFCOLWIDTH</span>
<pre>XLS_Type_DEFCOLWIDTH</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_DEFINEDNAME"
title="XLS_Type_DEFINEDNAME :: "><span class="description">XLS_Type_DEFINEDNAME</span>
<pre>XLS_Type_DEFINEDNAME</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_DIMENSION"
title="XLS_Type_DIMENSION :: "><span class="description">XLS_Type_DIMENSION</span>
<pre>XLS_Type_DIMENSION</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_EOF"
title="XLS_Type_EOF :: "><span class="description">XLS_Type_EOF</span>
<pre>XLS_Type_EOF</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_EXTERNALBOOK"
title="XLS_Type_EXTERNALBOOK :: "><span class="description">XLS_Type_EXTERNALBOOK</span>
<pre>XLS_Type_EXTERNALBOOK</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_EXTERNNAME"
title="XLS_Type_EXTERNNAME :: "><span class="description">XLS_Type_EXTERNNAME</span>
<pre>XLS_Type_EXTERNNAME</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_EXTERNSHEET"
title="XLS_Type_EXTERNSHEET :: "><span class="description">XLS_Type_EXTERNSHEET</span>
<pre>XLS_Type_EXTERNSHEET</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_EXTSST"
title="XLS_Type_EXTSST :: "><span class="description">XLS_Type_EXTSST</span>
<pre>XLS_Type_EXTSST</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_FILEPASS"
title="XLS_Type_FILEPASS :: "><span class="description">XLS_Type_FILEPASS</span>
<pre>XLS_Type_FILEPASS</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_FONT"
title="XLS_Type_FONT :: "><span class="description">XLS_Type_FONT</span>
<pre>XLS_Type_FONT</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_FOOTER"
title="XLS_Type_FOOTER :: "><span class="description">XLS_Type_FOOTER</span>
<pre>XLS_Type_FOOTER</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_FORMAT"
title="XLS_Type_FORMAT :: "><span class="description">XLS_Type_FORMAT</span>
<pre>XLS_Type_FORMAT</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_FORMULA"
title="XLS_Type_FORMULA :: "><span class="description">XLS_Type_FORMULA</span>
<pre>XLS_Type_FORMULA</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_HCENTER"
title="XLS_Type_HCENTER :: "><span class="description">XLS_Type_HCENTER</span>
<pre>XLS_Type_HCENTER</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_HEADER"
title="XLS_Type_HEADER :: "><span class="description">XLS_Type_HEADER</span>
<pre>XLS_Type_HEADER</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_HORIZONTALPAGEBREAKS"
title="XLS_Type_HORIZONTALPAGEBREAKS :: "><span
class="description">XLS_Type_HORIZONTALPAGEBREAKS</span>
<pre>XLS_Type_HORIZONTALPAGEBREAKS</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_HYPERLINK"
title="XLS_Type_HYPERLINK :: "><span class="description">XLS_Type_HYPERLINK</span>
<pre>XLS_Type_HYPERLINK</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_IMDATA"
title="XLS_Type_IMDATA :: "><span class="description">XLS_Type_IMDATA</span>
<pre>XLS_Type_IMDATA</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_INDEX"
title="XLS_Type_INDEX :: "><span class="description">XLS_Type_INDEX</span>
<pre>XLS_Type_INDEX</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_LABEL"
title="XLS_Type_LABEL :: "><span class="description">XLS_Type_LABEL</span>
<pre>XLS_Type_LABEL</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_LABELSST"
title="XLS_Type_LABELSST :: "><span class="description">XLS_Type_LABELSST</span>
<pre>XLS_Type_LABELSST</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_LEFTMARGIN"
title="XLS_Type_LEFTMARGIN :: "><span class="description">XLS_Type_LEFTMARGIN</span>
<pre>XLS_Type_LEFTMARGIN</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_MERGEDCELLS"
title="XLS_Type_MERGEDCELLS :: "><span class="description">XLS_Type_MERGEDCELLS</span>
<pre>XLS_Type_MERGEDCELLS</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_MSODRAWING"
title="XLS_Type_MSODRAWING :: "><span class="description">XLS_Type_MSODRAWING</span>
<pre>XLS_Type_MSODRAWING</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_MSODRAWINGGROUP"
title="XLS_Type_MSODRAWINGGROUP :: "><span
class="description">XLS_Type_MSODRAWINGGROUP</span>
<pre>XLS_Type_MSODRAWINGGROUP</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_MULBLANK"
title="XLS_Type_MULBLANK :: "><span class="description">XLS_Type_MULBLANK</span>
<pre>XLS_Type_MULBLANK</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_MULRK"
title="XLS_Type_MULRK :: "><span class="description">XLS_Type_MULRK</span>
<pre>XLS_Type_MULRK</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_NOTE"
title="XLS_Type_NOTE :: "><span class="description">XLS_Type_NOTE</span>
<pre>XLS_Type_NOTE</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_NUMBER"
title="XLS_Type_NUMBER :: "><span class="description">XLS_Type_NUMBER</span>
<pre>XLS_Type_NUMBER</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_OBJ"
title="XLS_Type_OBJ :: "><span class="description">XLS_Type_OBJ</span>
<pre>XLS_Type_OBJ</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_OBJECTPROTECT"
title="XLS_Type_OBJECTPROTECT :: "><span class="description">XLS_Type_OBJECTPROTECT</span>
<pre>XLS_Type_OBJECTPROTECT</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_PAGELAYOUTVIEW"
title="XLS_Type_PAGELAYOUTVIEW :: "><span
class="description">XLS_Type_PAGELAYOUTVIEW</span>
<pre>XLS_Type_PAGELAYOUTVIEW</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_PAGESETUP"
title="XLS_Type_PAGESETUP :: "><span class="description">XLS_Type_PAGESETUP</span>
<pre>XLS_Type_PAGESETUP</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_PALETTE"
title="XLS_Type_PALETTE :: "><span class="description">XLS_Type_PALETTE</span>
<pre>XLS_Type_PALETTE</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_PANE"
title="XLS_Type_PANE :: "><span class="description">XLS_Type_PANE</span>
<pre>XLS_Type_PANE</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_PASSWORD"
title="XLS_Type_PASSWORD :: "><span class="description">XLS_Type_PASSWORD</span>
<pre>XLS_Type_PASSWORD</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_PRINTGRIDLINES"
title="XLS_Type_PRINTGRIDLINES :: "><span
class="description">XLS_Type_PRINTGRIDLINES</span>
<pre>XLS_Type_PRINTGRIDLINES</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_PROTECT"
title="XLS_Type_PROTECT :: "><span class="description">XLS_Type_PROTECT</span>
<pre>XLS_Type_PROTECT</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_RANGEPROTECTION"
title="XLS_Type_RANGEPROTECTION :: "><span
class="description">XLS_Type_RANGEPROTECTION</span>
<pre>XLS_Type_RANGEPROTECTION</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_RIGHTMARGIN"
title="XLS_Type_RIGHTMARGIN :: "><span class="description">XLS_Type_RIGHTMARGIN</span>
<pre>XLS_Type_RIGHTMARGIN</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_RK"
title="XLS_Type_RK :: "><span class="description">XLS_Type_RK</span>
<pre>XLS_Type_RK</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_ROW"
title="XLS_Type_ROW :: "><span class="description">XLS_Type_ROW</span>
<pre>XLS_Type_ROW</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_SCENPROTECT"
title="XLS_Type_SCENPROTECT :: "><span class="description">XLS_Type_SCENPROTECT</span>
<pre>XLS_Type_SCENPROTECT</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_SCL"
title="XLS_Type_SCL :: "><span class="description">XLS_Type_SCL</span>
<pre>XLS_Type_SCL</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_SELECTION"
title="XLS_Type_SELECTION :: "><span class="description">XLS_Type_SELECTION</span>
<pre>XLS_Type_SELECTION</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_SHAREDFMLA"
title="XLS_Type_SHAREDFMLA :: "><span class="description">XLS_Type_SHAREDFMLA</span>
<pre>XLS_Type_SHAREDFMLA</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_SHEET"
title="XLS_Type_SHEET :: "><span class="description">XLS_Type_SHEET</span>
<pre>XLS_Type_SHEET</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_SHEETLAYOUT"
title="XLS_Type_SHEETLAYOUT :: "><span class="description">XLS_Type_SHEETLAYOUT</span>
<pre>XLS_Type_SHEETLAYOUT</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_SHEETPR"
title="XLS_Type_SHEETPR :: "><span class="description">XLS_Type_SHEETPR</span>
<pre>XLS_Type_SHEETPR</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_SHEETPROTECTION"
title="XLS_Type_SHEETPROTECTION :: "><span
class="description">XLS_Type_SHEETPROTECTION</span>
<pre>XLS_Type_SHEETPROTECTION</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_SST"
title="XLS_Type_SST :: "><span class="description">XLS_Type_SST</span>
<pre>XLS_Type_SST</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_STRING"
title="XLS_Type_STRING :: "><span class="description">XLS_Type_STRING</span>
<pre>XLS_Type_STRING</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_STYLE"
title="XLS_Type_STYLE :: "><span class="description">XLS_Type_STYLE</span>
<pre>XLS_Type_STYLE</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_TOPMARGIN"
title="XLS_Type_TOPMARGIN :: "><span class="description">XLS_Type_TOPMARGIN</span>
<pre>XLS_Type_TOPMARGIN</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_TXO"
title="XLS_Type_TXO :: "><span class="description">XLS_Type_TXO</span>
<pre>XLS_Type_TXO</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_UNKNOWN"
title="XLS_Type_UNKNOWN :: "><span class="description">XLS_Type_UNKNOWN</span>
<pre>XLS_Type_UNKNOWN</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_VCENTER"
title="XLS_Type_VCENTER :: "><span class="description">XLS_Type_VCENTER</span>
<pre>XLS_Type_VCENTER</pre></a></li>
<li class="constant "><a
href="#constant_XLS_Type_VERTICALPAGEBREAKS"
title="XLS_Type_VERTICALPAGEBREAKS :: "><span
class="description">XLS_Type_VERTICALPAGEBREAKS</span>
<pre>XLS_Type_VERTICALPAGEBREAKS</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_WINDOW2"
title="XLS_Type_WINDOW2 :: "><span class="description">XLS_Type_WINDOW2</span>
<pre>XLS_Type_WINDOW2</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_XF"
title="XLS_Type_XF :: "><span class="description">XLS_Type_XF</span>
<pre>XLS_Type_XF</pre></a></li>
<li class="constant "><a href="#constant_XLS_Type_XFEXT"
title="XLS_Type_XFEXT :: "><span class="description">XLS_Type_XFEXT</span>
<pre>XLS_Type_XFEXT</pre></a></li>
<li class="constant "><a
href="#constant_XLS_WorkbookGlobals"
title="XLS_WorkbookGlobals :: "><span class="description">XLS_WorkbookGlobals</span>
<pre>XLS_WorkbookGlobals</pre></a></li>
<li class="constant "><a href="#constant_XLS_Worksheet"
title="XLS_Worksheet :: "><span class="description">XLS_Worksheet</span>
<pre>XLS_Worksheet</pre></a></li>
</ul></li>
</ul>
</div>
<div class="span8">
<a id="\PHPExcel_Reader_Excel5"></a>
<ul class="breadcrumb">
<li><a href="../index.html"><i
class="icon-custom icon-class"></i></a><span class="divider">\</span>
</li>
<li><a href="../namespaces/global.html">global</a></li>
<li class="active"><span class="divider">\</span><a
href="../classes/PHPExcel_Reader_Excel5.html">PHPExcel_Reader_Excel5</a>
</li>
</ul>
<div class="element class">
<p class="short_description">PHPExcel_Reader_Excel5</p>
<div class="details">
<div class="long_description">
<p>
This class uses <a
href="http://sourceforge.net/projects/phpexcelreader/parseXL">http://sourceforge.net/projects/phpexcelreader/parseXL</a>
</p>
</div>
<table class="table table-bordered">
<tr>
<th>category</th>
<td>PHPExcel</td>
</tr>
<tr>
<th>package</th>
<td><a href="../packages/PHPExcel.Reader.Excel5.html">PHPExcel_Reader_Excel5</a></td>
</tr>
<tr>
<th>copyright</th>
<td>Copyright (c) 2006 - 2014 PHPExcel
(http://www.codeplex.com/PHPExcel)</td>
</tr>
</table>
<h3>
<i class="icon-custom icon-method"></i> Methods
</h3>
<a id="method__GetInt2d"></a>
<div class="element clickable method public method__GetInt2d"
data-toggle="collapse" data-target=".method__GetInt2d .collapse">
<h2>Read 16-bit unsigned integer</h2>
<pre>_GetInt2d(string $data, int $pos) : int</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code>
</div>
<div class="subelement argument">
<h4>$pos</h4>
<code>int</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>int</code>
</div>
</div>
</div>
</div>
<a id="method__GetInt4d"></a>
<div class="element clickable method public method__GetInt4d"
data-toggle="collapse" data-target=".method__GetInt4d .collapse">
<h2>Read 32-bit signed integer</h2>
<pre>_GetInt4d(string $data, int $pos) : int</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code>
</div>
<div class="subelement argument">
<h4>$pos</h4>
<code>int</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>int</code>
</div>
</div>
</div>
</div>
<a id="method___construct"></a>
<div class="element clickable method public method___construct"
data-toggle="collapse"
data-target=".method___construct .collapse">
<h2>Create a new PHPExcel_Reader_Excel5 instance</h2>
<pre>__construct() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method_canRead"></a>
<div class="element clickable method public method_canRead"
data-toggle="collapse" data-target=".method_canRead .collapse">
<h2>Can the current PHPExcel_Reader_IReader read the file?</h2>
<pre>canRead(string $pFilename) : boolean</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pFilename</h4>
<code>string</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>boolean</code>
</div>
</div>
</div>
</div>
<a id="method_getIncludeCharts"></a>
<div
class="element clickable method public method_getIncludeCharts"
data-toggle="collapse"
data-target=".method_getIncludeCharts .collapse">
<h2>Read charts in workbook? If this is true, then the
Reader will include any charts that exist in the workbook.</h2>
<pre>getIncludeCharts() : boolean</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Note that a ReadDataOnly value of false overrides, and
charts won't be read regardless of the IncludeCharts value.
If false (the default) it will ignore any charts defined in
the workbook file.</p>
</div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::getIncludeCharts()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>boolean</code>
</div>
</div>
</div>
</div>
<a id="method_getLoadSheetsOnly"></a>
<div
class="element clickable method public method_getLoadSheetsOnly"
data-toggle="collapse"
data-target=".method_getLoadSheetsOnly .collapse">
<h2>Get which sheets to load Returns either an array of
worksheet names (the list of worksheets that should be loaded),
or a null indicating that all worksheets in the workbook should
be loaded.</h2>
<pre>getLoadSheetsOnly() : mixed</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::getLoadSheetsOnly()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>mixed</code>
</div>
</div>
</div>
</div>
<a id="method_getReadDataOnly"></a>
<div
class="element clickable method public method_getReadDataOnly"
data-toggle="collapse"
data-target=".method_getReadDataOnly .collapse">
<h2>Read data only? If this is true, then the Reader will
only read data values for cells, it will not read any formatting
information.</h2>
<pre>getReadDataOnly() : boolean</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>If false (the default) it will read data and
formatting.</p>
</div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::getReadDataOnly()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>boolean</code>
</div>
</div>
</div>
</div>
<a id="method_getReadFilter"></a>
<div class="element clickable method public method_getReadFilter"
data-toggle="collapse"
data-target=".method_getReadFilter .collapse">
<h2>Read filter</h2>
<pre>getReadFilter() : <a
href="../classes/PHPExcel_Reader_IReadFilter.html">\PHPExcel_Reader_IReadFilter</a>
</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::getReadFilter()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>
<a href="../classes/PHPExcel_Reader_IReadFilter.html">\PHPExcel_Reader_IReadFilter</a>
</code>
</div>
</div>
</div>
</div>
<a id="method_listWorksheetInfo"></a>
<div
class="element clickable method public method_listWorksheetInfo"
data-toggle="collapse"
data-target=".method_listWorksheetInfo .collapse">
<h2>Return worksheet info (Name, Last Column Letter, Last
Column Index, Total Rows, Total Columns)</h2>
<pre>listWorksheetInfo(string $pFilename) </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pFilename</h4>
<code>string</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<a id="method_listWorksheetNames"></a>
<div
class="element clickable method public method_listWorksheetNames"
data-toggle="collapse"
data-target=".method_listWorksheetNames .collapse">
<h2>Reads names of the worksheets from a file, without
parsing the whole file to a PHPExcel object</h2>
<pre>listWorksheetNames(string $pFilename) </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pFilename</h4>
<code>string</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<a id="method_load"></a>
<div class="element clickable method public method_load"
data-toggle="collapse" data-target=".method_load .collapse">
<h2>Loads PHPExcel from file</h2>
<pre>load(string $pFilename) : <a
href="../classes/PHPExcel.html">\PHPExcel</a>
</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pFilename</h4>
<code>string</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>
<a href="../classes/PHPExcel.html">\PHPExcel</a>
</code>
</div>
</div>
</div>
</div>
<a id="method_setIncludeCharts"></a>
<div
class="element clickable method public method_setIncludeCharts"
data-toggle="collapse"
data-target=".method_setIncludeCharts .collapse">
<h2>Set read charts in workbook Set to true, to advise the
Reader to include any charts that exist in the workbook.</h2>
<pre>setIncludeCharts(boolean $pValue) : <a
href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Note that a ReadDataOnly value of false overrides, and
charts won't be read regardless of the IncludeCharts value.
Set to false (the default) to discard charts.</p>
</div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::setIncludeCharts()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pValue</h4>
<code>boolean</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>
<a href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</code>
</div>
</div>
</div>
</div>
<a id="method_setLoadAllSheets"></a>
<div
class="element clickable method public method_setLoadAllSheets"
data-toggle="collapse"
data-target=".method_setLoadAllSheets .collapse">
<h2>Set all sheets to load Tells the Reader to load all
worksheets from the workbook.</h2>
<pre>setLoadAllSheets() : <a
href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::setLoadAllSheets()</td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>
<a href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</code>
</div>
</div>
</div>
</div>
<a id="method_setLoadSheetsOnly"></a>
<div
class="element clickable method public method_setLoadSheetsOnly"
data-toggle="collapse"
data-target=".method_setLoadSheetsOnly .collapse">
<h2>Set which sheets to load</h2>
<pre>setLoadSheetsOnly(mixed $value) : <a
href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::setLoadSheetsOnly()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$value</h4>
<code>mixed</code>
<p>This should be either an array of worksheet names to be
loaded, or a string containing a single worksheet name. If
NULL, then it tells the Reader to read all worksheets in the
workbook</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>
<a href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</code>
</div>
</div>
</div>
</div>
<a id="method_setReadDataOnly"></a>
<div
class="element clickable method public method_setReadDataOnly"
data-toggle="collapse"
data-target=".method_setReadDataOnly .collapse">
<h2>Set read data only Set to true, to advise the Reader
only to read data values for cells, and to ignore any formatting
information.</h2>
<pre>setReadDataOnly(boolean $pValue) : <a
href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Set to false (the default) to advise the Reader to read
both data and formatting for cells.</p>
</div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::setReadDataOnly()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pValue</h4>
<code>boolean</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>
<a href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</code>
</div>
</div>
</div>
</div>
<a id="method_setReadFilter"></a>
<div class="element clickable method public method_setReadFilter"
data-toggle="collapse"
data-target=".method_setReadFilter .collapse">
<h2>Set read filter</h2>
<pre>setReadFilter(\PHPExcel_Reader_IReadFilter $pValue) : <a
href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::setReadFilter()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pValue</h4>
<code>
<a href="../classes/PHPExcel_Reader_IReadFilter.html">\PHPExcel_Reader_IReadFilter</a>
</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>
<a href="../classes/PHPExcel_Reader_IReader.html">\PHPExcel_Reader_IReader</a>
</code>
</div>
</div>
</div>
</div>
<a id="method__openFile"></a>
<div class="element clickable method protected method__openFile"
data-toggle="collapse" data-target=".method__openFile .collapse">
<h2>Open file for reading</h2>
<pre>_openFile(string $pFilename) : resource</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::_openFile()</td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pFilename</h4>
<code>string</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>resource</code>
</div>
</div>
</div>
</div>
<a id="method__GetIEEE754"></a>
<div class="element clickable method private method__GetIEEE754"
data-toggle="collapse"
data-target=".method__GetIEEE754 .collapse">
<h2>_GetIEEE754()</h2>
<pre>_GetIEEE754($rknum) </pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$rknum</h4>
</div>
</div>
</div>
</div>
<a id="method__UTF8toExcelDoubleQuoted"></a>
<div
class="element clickable method private method__UTF8toExcelDoubleQuoted"
data-toggle="collapse"
data-target=".method__UTF8toExcelDoubleQuoted .collapse">
<h2>Convert UTF-8 string to string surounded by double
quotes.</h2>
<pre>_UTF8toExcelDoubleQuoted(string $value) : string</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Used for explicit string tokens in formulas. Example:
hello"world --> "hello""world"</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$value</h4>
<code>string</code>
<p>UTF-8 encoded string</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__createFormulaFromTokens"></a>
<div
class="element clickable method private method__createFormulaFromTokens"
data-toggle="collapse"
data-target=".method__createFormulaFromTokens .collapse">
<h2>Take array of tokens together with additional data for
formula and return human readable formula</h2>
<pre>_createFormulaFromTokens(array $tokens, array $additionalData) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$tokens</h4>
<code>array</code>
</div>
<div class="subelement argument">
<h4>$additionalData</h4>
<code>array</code>
<p>Additional binary data going with the formula</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
Human readable formula
</div>
</div>
</div>
</div>
<a id="method__decodeCodepage"></a>
<div
class="element clickable method private method__decodeCodepage"
data-toggle="collapse"
data-target=".method__decodeCodepage .collapse">
<h2>Convert string to UTF-8.</h2>
<pre>_decodeCodepage(string $string) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Only used for BIFF5.</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$string</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__encodeUTF16"></a>
<div class="element clickable method private method__encodeUTF16"
data-toggle="collapse"
data-target=".method__encodeUTF16 .collapse">
<h2>Get UTF-8 string from (compressed or uncompressed)
UTF-16 string</h2>
<pre>_encodeUTF16(string $string, bool $compressed) : string</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$string</h4>
<code>string</code>
</div>
<div class="subelement argument">
<h4>$compressed</h4>
<code>bool</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__extractNumber"></a>
<div
class="element clickable method private method__extractNumber"
data-toggle="collapse"
data-target=".method__extractNumber .collapse">
<h2>Reads first 8 bytes of a string and return IEEE 754
float</h2>
<pre>_extractNumber(string $data) : float</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code>
<p>Binary string that is at least 8 bytes long</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>float</code>
</div>
</div>
</div>
</div>
<a id="method__getFormulaFromData"></a>
<div
class="element clickable method private method__getFormulaFromData"
data-toggle="collapse"
data-target=".method__getFormulaFromData .collapse">
<h2>Take formula data and additional data for formula and
return human readable formula</h2>
<pre>_getFormulaFromData(string $formulaData, string $additionalData, string $baseCell) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$formulaData</h4>
<code>string</code>
<p>The binary data for the formula itself</p>
</div>
<div class="subelement argument">
<h4>$additionalData</h4>
<code>string</code>
<p>Additional binary data going with the formula</p>
</div>
<div class="subelement argument">
<h4>$baseCell</h4>
<code>string</code>
<p>Base cell, only needed when formula contains tRefN
tokens, e.g. with shared formulas</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
Human readable formula
</div>
</div>
</div>
</div>
<a id="method__getFormulaFromStructure"></a>
<div
class="element clickable method private method__getFormulaFromStructure"
data-toggle="collapse"
data-target=".method__getFormulaFromStructure .collapse">
<h2>Convert formula structure into human readable Excel
formula like 'A3+A5*5'</h2>
<pre>_getFormulaFromStructure(string $formulaStructure, string $baseCell) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$formulaStructure</h4>
<code>string</code>
<p>The complete binary data for the formula</p>
</div>
<div class="subelement argument">
<h4>$baseCell</h4>
<code>string</code>
<p>Base cell, only needed when formula contains tRefN
tokens, e.g. with shared formulas</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
Human readable formula
</div>
</div>
</div>
</div>
<a id="method__getNextToken"></a>
<div class="element clickable method private method__getNextToken"
data-toggle="collapse"
data-target=".method__getNextToken .collapse">
<h2>Fetch next token from binary formula data</h2>
<pre>_getNextToken(string $formulaData, string $baseCell) : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$formulaData</h4>
<code>string</code>
<p>Formula data</p>
</div>
<div class="subelement argument">
<h4>$baseCell</h4>
<code>string</code>
<p>Base cell, only needed when formula contains tRefN
tokens, e.g. with shared formulas</p>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__getSplicedRecordData"></a>
<div
class="element clickable method private method__getSplicedRecordData"
data-toggle="collapse"
data-target=".method__getSplicedRecordData .collapse">
<h2>Reads a record from current position in data stream and
continues reading data as long as CONTINUE records are found.</h2>
<pre>_getSplicedRecordData() : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Splices the record data pieces and returns the combined
string as if record data is in one piece. Moves to next
current position in data stream to start of next record
different from a CONtINUE record</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__includeCellRangeFiltered"></a>
<div
class="element clickable method private method__includeCellRangeFiltered"
data-toggle="collapse"
data-target=".method__includeCellRangeFiltered .collapse">
<h2>_includeCellRangeFiltered()</h2>
<pre>_includeCellRangeFiltered($cellRangeAddress) </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$cellRangeAddress</h4>
</div>
</div>
</div>
</div>
<a id="method__loadOLE"></a>
<div class="element clickable method private method__loadOLE"
data-toggle="collapse" data-target=".method__loadOLE .collapse">
<h2>Use OLE reader to extract the relevant data streams from
the OLE file</h2>
<pre>_loadOLE(string $pFilename) </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$pFilename</h4>
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__makeKey"></a>
<div class="element clickable method private method__makeKey"
data-toggle="collapse" data-target=".method__makeKey .collapse">
<h2>Make an RC4 decryptor for the given block</h2>
<pre>_makeKey($block, $valContext) : <a
href="../classes/PHPExcel_Reader_Excel5_RC4.html">\PHPExcel_Reader_Excel5_RC4</a>
</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>var</th>
<td><p>Block for which to create decrypto</p></td>
</tr>
<tr>
<th>var</th>
<td><p>MD5 context state</p></td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$block</h4>
</div>
<div class="subelement argument">
<h4>$valContext</h4>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>
<a href="../classes/PHPExcel_Reader_Excel5_RC4.html">\PHPExcel_Reader_Excel5_RC4</a>
</code>
</div>
</div>
</div>
</div>
<a id="method__mapBorderStyle"></a>
<div
class="element clickable method private method__mapBorderStyle"
data-toggle="collapse"
data-target=".method__mapBorderStyle .collapse">
<h2>Map border style OpenOffice documentation: 2.5.11</h2>
<pre>_mapBorderStyle(int $index) : string</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$index</h4>
<code>int</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__mapBuiltInColor"></a>
<div
class="element clickable method private method__mapBuiltInColor"
data-toggle="collapse"
data-target=".method__mapBuiltInColor .collapse">
<h2>Map built-in color to RGB value</h2>
<pre>_mapBuiltInColor(int $color) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$color</h4>
<code>int</code>
<p>Indexed color</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__mapColor"></a>
<div class="element clickable method private method__mapColor"
data-toggle="collapse" data-target=".method__mapColor .collapse">
<h2>Map color array from BIFF8 built-in color index</h2>
<pre>_mapColor(int $subData) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>int</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__mapColorBIFF5"></a>
<div
class="element clickable method private method__mapColorBIFF5"
data-toggle="collapse"
data-target=".method__mapColorBIFF5 .collapse">
<h2>Map color array from BIFF5 built-in color index</h2>
<pre>_mapColorBIFF5(int $subData) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>int</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__mapErrorCode"></a>
<div class="element clickable method private method__mapErrorCode"
data-toggle="collapse"
data-target=".method__mapErrorCode .collapse">
<h2>Map error code, e.g.</h2>
<pre>_mapErrorCode(int $subData) : string</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>'#N/A'</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>int</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__mapFillPattern"></a>
<div
class="element clickable method private method__mapFillPattern"
data-toggle="collapse"
data-target=".method__mapFillPattern .collapse">
<h2>Get fill pattern from index OpenOffice documentation:
2.5.12</h2>
<pre>_mapFillPattern(int $index) : string</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$index</h4>
<code>int</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__parseRichText"></a>
<div
class="element clickable method private method__parseRichText"
data-toggle="collapse"
data-target=".method__parseRichText .collapse">
<h2>_parseRichText()</h2>
<pre>_parseRichText($is) </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$is</h4>
</div>
</div>
</div>
</div>
<a id="method__readBIFF5CellRangeAddressFixed"></a>
<div
class="element clickable method private method__readBIFF5CellRangeAddressFixed"
data-toggle="collapse"
data-target=".method__readBIFF5CellRangeAddressFixed .collapse">
<h2>Reads a cell range address in BIFF5 e.g.</h2>
<pre>_readBIFF5CellRangeAddressFixed(string $subData) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>'A2:B6' or 'A1' always fixed range section 2.5.14</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__readBIFF5CellRangeAddressList"></a>
<div
class="element clickable method private method__readBIFF5CellRangeAddressList"
data-toggle="collapse"
data-target=".method__readBIFF5CellRangeAddressList .collapse">
<h2>Read BIFF5 cell range address list section 2.5.15</h2>
<pre>_readBIFF5CellRangeAddressList(string $subData) : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readBIFF8CellAddress"></a>
<div
class="element clickable method private method__readBIFF8CellAddress"
data-toggle="collapse"
data-target=".method__readBIFF8CellAddress .collapse">
<h2>Reads a cell address in BIFF8 e.g.</h2>
<pre>_readBIFF8CellAddress(string $cellAddressStructure) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>'A2' or '$A$2' section 3.3.4</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$cellAddressStructure</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__readBIFF8CellAddressB"></a>
<div
class="element clickable method private method__readBIFF8CellAddressB"
data-toggle="collapse"
data-target=".method__readBIFF8CellAddressB .collapse">
<h2>Reads a cell address in BIFF8 for shared formulas.</h2>
<pre>_readBIFF8CellAddressB(string $cellAddressStructure, string $baseCell) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Uses positive and negative values for row and column to
indicate offsets from a base cell section 3.3.4</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$cellAddressStructure</h4>
<code>string</code>
</div>
<div class="subelement argument">
<h4>$baseCell</h4>
<code>string</code>
<p>Base cell, only needed when formula contains tRefN
tokens, e.g. with shared formulas</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__readBIFF8CellRangeAddress"></a>
<div
class="element clickable method private method__readBIFF8CellRangeAddress"
data-toggle="collapse"
data-target=".method__readBIFF8CellRangeAddress .collapse">
<h2>Reads a cell range address in BIFF8 e.g.</h2>
<pre>_readBIFF8CellRangeAddress(string $subData) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>'A2:B6' or '$A$2:$B$6' there are flags indicating
whether column/row index is relative section 3.3.4</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__readBIFF8CellRangeAddressB"></a>
<div
class="element clickable method private method__readBIFF8CellRangeAddressB"
data-toggle="collapse"
data-target=".method__readBIFF8CellRangeAddressB .collapse">
<h2>Reads a cell range address in BIFF8 for shared formulas.</h2>
<pre>_readBIFF8CellRangeAddressB(string $subData, string $baseCell) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Uses positive and negative values for row and column to
indicate offsets from a base cell section 3.3.4</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<div class="subelement argument">
<h4>$baseCell</h4>
<code>string</code>
<p>Base cell</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
Cell range address
</div>
</div>
</div>
</div>
<a id="method__readBIFF8CellRangeAddressFixed"></a>
<div
class="element clickable method private method__readBIFF8CellRangeAddressFixed"
data-toggle="collapse"
data-target=".method__readBIFF8CellRangeAddressFixed .collapse">
<h2>Reads a cell range address in BIFF8 e.g.</h2>
<pre>_readBIFF8CellRangeAddressFixed(string $subData) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>'A2:B6' or 'A1' always fixed range section 2.5.14</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__readBIFF8CellRangeAddressList"></a>
<div
class="element clickable method private method__readBIFF8CellRangeAddressList"
data-toggle="collapse"
data-target=".method__readBIFF8CellRangeAddressList .collapse">
<h2>Read BIFF8 cell range address list section 2.5.15</h2>
<pre>_readBIFF8CellRangeAddressList(string $subData) : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readBIFF8Constant"></a>
<div
class="element clickable method private method__readBIFF8Constant"
data-toggle="collapse"
data-target=".method__readBIFF8Constant .collapse">
<h2>read BIFF8 constant value which may be 'Empty Value',
'Number', 'String Value', 'Boolean Value', 'Error Value' section
2.5.7 returns e.g.</h2>
<pre>_readBIFF8Constant(string $valueData) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>array('value' => '5', 'size' => 9)</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$valueData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readBIFF8ConstantArray"></a>
<div
class="element clickable method private method__readBIFF8ConstantArray"
data-toggle="collapse"
data-target=".method__readBIFF8ConstantArray .collapse">
<h2>read BIFF8 constant value array from array data returns
e.g.</h2>
<pre>_readBIFF8ConstantArray(string $arrayData) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>array('value' => '{1,2;3,4}', 'size' => 40} section
2.5.8</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$arrayData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readBlank"></a>
<div class="element clickable method private method__readBlank"
data-toggle="collapse" data-target=".method__readBlank .collapse">
<h2>Read BLANK record</h2>
<pre>_readBlank() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readBof"></a>
<div class="element clickable method private method__readBof"
data-toggle="collapse" data-target=".method__readBof .collapse">
<h2>Read BOF</h2>
<pre>_readBof() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readBoolErr"></a>
<div class="element clickable method private method__readBoolErr"
data-toggle="collapse"
data-target=".method__readBoolErr .collapse">
<h2>Read BOOLERR record This record represents a Boolean
value or error value cell.</h2>
<pre>_readBoolErr() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readBottomMargin"></a>
<div
class="element clickable method private method__readBottomMargin"
data-toggle="collapse"
data-target=".method__readBottomMargin .collapse">
<h2>Read BOTTOMMARGIN record</h2>
<pre>_readBottomMargin() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readByteStringLong"></a>
<div
class="element clickable method private method__readByteStringLong"
data-toggle="collapse"
data-target=".method__readByteStringLong .collapse">
<h2>Read byte string (16-bit string length) OpenOffice
documentation: 2.5.2</h2>
<pre>_readByteStringLong(string $subData) : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readByteStringShort"></a>
<div
class="element clickable method private method__readByteStringShort"
data-toggle="collapse"
data-target=".method__readByteStringShort .collapse">
<h2>Read byte string (8-bit string length) OpenOffice
documentation: 2.5.2</h2>
<pre>_readByteStringShort(string $subData) : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readCodepage"></a>
<div class="element clickable method private method__readCodepage"
data-toggle="collapse"
data-target=".method__readCodepage .collapse">
<h2>CODEPAGE</h2>
<pre>_readCodepage() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record stores the text encoding used to write byte
strings, stored as MS Windows code page identifier.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readColInfo"></a>
<div class="element clickable method private method__readColInfo"
data-toggle="collapse"
data-target=".method__readColInfo .collapse">
<h2>Read COLINFO record</h2>
<pre>_readColInfo() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readColor"></a>
<div class="element clickable method private method__readColor"
data-toggle="collapse" data-target=".method__readColor .collapse">
<h2>Read color</h2>
<pre>_readColor(int $color, array $palette, $version) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$color</h4>
<code>int</code>
<p>Indexed color</p>
</div>
<div class="subelement argument">
<h4>$palette</h4>
<code>array</code>
<p>Color palette</p>
</div>
<div class="subelement argument">
<h4>$version</h4>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
RGB color value, example: array('rgb' => 'FF0000')
</div>
</div>
</div>
</div>
<a id="method__readContinue"></a>
<div class="element clickable method private method__readContinue"
data-toggle="collapse"
data-target=".method__readContinue .collapse">
<h2>Read a free CONTINUE record.</h2>
<pre>_readContinue() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Free CONTINUE record may be a camouflaged MSODRAWING
record When MSODRAWING data on a sheet exceeds 8224 bytes,
CONTINUE records are used instead. Undocumented. In this
case, we must treat the CONTINUE record as a MSODRAWING
record</p>
</div>
</div>
</div>
</div>
<a id="method__readDataValidation"></a>
<div
class="element clickable method private method__readDataValidation"
data-toggle="collapse"
data-target=".method__readDataValidation .collapse">
<h2>Read DATAVALIDATION record</h2>
<pre>_readDataValidation() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readDataValidations"></a>
<div
class="element clickable method private method__readDataValidations"
data-toggle="collapse"
data-target=".method__readDataValidations .collapse">
<h2>Read DATAVALIDATIONS record</h2>
<pre>_readDataValidations() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readDateMode"></a>
<div class="element clickable method private method__readDateMode"
data-toggle="collapse"
data-target=".method__readDateMode .collapse">
<h2>DATEMODE</h2>
<pre>_readDateMode() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record specifies the base date for displaying date
values. All dates are stored as count of days past this base
date. In BIFF2-BIFF4 this record is part of the Calculation
Settings Block. In BIFF5-BIFF8 it is stored in the Workbook
Globals Substream.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readDefColWidth"></a>
<div
class="element clickable method private method__readDefColWidth"
data-toggle="collapse"
data-target=".method__readDefColWidth .collapse">
<h2>Read DEFCOLWIDTH record</h2>
<pre>_readDefColWidth() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readDefault"></a>
<div class="element clickable method private method__readDefault"
data-toggle="collapse"
data-target=".method__readDefault .collapse">
<h2>Reads a general type of BIFF record.</h2>
<pre>_readDefault() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Does nothing except for moving stream pointer forward
to next record.</p>
</div>
</div>
</div>
</div>
<a id="method__readDefaultRowHeight"></a>
<div
class="element clickable method private method__readDefaultRowHeight"
data-toggle="collapse"
data-target=".method__readDefaultRowHeight .collapse">
<h2>Read DEFAULTROWHEIGHT record</h2>
<pre>_readDefaultRowHeight() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readDefinedName"></a>
<div
class="element clickable method private method__readDefinedName"
data-toggle="collapse"
data-target=".method__readDefinedName .collapse">
<h2>DEFINEDNAME</h2>
<pre>_readDefinedName() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record is part of a Link Table. It contains the
name and the token array of an internal defined name. Token
arrays of defined names contain tokens with aberrant token
classes.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readDocumentSummaryInformation"></a>
<div
class="element clickable method private method__readDocumentSummaryInformation"
data-toggle="collapse"
data-target=".method__readDocumentSummaryInformation .collapse">
<h2>Read additional document summary information</h2>
<pre>_readDocumentSummaryInformation() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readExternName"></a>
<div
class="element clickable method private method__readExternName"
data-toggle="collapse"
data-target=".method__readExternName .collapse">
<h2>Read EXTERNNAME record.</h2>
<pre>_readExternName() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readExternSheet"></a>
<div
class="element clickable method private method__readExternSheet"
data-toggle="collapse"
data-target=".method__readExternSheet .collapse">
<h2>Read EXTERNSHEET record</h2>
<pre>_readExternSheet() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readExternalBook"></a>
<div
class="element clickable method private method__readExternalBook"
data-toggle="collapse"
data-target=".method__readExternalBook .collapse">
<h2>Read EXTERNALBOOK record</h2>
<pre>_readExternalBook() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readFilepass"></a>
<div class="element clickable method private method__readFilepass"
data-toggle="collapse"
data-target=".method__readFilepass .collapse">
<h2>FILEPASS</h2>
<pre>_readFilepass() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record is part of the File Protection Block. It
contains information about the read/write password of the
file. All record contents following this record will be
encrypted.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
<p>The decryption functions and objects used from here on
in are based on the source of Spreadsheet-ParseExcel:
http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel/</p>
</div>
</div>
</div>
</div>
<a id="method__readFont"></a>
<div class="element clickable method private method__readFont"
data-toggle="collapse" data-target=".method__readFont .collapse">
<h2>Read a FONT record</h2>
<pre>_readFont() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readFooter"></a>
<div class="element clickable method private method__readFooter"
data-toggle="collapse"
data-target=".method__readFooter .collapse">
<h2>Read FOOTER record</h2>
<pre>_readFooter() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readFormat"></a>
<div class="element clickable method private method__readFormat"
data-toggle="collapse"
data-target=".method__readFormat .collapse">
<h2>FORMAT</h2>
<pre>_readFormat() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record contains information about a number format.
All FORMAT records occur together in a sequential list.</p>
<p>In BIFF2-BIFF4 other records referencing a FORMAT
record contain a zero-based index into this list. From BIFF5
on the FORMAT record contains the index itself that will be
used by other records.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readFormula"></a>
<div class="element clickable method private method__readFormula"
data-toggle="collapse"
data-target=".method__readFormula .collapse">
<h2>Read FORMULA record + perhaps a following STRING record
if formula result is a string This record contains the token
array and the result of a formula cell.</h2>
<pre>_readFormula() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readHcenter"></a>
<div class="element clickable method private method__readHcenter"
data-toggle="collapse"
data-target=".method__readHcenter .collapse">
<h2>Read HCENTER record</h2>
<pre>_readHcenter() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readHeader"></a>
<div class="element clickable method private method__readHeader"
data-toggle="collapse"
data-target=".method__readHeader .collapse">
<h2>Read HEADER record</h2>
<pre>_readHeader() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readHorizontalPageBreaks"></a>
<div
class="element clickable method private method__readHorizontalPageBreaks"
data-toggle="collapse"
data-target=".method__readHorizontalPageBreaks .collapse">
<h2>Read HORIZONTALPAGEBREAKS record</h2>
<pre>_readHorizontalPageBreaks() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readHyperLink"></a>
<div
class="element clickable method private method__readHyperLink"
data-toggle="collapse"
data-target=".method__readHyperLink .collapse">
<h2>Read HYPERLINK record</h2>
<pre>_readHyperLink() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readImData"></a>
<div class="element clickable method private method__readImData"
data-toggle="collapse"
data-target=".method__readImData .collapse">
<h2>Read IMDATA record</h2>
<pre>_readImData() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readLabel"></a>
<div class="element clickable method private method__readLabel"
data-toggle="collapse" data-target=".method__readLabel .collapse">
<h2>Read LABEL record This record represents a cell that
contains a string.</h2>
<pre>_readLabel() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>In BIFF8 it is usually replaced by the LABELSST record.
Excel still uses this record, if it copies unformatted text
cells to the clipboard.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readLabelSst"></a>
<div class="element clickable method private method__readLabelSst"
data-toggle="collapse"
data-target=".method__readLabelSst .collapse">
<h2>Read LABELSST record This record represents a cell that
contains a string.</h2>
<pre>_readLabelSst() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>It replaces the LABEL record and RSTRING record used in
BIFF2-BIFF5.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readLeftMargin"></a>
<div
class="element clickable method private method__readLeftMargin"
data-toggle="collapse"
data-target=".method__readLeftMargin .collapse">
<h2>Read LEFTMARGIN record</h2>
<pre>_readLeftMargin() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readMergedCells"></a>
<div
class="element clickable method private method__readMergedCells"
data-toggle="collapse"
data-target=".method__readMergedCells .collapse">
<h2>MERGEDCELLS</h2>
<pre>_readMergedCells() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record contains the addresses of merged cell
ranges in the current sheet.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readMsoDrawing"></a>
<div
class="element clickable method private method__readMsoDrawing"
data-toggle="collapse"
data-target=".method__readMsoDrawing .collapse">
<h2>Read MSODRAWING record</h2>
<pre>_readMsoDrawing() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readMsoDrawingGroup"></a>
<div
class="element clickable method private method__readMsoDrawingGroup"
data-toggle="collapse"
data-target=".method__readMsoDrawingGroup .collapse">
<h2>Read MSODRAWINGGROUP record</h2>
<pre>_readMsoDrawingGroup() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readMulBlank"></a>
<div class="element clickable method private method__readMulBlank"
data-toggle="collapse"
data-target=".method__readMulBlank .collapse">
<h2>Read MULBLANK record This record represents a cell range
of empty cells.</h2>
<pre>_readMulBlank() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>All cells are located in the same row</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readMulRk"></a>
<div class="element clickable method private method__readMulRk"
data-toggle="collapse" data-target=".method__readMulRk .collapse">
<h2>Read MULRK record This record represents a cell range
containing RK value cells.</h2>
<pre>_readMulRk() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>All cells are located in the same row.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readNote"></a>
<div class="element clickable method private method__readNote"
data-toggle="collapse" data-target=".method__readNote .collapse">
<h2>The NOTE record specifies a comment associated with a
particular cell.</h2>
<pre>_readNote() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>In Excel 95 (BIFF7) and earlier versions, this record
stores a note (cell note). This feature was significantly
enhanced in Excel 97.</p>
</div>
</div>
</div>
</div>
<a id="method__readNumber"></a>
<div class="element clickable method private method__readNumber"
data-toggle="collapse"
data-target=".method__readNumber .collapse">
<h2>Read NUMBER record This record represents a cell that
contains a floating-point value.</h2>
<pre>_readNumber() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readObj"></a>
<div class="element clickable method private method__readObj"
data-toggle="collapse" data-target=".method__readObj .collapse">
<h2>Read OBJ record</h2>
<pre>_readObj() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readObjectProtect"></a>
<div
class="element clickable method private method__readObjectProtect"
data-toggle="collapse"
data-target=".method__readObjectProtect .collapse">
<h2>OBJECTPROTECT</h2>
<pre>_readObjectProtect() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readPageLayoutView"></a>
<div
class="element clickable method private method__readPageLayoutView"
data-toggle="collapse"
data-target=".method__readPageLayoutView .collapse">
<h2>Read PLV Record(Created by Excel2007 or upper)</h2>
<pre>_readPageLayoutView() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readPageSetup"></a>
<div
class="element clickable method private method__readPageSetup"
data-toggle="collapse"
data-target=".method__readPageSetup .collapse">
<h2>Read PAGESETUP record</h2>
<pre>_readPageSetup() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readPalette"></a>
<div class="element clickable method private method__readPalette"
data-toggle="collapse"
data-target=".method__readPalette .collapse">
<h2>Read PALETTE record</h2>
<pre>_readPalette() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readPane"></a>
<div class="element clickable method private method__readPane"
data-toggle="collapse" data-target=".method__readPane .collapse">
<h2>Read PANE record</h2>
<pre>_readPane() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readPassword"></a>
<div class="element clickable method private method__readPassword"
data-toggle="collapse"
data-target=".method__readPassword .collapse">
<h2>PASSWORD - Sheet protection (hashed) password (BIFF2
through BIFF8)</h2>
<pre>_readPassword() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readPrintGridlines"></a>
<div
class="element clickable method private method__readPrintGridlines"
data-toggle="collapse"
data-target=".method__readPrintGridlines .collapse">
<h2>Read PRINTGRIDLINES record</h2>
<pre>_readPrintGridlines() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readProtect"></a>
<div class="element clickable method private method__readProtect"
data-toggle="collapse"
data-target=".method__readProtect .collapse">
<h2>PROTECT - Sheet protection (BIFF2 through BIFF8) if this
record is omitted, then it also means no sheet protection</h2>
<pre>_readProtect() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readRGB"></a>
<div class="element clickable method private method__readRGB"
data-toggle="collapse" data-target=".method__readRGB .collapse">
<h2>Extract RGB color OpenOffice.org's Documentation of the
Microsoft Excel File Format, section 2.5.4</h2>
<pre>_readRGB(string $rgb) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$rgb</h4>
<code>string</code>
<p>Encoded RGB value (4 bytes)</p>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readRangeProtection"></a>
<div
class="element clickable method private method__readRangeProtection"
data-toggle="collapse"
data-target=".method__readRangeProtection .collapse">
<h2>Read RANGEPROTECTION record Reading of this record is
based on Microsoft Office Excel 97-2000 Binary File Format
Specification, where it is referred to as FEAT record</h2>
<pre>_readRangeProtection() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readRecordData"></a>
<div
class="element clickable method private method__readRecordData"
data-toggle="collapse"
data-target=".method__readRecordData .collapse">
<h2>Read record data from stream, decrypting as required</h2>
<pre>_readRecordData(string $data, int $pos, $len) : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$data</h4>
<code>string</code>
<p>Data stream to read from</p>
</div>
<div class="subelement argument">
<h4>$pos</h4>
<code>int</code>
<p>Position to start reading from</p>
</div>
<div class="subelement argument">
<h4>$len</h4>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
Record data
</div>
</div>
</div>
</div>
<a id="method__readRightMargin"></a>
<div
class="element clickable method private method__readRightMargin"
data-toggle="collapse"
data-target=".method__readRightMargin .collapse">
<h2>Read RIGHTMARGIN record</h2>
<pre>_readRightMargin() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readRk"></a>
<div class="element clickable method private method__readRk"
data-toggle="collapse" data-target=".method__readRk .collapse">
<h2>Read RK record This record represents a cell that
contains an RK value (encoded integer or floating-point value).</h2>
<pre>_readRk() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>If a floating-point value cannot be encoded to an RK
value, a NUMBER record will be written. This record replaces
the record INTEGER written in BIFF2.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readRow"></a>
<div class="element clickable method private method__readRow"
data-toggle="collapse" data-target=".method__readRow .collapse">
<h2>ROW</h2>
<pre>_readRow() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record contains the properties of a single row in
a sheet. Rows and cells in a sheet are divided into blocks of
32 rows.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readScenProtect"></a>
<div
class="element clickable method private method__readScenProtect"
data-toggle="collapse"
data-target=".method__readScenProtect .collapse">
<h2>SCENPROTECT</h2>
<pre>_readScenProtect() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readScl"></a>
<div class="element clickable method private method__readScl"
data-toggle="collapse" data-target=".method__readScl .collapse">
<h2>Read SCL record</h2>
<pre>_readScl() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readSelection"></a>
<div
class="element clickable method private method__readSelection"
data-toggle="collapse"
data-target=".method__readSelection .collapse">
<h2>Read SELECTION record.</h2>
<pre>_readSelection() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>There is one such record for each pane in the sheet.</p>
</div>
</div>
</div>
</div>
<a id="method__readSharedFmla"></a>
<div
class="element clickable method private method__readSharedFmla"
data-toggle="collapse"
data-target=".method__readSharedFmla .collapse">
<h2>Read a SHAREDFMLA record.</h2>
<pre>_readSharedFmla() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This function just stores the binary shared formula in
the reader, which usually contains relative references. These
will be used to construct the formula in each shared formula
part after the sheet is read.</p>
</div>
</div>
</div>
</div>
<a id="method__readSheet"></a>
<div class="element clickable method private method__readSheet"
data-toggle="collapse" data-target=".method__readSheet .collapse">
<h2>SHEET</h2>
<pre>_readSheet() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record is located in the Workbook Globals
Substream and represents a sheet inside the workbook. One
SHEET record is written for each sheet. It stores the sheet
name and a stream offset to the BOF record of the respective
Sheet Substream within the Workbook Stream.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readSheetLayout"></a>
<div
class="element clickable method private method__readSheetLayout"
data-toggle="collapse"
data-target=".method__readSheetLayout .collapse">
<h2>Read SHEETLAYOUT record.</h2>
<pre>_readSheetLayout() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Stores sheet tab color information.</p>
</div>
</div>
</div>
</div>
<a id="method__readSheetPr"></a>
<div class="element clickable method private method__readSheetPr"
data-toggle="collapse"
data-target=".method__readSheetPr .collapse">
<h2>Read SHEETPR record</h2>
<pre>_readSheetPr() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readSheetProtection"></a>
<div
class="element clickable method private method__readSheetProtection"
data-toggle="collapse"
data-target=".method__readSheetProtection .collapse">
<h2>Read SHEETPROTECTION record (FEATHEADR)</h2>
<pre>_readSheetProtection() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readSheetRangeByRefIndex"></a>
<div
class="element clickable method private method__readSheetRangeByRefIndex"
data-toggle="collapse"
data-target=".method__readSheetRangeByRefIndex .collapse">
<h2>Get a sheet range like Sheet1:Sheet3 from REF index
Note: If there is only one sheet in the range, one gets e.g
Sheet1 It can also happen that the REF structure uses the -1
(FFFF) code to indicate deleted sheets, in which case an
PHPExcel_Reader_Exception is thrown</h2>
<pre>_readSheetRangeByRefIndex(int $index) : string | false</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$index</h4>
<code>int</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered">
<tr>
<th><code>
<a href="../classes/PHPExcel_Reader_Exception.html">\PHPExcel_Reader_Exception</a>
</code></th>
<td></td>
</tr>
</table>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
<code>false</code>
</div>
</div>
</div>
</div>
<a id="method__readSst"></a>
<div class="element clickable method private method__readSst"
data-toggle="collapse" data-target=".method__readSst .collapse">
<h2>SST - Shared String Table</h2>
<pre>_readSst() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record contains a list of all strings used
anywhere in the workbook. Each string occurs only once. The
workbook uses indexes into the list to reference the strings.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readString"></a>
<div class="element clickable method private method__readString"
data-toggle="collapse"
data-target=".method__readString .collapse">
<h2>Read a STRING record from current stream position and
advance the stream pointer to next record This record is used
for storing result from FORMULA record when it is a string, and
it occurs directly after the FORMULA record</h2>
<pre>_readString() : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
The string contents as UTF-8
</div>
</div>
</div>
</div>
<a id="method__readStyle"></a>
<div class="element clickable method private method__readStyle"
data-toggle="collapse" data-target=".method__readStyle .collapse">
<h2>Read STYLE record</h2>
<pre>_readStyle() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readSummaryInformation"></a>
<div
class="element clickable method private method__readSummaryInformation"
data-toggle="collapse"
data-target=".method__readSummaryInformation .collapse">
<h2>Read summary information</h2>
<pre>_readSummaryInformation() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readTextObject"></a>
<div
class="element clickable method private method__readTextObject"
data-toggle="collapse"
data-target=".method__readTextObject .collapse">
<h2>The TEXT Object record contains the text associated with
a cell annotation.</h2>
<pre>_readTextObject() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readTopMargin"></a>
<div
class="element clickable method private method__readTopMargin"
data-toggle="collapse"
data-target=".method__readTopMargin .collapse">
<h2>Read TOPMARGIN record</h2>
<pre>_readTopMargin() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readUnicodeString"></a>
<div
class="element clickable method private method__readUnicodeString"
data-toggle="collapse"
data-target=".method__readUnicodeString .collapse">
<h2>Read Unicode string with no string length field, but
with known character count this function is under construction,
needs to support rich text, and Asian phonetic settings
OpenOffice.org's Documentation of the Microsoft Excel File
Format, section 2.5.3</h2>
<pre>_readUnicodeString(string $subData, int $characterCount) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<div class="subelement argument">
<h4>$characterCount</h4>
<code>int</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readUnicodeStringLong"></a>
<div
class="element clickable method private method__readUnicodeStringLong"
data-toggle="collapse"
data-target=".method__readUnicodeStringLong .collapse">
<h2>Extracts an Excel Unicode long string (16-bit string
length) OpenOffice documentation: 2.5.3 this function is under
construction, needs to support rich text, and Asian phonetic
settings</h2>
<pre>_readUnicodeStringLong(string $subData) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readUnicodeStringShort"></a>
<div
class="element clickable method private method__readUnicodeStringShort"
data-toggle="collapse"
data-target=".method__readUnicodeStringShort .collapse">
<h2>Extracts an Excel Unicode short string (8-bit string
length) OpenOffice documentation: 2.5.3 function will
automatically find out where the Unicode string ends.</h2>
<pre>_readUnicodeStringShort(string $subData) : array</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$subData</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>
</div>
</div>
</div>
</div>
<a id="method__readVcenter"></a>
<div class="element clickable method private method__readVcenter"
data-toggle="collapse"
data-target=".method__readVcenter .collapse">
<h2>Read VCENTER record</h2>
<pre>_readVcenter() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readVerticalPageBreaks"></a>
<div
class="element clickable method private method__readVerticalPageBreaks"
data-toggle="collapse"
data-target=".method__readVerticalPageBreaks .collapse">
<h2>Read VERTICALPAGEBREAKS record</h2>
<pre>_readVerticalPageBreaks() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readWindow2"></a>
<div class="element clickable method private method__readWindow2"
data-toggle="collapse"
data-target=".method__readWindow2 .collapse">
<h2>Read WINDOW2 record</h2>
<pre>_readWindow2() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__readXf"></a>
<div class="element clickable method private method__readXf"
data-toggle="collapse" data-target=".method__readXf .collapse">
<h2>XF - Extended Format</h2>
<pre>_readXf() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>This record contains formatting information for cells,
rows, columns or styles. According to
http://support.microsoft.com/kb/147732 there are always at
least 15 cell style XF and 1 cell XF. Inspection of Excel
files generated by MS Office Excel shows that XF records 0-14
are cell style XF and XF record 15 is a cell XF We only read
the first cell style XF and skip the remaining cell style XF
records We read all cell XF records.</p>
<p>-- "OpenOffice.org's Documentation of the Microsoft
Excel File Format"</p>
</div>
</div>
</div>
</div>
<a id="method__readXfExt"></a>
<div class="element clickable method private method__readXfExt"
data-toggle="collapse" data-target=".method__readXfExt .collapse">
<h2>_readXfExt()</h2>
<pre>_readXfExt() </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="method__uncompressByteString"></a>
<div
class="element clickable method private method__uncompressByteString"
data-toggle="collapse"
data-target=".method__uncompressByteString .collapse">
<h2>Convert UTF-16 string in compressed notation to
uncompressed form.</h2>
<pre>_uncompressByteString(string $string) : string</pre>
<div class="labels">
<span class="label">Static</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Only used for BIFF8.</p>
</div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$string</h4>
<code>string</code>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>
</div>
</div>
</div>
</div>
<a id="method__verifyPassword"></a>
<div
class="element clickable method private method__verifyPassword"
data-toggle="collapse"
data-target=".method__verifyPassword .collapse">
<h2>Verify RC4 file password</h2>
<pre>_verifyPassword($password, $docid, $salt_data, $hashedsalt_data, $valContext) : bool</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>var</th>
<td><p>Password to check</p></td>
</tr>
<tr>
<th>var</th>
<td><p>Document id</p></td>
</tr>
<tr>
<th>var</th>
<td><p>Salt data</p></td>
</tr>
<tr>
<th>var</th>
<td><p>Hashed salt data</p></td>
</tr>
<tr>
<th>var</th>
<td><p>&$valContext Set to the MD5 context of the
value</p></td>
</tr>
</table>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$password</h4>
</div>
<div class="subelement argument">
<h4>$docid</h4>
</div>
<div class="subelement argument">
<h4>$salt_data</h4>
</div>
<div class="subelement argument">
<h4>$hashedsalt_data</h4>
</div>
<div class="subelement argument">
<h4>$valContext</h4>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>bool</code>
Success
</div>
</div>
</div>
</div>
<h3>
<i class="icon-custom icon-property"></i> Properties
</h3>
<a id="property__fileHandle"> </a>
<div
class="element clickable property protected property__fileHandle"
data-toggle="collapse"
data-target=".property__fileHandle .collapse">
<h2></h2>
<pre>$_fileHandle </pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::$$_fileHandle</td>
</tr>
</table>
</div>
</div>
</div>
<a id="property__includeCharts"> </a>
<div
class="element clickable property protected property__includeCharts"
data-toggle="collapse"
data-target=".property__includeCharts .collapse">
<h2></h2>
<pre>$_includeCharts : boolean</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::$$_includeCharts</td>
</tr>
</table>
</div>
</div>
</div>
<a id="property__loadSheetsOnly"> </a>
<div
class="element clickable property protected property__loadSheetsOnly"
data-toggle="collapse"
data-target=".property__loadSheetsOnly .collapse">
<h2></h2>
<pre>$_loadSheetsOnly : array</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>If null, then all worksheets will be loaded.</p>
</div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::$$_loadSheetsOnly</td>
</tr>
</table>
</div>
</div>
</div>
<a id="property__readDataOnly"> </a>
<div
class="element clickable property protected property__readDataOnly"
data-toggle="collapse"
data-target=".property__readDataOnly .collapse">
<h2></h2>
<pre>$_readDataOnly : boolean</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::$$_readDataOnly</td>
</tr>
</table>
</div>
</div>
</div>
<a id="property__readFilter"> </a>
<div
class="element clickable property protected property__readFilter"
data-toggle="collapse"
data-target=".property__readFilter .collapse">
<h2></h2>
<pre>$_readFilter : <a
href="../classes/PHPExcel_Reader_IReadFilter.html">\PHPExcel_Reader_IReadFilter</a>
</pre>
<div class="labels">
<span class="label">Inherited</span>
</div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>inherited_from</th>
<td>\PHPExcel_Reader_Abstract::$$_readFilter</td>
</tr>
</table>
</div>
</div>
</div>
<a id="property__cellNotes"> </a>
<div
class="element clickable property private property__cellNotes"
data-toggle="collapse"
data-target=".property__cellNotes .collapse">
<h2></h2>
<pre>$_cellNotes : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__codepage"> </a>
<div class="element clickable property private property__codepage"
data-toggle="collapse"
data-target=".property__codepage .collapse">
<h2></h2>
<pre>$_codepage : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Only important for BIFF5 (Excel 5.0 - Excel 95) For
BIFF8 (Excel 97 - Excel 2003) this will always have the value
'UTF-16LE'</p>
</div>
</div>
</div>
</div>
<a id="property__data"> </a>
<div class="element clickable property private property__data"
data-toggle="collapse" data-target=".property__data .collapse">
<h2></h2>
<pre>$_data : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>(Includes workbook globals substream as well as sheet
substreams)</p>
</div>
</div>
</div>
</div>
<a id="property__dataSize"> </a>
<div class="element clickable property private property__dataSize"
data-toggle="collapse"
data-target=".property__dataSize .collapse">
<h2></h2>
<pre>$_dataSize : int</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__definedname"> </a>
<div
class="element clickable property private property__definedname"
data-toggle="collapse"
data-target=".property__definedname .collapse">
<h2></h2>
<pre>$_definedname : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__documentSummaryInformation"> </a>
<div
class="element clickable property private property__documentSummaryInformation"
data-toggle="collapse"
data-target=".property__documentSummaryInformation .collapse">
<h2></h2>
<pre>$_documentSummaryInformation : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__drawingData"> </a>
<div
class="element clickable property private property__drawingData"
data-toggle="collapse"
data-target=".property__drawingData .collapse">
<h2></h2>
<pre>$_drawingData : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__drawingGroupData"> </a>
<div
class="element clickable property private property__drawingGroupData"
data-toggle="collapse"
data-target=".property__drawingGroupData .collapse">
<h2></h2>
<pre>$_drawingGroupData : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__encryption"> </a>
<div
class="element clickable property private property__encryption"
data-toggle="collapse"
data-target=".property__encryption .collapse">
<h2></h2>
<pre>$_encryption : int</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__encryptionStartPos"> </a>
<div
class="element clickable property private property__encryptionStartPos"
data-toggle="collapse"
data-target=".property__encryptionStartPos .collapse">
<h2></h2>
<pre>$_encryptionStartPos : int</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__externalBooks"> </a>
<div
class="element clickable property private property__externalBooks"
data-toggle="collapse"
data-target=".property__externalBooks .collapse">
<h2></h2>
<pre>$_externalBooks : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__externalNames"> </a>
<div
class="element clickable property private property__externalNames"
data-toggle="collapse"
data-target=".property__externalNames .collapse">
<h2></h2>
<pre>$_externalNames : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__formats"> </a>
<div class="element clickable property private property__formats"
data-toggle="collapse" data-target=".property__formats .collapse">
<h2></h2>
<pre>$_formats : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__frozen"> </a>
<div class="element clickable property private property__frozen"
data-toggle="collapse" data-target=".property__frozen .collapse">
<h2></h2>
<pre>$_frozen : boolean</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>See WINDOW2 record.</p>
</div>
</div>
</div>
</div>
<a id="property__isFitToPages"> </a>
<div
class="element clickable property private property__isFitToPages"
data-toggle="collapse"
data-target=".property__isFitToPages .collapse">
<h2></h2>
<pre>$_isFitToPages : boolean</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>See SHEETPR record.</p>
</div>
</div>
</div>
</div>
<a id="property__mapCellStyleXfIndex"> </a>
<div
class="element clickable property private property__mapCellStyleXfIndex"
data-toggle="collapse"
data-target=".property__mapCellStyleXfIndex .collapse">
<h2></h2>
<pre>$_mapCellStyleXfIndex : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__mapCellXfIndex"> </a>
<div
class="element clickable property private property__mapCellXfIndex"
data-toggle="collapse"
data-target=".property__mapCellXfIndex .collapse">
<h2></h2>
<pre>$_mapCellXfIndex : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__md5Ctxt"> </a>
<div class="element clickable property private property__md5Ctxt"
data-toggle="collapse" data-target=".property__md5Ctxt .collapse">
<h2></h2>
<pre>$_md5Ctxt : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__objFonts"> </a>
<div class="element clickable property private property__objFonts"
data-toggle="collapse"
data-target=".property__objFonts .collapse">
<h2></h2>
<pre>$_objFonts : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__objs"> </a>
<div class="element clickable property private property__objs"
data-toggle="collapse" data-target=".property__objs .collapse">
<h2></h2>
<pre>$_objs : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>One OBJ record contributes with one entry.</p>
</div>
</div>
</div>
</div>
<a id="property__palette"> </a>
<div class="element clickable property private property__palette"
data-toggle="collapse" data-target=".property__palette .collapse">
<h2></h2>
<pre>$_palette : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__phpExcel"> </a>
<div class="element clickable property private property__phpExcel"
data-toggle="collapse"
data-target=".property__phpExcel .collapse">
<h2></h2>
<pre>$_phpExcel : <a href="../classes/PHPExcel.html">\PHPExcel</a>
</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__phpSheet"> </a>
<div class="element clickable property private property__phpSheet"
data-toggle="collapse"
data-target=".property__phpSheet .collapse">
<h2></h2>
<pre>$_phpSheet : <a
href="../classes/PHPExcel_Worksheet.html">\PHPExcel_Worksheet</a>
</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__pos"> </a>
<div class="element clickable property private property__pos"
data-toggle="collapse" data-target=".property__pos .collapse">
<h2></h2>
<pre>$_pos : integer</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__rc4Key"> </a>
<div class="element clickable property private property__rc4Key"
data-toggle="collapse" data-target=".property__rc4Key .collapse">
<h2></h2>
<pre>$_rc4Key : <a
href="../classes/PHPExcel_Reader_Excel5_RC4.html">\PHPExcel_Reader_Excel5_RC4</a>
</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__rc4Pos"> </a>
<div class="element clickable property private property__rc4Pos"
data-toggle="collapse" data-target=".property__rc4Pos .collapse">
<h2></h2>
<pre>$_rc4Pos : int</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__ref"> </a>
<div class="element clickable property private property__ref"
data-toggle="collapse" data-target=".property__ref .collapse">
<h2></h2>
<pre>$_ref : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Only applies to BIFF8.</p>
</div>
</div>
</div>
</div>
<a id="property__sharedFormulaParts"> </a>
<div
class="element clickable property private property__sharedFormulaParts"
data-toggle="collapse"
data-target=".property__sharedFormulaParts .collapse">
<h2></h2>
<pre>$_sharedFormulaParts : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>One FORMULA record contributes with one value if it
refers to a shared formula.</p>
</div>
</div>
</div>
</div>
<a id="property__sharedFormulas"> </a>
<div
class="element clickable property private property__sharedFormulas"
data-toggle="collapse"
data-target=".property__sharedFormulas .collapse">
<h2></h2>
<pre>$_sharedFormulas : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>One SHAREDFMLA record contributes with one value.</p>
</div>
</div>
</div>
</div>
<a id="property__sheets"> </a>
<div class="element clickable property private property__sheets"
data-toggle="collapse" data-target=".property__sheets .collapse">
<h2></h2>
<pre>$_sheets : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__sst"> </a>
<div class="element clickable property private property__sst"
data-toggle="collapse" data-target=".property__sst .collapse">
<h2></h2>
<pre>$_sst : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>Only applies to BIFF8.</p>
</div>
</div>
</div>
</div>
<a id="property__summaryInformation"> </a>
<div
class="element clickable property private property__summaryInformation"
data-toggle="collapse"
data-target=".property__summaryInformation .collapse">
<h2></h2>
<pre>$_summaryInformation : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__textObjects"> </a>
<div
class="element clickable property private property__textObjects"
data-toggle="collapse"
data-target=".property__textObjects .collapse">
<h2></h2>
<pre>$_textObjects : array</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description">
<p>One TXO record corresponds with one entry.</p>
</div>
</div>
</div>
</div>
<a id="property__userDefinedProperties"> </a>
<div
class="element clickable property private property__userDefinedProperties"
data-toggle="collapse"
data-target=".property__userDefinedProperties .collapse">
<h2></h2>
<pre>$_userDefinedProperties : string</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__version"> </a>
<div class="element clickable property private property__version"
data-toggle="collapse" data-target=".property__version .collapse">
<h2></h2>
<pre>$_version : int</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="property__xfIndex"> </a>
<div class="element clickable property private property__xfIndex"
data-toggle="collapse" data-target=".property__xfIndex .collapse">
<h2></h2>
<pre>$_xfIndex : int</pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<h3>
<i class="icon-custom icon-constant"></i> Constants
</h3>
<a id="constant_MS_BIFF_CRYPTO_NONE"> </a>
<div
class="element clickable constant constant_MS_BIFF_CRYPTO_NONE"
data-toggle="collapse"
data-target=".constant_MS_BIFF_CRYPTO_NONE .collapse">
<h2>MS_BIFF_CRYPTO_NONE</h2>
<pre>MS_BIFF_CRYPTO_NONE </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_MS_BIFF_CRYPTO_RC4"> </a>
<div
class="element clickable constant constant_MS_BIFF_CRYPTO_RC4"
data-toggle="collapse"
data-target=".constant_MS_BIFF_CRYPTO_RC4 .collapse">
<h2>MS_BIFF_CRYPTO_RC4</h2>
<pre>MS_BIFF_CRYPTO_RC4 </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_MS_BIFF_CRYPTO_XOR"> </a>
<div
class="element clickable constant constant_MS_BIFF_CRYPTO_XOR"
data-toggle="collapse"
data-target=".constant_MS_BIFF_CRYPTO_XOR .collapse">
<h2>MS_BIFF_CRYPTO_XOR</h2>
<pre>MS_BIFF_CRYPTO_XOR </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_REKEY_BLOCK"> </a>
<div class="element clickable constant constant_REKEY_BLOCK"
data-toggle="collapse"
data-target=".constant_REKEY_BLOCK .collapse">
<h2>REKEY_BLOCK</h2>
<pre>REKEY_BLOCK </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_BIFF7"> </a>
<div class="element clickable constant constant_XLS_BIFF7"
data-toggle="collapse"
data-target=".constant_XLS_BIFF7 .collapse">
<h2>XLS_BIFF7</h2>
<pre>XLS_BIFF7 </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_BIFF8"> </a>
<div class="element clickable constant constant_XLS_BIFF8"
data-toggle="collapse"
data-target=".constant_XLS_BIFF8 .collapse">
<h2>XLS_BIFF8</h2>
<pre>XLS_BIFF8 </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_ARRAY"> </a>
<div class="element clickable constant constant_XLS_Type_ARRAY"
data-toggle="collapse"
data-target=".constant_XLS_Type_ARRAY .collapse">
<h2>XLS_Type_ARRAY</h2>
<pre>XLS_Type_ARRAY </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_BLANK"> </a>
<div class="element clickable constant constant_XLS_Type_BLANK"
data-toggle="collapse"
data-target=".constant_XLS_Type_BLANK .collapse">
<h2>XLS_Type_BLANK</h2>
<pre>XLS_Type_BLANK </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_BOF"> </a>
<div class="element clickable constant constant_XLS_Type_BOF"
data-toggle="collapse"
data-target=".constant_XLS_Type_BOF .collapse">
<h2>XLS_Type_BOF</h2>
<pre>XLS_Type_BOF </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_BOOLERR"> </a>
<div class="element clickable constant constant_XLS_Type_BOOLERR"
data-toggle="collapse"
data-target=".constant_XLS_Type_BOOLERR .collapse">
<h2>XLS_Type_BOOLERR</h2>
<pre>XLS_Type_BOOLERR </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_BOTTOMMARGIN"> </a>
<div
class="element clickable constant constant_XLS_Type_BOTTOMMARGIN"
data-toggle="collapse"
data-target=".constant_XLS_Type_BOTTOMMARGIN .collapse">
<h2>XLS_Type_BOTTOMMARGIN</h2>
<pre>XLS_Type_BOTTOMMARGIN </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_CODEPAGE"> </a>
<div
class="element clickable constant constant_XLS_Type_CODEPAGE"
data-toggle="collapse"
data-target=".constant_XLS_Type_CODEPAGE .collapse">
<h2>XLS_Type_CODEPAGE</h2>
<pre>XLS_Type_CODEPAGE </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_COLINFO"> </a>
<div class="element clickable constant constant_XLS_Type_COLINFO"
data-toggle="collapse"
data-target=".constant_XLS_Type_COLINFO .collapse">
<h2>XLS_Type_COLINFO</h2>
<pre>XLS_Type_COLINFO </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_CONTINUE"> </a>
<div
class="element clickable constant constant_XLS_Type_CONTINUE"
data-toggle="collapse"
data-target=".constant_XLS_Type_CONTINUE .collapse">
<h2>XLS_Type_CONTINUE</h2>
<pre>XLS_Type_CONTINUE </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_DATAVALIDATION"> </a>
<div
class="element clickable constant constant_XLS_Type_DATAVALIDATION"
data-toggle="collapse"
data-target=".constant_XLS_Type_DATAVALIDATION .collapse">
<h2>XLS_Type_DATAVALIDATION</h2>
<pre>XLS_Type_DATAVALIDATION </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_DATAVALIDATIONS"> </a>
<div
class="element clickable constant constant_XLS_Type_DATAVALIDATIONS"
data-toggle="collapse"
data-target=".constant_XLS_Type_DATAVALIDATIONS .collapse">
<h2>XLS_Type_DATAVALIDATIONS</h2>
<pre>XLS_Type_DATAVALIDATIONS </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_DATEMODE"> </a>
<div
class="element clickable constant constant_XLS_Type_DATEMODE"
data-toggle="collapse"
data-target=".constant_XLS_Type_DATEMODE .collapse">
<h2>XLS_Type_DATEMODE</h2>
<pre>XLS_Type_DATEMODE </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_DBCELL"> </a>
<div class="element clickable constant constant_XLS_Type_DBCELL"
data-toggle="collapse"
data-target=".constant_XLS_Type_DBCELL .collapse">
<h2>XLS_Type_DBCELL</h2>
<pre>XLS_Type_DBCELL </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_DEFAULTROWHEIGHT"> </a>
<div
class="element clickable constant constant_XLS_Type_DEFAULTROWHEIGHT"
data-toggle="collapse"
data-target=".constant_XLS_Type_DEFAULTROWHEIGHT .collapse">
<h2>XLS_Type_DEFAULTROWHEIGHT</h2>
<pre>XLS_Type_DEFAULTROWHEIGHT </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_DEFCOLWIDTH"> </a>
<div
class="element clickable constant constant_XLS_Type_DEFCOLWIDTH"
data-toggle="collapse"
data-target=".constant_XLS_Type_DEFCOLWIDTH .collapse">
<h2>XLS_Type_DEFCOLWIDTH</h2>
<pre>XLS_Type_DEFCOLWIDTH </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_DEFINEDNAME"> </a>
<div
class="element clickable constant constant_XLS_Type_DEFINEDNAME"
data-toggle="collapse"
data-target=".constant_XLS_Type_DEFINEDNAME .collapse">
<h2>XLS_Type_DEFINEDNAME</h2>
<pre>XLS_Type_DEFINEDNAME </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_DIMENSION"> </a>
<div
class="element clickable constant constant_XLS_Type_DIMENSION"
data-toggle="collapse"
data-target=".constant_XLS_Type_DIMENSION .collapse">
<h2>XLS_Type_DIMENSION</h2>
<pre>XLS_Type_DIMENSION </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_EOF"> </a>
<div class="element clickable constant constant_XLS_Type_EOF"
data-toggle="collapse"
data-target=".constant_XLS_Type_EOF .collapse">
<h2>XLS_Type_EOF</h2>
<pre>XLS_Type_EOF </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_EXTERNALBOOK"> </a>
<div
class="element clickable constant constant_XLS_Type_EXTERNALBOOK"
data-toggle="collapse"
data-target=".constant_XLS_Type_EXTERNALBOOK .collapse">
<h2>XLS_Type_EXTERNALBOOK</h2>
<pre>XLS_Type_EXTERNALBOOK </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_EXTERNNAME"> </a>
<div
class="element clickable constant constant_XLS_Type_EXTERNNAME"
data-toggle="collapse"
data-target=".constant_XLS_Type_EXTERNNAME .collapse">
<h2>XLS_Type_EXTERNNAME</h2>
<pre>XLS_Type_EXTERNNAME </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_EXTERNSHEET"> </a>
<div
class="element clickable constant constant_XLS_Type_EXTERNSHEET"
data-toggle="collapse"
data-target=".constant_XLS_Type_EXTERNSHEET .collapse">
<h2>XLS_Type_EXTERNSHEET</h2>
<pre>XLS_Type_EXTERNSHEET </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_EXTSST"> </a>
<div class="element clickable constant constant_XLS_Type_EXTSST"
data-toggle="collapse"
data-target=".constant_XLS_Type_EXTSST .collapse">
<h2>XLS_Type_EXTSST</h2>
<pre>XLS_Type_EXTSST </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_FILEPASS"> </a>
<div
class="element clickable constant constant_XLS_Type_FILEPASS"
data-toggle="collapse"
data-target=".constant_XLS_Type_FILEPASS .collapse">
<h2>XLS_Type_FILEPASS</h2>
<pre>XLS_Type_FILEPASS </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_FONT"> </a>
<div class="element clickable constant constant_XLS_Type_FONT"
data-toggle="collapse"
data-target=".constant_XLS_Type_FONT .collapse">
<h2>XLS_Type_FONT</h2>
<pre>XLS_Type_FONT </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_FOOTER"> </a>
<div class="element clickable constant constant_XLS_Type_FOOTER"
data-toggle="collapse"
data-target=".constant_XLS_Type_FOOTER .collapse">
<h2>XLS_Type_FOOTER</h2>
<pre>XLS_Type_FOOTER </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_FORMAT"> </a>
<div class="element clickable constant constant_XLS_Type_FORMAT"
data-toggle="collapse"
data-target=".constant_XLS_Type_FORMAT .collapse">
<h2>XLS_Type_FORMAT</h2>
<pre>XLS_Type_FORMAT </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_FORMULA"> </a>
<div class="element clickable constant constant_XLS_Type_FORMULA"
data-toggle="collapse"
data-target=".constant_XLS_Type_FORMULA .collapse">
<h2>XLS_Type_FORMULA</h2>
<pre>XLS_Type_FORMULA </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_HCENTER"> </a>
<div class="element clickable constant constant_XLS_Type_HCENTER"
data-toggle="collapse"
data-target=".constant_XLS_Type_HCENTER .collapse">
<h2>XLS_Type_HCENTER</h2>
<pre>XLS_Type_HCENTER </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_HEADER"> </a>
<div class="element clickable constant constant_XLS_Type_HEADER"
data-toggle="collapse"
data-target=".constant_XLS_Type_HEADER .collapse">
<h2>XLS_Type_HEADER</h2>
<pre>XLS_Type_HEADER </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_HORIZONTALPAGEBREAKS"> </a>
<div
class="element clickable constant constant_XLS_Type_HORIZONTALPAGEBREAKS"
data-toggle="collapse"
data-target=".constant_XLS_Type_HORIZONTALPAGEBREAKS .collapse">
<h2>XLS_Type_HORIZONTALPAGEBREAKS</h2>
<pre>XLS_Type_HORIZONTALPAGEBREAKS </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_HYPERLINK"> </a>
<div
class="element clickable constant constant_XLS_Type_HYPERLINK"
data-toggle="collapse"
data-target=".constant_XLS_Type_HYPERLINK .collapse">
<h2>XLS_Type_HYPERLINK</h2>
<pre>XLS_Type_HYPERLINK </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_IMDATA"> </a>
<div class="element clickable constant constant_XLS_Type_IMDATA"
data-toggle="collapse"
data-target=".constant_XLS_Type_IMDATA .collapse">
<h2>XLS_Type_IMDATA</h2>
<pre>XLS_Type_IMDATA </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_INDEX"> </a>
<div class="element clickable constant constant_XLS_Type_INDEX"
data-toggle="collapse"
data-target=".constant_XLS_Type_INDEX .collapse">
<h2>XLS_Type_INDEX</h2>
<pre>XLS_Type_INDEX </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_LABEL"> </a>
<div class="element clickable constant constant_XLS_Type_LABEL"
data-toggle="collapse"
data-target=".constant_XLS_Type_LABEL .collapse">
<h2>XLS_Type_LABEL</h2>
<pre>XLS_Type_LABEL </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_LABELSST"> </a>
<div
class="element clickable constant constant_XLS_Type_LABELSST"
data-toggle="collapse"
data-target=".constant_XLS_Type_LABELSST .collapse">
<h2>XLS_Type_LABELSST</h2>
<pre>XLS_Type_LABELSST </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_LEFTMARGIN"> </a>
<div
class="element clickable constant constant_XLS_Type_LEFTMARGIN"
data-toggle="collapse"
data-target=".constant_XLS_Type_LEFTMARGIN .collapse">
<h2>XLS_Type_LEFTMARGIN</h2>
<pre>XLS_Type_LEFTMARGIN </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_MERGEDCELLS"> </a>
<div
class="element clickable constant constant_XLS_Type_MERGEDCELLS"
data-toggle="collapse"
data-target=".constant_XLS_Type_MERGEDCELLS .collapse">
<h2>XLS_Type_MERGEDCELLS</h2>
<pre>XLS_Type_MERGEDCELLS </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_MSODRAWING"> </a>
<div
class="element clickable constant constant_XLS_Type_MSODRAWING"
data-toggle="collapse"
data-target=".constant_XLS_Type_MSODRAWING .collapse">
<h2>XLS_Type_MSODRAWING</h2>
<pre>XLS_Type_MSODRAWING </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_MSODRAWINGGROUP"> </a>
<div
class="element clickable constant constant_XLS_Type_MSODRAWINGGROUP"
data-toggle="collapse"
data-target=".constant_XLS_Type_MSODRAWINGGROUP .collapse">
<h2>XLS_Type_MSODRAWINGGROUP</h2>
<pre>XLS_Type_MSODRAWINGGROUP </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_MULBLANK"> </a>
<div
class="element clickable constant constant_XLS_Type_MULBLANK"
data-toggle="collapse"
data-target=".constant_XLS_Type_MULBLANK .collapse">
<h2>XLS_Type_MULBLANK</h2>
<pre>XLS_Type_MULBLANK </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_MULRK"> </a>
<div class="element clickable constant constant_XLS_Type_MULRK"
data-toggle="collapse"
data-target=".constant_XLS_Type_MULRK .collapse">
<h2>XLS_Type_MULRK</h2>
<pre>XLS_Type_MULRK </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_NOTE"> </a>
<div class="element clickable constant constant_XLS_Type_NOTE"
data-toggle="collapse"
data-target=".constant_XLS_Type_NOTE .collapse">
<h2>XLS_Type_NOTE</h2>
<pre>XLS_Type_NOTE </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_NUMBER"> </a>
<div class="element clickable constant constant_XLS_Type_NUMBER"
data-toggle="collapse"
data-target=".constant_XLS_Type_NUMBER .collapse">
<h2>XLS_Type_NUMBER</h2>
<pre>XLS_Type_NUMBER </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_OBJ"> </a>
<div class="element clickable constant constant_XLS_Type_OBJ"
data-toggle="collapse"
data-target=".constant_XLS_Type_OBJ .collapse">
<h2>XLS_Type_OBJ</h2>
<pre>XLS_Type_OBJ </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_OBJECTPROTECT"> </a>
<div
class="element clickable constant constant_XLS_Type_OBJECTPROTECT"
data-toggle="collapse"
data-target=".constant_XLS_Type_OBJECTPROTECT .collapse">
<h2>XLS_Type_OBJECTPROTECT</h2>
<pre>XLS_Type_OBJECTPROTECT </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_PAGELAYOUTVIEW"> </a>
<div
class="element clickable constant constant_XLS_Type_PAGELAYOUTVIEW"
data-toggle="collapse"
data-target=".constant_XLS_Type_PAGELAYOUTVIEW .collapse">
<h2>XLS_Type_PAGELAYOUTVIEW</h2>
<pre>XLS_Type_PAGELAYOUTVIEW </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_PAGESETUP"> </a>
<div
class="element clickable constant constant_XLS_Type_PAGESETUP"
data-toggle="collapse"
data-target=".constant_XLS_Type_PAGESETUP .collapse">
<h2>XLS_Type_PAGESETUP</h2>
<pre>XLS_Type_PAGESETUP </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_PALETTE"> </a>
<div class="element clickable constant constant_XLS_Type_PALETTE"
data-toggle="collapse"
data-target=".constant_XLS_Type_PALETTE .collapse">
<h2>XLS_Type_PALETTE</h2>
<pre>XLS_Type_PALETTE </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_PANE"> </a>
<div class="element clickable constant constant_XLS_Type_PANE"
data-toggle="collapse"
data-target=".constant_XLS_Type_PANE .collapse">
<h2>XLS_Type_PANE</h2>
<pre>XLS_Type_PANE </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_PASSWORD"> </a>
<div
class="element clickable constant constant_XLS_Type_PASSWORD"
data-toggle="collapse"
data-target=".constant_XLS_Type_PASSWORD .collapse">
<h2>XLS_Type_PASSWORD</h2>
<pre>XLS_Type_PASSWORD </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_PRINTGRIDLINES"> </a>
<div
class="element clickable constant constant_XLS_Type_PRINTGRIDLINES"
data-toggle="collapse"
data-target=".constant_XLS_Type_PRINTGRIDLINES .collapse">
<h2>XLS_Type_PRINTGRIDLINES</h2>
<pre>XLS_Type_PRINTGRIDLINES </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_PROTECT"> </a>
<div class="element clickable constant constant_XLS_Type_PROTECT"
data-toggle="collapse"
data-target=".constant_XLS_Type_PROTECT .collapse">
<h2>XLS_Type_PROTECT</h2>
<pre>XLS_Type_PROTECT </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_RANGEPROTECTION"> </a>
<div
class="element clickable constant constant_XLS_Type_RANGEPROTECTION"
data-toggle="collapse"
data-target=".constant_XLS_Type_RANGEPROTECTION .collapse">
<h2>XLS_Type_RANGEPROTECTION</h2>
<pre>XLS_Type_RANGEPROTECTION </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_RIGHTMARGIN"> </a>
<div
class="element clickable constant constant_XLS_Type_RIGHTMARGIN"
data-toggle="collapse"
data-target=".constant_XLS_Type_RIGHTMARGIN .collapse">
<h2>XLS_Type_RIGHTMARGIN</h2>
<pre>XLS_Type_RIGHTMARGIN </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_RK"> </a>
<div class="element clickable constant constant_XLS_Type_RK"
data-toggle="collapse"
data-target=".constant_XLS_Type_RK .collapse">
<h2>XLS_Type_RK</h2>
<pre>XLS_Type_RK </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_ROW"> </a>
<div class="element clickable constant constant_XLS_Type_ROW"
data-toggle="collapse"
data-target=".constant_XLS_Type_ROW .collapse">
<h2>XLS_Type_ROW</h2>
<pre>XLS_Type_ROW </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SCENPROTECT"> </a>
<div
class="element clickable constant constant_XLS_Type_SCENPROTECT"
data-toggle="collapse"
data-target=".constant_XLS_Type_SCENPROTECT .collapse">
<h2>XLS_Type_SCENPROTECT</h2>
<pre>XLS_Type_SCENPROTECT </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SCL"> </a>
<div class="element clickable constant constant_XLS_Type_SCL"
data-toggle="collapse"
data-target=".constant_XLS_Type_SCL .collapse">
<h2>XLS_Type_SCL</h2>
<pre>XLS_Type_SCL </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SELECTION"> </a>
<div
class="element clickable constant constant_XLS_Type_SELECTION"
data-toggle="collapse"
data-target=".constant_XLS_Type_SELECTION .collapse">
<h2>XLS_Type_SELECTION</h2>
<pre>XLS_Type_SELECTION </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SHAREDFMLA"> </a>
<div
class="element clickable constant constant_XLS_Type_SHAREDFMLA"
data-toggle="collapse"
data-target=".constant_XLS_Type_SHAREDFMLA .collapse">
<h2>XLS_Type_SHAREDFMLA</h2>
<pre>XLS_Type_SHAREDFMLA </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SHEET"> </a>
<div class="element clickable constant constant_XLS_Type_SHEET"
data-toggle="collapse"
data-target=".constant_XLS_Type_SHEET .collapse">
<h2>XLS_Type_SHEET</h2>
<pre>XLS_Type_SHEET </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SHEETLAYOUT"> </a>
<div
class="element clickable constant constant_XLS_Type_SHEETLAYOUT"
data-toggle="collapse"
data-target=".constant_XLS_Type_SHEETLAYOUT .collapse">
<h2>XLS_Type_SHEETLAYOUT</h2>
<pre>XLS_Type_SHEETLAYOUT </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SHEETPR"> </a>
<div class="element clickable constant constant_XLS_Type_SHEETPR"
data-toggle="collapse"
data-target=".constant_XLS_Type_SHEETPR .collapse">
<h2>XLS_Type_SHEETPR</h2>
<pre>XLS_Type_SHEETPR </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SHEETPROTECTION"> </a>
<div
class="element clickable constant constant_XLS_Type_SHEETPROTECTION"
data-toggle="collapse"
data-target=".constant_XLS_Type_SHEETPROTECTION .collapse">
<h2>XLS_Type_SHEETPROTECTION</h2>
<pre>XLS_Type_SHEETPROTECTION </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_SST"> </a>
<div class="element clickable constant constant_XLS_Type_SST"
data-toggle="collapse"
data-target=".constant_XLS_Type_SST .collapse">
<h2>XLS_Type_SST</h2>
<pre>XLS_Type_SST </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_STRING"> </a>
<div class="element clickable constant constant_XLS_Type_STRING"
data-toggle="collapse"
data-target=".constant_XLS_Type_STRING .collapse">
<h2>XLS_Type_STRING</h2>
<pre>XLS_Type_STRING </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_STYLE"> </a>
<div class="element clickable constant constant_XLS_Type_STYLE"
data-toggle="collapse"
data-target=".constant_XLS_Type_STYLE .collapse">
<h2>XLS_Type_STYLE</h2>
<pre>XLS_Type_STYLE </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_TOPMARGIN"> </a>
<div
class="element clickable constant constant_XLS_Type_TOPMARGIN"
data-toggle="collapse"
data-target=".constant_XLS_Type_TOPMARGIN .collapse">
<h2>XLS_Type_TOPMARGIN</h2>
<pre>XLS_Type_TOPMARGIN </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_TXO"> </a>
<div class="element clickable constant constant_XLS_Type_TXO"
data-toggle="collapse"
data-target=".constant_XLS_Type_TXO .collapse">
<h2>XLS_Type_TXO</h2>
<pre>XLS_Type_TXO </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_UNKNOWN"> </a>
<div class="element clickable constant constant_XLS_Type_UNKNOWN"
data-toggle="collapse"
data-target=".constant_XLS_Type_UNKNOWN .collapse">
<h2>XLS_Type_UNKNOWN</h2>
<pre>XLS_Type_UNKNOWN </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_VCENTER"> </a>
<div class="element clickable constant constant_XLS_Type_VCENTER"
data-toggle="collapse"
data-target=".constant_XLS_Type_VCENTER .collapse">
<h2>XLS_Type_VCENTER</h2>
<pre>XLS_Type_VCENTER </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_VERTICALPAGEBREAKS"> </a>
<div
class="element clickable constant constant_XLS_Type_VERTICALPAGEBREAKS"
data-toggle="collapse"
data-target=".constant_XLS_Type_VERTICALPAGEBREAKS .collapse">
<h2>XLS_Type_VERTICALPAGEBREAKS</h2>
<pre>XLS_Type_VERTICALPAGEBREAKS </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_WINDOW2"> </a>
<div class="element clickable constant constant_XLS_Type_WINDOW2"
data-toggle="collapse"
data-target=".constant_XLS_Type_WINDOW2 .collapse">
<h2>XLS_Type_WINDOW2</h2>
<pre>XLS_Type_WINDOW2 </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_XF"> </a>
<div class="element clickable constant constant_XLS_Type_XF"
data-toggle="collapse"
data-target=".constant_XLS_Type_XF .collapse">
<h2>XLS_Type_XF</h2>
<pre>XLS_Type_XF </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Type_XFEXT"> </a>
<div class="element clickable constant constant_XLS_Type_XFEXT"
data-toggle="collapse"
data-target=".constant_XLS_Type_XFEXT .collapse">
<h2>XLS_Type_XFEXT</h2>
<pre>XLS_Type_XFEXT </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_WorkbookGlobals"> </a>
<div
class="element clickable constant constant_XLS_WorkbookGlobals"
data-toggle="collapse"
data-target=".constant_XLS_WorkbookGlobals .collapse">
<h2>XLS_WorkbookGlobals</h2>
<pre>XLS_WorkbookGlobals </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
<a id="constant_XLS_Worksheet"> </a>
<div class="element clickable constant constant_XLS_Worksheet"
data-toggle="collapse"
data-target=".constant_XLS_Worksheet .collapse">
<h2>XLS_Worksheet</h2>
<pre>XLS_Worksheet </pre>
<div class="labels"></div>
<div class="row collapse">
<div class="detail-description">
<div class="long_description"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<footer class="span12">
Template is built using <a
href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a>
and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor
2.0.0a12</a> and<br> generated on 2014-03-02T15:27:35Z.<br>
</footer>
</div>
</div>
</body>
</html>
| 40.180098 | 333 | 0.601192 |
e7521d7d10dc9e4a42bb1da82bffc4a07c5a7cb2 | 1,371 | js | JavaScript | server/modules/survey/service/publish/jobs/nodeDefsValidationJob.js | vbarrois/arena | 89e7af193b8f10c82c85258192294c6db4d23693 | [
"MIT"
] | null | null | null | server/modules/survey/service/publish/jobs/nodeDefsValidationJob.js | vbarrois/arena | 89e7af193b8f10c82c85258192294c6db4d23693 | [
"MIT"
] | null | null | null | server/modules/survey/service/publish/jobs/nodeDefsValidationJob.js | vbarrois/arena | 89e7af193b8f10c82c85258192294c6db4d23693 | [
"MIT"
] | 1 | 2020-10-12T13:36:55.000Z | 2020-10-12T13:36:55.000Z | import * as R from 'ramda'
import Job from '@server/job/job'
import * as Survey from '@core/survey/survey'
import * as NodeDef from '@core/survey/nodeDef'
import * as Validation from '@core/validation/validation'
import * as SurveyManager from '../../../manager/surveyManager'
export default class NodeDefsValidationJob extends Job {
constructor(params) {
super(NodeDefsValidationJob.type, params)
}
async execute() {
const survey = await SurveyManager.fetchSurveyById(this.surveyId, true, false, this.tx)
const cycleKeys = R.pipe(Survey.getSurveyInfo, Survey.getCycleKeys)(survey)
for (const cycle of cycleKeys) {
const surveyAndNodeDefs = await SurveyManager.fetchSurveyAndNodeDefsBySurveyId(
this.surveyId,
cycle,
true,
true,
true,
false,
this.tx,
)
R.pipe(
Survey.getNodeDefsValidation,
Validation.getFieldValidations,
R.forEachObjIndexed((nodeDefValidation, nodeDefUuid) => {
const nodeDef = Survey.getNodeDefByUuid(nodeDefUuid)(surveyAndNodeDefs)
this.errors[NodeDef.getName(nodeDef)] = Validation.getFieldValidations(nodeDefValidation)
}),
)(surveyAndNodeDefs)
}
if (!R.isEmpty(this.errors)) {
await this.setStatusFailed()
}
}
}
NodeDefsValidationJob.type = 'NodeDefsValidationJob'
| 29.170213 | 99 | 0.685631 |
2f3572843c22c1dd914d648180b29730c853ff53 | 1,870 | java | Java | src/org/callimachusproject/engine/impl/FallbackLocation.java | Thellmann/callimachus | fbb061d673bcda7f7aa113af5956beb10d880267 | [
"ECL-2.0",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/org/callimachusproject/engine/impl/FallbackLocation.java | Thellmann/callimachus | fbb061d673bcda7f7aa113af5956beb10d880267 | [
"ECL-2.0",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/org/callimachusproject/engine/impl/FallbackLocation.java | Thellmann/callimachus | fbb061d673bcda7f7aa113af5956beb10d880267 | [
"ECL-2.0",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | package org.callimachusproject.engine.impl;
import javax.xml.stream.Location;
import javax.xml.stream.events.XMLEvent;
public class FallbackLocation implements Location {
public static Location newInstance(XMLEvent primary, XMLEvent secondary) {
return newInstance(primary.getLocation(), secondary.getLocation());
}
public static Location newInstance(Location primary, Location secondary) {
if (primary == null)
return secondary;
if (secondary == null)
return primary;
return new FallbackLocation(primary, secondary);
}
private final Location primary;
private final Location secondary;
private FallbackLocation(Location primary, Location secondary) {
this.primary = primary;
this.secondary = secondary;
}
public int getLineNumber() {
if (primary.getLineNumber() >= 0)
return primary.getLineNumber();
return secondary.getLineNumber();
}
public int getColumnNumber() {
if (primary.getColumnNumber() >= 0)
return primary.getColumnNumber();
return secondary.getColumnNumber();
}
public int getCharacterOffset() {
if (primary.getCharacterOffset() >= 0)
return primary.getCharacterOffset();
return secondary.getCharacterOffset();
}
public String getPublicId() {
if (primary.getPublicId() != null)
return primary.getPublicId();
return secondary.getPublicId();
}
public String getSystemId() {
if (primary.getPublicId() != null)
return primary.getPublicId();
return secondary.getPublicId();
}
public String toString() {
StringBuffer sbuffer = new StringBuffer();
sbuffer.append("Line number = " + getLineNumber());
sbuffer.append("\nColumn number = " + getColumnNumber());
sbuffer.append("\nSystem Id = " + getSystemId());
sbuffer.append("\nPublic Id = " + getPublicId());
sbuffer.append("\nCharacterOffset = " + getCharacterOffset());
return sbuffer.append("\n").toString();
}
}
| 27.5 | 75 | 0.729947 |
039256ecebd0c2a96603101212387463030fa1be | 3,107 | lua | Lua | Lua/FrameXML/Blizzard_APIDocumentation/QuestSessionConstantsDocumentation.lua | Nightwarden24/vscode-wow-api | ca59dfc2fb931672b476177ec7155a835b1b6681 | [
"MIT"
] | null | null | null | Lua/FrameXML/Blizzard_APIDocumentation/QuestSessionConstantsDocumentation.lua | Nightwarden24/vscode-wow-api | ca59dfc2fb931672b476177ec7155a835b1b6681 | [
"MIT"
] | null | null | null | Lua/FrameXML/Blizzard_APIDocumentation/QuestSessionConstantsDocumentation.lua | Nightwarden24/vscode-wow-api | ca59dfc2fb931672b476177ec7155a835b1b6681 | [
"MIT"
] | null | null | null | local QuestSessionConstants =
{
Tables =
{
{
Name = "QuestSessionCommand",
Type = "Enumeration",
NumValues = 4,
MinValue = 0,
MaxValue = 3,
Fields =
{
{ Name = "None", Type = "QuestSessionCommand", EnumValue = 0 },
{ Name = "Start", Type = "QuestSessionCommand", EnumValue = 1 },
{ Name = "Stop", Type = "QuestSessionCommand", EnumValue = 2 },
{ Name = "SessionActiveNoCommand", Type = "QuestSessionCommand", EnumValue = 3 },
},
},
{
Name = "QuestSessionResult",
Type = "Enumeration",
NumValues = 33,
MinValue = 0,
MaxValue = 32,
Fields =
{
{ Name = "Ok", Type = "QuestSessionResult", EnumValue = 0 },
{ Name = "NotInParty", Type = "QuestSessionResult", EnumValue = 1 },
{ Name = "InvalidOwner", Type = "QuestSessionResult", EnumValue = 2 },
{ Name = "AlreadyActive", Type = "QuestSessionResult", EnumValue = 3 },
{ Name = "NotActive", Type = "QuestSessionResult", EnumValue = 4 },
{ Name = "InRaid", Type = "QuestSessionResult", EnumValue = 5 },
{ Name = "OwnerRefused", Type = "QuestSessionResult", EnumValue = 6 },
{ Name = "Timeout", Type = "QuestSessionResult", EnumValue = 7 },
{ Name = "Disabled", Type = "QuestSessionResult", EnumValue = 8 },
{ Name = "Started", Type = "QuestSessionResult", EnumValue = 9 },
{ Name = "Stopped", Type = "QuestSessionResult", EnumValue = 10 },
{ Name = "Joined", Type = "QuestSessionResult", EnumValue = 11 },
{ Name = "Left", Type = "QuestSessionResult", EnumValue = 12 },
{ Name = "OwnerLeft", Type = "QuestSessionResult", EnumValue = 13 },
{ Name = "ReadyCheckFailed", Type = "QuestSessionResult", EnumValue = 14 },
{ Name = "PartyDestroyed", Type = "QuestSessionResult", EnumValue = 15 },
{ Name = "MemberTimeout", Type = "QuestSessionResult", EnumValue = 16 },
{ Name = "AlreadyMember", Type = "QuestSessionResult", EnumValue = 17 },
{ Name = "NotOwner", Type = "QuestSessionResult", EnumValue = 18 },
{ Name = "AlreadyOwner", Type = "QuestSessionResult", EnumValue = 19 },
{ Name = "AlreadyJoined", Type = "QuestSessionResult", EnumValue = 20 },
{ Name = "NotMember", Type = "QuestSessionResult", EnumValue = 21 },
{ Name = "Busy", Type = "QuestSessionResult", EnumValue = 22 },
{ Name = "JoinRejected", Type = "QuestSessionResult", EnumValue = 23 },
{ Name = "Logout", Type = "QuestSessionResult", EnumValue = 24 },
{ Name = "Empty", Type = "QuestSessionResult", EnumValue = 25 },
{ Name = "QuestNotCompleted", Type = "QuestSessionResult", EnumValue = 26 },
{ Name = "Resync", Type = "QuestSessionResult", EnumValue = 27 },
{ Name = "Restricted", Type = "QuestSessionResult", EnumValue = 28 },
{ Name = "InPetBattle", Type = "QuestSessionResult", EnumValue = 29 },
{ Name = "InvalidPublicParty", Type = "QuestSessionResult", EnumValue = 30 },
{ Name = "Unknown", Type = "QuestSessionResult", EnumValue = 31 },
{ Name = "InCombat", Type = "QuestSessionResult", EnumValue = 32 },
},
},
},
};
APIDocumentation:AddDocumentationTable(QuestSessionConstants); | 47.8 | 85 | 0.625362 |
80ba7f382465c062e28841dc998229f35533d6fb | 3,375 | java | Java | harness/src/test/java/org/apache/geode/perftest/yardstick/hdrhistogram/HdrHistogramProbeTest.java | rhoughton-pivot/geode-benchmarks | 9819b5f39c3f7dbbd25e467a9af9f60db368d949 | [
"Apache-2.0"
] | null | null | null | harness/src/test/java/org/apache/geode/perftest/yardstick/hdrhistogram/HdrHistogramProbeTest.java | rhoughton-pivot/geode-benchmarks | 9819b5f39c3f7dbbd25e467a9af9f60db368d949 | [
"Apache-2.0"
] | null | null | null | harness/src/test/java/org/apache/geode/perftest/yardstick/hdrhistogram/HdrHistogramProbeTest.java | rhoughton-pivot/geode-benchmarks | 9819b5f39c3f7dbbd25e467a9af9f60db368d949 | [
"Apache-2.0"
] | null | null | null | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.geode.perftest.yardstick.hdrhistogram;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Collection;
import java.util.function.Consumer;
import org.HdrHistogram.Histogram;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.yardstickframework.BenchmarkProbePoint;
public class HdrHistogramProbeTest {
private HdrHistogramProbe probe;
private Clock clock;
private Consumer consumer;
@BeforeEach
public void setUp() {
clock = mock(Clock.class);
consumer = mock(Consumer.class);
probe = new HdrHistogramProbe(1, 3_600_000, 3, clock, consumer);
}
@Test
public void recordsASingleValue() throws InterruptedException {
probe.start(8);
when(clock.currentTimeNanos()).thenReturn(0L);
probe.beforeExecute(1);
when(clock.currentTimeNanos()).thenReturn(2L);
probe.afterExecute(1);
Histogram histogram = probe.getHistogram();
assertEquals(2, histogram.getMaxValue());
System.out.println("Size=" + histogram.getEstimatedFootprintInBytes());
}
@Test
public void recordsFromMultipleThreads() {
probe.start(3);
when(clock.currentTimeNanos()).thenReturn(0L);
probe.beforeExecute(0);
when(clock.currentTimeNanos()).thenReturn(1L);
probe.beforeExecute(2);
when(clock.currentTimeNanos()).thenReturn(1L);
probe.beforeExecute(1);
when(clock.currentTimeNanos()).thenReturn(3L);
probe.afterExecute(2);
when(clock.currentTimeNanos()).thenReturn(3L);
probe.afterExecute(1);
when(clock.currentTimeNanos()).thenReturn(4L);
probe.afterExecute(0);
assertEquals(4, probe.getHistogram().getMaxValue());
assertEquals(8.0 / 3.0, probe.getHistogram().getMean(), 0.01);
}
@Test
public void generatesASummaryBenchmarkPoint() throws Exception {
probe.start(1);
when(clock.currentTimeNanos()).thenReturn(0L);
probe.beforeExecute(0);
when(clock.currentTimeNanos()).thenReturn(2L);
probe.afterExecute(0);
probe.beforeExecute(0);
when(clock.currentTimeNanos()).thenReturn(6L);
probe.afterExecute(0);
when(clock.currentTimeNanos()).thenReturn(8L);
probe.stop();
Collection<BenchmarkProbePoint> points = probe.points();
assertEquals(1, points.size());
BenchmarkProbePoint point = points.iterator().next();
assertEquals(0, point.time());
Assertions.assertThat(point.values()).containsExactly(3.0, 4.0);
}
}
| 31.542056 | 75 | 0.734222 |
a19c0fccdc39d985480b7f183d1c290aed2ed209 | 1,176 | go | Go | internal/loader/tag_test.go | caixw/blo | cc4fc931b935d3ab2d19ce24569ee9d82a833856 | [
"MIT"
] | 8 | 2021-04-01T07:17:50.000Z | 2022-03-23T15:59:17.000Z | internal/loader/tag_test.go | caixw/blo | cc4fc931b935d3ab2d19ce24569ee9d82a833856 | [
"MIT"
] | null | null | null | internal/loader/tag_test.go | caixw/blo | cc4fc931b935d3ab2d19ce24569ee9d82a833856 | [
"MIT"
] | 2 | 2021-10-30T15:02:59.000Z | 2022-01-04T10:33:20.000Z | // SPDX-License-Identifier: MIT
package loader
import (
"io/fs"
"testing"
"github.com/issue9/assert/v2"
"github.com/caixw/blogit/v2/internal/locale"
"github.com/caixw/blogit/v2/internal/testdata"
)
func TestTag_sanitize(t *testing.T) {
a := assert.New(t, false)
tag := &Tag{}
a.Error(tag.sanitize(nil))
tag.Slug = "s1"
a.Error(tag.sanitize(nil))
tag.Title = "t1"
a.Error(tag.sanitize(nil))
tag.Content = "c1"
a.NotError(tag.sanitize(nil))
a.NotError(tag.sanitize(&Tags{Tags: []*Tag{tag}}))
p, err := locale.NewPrinter()
a.NotError(err).NotNil(p)
e := tag.sanitize(&Tags{Tags: []*Tag{tag, tag}})
a.Contains(e.LocaleString(p), p.Sprintf("duplicate value"))
}
func TestLoadTags(t *testing.T) {
a := assert.New(t, false)
tags, err := LoadTags(testdata.Source, "tags.yaml")
a.NotError(err).NotNil(tags).Equal(tags.Title, "标签").Equal(tags.OrderType, TagOrderTypeSize)
a.Equal(4, len(tags.Tags))
a.Equal(tags.Tags[0].Slug, "default").
Equal(tags.Tags[1].Slug, "api").
Equal(tags.Tags[2].Slug, "firefox").
Equal(tags.Tags[3].Slug, "git")
tags, err = LoadTags(testdata.Source, "not-exists.yaml")
a.ErrorIs(err, fs.ErrNotExist).Empty(tags)
}
| 23.52 | 93 | 0.679422 |
f06c0a436a6bd375e7b53e8c96203ec37cc92572 | 1,624 | py | Python | tests/fixtures/specification.py | FlyingBird95/openapi_generator | df4649b9723eb89fa370b02220356b7596794069 | [
"MIT"
] | 3 | 2022-01-10T12:43:36.000Z | 2022-01-13T18:08:15.000Z | tests/fixtures/specification.py | FlyingBird95/openapi_generator | df4649b9723eb89fa370b02220356b7596794069 | [
"MIT"
] | 6 | 2021-12-09T20:08:19.000Z | 2021-12-21T13:31:54.000Z | tests/fixtures/specification.py | FlyingBird95/openapi-builder | df4649b9723eb89fa370b02220356b7596794069 | [
"MIT"
] | 2 | 2021-12-17T17:26:06.000Z | 2021-12-17T17:39:00.000Z | from pytest_factoryboy import register
from tests.factories.specification import (
CallbackFactory,
ComponentsFactory,
ContactFactory,
DiscriminatorFactory,
EncodingFactory,
ExampleFactory,
ExternalDocumentationFactory,
HeaderFactory,
InfoFactory,
LicenseFactory,
LinkFactory,
MediaTypeFactory,
OAuthFlowFactory,
OAuthFlowsFactory,
OpenAPIFactory,
OperationFactory,
ParameterFactory,
PathItemFactory,
PathsFactory,
ReferenceFactory,
RequestBodyFactory,
ResponseFactory,
ResponsesFactory,
SchemaFactory,
SecurityRequirementFactory,
SecuritySchemeFactory,
ServerFactory,
ServerVariableFactory,
TagFactory,
)
register(OpenAPIFactory)
register(InfoFactory)
register(ContactFactory)
register(LicenseFactory)
register(ServerFactory)
register(ServerVariableFactory)
register(ComponentsFactory)
register(PathsFactory)
register(PathItemFactory)
register(OperationFactory)
register(ExternalDocumentationFactory)
register(ParameterFactory)
register(RequestBodyFactory)
register(MediaTypeFactory)
register(EncodingFactory)
register(ResponsesFactory)
register(ResponseFactory)
register(CallbackFactory)
register(ExampleFactory)
register(LinkFactory)
register(HeaderFactory)
register(TagFactory)
register(ReferenceFactory)
register(SchemaFactory)
register(SchemaFactory, "second_schema")
register(DiscriminatorFactory)
register(SecuritySchemeFactory)
register(OAuthFlowsFactory, "oauth_flows")
register(OAuthFlowFactory, "oauth_flow")
register(OAuthFlowFactory, "second_oauth_flow")
register(SecurityRequirementFactory)
| 24.606061 | 47 | 0.816502 |
70844e453ccedbcf741ae01c9490ab75eb04d936 | 855 | cs | C# | samples/ContactListWithMvvmLight/ContactViewModel.cs | envicase/flip | 56baa7558c915ae7b75f185eab34dec1dfecfc6a | [
"MIT"
] | 16 | 2015-10-13T02:16:39.000Z | 2021-08-08T07:50:24.000Z | samples/ContactListWithMvvmLight/ContactViewModel.cs | envicase/flip | 56baa7558c915ae7b75f185eab34dec1dfecfc6a | [
"MIT"
] | 13 | 2015-10-29T02:39:12.000Z | 2016-03-07T17:53:31.000Z | samples/ContactListWithMvvmLight/ContactViewModel.cs | envicase/flip | 56baa7558c915ae7b75f185eab34dec1dfecfc6a | [
"MIT"
] | 3 | 2015-10-06T12:50:28.000Z | 2018-10-23T13:54:02.000Z | using System;
using System.Reactive.Linq;
using Flip;
using GalaSoft.MvvmLight;
namespace ContactListWithMvvmLight
{
public class ContactViewModel : ViewModelBase
{
public static readonly StreamFactory<int, Contact> StreamFactory =
new StreamFactory<int, Contact>();
private readonly IConnection<int, Contact> _connection;
private Contact _model;
public ContactViewModel(Contact model)
{
_connection = StreamFactory.Connect(model.Id);
_connection.Subscribe(m => Model = m);
_connection.Emit(model);
}
protected IConnection<Contact> Connection => _connection;
public Contact Model
{
get { return _model; }
private set { Set(ref _model, value); }
}
}
}
| 26.71875 | 75 | 0.60117 |
1f21d0ee3d48cea36c229a708b2e0f0c6484c60e | 1,211 | kt | Kotlin | src/main/kotlin/io/fabric8/launcher/booster/catalog/rhoar/Runtime.kt | quintesse/launcher-booster-catalog-service | 20a79d4d91d6f226bfe8276d43323e13d4c05b03 | [
"Apache-2.0"
] | null | null | null | src/main/kotlin/io/fabric8/launcher/booster/catalog/rhoar/Runtime.kt | quintesse/launcher-booster-catalog-service | 20a79d4d91d6f226bfe8276d43323e13d4c05b03 | [
"Apache-2.0"
] | null | null | null | src/main/kotlin/io/fabric8/launcher/booster/catalog/rhoar/Runtime.kt | quintesse/launcher-booster-catalog-service | 20a79d4d91d6f226bfe8276d43323e13d4c05b03 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package io.fabric8.launcher.booster.catalog.rhoar
import java.util.Collections
import java.util.Objects
/**
* This type is used to group boosters into "Runtimes",
* where a runtime is the technology that is used to
* to develop and execute the booster's code
*/
class Runtime @JvmOverloads constructor(id: String,
name: String = id,
description: String? = null,
metadata: Map<String, Any?> = emptyMap(),
val icon: String? = null,
val versions: Map<String, Version> = emptyMap())
: AbstractCategory(id, name, description, metadata) {
val pipelinePlatform: String
get() = Objects.toString(metadata.getOrDefault(KEY_PIPELINE_PLATFORM, DEFAULT_PIPELINE_PLATFORM))
companion object {
const val KEY_PIPELINE_PLATFORM = "pipelinePlatform"
const val DEFAULT_PIPELINE_PLATFORM = "maven"
}
} | 36.69697 | 105 | 0.607762 |
b82c7e5a864cface4226ba9a8038e7a5459f17e9 | 2,456 | swift | Swift | stts/Services/Heroku.swift | roopakv/stts | ffdf7e88e0f81120930d4c57e69cb4109b9c9a88 | [
"MIT"
] | null | null | null | stts/Services/Heroku.swift | roopakv/stts | ffdf7e88e0f81120930d4c57e69cb4109b9c9a88 | [
"MIT"
] | null | null | null | stts/Services/Heroku.swift | roopakv/stts | ffdf7e88e0f81120930d4c57e69cb4109b9c9a88 | [
"MIT"
] | null | null | null | //
// Heroku.swift
// stts
//
import Foundation
private struct HerokuStatusResponse: Codable {
struct HerokuStatus: Codable {
enum CodingKeys: String, CodingKey {
case production = "Production"
case development = "Development"
}
enum Status: String, Codable {
case green
case red
case yellow
case blue
var status: ServiceStatus {
switch self {
case .green: return .good
case .red: return .major
case .yellow: return .minor
case .blue: return .maintenance
}
}
}
let production: Status
let development: Status
}
struct HerokuIssue: Codable {
let title: String
}
let status: HerokuStatus
let issues: [HerokuIssue]
}
class Heroku: Service {
let url = URL(string: "https://status.heroku.com")!
override func updateStatus(callback: @escaping (BaseService) -> Void) {
let statusURL = URL(string: "https://status.heroku.com/api/v3/current-status")!
loadData(with: statusURL) { [weak self] data, _, error in
guard let strongSelf = self else { return }
defer { callback(strongSelf) }
guard let data = data else { return strongSelf._fail(error) }
guard let statusResponse = try? JSONDecoder().decode(HerokuStatusResponse.self, from: data) else {
return strongSelf._fail("Unexpected data")
}
let production = statusResponse.status.production
let development = statusResponse.status.development
guard let max = [production, development].max(by: { $0.status < $1.status }) else {
// This will never happen
return strongSelf._fail("Unexpected error")
}
self?.status = max.status
// Prefer "production" status text except when it's green
let representedStatus = production == .green ? development : production
let statusText = representedStatus.rawValue.capitalized
switch max {
case .green:
self?.message = statusText
default:
// Get the title of the current issue if any
self?.message = statusResponse.issues.first?.title ?? statusText
}
}
}
}
| 29.95122 | 110 | 0.563111 |
81c82b1c49f57071a6407fabb7b6861acd0572e6 | 1,456 | html | HTML | book.html | k-giardchase/address_book_js | 0a12e09654cb80d3d0b7b64edb1abc1b4a69c6ce | [
"Unlicense"
] | null | null | null | book.html | k-giardchase/address_book_js | 0a12e09654cb80d3d0b7b64edb1abc1b4a69c6ce | [
"Unlicense"
] | null | null | null | book.html | k-giardchase/address_book_js | 0a12e09654cb80d3d0b7b64edb1abc1b4a69c6ce | [
"Unlicense"
] | null | null | null | <html>
<head>
<link rel='stylesheet' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css'>
<link rel='stylesheet' href='css/styles.css'>
<script src='js/jquery-1.11.2.js'></script>
<script src='js/scripts.js'></script>
<title>Address Book</title>
</head>
<body>
<div class='container'>
<h1>Address Book</h1>
<div class='row'>
<div class='col-md-6'>
<h2>Add a contact:</h2>
<form id="new_contact">
<div class='form-group'>
<label for="new-first-name">First Name</label>
<input type="text" id='new-first-name' class='form-control'>
</div>
<div class='form-group'>
<label for="new-last-name">Last Name</label>
<input type="text" id='new-last-name' class='form-control'>
</div>
<div class='form-group'>
<label for="new-address">Address</label>
<input type="text" id='new-address' class='form-control'>
</div>
<button type="submit" class='btn btn-info'>Add</button>
</form>
<h2>Contacts:</h2>
<ul id='contacts'>
</ul>
</div>
<div class='col-md-6'>
<div id='show-contact'>
<h2></h2>
<p>First name: <span class='first-name'></span></p>
<p>Last name: <span class='last-name'></span></p>
<p>Address: <span class='address'></span></p>
</div>
</div>
</div>
</div>
</body>
</html>
| 29.12 | 103 | 0.543956 |
df7700321d0ef279b35ce827190a468c880cf873 | 1,049 | dart | Dart | lib/main.dart | PhotonRayleigh/spark_dnd | dd95581cf1b957c2542577d9e4ae7a9a23153d45 | [
"BSD-Source-Code"
] | null | null | null | lib/main.dart | PhotonRayleigh/spark_dnd | dd95581cf1b957c2542577d9e4ae7a9a23153d45 | [
"BSD-Source-Code"
] | null | null | null | lib/main.dart | PhotonRayleigh/spark_dnd | dd95581cf1b957c2542577d9e4ae7a9a23153d45 | [
"BSD-Source-Code"
] | null | null | null | import 'package:spark_dnd/app/components/main_comp.dart';
import 'package:spark_lib/app/spark_app.dart';
import 'package:spark_lib/custom_window/window_data.dart';
import 'package:spark_lib/filesystem/system_paths.dart';
import 'package:spark_lib/filesystem/filesystem_manager.dart';
import 'package:spark_lib/navigation/spark_nav.dart';
import 'app/screens/dnd_home.dart';
import 'app/theme/base_theme.dart';
import 'utility/print_paths.dart';
void main() async {
// Filesystem access is a bit weird on Mac.
// I'm going to have to see how to get proper access
// to the user's file system. It has a permissions system
// where the user has to grant access.
// For now, just store data in the app storage
// directory.
printPaths(SystemPaths.I);
FileSystemManager.I.config("D&D App", "Spark Framework");
SparkApp(
home: DnDHome(WindowData(windowTitle: "Spark D&D"), AppNavigator.I,
MainComp(AppNavigator.I, FileSystemManager.I)),
theme: darkTheme())
.run();
}
| 37.464286 | 78 | 0.7102 |
2f61687acc42aa350754112b2b723fe103139bf6 | 24,398 | cs | C# | SteamVent/SteamContext.cs | Nielk1/SteamVent | d070cd871619305a457bf741525e44e0eedac13c | [
"MIT"
] | 2 | 2019-05-01T05:58:55.000Z | 2021-01-29T10:06:26.000Z | SteamVent/SteamContext.cs | Nielk1/SteamVent | d070cd871619305a457bf741525e44e0eedac13c | [
"MIT"
] | null | null | null | SteamVent/SteamContext.cs | Nielk1/SteamVent | d070cd871619305a457bf741525e44e0eedac13c | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;
using Gameloop.Vdf.Linq;
using SteamVent.FileSystem;
using SteamVent.Common.BVdf;
using SteamVent.InterProc.Interfaces;
using SteamVent.InterProc;
using Gameloop.Vdf;
using SteamVent.Common;
namespace SteamVent
{
class SteamException : Exception
{
public SteamException(string msg)
: base(msg)
{
}
}
/// <summary>
/// General context wrapper for entire SteamVent system utilizing what sub-libraries are available
/// </summary>
public class SteamContext : IDisposable
{
private static readonly object CoreInstanceMutex = new object();
private static SteamContext CoreInstance;
private ISteamClient SteamClient { get; set; }
Type _SteamClientVersion { get; set; }
private Int32 Pipe { get; set; }
private Int32 User { get; set; }
private ISteamApps SteamApps { get; set; }
Type _SteamAppsVersion { get; set; }
private SteamContext()
{
Init();
}
public static SteamContext GetInstance()
{
lock (CoreInstanceMutex)
{
if (CoreInstance == null)
CoreInstance = new SteamContext();
return CoreInstance;
}
}
#region Dispose
// Flag: Has Dispose already been called?
bool disposed = false;
// Public implementation of Dispose pattern callable by consumers.
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
// Protected implementation of Dispose pattern.
protected virtual void Dispose(bool disposing)
{
if (disposed)
return;
if (disposing)
{
Shutdown();
}
// Free any unmanaged objects here.
//
disposed = true;
}
~SteamContext()
{
Dispose(false);
}
#endregion Dispose
public bool SteamIsRunning { get { return SteamProcessInfo.GetSteamPid() > 0; } }
// TODO use a better AppID source, the AppInfo.vtf file only holds data the client has actually seen
public List<SteamLaunchableApp> GetOwnedApps()
{
//UInt32[] appIDs = GetClientAppIds();
List<SteamLaunchableApp> apps = new List<SteamLaunchableApp>();
//SteamAppInfoDataFile dataFile = SteamAppInfoDataFile.Read(GetAppCacheAppInfoFile());
SteamAppInfoDataFile dataFile = SteamAppInfoDataFile.GetSteamAppInfoDataFile();
/*dataFile.chunks
.Where(chunk => chunk.data != null && chunk.data.Properties != null && chunk.data.Properties.Count > 0)
//.Select(chunk => ((BVStringToken)((BVPropertyCollection)((BVPropertyCollection)chunk.data?["appinfo"])?["common"])?["type"])?.Value?.ToLowerInvariant())
.Select(chunk => ((BVStringToken)((BVPropertyCollection)((BVPropertyCollection)chunk.data?["appinfo"])?["common"])?["releasestate"])?.Value?.ToLowerInvariant())
.Distinct()
.OrderBy(dr => dr)
.ToList()
.ForEach(dr =>
{
Console.WriteLine(dr);
});*/
dataFile.chunks
.ForEach(chunk =>
{
if (chunk.data != null
&& chunk.data.Properties != null
&& chunk.data.Properties.Count > 0)
{
BVPropertyCollection appinfo = ((BVPropertyCollection)chunk.data?["appinfo"]);
BVPropertyCollection common = ((BVPropertyCollection)appinfo?["common"]);
BVPropertyCollection extended = ((BVPropertyCollection)appinfo?["extended"]);
string type = common?["type"]?.GetValue<string>()?.ToLowerInvariant();
//if (type == "demo" || type == "game")
if (!string.IsNullOrWhiteSpace(type) && type != "config")
{
bool isInstalled = SteamApps.BIsAppInstalled(chunk.AppID);
bool isSubscribed = SteamApps.BIsSubscribedApp(chunk.AppID);
string name = common?["name"]?.GetValue<string>();
string clienticon = common?["clienticon"]?.GetValue<string>();
if (isSubscribed && !string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(type))
{
apps.Add(new SteamLaunchableApp(chunk.AppID)
{
Name = name?.TrimEnd(),
appIcon = string.IsNullOrWhiteSpace(clienticon) ? null : Path.Combine(SteamProcessInfo.SteamInstallPath, "steam", "games", clienticon + ".ico"),
appType = type,
});;
}
}
}
});
return apps;
}
public List<SteamLaunchableApp> GetAppsWithMetadata(UInt64[] AppIDs = null)
{
//UInt32[] appIDs = GetClientAppIds();
List<SteamLaunchableApp> apps = new List<SteamLaunchableApp>();
//SteamAppInfoDataFile dataFile = SteamAppInfoDataFile.Read(GetAppCacheAppInfoFile());
SteamAppInfoDataFile dataFile = SteamAppInfoDataFile.GetSteamAppInfoDataFile();
/*dataFile.chunks
.Where(chunk => chunk.data != null && chunk.data.Properties != null && chunk.data.Properties.Count > 0)
//.Select(chunk => ((BVStringToken)((BVPropertyCollection)((BVPropertyCollection)chunk.data?["appinfo"])?["common"])?["type"])?.Value?.ToLowerInvariant())
.Select(chunk => ((BVStringToken)((BVPropertyCollection)((BVPropertyCollection)chunk.data?["appinfo"])?["common"])?["releasestate"])?.Value?.ToLowerInvariant())
.Distinct()
.OrderBy(dr => dr)
.ToList()
.ForEach(dr =>
{
Console.WriteLine(dr);
});*/
dataFile.chunks
.ForEach(chunk =>
{
if (chunk.data != null
&& chunk.data.Properties != null
&& chunk.data.Properties.Count > 0
&& ((AppIDs?.Length ?? 0) == 0 || AppIDs.Contains(chunk.AppID)))
{
BVPropertyCollection appinfo = ((BVPropertyCollection)chunk.data?["appinfo"]);
BVPropertyCollection common = ((BVPropertyCollection)appinfo?["common"]);
BVPropertyCollection extended = ((BVPropertyCollection)appinfo?["extended"]);
string type = common?["type"]?.GetValue<string>()?.ToLowerInvariant();
//if (type == "demo" || type == "game")
if (!string.IsNullOrWhiteSpace(type) && type != "config")
{
bool isInstalled = SteamApps.BIsAppInstalled(chunk.AppID);
bool isSubscribed = SteamApps.BIsSubscribedApp(chunk.AppID);
string name = common?["name"]?.GetValue<string>();
//string oslist = common?["oslist"]?.GetValue<string>();
//string icon = common?["icon"]?.GetValue<string>();
//string clienttga = common?["clienttga"]?.GetValue<string>();
string clienticon = common?["clienticon"]?.GetValue<string>();
//string logo = common?["logo"]?.GetValue<string>();
//string logo_small = common?["logo_small"]?.GetValue<string>();
//string releasestate = common?["releasestate"]?.GetValue<string>();
//string linuxclienticon = common?["linuxclienticon"]?.GetValue<string>();
//string controller_support = common?["controller_support"]?.GetValue<string>();
//string clienticns = common?["clienticns"]?.GetValue<string>();
//int metacritic_score = ((BVInt32Token)common?["metacritic_score"])?.Value ?? -1;
//string metacritic_name = common?["metacritic_name"]?.GetValue<string>();
//BVPropertyCollection small_capsule = ((BVPropertyCollection)common?["small_capsule"]);
//BVPropertyCollection header_image = ((BVPropertyCollection)common?["header_image"]);
//BVPropertyCollection languages = ((BVPropertyCollection)common?["languages"]);
//bool community_visible_stats = common?["community_visible_stats"]?.GetValue<string>() == "1";
//bool community_hub_visible = common?["community_hub_visible"]?.GetValue<string>() == "1";
//bool workshop_visible = common?["workshop_visible"]?.GetValue<string>() == "1";
//bool exfgls = common?["exfgls"]?.GetValue<string>() == "1";
//string gamedir = extended?["gamedir"]?.GetValue<string>();
List<string> developer = new List<string>();
List<string> publisher = new List<string>();
//string homepage = extended?["homepage"]?.GetValue<string>();
//string gamemanualurl = extended?["gamemanualurl"]?.GetValue<string>();
//bool showcdkeyonlaunch = extended?["showcdkeyonlaunch"]?.GetValue<string>() == "1";
//bool dlcavailableonstore = extended?["dlcavailableonstore"]?.GetValue<string>() == "1";
{
List<BVProperty> props = (common?["associations"] as BVPropertyCollection)?.Properties;
if (props != null)
{
foreach (BVProperty element in props)
{
string elemType = (element.Value as BVPropertyCollection)?["type"].GetValue<string>();
string elemVal = (element.Value as BVPropertyCollection)?["name"].GetValue<string>();
if (string.IsNullOrWhiteSpace(elemVal))
continue;
if (elemType == "developer")// && string.IsNullOrWhiteSpace(developer))
{
developer.Add(elemVal);
}
if (elemType == "publisher")// && string.IsNullOrWhiteSpace(publisher))
{
publisher.Add(elemVal);
}
}
}
string extended_dev = extended?["developer"]?.GetValue<string>();
if (developer.Count == 0 && !string.IsNullOrWhiteSpace(extended_dev))
developer.Add(extended_dev);
string extended_pub = extended?["publisher"]?.GetValue<string>();
if (publisher.Count == 0 && !string.IsNullOrWhiteSpace(extended_pub))
publisher.Add(extended_pub);
}
long? _original_release_date = common?["original_release_date"]?.GetValue<long>();
long? _steam_release_date = common?["steam_release_date"]?.GetValue<long>();
DateTime? original_release_date = _original_release_date.HasValue ? DateTimeOffset.FromUnixTimeSeconds(_original_release_date.Value).UtcDateTime : (DateTime?)null;
DateTime? steam_release_date = _steam_release_date.HasValue ? DateTimeOffset.FromUnixTimeSeconds(_steam_release_date.Value).UtcDateTime : (DateTime?)null;
BVPropertyCollection library_assets = ((BVPropertyCollection)common?["library_assets"]);
bool has_library_capsule = !string.IsNullOrWhiteSpace(library_assets?["library_capsule"]?.GetValue<string>());
bool has_library_hero = !string.IsNullOrWhiteSpace(library_assets?["library_hero"]?.GetValue<string>());
bool has_library_logo = !string.IsNullOrWhiteSpace(library_assets?["library_logo"]?.GetValue<string>());
//Console.WriteLine($"{chunk.AppID}\t{(type ?? string.Empty).PadRight(4)} {(isInstalled ? 1 : 0)} {(isSubscribed ? 1 : 0)} {(releasestate ?? string.Empty).PadRight(11)} {(name ?? string.Empty).PadRight(90)} {(developer ?? string.Empty).PadRight(40)} {(publisher ?? string.Empty)}");
//File.AppendAllText("SteamDump.txt",$"{chunk.appID}\t{(type ?? string.Empty).PadRight(4)} {(isInstalled ? 1 : 0)} {(isSubscribed ? 1 : 0)} {(releasestate ?? string.Empty).PadRight(11)} {(name ?? string.Empty).PadRight(90)} {(developer ?? string.Empty).PadRight(40)} {(publisher ?? string.Empty).PadRight(40)}\r\n");
if (isSubscribed && !string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(type))
{
apps.Add(new SteamLaunchableApp(chunk.AppID)
{
Name = name?.TrimEnd(),
appIcon = string.IsNullOrWhiteSpace(clienticon) ? null : Path.Combine(SteamProcessInfo.SteamInstallPath, "steam", "games", clienticon + ".ico"),
appType = type,
extra_developer = developer.ToArray(),
extra_publisher = publisher.ToArray(),
extra_has_library_capsule = has_library_capsule,
extra_has_library_hero = has_library_hero,
extra_has_library_logo = has_library_logo,
extra_original_release_date = original_release_date,
extra_steam_release_date = steam_release_date,
}); ;
}
}
}
});
return apps;
}
public static readonly string[] GoldSrcModSkipFolders = new string[] {
"valve", // "valve_hd", // Half-Life
"gearbox", // "gearbox_hd", // Opposing Force
"bshift", // "bshift_hd", // Blue Shift
"dmc", // Deathmatch Classic
"cstrike", // "cstrike_hd", // Counter-Strike
"czero", // Condition Zero
"czeror", // Condition-Zero: Deleted Scenes
"dod", // Day of Defeat
"ricochet", // Ricochet
//"htmlcache", "platform", "Soundtrack", // other
"before" // mod that even Steam accidently picks up, we're offically better than Steam itself now
};
public List<SteamLaunchableModGoldSrc> GetGoldSrcMods()
{
// gold source mods
List<SteamLaunchableModGoldSrc> GoldSourceMods = new List<SteamLaunchableModGoldSrc>();
string AppInstallDir = SteamProcessInfo.GetGoldSrcModPath();
UInt32 sourceModAppID = 70;
if (Directory.Exists(AppInstallDir))
{
Directory.GetDirectories(AppInstallDir)
.Where(dr => !GoldSrcModSkipFolders.Contains(Path.GetFileName(dr)))
.Where(dr => File.Exists(Path.Combine(dr, "liblist.gam")))
.ToList().ForEach(dr =>
{
//VObject rootObj = VdfConvert.Deserialize("\"GameInfo\"\r\n{\r\n" + File.ReadAllText(Path.Combine(dr, "liblist.gam")) + "\r\n}");
//VObject tmp = (VObject)rootObj["GameInfo"];
//VToken tmp2 = tmp["gamedir"];
//UInt64 tmpID = SteamLaunchableShortcut.GetModShortcutID(tmp2.ToString(), sourceModAppID);
//if (tmpID > 0) GoldSourceMods.Add(tmpID);
SteamLaunchableModGoldSrc mod = SteamLaunchableModGoldSrc.Make(sourceModAppID, dr, Path.Combine(dr, "liblist.gam"));
if (mod != null) GoldSourceMods.Add(mod);
});
}
return GoldSourceMods;
}
public List<SteamLaunchableModSource> GetSourceMods()
{
// source mods
List<SteamLaunchableModSource> SourceMods = new List<SteamLaunchableModSource>();
{
string sourceMods = SteamProcessInfo.GetSourceModPath();
if (Directory.Exists(sourceMods))
{
Directory.GetDirectories(sourceMods)
.Where(dr => File.Exists(Path.Combine(dr, "gameinfo.txt")))
.ToList().ForEach(dr =>
{
VObject rootObj = new VObject();
rootObj.Add(VdfConvert.Deserialize(File.ReadAllText(Path.Combine(dr, "gameinfo.txt"))));
VObject GameInfoObj = (VObject)rootObj["GameInfo"];
VObject FileSystemObj = (VObject)GameInfoObj["FileSystem"];
VToken appID = FileSystemObj["SteamAppId"];
UInt32 appIdCheck = 0;
if (!UInt32.TryParse(appID.ToString(), out appIdCheck)) return;
if (appIdCheck == 0) return;
string AppInstallDir = SteamApps.GetAppInstallDir(appIdCheck);
if (!string.IsNullOrWhiteSpace(AppInstallDir))
{
SteamLaunchableModSource mod = SteamLaunchableModSource.Make(appIdCheck, dr, rootObj);
if (mod != null) SourceMods.Add(mod);
}
});
}
}
return SourceMods;
}
public bool IsInstalled(UInt64 GameID)
{
CGameID gameID = new CGameID(GameID);
switch (gameID.AppType)
{
// Basic Steam App
case CGameID.EGameID.k_EGameIDTypeApp:
return SteamApps.BIsAppInstalled(gameID.AppID);
//return SteamApps.BIsAppInstalled(gameID.AppID().m_AppId);
// Mod Steam App
case CGameID.EGameID.k_EGameIDTypeGameMod:
return true;
// If the base game isn't installed, just say no
if (!SteamApps.BIsAppInstalled(gameID.AppID)) return false;
//if (!SteamApps.BIsAppInstalled(gameID.AppID().m_AppId)) return false;
// Root app is GoldSrc
//if (GoldSrcModHosts.Contains(gameID.AppID().m_AppId))
if(gameID.AppID == 70)
{
// Get a list of known GoldSrc Mods
List<SteamLaunchableModGoldSrc> mods = GetGoldSrcMods();
// return if any of these mods match our ID
return mods.Any(dr => dr.GetShortcutID() == GameID);
}
// Root app is Source
// TODO add check for source engine IDs here
{
// Get a list of known GoldSrc Mods
List<SteamLaunchableModSource> mods = GetSourceMods();
// return if any of these mods match our ID
return mods.Any(dr => dr.GetShortcutID() == GameID);
}
return false;
case CGameID.EGameID.k_EGameIDTypeShortcut:
break;
}
return false;
}
/*public void InstallGame(UInt64 GameID)
{
CGameID gameID = new CGameID(GameID);
switch (gameID.AppType)
{
// Basic Steam App
case CGameID.EGameID.k_EGameIDTypeApp:
{
string InstallCommand = $"steam://install/{GameID}";
string installPath = Steamworks.GetInstallPath();
string steamEXE = Path.Combine(installPath, @"steam.exe");
Process.Start(steamEXE, InstallCommand);
}
break;
case CGameID.EGameID.k_EGameIDTypeGameMod:
break;
case CGameID.EGameID.k_EGameIDTypeShortcut:
break;
}
}*/
/*public string[] GetGameLibraries()
{
try
{
int CountBaseFolders = ClientAppManager.GetNumInstallBaseFolders();
string[] BaseFolders = new string[CountBaseFolders];
for (int x = 0; x < CountBaseFolders; x++)
{
StringBuilder builder = new StringBuilder(1024);
ClientAppManager.GetInstallBaseFolder(x, builder);
BaseFolders[x] = builder.ToString();
}
return BaseFolders;
}
catch
{
return new string[0];
}
}*/
/*public EAppUpdateError? InstallGame(UInt64 GameID, int GameLibraryIndex)
{
CGameID gameID = new CGameID(GameID);
switch (gameID.AppType)
{
// Basic Steam App
case CGameID.EGameID.k_EGameIDTypeApp:
{
return ClientAppManager.InstallApp(gameID.AppID, GameLibraryIndex, false);
}
break;
case CGameID.EGameID.k_EGameIDTypeGameMod:
break;
case CGameID.EGameID.k_EGameIDTypeShortcut:
break;
}
return null;
}*/
/*public void StartBigPicture()
{
string installPath = Steamworks.GetInstallPath();
string steamEXE = Path.Combine(installPath, @"steam.exe");
Process.Start(steamEXE, "steam://open/bigpicture");
}*/
/*public bool IsInBigPicture()
{
return WrappedContext.BigPicturePID > 0;
}*/
public void Init(string ProxyServerPath = null, bool SearchSubfolders = false)
{
Steam.Load();
SteamClient = Steam.CreateInterface<ISteamClient017>();
if (SteamClient == null)
throw new Exception();
Pipe = SteamClient.CreateSteamPipe();
if (Pipe == 0)
throw new Exception();
User = SteamClient.ConnectToGlobalUser(Pipe);
if (User == 0)
throw new Exception();
SteamApps = SteamClient.GetISteamApps<ISteamApps008>(User, Pipe);
if (SteamApps == null)
throw new Exception();
}
public void Shutdown()
{
if (SteamClient == null)
return;
SteamClient.ReleaseUser(Pipe, User);
SteamClient.BReleaseSteamPipe(Pipe);
}
}
}
| 47.374757 | 344 | 0.503156 |
31481285fdc8ecbb9319899a6579c3d6e763484c | 81 | sql | SQL | src/test/resources/sql/alter_table/613d0da2.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 66 | 2018-06-15T11:34:03.000Z | 2022-03-16T09:24:49.000Z | src/test/resources/sql/alter_table/613d0da2.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 13 | 2019-03-19T11:56:28.000Z | 2020-08-05T04:20:50.000Z | src/test/resources/sql/alter_table/613d0da2.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 28 | 2019-01-05T19:59:02.000Z | 2022-03-24T11:55:50.000Z | -- file:alter_table.sql ln:128 expect:true
ALTER TABLE tmp ADD COLUMN x float8[]
| 27 | 42 | 0.765432 |
c22fda55b20ffdc615441e4017bbc567a68646a3 | 10,243 | asm | Assembly | src/drawsprite.asm | fjpena/sword-of-ianna-msx2 | f104f46a677e4b21f42fbed478307a0bb1d372f3 | [
"Apache-2.0"
] | 43 | 2017-10-21T23:01:25.000Z | 2022-02-21T17:45:11.000Z | src/drawsprite.asm | fjpena/sword-of-ianna-msx2 | f104f46a677e4b21f42fbed478307a0bb1d372f3 | [
"Apache-2.0"
] | null | null | null | src/drawsprite.asm | fjpena/sword-of-ianna-msx2 | f104f46a677e4b21f42fbed478307a0bb1d372f3 | [
"Apache-2.0"
] | 6 | 2017-10-23T05:48:50.000Z | 2022-01-06T03:11:49.000Z | ; Sprite type definitions
SPR_24x32_NOMIRROR: EQU 0 ; 24x32 sprite, no mirroring
SPR_24x32_MIRROR: EQU 128 ; 24x32 sprite, mirrored
MAX_SPRITES: EQU 16 ; Maximum 16 sprites
; Init sprite structures
; The sprite structure has 8 bytes per sprite, with the following structure:
;
; spraddress: 2 bytes (sprite address in memory, if 0 there is no sprite)
; sprtype + ROM bank: 1 bit(sprtype) + 7 bits (ROM Bank) 1 byte (see srite type definitions above)
; xpos: 1 byte (X position. X / 8 will be the starting char)
; ypos: 1 byte (Y position. Y / 8 will be the starting char)
; xmaxchar: 1 byte (X chars occupied by sprite)
; ymaxchar: 1 byte (Y chars occupied by sprite)
; redraw: 1 byte (0: sprite does not need to be redrawn; 1: redraw)
; 16 sprites, 8 bytes per sprite = 128 bytes for the sprite data structure
InitSprites:
ld hl, SPDATA
ld (hl), 0
ld de, SPDATA+1
ld bc, 127 ; Just fill the whole structure with zeroes
ldir
ret
; Re-initialize sprites after a screen change
; Do it with every sprite, but the player one
ReInitSprites:
ld hl, SPDATA+8
ld (hl), 0
ld de, SPDATA+9
ld bc, 119 ; Just fill the whole structure with zeroes
ldir
ret
; Return address of the first available sprite
; It is the responsibility of the calling function to fill the sprite data properly
; INPUT: none
; OUTPUT:
; - HL: address of the first available sprite
NewSprite:
ld hl, SPDATA
inc hl ; go to spdata + 1
ld e, MAX_SPRITES
ld bc, 9
newsprloop:
ld a, (hl)
dec hl
or (hl)
ret z ; if the first two bytes are zero, the sprite is available
dec e
jr z, nonewsprite ; if no new sprite is found...
add hl, bc
jr newsprloop
nonewsprite:
ld hl, 0
ret ; return HL=0 as the sprite
; Update sprite. This function will invalidate the sprite tiles, as
; well as force redraw of all sprites overlapping with this one
;
; INPUT: IX: address in sprite list
; B: new X position
; C: new Y position
UpdateSprite:
push bc
ld a, b
rra
rra
rra
and $1f ; Get the X char
ld h, a
ld a, c
rra
rra
rra
and $1f ; Get the Y char
ld l, a ; save the new position in HL
ld (ix+7), 1 ; Mark sprite to be redrawn
ld a, (ix+3)
rra
rra
rra
and $1f ; Get the X char
ld b, a
ld a, (ix+4)
rra
rra
rra
and $1f ; Get the Y char
ld c, a ; B is the first char in X, C is the first char in Y
ld d, (ix+5)
ld e, (ix+6) ; D is the nchars in X, E is the nchars in Y
; if the Y value is the same in the current and new position, extend the dirty rectangle
; FIXME: this is something we could improve, when changing the Y we are not checking anything!!!
ld a, l
cp c
jr nz, Update_differentY
; same Y, lets adjust X
ld a, h ; new X position
cp b ; old X position
jr z, Update_inv ; if the same, nothing to do
jr nc, Update_newhigher ; new X position is higher than the old one
Update_newlower: ; new X position is lower than the old one
push bc ; BC= old position
push hl ; HL= new position
ld a, b
sub h ; A = oldX - newX
add a, d
ld d, a ; D = nchars + diff
ld b, h ; first X is the old one
jr Update_inv_two
Update_newhigher:
push bc ; BC= old position
push hl ; HL= new position
sub b ; A = newX - oldX
add a, d
ld d, a ; D = nchars + diff
jr Update_inv_two
Update_differentY:
push bc
push de
ld b, h
ld c, l
call InvalidateTiles
pop de
pop bc
Update_inv:
call InvalidateTiles
;UpdateSprite_CheckOverlap:
; call MarkOverlappingSprites
update_storenewpos:
pop bc
ld (ix+3), b
ld (ix+4), c
ret
Update_inv_two: ; here we have to check the old and new position, which takes some more effort
call InvalidateTiles
pop hl
pop bc
ld l, b
add hl, hl
add hl, hl
add hl, hl
jr update_storenewpos
;UpdateSprite_two_CheckOverlap:
; ld iy, SPDATA
; ld a, MAX_SPRITES
;checkoverlap_two_loop:
; push af
; ld (ix+3), l ; start with the old position
; call CheckSprOverlap ; Check if sprites DO overlap
; jr c, overlap
;
; ld (ix+3), h ; now check with the new position
; call CheckSprOverlap ; Check if sprites DO overlap
; jr nc, nooverlap_two
; if they overlap, just mark the sprite for redraw
;overlap:
; ld (iy+7), 1 ; mark for redraw
;nooverlap_two:
; pop af
; dec a
; jr z, update_storenewpos ; return after checking all sprites
; ld de, 8
; add iy, de
; jp checkoverlap_two_loop ; continue loop
; Mark all sprites to be redrawn
RedrawAllSprites:
ld ix, SPDATA
ld b, MAX_SPRITES
ld de, 8
RedrawAllSprites_loop:
ld a, (ix+0)
or (ix+1)
jr z, RedrawAllSprites_cont
ld (ix+7), 1 ; set the redraw flag
RedrawAllSprites_cont:
add ix, de
djnz RedrawAllSprites_loop
ret
; Check if two sprites overlap
;
; INPUT: IX: pointer to sprite 1
; IY: pointer to sprite 2
;
; OUTPUT: CY flag = 0: no overlap
; CY flag = 1: overlap
CheckSprOverlap:
; first, check if this sprite is enabled
ld a, (iy+0)
or (iy+1)
ret z ; AND sets the CY flag to zero!
; then if it needs to be redrawn anyway
ld a, (iy+7) ; get the spredraw flag
and 1
ret nz ; If 1, already needs to be redrawn, and CY flag is zero anyway
call check_sprite_overlap ; this function does the rest of the checks for us!
ccf ; however, the carry flag output is complemented
ret
; Check for all overlapping sprites with the current one,
; and mark them for redraw if needed
;
; INPUT: IX: address in sprite list
MarkOverlappingSprites:
ld iy, SPDATA
ld a, MAX_SPRITES
checkoverlap_loop:
push af
call CheckSprOverlap ; Check if sprites DO overlap
jr nc, nooverlap ; If CY=1, sprites overlap, otherwise they don't
ld a, (iy+7)
and a
jr nz, nooverlap ; we've already marked it , so don't do it again
; if they overlap, just mark the sprite for redraw
ld (iy+7), 1 ; mark for redraw
; And invalidate its tiles
ld a, (iy+3)
rra
rra
rra
and $1f ; Get the X char
ld b, a
ld a, (iy+4)
rra
rra
rra
and $1f ; Get the Y char
ld c, a ; B is the first char in X, C is the first char in Y
ld d, (iy+5)
ld e, (iy+6) ; D is the nchars in X, E is the nchars in Y
push iy
call InvalidateTiles
pop iy
nooverlap:
pop af
dec a
ret z ; return after checking all sprites
ld de, 8
add iy, de
jp checkoverlap_loop ; continue loop
; ret
; Check if two sprites overlap (useful for collision detection!)
; INPUT:
; - IX: pointer to sprite1
; - IY: pointer to sprite2
; RETURNS:
; - Carry flag on: no overlap
; - Carry flag off: overlap
check_sprite_overlap:
ld b, (ix+3) ; left side of sprite1
ld a, (iy+5)
add a, a
add a, a
add a, a ; a*8
add a, (iy+3) ; right side of sprite2
dec a
cp b
ret c
ld b, (iy+3) ; left side of sprite2
ld a, (ix+5)
add a, a
add a, a
add a, a ; a*8
add a, (ix+3) ; right side of sprite1
dec a
cp b
ret c
ld b, (ix+4) ; top side of sprite1
ld a, (iy+6)
add a, a
add a, a
add a, a ; a*8
add a, (iy+4) ; bottom side of sprite2
dec a
cp b
ret c
ld b, (iy+4) ; top side of sprite2
ld a, (ix+6)
add a, a
add a, a
add a, a ; a*8
add a, (ix+4) ; bottom side of sprite1
dec a
cp b
ret
; Redraw the sprite list
; This function will go through the sprite list, checking which ones need to be redrawn
; If needed, it will call each sprite draw function depending on the sprite type
DrawSpriteList:
ld ix, SPDATA
ld iyh, MAX_SPRITES
drawsprlist_loop:
ld a, (ix+7) ; get the redraw flag
and a
jp z, drawsprlist_next ; if no redraw is needed, skip sprite
; Set sprite ROM page
ld a, (ix+2)
and $7f
call setROM2
ld a, (ix+6) ; number of chars in Y
add a, a ; *2
add a, a ; *4
add a, a ; *8, so pixels
add a, (ix+4) ; get max Y
cp 160
jr nc, drawsprlist_loop_clip ; need to clip in Y
ld a, SPRITE_HEIGHT
jr drawsprlist_loop_continue
drawsprlist_loop_clip:
sub 160 ; this is how many pixels we need to clip
neg ; make it negative
add a, SPRITE_HEIGHT ; and this is the number of pixels to draw in Y
drawsprlist_loop_continue:
ld (vdpCmdSprite+VDP_NY), a
ld b, (ix+3) ; Load X
ld c, (ix+4) ; Load Y
ld h, (ix+1)
ld l, (ix+0) ; Load sprite address
xor a
ld (ix+7), a ; no need to redraw!
ld a, (ix+2) ; get the sprite type, which is also the direction we're looking at
rlca
and 1
push ix
push iy
calldrawsprite:
call drawSprite
pop iy
pop ix
drawsprlist_next:
dec iyh
jr z, drawsprlist_end
ld bc, 8
add ix, bc
jp drawsprlist_loop
drawsprlist_end:
ld a, 1
call setROM2
ret
; Clean a sprite (remove it). This function will:
;
; 1. Remove the sprite from the sprite list
; 2. Mark all tiles touched by the sprite as dirty
; 3. Mark all overlapping sprites for redraw
; INPUT:
; - HL: pointer to sprite in sprite list
CleanSprite:
push hl
ld (hl), 0
inc hl
ld (hl), 0 ; spradress=0
inc hl
inc hl ; Now pointing at the X position
ld a, (hl)
rra
rra
rra
and $1f ; Get the X char
ld b, a
inc hl
ld a, (hl)
rra
rra
rra
and $1f ; Get the Y char
ld c, a ; B is the first char in X, C is the first char in Y
inc hl
ld d, (hl)
inc hl
ld e, (hl) ; D is the nchars in X, E is the nchars in Y
inc hl
xor a
ld (hl), a ; sprite will not be redrawn anymore
call InvalidateTiles ; Invalidate tiles
pop ix
ret
;call MarkOverlappingSprites ; check for any overlapping sprite
;ret
; jp MarkOverlappingSprites ; FIXME this shouldn't be needed, should it???
; Get the ROM page for a specific enemy type
; INPUT:
; - A: enemy type
; OUTPUT:
; - A: ROM page
; skeleton orc mummy troll rock knight dalgurak golem ogre minotaur demon
SpriteROMPages: db 7, 8, 9, 10, 12, 13, 11, 14, 16, 18, 20
GetSpriteROMPage:
cp OBJECT_ENEMY_SECONDARY ; if this is the secondary, we need to do something different
jr nz, GetSpriteROMPage_notsecondary
; this is the secondary enemy. We need to get whatever page the first enemy has, and add 1
push ix
ld ix, ENTITY_ENEMY1_POINTER
ld a, (ix+10)
rrca
rrca
rrca
rrca
and $0f ; get the enemy type in A
pop ix
call GetSpriteROMPage_notsecondary
inc a
ret
GetSpriteROMPage_notsecondary:
push hl
push de
sub OBJECT_ENEMY_SKELETON ; make it base 0
ld hl, SpriteROMPages
ld e, a
ld d, 0
add hl, de
ld a, (hl) ; This is the ROM page
pop de
pop hl
ret
| 22.812918 | 101 | 0.675486 |
75948d7d435c641d7d63d8ceeade6c97769f9dbc | 3,776 | cs | C# | src/dvsku.Wpf.Controls/Controls/Labeled/LabeledComboBox.cs | nikolastojsin/dvsku | 0bdafa915a2cc0174390120fa2bd6dadae7e6ea0 | [
"MIT"
] | null | null | null | src/dvsku.Wpf.Controls/Controls/Labeled/LabeledComboBox.cs | nikolastojsin/dvsku | 0bdafa915a2cc0174390120fa2bd6dadae7e6ea0 | [
"MIT"
] | null | null | null | src/dvsku.Wpf.Controls/Controls/Labeled/LabeledComboBox.cs | nikolastojsin/dvsku | 0bdafa915a2cc0174390120fa2bd6dadae7e6ea0 | [
"MIT"
] | null | null | null | using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace dvsku.Wpf.Controls {
[TemplatePart(Name = "PART_Label", Type = typeof(Border))]
[TemplatePart(Name = "PART_ToggleButton", Type = typeof(ToggleButton))]
[StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(ComboBoxItem))]
public class LabeledComboBox : ComboBox {
public enum Placement { Top, Left }
private Border _label;
private ToggleButton _comboBox;
static LabeledComboBox() {
DefaultStyleKeyProperty.OverrideMetadata(typeof(LabeledComboBox), new FrameworkPropertyMetadata(typeof(LabeledComboBox)));
FocusableProperty.OverrideMetadata(typeof(LabeledComboBox), new FrameworkPropertyMetadata(false));
KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(LabeledComboBox), new FrameworkPropertyMetadata(KeyboardNavigationMode.Local));
KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata(typeof(LabeledComboBox), new FrameworkPropertyMetadata(KeyboardNavigationMode.None));
KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(typeof(LabeledComboBox), new FrameworkPropertyMetadata(KeyboardNavigationMode.None));
}
#region LabelContent
public static readonly DependencyProperty LabelContentProperty =
DependencyProperty.Register("LabelContent", typeof(object), typeof(LabeledComboBox),
new FrameworkPropertyMetadata(null));
public object LabelContent {
get => GetValue(LabelContentProperty);
set => SetValue(LabelContentProperty, value);
}
#endregion
#region LabelContentTemplate
public static readonly DependencyProperty LabelContentTemplateProperty =
DependencyProperty.Register("LabelContentTemplate", typeof(DataTemplate), typeof(LabeledComboBox),
new FrameworkPropertyMetadata(null));
[Bindable(true)]
public DataTemplate LabelContentTemplate {
get => (DataTemplate)GetValue(LabelContentTemplateProperty);
set => SetValue(LabelContentTemplateProperty, value);
}
#endregion
#region LabelPlacement
public static readonly DependencyProperty LabelPlacementProperty =
DependencyProperty.Register("LabelPlacement", typeof(Placement), typeof(LabeledComboBox),
new FrameworkPropertyMetadata(Placement.Top));
public Placement LabelPlacement {
get => (Placement)GetValue(LabelPlacementProperty);
set => SetValue(LabelPlacementProperty, value);
}
#endregion
#region ComboBoxHeight
public static readonly DependencyProperty ComboBoxHeightProperty =
DependencyProperty.Register("ComboBoxHeight", typeof(double), typeof(LabeledComboBox),
new FrameworkPropertyMetadata(20.0));
public double ComboBoxHeight {
get => (double)GetValue(ComboBoxHeightProperty);
set => SetValue(ComboBoxHeightProperty, value);
}
#endregion
public override void OnApplyTemplate() {
base.OnApplyTemplate();
_label = GetTemplateChild("PART_Label") as Border;
_comboBox = GetTemplateChild("PART_ToggleButton") as ToggleButton;
if (_label != null)
_label.PreviewMouseDown += OnLabelPreviewMouseDown;
}
private void OnLabelPreviewMouseDown(object sender, MouseButtonEventArgs e) {
if(_comboBox != null)
_comboBox.Focus();
}
}
} | 43.906977 | 163 | 0.691208 |
e41a525cd12db1becb2c112f65acf7e5b27dc4ff | 8,741 | go | Go | gateway.go | xgfone/apigw | 748b4deff3689aea0a3291f51140e321f3cbfcaa | [
"Apache-2.0"
] | 1 | 2021-07-06T03:03:33.000Z | 2021-07-06T03:03:33.000Z | gateway.go | xgfone/apigw | 748b4deff3689aea0a3291f51140e321f3cbfcaa | [
"Apache-2.0"
] | null | null | null | gateway.go | xgfone/apigw | 748b4deff3689aea0a3291f51140e321f3cbfcaa | [
"Apache-2.0"
] | null | null | null | // Copyright 2021 xgfone
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package apigw is a simple, flexible, high performance api gateway library,
// and you can use it to customize yourself api gateway quickly.
//
// Features
//
// - Flexible, high performance and zero memory allocation for the core engine.
// - Support the virtual host, and different hosts has their own independent routes and NotFound.
// - Support the health check for the backend, that's upstream server.
// - Support the group of the upstream servers as the backend.
// - Support to customize the backend forwarder of the route.
// - Most of the functions are implemented by the plugin mode.
//
package apigw
import (
"fmt"
"net/http"
"sync"
"sync/atomic"
"github.com/xgfone/ship/v5"
)
// DefalutBodyMaxLen is the default maximum length of the request body.
var DefalutBodyMaxLen = 8 << 20 // 8MB
// DefaultGateway is the default global Gateway.
var DefaultGateway = NewGateway()
type (
// Logger is the logger interface.
Logger = ship.Logger
// Router is the route manager.
Router = ship.Router
// Context is the context of Handler.
Context = ship.Context
// Handler is the http handler to handle http request.
Handler = ship.Handler
// Middleware is used to shape the http request before routing.
Middleware = ship.Middleware
// HTTPServerError represents a http server error.
HTTPServerError = ship.HTTPServerError
)
// Gateway is an api gateway.
type Gateway struct {
Name string
Logger
// Context is the user-defined context data.
Context interface{}
vhosts *ship.HostManagerHandler
metadatas sync.Map
plugins sync.Map
notfound atomic.Value
ehandler atomic.Value
bodyMaxLen int64
middlewares []Middleware
}
// NewGateway returns a new Gateway.
func NewGateway() *Gateway {
hm := ship.NewHostManager(nil)
hm = ship.NewLockHostManager(hm)
g := &Gateway{bodyMaxLen: int64(DefalutBodyMaxLen)}
g.vhosts = ship.NewHostManagerHandler(hm)
g.vhosts.HandleHTTP = g.handleHTTP
g.notfound.Store(http.HandlerFunc(g.defaultNotFound))
g.ehandler.Store(g.handleError)
g.Logger = newLogger()
return g
}
func (g *Gateway) defaultNotFound(w http.ResponseWriter, r *http.Request) {
if h, ok := w.(http.Hijacker); ok {
if conn, _, err := h.Hijack(); err != nil {
w.Header().Set(ship.HeaderConnection, "close")
} else {
conn.Close()
}
} else {
w.Header().Set(ship.HeaderConnection, "close")
}
}
func (g *Gateway) handleError(c *Context, err error) {
if !c.IsResponded() {
switch e := err.(type) {
case ship.HTTPServerError:
c.BlobText(e.Code, e.CT, e.Error())
default:
c.Text(http.StatusInternalServerError, err.Error())
}
}
}
// GetName returns the name of the gateway.
func (g *Gateway) GetName() string { return g.Name }
// GetLogger returns the logger of the gateway.
func (g *Gateway) GetLogger() Logger { return g.Logger }
// SetMetadataForce is the same as SetMetadata, but still updates the key
// if the key has existed.
func (g *Gateway) SetMetadataForce(key string, value interface{}) {
if key == "" {
panic("Gateway.SetMetadataForce: key is empty")
} else if value == nil {
panic("Gateway.SetMetadataForce: value is nil")
}
g.metadatas.Store(key, value)
}
// SetMetadata sets the metadata with the key and value.
//
// If the key has existed, do nothing. If the value is nil, panic.
func (g *Gateway) SetMetadata(key string, value interface{}) (ok bool) {
if key == "" {
panic("Gateway.SetMetadata: key is empty")
} else if value == nil {
panic("Gateway.SetMetadata: value is nil")
}
_, loaded := g.metadatas.LoadOrStore(key, value)
return !loaded
}
// DelMetadata deletes and returns the metadata by the key.
//
// If not exist, do nothing and return nil.
func (g *Gateway) DelMetadata(key string) (value interface{}) {
if key == "" {
panic("Gateway.DelMetadata: key is empty")
} else if v, loaded := g.metadatas.LoadAndDelete(key); loaded {
value = v
}
return
}
// GetMetadata returns the metadata by the key. But return nil if not exist.
func (g *Gateway) GetMetadata(key string) (value interface{}) {
if key == "" {
panic("Gateway.GetMetadata: key is empty")
} else if v, ok := g.metadatas.Load(key); ok {
value = v
}
return
}
// GetMetadatas returns all the metadatas.
func (g *Gateway) GetMetadatas() (metadatas map[string]interface{}) {
metadatas = make(map[string]interface{}, 4)
g.metadatas.Range(func(key, value interface{}) bool {
metadatas[key.(string)] = value
return true
})
return
}
// GetBodyMaxLen returns the maximum length of the request body.
func (g *Gateway) GetBodyMaxLen() int64 {
return atomic.LoadInt64(&g.bodyMaxLen)
}
// SetBodyMaxLen resets the maxinum length of the request body.
// And 0 represents no limit.
//
// Default: DefalutBodyMaxLen
func (g *Gateway) SetBodyMaxLen(maxLen int64) {
atomic.StoreInt64(&g.bodyMaxLen, maxLen)
}
// SetDefaultNotFound sets the default NotFound handler.
func (g *Gateway) SetDefaultNotFound(notfound http.Handler) {
if notfound == nil {
panic("Gateway.SetDefaultNotFound: NotFound handler is nil")
}
g.notfound.Store(notfound)
}
// SetErrorHandler sets the handler of the error returned by the response
// handler or middlwares.
func (g *Gateway) SetErrorHandler(f func(*Context, error)) {
if f == nil {
panic("Gateway.SetErrorHandler: the error handler is nil")
}
g.ehandler.Store(f)
}
// SetDefaultHost sets the default host to the existed host.
func (g *Gateway) SetDefaultHost(host string) (err error) {
if host == "" {
err = fmt.Errorf("host is empty")
} else if dhost, _ := g.vhosts.GetDefaultHost(); dhost == host {
return
} else if handler := g.vhosts.GetHost(host); handler == nil {
err = fmt.Errorf("no the host '%s'", host)
} else {
g.vhosts.SetDefaultHost(host, handler)
}
return
}
// GetDefaultHost returns the default host, which is "" by default.
func (g *Gateway) GetDefaultHost() (host string) {
host, _ = g.vhosts.GetDefaultHost()
return
}
// ServeHTTP implements the interface http.Handler.
func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request) {
maxlen := atomic.LoadInt64(&g.bodyMaxLen)
if maxlen > 0 && maxlen < r.ContentLength {
w.WriteHeader(http.StatusRequestEntityTooLarge)
return
}
g.vhosts.ServeHTTP(w, r)
}
func (g *Gateway) handleHTTP(w http.ResponseWriter, r *http.Request,
matchedHost string, matchedHandler http.Handler) {
if matchedHandler == nil {
g.notfound.Load().(http.Handler).ServeHTTP(w, r)
return
}
var err error
host := matchedHandler.(*Host)
c := host.AcquireContext(r, w)
if _len := len(g.middlewares); _len == 0 {
err = host.HandleHTTP(c)
} else {
handler := host.HandleHTTP
for _len--; _len >= 0; _len-- {
handler = g.middlewares[_len](handler)
}
err = handler(c)
}
if err != nil {
g.ehandler.Load().(func(*Context, error))(c, err)
}
host.ReleaseContext(c)
}
// RegisterGlobalMiddlewares registers the global route middlewares,
// which will act on all the hosts.
func (g *Gateway) RegisterGlobalMiddlewares(mws ...Middleware) {
g.middlewares = append(g.middlewares, mws...)
}
// ResetGlobalMiddlewares cleans the old global router middlewares
// and resets it to mws.
//
// Notice: It must be called before starting the gateway.
func (g *Gateway) ResetGlobalMiddlewares(mws ...Middleware) {
g.middlewares = append([]Middleware{}, mws...)
}
// RegisterPlugin registers the plugin.
func (g *Gateway) RegisterPlugin(p Plugin) (err error) {
name := p.Name()
if _, loaded := g.plugins.LoadOrStore(name, p); loaded {
err = fmt.Errorf("the plugin named '%s' has been registered", name)
}
return
}
// UnregisterPlugin unregisters the plugin named pname.
func (g *Gateway) UnregisterPlugin(pname string) { g.plugins.Delete(pname) }
// Plugin returns the plugin by the name. Return nil instead if not exist.
func (g *Gateway) Plugin(pname string) Plugin {
if value, ok := g.plugins.Load(pname); ok {
return value.(Plugin)
}
return nil
}
// Plugins returns all the registered plugins.
func (g *Gateway) Plugins() Plugins {
plugins := make(Plugins, 0, 16)
g.plugins.Range(func(key, value interface{}) bool {
plugins = append(plugins, value.(Plugin))
return true
})
return plugins
}
| 28.016026 | 99 | 0.710903 |
b6c5c547e3bb8641ac0471a4e161c608571fa5fd | 1,179 | asm | Assembly | Mips Exersice/GCD.asm | Pandula1234/Machine-Instructions | 4fa06486968a546a727fffd897e5a18f75e95c04 | [
"BSL-1.0"
] | null | null | null | Mips Exersice/GCD.asm | Pandula1234/Machine-Instructions | 4fa06486968a546a727fffd897e5a18f75e95c04 | [
"BSL-1.0"
] | null | null | null | Mips Exersice/GCD.asm | Pandula1234/Machine-Instructions | 4fa06486968a546a727fffd897e5a18f75e95c04 | [
"BSL-1.0"
] | null | null | null | # index number : 18001521
.text
main:
#(1)read data ------------------------------------------------------------------
#print first message
la $a0,first
li $v0,4
syscall
#reading first integer
li $v0,5
syscall
move $t0,$v0
#print second message
la $a0,second
li $v0,4
syscall
#reading second integer
li $v0,5
syscall
move $t1,$v0
#find gcd---------------------------------------------------------------------
check:
#(2)if a and b are equals a=gcd (jump to print gcd)
beq $t0,$t1,gcd
#if a>b (jump to a-b)
bgt $t0,$t1,subab
#if a<b (jump to b-a)
blt $t0,$t1,subba
#(3)substract smaller from larger-----------
#substract b from a (a-b)
subab:
sub $t0,$t0,$t1
jal check
#substract a from b (b-a)
subba:
sub $t1,$t1,$t0
jal check
#print gcd -------------------------------------------------------------------
gcd:
#print printgcd message
la $a0,printgcd
li $v0,4
syscall
#print a (gcd)
move $a0,$t0
li $v0,1
syscall
jal end
#end program -----------------------------------------------------------------
end:
li $v0,10
syscall
.data
first: .asciiz "\nEnter the first integer :"
second: .asciiz "\nEnter the second integer :"
printgcd: .asciiz "\nThe greatest common divisor =" | 19.016129 | 80 | 0.532655 |
ddbe22f84f3d5182d918ca91e23b46e0268e3506 | 3,244 | php | PHP | application/controllers/admin/Print_Laporan.php | pkl-diskominfo-mojokerto/bukutamu | abda6d1af0b49d62a68397074d64c6cfe8984a9c | [
"MIT"
] | null | null | null | application/controllers/admin/Print_Laporan.php | pkl-diskominfo-mojokerto/bukutamu | abda6d1af0b49d62a68397074d64c6cfe8984a9c | [
"MIT"
] | null | null | null | application/controllers/admin/Print_Laporan.php | pkl-diskominfo-mojokerto/bukutamu | abda6d1af0b49d62a68397074d64c6cfe8984a9c | [
"MIT"
] | null | null | null | <?php
Class Print_Laporan extends CI_Controller{
function __construct() {
parent::__construct();
$this->load->model('Tamu_model');
$this->load->model('Admin_model');
}
public function index()
{
if($this->Admin_model->logged_id())
{
if ($_POST['cetak']) {
$data = [
$tgl_a = $this->input->post('tgl_a', true),
$tgl_b = $this->input->post('tgl_b', true)
];
$datas['tamu'] = $this->Tamu_model->tampil_tgl($tgl_a, $tgl_b);
$mpdf = new \Mpdf\Mpdf([
'default_font_size' => 12,
'default_font' => 'arial',
'format' => 'Legal'
]);
// $mpdf->defaultheaderfontsize=15;
// $mpdf->defaultheaderfontstyle='B';
// $mpdf->defaultheaderline=0;
// $mpdf->SetHeader('|Daftar Tamu|');
$mpdf->AddPage('L', // L - landscape, P - portrait
'', '', '', '',
5, // margin_left
5, // margin right
7, // margin top
0, // margin bottom
5, // margin header
0); // margin footer
$data = $this->load->view('admin/content/resultprintdata_user', $datas, TRUE);
$mpdf->WriteHTML($data);
// $mpdf->WriteCell(110, 5);
/*$mpdf->default_font_size*/
$mpdf->Output();
}else {
// $this->Tamu_model->tgl_indonesia($date)
$datas['tamu'] = $this->Tamu_model->getAll();
$mpdf = new \Mpdf\Mpdf([
'default_font_size' => 12,
'default_font' => 'arial',
'format' => 'Legal'
]);
// $mpdf->defaultheaderfontsize=15;
// $mpdf->defaultheaderfontstyle='B';
// $mpdf->defaultheaderline=0;
// $mpdf->SetHeader('|Daftar Tamu|');
$mpdf->AddPage('L', // L - landscape, P - portrait
'', '', '', '',
5, // margin_left
5, // margin right
7, // margin top
5, // margin bottom
5, // margin header
0); // margin footer
$data = $this->load->view('admin/content/resultprintdata_user', $datas, TRUE);
$mpdf->WriteHTML($data);
// $mpdf->WriteCell(110, 5);
/*$mpdf->default_font_size*/
$mpdf->Output();
}
}else{
//jika session belum terdaftar, maka redirect ke halaman login
redirect("admin/login");
}
}
}
?> | 34.147368 | 98 | 0.367756 |
2f6f3e14150a479c0ea3ddf1d970d2ac299067c2 | 1,091 | cs | C# | sdk/dotnet/SageMaker/Inputs/DeviceArgs.cs | AaronFriel/pulumi-aws-native | 5621690373ac44accdbd20b11bae3be1baf022d1 | [
"Apache-2.0"
] | 29 | 2021-09-30T19:32:07.000Z | 2022-03-22T21:06:08.000Z | sdk/dotnet/SageMaker/Inputs/DeviceArgs.cs | AaronFriel/pulumi-aws-native | 5621690373ac44accdbd20b11bae3be1baf022d1 | [
"Apache-2.0"
] | 232 | 2021-09-30T19:26:26.000Z | 2022-03-31T23:22:06.000Z | sdk/dotnet/SageMaker/Inputs/DeviceArgs.cs | AaronFriel/pulumi-aws-native | 5621690373ac44accdbd20b11bae3be1baf022d1 | [
"Apache-2.0"
] | 4 | 2021-11-10T19:42:01.000Z | 2022-02-05T10:15:49.000Z | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AwsNative.SageMaker.Inputs
{
/// <summary>
/// Edge device you want to create
/// </summary>
public sealed class DeviceArgs : Pulumi.ResourceArgs
{
/// <summary>
/// Description of the device
/// </summary>
[Input("description")]
public Input<string>? Description { get; set; }
/// <summary>
/// The name of the device
/// </summary>
[Input("deviceName", required: true)]
public Input<string> DeviceName { get; set; } = null!;
/// <summary>
/// AWS Internet of Things (IoT) object name.
/// </summary>
[Input("iotThingName")]
public Input<string>? IotThingName { get; set; }
public DeviceArgs()
{
}
}
}
| 26.609756 | 81 | 0.590284 |
801a91a26ec56b9f7cd6828ab06f0d8d2cf32554 | 748 | java | Java | src/main/java/quickcarpet/mixin/client/IntegratedServerMixin.java | fxmorin/QuickCarpet | 1fd4949fc0e1743445e215f33506df6f84e3338c | [
"MIT"
] | null | null | null | src/main/java/quickcarpet/mixin/client/IntegratedServerMixin.java | fxmorin/QuickCarpet | 1fd4949fc0e1743445e215f33506df6f84e3338c | [
"MIT"
] | null | null | null | src/main/java/quickcarpet/mixin/client/IntegratedServerMixin.java | fxmorin/QuickCarpet | 1fd4949fc0e1743445e215f33506df6f84e3338c | [
"MIT"
] | null | null | null | package quickcarpet.mixin.client;
import net.minecraft.server.integrated.IntegratedServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import quickcarpet.QuickCarpet;
@Mixin(IntegratedServer.class)
public abstract class IntegratedServerMixin {
@Inject(method = "setupServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/integrated/IntegratedServer;loadWorld()V"))
private void quickcarpet$onSetupServerIntegrated(CallbackInfoReturnable<Boolean> cir) {
QuickCarpet.getInstance().onServerLoaded((IntegratedServer) (Object) this);
}
}
| 41.555556 | 138 | 0.803476 |
70c61003be5e88c06a92e42e125bbd1fd9c2195f | 4,017 | go | Go | client/emails/update_email_parameters.go | displague/gometal | 212875b1b10669e49251de576f2efa8c58aa5b38 | [
"MIT"
] | null | null | null | client/emails/update_email_parameters.go | displague/gometal | 212875b1b10669e49251de576f2efa8c58aa5b38 | [
"MIT"
] | null | null | null | client/emails/update_email_parameters.go | displague/gometal | 212875b1b10669e49251de576f2efa8c58aa5b38 | [
"MIT"
] | null | null | null | // Code generated by go-swagger; DO NOT EDIT.
package emails
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/t0mk/gometal/types"
)
// NewUpdateEmailParams creates a new UpdateEmailParams object
// with the default values initialized.
func NewUpdateEmailParams() *UpdateEmailParams {
var ()
return &UpdateEmailParams{
timeout: cr.DefaultTimeout,
}
}
// NewUpdateEmailParamsWithTimeout creates a new UpdateEmailParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewUpdateEmailParamsWithTimeout(timeout time.Duration) *UpdateEmailParams {
var ()
return &UpdateEmailParams{
timeout: timeout,
}
}
// NewUpdateEmailParamsWithContext creates a new UpdateEmailParams object
// with the default values initialized, and the ability to set a context for a request
func NewUpdateEmailParamsWithContext(ctx context.Context) *UpdateEmailParams {
var ()
return &UpdateEmailParams{
Context: ctx,
}
}
// NewUpdateEmailParamsWithHTTPClient creates a new UpdateEmailParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewUpdateEmailParamsWithHTTPClient(client *http.Client) *UpdateEmailParams {
var ()
return &UpdateEmailParams{
HTTPClient: client,
}
}
/*UpdateEmailParams contains all the parameters to send to the API endpoint
for the update email operation typically these are written to a http.Request
*/
type UpdateEmailParams struct {
/*Email
email to update
*/
Email *types.UpdateEmailInput
/*ID
Email UUID
*/
ID strfmt.UUID
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithTimeout adds the timeout to the update email params
func (o *UpdateEmailParams) WithTimeout(timeout time.Duration) *UpdateEmailParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the update email params
func (o *UpdateEmailParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the update email params
func (o *UpdateEmailParams) WithContext(ctx context.Context) *UpdateEmailParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the update email params
func (o *UpdateEmailParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the update email params
func (o *UpdateEmailParams) WithHTTPClient(client *http.Client) *UpdateEmailParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the update email params
func (o *UpdateEmailParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithEmail adds the email to the update email params
func (o *UpdateEmailParams) WithEmail(email *types.UpdateEmailInput) *UpdateEmailParams {
o.SetEmail(email)
return o
}
// SetEmail adds the email to the update email params
func (o *UpdateEmailParams) SetEmail(email *types.UpdateEmailInput) {
o.Email = email
}
// WithID adds the id to the update email params
func (o *UpdateEmailParams) WithID(id strfmt.UUID) *UpdateEmailParams {
o.SetID(id)
return o
}
// SetID adds the id to the update email params
func (o *UpdateEmailParams) SetID(id strfmt.UUID) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *UpdateEmailParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Email != nil {
if err := r.SetBodyParam(o.Email); err != nil {
return err
}
}
// path param id
if err := r.SetPathParam("id", o.ID.String()); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
| 25.10625 | 96 | 0.756286 |
285e74a95d2a5b8737ecb4b2c739d6be810b6d82 | 4,653 | cpp | C++ | src/plugins/listops/len_operation.cpp | diehlpk/phylanx | 7eba54f0f22dc66d18addac0b24f006380d0f798 | [
"BSL-1.0"
] | null | null | null | src/plugins/listops/len_operation.cpp | diehlpk/phylanx | 7eba54f0f22dc66d18addac0b24f006380d0f798 | [
"BSL-1.0"
] | null | null | null | src/plugins/listops/len_operation.cpp | diehlpk/phylanx | 7eba54f0f22dc66d18addac0b24f006380d0f798 | [
"BSL-1.0"
] | null | null | null | // Copyright (c) 2018 Parsa Amini
// Copyright (c) 2018 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <phylanx/config.hpp>
#include <phylanx/ir/node_data.hpp>
#include <phylanx/ir/ranges.hpp>
#include <phylanx/plugins/listops/len_operation.hpp>
#include <hpx/include/lcos.hpp>
#include <hpx/include/naming.hpp>
#include <hpx/include/util.hpp>
#include <hpx/throw_exception.hpp>
#include <cstdint>
#include <cstddef>
#include <memory>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include <blaze/Math.h>
///////////////////////////////////////////////////////////////////////////////
namespace phylanx { namespace execution_tree { namespace primitives
{
///////////////////////////////////////////////////////////////////////////
match_pattern_type const len_operation::match_data =
{
hpx::util::make_tuple("len",
std::vector<std::string>{"len(_1)"},
&create_len_operation, &create_primitive<len_operation>,
"li\n"
"Args:\n"
"\n"
" li (object) : a list, vector, or matrix\n"
"\n"
"Returns:\n"
"\n"
"The size of the given object."
)
};
///////////////////////////////////////////////////////////////////////////
len_operation::len_operation(
primitive_arguments_type&& operands,
std::string const& name, std::string const& codename)
: primitive_component_base(std::move(operands), name, codename)
{}
///////////////////////////////////////////////////////////////////////////
hpx::future<primitive_argument_type> len_operation::eval(
primitive_arguments_type const& operands,
primitive_arguments_type const& args) const
{
if (operands.size() != 1)
{
HPX_THROW_EXCEPTION(hpx::bad_parameter,
"phylanx::execution_tree::primitives::len_operation::eval",
util::generate_error_message(
"len_operation accepts exactly one argument", name_,
codename_));
}
auto this_ = this->shared_from_this();
return hpx::dataflow(hpx::launch::sync, hpx::util::unwrapping(
[this_ = std::move(this_)](primitive_argument_type&& arg)
-> primitive_argument_type
{
if (is_list_operand_strict(arg))
{
auto val = extract_list_value_strict(std::move(arg));
return primitive_argument_type{ir::node_data<std::int64_t>{
static_cast<std::int64_t>(val.size())}};
}
else if (is_string_operand(arg))
{
auto val = extract_string_value(std::move(arg));
return primitive_argument_type{ir::node_data<std::int64_t>{
static_cast<std::int64_t>(val.size())}};
}
else if (is_boolean_operand_strict(arg) ||
is_integer_operand_strict(arg) ||
is_numeric_operand_strict(arg))
{
std::size_t dim = extract_numeric_value_dimension(arg);
auto val = extract_numeric_value_dimensions(std::move(arg));
switch (dim)
{
case 0:
return primitive_argument_type{ir::node_data<std::int64_t>{
static_cast<std::int64_t>(1)}};
case 1:
return primitive_argument_type{ir::node_data<std::int64_t>{
static_cast<std::int64_t>(val[1])}};
case 2:
return primitive_argument_type{ir::node_data<std::int64_t>{
static_cast<std::int64_t>(val[0])}};
default:
break;
}
}
HPX_THROW_EXCEPTION(hpx::bad_parameter,
"phylanx::execution_tree::primitives::len_operation::eval",
this_->generate_error_message(
"len_operation accepts a list, a string, or a numeric "
"value as its operand only"));
}),
value_operand(operands[0], args,
name_, codename_));
}
hpx::future<primitive_argument_type> len_operation::eval(
primitive_arguments_type const& args) const
{
if (this->no_operands())
{
return eval(args, noargs);
}
return eval(this->operands(), args);
}
}}}
| 35.792308 | 79 | 0.527402 |
e71ac9e1764f0a1f44d33f3feab5c461d0ead9f2 | 1,478 | js | JavaScript | react-static-tweets/build/cjs/twitter-layout/tweet-skeleton.js | catoverse/yellowjobs-frontend | 26a4f0e7ab0bbf1a0425fc478e11ab7ef8dd3f0f | [
"MIT"
] | 12 | 2021-08-12T11:34:24.000Z | 2021-12-12T09:59:23.000Z | react-static-tweets/build/cjs/twitter-layout/tweet-skeleton.js | catoverse/yellowjobs-frontend | 26a4f0e7ab0bbf1a0425fc478e11ab7ef8dd3f0f | [
"MIT"
] | 29 | 2021-07-27T06:55:37.000Z | 2021-11-15T10:12:12.000Z | react-static-tweets/build/cjs/twitter-layout/tweet-skeleton.js | catoverse/yellowjobs-frontend | 26a4f0e7ab0bbf1a0425fc478e11ab7ef8dd3f0f | [
"MIT"
] | 4 | 2021-08-12T11:58:12.000Z | 2021-10-17T04:45:37.000Z | 'use strict'
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
return mod && mod.__esModule ? mod : { default: mod }
}
exports.__esModule = true
var react_1 = __importDefault(require('react'))
var classnames_1 = __importDefault(require('classnames'))
var skeleton_1 = require('./skeleton')
function TweetSkeleton(_a) {
var _b = _a.simple,
simple = _b === void 0 ? false : _b,
_c = _a.className,
className = _c === void 0 ? undefined : _c
return react_1['default'].createElement(
'div',
{
className: classnames_1['default'](
'static-tweet-skeleton-container',
className
),
},
react_1['default'].createElement(
'div',
{ className: 'static-tweet-skeleton-content' },
react_1['default'].createElement(skeleton_1.Skeleton, {
style: { height: '2.25rem' },
}),
react_1['default'].createElement(skeleton_1.Skeleton, {
style: { height: '7rem', margin: '1.25rem 0' },
}),
react_1['default'].createElement(skeleton_1.Skeleton, {
style: { height: '1.25rem' },
})
),
simple
? null
: react_1['default'].createElement(
'div',
{ className: 'static-tweet-skeleton-footer' },
react_1['default'].createElement(skeleton_1.Skeleton, {
style: { height: '1.25rem' },
})
)
)
}
exports['default'] = TweetSkeleton
//# sourceMappingURL=tweet-skeleton.js.map
| 29.56 | 65 | 0.598782 |
4d351750811ad5d14a6ea1397973e17c1a828ce5 | 7,305 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2692.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2692.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2692.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xe126, %rsi
lea addresses_D_ht+0x17926, %rdi
nop
nop
sub %rbp, %rbp
mov $101, %rcx
rep movsq
nop
dec %r15
lea addresses_normal_ht+0x16cb4, %r13
nop
nop
nop
sub %rcx, %rcx
mov $0x6162636465666768, %rbp
movq %rbp, (%r13)
add $28303, %r13
lea addresses_WT_ht+0x27d7, %rcx
nop
nop
nop
nop
cmp $12809, %r8
mov $0x6162636465666768, %r13
movq %r13, %xmm7
vmovups %ymm7, (%rcx)
dec %r15
lea addresses_A_ht+0x15906, %rsi
cmp %r15, %r15
mov $0x6162636465666768, %rbp
movq %rbp, %xmm1
movups %xmm1, (%rsi)
nop
cmp %rsi, %rsi
lea addresses_UC_ht+0x127d6, %r15
nop
nop
dec %rdi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm6
and $0xffffffffffffffc0, %r15
vmovntdq %ymm6, (%r15)
dec %rbp
lea addresses_normal_ht+0x9eae, %r13
nop
nop
nop
nop
add $25617, %rdi
and $0xffffffffffffffc0, %r13
vmovaps (%r13), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %r8
mfence
lea addresses_D_ht+0xa126, %r8
nop
nop
nop
nop
cmp $6326, %rsi
movb $0x61, (%r8)
nop
xor $29138, %rbp
lea addresses_UC_ht+0x63a6, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
dec %rdi
and $0xffffffffffffffc0, %rsi
vmovaps (%rsi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %r8
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_WC_ht+0xfb26, %r8
and %rbp, %rbp
movw $0x6162, (%r8)
nop
nop
nop
nop
and $22400, %r15
lea addresses_UC_ht+0xe466, %rcx
nop
nop
cmp %rsi, %rsi
mov (%rcx), %r15
nop
nop
nop
nop
inc %rdi
lea addresses_UC_ht+0xef26, %rsi
lea addresses_WC_ht+0xea6, %rdi
nop
nop
nop
nop
nop
sub %r14, %r14
mov $116, %rcx
rep movsl
nop
add $32438, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %rbp
push %rbx
push %rdi
// Store
lea addresses_UC+0x7b26, %rbx
nop
nop
nop
nop
xor $57086, %rbp
movw $0x5152, (%rbx)
nop
nop
nop
nop
add %rdi, %rdi
// Store
lea addresses_normal+0x1646, %rdi
nop
nop
sub %r12, %r12
movw $0x5152, (%rdi)
cmp $55904, %r12
// Faulty Load
lea addresses_normal+0x2126, %r11
nop
nop
nop
nop
inc %rdi
mov (%r11), %rbp
lea oracles, %r11
and $0xff, %rbp
shlq $12, %rbp
mov (%r11,%rbp,1), %rbp
pop %rdi
pop %rbx
pop %rbp
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
| 35.634146 | 2,999 | 0.659274 |
2ab4618c94432fd8b0577e786e12931753c8ad09 | 757 | kt | Kotlin | src/main/kotlin/ru/spbau/cliapp/interpreter/TasksRegistry.kt | fedochet/simple-cli-app | 8b5b09e7308da1d92d1cfd2e89519ff29beb11ba | [
"MIT"
] | null | null | null | src/main/kotlin/ru/spbau/cliapp/interpreter/TasksRegistry.kt | fedochet/simple-cli-app | 8b5b09e7308da1d92d1cfd2e89519ff29beb11ba | [
"MIT"
] | null | null | null | src/main/kotlin/ru/spbau/cliapp/interpreter/TasksRegistry.kt | fedochet/simple-cli-app | 8b5b09e7308da1d92d1cfd2e89519ff29beb11ba | [
"MIT"
] | 1 | 2018-04-13T12:02:48.000Z | 2018-04-13T12:02:48.000Z | package ru.spbau.cliapp.interpreter
import ru.spbau.cliapp.task.Task
/**
* Class for keeping [Task] instances by names along with some default fallback task.
*
* [defaultTaskCreator] is a function that creates tasks by name.
*/
class TasksRegistry(private val defaultTaskCreator: (String) -> Task, tasks: Map<String, Task> = emptyMap()) {
private val tasks: MutableMap<String, Task> = tasks.toMutableMap()
/**
* Adds task by this name into the registry, replaces existing.
*/
fun addTask(name: String, task: Task) {
tasks[name] = task
}
/**
* Returns task found by this name or created by [defaultTaskCreator].
*/
fun getTaskByName(name: String): Task = tasks[name] ?: defaultTaskCreator(name)
}
| 29.115385 | 110 | 0.681638 |
49b62a383b3b70c6191ae9ecf56df7a8c119d5db | 564,512 | html | HTML | docs/api.html | OneRaynyDay/treeno | ce11b8447f471c0b5ea596a211b3855625ec43eb | [
"MIT"
] | 1 | 2021-12-28T19:00:01.000Z | 2021-12-28T19:00:01.000Z | docs/api.html | OneRaynyDay/treeno | ce11b8447f471c0b5ea596a211b3855625ec43eb | [
"MIT"
] | null | null | null | docs/api.html | OneRaynyDay/treeno | ce11b8447f471c0b5ea596a211b3855625ec43eb | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1"><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>API Reference</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/theme.css " type="text/css" />
<!-- sphinx script_files -->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<!-- bundled in js (rollup iife) -->
<!-- <script src="_static/theme-vendors.js"></script> -->
<script src="_static/theme.js" defer></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Welcome to treeno’s documentation!" href="index.html" />
</head>
<body>
<div id="app">
<div class="theme-container" :class="pageClasses"><navbar @toggle-sidebar="toggleSidebar">
<router-link to="index.html" class="home-link">
<span class="site-name">treeno</span>
</router-link>
<div class="links">
<navlinks class="can-hide">
</navlinks>
</div>
</navbar>
<div class="sidebar-mask" @click="toggleSidebar(false)">
</div>
<sidebar @toggle-sidebar="toggleSidebar">
<navlinks>
</navlinks><div id="searchbox" class="searchbox" role="search">
<div class="caption"><span class="caption-text">Quick search</span>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Search" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div><div class="sidebar-links" role="navigation" aria-label="main navigation">
<div class="sidebar-group">
<p class="caption">
<span class="caption-text"><a href="index.html#api-reference">api reference</a></span>
</p>
<ul class="current">
<li class="toctree-l1 current">
<a href="#" class="reference internal current">API Reference</a>
<ul>
<li class="toctree-l2"><a href="#module-treeno.base" class="reference internal">Treeno Base</a></li>
<li class="toctree-l2"><a href="#module-treeno.expression" class="reference internal">Treeno Expressions</a></li>
<li class="toctree-l2"><a href="#module-treeno.relation" class="reference internal">Treeno Relations</a></li>
</ul>
</li>
</ul>
</div>
</div>
</sidebar>
<page>
<div class="body-header" role="navigation" aria-label="navigation">
<ul class="breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>API Reference</li>
</ul>
<ul class="page-nav">
<li class="prev">
<a href="index.html"
title="previous chapter">← Welcome to treeno’s documentation!</a>
</li>
</ul>
</div>
<hr>
<div class="content" role="main" v-pre>
<section id="api-reference">
<h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h1>
<section id="module-treeno.base">
<span id="treeno-base"></span><h2>Treeno Base<a class="headerlink" href="#module-treeno.base" title="Permalink to this headline">¶</a></h2>
<p>Treeno is built around the concept of creating python nodes that represent SQL constructs. These constructs must be
interoperable with SQL strings, which means:</p>
<ol class="arabic simple">
<li><p>The trees created by a hierarchy of nodes can produce valid SQL.</p></li>
<li><p>We can construct a Treeno tree from valid SQL.</p></li>
</ol>
<p>In order to do this, this module introduces some preliminary classes for printing/formatting SQL and the base
<a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> superclass responsible for representing all SQL nodes.</p>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.base.Sql">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.base.</span></span><span class="sig-name descname"><span class="pre">Sql</span></span><a class="headerlink" href="#treeno.base.Sql" title="Permalink to this definition">¶</a></dt>
<dd><p>A base class for all SQL nodes in Treeno.</p>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.base.Sql.assert_equals">
<span class="sig-name descname"><span class="pre">assert_equals</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.base.Sql.assert_equals" title="Permalink to this definition">¶</a></dt>
<dd><p>Assert whether two <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> nodes are the same.</p>
<p>For more information, refer to <a class="reference internal" href="#treeno.base.Sql.equals" title="treeno.base.Sql.equals"><code class="xref py py-func docutils literal notranslate"><span class="pre">Sql.equals()</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.base.Sql.equals">
<span class="sig-name descname"><span class="pre">equals</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">other</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.base.Sql.equals" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks to see whether two <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> nodes have identical content.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Why do we not use <code class="docutils literal notranslate"><span class="pre">__eq__</span></code> here? Because for the sake of syntactical sugar, we need that operator for
<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a> to evaluate whether two objects are equal in SQL space (thus generating
a Sql node using <a class="reference internal" href="#treeno.expression.Equal" title="treeno.expression.Equal"><code class="xref py py-class docutils literal notranslate"><span class="pre">Equal</span></code></a> rather than returning to us a boolean value).</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>other</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code>) – Another potentially SQL-like object.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>True if both objects are equal, False otherwise.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.base.Sql.sql">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.base.Sql.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.base.PrintOptions">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.base.</span></span><span class="sig-name descname"><span class="pre">PrintOptions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">spaces</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.base.PrintOptions" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.base.PrintOptions.mode">
<span class="sig-name descname"><span class="pre">mode</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.base.PrintMode</span></em><a class="headerlink" href="#treeno.base.PrintOptions.mode" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.base.PrintOptions.spaces">
<span class="sig-name descname"><span class="pre">spaces</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="headerlink" href="#treeno.base.PrintOptions.spaces" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</section>
<section id="module-treeno.expression">
<span id="treeno-expressions"></span><h2>Treeno Expressions<a class="headerlink" href="#module-treeno.expression" title="Permalink to this headline">¶</a></h2>
<p>Treeno supports arbitrary expressions including arithmetic binary, arithmetic unary, function, boolean expressions and
more. Underneath the hood, the values to be expressed in SQL are actually nodes of a tree and the tree is traversed to
generate SQL for execution. The base class which supports a suite of syntactic sugar such as <code class="docutils literal notranslate"><span class="pre">__add__</span></code>, <code class="docutils literal notranslate"><span class="pre">__eq__</span></code> and
is <a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a>.</p>
<p>Here’s an example using the CLI tool:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>❯ treeno tree expression <span class="s2">"1+2*3"</span>
Add
_________________________________<span class="p">|</span>__________________________
<span class="p">|</span> <span class="p">|</span> right
<span class="p">|</span> <span class="p">|</span> <span class="p">|</span>
<span class="p">|</span> <span class="p">|</span> Multiply
<span class="p">|</span> <span class="p">|</span> __________________________<span class="p">|</span>__________________
<span class="p">|</span> left <span class="p">|</span> left right
<span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span>
<span class="p">|</span> Literal <span class="p">|</span> Literal Literal
<span class="p">|</span> ________<span class="p">|</span>______ <span class="p">|</span> ________<span class="p">|</span>_______ ________<span class="p">|</span>______
data_type data_type value data_type data_type value data_type value
<span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span> <span class="p">|</span>
INTEGER INTEGER <span class="m">1</span> INTEGER INTEGER <span class="m">2</span> INTEGER <span class="m">3</span>
</pre></div>
</div>
<p>A simple multiply and add is represented as nodes in a tree, each node having a data type (here, all of them are
INTEGER).</p>
<p>A myriad of python data types are supported to convert to <a class="reference internal" href="#treeno.expression.Literal" title="treeno.expression.Literal"><code class="xref py py-class docutils literal notranslate"><span class="pre">Literal</span></code></a> nodes using <a class="reference internal" href="#treeno.expression.wrap_literal" title="treeno.expression.wrap_literal"><code class="xref py py-func docutils literal notranslate"><span class="pre">wrap_literal()</span></code></a>. We even
support <code class="docutils literal notranslate"><span class="pre">decimal.Decimal</span></code> types for fixed precision decimal point classes in python. A notable exception is NoneType,
which cannot be wrapped to a literal. Instead, please use the <code class="xref py py-data docutils literal notranslate"><span class="pre">NULL</span></code> singleton.</p>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Add">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Add</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Add" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Add.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Add.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Add.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Add.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Add.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Add.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.AliasedStar">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">AliasedStar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">star</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">aliases</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.AliasedStar" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents one or more aliases corresponding to an unpacked star</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.AliasedStar.aliases">
<span class="sig-name descname"><span class="pre">aliases</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.AliasedStar.aliases" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.AliasedStar.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.AliasedStar.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.AliasedStar.star">
<span class="sig-name descname"><span class="pre">star</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Star" title="treeno.expression.Star"><span class="pre">treeno.expression.Star</span></a></em><a class="headerlink" href="#treeno.expression.AliasedStar.star" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.AliasedValue">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">AliasedValue</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">alias</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.AliasedValue" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents an alias on a value. For unpacking individual column aliases
from a star, see AliasedStar</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.AliasedValue.alias">
<span class="sig-name descname"><span class="pre">alias</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.expression.AliasedValue.alias" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.AliasedValue.identifier">
<span class="sig-name descname"><span class="pre">identifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.AliasedValue.identifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Identifier for the value.</p>
<p>Values if aliased can have identifiers which are useful to capture output information. By default,
<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a> s are not identifiable by themselves.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>String name for the value’s identifier if one exists, otherwise None.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.AliasedValue.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.AliasedValue.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.AliasedValue.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.AliasedValue.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.And">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">And</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.And" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.And.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.And.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.And.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.And.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.And.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.And.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Array">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Array</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">values</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Array" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Array.from_values">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_values</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">vals</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Array.from_values" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#treeno.expression.Array" title="treeno.expression.Array"><code class="xref py py-class docutils literal notranslate"><span class="pre">Array</span></code></a></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Array.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Array.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Array.values">
<span class="sig-name descname"><span class="pre">values</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Array.values" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Between">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Between</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lower</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">upper</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Between" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Between.lower">
<span class="sig-name descname"><span class="pre">lower</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Between.lower" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Between.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Between.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Between.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">negate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Between.to_string" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Between.upper">
<span class="sig-name descname"><span class="pre">upper</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Between.upper" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Between.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Between.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.BinaryExpression">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">BinaryExpression</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.BinaryExpression" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.BinaryExpression.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.BinaryExpression.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.BinaryExpression.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.BinaryExpression.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Case">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Case</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">branches</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">else_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Case" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Case.branches">
<span class="sig-name descname"><span class="pre">branches</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.When" title="treeno.expression.When"><span class="pre">treeno.expression.When</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Case.branches" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Case.else_">
<span class="sig-name descname"><span class="pre">else_</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Else" title="treeno.expression.Else"><span class="pre">treeno.expression.Else</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Case.else_" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Case.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Case.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Case.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Case.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Cast">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Cast</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Cast" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Cast.expr">
<span class="sig-name descname"><span class="pre">expr</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Cast.expr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Cast.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Cast.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.DistinctFrom">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">DistinctFrom</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.DistinctFrom" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.DistinctFrom.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.DistinctFrom.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.DistinctFrom.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.DistinctFrom.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.DistinctFrom.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.DistinctFrom.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.DistinctFrom.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.DistinctFrom.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.DistinctFrom.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">negate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.DistinctFrom.to_string" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Divide">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Divide</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Divide" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Divide.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.Divide.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Divide.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Divide.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Divide.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Divide.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Divide.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Divide.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Else">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Else</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Else" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Else.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Else.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Else.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Else.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Equal">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Equal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Equal" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Equal.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.Equal.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Equal.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Equal.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Equal.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Equal.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Equal.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Equal.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Equal.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">negate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Equal.to_string" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Expression">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Expression</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Expression" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a complex expression which involves a function and its corresponding arguments.</p>
<p>Expressions can be grouped into two general groups - <code class="xref py py-class docutils literal notranslate"><span class="pre">treeno.functions.base.Function</span></code> s and built-in SQL operators. For all
functions, please refer to the module <code class="xref py py-mod docutils literal notranslate"><span class="pre">treeno.functions</span></code>. Operators live in <cite>treeno.expression</cite>, and support
basic arihmetic scalar transforms such as add, subtract, divide, etc. and boolean clauses such as LIKE, IS NULL,
DISTINCT FROM, etc.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Expression.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.Expression.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Field">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Field</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">table</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Field" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a field referenced in the input relations of a SELECT query</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em>) – The name of the field</p></li>
<li><p><strong>table</strong> (<em>Optional</em><em>[</em><em>Union</em><em>[</em><em>str</em><em>, </em><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><em>treeno.expression.Value</em></a><em>]</em><em>]</em>) – The source of the field. This is sometimes necessary when there are multiple relations with duplicate
column names and the name is not sufficient to disambiguate the field.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Field.identifier">
<span class="sig-name descname"><span class="pre">identifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Field.identifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Identifier for the value.</p>
<p>Values if aliased can have identifiers which are useful to capture output information. By default,
<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a> s are not identifiable by themselves.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>String name for the value’s identifier if one exists, otherwise None.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Field.name">
<span class="sig-name descname"><span class="pre">name</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.expression.Field.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Field.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Field.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Field.table">
<span class="sig-name descname"><span class="pre">table</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Field.table" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.GreaterThan">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">GreaterThan</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.GreaterThan" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.GreaterThan.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.GreaterThan.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.GreaterThan.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.GreaterThan.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.GreaterThan.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.GreaterThan.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.GreaterThan.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.GreaterThan.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.GreaterThanOrEqual">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">GreaterThanOrEqual</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.GreaterThanOrEqual" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.GreaterThanOrEqual.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.GreaterThanOrEqual.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.GreaterThanOrEqual.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.GreaterThanOrEqual.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.GreaterThanOrEqual.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.GreaterThanOrEqual.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.GreaterThanOrEqual.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.GreaterThanOrEqual.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.InList">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">InList</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exprs</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.InList" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.InList.exprs">
<span class="sig-name descname"><span class="pre">exprs</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.InList.exprs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.InList.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.InList.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.InList.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">negate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.InList.to_string" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.InList.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.InList.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.InQuery">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">InQuery</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">query</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.InQuery" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.InQuery.query">
<span class="sig-name descname"><span class="pre">query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.expression.InQuery.query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.InQuery.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.InQuery.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.InQuery.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">negate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.InQuery.to_string" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.InQuery.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.InQuery.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Interval">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Interval</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">from_interval</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">to_interval</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Interval" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Interval.from_interval">
<span class="sig-name descname"><span class="pre">from_interval</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.expression.Interval.from_interval" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Interval.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Interval.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Interval.to_interval">
<span class="sig-name descname"><span class="pre">to_interval</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Interval.to_interval" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Interval.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.expression.Interval.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.IsNull">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">IsNull</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.IsNull" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.IsNull.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.IsNull.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.IsNull.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">negate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.IsNull.to_string" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.IsNull.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.IsNull.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Lambda">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Lambda</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Lambda" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents an anonymous function. This expression will currently have an unknown type because it can never be
expressed as a standalone expression.</p>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Lambda.Variable">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Variable</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Lambda.Variable" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Lambda.Variable.identifier">
<span class="sig-name descname"><span class="pre">identifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Lambda.Variable.identifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Identifier for the value.</p>
<p>Values if aliased can have identifiers which are useful to capture output information. By default,
<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a> s are not identifiable by themselves.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>String name for the value’s identifier if one exists, otherwise None.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Lambda.Variable.name">
<span class="sig-name descname"><span class="pre">name</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.expression.Lambda.Variable.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Lambda.Variable.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Lambda.Variable.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Lambda.expr">
<span class="sig-name descname"><span class="pre">expr</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Lambda.expr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Lambda.from_generic_expr">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_generic_expr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">expr</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Lambda.from_generic_expr" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#treeno.expression.Lambda" title="treeno.expression.Lambda"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lambda</span></code></a></p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Lambda.inputs">
<span class="sig-name descname"><span class="pre">inputs</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Lambda.Variable" title="treeno.expression.Lambda.Variable"><span class="pre">treeno.expression.Lambda.Variable</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Lambda.inputs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Lambda.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Lambda.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.LessThan">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">LessThan</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.LessThan" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.LessThan.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.LessThan.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.LessThan.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.LessThan.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.LessThan.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.LessThan.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.LessThan.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.LessThan.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.LessThanOrEqual">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">LessThanOrEqual</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.LessThanOrEqual" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.LessThanOrEqual.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.LessThanOrEqual.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.LessThanOrEqual.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.LessThanOrEqual.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.LessThanOrEqual.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.LessThanOrEqual.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.LessThanOrEqual.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.LessThanOrEqual.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Like">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Like</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pattern</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">escape</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Like" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Like.escape">
<span class="sig-name descname"><span class="pre">escape</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Like.escape" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Like.pattern">
<span class="sig-name descname"><span class="pre">pattern</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Like.pattern" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Like.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Like.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Like.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">negate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Like.to_string" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Like.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Like.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Literal">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Literal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Literal" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a literal value in SQL.</p>
<p>Literal values are expressions that don’t require calling constructors to any SQL data types such as ARRAY,
and have a known data type (with the exception of NULL).</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">decimal</span> <span class="kn">import</span> <span class="n">Decimal</span>
<span class="gp">>>> </span><span class="c1"># Don't directly create a Literal value</span>
<span class="gp">>>> </span><span class="n">Literal</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span><span class="o">.</span><span class="n">data_type</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="o">...</span>
<span class="gr">AssertionError</span>: <span class="n">Please use wrap_literal to construct a Literal value so the data types are detected</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">VARCHAR(1)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">BOOLEAN</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">INTEGER</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">100000000000</span><span class="p">)</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">BIGINT</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mf">2.2</span><span class="p">)</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">DOUBLE</span>
<span class="gp">>>> </span><span class="c1"># Use decimal.Decimal if you wish to represent a fixed precision decimal point in SQL</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="n">Decimal</span><span class="p">(</span><span class="s2">"2.2"</span><span class="p">))</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">DECIMAL(2,1)</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><p><strong>value</strong> (<em>Any</em>) – A value in python representing a value in SQL.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Literal.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Literal.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Literal.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Any</span></em><a class="headerlink" href="#treeno.expression.Literal.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Minus">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Minus</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Minus" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Minus.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.Minus.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Minus.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Minus.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Minus.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Minus.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Minus.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Minus.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Modulus">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Modulus</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Modulus" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Modulus.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.Modulus.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Modulus.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Modulus.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Modulus.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Modulus.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Modulus.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Modulus.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Multiply">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Multiply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Multiply" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Multiply.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.Multiply.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Multiply.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Multiply.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Multiply.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Multiply.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Multiply.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Multiply.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Negative">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Negative</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Negative" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Negative.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Negative.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Negative.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Negative.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Not">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Not</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Not" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Not.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Not.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Not.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Not.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.NotEqual">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">NotEqual</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.NotEqual" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.NotEqual.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.NotEqual.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.NotEqual.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.NotEqual.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.NotEqual.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.NotEqual.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.NotEqual.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.NotEqual.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.NotEqual.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">negate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.NotEqual.to_string" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Or">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Or</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Or" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Or.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.Or.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Or.left">
<span class="sig-name descname"><span class="pre">left</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Or.left" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Or.right">
<span class="sig-name descname"><span class="pre">right</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Or.right" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Or.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Or.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Positive">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Positive</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Positive" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Positive.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Positive.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Positive.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Positive.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.RowConstructor">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">RowConstructor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">values</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.RowConstructor" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.RowConstructor.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.RowConstructor.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.RowConstructor.values">
<span class="sig-name descname"><span class="pre">values</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.RowConstructor.values" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Star">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Star</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">table</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Star" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a <cite>*</cite> or a <cite>table.*</cite> statement</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The reason Star does not inherit from Field is because a star has no name.
Fields must have a name, and allow an optional table identifier.</p>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Star.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Star.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Star.table">
<span class="sig-name descname"><span class="pre">table</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.expression.Star.table" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Subscript">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Subscript</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">index</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Subscript" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Subscript.index">
<span class="sig-name descname"><span class="pre">index</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Subscript.index" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Subscript.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Subscript.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Subscript.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.Subscript.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.TryCast">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">TryCast</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">expr</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.TryCast" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.TryCast.expr">
<span class="sig-name descname"><span class="pre">expr</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.TryCast.expr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.TryCast.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.TryCast.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.TypeConstructor">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">TypeConstructor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">type_name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.TypeConstructor" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.TypeConstructor.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.TypeConstructor.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.TypeConstructor.type_name">
<span class="sig-name descname"><span class="pre">type_name</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.expression.TypeConstructor.type_name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.TypeConstructor.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.expression.TypeConstructor.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.UnaryExpression">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">UnaryExpression</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.UnaryExpression" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.UnaryExpression.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.UnaryExpression.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.Value">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">Value</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Value" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a basic SQL value.</p>
<p>A value can be one of the following:</p>
<ol class="arabic simple">
<li><p>(<a class="reference internal" href="#treeno.expression.Literal" title="treeno.expression.Literal"><code class="xref py py-class docutils literal notranslate"><span class="pre">Literal</span></code></a>) A literal value with well-defined type</p></li>
<li><dl class="simple">
<dt>(<a class="reference internal" href="#treeno.expression.Field" title="treeno.expression.Field"><code class="xref py py-class docutils literal notranslate"><span class="pre">Field</span></code></a>) A reference to a field in a table, which doesn’t always have a well-defined type before</dt><dd><p>resolution.</p>
</dd>
</dl>
</li>
<li><p>(<a class="reference internal" href="#treeno.expression.Star" title="treeno.expression.Star"><code class="xref py py-class docutils literal notranslate"><span class="pre">Star</span></code></a>) A reference to ALL of the fields in a table.</p></li>
<li><p>(<a class="reference internal" href="#treeno.expression.AliasedValue" title="treeno.expression.AliasedValue"><code class="xref py py-class docutils literal notranslate"><span class="pre">AliasedValue</span></code></a> and <a class="reference internal" href="#treeno.expression.AliasedStar" title="treeno.expression.AliasedStar"><code class="xref py py-class docutils literal notranslate"><span class="pre">AliasedStar</span></code></a>) Aliased versions of (2) and (3).</p></li>
<li><dl class="simple">
<dt>(<a class="reference internal" href="#treeno.expression.Expression" title="treeno.expression.Expression"><code class="xref py py-class docutils literal notranslate"><span class="pre">Expression</span></code></a>) A nested complex expression involving any <a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a>. This can be a</dt><dd><p>built-in operator such as +, a lambda expression, a complex function involving potentially variadic arguments
as seen in <code class="xref py py-mod docutils literal notranslate"><span class="pre">treeno.functions</span></code> inheriting from <code class="xref py py-class docutils literal notranslate"><span class="pre">treeno.functions.base.Function</span></code>, etc.</p>
</dd>
</dl>
</li>
</ol>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><p><strong>data_type</strong> (<em>treeno.datatypes.types.DataType</em>) – The data type of the value. If not specified, defaults to UNKNOWN, which means the data type can’t
be directly determined.</p>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.Value.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.expression.Value.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.Value.identifier">
<span class="sig-name descname"><span class="pre">identifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.Value.identifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Identifier for the value.</p>
<p>Values if aliased can have identifiers which are useful to capture output information. By default,
<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a> s are not identifiable by themselves.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>String name for the value’s identifier if one exists, otherwise None.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.expression.When">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">When</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">condition</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.When" title="Permalink to this definition">¶</a></dt>
<dd><dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.When.condition">
<span class="sig-name descname"><span class="pre">condition</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.When.condition" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.expression.When.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.When.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.expression.When.value">
<span class="sig-name descname"><span class="pre">value</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.expression.When.value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="treeno.expression.builtin_binary_str">
<span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">builtin_binary_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">string_format</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.builtin_binary_str" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="treeno.expression.builtin_unary_str">
<span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">builtin_unary_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">string_format</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.builtin_unary_str" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="treeno.expression.pemdas_str">
<span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">pemdas_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">current_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">val</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_left</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.pemdas_str" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply parenthesization onto the nested expression if required for pemdas.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>current_type</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">Type</span></code>[<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a>]) – Current value’s type.</p></li>
<li><p><strong>val</strong> (<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a>) – One of the direct children of the current value.</p></li>
<li><p><strong>is_left</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – Whether this value is the leftmost child. This is used to determine whether the right child should
be parenthesized or not. i.e. 1+(2+3) or 1+2+3.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="treeno.expression.wrap_literal">
<span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">wrap_literal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">val</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.wrap_literal" title="Permalink to this definition">¶</a></dt>
<dd><p>Convenience method to wrap a literal value into a treeno Value</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a></p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="treeno.expression.wrap_literal_list">
<span class="sig-prename descclassname"><span class="pre">treeno.expression.</span></span><span class="sig-name descname"><span class="pre">wrap_literal_list</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">vals</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.expression.wrap_literal_list" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">List</span></code>[<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code></a>]</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-treeno.relation">
<span id="treeno-relations"></span><h2>Treeno Relations<a class="headerlink" href="#module-treeno.relation" title="Permalink to this headline">¶</a></h2>
<p>Every relation in Treeno is a <a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Relation</span></code></a>. <a class="reference external" href="https://en.wikipedia.org/wiki/Relation_(database)">Relations</a> are SQL entities that contain rows of data,
with every row being the same data type, and each element in the row are assigned its corresponding column name.
You can think of relations as “things I can FROM in a SELECT query”.</p>
<p>For example, the following constructs are all relations:</p>
<div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="n">trino</span><span class="o">></span> <span class="k">VALUES</span> <span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">;</span>
<span class="n">_col0</span>
<span class="c1">-------</span>
<span class="mi">1</span>
<span class="mi">2</span>
<span class="mi">3</span>
<span class="n">trino</span><span class="o">></span> <span class="k">SELECT</span> <span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">;</span>
<span class="n">_col0</span> <span class="o">|</span> <span class="n">_col1</span> <span class="o">|</span> <span class="n">_col2</span>
<span class="c1">-------+-------+-------</span>
<span class="mi">1</span> <span class="o">|</span> <span class="mi">2</span> <span class="o">|</span> <span class="mi">3</span>
<span class="n">trino</span><span class="o">></span> <span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="k">UNNEST</span><span class="p">(</span><span class="nb">ARRAY</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">]);</span>
<span class="n">_col0</span>
<span class="c1">-------</span>
<span class="mi">1</span>
<span class="mi">2</span>
<span class="mi">3</span>
<span class="n">trino</span><span class="o">></span> <span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">some_table</span><span class="p">;</span>
<span class="n">_col0</span>
<span class="c1">-------</span>
<span class="mi">1</span>
<span class="mi">2</span>
<span class="mi">3</span>
</pre></div>
</div>
<p>Not all <a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Relation</span></code></a> s are directly queryable though! For those that are directly queryable, i.e. SELECT statements,
TABLE statements, etc, they inherit from <a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><code class="xref py py-class docutils literal notranslate"><span class="pre">Query</span></code></a> which directly inherits from <a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Relation</span></code></a>.</p>
<p>Since Treeno does not try to communicate with the metastore(s) powering <a class="reference internal" href="#treeno.relation.Table" title="treeno.relation.Table"><code class="xref py py-class docutils literal notranslate"><span class="pre">Table</span></code></a> s, we need user input to resolve
schemas. More information can be found in <a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Relation</span></code></a>.</p>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.AliasedRelation">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">AliasedRelation</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">relation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">alias</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">column_aliases</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.AliasedRelation" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents an alias corresponding to a relation</p>
<p>Aliased relations can change/add identifier to another underlying <a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Relation</span></code></a>, and can also rname the columns.
Here’s an example using resolve:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span>
<span class="gp">>>> </span><span class="n">aliased_relation</span> <span class="o">=</span> <span class="n">AliasedRelation</span><span class="p">(</span><span class="n">SelectQuery</span><span class="p">([</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> <span class="n">wrap_literal</span><span class="p">(</span><span class="s1">'2'</span><span class="p">)]),</span> <span class="s2">"query"</span><span class="p">,</span> <span class="p">[</span><span class="s2">"x"</span><span class="p">,</span> <span class="s2">"y"</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">aliased_schema</span> <span class="o">=</span> <span class="n">aliased_relation</span><span class="o">.</span><span class="n">resolve</span><span class="p">(</span><span class="n">Schema</span><span class="o">.</span><span class="n">empty_schema</span><span class="p">())</span>
<span class="gp">>>> </span><span class="p">[</span><span class="n">schema_field</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">schema_field</span> <span class="ow">in</span> <span class="n">aliased_schema</span><span class="o">.</span><span class="n">fields</span><span class="p">]</span>
<span class="go">['x', 'y']</span>
<span class="gp">>>> </span><span class="n">aliased_schema</span><span class="o">.</span><span class="n">relation_ids</span>
<span class="go">{'query'}</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>relation</strong> (<a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><em>treeno.relation.Relation</em></a>) – A relation to alias over.</p></li>
<li><p><strong>alias</strong> (<em>str</em>) – Alias for the relation.</p></li>
<li><p><strong>column_aliases</strong> (<em>Optional</em><em>[</em><em>List</em><em>[</em><em>str</em><em>]</em><em>]</em>) – An optional list of names for each column of the underlying relation.</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.AliasedRelation.alias">
<span class="sig-name descname"><span class="pre">alias</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.relation.AliasedRelation.alias" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.AliasedRelation.column_aliases">
<span class="sig-name descname"><span class="pre">column_aliases</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.AliasedRelation.column_aliases" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.AliasedRelation.identifier">
<span class="sig-name descname"><span class="pre">identifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.AliasedRelation.identifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Shorthand identifier for the relation</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A string if the relation has a well-defined identifier, otherwise None</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.AliasedRelation.relation">
<span class="sig-name descname"><span class="pre">relation</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><span class="pre">treeno.relation.Relation</span></a></em><a class="headerlink" href="#treeno.relation.AliasedRelation.relation" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.AliasedRelation.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.AliasedRelation.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.AliasedRelation.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.AliasedRelation.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.ExceptQuery">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">ExceptQuery</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left_query</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right_query</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">set_quantifier</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">SetQuantifier.DISTINCT</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orderby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.ExceptQuery" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a set subtract of left query with right query.</p>
<p>Note that except queries cannot use set quantifier ALL, since Trino implements EXCEPT by hashing the rows
and subsequently deduplicates input query rows.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">NULL</span>
<span class="gp">>>> </span><span class="n">q</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">([</span><span class="n">NULL</span><span class="p">])</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">ExceptQuery</span><span class="p">(</span><span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">set_quantifier</span><span class="o">=</span><span class="n">SetQuantifier</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">))</span>
<span class="go">'(SELECT NULL) EXCEPT DISTINCT (SELECT NULL)'</span>
<span class="gp">>>> </span><span class="n">ExceptQuery</span><span class="p">(</span><span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">set_quantifier</span><span class="o">=</span><span class="n">SetQuantifier</span><span class="o">.</span><span class="n">ALL</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="o">...</span>
<span class="gr">AssertionError</span>: <span class="n">EXCEPT does not support ALL</span>
</pre></div>
</div>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.ExceptQuery.left_query">
<span class="sig-name descname"><span class="pre">left_query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.ExceptQuery.left_query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.ExceptQuery.right_query">
<span class="sig-name descname"><span class="pre">right_query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.ExceptQuery.right_query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.ExceptQuery.set_quantifier">
<span class="sig-name descname"><span class="pre">set_quantifier</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.base.SetQuantifier</span></em><a class="headerlink" href="#treeno.relation.ExceptQuery.set_quantifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.ExceptQuery.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.ExceptQuery.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.IntersectQuery">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">IntersectQuery</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left_query</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right_query</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">set_quantifier</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">SetQuantifier.DISTINCT</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orderby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.IntersectQuery" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents an intersection of two queries.</p>
<p>Note that intersect queries cannot use set quantifier ALL, since Trino implements INTERSECT by hashing the rows
and subsequently deduplicates input query rows.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">NULL</span>
<span class="gp">>>> </span><span class="n">q</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">([</span><span class="n">NULL</span><span class="p">])</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">IntersectQuery</span><span class="p">(</span><span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">set_quantifier</span><span class="o">=</span><span class="n">SetQuantifier</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">))</span>
<span class="go">'(SELECT NULL) INTERSECT DISTINCT (SELECT NULL)'</span>
<span class="gp">>>> </span><span class="n">IntersectQuery</span><span class="p">(</span><span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">set_quantifier</span><span class="o">=</span><span class="n">SetQuantifier</span><span class="o">.</span><span class="n">ALL</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="o">...</span>
<span class="gr">AssertionError</span>: <span class="n">INTERSECT does not support ALL</span>
</pre></div>
</div>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.IntersectQuery.left_query">
<span class="sig-name descname"><span class="pre">left_query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.IntersectQuery.left_query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.IntersectQuery.right_query">
<span class="sig-name descname"><span class="pre">right_query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.IntersectQuery.right_query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.IntersectQuery.set_quantifier">
<span class="sig-name descname"><span class="pre">set_quantifier</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.base.SetQuantifier</span></em><a class="headerlink" href="#treeno.relation.IntersectQuery.set_quantifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.IntersectQuery.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.IntersectQuery.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.Join">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">Join</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left_relation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right_relation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">config</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Join" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a join between two relations</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>left_relation</strong> (<a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><em>treeno.relation.Relation</em></a>) – An arbitrary relation to be joined on</p></li>
<li><p><strong>right_relation</strong> (<a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><em>treeno.relation.Relation</em></a>) – An arbitrary relation to be joined on</p></li>
<li><p><strong>config</strong> (<a class="reference internal" href="#treeno.relation.JoinConfig" title="treeno.relation.JoinConfig"><em>treeno.relation.JoinConfig</em></a>) – Details on what type of join we’re performing. Refer to <a class="reference internal" href="#treeno.relation.JoinConfig" title="treeno.relation.JoinConfig"><code class="xref py py-class docutils literal notranslate"><span class="pre">JoinConfig</span></code></a> for more info.</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Join.config">
<span class="sig-name descname"><span class="pre">config</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.JoinConfig" title="treeno.relation.JoinConfig"><span class="pre">treeno.relation.JoinConfig</span></a></em><a class="headerlink" href="#treeno.relation.Join.config" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Join.left_relation">
<span class="sig-name descname"><span class="pre">left_relation</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><span class="pre">treeno.relation.Relation</span></a></em><a class="headerlink" href="#treeno.relation.Join.left_relation" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Join.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Join.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Join.right_relation">
<span class="sig-name descname"><span class="pre">right_relation</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><span class="pre">treeno.relation.Relation</span></a></em><a class="headerlink" href="#treeno.relation.Join.right_relation" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Join.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Join.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.JoinConfig">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">JoinConfig</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">join_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">natural</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">criteria</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinConfig" title="Permalink to this definition">¶</a></dt>
<dd><p>Details the method of join used in a <a class="reference internal" href="#treeno.relation.Join" title="treeno.relation.Join"><code class="xref py py-class docutils literal notranslate"><span class="pre">Join</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>join_type</strong> (<a class="reference internal" href="#treeno.relation.JoinType" title="treeno.relation.JoinType"><em>treeno.relation.JoinType</em></a>) – The type of JOIN (i.e. CROSS JOIN, INNER JOIN, etc)</p></li>
<li><p><strong>natural</strong> (<em>bool</em>) – Whether the join is natural (i.e. joins on equality on column names that are the same between two queries)</p></li>
<li><p><strong>criteria</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="#treeno.relation.JoinCriteria" title="treeno.relation.JoinCriteria"><em>treeno.relation.JoinCriteria</em></a><em>]</em>) – What boolean expression criteria the join requires. Refer to <a class="reference internal" href="#treeno.relation.JoinCriteria" title="treeno.relation.JoinCriteria"><code class="xref py py-class docutils literal notranslate"><span class="pre">JoinCriteria</span></code></a> for more info.</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinConfig.criteria">
<span class="sig-name descname"><span class="pre">criteria</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.relation.JoinCriteria" title="treeno.relation.JoinCriteria"><span class="pre">treeno.relation.JoinCriteria</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.JoinConfig.criteria" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinConfig.join_type">
<span class="sig-name descname"><span class="pre">join_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.JoinType" title="treeno.relation.JoinType"><span class="pre">treeno.relation.JoinType</span></a></em><a class="headerlink" href="#treeno.relation.JoinConfig.join_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinConfig.natural">
<span class="sig-name descname"><span class="pre">natural</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">bool</span></em><a class="headerlink" href="#treeno.relation.JoinConfig.natural" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.JoinConfig.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinConfig.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.JoinCriteria">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">JoinCriteria</span></span><a class="headerlink" href="#treeno.relation.JoinCriteria" title="Permalink to this definition">¶</a></dt>
<dd><p>Join criterias are complex expressions that describe exactly how a JOIN is done.</p>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.JoinCriteria.build_sql">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">build_sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinCriteria.build_sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a dictionary mapping of statements to strings</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.JoinCriteria.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinCriteria.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.JoinOnCriteria">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">JoinOnCriteria</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">constraint</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinOnCriteria" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform a join between two relations using boolean expressions.</p>
<p>An example ON usage:</p>
<div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span> <span class="k">AS</span> <span class="ss">"foo"</span><span class="p">)</span> <span class="ss">"a"</span> <span class="k">JOIN</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span> <span class="k">AS</span> <span class="ss">"foo"</span><span class="p">)</span> <span class="ss">"b"</span> <span class="k">ON</span> <span class="ss">"a"</span><span class="p">.</span><span class="ss">"foo"</span> <span class="o">=</span> <span class="ss">"b"</span><span class="p">.</span><span class="ss">"foo"</span><span class="p">;</span>
<span class="n">foo</span> <span class="o">|</span> <span class="n">foo</span>
<span class="c1">-----+-----</span>
<span class="mi">1</span> <span class="o">|</span> <span class="mi">1</span>
<span class="p">(</span><span class="mi">1</span> <span class="k">row</span><span class="p">)</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><p><strong>constraint</strong> (<a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><em>treeno.expression.Value</em></a>) – A boolean expression constraining the join to where the expression evaluates to True using
two subqueries’ rows.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.JoinOnCriteria.build_sql">
<span class="sig-name descname"><span class="pre">build_sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinOnCriteria.build_sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a dictionary mapping of statements to strings</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinOnCriteria.constraint">
<span class="sig-name descname"><span class="pre">constraint</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.relation.JoinOnCriteria.constraint" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.JoinType">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">JoinType</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinType" title="Permalink to this definition">¶</a></dt>
<dd><p>An enumeration.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinType.CROSS">
<span class="sig-name descname"><span class="pre">CROSS</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'CROSS'</span></em><a class="headerlink" href="#treeno.relation.JoinType.CROSS" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinType.INNER">
<span class="sig-name descname"><span class="pre">INNER</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'INNER'</span></em><a class="headerlink" href="#treeno.relation.JoinType.INNER" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinType.LEFT">
<span class="sig-name descname"><span class="pre">LEFT</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'LEFT'</span></em><a class="headerlink" href="#treeno.relation.JoinType.LEFT" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinType.OUTER">
<span class="sig-name descname"><span class="pre">OUTER</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'FULL</span> <span class="pre">OUTER'</span></em><a class="headerlink" href="#treeno.relation.JoinType.OUTER" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinType.RIGHT">
<span class="sig-name descname"><span class="pre">RIGHT</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'RIGHT'</span></em><a class="headerlink" href="#treeno.relation.JoinType.RIGHT" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.JoinUsingCriteria">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">JoinUsingCriteria</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">column_names</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinUsingCriteria" title="Permalink to this definition">¶</a></dt>
<dd><p>Using allows us to join on equality criterion on multiple rows.</p>
<p>There’s one subtle difference between USING and ON, which is the output number of columns:</p>
<div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span> <span class="k">AS</span> <span class="ss">"foo"</span><span class="p">)</span> <span class="k">JOIN</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span> <span class="k">AS</span> <span class="ss">"foo"</span><span class="p">)</span> <span class="k">USING</span><span class="p">(</span><span class="ss">"foo"</span><span class="p">);</span>
<span class="n">foo</span>
<span class="c1">-----</span>
<span class="mi">1</span>
<span class="p">(</span><span class="mi">1</span> <span class="k">row</span><span class="p">)</span>
</pre></div>
</div>
<p>Selects the column once. If we use ON:</p>
<div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span> <span class="k">AS</span> <span class="ss">"foo"</span><span class="p">)</span> <span class="ss">"a"</span> <span class="k">JOIN</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span> <span class="k">AS</span> <span class="ss">"foo"</span><span class="p">)</span> <span class="ss">"b"</span> <span class="k">ON</span> <span class="ss">"a"</span><span class="p">.</span><span class="ss">"foo"</span> <span class="o">=</span> <span class="ss">"b"</span><span class="p">.</span><span class="ss">"foo"</span><span class="p">;</span>
<span class="n">foo</span> <span class="o">|</span> <span class="n">foo</span>
<span class="c1">-----+-----</span>
<span class="mi">1</span> <span class="o">|</span> <span class="mi">1</span>
<span class="p">(</span><span class="mi">1</span> <span class="k">row</span><span class="p">)</span>
</pre></div>
</div>
<p>If the output columns have the same name, then upon referencing the columns Trino will fail.</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><p><strong>column_names</strong> (<em>List</em><em>[</em><em>str</em><em>]</em>) – A list of column names to check equality clauses for.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.JoinUsingCriteria.build_sql">
<span class="sig-name descname"><span class="pre">build_sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.JoinUsingCriteria.build_sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a dictionary mapping of statements to strings</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.JoinUsingCriteria.column_names">
<span class="sig-name descname"><span class="pre">column_names</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.JoinUsingCriteria.column_names" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.Lateral">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">Lateral</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">subquery</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Lateral" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a correlated subquery.</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><p><strong>subquery</strong> (<a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><em>treeno.relation.Query</em></a>) – The subquery to correlate with the current scope.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Lateral.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Lateral.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Lateral.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Lateral.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Lateral.subquery">
<span class="sig-name descname"><span class="pre">subquery</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.Lateral.subquery" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.Query">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">Query</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orderby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Query" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a query with filtered outputs.</p>
<p>Note that Queries are also <code class="xref py py-class docutils literal notranslate"><span class="pre">treeno.expression.Values</span></code>, in that they are just row data typed expressions.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Query.limit">
<span class="sig-name descname"><span class="pre">limit</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Query.limit" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Query.offset">
<span class="sig-name descname"><span class="pre">offset</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Query.offset" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Query.orderby">
<span class="sig-name descname"><span class="pre">orderby</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">treeno.orderby.OrderTerm</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Query.orderby" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Query.with_">
<span class="sig-name descname"><span class="pre">with_</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.relation.AliasedRelation" title="treeno.relation.AliasedRelation"><span class="pre">treeno.relation.AliasedRelation</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Query.with_" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.Relation">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">Relation</span></span><a class="headerlink" href="#treeno.relation.Relation" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a SQL relation.</p>
<p>A <a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Relation</span></code></a> can be one of the following:</p>
<ol class="arabic simple">
<li><p>(<a class="reference internal" href="#treeno.relation.Table" title="treeno.relation.Table"><code class="xref py py-class docutils literal notranslate"><span class="pre">Table</span></code></a>) A table reference.</p></li>
<li><dl class="simple">
<dt>(<a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><code class="xref py py-class docutils literal notranslate"><span class="pre">Query</span></code></a>) A subquery. <a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><code class="xref py py-class docutils literal notranslate"><span class="pre">Query</span></code></a> is an abstract class, and its subclasses contain</dt><dd><p><a class="reference internal" href="#treeno.relation.SelectQuery" title="treeno.relation.SelectQuery"><code class="xref py py-class docutils literal notranslate"><span class="pre">SelectQuery</span></code></a>, <code class="xref py py-class docutils literal notranslate"><span class="pre">ValuesTable</span></code>, <a class="reference internal" href="#treeno.relation.SetQuery" title="treeno.relation.SetQuery"><code class="xref py py-class docutils literal notranslate"><span class="pre">SetQuery</span></code></a> and its subclasses, etc.</p>
</dd>
</dl>
</li>
<li><p>(<a class="reference internal" href="#treeno.relation.Unnest" title="treeno.relation.Unnest"><code class="xref py py-class docutils literal notranslate"><span class="pre">Unnest</span></code></a>) An unnested expression of arrays.</p></li>
<li><p>(<a class="reference internal" href="#treeno.relation.Lateral" title="treeno.relation.Lateral"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lateral</span></code></a>) Shares the current relation’s namespace with any <a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><code class="xref py py-class docutils literal notranslate"><span class="pre">Query</span></code></a>.</p></li>
<li><p>(<a class="reference internal" href="#treeno.relation.TableSample" title="treeno.relation.TableSample"><code class="xref py py-class docutils literal notranslate"><span class="pre">TableSample</span></code></a>) A subset sample of any relation.</p></li>
<li><p>(<a class="reference internal" href="#treeno.relation.Join" title="treeno.relation.Join"><code class="xref py py-class docutils literal notranslate"><span class="pre">Join</span></code></a>) A join composing of any relation.</p></li>
<li><p>(<a class="reference internal" href="#treeno.relation.AliasedRelation" title="treeno.relation.AliasedRelation"><code class="xref py py-class docutils literal notranslate"><span class="pre">AliasedRelation</span></code></a>) An alias (both as relation name and its column names) of any relation.</p></li>
</ol>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Relation.identifier">
<span class="sig-name descname"><span class="pre">identifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Relation.identifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Shorthand identifier for the relation</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A string if the relation has a well-defined identifier, otherwise None</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Relation.resolve">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Relation.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.SampleType">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">SampleType</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.SampleType" title="Permalink to this definition">¶</a></dt>
<dd><p>An enumeration.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SampleType.BERNOULLI">
<span class="sig-name descname"><span class="pre">BERNOULLI</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'BERNOULLI'</span></em><a class="headerlink" href="#treeno.relation.SampleType.BERNOULLI" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SampleType.SYSTEM">
<span class="sig-name descname"><span class="pre">SYSTEM</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'SYSTEM'</span></em><a class="headerlink" href="#treeno.relation.SampleType.SYSTEM" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.Schema">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">Schema</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fields</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">relation_ids</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Schema" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents the output schema of a given <a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Relation</span></code></a></p>
<p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a> s are used to impute missing types from trees with partial type information. This class serves two
main functions. The first is to resolve cross-query references i.e. WITH queries which can be referenced from the
FROM clause in a <a class="reference internal" href="#treeno.relation.SelectQuery" title="treeno.relation.SelectQuery"><code class="xref py py-class docutils literal notranslate"><span class="pre">SelectQuery</span></code></a>. The second is to allow the user to pass in schemas to resolve relations
like <a class="reference internal" href="#treeno.relation.Table" title="treeno.relation.Table"><code class="xref py py-class docutils literal notranslate"><span class="pre">Table</span></code></a> s which can’t resolve its own schema without access to external metadata (i.e. from a metastore).</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fields</strong> (<em>List</em><em>[</em><a class="reference internal" href="#treeno.relation.SchemaField" title="treeno.relation.SchemaField"><em>treeno.relation.SchemaField</em></a><em>]</em>) – A list of <a class="reference internal" href="#treeno.relation.SchemaField" title="treeno.relation.SchemaField"><code class="xref py py-class docutils literal notranslate"><span class="pre">SchemaField</span></code></a> s that exist in the current namespace</p></li>
<li><p><strong>Relation_ids</strong> – A set of relations used to denote the existence of a relation included in the schema.
This set can contain relations that contains no fields - e.g. for a table with an undefined schema,
the fields would be empty but the relation would still be in the set</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Schema.empty_schema">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">empty_schema</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Schema.empty_schema" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Schema.fields">
<span class="sig-name descname"><span class="pre">fields</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.relation.SchemaField" title="treeno.relation.SchemaField"><span class="pre">treeno.relation.SchemaField</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Schema.fields" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Schema.merge">
<span class="sig-name descname"><span class="pre">merge</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">another_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Schema.merge" title="Permalink to this definition">¶</a></dt>
<dd><p>Merge two schemas together to create a new schema</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.datatypes.builder</span> <span class="kn">import</span> <span class="n">bigint</span>
<span class="gp">>>> </span><span class="n">schema_a</span> <span class="o">=</span> <span class="n">Schema</span><span class="p">([</span><span class="n">SchemaField</span><span class="p">(</span><span class="s2">"x"</span><span class="p">,</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">),</span> <span class="n">bigint</span><span class="p">())],</span> <span class="n">relation_ids</span><span class="o">=</span><span class="p">{</span><span class="s2">"a"</span><span class="p">})</span>
<span class="gp">>>> </span><span class="n">schema_b</span> <span class="o">=</span> <span class="n">Schema</span><span class="p">([</span><span class="n">SchemaField</span><span class="p">(</span><span class="s2">"y"</span><span class="p">,</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"b"</span><span class="p">),</span> <span class="n">bigint</span><span class="p">())],</span> <span class="n">relation_ids</span><span class="o">=</span><span class="p">{</span><span class="s2">"b"</span><span class="p">})</span>
<span class="gp">>>> </span><span class="n">resulting_schema</span> <span class="o">=</span> <span class="n">schema_a</span><span class="o">.</span><span class="n">merge</span><span class="p">(</span><span class="n">schema_b</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">assert</span> <span class="n">resulting_schema</span><span class="o">.</span><span class="n">fields</span> <span class="o">==</span> <span class="n">schema_a</span><span class="o">.</span><span class="n">fields</span> <span class="o">+</span> <span class="n">schema_b</span><span class="o">.</span><span class="n">fields</span>
<span class="gp">>>> </span><span class="k">assert</span> <span class="n">resulting_schema</span><span class="o">.</span><span class="n">relation_ids</span> <span class="o">==</span> <span class="p">{</span><span class="s2">"a"</span><span class="p">,</span> <span class="s2">"b"</span><span class="p">}</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>another_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – The other schema to merge with. The fields from it are appended to the end of the resulting
<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a> fields</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a> object with both schemas’ fields and relations in the same namespace.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Schema.relation_ids">
<span class="sig-name descname"><span class="pre">relation_ids</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Set</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Schema.relation_ids" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.SchemaField">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">SchemaField</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">source</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.SchemaField" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a single field in a <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
<p>A schema must have a data type, a source, and optionally have a name. For example, a SUM(x) term with no alias
should have no name. It still shows up in the output, but there’s no way to refer to it.</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>Optional</em><em>[</em><em>str</em><em>]</em>) – An optional name of the schema field. If the name is None, then the field cannot be selected later on,
and Trino will autogenerate column names for these e.g. _col0</p></li>
<li><p><strong>source</strong> (<a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><em>treeno.relation.Relation</em></a>) – The source of which the field came from. Important to disambiguate <a class="reference internal" href="#treeno.relation.SchemaField" title="treeno.relation.SchemaField"><code class="xref py py-class docutils literal notranslate"><span class="pre">SchemaField</span></code></a> with same
names across different sources</p></li>
<li><p><strong>data_type</strong> (<em>treeno.datatypes.types.DataType</em>) – The data type of the field</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SchemaField.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.relation.SchemaField.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SchemaField.name">
<span class="sig-name descname"><span class="pre">name</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.SchemaField.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SchemaField.source">
<span class="sig-name descname"><span class="pre">source</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><span class="pre">treeno.relation.Relation</span></a></em><a class="headerlink" href="#treeno.relation.SchemaField.source" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">SelectQuery</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">select</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">from_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">where</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">groupby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">having</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">select_quantifier</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orderby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">window</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.SelectQuery" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a high level SELECT query.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span>
<span class="gp">... </span> <span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span>
<span class="gp">... </span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span>
<span class="gp">... </span><span class="p">)</span>
<span class="gp">>>> </span><span class="c1"># We can get the SQL string of the query via __str__</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
<span class="go">'SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5'</span>
<span class="gp">>>> </span><span class="c1"># The schema of the fields can be retrieved from resolve</span>
<span class="gp">>>> </span><span class="n">query_fields</span> <span class="o">=</span> <span class="n">query</span><span class="o">.</span><span class="n">resolve</span><span class="p">(</span><span class="n">Schema</span><span class="o">.</span><span class="n">empty_schema</span><span class="p">())</span><span class="o">.</span><span class="n">fields</span>
<span class="gp">>>> </span><span class="c1"># We aliased the literal value as "foo", but we didn't give a name for the second field</span>
<span class="gp">>>> </span><span class="p">[</span><span class="n">schema_field</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">schema_field</span> <span class="ow">in</span> <span class="n">query_fields</span><span class="p">]</span>
<span class="go">['foo', None]</span>
<span class="gp">>>> </span><span class="c1"># The type for field a is unknown without a schema supplied to the Table object.</span>
<span class="gp">>>> </span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">schema_field</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span> <span class="k">for</span> <span class="n">schema_field</span> <span class="ow">in</span> <span class="n">query_fields</span><span class="p">]</span>
<span class="go">['INTEGER', 'UNKNOWN']</span>
<span class="gp">>>> </span><span class="c1"># Alternatively, we can also get the whole row type of the select query via:</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">'ROW(INTEGER,UNKNOWN)'</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>select</strong> (<em>List</em><em>[</em><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><em>treeno.expression.Value</em></a><em>]</em>) – A list of <code class="xref py py-class docutils literal notranslate"><span class="pre">Value</span></code> s as outputs to the query.</p></li>
<li><p><strong>from_</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><em>treeno.relation.Relation</em></a><em>]</em>) – An optional relation to select from. If from is not specified, select must contain values that do not
reference any external relations, i.e. <code class="docutils literal notranslate"><span class="pre">SELECT</span> <span class="pre">1</span></code>.</p></li>
<li><p><strong>where</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><em>treeno.expression.Value</em></a><em>]</em>) – An optional boolean clause to filter rows by. If where is not specified, all rows are used.</p></li>
<li><p><strong>groupby</strong> (<em>Optional</em><em>[</em><em>treeno.groupby.GroupBy</em><em>]</em>) – An optional <code class="xref py py-class docutils literal notranslate"><span class="pre">GroupBy</span></code> which allows the user to run partial aggregate functions over different
groupings. For more information refer to <code class="xref py py-mod docutils literal notranslate"><span class="pre">treeno.groupby</span></code>.</p></li>
<li><p><strong>having</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><em>treeno.expression.Value</em></a><em>]</em>) – An optional boolean clause to filter groups by. If having is not specified, all groups are used.</p></li>
<li><p><strong>select_quantifier</strong> (<em>treeno.base.SetQuantifier</em>) – Whether to return all rows or only the distinct ones. Defaults to ALL.</p></li>
<li><p><strong>window</strong> (<em>Optional</em><em>[</em><em>Dict</em><em>[</em><em>str</em><em>, </em><em>treeno.window.Window</em><em>]</em><em>]</em>) – An optional mapping of window names to <code class="xref py py-class docutils literal notranslate"><span class="pre">Window</span></code> s. For more information refer to
<code class="xref py py-mod docutils literal notranslate"><span class="pre">treeno.window</span></code>.</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.from_">
<span class="sig-name descname"><span class="pre">from_</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><span class="pre">treeno.relation.Relation</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.SelectQuery.from_" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.groupby">
<span class="sig-name descname"><span class="pre">groupby</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">treeno.groupby.GroupBy</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.SelectQuery.groupby" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.having">
<span class="sig-name descname"><span class="pre">having</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.SelectQuery.having" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.SelectQuery.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.select">
<span class="sig-name descname"><span class="pre">select</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.SelectQuery.select" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.select_quantifier">
<span class="sig-name descname"><span class="pre">select_quantifier</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.base.SetQuantifier</span></em><a class="headerlink" href="#treeno.relation.SelectQuery.select_quantifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.SelectQuery.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.where">
<span class="sig-name descname"><span class="pre">where</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.SelectQuery.where" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SelectQuery.window">
<span class="sig-name descname"><span class="pre">window</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">treeno.window.Window</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.SelectQuery.window" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.SetQuery">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">SetQuery</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left_query</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right_query</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">set_quantifier</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">SetQuantifier.DISTINCT</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orderby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.SetQuery" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a set operation on two subqueries.</p>
<p>For all set operations, the input query schemas must be the coercible with each other (i.e. integer and bigint).
Otherwise, Trino will complain:</p>
<div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="n">trino</span><span class="o">></span> <span class="k">SELECT</span> <span class="mi">1</span> <span class="k">UNION</span> <span class="k">SELECT</span> <span class="s1">'a'</span><span class="p">;</span>
<span class="p">...</span> <span class="k">column</span> <span class="mi">1</span> <span class="k">in</span> <span class="k">UNION</span> <span class="n">query</span> <span class="n">has</span> <span class="n">incompatible</span> <span class="n">types</span><span class="p">:</span> <span class="nb">integer</span><span class="p">,</span> <span class="nb">varchar</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>left_query</strong> (<a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><em>treeno.relation.Query</em></a>) – An arbitrary <a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><code class="xref py py-class docutils literal notranslate"><span class="pre">Query</span></code></a>. The set query’s output will be identical in schema to this query.</p></li>
<li><p><strong>right_query</strong> (<a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><em>treeno.relation.Query</em></a>) – An arbitrary <a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><code class="xref py py-class docutils literal notranslate"><span class="pre">Query</span></code></a> to filter <code class="docutils literal notranslate"><span class="pre">left_query</span></code> on.</p></li>
<li><p><strong>set_quantifier</strong> (<em>treeno.base.SetQuantifier</em>) – Quantifier for the output rows. If DISTINCT, then the output rows will only contain unique rows.
If ALL, then the output rows will contain all rows of the set operation.</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SetQuery.left_query">
<span class="sig-name descname"><span class="pre">left_query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.SetQuery.left_query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.SetQuery.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.SetQuery.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SetQuery.right_query">
<span class="sig-name descname"><span class="pre">right_query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.SetQuery.right_query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.SetQuery.set_quantifier">
<span class="sig-name descname"><span class="pre">set_quantifier</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.base.SetQuantifier</span></em><a class="headerlink" href="#treeno.relation.SetQuery.set_quantifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.Table">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">Table</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">schema</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">catalog</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">column_schema</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Table" title="Permalink to this definition">¶</a></dt>
<dd><p>A table reference uniquely identified by a qualified name</p>
<p>Tables can be standalone queries by themselves (in the form TABLE {table name}), and thus
can be subject to orderby, offset, and limit constraints. Refer to TableQuery for more information.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.datatypes.builder</span> <span class="kn">import</span> <span class="n">bigint</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">assert</span> <span class="n">table</span><span class="o">.</span><span class="n">_column_schema</span> <span class="o">==</span> <span class="n">Schema</span><span class="p">([],</span> <span class="n">relation_ids</span><span class="o">=</span><span class="p">{</span><span class="s2">"a"</span><span class="p">})</span>
<span class="gp">>>> </span><span class="c1"># Supply a schema to the table via resolve</span>
<span class="gp">>>> </span><span class="n">new_schema</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">resolve</span><span class="p">(</span><span class="n">Schema</span><span class="p">([</span><span class="n">SchemaField</span><span class="p">(</span><span class="s2">"x"</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="n">bigint</span><span class="p">())],</span> <span class="n">relation_ids</span><span class="o">=</span><span class="p">{</span><span class="s2">"a"</span><span class="p">}))</span>
<span class="gp">>>> </span><span class="n">schema_fields</span> <span class="o">=</span> <span class="n">new_schema</span><span class="o">.</span><span class="n">fields</span>
<span class="gp">>>> </span><span class="k">assert</span> <span class="n">table</span><span class="o">.</span><span class="n">_column_schema</span> <span class="o">==</span> <span class="n">new_schema</span>
<span class="gp">>>> </span><span class="p">[</span><span class="n">schema_field</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">schema_field</span> <span class="ow">in</span> <span class="n">schema_fields</span><span class="p">]</span>
<span class="go">['x']</span>
<span class="gp">>>> </span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">schema_field</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span> <span class="k">for</span> <span class="n">schema_field</span> <span class="ow">in</span> <span class="n">schema_fields</span><span class="p">]</span>
<span class="go">['BIGINT']</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em>) – The name of the table.</p></li>
<li><p><strong>schema</strong> (<em>Optional</em><em>[</em><em>str</em><em>]</em>) – The schema the table belongs to. Can be unspecified to denote the current session’s schema.</p></li>
<li><p><strong>catalog</strong> (<em>Optional</em><em>[</em><em>str</em><em>]</em>) – The catalog the schema belongs to. Can be unspecified to denote the current session’s catalog.</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Table.catalog">
<span class="sig-name descname"><span class="pre">catalog</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Table.catalog" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Table.identifier">
<span class="sig-name descname"><span class="pre">identifier</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Table.identifier" title="Permalink to this definition">¶</a></dt>
<dd><p>Shorthand identifier for the relation</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A string if the relation has a well-defined identifier, otherwise None</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Table.name">
<span class="sig-name descname"><span class="pre">name</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="headerlink" href="#treeno.relation.Table.name" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Table.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Table.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Table.schema">
<span class="sig-name descname"><span class="pre">schema</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Table.schema" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Table.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Table.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.TableQuery">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">TableQuery</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">table</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orderby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.TableQuery" title="Permalink to this definition">¶</a></dt>
<dd><p>A light wrapper around a table for querying.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">TableQuery</span><span class="p">(</span><span class="n">Table</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)))</span>
<span class="go">'TABLE "x"'</span>
</pre></div>
</div>
<p>The above statement is equivalent to SELECT * FROM x.</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><p><strong>table</strong> (<a class="reference internal" href="#treeno.relation.Table" title="treeno.relation.Table"><em>treeno.relation.Table</em></a>) – The underlying table to select from.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.TableQuery.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.TableQuery.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.TableQuery.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.TableQuery.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.TableQuery.table">
<span class="sig-name descname"><span class="pre">table</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Table" title="treeno.relation.Table"><span class="pre">treeno.relation.Table</span></a></em><a class="headerlink" href="#treeno.relation.TableQuery.table" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.TableSample">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">TableSample</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">relation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sample_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">percentage</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.TableSample" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a sampled relation.</p>
<p>Note that TABLESAMPLE can work with all relations, including JOINs. However, for JOINs we need to take extra care
to parenthesize the expression. This doesn’t work:</p>
<div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="n">trino</span><span class="o">></span> <span class="k">WITH</span> <span class="n">f</span> <span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">AS</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span><span class="p">),</span> <span class="k">g</span> <span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="k">AS</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span><span class="p">)</span> <span class="k">SELECT</span> <span class="n">f</span><span class="p">.</span><span class="n">a</span><span class="p">,</span> <span class="k">g</span><span class="p">.</span><span class="n">b</span> <span class="k">FROM</span> <span class="n">f</span> <span class="k">JOIN</span> <span class="k">g</span> <span class="k">ON</span> <span class="n">f</span><span class="p">.</span><span class="n">a</span> <span class="o">=</span> <span class="k">g</span><span class="p">.</span><span class="n">b</span> <span class="n">TABLESAMPLE</span> <span class="n">BERNOULLI</span><span class="p">(</span><span class="mi">99</span><span class="p">);</span>
<span class="p">...</span> <span class="n">mismatched</span> <span class="k">input</span> <span class="s1">'TABLESAMPLE'</span> <span class="p">...</span>
</pre></div>
</div>
<p>But this does:</p>
<div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="n">trino</span><span class="o">></span> <span class="k">WITH</span> <span class="n">f</span> <span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">AS</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span><span class="p">),</span> <span class="k">g</span> <span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="k">AS</span> <span class="p">(</span><span class="k">SELECT</span> <span class="mi">1</span><span class="p">)</span> <span class="k">SELECT</span> <span class="n">f</span><span class="p">.</span><span class="n">a</span><span class="p">,</span> <span class="k">g</span><span class="p">.</span><span class="n">b</span> <span class="k">FROM</span> <span class="p">(</span><span class="n">f</span> <span class="k">JOIN</span> <span class="k">g</span> <span class="k">ON</span> <span class="n">f</span><span class="p">.</span><span class="n">a</span> <span class="o">=</span> <span class="k">g</span><span class="p">.</span><span class="n">b</span><span class="p">)</span> <span class="n">TABLESAMPLE</span> <span class="n">BERNOULLI</span><span class="p">(</span><span class="mi">99</span><span class="p">);</span>
<span class="n">a</span> <span class="o">|</span> <span class="n">b</span>
<span class="c1">---+---</span>
<span class="mi">1</span> <span class="o">|</span> <span class="mi">1</span>
</pre></div>
</div>
<p>Because JOINs are higher on the parsing hierarchy than TABLESAMPLEs, potentially due to an ambiguous parse
otherwise where TABLESAMPLE can be applied to the right relation in a JOIN.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.TableSample.percentage">
<span class="sig-name descname"><span class="pre">percentage</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a></em><a class="headerlink" href="#treeno.relation.TableSample.percentage" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.TableSample.relation">
<span class="sig-name descname"><span class="pre">relation</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><span class="pre">treeno.relation.Relation</span></a></em><a class="headerlink" href="#treeno.relation.TableSample.relation" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.TableSample.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.TableSample.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.TableSample.sample_type">
<span class="sig-name descname"><span class="pre">sample_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.SampleType" title="treeno.relation.SampleType"><span class="pre">treeno.relation.SampleType</span></a></em><a class="headerlink" href="#treeno.relation.TableSample.sample_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.TableSample.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.TableSample.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">UnionQuery</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">left_query</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">right_query</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">set_quantifier</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">SetQuantifier.DISTINCT</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orderby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.UnionQuery" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a union of two queries’ rows.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">NULL</span>
<span class="gp">>>> </span><span class="n">q</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">([</span><span class="n">NULL</span><span class="p">])</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">UnionQuery</span><span class="p">(</span><span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">set_quantifier</span><span class="o">=</span><span class="n">SetQuantifier</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">))</span>
<span class="go">'(SELECT NULL) UNION DISTINCT (SELECT NULL)'</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">UnionQuery</span><span class="p">(</span><span class="n">q</span><span class="p">,</span> <span class="n">q</span><span class="p">,</span> <span class="n">set_quantifier</span><span class="o">=</span><span class="n">SetQuantifier</span><span class="o">.</span><span class="n">ALL</span><span class="p">))</span>
<span class="go">'(SELECT NULL) UNION ALL (SELECT NULL)'</span>
</pre></div>
</div>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.data_type">
<span class="sig-name descname"><span class="pre">data_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.datatypes.types.DataType</span></em><a class="headerlink" href="#treeno.relation.UnionQuery.data_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.left_query">
<span class="sig-name descname"><span class="pre">left_query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.UnionQuery.left_query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.limit">
<span class="sig-name descname"><span class="pre">limit</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.UnionQuery.limit" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.offset">
<span class="sig-name descname"><span class="pre">offset</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.UnionQuery.offset" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.orderby">
<span class="sig-name descname"><span class="pre">orderby</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">treeno.orderby.OrderTerm</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.UnionQuery.orderby" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.right_query">
<span class="sig-name descname"><span class="pre">right_query</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#treeno.relation.Query" title="treeno.relation.Query"><span class="pre">treeno.relation.Query</span></a></em><a class="headerlink" href="#treeno.relation.UnionQuery.right_query" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.set_quantifier">
<span class="sig-name descname"><span class="pre">set_quantifier</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">treeno.base.SetQuantifier</span></em><a class="headerlink" href="#treeno.relation.UnionQuery.set_quantifier" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.UnionQuery.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.UnionQuery.with_">
<span class="sig-name descname"><span class="pre">with_</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.relation.AliasedRelation" title="treeno.relation.AliasedRelation"><span class="pre">treeno.relation.AliasedRelation</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.UnionQuery.with_" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.Unnest">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">Unnest</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arrays</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_ordinality</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Unnest" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents an unnested set of arrays representing a table</p>
<p>An example of unnest:</p>
<div class="highlight-sql notranslate"><div class="highlight"><pre><span></span><span class="n">trino</span><span class="o">></span> <span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="k">UNNEST</span><span class="p">(</span><span class="nb">ARRAY</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">]);</span>
<span class="n">_col0</span>
<span class="c1">-------</span>
<span class="mi">1</span>
<span class="mi">2</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>arrays</strong> (<em>List</em><em>[</em><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><em>treeno.expression.Value</em></a><em>]</em>) – The array(s) to use in an unnest. The i-th array in the list corresponds to the i-th output column.</p></li>
<li><p><strong>with_ordinality</strong> (<em>bool</em>) – Whether there should be an ordinality column appended at the end of the UNNEST.</p></li>
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Unnest.arrays">
<span class="sig-name descname"><span class="pre">arrays</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.Unnest.arrays" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Unnest.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Unnest.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.Unnest.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.Unnest.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.Unnest.with_ordinality">
<span class="sig-name descname"><span class="pre">with_ordinality</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">bool</span></em><a class="headerlink" href="#treeno.relation.Unnest.with_ordinality" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="treeno.relation.ValuesQuery">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">ValuesQuery</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">exprs</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">limit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orderby</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">NOTHING</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.ValuesQuery" title="Permalink to this definition">¶</a></dt>
<dd><p>A literal table constructed by literal ROWs</p>
<p>For a given comma separated list of expressions, the VALUES keyword turns the expression into a subquery that can
be used later on. VALUES is often used for unit testing fixtures for mock tables.</p>
<p>Values tables can be standalone queries by themselves, and thus can be subject to
orderby, offset, and limit constraints. Refer to ValuesQuery for more information.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">decimal</span> <span class="kn">import</span> <span class="n">Decimal</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">RowConstructor</span>
<span class="gp">>>> </span><span class="c1"># Types are inferred from all input values coerced together</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">ValuesQuery</span><span class="p">([</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> <span class="n">wrap_literal</span><span class="p">(</span><span class="n">Decimal</span><span class="p">(</span><span class="s2">"2.2"</span><span class="p">))])</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
<span class="go">'VALUES 1,2.2'</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">'DECIMAL(11,1)'</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">ValuesQuery</span><span class="p">([</span>
<span class="gp">... </span> <span class="n">RowConstructor</span><span class="p">([</span>
<span class="gp">... </span> <span class="n">wrap_literal</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span>
<span class="gp">... </span> <span class="n">wrap_literal</span><span class="p">(</span><span class="s1">'a'</span><span class="p">)</span>
<span class="gp">... </span> <span class="p">]),</span>
<span class="gp">... </span> <span class="n">RowConstructor</span><span class="p">([</span>
<span class="gp">... </span> <span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span>
<span class="gp">... </span> <span class="n">wrap_literal</span><span class="p">(</span><span class="s1">'b'</span><span class="p">)</span>
<span class="gp">... </span> <span class="p">])</span>
<span class="gp">... </span><span class="p">])</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
<span class="go">"VALUES (1,'a'),(2,'b')"</span>
<span class="gp">>>> </span><span class="nb">str</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">data_type</span><span class="p">)</span>
<span class="go">'ROW(INTEGER,VARCHAR(1))'</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><p><strong>exprs</strong> (<em>List</em><em>[</em><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><em>treeno.expression.Value</em></a><em>]</em>) – Values for each row of the query.</p>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="treeno.relation.ValuesQuery.exprs">
<span class="sig-name descname"><span class="pre">exprs</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#treeno.expression.Value" title="treeno.expression.Value"><span class="pre">treeno.expression.Value</span></a><span class="p"><span class="pre">]</span></span></em><a class="headerlink" href="#treeno.relation.ValuesQuery.exprs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.ValuesQuery.resolve">
<span class="sig-name descname"><span class="pre">resolve</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.ValuesQuery.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolves the current relation’s schema with supplemental schema information.</p>
<p>This function is used to resolve missing types in queries. The user can pass in existing_schemas to
hint at types of dynamically determined fields i.e. a table in Trino, but we also use resolve() underneath
the hood in order to resolve some types that can only be determined through a cross-query tree traversal. For
more information refer to <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – Schema with a partial list of fields to resolve the current field’s schema</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A new schema for the current relation</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="treeno.relation.ValuesQuery.sql">
<span class="sig-name descname"><span class="pre">sql</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">opts</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.ValuesQuery.sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the Treeno object into SQL string.</p>
<p>All objects that represent some concept in SQL inherit from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a> and must
implement this function to return its SQL representation which may be more compact
or more readable depending on the <a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>. By default, all Treeno
objects has a <code class="docutils literal notranslate"><span class="pre">__str__</span></code> representation which calls this function with default
print options.</p>
<p>When writing a new class that inherits from <a class="reference internal" href="#treeno.base.Sql" title="treeno.base.Sql"><code class="xref py py-class docutils literal notranslate"><span class="pre">Sql</span></code></a>, remember to pass along
<code class="docutils literal notranslate"><span class="pre">opts</span></code> to its childrens’ <code class="docutils literal notranslate"><span class="pre">sql()</span></code> call to make sure the print options are
recursively applied.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.expression</span> <span class="kn">import</span> <span class="n">wrap_literal</span><span class="p">,</span> <span class="n">AliasedValue</span><span class="p">,</span> <span class="n">Field</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">treeno.relation</span> <span class="kn">import</span> <span class="n">SelectQuery</span><span class="p">,</span> <span class="n">Table</span>
<span class="gp">>>> </span><span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">SelectQuery</span><span class="p">(</span><span class="n">select</span><span class="o">=</span><span class="p">[</span><span class="n">AliasedValue</span><span class="p">(</span><span class="n">wrap_literal</span><span class="p">(</span><span class="mi">2</span><span class="p">),</span> <span class="s2">"foo"</span><span class="p">),</span> <span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">/</span> <span class="mi">5</span><span class="p">],</span> <span class="n">from_</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="n">Field</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span> <span class="o">></span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5 FROM "a" WHERE "a" > 5</span>
<span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">PrintOptions</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">PrintMode</span><span class="o">.</span><span class="n">PRETTY</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">2</span><span class="p">)))</span>
<span class="go">SELECT 2 "foo","a" / 5</span>
<span class="go"> FROM "a"</span>
<span class="go"> WHERE "a" > 5</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>opts</strong> (<a class="reference internal" href="#treeno.base.PrintOptions" title="treeno.base.PrintOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">PrintOptions</span></code></a>) – The print options to control the SQL output format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>A SQL string for the given object.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="treeno.relation.maybe_prune_schema">
<span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">maybe_prune_schema</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">relation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">existing_schema</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.maybe_prune_schema" title="Permalink to this definition">¶</a></dt>
<dd><p>Prune the schema depending on whether the relation will enter a new namespace</p>
<p>Some relations don’t want extra schema information to be passed through because it’s in its own parenthesized
expression which is not aware of the outer namespace.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>relation</strong> (<a class="reference internal" href="#treeno.relation.Relation" title="treeno.relation.Relation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Relation</span></code></a>) – The relation to enter into with the given schema</p></li>
<li><p><strong>existing_schema</strong> (<a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>) – The schema to pass into the relation</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Either an empty <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a> or the original <a class="reference internal" href="#treeno.relation.Schema" title="treeno.relation.Schema"><code class="xref py py-class docutils literal notranslate"><span class="pre">Schema</span></code></a>.</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="treeno.relation.relation_string">
<span class="sig-prename descclassname"><span class="pre">treeno.relation.</span></span><span class="sig-name descname"><span class="pre">relation_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">relation</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">opts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">newline</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">special_parenthesize_relations</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#treeno.relation.relation_string" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>
</section>
</section>
</div>
<div class="page-nav">
<div class="inner"><ul class="page-nav">
<li class="prev">
<a href="index.html"
title="previous chapter">← Welcome to treeno’s documentation!</a>
</li>
</ul><div class="footer" role="contentinfo">
© Copyright 2021, Ray Zhang.
<br>
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 4.3.2 with <a href="https://github.com/schettino72/sphinx_press_theme">Press Theme</a> 0.8.0.
</div>
</div>
</div>
</page>
</div></div>
</body>
</html>
| 129.952118 | 2,748 | 0.684478 |
43730bb2eb16d2d0492f1d1f2dee4825b5b3e323 | 2,757 | go | Go | tcp/service.go | archi-chester/notification-service-v2 | 649fae592c9ab93b09d2b918bd1697cd54df0b59 | [
"Apache-2.0"
] | null | null | null | tcp/service.go | archi-chester/notification-service-v2 | 649fae592c9ab93b09d2b918bd1697cd54df0b59 | [
"Apache-2.0"
] | null | null | null | tcp/service.go | archi-chester/notification-service-v2 | 649fae592c9ab93b09d2b918bd1697cd54df0b59 | [
"Apache-2.0"
] | null | null | null | package tcp
import (
"encoding/binary"
"errors"
"fmt"
"net"
log "github.com/Sirupsen/logrus"
"gitlab.havana/BDIO/notification-service-v2/serve"
)
// выполнение полученной задачи
func Exec(conn net.Conn, messageType int, messageBody []byte) error {
// в зависимости от типа сообщения дергаем конкретную функцию
switch messageType {
// ошибка
case MESSAGE_TYPE_ERROR:
log.Error("Неверный тип сообщения. ")
return errors.New("Неверный тип сообщения. ")
// заглушка под тест
case MESSAGE_TYPE_TEST:
err := sendTestNotice(conn, messageBody)
if err != nil {
// handle error
log.Error("Ошибка обработки testNotice", err)
return err
}
// заглушка под тест
case MESSAGE_TYPE_INSERT:
err := insertNotice(conn, messageBody)
if err != nil {
// handle error
log.Error("Ошибка обработки insertNotice", err)
return err
}
}
return nil
}
// тестовое сообщение
func sendTestNotice(conn net.Conn, messageBody []byte) error {
// предварительная обработка
// шифруем
cipherText, err := encrypt(messageBody)
if err != nil {
log.Error("Ошибка шифрования. ", err)
return err
}
// отправка обратно
// формируем префикс
prefix := make([]byte, 4)
binary.BigEndian.PutUint32(prefix, uint32(len(cipherText)))
// передаем стрим
_, err = conn.Write(prefix)
if err != nil {
// handle error
log.Error("Ошибка передачи по TCP. Ошибка при передаче префикса. ", err)
return err
}
_, err = conn.Write(cipherText)
if err != nil {
// handle error
log.Error("Ошибка передачи по TCP. Ошибка при передачи сообщения. ", err)
return err
}
// возврат ошибки
return nil
}
// добавляем сообщение
func insertNotice(conn net.Conn, messageBody []byte) error {
// предварительная обработка
var answer, err = serve.InsertNotice(messageBody)
// отправка обратно
// TODO: вызов инсерт
//
// plainText = []byte("{'status':'ok', 'message':'" + string(messageBody) + "'}")
// возврат данных клиенту
// шифруем
cipherText, err := encrypt(answer)
if err != nil {
log.Error("Ошибка шифрования. ", err)
return err
}
// формируем префикс
prefix := make([]byte, 4)
binary.BigEndian.PutUint32(prefix, uint32(len(cipherText)))
fmt.Printf("Шифровано: %s", string(cipherText))
// передаем стрим
_, err = conn.Write(prefix)
if err != nil {
// handle error
log.Error("Ошибка передачи по TCP. Ошибка при передаче префикса. ", err)
return err
}
_, err = conn.Write(cipherText)
if err != nil {
// handle error
log.Error("Ошибка передачи по TCP. Ошибка при передачи сообщения. ", err)
return err
}
if err != nil {
// handle error
log.Error("Ошибка передачи по TCP. ", err)
return err
} else {
log.Info("Ответ клиенту отправлен.")
}
// возврат ошибки
return nil
}
| 22.975 | 82 | 0.683351 |
68265db6d8dbd305c9fb858c0d039d83956ffc72 | 14,784 | cpp | C++ | ns3/netanim-3.107/animnode.cpp | Aedemon/clusim | 7f09cdb79b5f02cf0fed1bd44842981941f29f32 | [
"Apache-2.0"
] | 7 | 2017-08-11T06:06:47.000Z | 2022-02-27T07:34:33.000Z | ns3/netanim-3.107/animnode.cpp | Aedemon/clusim | 7f09cdb79b5f02cf0fed1bd44842981941f29f32 | [
"Apache-2.0"
] | 3 | 2017-08-11T03:04:59.000Z | 2017-09-11T14:01:14.000Z | ns3/netanim-3.107/animnode.cpp | Aedemon/clusim | 7f09cdb79b5f02cf0fed1bd44842981941f29f32 | [
"Apache-2.0"
] | 3 | 2017-08-08T13:36:30.000Z | 2018-07-04T09:49:41.000Z | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: John Abraham <john.abraham.in@gmail.com>
* Contributions: Eugene Kalishenko <ydginster@gmail.com> (Open Source and Linux Laboratory http://dev.osll.ru/)
* Dmitrii Shakshin <d.shakshin@gmail.com> (Open Source and Linux Laboratory http://dev.osll.ru/)
*/
#include "animnode.h"
#include "animresource.h"
#include "animatorview.h"
#include <QColor>
NS_LOG_COMPONENT_DEFINE ("AnimNode");
namespace netanim
{
AnimNodeMgr * pAnimNodeMgr = 0;
AnimNode::AnimNode (uint32_t nodeId, uint32_t nodeSysId, qreal x, qreal y, QString nodeDescription):
m_nodeDescription (0),
m_nodeId (nodeId),
m_nodeSysId (nodeSysId),
m_x (x),
m_y (y),
m_showNodeId (true),
m_showNodeSysId (false),
m_resourceId (-1),
m_showNodeTrajectory (false),
m_showBatteryCapcity (false)
{
//setVisible (false);
setZValue (ANIMNODE_ZVALUE);
m_r = 255;
m_g = 0;
m_b = 0;
if (nodeDescription == "")
{
nodeDescription = QString::number (nodeId);
}
m_nodeDescription = new QGraphicsTextItem (nodeDescription);
m_nodeDescription->setFlag (QGraphicsItem::ItemIgnoresTransformations);
setFlag (QGraphicsItem::ItemIsSelectable);
}
AnimNode::~AnimNode ()
{
if (m_nodeDescription)
{
delete m_nodeDescription;
}
}
void
AnimNode::showNodeId (bool show)
{
m_showNodeId = show;
m_nodeDescription->setVisible (m_showNodeId);
}
QColor
generateColor (size_t index, uint8_t alpha = 0)
{
static const size_t colors[] =
{ Qt::blue, Qt::magenta, Qt::darkCyan, Qt::darkYellow, Qt::darkRed, Qt::darkMagenta, Qt::darkGreen, Qt::darkBlue,
Qt::black, Qt::darkGray, Qt::lightGray };
static const size_t COUNT = sizeof (colors) / sizeof (size_t);
QColor result;
if (index < COUNT)
result = QColor (Qt::GlobalColor (colors[index]));
else
{
result = QColor (Qt::GlobalColor (colors[index % COUNT]));
const int step = 256 * 3 % COUNT;
result.setRed ((result.red () + step * index) % 255);
result.setGreen ((result.blue () + step * index) % 255);
result.setBlue (((int)result.green () - step * index) % 255);
}
if (alpha)
result.setAlpha (alpha);
return result;
}
void
AnimNode::showNodeSysId (bool show)
{
if (show)
{
m_lastColor = this->getColor ();
int r, g, b, a;
m_lastColor.getRgb(&r, &g, &b, &a);
const QColor &color = generateColor (m_nodeSysId, a);
color.getRgb (&r, &g, &b, &a);
setColor (static_cast<uint8_t> (r), static_cast<uint8_t> (g), static_cast<uint8_t> (b), static_cast<uint8_t> (a));
}
else
{
if(m_showNodeSysId)
{
int r, g, b, a;
m_lastColor.getRgb (&r, &g, &b, &a);
setColor (r, g, b, a);
}
}
m_showNodeSysId = show;
m_nodeDescription->setPlainText (QString::number (m_nodeId) + (m_showNodeSysId ? QString(" SysId:") +
QString::number (m_nodeSysId): QString()));
}
bool
AnimNode::isVisibleNodeSysId() const
{
return m_showNodeSysId;
}
void
AnimNode::updateNodeSysId (uint32_t sysId, bool show)
{
m_nodeSysId = sysId;
//m_nodeSysIdDescription->setPlainText ("sysId: " + QString::number (sysId));
showNodeSysId (show);
}
void
AnimNode::updateBatteryCapacityImage (bool show)
{
m_showBatteryCapcity = show;
QString batteryCapacityImagePath(":/resources/battery_icon_");
bool result = false;
CounterType_t counterType;
uint32_t counterId = AnimNodeMgr::getInstance ()->getCounterIdForName ("RemainingEnergy", result, counterType);
if (!result)
{
return;
}
result = false;
qreal capacity = getDoubleCounterValue (counterId, result);
if (!result)
{
return;
}
if (capacity > 0.75) batteryCapacityImagePath += "4";
else if (capacity > 0.5) batteryCapacityImagePath += "3";
else if (capacity > 0.25) batteryCapacityImagePath += "2";
else if (capacity >= 0) batteryCapacityImagePath += "1";
else batteryCapacityImagePath += "0";
// NS_LOG_DEBUG ("Capacity:" << batteryCapacityImagePath.toAscii().data());
batteryCapacityImagePath += ".png";
if(show)
{
m_batteryPixmap = QPixmap (batteryCapacityImagePath);
}
if (!show)
{
m_batteryPixmap = QPixmap ();
}
}
uint32_t
AnimNode::getUint32CounterValue (uint32_t counterId, bool & result)
{
result = false;
if (m_counterIdToValuesUint32.find (counterId) == m_counterIdToValuesUint32.end ())
return -1;
result = true;
return m_counterIdToValuesUint32[counterId];
}
qreal
AnimNode::getDoubleCounterValue (uint32_t counterId, bool & result)
{
result = false;
if (m_counterIdToValuesDouble.find (counterId) == m_counterIdToValuesDouble.end ())
return -1;
result = true;
return m_counterIdToValuesDouble[counterId];
}
void
AnimNode::updateCounter (uint32_t counterId, qreal counterValue, CounterType_t counterType)
{
if (counterType == DOUBLE_COUNTER)
{
m_counterIdToValuesDouble[counterId] = counterValue;
}
if (counterType == UINT32_COUNTER)
{
m_counterIdToValuesUint32[counterId] = counterValue;
}
}
int
AnimNode::getResourceId ()
{
return m_resourceId;
}
void
AnimNode::setResource (int resourceId)
{
m_resourceId = resourceId;
QString resourcePath = AnimResourceManager::getInstance ()->get (resourceId);
//NS_LOG_DEBUG ("Res:" << resourcePath.toAscii ().data ());
QPixmap pix;
if (resourcePath.endsWith (".png"))
pix = QPixmap (resourcePath, "png");
else if (resourcePath.endsWith (".svg"))
pix = QPixmap (resourcePath, "svg");
setPixmap (pix);
update ();
}
void
AnimNode::setColor (uint8_t r, uint8_t g, uint8_t b, uint8_t alpha)
{
m_r = r;
m_g = g;
m_b = b;
m_alpha = alpha;
ResizeableItem::setColor (r, g, b, alpha);
update ();
}
QColor
AnimNode::getColor ()
{
QColor c (m_r, m_g, m_b, 255);
return c;
}
qreal
AnimNode::getWidth ()
{
return m_width;
}
qreal
AnimNode::getX ()
{
return m_x;
}
qreal
AnimNode::getY ()
{
return m_y;
}
void
AnimNode::setPos (qreal x, qreal y)
{
m_x = x;
m_y = y;
QGraphicsItem::setPos (x, y);
}
void
AnimNode::setX (qreal x)
{
m_x = x;
}
bool
AnimNode::getShowNodeTrajectory ()
{
return m_showNodeTrajectory;
}
void
AnimNode::setShowNodeTrajectory (bool showNodeTrajectory)
{
m_showNodeTrajectory = showNodeTrajectory;
}
void
AnimNode::setY (qreal y)
{
m_y = y;
}
uint32_t
AnimNode::getNodeId ()
{
return m_nodeId;
}
uint32_t
AnimNode::getNodeSysId ()
{
return m_nodeSysId;
}
QGraphicsTextItem *
AnimNode::getDescription ()
{
return m_nodeDescription;
}
QPointF AnimNode::getCenter ()
{
//return sceneBoundingRect ().center ();
return QPointF (m_x, m_y);
}
void AnimNode::setNodeDescription (QString description)
{
m_nodeDescription->setPlainText (description);
}
void AnimNode::paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
ResizeableItem::paint (painter, option, widget);
if (!m_batteryPixmap.isNull ())
{
updateBatteryCapacityImage (m_showBatteryCapcity);
QPointF bottomLeft = sceneBoundingRect ().bottomLeft ();
//NS_LOG_DEBUG ("Pix Width:" << m_batteryPixmap->width());
bottomLeft = QPointF (-1, 1);
painter->save ();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing | QPainter::NonCosmeticDefaultPen, true); painter->scale (0.5, 1);
painter->drawPixmap (bottomLeft.x (), bottomLeft.y (), 1, 1, m_batteryPixmap);
painter->restore ();
}
}
void AnimNode::mouseMoveEvent (QGraphicsSceneMouseEvent *event)
{
ResizeableItem::mouseMoveEvent (event);
if (m_nodeDescription)
{
m_nodeDescription->setPos (sceneBoundingRect ().bottomRight ());
update ();
}
}
AnimNode::Ipv4Vector_t
AnimNode::getIpv4Addresses ()
{
return m_ipv4Vector;
}
AnimNode::MacVector_t
AnimNode::getMacAddresses ()
{
return m_macVector;
}
void
AnimNode::addIpv4Address (QString ip)
{
m_ipv4Vector.push_back (ip);
}
void
AnimNode::addMacAddress (QString mac)
{
m_macVector.push_back (mac);
}
bool
AnimNode::hasIpv4 (QString ip)
{
bool result = false;
QStringList quads = ip.split (".");
if (quads.count () == 4)
{
if (quads.at (3) == "255")
return true;
for (Ipv4Vector_t::const_iterator i = m_ipv4Vector.begin ();
i != m_ipv4Vector.end ();
++i)
{
if (*i == ip)
{
//QDEBUG (ip);
return true;
}
}
}
return result;
}
bool
AnimNode::hasMac (QString mac)
{
bool result = false;
QStringList bytes = mac.split (":");
if (bytes.count () == 6)
{
for (MacVector_t::const_iterator i = m_macVector.begin ();
i != m_macVector.end ();
++i)
{
if (*i == mac)
{
return true;
}
}
}
return result;
}
AnimNodeMgr::AnimNodeMgr ():
m_minX (0),
m_minY (0),
m_maxX (0),
m_maxY (0)
{
}
AnimNodeMgr * AnimNodeMgr::getInstance ()
{
if (!pAnimNodeMgr)
{
pAnimNodeMgr = new AnimNodeMgr;
}
return pAnimNodeMgr;
}
AnimNode * AnimNodeMgr::add (uint32_t nodeId, uint32_t nodeSysId, qreal x, qreal y, QString nodeDescription)
{
if (m_nodes.find (nodeId) != m_nodes.end ())
{
//NS_FATAL_ERROR ("NodeId:" << nodeId << " Already exists");
}
QPixmap pix (":/resources/ns3logo2.png","png");
AnimNode * node = new AnimNode (nodeId, nodeSysId, x, y, nodeDescription);
node->setPos (x, y);
//node->setPixmap (pix);
m_nodes[nodeId] = node;
m_minX = qMin (m_minX, x);
m_minY = qMin (m_minY, y);
m_maxX = qMax (m_maxX, x);
m_maxY = qMax (m_maxY, y);
return node;
}
void
AnimNodeMgr::setSize (qreal width, qreal height)
{
for (NodeIdAnimNodeMap_t::const_iterator i = m_nodes.begin ();
i != m_nodes.end ();
++i)
{
AnimNode * animNode = i->second;
animNode->setSize (width, height);
}
}
void
AnimNodeMgr::showRemainingBatteryCapacity (bool show)
{
for (NodeIdAnimNodeMap_t::const_iterator i = m_nodes.begin ();
i != m_nodes.end ();
++i)
{
AnimNode * animNode = i->second;
animNode->updateBatteryCapacityImage (show);
}
}
AnimNode * AnimNodeMgr::getNode (uint32_t nodeId)
{
return m_nodes[nodeId];
}
uint32_t
AnimNodeMgr::getCount ()
{
return m_nodes.size ();
}
QPointF
AnimNodeMgr::getMinPoint ()
{
return QPointF (m_minX, m_minY);
}
QPointF
AnimNodeMgr::getMaxPoint ()
{
qreal m = qMax (m_maxX, m_maxY);
return QPointF (m, m);
}
void
AnimNodeMgr::systemReset ()
{
m_nodes.clear ();
m_minX = 0;
m_minY = 0;
m_maxX = 0;
m_maxY = 0;
m_counterIdToNamesDouble.clear ();
m_counterIdToNamesUint32.clear ();
}
void
AnimNodeMgr::addIpv4Address (uint32_t nodeId, QString ip)
{
getNode (nodeId)->addIpv4Address (ip);
}
void
AnimNodeMgr::addMacAddress (uint32_t nodeId, QString mac)
{
getNode (nodeId)->addMacAddress (mac);
}
void
AnimNodeMgr::showNodeId (bool show)
{
for (NodeIdAnimNodeMap_t::const_iterator i = m_nodes.begin ();
i != m_nodes.end ();
++i)
{
AnimNode * animNode = i->second;
animNode->showNodeId (show);
}
}
void
AnimNodeMgr::showNodeSysId (bool show)
{
for (NodeIdAnimNodeMap_t::const_iterator i = m_nodes.begin ();
i != m_nodes.end ();
++i)
{
AnimNode * animNode = i->second;
animNode->showNodeSysId (show);
}
}
AnimNodeMgr::TimePosVector_t
AnimNodeMgr::getPositions (uint32_t nodeId)
{
return m_nodePositions[nodeId];
}
void
AnimNodeMgr::addAPosition (uint32_t nodeId, qreal t, QPointF pos)
{
if (m_nodePositions.find (nodeId) == m_nodePositions.end ())
{
TimePosVector_t posVector;
m_nodePositions[nodeId] = posVector;
}
TimePosVector_t & pv = m_nodePositions[nodeId];
TimePosition_t tp;
tp.p = pos;
tp.t = t;
pv.push_back (tp);
}
void
AnimNodeMgr::addNodeCounterUint32 (uint32_t counterId, QString counterName)
{
m_counterIdToNamesUint32[counterId] = counterName;
}
void
AnimNodeMgr::addNodeCounterDouble (uint32_t counterId, QString counterName)
{
m_counterIdToNamesDouble[counterId] = counterName;
}
void
AnimNodeMgr::updateNodeCounter (uint32_t nodeId, uint32_t counterId, qreal counterValue)
{
AnimNode * animNode = getNode (nodeId);
AnimNode::CounterType_t ct;
bool counterFound = false;
for (CounterIdName_t::const_iterator i = m_counterIdToNamesDouble.begin ();
i != m_counterIdToNamesDouble.end ();
++i)
{
if (counterId == i->first)
{
ct = AnimNode::DOUBLE_COUNTER;
counterFound = true;
break;
}
}
if (!counterFound)
{
for (CounterIdName_t::const_iterator i = m_counterIdToNamesUint32.begin ();
i != m_counterIdToNamesUint32.end ();
++i)
{
if (counterId == i->first)
{
ct = AnimNode::UINT32_COUNTER;
counterFound = true;
break;
}
}
}
animNode->updateCounter (counterId, counterValue, ct);
}
AnimNodeMgr::CounterIdName_t
AnimNodeMgr::getUint32CounterNames ()
{
return m_counterIdToNamesUint32;
}
AnimNodeMgr::CounterIdName_t
AnimNodeMgr::getDoubleCounterNames ()
{
return m_counterIdToNamesDouble;
}
uint32_t
AnimNodeMgr::getCounterIdForName (QString counterName, bool &result, AnimNode::CounterType_t & counterType)
{
result = false;
for (CounterIdName_t::const_iterator i = m_counterIdToNamesDouble.begin ();
i != m_counterIdToNamesDouble.end ();
++i)
{
QString n = i->second;
if (n == counterName)
{
result = true;
counterType = AnimNode::DOUBLE_COUNTER;
return i->first;
}
}
for (CounterIdName_t::const_iterator i = m_counterIdToNamesUint32.begin ();
i != m_counterIdToNamesUint32.end ();
++i)
{
QString n = i->second;
if (n == counterName)
{
result = true;
counterType = AnimNode::UINT32_COUNTER;
return i->first;
}
}
return -1;
}
}
| 21 | 223 | 0.657873 |
6ec2ab2a1f0a7ed35d2d1ba72fe40429695af504 | 888 | asm | Assembly | src/firmware/Ui/DoorOverrideStates.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | 1 | 2019-12-12T09:07:08.000Z | 2019-12-12T09:07:08.000Z | src/firmware/Ui/DoorOverrideStates.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | null | null | null | src/firmware/Ui/DoorOverrideStates.asm | pete-restall/Cluck2Sesame-Prototype | 99119b6748847a7b6aeadc4bee42cbed726f7fdc | [
"MIT"
] | null | null | null | #include "Platform.inc"
#include "FarCalls.inc"
#include "Flash.inc"
#include "Lcd.inc"
#include "States.inc"
#include "WaitButtonPressState.inc"
radix decimal
defineUiState UI_STATE_DOOROVERRIDE
fcall isLcdIdle
xorlw 0
btfsc STATUS, Z
returnFromUiState
loadFlashAddressOf screen
fcall putScreenFromFlash
waitForButtonPress UI_STATE_DOOROVERRIDE_LEFT, UI_STATE_DOOROVERRIDE_RIGHT, UI_STATE_DOOROVERRIDE_ENTER
returnFromUiState
defineUiStateInSameSection UI_STATE_DOOROVERRIDE_LEFT
setUiState UI_STATE_HOME
returnFromUiState
defineUiStateInSameSection UI_STATE_DOOROVERRIDE_RIGHT
setUiState UI_STATE_VERSION
returnFromUiState
defineUiStateInSameSection UI_STATE_DOOROVERRIDE_ENTER
;setUiState UI_STATE_DOOROVERIDE_CHANGE
setUiState UI_STATE_WAIT_BUTTONPRESS
returnFromUiState
screen:
da "Door Override "
da " OPEN CLOSE OFF "
end
| 20.181818 | 105 | 0.826577 |
c3624e826ebb15753a2e87c2f5f30de57fa45a44 | 4,968 | swift | Swift | Centipede/UIKit/CE_UISearchController.swift | QiuZhiFei/Centipede | 02ea1a925fbd98b0eeb729ce7244af7ee1d3496d | [
"MIT"
] | 28 | 2015-06-03T03:20:09.000Z | 2021-06-15T09:43:21.000Z | Centipede/UIKit/CE_UISearchController.swift | QiuZhiFei/Centipede | 02ea1a925fbd98b0eeb729ce7244af7ee1d3496d | [
"MIT"
] | 3 | 2015-06-09T03:37:57.000Z | 2016-10-31T03:33:50.000Z | Centipede/UIKit/CE_UISearchController.swift | QiuZhiFei/Centipede | 02ea1a925fbd98b0eeb729ce7244af7ee1d3496d | [
"MIT"
] | 5 | 2015-06-04T13:50:47.000Z | 2020-09-01T08:31:20.000Z | //
// CE_UISearchController.swift
// Centipede
//
// Created by kelei on 2016/9/15.
// Copyright (c) 2016年 kelei. All rights reserved.
//
import UIKit
extension UISearchController {
private struct Static { static var AssociationKey: UInt8 = 0 }
private var _delegate: UISearchController_Delegate? {
get { return objc_getAssociatedObject(self, &Static.AssociationKey) as? UISearchController_Delegate }
set { objc_setAssociatedObject(self, &Static.AssociationKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) }
}
private var ce: UISearchController_Delegate {
if let obj = _delegate {
return obj
}
if let obj: AnyObject = self.delegate {
if obj is UISearchController_Delegate {
return obj as! UISearchController_Delegate
}
}
let obj = getDelegateInstance()
_delegate = obj
return obj
}
private func rebindingDelegate() {
let delegate = ce
self.delegate = nil
self.delegate = delegate
self.searchResultsUpdater = nil
self.searchResultsUpdater = delegate
self.transitioningDelegate = nil
self.transitioningDelegate = delegate
}
internal override func getDelegateInstance() -> UISearchController_Delegate {
return UISearchController_Delegate()
}
@discardableResult
public func ce_updateSearchResults_for(handle: @escaping (UISearchController) -> Void) -> Self {
ce._updateSearchResults_for = handle
rebindingDelegate()
return self
}
@discardableResult
public func ce_willPresentSearchController(handle: @escaping (UISearchController) -> Void) -> Self {
ce._willPresentSearchController = handle
rebindingDelegate()
return self
}
@discardableResult
public func ce_didPresentSearchController(handle: @escaping (UISearchController) -> Void) -> Self {
ce._didPresentSearchController = handle
rebindingDelegate()
return self
}
@discardableResult
public func ce_willDismissSearchController(handle: @escaping (UISearchController) -> Void) -> Self {
ce._willDismissSearchController = handle
rebindingDelegate()
return self
}
@discardableResult
public func ce_didDismissSearchController(handle: @escaping (UISearchController) -> Void) -> Self {
ce._didDismissSearchController = handle
rebindingDelegate()
return self
}
@discardableResult
public func ce_presentSearchController(handle: @escaping (UISearchController) -> Void) -> Self {
ce._presentSearchController = handle
rebindingDelegate()
return self
}
}
internal class UISearchController_Delegate: UIViewController_Delegate, UISearchResultsUpdating, UISearchControllerDelegate {
var _updateSearchResults_for: ((UISearchController) -> Void)?
var _willPresentSearchController: ((UISearchController) -> Void)?
var _didPresentSearchController: ((UISearchController) -> Void)?
var _willDismissSearchController: ((UISearchController) -> Void)?
var _didDismissSearchController: ((UISearchController) -> Void)?
var _presentSearchController: ((UISearchController) -> Void)?
override func responds(to aSelector: Selector!) -> Bool {
let funcDic1: [Selector : Any?] = [
#selector(updateSearchResults(for:)) : _updateSearchResults_for,
#selector(willPresentSearchController(_:)) : _willPresentSearchController,
#selector(didPresentSearchController(_:)) : _didPresentSearchController,
#selector(willDismissSearchController(_:)) : _willDismissSearchController,
#selector(didDismissSearchController(_:)) : _didDismissSearchController,
#selector(presentSearchController(_:)) : _presentSearchController,
]
if let f = funcDic1[aSelector] {
return f != nil
}
return super.responds(to: aSelector)
}
@objc func updateSearchResults(for searchController: UISearchController) {
_updateSearchResults_for!(searchController)
}
@objc func willPresentSearchController(_ searchController: UISearchController) {
_willPresentSearchController!(searchController)
}
@objc func didPresentSearchController(_ searchController: UISearchController) {
_didPresentSearchController!(searchController)
}
@objc func willDismissSearchController(_ searchController: UISearchController) {
_willDismissSearchController!(searchController)
}
@objc func didDismissSearchController(_ searchController: UISearchController) {
_didDismissSearchController!(searchController)
}
@objc func presentSearchController(_ searchController: UISearchController) {
_presentSearchController!(searchController)
}
}
| 37.353383 | 128 | 0.692029 |
98daac46237aef4bb469c3813655ff699d4b6151 | 7,261 | html | HTML | application/admin/view2/template/index.html | happypypy/workspace | e5b66fd88438f03516b93c7220ac8b935dd36b65 | [
"Apache-2.0"
] | null | null | null | application/admin/view2/template/index.html | happypypy/workspace | e5b66fd88438f03516b93c7220ac8b935dd36b65 | [
"Apache-2.0"
] | null | null | null | application/admin/view2/template/index.html | happypypy/workspace | e5b66fd88438f03516b93c7220ac8b935dd36b65 | [
"Apache-2.0"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>开启头部工具栏 - 数据表格</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="/layuiadmin/style/public.css">
<script src="__PUBLIC__/layuiadmin/js/public.js"></script>
<style>
.list {
overflow: hidden;
}
.list>li {
float: left;
margin:0 15px 15px 0;
border: 1px solid #ccc;
}
.img-div {
height: 500px;
overflow: hidden;
}
.layui-form-radio>i {
font-size: 14px;
margin-right: 2px;
}
.layui-form-radio {
margin: 6px 0 0 0;
padding-right: 2px;
}
.layui-form-radioed>div {
color: red;
}
</style>
</head>
<body>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header1">模板列表</div>
<div class="layui-card-body">
<ul class="list">
{volist name="template_list" id="voo"}
{php} $temp=$key;{/php}
{volist name="voo" id="vo"}
{if condition="($key eq 0 && substr($selcode,0,strrpos($selcode,'_')) neq $vo['dirname'] ) OR (strtolower($vo['dirname']) eq strtolower($selcode) )"}
<li>
<div class="template-show">
<div class="img-div">
{if condition="substr($vo['dirname'],0,strrpos($vo['dirname'],'_')) eq ''"}
<a href="/template/{$vo.dirname}/index.jpg" title="点击查看" target="_blank" temp="" pictype="">
<img src="/template/{$vo.dirname}/index.jpg" alt=""
width="200"></a>
{else /}
<a href="/template/{:substr($vo['dirname'],0,strrpos($vo['dirname'],'_'))}/index{:substr($vo['dirname'], -2)}.jpg" title="点击查看" target="_blank" temp="" pictype="">
<img style="width:200px; " src="/template/{:substr($vo['dirname'],0,strrpos($vo['dirname'],'_'))}/index{:substr($vo['dirname'], -2)}.jpg" alt="" /></a>{/if}
</div>
<form class="layui-form" action="">
<div class="layui-form-item" style="margin-bottom: 0;">
<label class="layui-form-label" style="width: auto; padding: 9px 6px;">{$vo.temname}</label>
<div class="layui-input-block" style="margin-left: 0">
<input type="radio" name="code" value="{$temp}" title="小图"
{if condition="substr($selcode,0,strrpos($selcode,'_')) =='' && strtolower($vo['dirname']) eq strtolower($selcode)"}checked{/if} temp="{$temp}/index.jpg" lay-filter="component-form-group" />
<input type="radio" name="code" value="{$temp}_m" title="中图" {if condition="substr($selcode, -1) eq 'm' && strtolower($vo['dirname']) eq strtolower($selcode)"} checked{/if} temp="{$temp}/index_m.jpg" lay-filter="component-form-group" />
<input type="radio" name="code" value="{$temp}_b" title="大图" {if condition="substr($selcode, -1) eq 'b' && strtolower($vo['dirname']) eq strtolower($selcode)"}checked{/if} temp="{$temp}/index_b.jpg" lay-filter="component-form-group" />
</div>
</div>
<div style="margin-bottom: 10px; text-align: center; color: red;height:25px">
{if condition="strtolower($vo['dirname']) eq strtolower($selcode)"}
已启用 <span>
{if condition="substr($selcode, -1) eq 'm'"}中图
{elseif condition="substr($selcode, -1) eq 'b'"}大图
{else}小图
{/if}
</span>
{/if}
</div>
</form>
</div>
</li>
{/if}
{/volist}
{/volist}
</ul>
</div>
<div id="laypage" style="text-align: right; margin-right: 15px;"></div>
</div>
</div>
</div>
</div>
<script src="/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: '/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form','table'], function () {
var $ = layui.$
, admin = layui.admin
, element = layui.element
, form = layui.form
,laypage = layui.laypage
form.render(null, 'component-form-element');
element.render('breadcrumb', 'breadcrumb');
form.on('submit(component-form-element)', function (data) {
layer.msg(JSON.stringify(data.field));
return false;
});
form.on('radio(component-form-group)', function(data){
// console.log(data.elem); //得到radio原始DOM对象
// console.log(data.value); //被点击的radio的value值
var code=data.value;
window.location="{:url('template/changetemplate')}?code="+code
});
//总页数大于页码总数
laypage.render({
elem: 'laypage'
,count: {:$page->count}
,curr: {:$page->iPage}
,limit: {:$page->pageSize}
,layout: ['count', 'prev', 'page', 'next', 'skip']
,jump: function(obj){
if(obj.curr!= "{:$page->iPage}"){
var jumpUrl = "{:$page->url('currentPage')}";
jumpUrl = jumpUrl.replace("currentPage",obj.curr);
location.href = jumpUrl;
}
}
});
});
$(document).on('mouseover', '.layui-form-radio', function () {
obj=$(this)
var temp=obj.prev().attr('temp')
//console.log(temp)
obj.parents('.template-show').eq(0).find('.img-div').eq(0).find('a').eq(0).attr('href', '/template/'+temp)
obj.parents('.template-show').eq(0).find('.img-div').eq(0).find('img').eq(0).attr('src', '/template/'+temp)
})
</script>
</body>
| 42.461988 | 280 | 0.448148 |
c5333a49460ab81670d59c286fd45410223951e7 | 1,642 | swift | Swift | submodules/SyncCore/Sources/StickerPackItem.swift | Sergey70/Telegram-iOS | 331b51ee204b92bb4c3aa8d4006a5070d4644770 | [
"AML"
] | null | null | null | submodules/SyncCore/Sources/StickerPackItem.swift | Sergey70/Telegram-iOS | 331b51ee204b92bb4c3aa8d4006a5070d4644770 | [
"AML"
] | null | null | null | submodules/SyncCore/Sources/StickerPackItem.swift | Sergey70/Telegram-iOS | 331b51ee204b92bb4c3aa8d4006a5070d4644770 | [
"AML"
] | null | null | null | import Postbox
public final class StickerPackItem: ItemCollectionItem, Equatable {
public let index: ItemCollectionItemIndex
public let file: TelegramMediaFile
public let indexKeys: [MemoryBuffer]
public init(index: ItemCollectionItemIndex, file: TelegramMediaFile, indexKeys: [MemoryBuffer]) {
self.index = index
self.file = file
self.indexKeys = indexKeys
}
public init(decoder: PostboxDecoder) {
self.index = ItemCollectionItemIndex(index: decoder.decodeInt32ForKey("i.n", orElse: 0), id: decoder.decodeInt64ForKey("i.i", orElse: 0))
self.file = decoder.decodeObjectForKey("f") as! TelegramMediaFile
self.indexKeys = decoder.decodeBytesArrayForKey("s")
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeInt32(self.index.index, forKey: "i.n")
encoder.encodeInt64(self.index.id, forKey: "i.i")
encoder.encodeObject(self.file, forKey: "f")
encoder.encodeBytesArray(self.indexKeys, forKey: "s")
}
public static func ==(lhs: StickerPackItem, rhs: StickerPackItem) -> Bool {
return lhs.index == rhs.index && lhs.file == rhs.file && lhs.indexKeys == rhs.indexKeys
}
public func getStringRepresentationsOfIndexKeys() -> [String] {
var stringRepresentations: [String] = []
for key in self.indexKeys {
key.withDataNoCopy { data in
if let string = String(data: data, encoding: .utf8) {
stringRepresentations.append(string)
}
}
}
return stringRepresentations
}
}
| 38.186047 | 145 | 0.644336 |
046b46877899918dbd339ed7f1dbfe97dc95b982 | 464 | java | Java | p2p-app/src/main/java/info/bfly/app/protocol/model/response/ApiLoan.java | eshuo/bfly | b03e9c216485707cf0d26ddad59570e8548dc760 | [
"MIT"
] | null | null | null | p2p-app/src/main/java/info/bfly/app/protocol/model/response/ApiLoan.java | eshuo/bfly | b03e9c216485707cf0d26ddad59570e8548dc760 | [
"MIT"
] | null | null | null | p2p-app/src/main/java/info/bfly/app/protocol/model/response/ApiLoan.java | eshuo/bfly | b03e9c216485707cf0d26ddad59570e8548dc760 | [
"MIT"
] | null | null | null | package info.bfly.app.protocol.model.response;
/**
* Created by XXSun on 2016/12/27.
*/
public class ApiLoan {
// Fields
private String id;
// 借款名称
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| 16.571429 | 46 | 0.532328 |
99eaf3eb8f1c9cfcef507df68f4844ee1fca683a | 236 | sql | SQL | mydpo/src/server/db/migrations/20211109034032_refactor/migration.sql | mrkara/PRIVACYMAP | 3f254274f2a22e7bb811bc194032a7cfcf09213b | [
"Apache-2.0"
] | null | null | null | mydpo/src/server/db/migrations/20211109034032_refactor/migration.sql | mrkara/PRIVACYMAP | 3f254274f2a22e7bb811bc194032a7cfcf09213b | [
"Apache-2.0"
] | null | null | null | mydpo/src/server/db/migrations/20211109034032_refactor/migration.sql | mrkara/PRIVACYMAP | 3f254274f2a22e7bb811bc194032a7cfcf09213b | [
"Apache-2.0"
] | 1 | 2022-01-31T23:48:49.000Z | 2022-01-31T23:48:49.000Z | /*
Warnings:
- Made the column `businessId` on table `Application` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "Application" ALTER COLUMN "businessId" SET NOT NULL;
| 26.222222 | 135 | 0.741525 |
d1e7c20efedf176a556bada00a50ec8259e98cc3 | 3,425 | sql | SQL | db_tiketonline.sql | maulanakavaldo/Order-Tiket-Bioskop | 7a3f445c4605b787b8fe97aad4be2901b78c5ec8 | [
"MIT"
] | 1 | 2021-12-29T08:29:31.000Z | 2021-12-29T08:29:31.000Z | db_tiketonline.sql | maulanakavaldo/Order-Tiket-Bioskop | 7a3f445c4605b787b8fe97aad4be2901b78c5ec8 | [
"MIT"
] | null | null | null | db_tiketonline.sql | maulanakavaldo/Order-Tiket-Bioskop | 7a3f445c4605b787b8fe97aad4be2901b78c5ec8 | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 19 Des 2019 pada 14.18
-- Versi server: 10.1.37-MariaDB
-- Versi PHP: 7.3.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `db_tiketonline`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `pembelian`
--
CREATE TABLE `pembelian` (
`id` int(11) NOT NULL,
`film` varchar(30) NOT NULL,
`tanggal` varchar(30) NOT NULL,
`waktu` varchar(30) NOT NULL,
`tik_dewasa` int(11) NOT NULL,
`tik_anak` int(11) NOT NULL,
`total_bayar` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `pembelian`
--
INSERT INTO `pembelian` (`id`, `film`, `tanggal`, `waktu`, `tik_dewasa`, `tik_anak`, `total_bayar`) VALUES
(1, 'Avengers', 'Kamis, 26 Desember 2019', '12:00', 1, 2, 'Rp 96900'),
(2, 'Avengers', 'Selasa, 24 Desember 2019', '12:00', 1, 2, 'Rp 96900'),
(3, 'Avengers', 'Jumat, 27 Desember 2019', '22:00', 2, 2, 'Rp 112200'),
(4, 'Avengers', 'Jumat, 27 Desember 2019', '16:00', 2, 2, 'Rp 112200'),
(5, 'Parasite', 'Jumat, 20 Desember 2019', '10:00', 1, 2, 'Rp 71400'),
(6, 'Avengers End Game', 'Jumat, 20 Desember 2019', '08.00', 1, 1, '0'),
(7, 'Parasite', 'Jumat, 27 Desember 2019', '10:00', 2, 1, 'Rp 96900'),
(8, 'Parasite', 'Rabu, 25 Desember 2019', '00:00', 2, 1, 'Rp 96900'),
(9, 'Parasite', 'Jumat, 27 Desember 2019', '16:00', 2, 1, 'Rp 96900'),
(10, 'Spiderman Far From Home', 'Selasa, 24 Desember 2019', '12:00', 2, 1, 'Rp 96900'),
(11, 'Avengers', 'Jumat, 27 Desember 2019', '12:00', 2, 1, 'Rp 96900');
-- --------------------------------------------------------
--
-- Struktur dari tabel `user`
--
CREATE TABLE `user` (
`id` int(11) NOT NULL,
`nm_depan` varchar(20) NOT NULL,
`nm_belakang` varchar(20) NOT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(20) NOT NULL,
`alamat` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `user`
--
INSERT INTO `user` (`id`, `nm_depan`, `nm_belakang`, `username`, `password`, `alamat`) VALUES
(1, 'Maulana', 'Kavaldo', 'maulana', 'ald123#', 'Purworejo'),
(2, 'Abel', 'Situmorang', 'abel', 'abel', 'Palembang'),
(3, 'Funny', 'Puspita', 'funny', 'funnysa', 'Surabaya'),
(4, 'Nando', 'Berlio', 'nando', 'nandober', 'Sulawesi'),
(5, 'adlan', 'syafaat', 'mochsyaf', '12345', 'tes');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `pembelian`
--
ALTER TABLE `pembelian`
ADD KEY `id` (`id`);
--
-- Indeks untuk tabel `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `pembelian`
--
ALTER TABLE `pembelian`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT untuk tabel `user`
--
ALTER TABLE `user`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 28.541667 | 106 | 0.633285 |
b3196db8707de7d01f0e836e7e2f17893331fd63 | 273 | rb | Ruby | app/api/v1/base.rb | Safecast/ingest | c927ce5c5efd658e2d5522bd6d6fc40bc00460a3 | [
"MIT"
] | null | null | null | app/api/v1/base.rb | Safecast/ingest | c927ce5c5efd658e2d5522bd6d6fc40bc00460a3 | [
"MIT"
] | 36 | 2017-01-12T07:52:21.000Z | 2022-03-30T22:02:25.000Z | app/api/v1/base.rb | Safecast/ingest | c927ce5c5efd658e2d5522bd6d6fc40bc00460a3 | [
"MIT"
] | 3 | 2017-01-18T02:11:52.000Z | 2018-07-02T23:17:31.000Z | require_relative 'defaults'
require_relative 'devices'
require_relative 'measurements'
module API
module V1
class Base < Grape::API
include API::V1::Defaults
version 'v1'
mount API::V1::Devices
mount API::V1::Measurements
end
end
end
| 16.058824 | 33 | 0.681319 |
f53d21bc34dcedc18681cd4a76ffe40b3b42ed8f | 1,653 | cpp | C++ | libcxx/test/std/ranges/range.req/range.refinements/random_access_range.compile.pass.cpp | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 2,338 | 2018-06-19T17:34:51.000Z | 2022-03-31T11:00:37.000Z | libcxx/test/std/ranges/range.req/range.refinements/random_access_range.compile.pass.cpp | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 3,740 | 2019-01-23T15:36:48.000Z | 2022-03-31T22:01:13.000Z | libcxx/test/std/ranges/range.req/range.refinements/random_access_range.compile.pass.cpp | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 500 | 2019-01-23T07:49:22.000Z | 2022-03-30T02:59:37.000Z | //===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-no-concepts
// UNSUPPORTED: libcpp-has-no-incomplete-ranges
// template<class R>
// concept random_access_range;
#include <ranges>
#include "test_range.h"
#include "test_iterators.h"
namespace ranges = std::ranges;
template <template <class...> class I>
constexpr bool check_range() {
constexpr bool result = ranges::random_access_range<test_range<I> >;
static_assert(ranges::random_access_range<test_range<I> const> == result);
static_assert(ranges::random_access_range<test_non_const_common_range<I> > == result);
static_assert(ranges::random_access_range<test_non_const_range<I> > == result);
static_assert(ranges::random_access_range<test_common_range<I> > == result);
static_assert(ranges::random_access_range<test_common_range<I> const> == result);
static_assert(!ranges::random_access_range<test_non_const_common_range<I> const>);
static_assert(!ranges::random_access_range<test_non_const_range<I> const>);
return result;
}
static_assert(!check_range<cpp20_input_iterator>());
static_assert(!check_range<forward_iterator>());
static_assert(!check_range<bidirectional_iterator>());
static_assert(check_range<random_access_iterator>());
static_assert(check_range<contiguous_iterator>());
| 40.317073 | 88 | 0.69994 |
4abf42ab922ba158315a99efb80b6357322640b6 | 467 | cs | C# | tools/DataWarehouseViewer/Mvvm/Jurisdiction/JurisdictionInfrastructure.cs | IObsequious/DatabaseTools | 16b18414ca8f53d565709a58836eb8f3a6f18755 | [
"MIT"
] | null | null | null | tools/DataWarehouseViewer/Mvvm/Jurisdiction/JurisdictionInfrastructure.cs | IObsequious/DatabaseTools | 16b18414ca8f53d565709a58836eb8f3a6f18755 | [
"MIT"
] | null | null | null | tools/DataWarehouseViewer/Mvvm/Jurisdiction/JurisdictionInfrastructure.cs | IObsequious/DatabaseTools | 16b18414ca8f53d565709a58836eb8f3a6f18755 | [
"MIT"
] | null | null | null | namespace DataWarehouseViewer.Mvvm
{
public class JurisdictionInfrastructure
{
public Jurisdiction Model { get; }
public JurisdictionViewModel ViewModel { get; }
public JurisdictionView View { get; }
public JurisdictionInfrastructure(Jurisdiction model, JurisdictionViewModel viewModel, JurisdictionView view)
{
Model = model;
ViewModel = viewModel;
View = view;
}
}
}
| 27.470588 | 117 | 0.638116 |
7544ca11236b80b5c7de4c3be683951768c52874 | 917 | cs | C# | src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/src/BuildTask.cs | jepetty/arcade | 6d8efa00a7dd2d15e07df673a83cecb8a0a3031f | [
"MIT"
] | 1 | 2019-11-11T12:33:01.000Z | 2019-11-11T12:33:01.000Z | src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/src/BuildTask.cs | jepetty/arcade | 6d8efa00a7dd2d15e07df673a83cecb8a0a3031f | [
"MIT"
] | 6 | 2020-02-06T15:42:45.000Z | 2020-02-17T12:43:08.000Z | src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/src/BuildTask.cs | jepetty/arcade | 6d8efa00a7dd2d15e07df673a83cecb8a0a3031f | [
"MIT"
] | null | null | null | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk
{
public abstract partial class BuildTask : ITask
{
private TaskLoggingHelper _log = null;
internal TaskLoggingHelper Log => _log ??= new TaskLoggingHelper(this);
public IBuildEngine BuildEngine { get; set; }
public ITaskHost HostObject { get; set; }
public abstract bool ExecuteCore();
public bool Execute()
{
#if NET472
AssemblyResolution.Log = Log;
#endif
try
{
return ExecuteCore();
}
finally
{
#if NET472
AssemblyResolution.Log = null;
#endif
}
}
}
}
| 23.512821 | 79 | 0.605234 |
7132b8ccabba3a412935ec2cc17666ef36370d84 | 3,652 | tsx | TypeScript | src/components/ImageDialog/index.tsx | designunit/korsakov | 6364db698273ee3f5538eb94aaca808dfed5065e | [
"MIT"
] | null | null | null | src/components/ImageDialog/index.tsx | designunit/korsakov | 6364db698273ee3f5538eb94aaca808dfed5065e | [
"MIT"
] | 8 | 2021-08-30T14:42:54.000Z | 2021-10-12T11:39:16.000Z | src/components/ImageDialog/index.tsx | designunit/korsakov | 6364db698273ee3f5538eb94aaca808dfed5065e | [
"MIT"
] | null | null | null | import Image from 'next/image'
import { Dialog, Transition } from '@headlessui/react'
import { Fragment } from 'react'
import { XIcon } from '@heroicons/react/solid'
export type ImageDialogProps = {
open: boolean
src: string
width: number
height: number
onClose: () => void
}
export const ImageDialog: React.FC<ImageDialogProps> = props => {
return (
<>
<Transition appear show={props.open} as={Fragment}>
<Dialog
as="div"
className="fixed inset-0 z-10 overflow-y-auto"
onClose={props.onClose}
>
<div className="min-h-screen px-4 text-center">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<Dialog.Overlay className="fixed inset-0 bg-black opacity-70" />
</Transition.Child>
{/* This element is to trick the browser into centering the modal contents. */}
<span
className="inline-block h-screen align-middle"
aria-hidden="true"
>
​
</span>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<div className="inline-block w-full max-w-6xl my-8 overflow-hidden text-left align-middle transition-all transform bg-white shadow-xl">
{/* <Dialog.Title
as="h3"
className="text-lg font-medium leading-6 text-gray-900"
>
Payment successful
</Dialog.Title> */}
<Image
src={props.src}
alt={''}
width={props.width}
height={props.height}
layout={'responsive'}
/>
<button
type="button"
className="absolute top-0 right-0 px-2 py-2 text-sm font-medium bg-green-300 text-black hover:text-gray-700 border border-transparent focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-green-300"
onClick={props.onClose}
>
<XIcon className="w-4 h-4" />
</button>
</div>
</Transition.Child>
</div>
</Dialog>
</Transition>
</>
)
}
| 44 | 267 | 0.393209 |
4e28a4d2984ed6aa8392b334ec7028f68731565b | 3,140 | kt | Kotlin | src/main/kotlin/xyz/aesthetical/lookupbot/commands/lookup/DNSInfo.kt | Sxmurai/lookup-bot | 83bc76e3f790505d8c4b089181b1ad774bd561a5 | [
"WTFPL"
] | 1 | 2021-01-18T02:28:50.000Z | 2021-01-18T02:28:50.000Z | src/main/kotlin/xyz/aesthetical/lookupbot/commands/lookup/DNSInfo.kt | Sxmurai/lookup-bot | 83bc76e3f790505d8c4b089181b1ad774bd561a5 | [
"WTFPL"
] | null | null | null | src/main/kotlin/xyz/aesthetical/lookupbot/commands/lookup/DNSInfo.kt | Sxmurai/lookup-bot | 83bc76e3f790505d8c4b089181b1ad774bd561a5 | [
"WTFPL"
] | null | null | null | package xyz.aesthetical.lookupbot.commands.lookup
import khttp.get
import me.devoxin.flight.api.Context
import me.devoxin.flight.api.annotations.Command
import me.devoxin.flight.api.entities.Cog
import org.json.JSONObject
import xyz.aesthetical.lookupbot.utils.Line
import xyz.aesthetical.lookupbot.utils.PrologBuilder
import xyz.aesthetical.lookupbot.utils.enums.DNSTypeEnum
import java.net.URL
class DNSInfo : Cog {
@Command(
aliases = ["dnsinfo", "dnslookup"],
description = "Displays DNS related information depending on the type"
)
fun dns(ctx: Context, type: DNSTypeEnum, url: URL) {
return lookup(ctx, type, url)
}
private fun lookup(ctx: Context, type: DNSTypeEnum, url: URL) {
val request = get(
"https://cloudflare-dns.com/dns-query?name=${url.host}&type=${type}",
mapOf(
"Accept" to "application/dns-json"
)
).jsonObject
/*
* Taken from https://github.com/MattIPv4/DNS-over-Discord/blob/8790a362cf910fc19a17417c56bb4448bcc58850/src/utils/dns.js#L1#L22
*/
val errorCodes = mapOf(
1 to "A format error [1 - FormErr] occurred when looking up the domain",
2 to "An unexpected server failure [2 - ServFail] occurred when looking up the domain",
3 to "A non-existent domain [3 - NXDomain] was requested and could not be found",
4 to "A request was made that is not implemented [4 - NotImp] by the resolver",
5 to "The query was refused [5 - Refused] by the DNS resolver",
6 to "Name Exists when it should not",
7 to "RR Set Exists when it should not",
8 to "RR Set that should exist does not",
9 to "Server Not Authoritative for zone or Not Authorized",
10 to "Name not contained in zone",
11 to "DSO-TYPE Not Implemented",
16 to "Bad OPT Version or TSIG Signature Failure",
17 to "Key not recognized",
18 to "Signature out of time window",
19 to "Bad TKEY Mode",
20 to "Duplicate key name",
21 to "Algorithm not supported",
22 to "Bad Truncation",
23 to "Bad/missing Server Cookie",
)
if (request.getInt("Status") != 0) {
return ctx.send {
setColor("f55e53".toInt(16))
setDescription(errorCodes[request.getInt("Status")])
}
}
if (request.getJSONArray("Answer").length() == 0) {
return ctx.send {
setColor("f55e53".toInt(16))
setDescription("No results found.")
}
}
val results = arrayListOf<String>()
for (item in request.getJSONArray("Answer")) {
val prologBuilder = PrologBuilder()
for ((k, v) in (item as JSONObject).toMap()) {
prologBuilder.addLine(
Line(
k.replace("(\\b\\w)".toRegex()) { res: MatchResult -> res.groupValues[1].toUpperCase() },
v.toString()
)
)
}
results.add(prologBuilder.build())
}
return ctx.send {
setColor("3377de".toInt(16))
setAuthor("DNS Results", "http://${url.host}", ctx.author.effectiveAvatarUrl)
setDescription(results.joinToString("\n\n"))
}
}
}
| 31.089109 | 131 | 0.634076 |
70fe3d161c39788d43d52592d14571aaefd920bb | 7,686 | cs | C# | sources/Interop/Windows/DirectX/um/d3dcommon/D3D.cs | JeremyKuhne/terrafx.interop.windows | 337dab04103688027ccfbee0180568de552283de | [
"MIT"
] | null | null | null | sources/Interop/Windows/DirectX/um/d3dcommon/D3D.cs | JeremyKuhne/terrafx.interop.windows | 337dab04103688027ccfbee0180568de552283de | [
"MIT"
] | null | null | null | sources/Interop/Windows/DirectX/um/d3dcommon/D3D.cs | JeremyKuhne/terrafx.interop.windows | 337dab04103688027ccfbee0180568de552283de | [
"MIT"
] | null | null | null | // Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d3dcommon.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace TerraFX.Interop.DirectX;
public static partial class D3D
{
[NativeTypeName("const GUID")]
public static ref readonly Guid D3D_TEXTURE_LAYOUT_ROW_MAJOR
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
0x4F, 0x23, 0xDC, 0xB5,
0xBB, 0x72,
0xEC, 0x4B,
0x97,
0x05,
0x8C,
0xF2,
0x58,
0xDF,
0x6B,
0x6C
};
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
[NativeTypeName("const GUID")]
public static ref readonly Guid D3D_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
0xE3, 0x29, 0x0F, 0x4C,
0x5F, 0x3F,
0x35, 0x4D,
0x84,
0xC9,
0xBC,
0x09,
0x83,
0xB6,
0x2C,
0x28
};
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
}
[NativeTypeName("#define D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION 2048")]
public const int D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION = 2048;
[NativeTypeName("#define D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION 4096")]
public const int D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION = 4096;
[NativeTypeName("#define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048")]
public const int D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION = 2048;
[NativeTypeName("#define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096")]
public const int D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION = 4096;
[NativeTypeName("#define D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION 512")]
public const int D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION = 512;
[NativeTypeName("#define D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION 4096")]
public const int D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION = 4096;
[NativeTypeName("#define D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 256")]
public const int D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = 256;
[NativeTypeName("#define D3D_FL9_1_DEFAULT_MAX_ANISOTROPY 2")]
public const int D3D_FL9_1_DEFAULT_MAX_ANISOTROPY = 2;
[NativeTypeName("#define D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT 65535")]
public const int D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT = 65535;
[NativeTypeName("#define D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT 1048575")]
public const int D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT = 1048575;
[NativeTypeName("#define D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT 1")]
public const int D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT = 1;
[NativeTypeName("#define D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT 4")]
public const int D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT = 4;
[NativeTypeName("#define D3D_FL9_1_MAX_TEXTURE_REPEAT 128")]
public const int D3D_FL9_1_MAX_TEXTURE_REPEAT = 128;
[NativeTypeName("#define D3D_FL9_2_MAX_TEXTURE_REPEAT 2048")]
public const int D3D_FL9_2_MAX_TEXTURE_REPEAT = 2048;
[NativeTypeName("#define D3D_FL9_3_MAX_TEXTURE_REPEAT 8192")]
public const int D3D_FL9_3_MAX_TEXTURE_REPEAT = 8192;
[NativeTypeName("#define D3D_SHADER_FEATURE_DOUBLES 0x00001")]
public const int D3D_SHADER_FEATURE_DOUBLES = 0x00001;
[NativeTypeName("#define D3D_SHADER_FEATURE_COMPUTE_SHADERS_PLUS_RAW_AND_STRUCTURED_BUFFERS_VIA_SHADER_4_X 0x00002")]
public const int D3D_SHADER_FEATURE_COMPUTE_SHADERS_PLUS_RAW_AND_STRUCTURED_BUFFERS_VIA_SHADER_4_X = 0x00002;
[NativeTypeName("#define D3D_SHADER_FEATURE_UAVS_AT_EVERY_STAGE 0x00004")]
public const int D3D_SHADER_FEATURE_UAVS_AT_EVERY_STAGE = 0x00004;
[NativeTypeName("#define D3D_SHADER_FEATURE_64_UAVS 0x00008")]
public const int D3D_SHADER_FEATURE_64_UAVS = 0x00008;
[NativeTypeName("#define D3D_SHADER_FEATURE_MINIMUM_PRECISION 0x00010")]
public const int D3D_SHADER_FEATURE_MINIMUM_PRECISION = 0x00010;
[NativeTypeName("#define D3D_SHADER_FEATURE_11_1_DOUBLE_EXTENSIONS 0x00020")]
public const int D3D_SHADER_FEATURE_11_1_DOUBLE_EXTENSIONS = 0x00020;
[NativeTypeName("#define D3D_SHADER_FEATURE_11_1_SHADER_EXTENSIONS 0x00040")]
public const int D3D_SHADER_FEATURE_11_1_SHADER_EXTENSIONS = 0x00040;
[NativeTypeName("#define D3D_SHADER_FEATURE_LEVEL_9_COMPARISON_FILTERING 0x00080")]
public const int D3D_SHADER_FEATURE_LEVEL_9_COMPARISON_FILTERING = 0x00080;
[NativeTypeName("#define D3D_SHADER_FEATURE_TILED_RESOURCES 0x00100")]
public const int D3D_SHADER_FEATURE_TILED_RESOURCES = 0x00100;
[NativeTypeName("#define D3D_SHADER_FEATURE_STENCIL_REF 0x00200")]
public const int D3D_SHADER_FEATURE_STENCIL_REF = 0x00200;
[NativeTypeName("#define D3D_SHADER_FEATURE_INNER_COVERAGE 0x00400")]
public const int D3D_SHADER_FEATURE_INNER_COVERAGE = 0x00400;
[NativeTypeName("#define D3D_SHADER_FEATURE_TYPED_UAV_LOAD_ADDITIONAL_FORMATS 0x00800")]
public const int D3D_SHADER_FEATURE_TYPED_UAV_LOAD_ADDITIONAL_FORMATS = 0x00800;
[NativeTypeName("#define D3D_SHADER_FEATURE_ROVS 0x01000")]
public const int D3D_SHADER_FEATURE_ROVS = 0x01000;
[NativeTypeName("#define D3D_SHADER_FEATURE_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER 0x02000")]
public const int D3D_SHADER_FEATURE_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER = 0x02000;
[NativeTypeName("#define D3D_SHADER_FEATURE_WAVE_OPS 0x04000")]
public const int D3D_SHADER_FEATURE_WAVE_OPS = 0x04000;
[NativeTypeName("#define D3D_SHADER_FEATURE_INT64_OPS 0x08000")]
public const int D3D_SHADER_FEATURE_INT64_OPS = 0x08000;
[NativeTypeName("#define D3D_SHADER_FEATURE_VIEW_ID 0x10000")]
public const int D3D_SHADER_FEATURE_VIEW_ID = 0x10000;
[NativeTypeName("#define D3D_SHADER_FEATURE_BARYCENTRICS 0x20000")]
public const int D3D_SHADER_FEATURE_BARYCENTRICS = 0x20000;
[NativeTypeName("#define D3D_SHADER_FEATURE_NATIVE_16BIT_OPS 0x40000")]
public const int D3D_SHADER_FEATURE_NATIVE_16BIT_OPS = 0x40000;
[NativeTypeName("#define D3D_SHADER_FEATURE_SHADING_RATE 0x80000")]
public const int D3D_SHADER_FEATURE_SHADING_RATE = 0x80000;
[NativeTypeName("#define D3D_SHADER_FEATURE_RAYTRACING_TIER_1_1 0x100000")]
public const int D3D_SHADER_FEATURE_RAYTRACING_TIER_1_1 = 0x100000;
[NativeTypeName("#define D3D_SHADER_FEATURE_SAMPLER_FEEDBACK 0x200000")]
public const int D3D_SHADER_FEATURE_SAMPLER_FEEDBACK = 0x200000;
[NativeTypeName("#define D3D_COMPONENT_MASK_X 1")]
public const int D3D_COMPONENT_MASK_X = 1;
[NativeTypeName("#define D3D_COMPONENT_MASK_Y 2")]
public const int D3D_COMPONENT_MASK_Y = 2;
[NativeTypeName("#define D3D_COMPONENT_MASK_Z 4")]
public const int D3D_COMPONENT_MASK_Z = 4;
[NativeTypeName("#define D3D_COMPONENT_MASK_W 8")]
public const int D3D_COMPONENT_MASK_W = 8;
}
| 40.882979 | 145 | 0.744601 |
04bb3a4230141a61e000c969a956d08b967e3857 | 1,276 | asm | Assembly | programs/oeis/141/A141325.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/141/A141325.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/141/A141325.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A141325: a(n) = A000045(n) + A131531(n+3).
; 1,1,1,1,3,5,9,13,21,33,55,89,145,233,377,609,987,1597,2585,4181,6765,10945,17711,28657,46369,75025,121393,196417,317811,514229,832041,1346269,2178309,3524577,5702887,9227465,14930353,24157817,39088169,63245985,102334155,165580141,267914297,433494437,701408733,1134903169,1836311903,2971215073,4807526977,7778742049,12586269025,20365011073,32951280099,53316291173,86267571273,139583862445,225851433717,365435296161,591286729879,956722026041,1548008755921,2504730781961,4052739537881,6557470319841,10610209857723,17167680177565,27777890035289,44945570212853,72723460248141,117669030460993,190392490709135,308061521170129,498454011879265,806515533049393,1304969544928657,2111485077978049,3416454622906707,5527939700884757,8944394323791465,14472334024676221,23416728348467685,37889062373143905,61305790721611591,99194853094755497,160500643816367089,259695496911122585,420196140727489673,679891637638612257,1100087778366101931,1779979416004714189,2880067194370816121,4660046610375530309,7540113804746346429,12200160415121876737,19740274219868223167,31940434634990099905,51680708854858323073,83621143489848422977,135301852344706746049,218922995834555169025
trn $0,1
seq $0,173434 ; a(n) = (A000045(n)-A173432(n))/2.
mul $0,2
add $0,1
| 159.5 | 1,152 | 0.878527 |
2f12ae9bd0a549c45897c2b2fff3868e20a4f6d0 | 174 | cs | C# | HappyFace/Domain/ScrapeResult.cs | repne/happyface | 342612495b1d76f792906a4d6239a2787bc0b3b5 | [
"MIT"
] | 1 | 2015-05-13T10:31:09.000Z | 2015-05-13T10:31:09.000Z | HappyFace/Domain/ScrapeResult.cs | repne/happyface | 342612495b1d76f792906a4d6239a2787bc0b3b5 | [
"MIT"
] | null | null | null | HappyFace/Domain/ScrapeResult.cs | repne/happyface | 342612495b1d76f792906a4d6239a2787bc0b3b5 | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
namespace HappyFace.Domain
{
public class ScrapeResult
{
public IEnumerable<Uri> Links { get; set; }
}
} | 17.4 | 51 | 0.678161 |
9be7b4775f6e3ed87888e7bf397c9c4738ddfc5f | 1,312 | js | JavaScript | src/NewRelic/index.js | carlsonorozco/adonis-newrelic | ca5e87b14d3165b7ea9844066f93eaa823533570 | [
"MIT"
] | null | null | null | src/NewRelic/index.js | carlsonorozco/adonis-newrelic | ca5e87b14d3165b7ea9844066f93eaa823533570 | [
"MIT"
] | null | null | null | src/NewRelic/index.js | carlsonorozco/adonis-newrelic | ca5e87b14d3165b7ea9844066f93eaa823533570 | [
"MIT"
] | null | null | null | 'use strict'
/**
* adonis-newrelic
*
* (c) Carlson Orozco <carlsonorozco@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
const GE = require('@adonisjs/generic-exceptions')
class NewRelic {
constructor (Config, Handler = new DefaultHandler()) {
this.Config = Config
this.Handler = Handler
if (Config.get('throwIfNotInstalled')) {
// throw GE.RuntimeException.
}
}
setAppName (name, license, $xmit = false) {
}
noticeError (message, exception = null) {
}
nameTransaction (name) {
}
endOfTransaction () {
}
endTransaction (ignore = false) {
}
startTransaction (name, license) {
}
ignoreTransaction () {
}
ignoreApdex() {
}
backgroundJob (flag = true) {
}
captureParams (enable = true) {
}
customMetric (name, value) {
}
addCustomParameter (key, value) {
}
addCustomTracer (functionName) {
}
getBrowserTimingHeader (flag = true) {
}
getBrowserTimingFooter (flag = true) {
}
disableAutoRUM () {
}
setUserAttributes (user = '', account = '', product = '') {
}
recordCustomEvent (name, attributes) {
}
_call (method, params = []) {
this.handler.handle(method, params)
}
}
| 12.990099 | 74 | 0.623476 |
8f7290c9beaaa1ac6593bcd9f38b98b6398cb830 | 1,114 | dart | Dart | lib/focus_node.dart | lucky1213/extended_textfield | 971d5ad8e16a179b6df31f60e5f44aff885726f1 | [
"MIT"
] | null | null | null | lib/focus_node.dart | lucky1213/extended_textfield | 971d5ad8e16a179b6df31f60e5f44aff885726f1 | [
"MIT"
] | null | null | null | lib/focus_node.dart | lucky1213/extended_textfield | 971d5ad8e16a179b6df31f60e5f44aff885726f1 | [
"MIT"
] | null | null | null | part of flutter_extended_text_field;
class SelectableFocusNode extends FocusNode {
SelectableFocusNode([this.allowFocus = true]) : super();
final bool allowFocus;
}
class ExtendedFocusNode extends FocusNode {
ExtendedFocusNode([this.keyboardToken = true]) : super();
bool keyboardToken;
// @override
// bool get hasFocus => _hasFocus;
@override
bool consumeKeyboardToken() {
return keyboardToken;
}
void hideKeyboard() {
SystemChannels.textInput.invokeMethod<void>('TextInput.hide');
}
void showKeyboard() {
SystemChannels.textInput.invokeMethod<void>('TextInput.show');
}
@override
void unfocus({
UnfocusDisposition disposition = UnfocusDisposition.scope,
bool showCursor = false,
}) {
keyboardToken = false;
if (showCursor) {
hideKeyboard();
} else {
super.unfocus(disposition: disposition);
}
}
@override
void requestFocus([FocusNode? node, bool keyboard = true]) {
keyboardToken = keyboard;
if (keyboardToken) {
showKeyboard();
} else {
hideKeyboard();
}
super.requestFocus();
}
}
| 21.018868 | 66 | 0.677738 |
4b96eae55dd8b5463b8259b598400b3b539f0c49 | 2,931 | go | Go | enmime.go | jrse/enmime | 87eb76762b8a660bef98b369f5d96168182f2993 | [
"MIT"
] | null | null | null | enmime.go | jrse/enmime | 87eb76762b8a660bef98b369f5d96168182f2993 | [
"MIT"
] | null | null | null | enmime.go | jrse/enmime | 87eb76762b8a660bef98b369f5d96168182f2993 | [
"MIT"
] | null | null | null | // Package enmime implements a MIME encoding and decoding library. It's built on top of Go's
// included mime/multipart support where possible, but is geared towards parsing MIME encoded
// emails.
//
// Overview
//
// The enmime API has two conceptual layers. The lower layer is a tree of Part structs,
// representing each component of a decoded MIME message. The upper layer, called an Envelope
// provides an intuitive way to interact with a MIME message.
//
// Part Tree
//
// Calling ReadParts causes enmime to parse the body of a MIME message into a tree of Part objects,
// each of which is aware of its content type, filename and headers. The content of a Part is
// available as a slice of bytes via the Content field.
//
// If the part was encoded in quoted-printable or base64, it is decoded prior to being placed in
// Content. If the Part contains text in a character set other than utf-8, enmime will attempt to
// convert it to utf-8.
//
// To locate a particular Part, pass a custom PartMatcher function into the BreadthMatchFirst() or
// DepthMatchFirst() methods to search the Part tree. BreadthMatchAll() and DepthMatchAll() will
// collect all Parts matching your criteria.
//
// Envelope
//
// ReadEnvelope returns an Envelope struct. Behind the scenes a Part tree is constructed, and then
// sorted into the correct fields of the Envelope.
//
// The Envelope contains both the plain text and HTML portions of the email. If there was no plain
// text Part available, the HTML Part will be down-converted using the html2text library[1]. The
// root of the Part tree, as well as slices of the inline and attachment Parts are also available.
//
// Headers
//
// Every MIME Part has its own headers, accessible via the Part.Header field. The raw headers for
// an Envelope are available in Root.Header. Envelope also provides helper methods to fetch
// headers: GetHeader(key) will return the RFC 2047 decoded value of the specified header.
// AddressList(key) will convert the specified address header into a slice of net/mail.Address
// values.
//
// Errors
//
// enmime attempts to be tolerant of poorly encoded MIME messages. In situations where parsing is
// not possible, the ReadEnvelope and ReadParts functions will return a hard error. If enmime is
// able to continue parsing the message, it will add an entry to the Errors slice on the relevant
// Part. After parsing is complete, all Part errors will be appended to the Envelope Errors slice.
// The Error* constants can be used to identify a specific class of error.
//
// Please note that enmime parses messages into memory, so it is not likely to perform well with
// multi-gigabyte attachments.
//
// enmime is open source software released under the MIT License. The latest version can be found
// at https://github.com/jrse/enmime
//
// [1]: https://github.com/jaytaylor/html2text
package enmime // import "github.com/jrse/enmime"
| 50.534483 | 99 | 0.756738 |
0a8a3ffb3a69af8b3ca0a2e4c5f6735f015d9b14 | 7,490 | go | Go | tmxscripter/tmxscripter_test.go | kurrik/tmxscripter | 3c175ecb2c19855e0b0477c44e1bdf34b777814e | [
"Apache-2.0"
] | 1 | 2016-02-23T04:12:57.000Z | 2016-02-23T04:12:57.000Z | tmxscripter/tmxscripter_test.go | kurrik/tmxscripter | 3c175ecb2c19855e0b0477c44e1bdf34b777814e | [
"Apache-2.0"
] | null | null | null | tmxscripter/tmxscripter_test.go | kurrik/tmxscripter | 3c175ecb2c19855e0b0477c44e1bdf34b777814e | [
"Apache-2.0"
] | null | null | null | // Copyright 2015 Arne Roomann-Kurrik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tmxscripter
import (
"fmt"
"github.com/kurrik/fauxfile"
"github.com/kurrik/tmxgo"
"io/ioutil"
"testing"
)
func getGrid(input string, layer string) (output tmxgo.DataTileGrid, err error) {
var (
m *tmxgo.Map
l *tmxgo.Layer
)
if m, err = tmxgo.ParseMapString(input); err != nil {
return
}
if l, err = m.LayerByName(layer); err != nil {
return
}
output, err = l.GetGrid()
return
}
func getGridIds(grid tmxgo.DataTileGrid) (ids []uint32) {
ids = make([]uint32, grid.Width*grid.Height)
for y := 0; y < grid.Height; y++ {
for x := 0; x < grid.Width; x++ {
ids[y*grid.Width+x] = grid.Tiles[x][y].Id
}
}
return
}
func writeFile(fs fauxfile.Filesystem, path, contents string) (err error) {
var f fauxfile.File
if f, err = fs.Create(path); err != nil {
return
}
defer f.Close()
f.Write([]byte(contents))
return
}
func readFile(fs fauxfile.Filesystem, path string) (contents string, err error) {
var (
byteOutput []byte
f fauxfile.File
)
if f, err = fs.Open(path); err != nil {
return
}
defer f.Close()
if byteOutput, err = ioutil.ReadAll(f); err != nil {
return
}
contents = string(byteOutput)
return
}
func script(input, script, data string) (output string, fs fauxfile.Filesystem, err error) {
fs = fauxfile.NewMockFilesystem()
var scripter = NewTmxScripter(fs)
scripter.InputPath = "./foo/map.tmx"
scripter.OutputPath = "./foo/modified.tmx"
scripter.ScriptPath = "./foo/script.js"
if err = fs.MkdirAll("./foo/bar", 0755); err != nil {
return
}
if err = writeFile(fs, scripter.InputPath, input); err != nil {
return
}
if err = writeFile(fs, scripter.ScriptPath, script); err != nil {
return
}
if err = writeFile(fs, "./foo/bar/data.json", data); err != nil {
return
}
if err = scripter.Run(); err != nil {
return
}
if output, err = readFile(fs, scripter.OutputPath); err != nil {
return
}
return
}
func runTest(js, layer string, expected []uint32) (fs fauxfile.Filesystem, err error) {
var (
result string
grid tmxgo.DataTileGrid
ids []uint32
)
if result, fs, err = script(TEST_MAP, js, TEST_DATA); err != nil {
return
}
if grid, err = getGrid(result, layer); err != nil {
return
}
ids = getGridIds(grid)
if len(ids) != len(expected) {
err = fmt.Errorf("IDs didn't match! expected: %v, got %v", expected, ids)
return
}
for i := 0; i < len(ids); i++ {
if ids[i] != expected[i] {
err = fmt.Errorf("No match at index %v! expected: %v, got %v", i, expected[i], ids[i])
return
}
}
return
}
const TEST_DATA = `
{
"aString": "bar",
"aNumber": 20
}`
const TEST_MAP = `
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="3" height="3" tilewidth="32" tileheight="32">
<tileset firstgid="1" name="sprites32" tilewidth="32" tileheight="32">
<image source="sprites.png" width="512" height="512"/>
</tileset>
<layer name="layer1" width="3" height="3">
<data>
<tile gid="1" />
<tile gid="0" />
<tile gid="0" />
<tile gid="0" />
<tile gid="1" />
<tile gid="0" />
<tile gid="0" />
<tile gid="0" />
<tile gid="1" />
</data>
</layer>
</map>
`
func TestValidateInputPath(t *testing.T) {
var (
fs = fauxfile.NewMockFilesystem()
scripter = NewTmxScripter(fs)
err error
)
scripter.InputPath = "./doesnotexist.tmx"
scripter.OutputPath = "./modified.tmx"
scripter.ScriptPath = "./script.js"
if err = writeFile(fs, scripter.ScriptPath, `console.log("foo");`); err != nil {
return
}
if err = scripter.Validate(); err == nil {
t.Fatalf("Expected error if input path doesn't exist")
return
}
}
func TestValidateScriptPath(t *testing.T) {
var (
fs = fauxfile.NewMockFilesystem()
scripter = NewTmxScripter(fs)
err error
)
scripter.InputPath = "./map.tmx"
scripter.OutputPath = "./modified.tmx"
scripter.ScriptPath = "./doesnotexist.js"
if err = writeFile(fs, scripter.InputPath, TEST_MAP); err != nil {
return
}
if err = scripter.Validate(); err == nil {
t.Fatalf("Expected error if script path doesn't exist")
return
}
}
func TestNoop(t *testing.T) {
if _, err := runTest(`
// This script does nothing.
`, "layer1", []uint32{
1, 0, 0,
0, 1, 0,
0, 0, 1,
}); err != nil {
t.Fatal(err)
}
}
func TestPlusOne(t *testing.T) {
if _, err := runTest(`
// This script adds one to each tile Id.
addEventListener("map", function(m) {
var layer = m.GetLayer("layer1"),
grid = layer.GetGrid(),
tile;
for (var y = 0; y < grid.Height(); y++) {
for (var x = 0; x < grid.Width(); x++) {
tile = grid.TileAt(x, y);
tile.Id += 1;
}
}
grid.Save();
});
`, "layer1", []uint32{
2, 1, 1,
1, 2, 1,
1, 1, 2,
}); err != nil {
t.Fatal(err)
}
}
func TestPlusOneMap(t *testing.T) {
if _, err := runTest(`
// This script adds one to each tile Id using underscore's map.
addEventListener("map", function(m) {
var layer = m.GetLayer("layer1"),
grid = layer.GetGrid();
_.map(grid.TileList(), function(tile) {
tile.Id += 1;
});
grid.Save();
});
`, "layer1", []uint32{
2, 1, 1,
1, 2, 1,
1, 1, 2,
}); err != nil {
t.Fatal(err)
}
}
func TestAddLayer(t *testing.T) {
if _, err := runTest(`
// This script adds a new layer to the map.
addEventListener("map", function(m) {
var layer = m.AddLayer("layer2"),
grid = layer.GetGrid(),
tile;
grid.TileAt(1,1).Id = 1;
grid.Save();
});
`, "layer2", []uint32{
0, 0, 0,
0, 1, 0,
0, 0, 0,
}); err != nil {
t.Fatal(err)
}
}
func TestReadFile(t *testing.T) {
if _, err := runTest(`
// This script reads a data file and uses it to adjust a layer.
addEventListener("map", function(m) {
var layer = m.GetLayer("layer1"),
grid = layer.GetGrid(),
data = JSON.parse(readFile("bar/data.json")),
tile;
for (var y = 0; y < grid.Height(); y++) {
for (var x = 0; x < grid.Width(); x++) {
grid.TileAt(x, y).Id = data.aNumber;
}
}
grid.Save();
});
`, "layer1", []uint32{
20, 20, 20,
20, 20, 20,
20, 20, 20,
}); err != nil {
t.Fatal(err)
}
}
func TestWriteFile(t *testing.T) {
var (
output string
expected string = "[1,0,0,0,1,0,0,0,1]"
fs fauxfile.Filesystem
err error
)
if fs, err = runTest(`
// This script writes a list of tile IDs to a file.
addEventListener("map", function(m) {
var layer = m.GetLayer("layer1"),
grid = layer.GetGrid(),
data;
data = _.map(grid.TileList(), function(tile) {
return tile.Id;
});
writeFile("bar/output.json", JSON.stringify(data));
});
`, "layer1", []uint32{
1, 0, 0,
0, 1, 0,
0, 0, 1,
}); err != nil {
t.Fatal(err)
}
if output, err = readFile(fs, "./foo/bar/output.json"); err != nil {
t.Fatal(err)
}
if output != expected {
t.Fatalf("Data file invalid. Got: '%v' Expected: '%v'", output, expected)
}
}
| 22.97546 | 96 | 0.610414 |
f27e00696edd02fb84e4c3557b9e4564602806f6 | 586 | asm | Assembly | oeis/109/A109604.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/109/A109604.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/109/A109604.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A109604: Numbers n such that 41*n - 43 is prime.
; Submitted by Jamie Morken(w3)
; 10,12,16,22,24,30,36,40,52,60,66,72,82,100,102,112,120,142,144,154,156,162,166,186,192,196,214,222,234,252,256,264,270,276,280,282,294,304,306,322,324,330,346,352,360,376,382,394,396,406,414,424,432,462,472
mov $1,84
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $1,24
sub $2,1
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,65
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,496
div $0,41
add $0,10
| 21.703704 | 208 | 0.639932 |
d2c893e3e558cb8477b3bf61bea14f8b59f8d25a | 1,690 | php | PHP | routes/api.php | Sabbir163015043/Management-System-Api | 92a8acedc52a8fec26c023ad108401938d4fc720 | [
"MIT"
] | null | null | null | routes/api.php | Sabbir163015043/Management-System-Api | 92a8acedc52a8fec26c023ad108401938d4fc720 | [
"MIT"
] | null | null | null | routes/api.php | Sabbir163015043/Management-System-Api | 92a8acedc52a8fec26c023ad108401938d4fc720 | [
"MIT"
] | null | null | null | <?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\ProjectController;
use App\Http\Controllers\Api\ClientController;
use App\Http\Controllers\Api\ContactController;
use App\Http\Controllers\Api\DevloperController;
use App\Http\Controllers\Api\PaymentController;
use App\Http\Controllers\Api\ExpenseController;
use App\Http\Controllers\Api\ModuleController;
use App\Http\Controllers\Api\TaskController;
use App\Http\Controllers\Api\AttachmentController;
use App\Http\Controllers\Api\CommentController;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
// Route :: post ("add",[ProjectController::class,'add']);
Route::resource('v1/projects', ProjectController::class);
Route::resource('v1/clients', ClientController::class);
Route::resource('v1/contacts', ContactController::class);
Route::resource('v1/devlopers', DevloperController::class);
Route::resource('v1/payments', PaymentController::class);
Route::resource('v1/expenses', ExpenseController::class);
Route::resource('v1/modules', ModuleController::class);
Route::resource('v1/tasks', TaskController::class);
Route::resource('v1/attachments', AttachmentController::class);
Route::resource('v1/comments', CommentController::class);
| 34.489796 | 75 | 0.707101 |
8756b6f7f75cf8527f6c6f09135fda4ba732c0f0 | 1,407 | html | HTML | application/admin/view/public/_js.html | amd5/blog | 8fb95b647bb0317eb74165dcfba76ba6df4a7955 | [
"Apache-2.0"
] | 1 | 2018-07-10T16:04:15.000Z | 2018-07-10T16:04:15.000Z | application/admin/view/public/_js.html | amd5/blog | 8fb95b647bb0317eb74165dcfba76ba6df4a7955 | [
"Apache-2.0"
] | null | null | null | application/admin/view/public/_js.html | amd5/blog | 8fb95b647bb0317eb74165dcfba76ba6df4a7955 | [
"Apache-2.0"
] | null | null | null | </body>
</div>
</div>
</div>
<!-- <script src="/static/admin_css/layer/layer.js" charset="utf-8"></script> 重复取消-->
<!-- <script src="/static/admin_css/layui/layui.js" charset="utf-8"></script> -->
<!-- <script src="/static/admin_css/js/admin.js" charset="utf-8"></script> -->
<!-- <script src="/static/admin_css/markdown/js/jquery.min.js"></script> 重复取消-->
<!-- <script src="/static/admin_css/markdown/js/editormd.min.js"></script> -->
<script src="/static/admin_css/js/jquery.js" charset="utf-8"></script>
<script src="/static/admin_css/layui/layui.js" charset="utf-8"></script>
<script src="/static/admin_css/js/admin.js" charset="utf-8"></script>
<script src="/static/admin_css/markdown/js/editormd.min.js"></script>
<script src="/static/admin_css/markdown/lib/marked.min.js"></script>
<script src="/static/admin_css/markdown/lib/prettify.min.js"></script>
<script src="/static/admin_css/layer/layer.js" charset="utf-8"></script>
<script type="text/javascript">
// 侧边栏 缩小后点击自动展开
$('.layui-nav-tree').click(function(obj){
if($('#LAY_app').hasClass('layadmin-side-shrink')){
$('#LAY_app').removeClass('layadmin-side-shrink');
};
if ($('#LAY_app_flexible').hasClass('layui-icon-spread-left')){
$('#LAY_app_flexible').removeClass('layui-icon-spread-left');
$('#LAY_app_flexible').addClass('layui-icon-shrink-right');
};
});
</script> | 37.026316 | 85 | 0.656006 |
da4e8e367805070b7841d93bee35ae6035fa52da | 669 | swift | Swift | MusicMotion/Song.swift | CliffWhite/AutomationPOC | cc0429ec3b06ae6180cf874caed35162d3f5d4b1 | [
"AML"
] | null | null | null | MusicMotion/Song.swift | CliffWhite/AutomationPOC | cc0429ec3b06ae6180cf874caed35162d3f5d4b1 | [
"AML"
] | null | null | null | MusicMotion/Song.swift | CliffWhite/AutomationPOC | cc0429ec3b06ae6180cf874caed35162d3f5d4b1 | [
"AML"
] | null | null | null | /*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
This class represents an instance of a single song.
*/
import Foundation
import UIKit
/**
This struct is responsible for the storing the song metadata. The `SongManager`
manages instances of this struct.
*/
struct Song: CustomDebugStringConvertible {
// MARK: Properties
var artist: String
var title: String
var albumImage: UIImage?
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return "Artist: \(artist), Title: \(title), Album Image: \(String(describing: albumImage))"
}
}
| 22.3 | 99 | 0.714499 |
027108e913ed45403ea619b707ddfbb0cd7d6cf0 | 2,884 | h | C | sdk/protocol/boatchainmaker/protos/common/member.pb-c.h | wsdhrtjl/BoAT-X-Framework | a79477048716993773004075a3ebfd6eef0171a5 | [
"Apache-2.0"
] | 1 | 2022-03-03T01:43:58.000Z | 2022-03-03T01:43:58.000Z | sdk/protocol/boatchainmaker/protos/common/member.pb-c.h | wsdhrtjl/BoAT-X-Framework | a79477048716993773004075a3ebfd6eef0171a5 | [
"Apache-2.0"
] | null | null | null | sdk/protocol/boatchainmaker/protos/common/member.pb-c.h | wsdhrtjl/BoAT-X-Framework | a79477048716993773004075a3ebfd6eef0171a5 | [
"Apache-2.0"
] | null | null | null | /* Generated by the protocol buffer compiler. DO NOT EDIT! */
/* Generated from: accesscontrol/member.proto */
#ifndef PROTOBUF_C_accesscontrol_2fmember_2eproto__INCLUDED
#define PROTOBUF_C_accesscontrol_2fmember_2eproto__INCLUDED
#include <protobuf-c/protobuf-c.h>
PROTOBUF_C__BEGIN_DECLS
#if PROTOBUF_C_VERSION_NUMBER < 1003000
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
#elif 1003003 < PROTOBUF_C_MIN_COMPILER_VERSION
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif
typedef struct _Accesscontrol__SerializedMember Accesscontrol__SerializedMember;
/* --- enums --- */
/* --- messages --- */
/*
* Serialized member of blockchain
*/
struct _Accesscontrol__SerializedMember
{
ProtobufCMessage base;
/*
* organization identifier of the member
*/
char *org_id;
/*
* member identity related info bytes
*/
ProtobufCBinaryData member_info;
/*
* use cert compression
* todo: is_full_cert -> compressed
*/
protobuf_c_boolean is_full_cert;
};
#define ACCESSCONTROL__SERIALIZED_MEMBER__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&accesscontrol__serialized_member__descriptor) \
, (char *)protobuf_c_empty_string, {0,NULL}, 0 }
/* Accesscontrol__SerializedMember methods */
void accesscontrol__serialized_member__init
(Accesscontrol__SerializedMember *message);
size_t accesscontrol__serialized_member__get_packed_size
(const Accesscontrol__SerializedMember *message);
size_t accesscontrol__serialized_member__pack
(const Accesscontrol__SerializedMember *message,
uint8_t *out);
size_t accesscontrol__serialized_member__pack_to_buffer
(const Accesscontrol__SerializedMember *message,
ProtobufCBuffer *buffer);
Accesscontrol__SerializedMember *
accesscontrol__serialized_member__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
void accesscontrol__serialized_member__free_unpacked
(Accesscontrol__SerializedMember *message,
ProtobufCAllocator *allocator);
/* --- per-message closures --- */
typedef void (*Accesscontrol__SerializedMember_Closure)
(const Accesscontrol__SerializedMember *message,
void *closure_data);
/* --- services --- */
/* --- descriptors --- */
extern const ProtobufCMessageDescriptor accesscontrol__serialized_member__descriptor;
PROTOBUF_C__END_DECLS
#endif /* PROTOBUF_C_accesscontrol_2fmember_2eproto__INCLUDED */
| 33.149425 | 180 | 0.714286 |
8a7d961db9ab47ae1499025736162fe4afa6a0ee | 2,741 | ps1 | PowerShell | Data/Test-QlikAccess.ps1 | msilvestro/QlikButler | 75c8f3b01d57fc4275d9ab9ca8d8ea2f81280dcd | [
"MIT"
] | 1 | 2020-03-03T15:46:47.000Z | 2020-03-03T15:46:47.000Z | Data/Test-QlikAccess.ps1 | msilvestro/QlikButler | 75c8f3b01d57fc4275d9ab9ca8d8ea2f81280dcd | [
"MIT"
] | null | null | null | Data/Test-QlikAccess.ps1 | msilvestro/QlikButler | 75c8f3b01d57fc4275d9ab9ca8d8ea2f81280dcd | [
"MIT"
] | 1 | 2021-03-01T16:49:17.000Z | 2021-03-01T16:49:17.000Z | <#
.SINOSSI
Restituisci un resoconto dettagliato dello stato di un nodo.
.SINTASSI
Test-QlikAccess [-Acronimo] <string> [-Ambiente] <string> [-InstallationType] <string>
.DESCRIZIONE
Se il cluster è Qlik Sense, per ogni suo nodo:
* Esegui un pin al server.
* Esegui una richiesta HTTP per controllare il funzionamento dell'Engine.
* Controlla la raggiungibilità della QMC.
* Controlla la raggiungibilità dell'hub.
Se il cluster è NPrinting il funzionamento è da rivedere (TODO).
.NOTE
Autore: Matteo Silvestro
Versione: 3.0.2
Ultimo aggiornamento: 11/10/2019
#>
param(
[string] $Acronimo,
[string] $Ambiente,
[string] $InstallationType
)
# Ottieni la directory da cui è stato lanciato lo script.
$ScriptPath = if ($psise) { Split-Path $psise.CurrentFile.FullPath } else { $PSScriptRoot }
Import-Module $ScriptPath\QlikButlerManagerToolbox.psm1
$ClusterNodes = Import-Csv $ScriptPath\NodiCluster.csv -Delimiter ';' | where { ($_.Acronimo -eq $Acronimo) -and ($_.Ambiente -eq $Ambiente) -and ($_.Installazione -eq $InstallationType) }
$ClusterNodes | foreach {
Write-Host "Nodo $($_.Hostname)" -BackgroundColor DarkCyan
$PingTest = Test-NetConnection -ComputerName $_.Hostname
Write-Host "Ping:`t`t`t`t" -NoNewline
if ($PingTest) {
Write-Host "Successo" -ForegroundColor Green
} else {
Write-Host "Errore" -ForegroundColor Red
}
if ($InstallationType -eq "Qlik Sense") {
$HealthCheck = Test-WebPage -Url "https://$($_.Hostname)/engine/healthcheck/"
$QMCTest = Test-WebPage -Url "https://$($_.Hostname)/qmc"
$HubTest = Test-WebPage -Url "https://$($_.Hostname)/hub"
Write-Host "Engine check:`t`t" -NoNewline
if ($HealthCheck) {
Write-Host "Successo" -ForegroundColor Green
} else {
Write-Host "Errore" -ForegroundColor Red
}
Write-Host "Accesso QMC:`t`t" -NoNewline
if ($QMCTest) {
Write-Host "Successo" -ForegroundColor Green
} else {
Write-Host "Errore" -ForegroundColor Red
}
Write-Host "Accesso hub:`t`t" -NoNewline
if ($HubTest) {
Write-Host "Successo" -ForegroundColor Green
} else {
Write-Host "Errore" -ForegroundColor Red
}
} elseif (($InstallationType -eq "NPrinting") -and ($_.TipoNodo -eq "Central")) {
$ConsoleTest = Test-WebPage -Url "https://$($_.Hostname):4993"
Write-Host "Accesso console:`t" -NoNewline
if ($ConsoleTest -eq 200) {
Write-Host "Successo" -ForegroundColor Green
} else {
Write-Host "Errore" -ForegroundColor Red
}
}
Write-Host
} | 33.426829 | 188 | 0.636264 |
73453e8ec7fa054bf1afadf7a8915735cfc80cfa | 4,685 | sql | SQL | sysPass-2.1.11.17061503/inc/sql/20017011701.sql | kolaente/syspass-docker | 6247f52c3c5ec197142fa5fcfbd61846acd5329f | [
"MIT"
] | 3 | 2017-08-02T19:16:34.000Z | 2018-10-24T12:39:02.000Z | sysPass-2.1.11.17061503/inc/sql/20017011701.sql | kolaente/syspass-docker | 6247f52c3c5ec197142fa5fcfbd61846acd5329f | [
"MIT"
] | null | null | null | sysPass-2.1.11.17061503/inc/sql/20017011701.sql | kolaente/syspass-docker | 6247f52c3c5ec197142fa5fcfbd61846acd5329f | [
"MIT"
] | null | null | null | ALTER TABLE `accounts`
ADD COLUMN `account_isPrivateGroup` BIT(1) NULL DEFAULT b'0' AFTER `account_isPrivate`;
ALTER TABLE `accHistory`
ADD COLUMN `accHistory_isPrivate` BIT(1) NULL DEFAULT b'0' AFTER `accHistory_parentId`,
ADD COLUMN `accHistory_isPrivateGroup` BIT(1) NULL DEFAULT b'0' AFTER `accHistory_isPrivate`;
CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = CURRENT_USER SQL SECURITY DEFINER VIEW `account_data_v` AS
SELECT
`accounts`.`account_id` AS `account_id`,
`accounts`.`account_name` AS `account_name`,
`accounts`.`account_categoryId` AS `account_categoryId`,
`accounts`.`account_userId` AS `account_userId`,
`accounts`.`account_customerId` AS `account_customerId`,
`accounts`.`account_userGroupId` AS `account_userGroupId`,
`accounts`.`account_userEditId` AS `account_userEditId`,
`accounts`.`account_login` AS `account_login`,
`accounts`.`account_url` AS `account_url`,
`accounts`.`account_notes` AS `account_notes`,
`accounts`.`account_countView` AS `account_countView`,
`accounts`.`account_countDecrypt` AS `account_countDecrypt`,
`accounts`.`account_dateAdd` AS `account_dateAdd`,
`accounts`.`account_dateEdit` AS `account_dateEdit`,
CONV(`accounts`.`account_otherUserEdit`,10,2) AS `account_otherUserEdit`,
CONV(`accounts`.`account_otherGroupEdit`,10,2) AS `account_otherGroupEdit`,
CONV(`accounts`.`account_isPrivate`, 10, 2) AS `account_isPrivate`,
CONV(`accounts`.`account_isPrivateGroup`, 10, 2) AS `account_isPrivateGroup`,
`accounts`.`account_passDate` AS `account_passDate`,
`accounts`.`account_passDateChange` AS `account_passDateChange`,
`accounts`.`account_parentId` AS `account_parentId`,
`categories`.`category_name` AS `category_name`,
`customers`.`customer_name` AS `customer_name`,
`ug`.`usergroup_name` AS `usergroup_name`,
`u1`.`user_name` AS `user_name`,
`u1`.`user_login` AS `user_login`,
`u2`.`user_name` AS `user_editName`,
`u2`.`user_login` AS `user_editLogin`,
`publicLinks`.`publicLink_hash` AS `publicLink_hash`
FROM
((((((`accounts`
LEFT JOIN `categories` ON ((`accounts`.`account_categoryId` = `categories`.`category_id`)))
LEFT JOIN `usrGroups` `ug` ON ((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`)))
LEFT JOIN `usrData` `u1` ON ((`accounts`.`account_userId` = `u1`.`user_id`)))
LEFT JOIN `usrData` `u2` ON ((`accounts`.`account_userEditId` = `u2`.`user_id`)))
LEFT JOIN `customers` ON ((`accounts`.`account_customerId` = `customers`.`customer_id`)))
LEFT JOIN `publicLinks` ON ((`accounts`.`account_id` = `publicLinks`.`publicLink_itemId`)));
CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = CURRENT_USER SQL SECURITY DEFINER VIEW `account_search_v` AS
SELECT DISTINCT
`accounts`.`account_id` AS `account_id`,
`accounts`.`account_customerId` AS `account_customerId`,
`accounts`.`account_categoryId` AS `account_categoryId`,
`accounts`.`account_name` AS `account_name`,
`accounts`.`account_login` AS `account_login`,
`accounts`.`account_url` AS `account_url`,
`accounts`.`account_notes` AS `account_notes`,
`accounts`.`account_userId` AS `account_userId`,
`accounts`.`account_userGroupId` AS `account_userGroupId`,
`accounts`.`account_otherUserEdit` AS `account_otherUserEdit`,
`accounts`.`account_otherGroupEdit` AS `account_otherGroupEdit`,
`accounts`.`account_isPrivate` AS `account_isPrivate`,
`accounts`.`account_isPrivateGroup` AS `account_isPrivateGroup`,
`accounts`.`account_passDate` AS `account_passDate`,
`accounts`.`account_passDateChange` AS `account_passDateChange`,
`accounts`.`account_parentId` AS `account_parentId`,
`accounts`.`account_countView` AS `account_countView`,
`ug`.`usergroup_name` AS `usergroup_name`,
`categories`.`category_name` AS `category_name`,
`customers`.`customer_name` AS `customer_name`,
(SELECT
COUNT(0)
FROM
`accFiles`
WHERE
(`accFiles`.`accfile_accountId` = `accounts`.`account_id`)) AS `num_files`
FROM
(((`accounts`
LEFT JOIN `categories` ON ((`accounts`.`account_categoryId` = `categories`.`category_id`)))
LEFT JOIN `usrGroups` `ug` ON ((`accounts`.`account_userGroupId` = `ug`.`usergroup_id`)))
LEFT JOIN `customers` ON ((`customers`.`customer_id` = `accounts`.`account_customerId`)));
| 57.134146 | 110 | 0.672145 |
5160961dde653970da66a3bfbffc72f8b6120d70 | 205 | sql | SQL | src/test/resources/sql/update/e8579a0f.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 66 | 2018-06-15T11:34:03.000Z | 2022-03-16T09:24:49.000Z | src/test/resources/sql/update/e8579a0f.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 13 | 2019-03-19T11:56:28.000Z | 2020-08-05T04:20:50.000Z | src/test/resources/sql/update/e8579a0f.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 28 | 2019-01-05T19:59:02.000Z | 2022-03-24T11:55:50.000Z | -- file:rowsecurity.sql ln:653 expect:true
UPDATE t1 t1_1 SET b = t1_2.b FROM t1 t1_2
WHERE t1_1.a = 4 AND t1_2.a = t1_1.a AND t1_2.b = t1_1.b
AND f_leak(t1_1.b) AND f_leak(t1_2.b) RETURNING *, t1_1, t1_2
| 41 | 61 | 0.712195 |
fb84232f0c88a3b81300689f0c94ae33ca7b7209 | 860 | java | Java | u8sdk_vivooffline/src/main/java/com/u8/sdk/VivoAds.java | leo0228/U8Project | 495c3ab47a604842e924233484459f1b61d45341 | [
"Apache-2.0"
] | 4 | 2021-01-28T01:11:16.000Z | 2022-01-28T02:01:37.000Z | u8sdk_vivooffline/src/main/java/com/u8/sdk/VivoAds.java | leo0228/U8Project | 495c3ab47a604842e924233484459f1b61d45341 | [
"Apache-2.0"
] | null | null | null | u8sdk_vivooffline/src/main/java/com/u8/sdk/VivoAds.java | leo0228/U8Project | 495c3ab47a604842e924233484459f1b61d45341 | [
"Apache-2.0"
] | 2 | 2021-03-11T04:45:21.000Z | 2022-01-28T02:01:42.000Z | package com.u8.sdk;
import android.app.Activity;
import com.u8.sdk.utils.Arrays;
public class VivoAds extends U8AdAdapter {
public VivoAds(Activity context) {
}
private String[] supportedMethods = {"rewardAd", "insertAd", "nativeAd"};
@Override
public boolean isSupportMethod(String methodName) {
return Arrays.contain(supportedMethods, methodName);
}
@Override
public void rewardAd(String posId) {
VivoSDK.getInstance().showRewardAd(posId);
}
@Override
public void insertAd(String posId) {
VivoSDK.getInstance().showInsertAd(posId);
}
@Override
public void nativeAd(String posId, U8AdParams adParams) {
VivoSDK.getInstance().showNativeAd(posId,adParams);
}
@Override
public void nativeClose() {
VivoSDK.getInstance().nativeClose();
}
}
| 21.5 | 77 | 0.672093 |
80b01f9f16722bdeb3ef944631a6a0af8558b406 | 4,677 | java | Java | src/integrations/spigot-1.16/work/decompile-d7866d9c/net/minecraft/server/commands/CommandTime.java | alexjvan/BrokenCube | 2b7c8ae2ada23ba3d0831738d2b46acb85f68289 | [
"Apache-2.0"
] | 1 | 2021-03-19T06:10:32.000Z | 2021-03-19T06:10:32.000Z | src/integrations/spigot-1.16/work/decompile-d7866d9c/net/minecraft/server/commands/CommandTime.java | alexjvan/BrokenCube | 2b7c8ae2ada23ba3d0831738d2b46acb85f68289 | [
"Apache-2.0"
] | null | null | null | src/integrations/spigot-1.16/work/decompile-d7866d9c/net/minecraft/server/commands/CommandTime.java | alexjvan/BrokenCube | 2b7c8ae2ada23ba3d0831738d2b46acb85f68289 | [
"Apache-2.0"
] | null | null | null | package net.minecraft.server.commands;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import java.util.Iterator;
import net.minecraft.commands.CommandListenerWrapper;
import net.minecraft.commands.arguments.ArgumentTime;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.server.level.WorldServer;
public class CommandTime {
public static void a(CommandDispatcher<CommandListenerWrapper> commanddispatcher) {
commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.CommandDispatcher.a("time").requires((commandlistenerwrapper) -> {
return commandlistenerwrapper.hasPermission(2);
})).then(((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.CommandDispatcher.a("set").then(net.minecraft.commands.CommandDispatcher.a("day").executes((commandcontext) -> {
return a((CommandListenerWrapper) commandcontext.getSource(), 1000);
}))).then(net.minecraft.commands.CommandDispatcher.a("noon").executes((commandcontext) -> {
return a((CommandListenerWrapper) commandcontext.getSource(), 6000);
}))).then(net.minecraft.commands.CommandDispatcher.a("night").executes((commandcontext) -> {
return a((CommandListenerWrapper) commandcontext.getSource(), 13000);
}))).then(net.minecraft.commands.CommandDispatcher.a("midnight").executes((commandcontext) -> {
return a((CommandListenerWrapper) commandcontext.getSource(), 18000);
}))).then(net.minecraft.commands.CommandDispatcher.a("time", (ArgumentType) ArgumentTime.a()).executes((commandcontext) -> {
return a((CommandListenerWrapper) commandcontext.getSource(), IntegerArgumentType.getInteger(commandcontext, "time"));
})))).then(net.minecraft.commands.CommandDispatcher.a("add").then(net.minecraft.commands.CommandDispatcher.a("time", (ArgumentType) ArgumentTime.a()).executes((commandcontext) -> {
return b((CommandListenerWrapper) commandcontext.getSource(), IntegerArgumentType.getInteger(commandcontext, "time"));
})))).then(((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.CommandDispatcher.a("query").then(net.minecraft.commands.CommandDispatcher.a("daytime").executes((commandcontext) -> {
return c((CommandListenerWrapper) commandcontext.getSource(), a(((CommandListenerWrapper) commandcontext.getSource()).getWorld()));
}))).then(net.minecraft.commands.CommandDispatcher.a("gametime").executes((commandcontext) -> {
return c((CommandListenerWrapper) commandcontext.getSource(), (int) (((CommandListenerWrapper) commandcontext.getSource()).getWorld().getTime() % 2147483647L));
}))).then(net.minecraft.commands.CommandDispatcher.a("day").executes((commandcontext) -> {
return c((CommandListenerWrapper) commandcontext.getSource(), (int) (((CommandListenerWrapper) commandcontext.getSource()).getWorld().getDayTime() / 24000L % 2147483647L));
}))));
}
private static int a(WorldServer worldserver) {
return (int) (worldserver.getDayTime() % 24000L);
}
private static int c(CommandListenerWrapper commandlistenerwrapper, int i) {
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.query", new Object[]{i}), false);
return i;
}
public static int a(CommandListenerWrapper commandlistenerwrapper, int i) {
Iterator iterator = commandlistenerwrapper.getServer().getWorlds().iterator();
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
worldserver.setDayTime((long) i);
}
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.set", new Object[]{i}), true);
return a(commandlistenerwrapper.getWorld());
}
public static int b(CommandListenerWrapper commandlistenerwrapper, int i) {
Iterator iterator = commandlistenerwrapper.getServer().getWorlds().iterator();
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
worldserver.setDayTime(worldserver.getDayTime() + (long) i);
}
int j = a(commandlistenerwrapper.getWorld());
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.set", new Object[]{j}), true);
return j;
}
}
| 61.539474 | 256 | 0.725037 |
317b3772bc44926a6e74b3cb5a3b09555e816601 | 766 | go | Go | test/handler_remove_ips_from_netnamespace_test.go | klenkes74/aws-egressip-operator | ab17c91ad8164dd69b427e5d0df40f000e1fc998 | [
"Apache-2.0"
] | null | null | null | test/handler_remove_ips_from_netnamespace_test.go | klenkes74/aws-egressip-operator | ab17c91ad8164dd69b427e5d0df40f000e1fc998 | [
"Apache-2.0"
] | null | null | null | test/handler_remove_ips_from_netnamespace_test.go | klenkes74/aws-egressip-operator | ab17c91ad8164dd69b427e5d0df40f000e1fc998 | [
"Apache-2.0"
] | null | null | null | package main
import (
"github.com/klenkes74/aws-egressip-operator/pkg/openshift"
"github.com/klenkes74/aws-egressip-operator/test/mocks"
"testing"
)
func TestRemoveIPsFromNetnamespace(t *testing.T) {
mockAws := &mocks.AwsClient{}
mockOcp := &mocks.OcpClient{}
cloud := createAwsCloudProviderMock(mockAws)
service := *openshift.NewEgressIPHandler(cloud, mockOcp)
service.RemoveIPsFromNetNamespace(defaultNetNamespace("1.1.1.11", "1.1.2.22", "1.1.3.33"))
}
func TestRemoveIPsFromNetnamespaceNotHavingTheseIPs(t *testing.T) {
mockAws := &mocks.AwsClient{}
mockOcp := &mocks.OcpClient{}
cloud := createAwsCloudProviderMock(mockAws)
service := *openshift.NewEgressIPHandler(cloud, mockOcp)
service.RemoveIPsFromNetNamespace(defaultNetNamespace())
}
| 25.533333 | 91 | 0.76893 |
04f18785b96a0b2d966d09e5180fc63f934e0b82 | 11,202 | java | Java | src/com/tinkerpop/graph/benchmark/index/LuceneKeyToNodeIdIndexImpl.java | xingh/graphdb-load-tester | 3a086206b32cbb36a299a1b78475ae1b3f0bc198 | [
"Apache-2.0"
] | null | null | null | src/com/tinkerpop/graph/benchmark/index/LuceneKeyToNodeIdIndexImpl.java | xingh/graphdb-load-tester | 3a086206b32cbb36a299a1b78475ae1b3f0bc198 | [
"Apache-2.0"
] | null | null | null | src/com/tinkerpop/graph/benchmark/index/LuceneKeyToNodeIdIndexImpl.java | xingh/graphdb-load-tester | 3a086206b32cbb36a299a1b78475ae1b3f0bc198 | [
"Apache-2.0"
] | null | null | null | package com.tinkerpop.graph.benchmark.index;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.File;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
import org.apache.lucene.index.LogByteSizeMergePolicy;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.OpenBitSet;
/**
* Uses Lucene to store and retrieve vertex Ids keyed on a user-defined key. Uses: 1) A bloom filter
* "to know what we don't know" 2) An LRU cache to remember commonly accessed values we do know 3)
* Uses a buffer to accumulate uncommitted state Lucene takes care of the rest.
* @author Mark
*/
public class LuceneKeyToNodeIdIndexImpl implements SimpleKeyToNodeIdIndex
{
LRUCache<String, Long> hotCache;
HashMap<String, Long> uncommittedKeyBuffer = new HashMap<String, Long>();
private IndexWriter writer;
private FSDirectory dir;
private IndexReader reader;
Term term = new Term("udk", "");
int bloomFilterSize = 50 * 1024 * 1024;
int maxNumRecordsBeforeCommit = 500000;
private int lruCacheSize = 500000;
OpenBitSet bloomFilter;
//Avoid Lucene performing "mega merges" with a finite limit on segments sizes that can be merged
private int maxMergeMB = 3000;
//Stats for each batch of updates
long bloomReadSaves = 0;
long hotCacheHits = 0;
long luceneAdds = 0;
long failedLuceneReads = 0;
long successfulLuceneReads = 0;
long startTime = System.currentTimeMillis();
private IndexReader[] subreaders;
private boolean showDebug;
private String path;
private boolean useCompoundFile = false;
private double ramBufferSizeMB = 300;
private int termIndexIntervalSize = 512;
public LuceneKeyToNodeIdIndexImpl(String path, boolean showDebugInfo)
{
this.showDebug = showDebugInfo;
this.path = path;
}
public void init()
{
try
{
hotCache = new LRUCache<String, Long>(getLruCacheSize());
if (showDebug)
{
System.out
.println("timeTaken,numDocs,bloomReadSaves,hotCacheHits,failedLuceneReads,successfulLuceneReads,luceneAdds");
}
bloomFilter = new OpenBitSet(bloomFilterSize);
deleteDirectoryContents(new File(path));
dir = FSDirectory.open(new File(path));
writer = new IndexWriter(dir, new WhitespaceAnalyzer(), MaxFieldLength.UNLIMITED);
// LogByteSizeMergePolicy mp=new LogByteSizeMergePolicy(writer);
LogByteSizeMergePolicy mp = new LogByteSizeMergePolicy();
mp.setMaxMergeMB(getMaxMergeMB());
writer.setMergePolicy(mp);
writer.setUseCompoundFile(useCompoundFile);
writer.setRAMBufferSizeMB(ramBufferSizeMB);
writer.setTermIndexInterval(termIndexIntervalSize);
writer.commit();
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
static public void deleteDirectoryContents(File path)
{
if (path.exists())
{
File[] files = path.listFiles();
for (int i = 0; i < files.length; i++)
{
if (!files[i].isDirectory())
{
files[i].delete();
}
}
}
}
@Override
public long getGraphNodeId(String udk)
{
Long result = hotCache.get(udk);
if (result == null)
{
//fail fast on bloom
int bloomKey = Math.abs(udk.hashCode() % bloomFilterSize);
if (!bloomFilter.fastGet(bloomKey))
{
//Not seen - fail
bloomReadSaves++;
return -1;
}
result = uncommittedKeyBuffer.get(udk);
if (result != null)
{
return result;
}
if (reader == null)
{
try
{
reader = IndexReader.open(dir, true);
subreaders = reader.getSequentialSubReaders();
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
try
{
Term searchTerm = term.createTerm(udk);
for (IndexReader r : subreaders)
{
TermDocs td = r.termDocs(searchTerm);
if (td.next())
{
Document doc = r.document(td.doc());
result = Long.parseLong(doc.get("id"));
hotCache.put(udk, result);
successfulLuceneReads++;
return result;
}
}
failedLuceneReads++;
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
else
{
hotCacheHits++;
}
if (result == null)
{
return -1;
}
else
{
return result;
}
}
@Override
public void put(String udk, long graphNodeId)
{
try
{
if (uncommittedKeyBuffer.size() > maxNumRecordsBeforeCommit)
{
writer.commit();
if (reader != null)
{
IndexReader newReader = reader.reopen(true);
if (newReader != reader)
{
reader.close();
reader = newReader;
}
subreaders = reader.getSequentialSubReaders();
}
uncommittedKeyBuffer.clear();
if (showDebug)
{
long diff = System.currentTimeMillis() - startTime;
System.out.println(diff + "," + reader.maxDoc() + "," + bloomReadSaves + ","
+ hotCacheHits + "," + failedLuceneReads + "," + successfulLuceneReads
+ "," + luceneAdds);
}
bloomReadSaves = 0;
hotCacheHits = 0;
failedLuceneReads = 0;
luceneAdds = 0;
successfulLuceneReads = 0;
startTime = System.currentTimeMillis();
}
int bloomKey = Math.abs(udk.hashCode() % bloomFilterSize);
bloomFilter.fastSet(bloomKey);
uncommittedKeyBuffer.put(udk, graphNodeId);
Document doc = new Document();
Field udkF = new Field("udk", udk, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS);
udkF.setOmitTermFreqAndPositions(true);
doc.add(udkF);
doc.add(new Field("id", "" + graphNodeId, Field.Store.YES, Field.Index.NO));
writer.addDocument(doc);
luceneAdds++;
}
catch (Exception e)
{
throw new RuntimeException("Error adding key to index", e);
}
}
@Override
public void close()
{
try
{
reader.close();
writer.close();
dir.close();
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
@SuppressWarnings("serial")
static class LRUCache<K, V> extends LinkedHashMap<K, V>
{
private int maxSize;
public LRUCache(int maxSize)
{
super(((maxSize * 4) / 3) + 1, 0.75f, true);
this.maxSize = maxSize;
}
@Override
protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest)
{
return size() > maxSize;
}
}
public boolean isUseCompoundFile()
{
return useCompoundFile;
}
public void setUseCompoundFile(boolean useCompoundFile)
{
this.useCompoundFile = useCompoundFile;
}
public double getRamBufferSizeMB()
{
return ramBufferSizeMB;
}
public void setRamBufferSizeMB(double ramBufferSizeMB)
{
this.ramBufferSizeMB = ramBufferSizeMB;
}
public int getTermIndexIntervalSize()
{
return termIndexIntervalSize;
}
public void setTermIndexIntervalSize(int termIndexIntervalSize)
{
this.termIndexIntervalSize = termIndexIntervalSize;
}
public int getBloomFilterSize()
{
return bloomFilterSize;
}
public void setBloomFilterSize(int bloomFilterSize)
{
this.bloomFilterSize = bloomFilterSize;
}
public int getMaxNumRecordsBeforeCommit()
{
return maxNumRecordsBeforeCommit;
}
public void setMaxNumRecordsBeforeCommit(int maxNumRecordsBeforeCommit)
{
this.maxNumRecordsBeforeCommit = maxNumRecordsBeforeCommit;
}
public void setLruCacheSize(int lruCacheSize)
{
this.lruCacheSize = lruCacheSize;
}
public int getLruCacheSize()
{
return lruCacheSize;
}
public void setMaxMergeMB(int maxMergeMB)
{
this.maxMergeMB = maxMergeMB;
}
public int getMaxMergeMB()
{
return maxMergeMB;
}
public long getBloomReadSaves()
{
return bloomReadSaves;
}
public long getHotCacheHits()
{
return hotCacheHits;
}
public long getLuceneAdds()
{
return luceneAdds;
}
public long getFailedLuceneReads()
{
return failedLuceneReads;
}
public long getSuccessfulLuceneReads()
{
return successfulLuceneReads;
}
}
| 30.774725 | 134 | 0.550973 |
810b4dcee0d319f9e141323a4402a6b2260cc391 | 479 | go | Go | goweb/utils/future.go | sagacao/vms-go | 664c6da80b93479aaa9b001a33d0e9a351862c45 | [
"MIT"
] | null | null | null | goweb/utils/future.go | sagacao/vms-go | 664c6da80b93479aaa9b001a33d0e9a351862c45 | [
"MIT"
] | 1 | 2021-01-05T07:57:06.000Z | 2021-01-05T07:57:06.000Z | goweb/utils/future.go | sagacao/vms-go | 664c6da80b93479aaa9b001a33d0e9a351862c45 | [
"MIT"
] | null | null | null | package utils
// Future boilerplate method
func Future(f func() (interface{}, error)) func() (interface{}, error) {
var result interface{}
var err error
c := make(chan struct{}, 1)
// quit := make(chan bool)
go func() {
defer close(c)
result, err = f()
// for {
// select {
// case <-time.After(3 * time.Second):
// fmt.Println("timeout -----")
// quit <- true
// }
// }
}()
return func() (interface{}, error) {
<-c
return result, err
}
}
| 17.740741 | 72 | 0.559499 |
8d84290aa8d4044f70fbcfe585f40fd15851e1cb | 646 | lua | Lua | Dungeon_01/.core_backup/version_0_2020.08.18-11.16.56/Scripts/PlayerStateServer.lua | Core-Team-META/Corehaven | 3f9ed3f5aeb2763c08da54e673258c773bd7a071 | [
"Apache-2.0"
] | 1 | 2021-11-02T16:00:59.000Z | 2021-11-02T16:00:59.000Z | Dungeon_01/.core_backup/version_0_2020.08.18-11.16.56/Scripts/PlayerStateServer.lua | Core-Team-META/Corehaven | 3f9ed3f5aeb2763c08da54e673258c773bd7a071 | [
"Apache-2.0"
] | null | null | null | Dungeon_01/.core_backup/version_0_2020.08.18-11.16.56/Scripts/PlayerStateServer.lua | Core-Team-META/Corehaven | 3f9ed3f5aeb2763c08da54e673258c773bd7a071 | [
"Apache-2.0"
] | 1 | 2021-11-02T17:17:04.000Z | 2021-11-02T17:17:04.000Z | local API_PS = require(script:GetCustomProperty("APIPlayerState"))
local PLAYER_STATE_HELPERS = script:GetCustomProperty("PlayerStateHelpers"):WaitForObject()
local PLAYER_STATE_TEMPLATE = script:GetCustomProperty("PlayerStateTemplate")
function OnPlayerJoined(player)
local helper = World.SpawnAsset(PLAYER_STATE_TEMPLATE, {parent = PLAYER_STATE_HELPERS})
helper.name = API_PS.GetPlayerStateHelperName(player)
end
function OnPlayerLeft(player)
API_PS.GetPlayerStateHelper(player):Destroy()
end
API_PS.SetPlayerStateHelperGroup(PLAYER_STATE_HELPERS)
Game.playerJoinedEvent:Connect(OnPlayerJoined)
Game.playerLeftEvent:Connect(OnPlayerLeft)
| 38 | 91 | 0.852941 |
9088458742e62e01ad0c73c0ef6bd53dcce028a6 | 1,041 | go | Go | day_1/e.go | RomarQ/AdventOfCode_2021 | e5483f600ecaeeb824f13edcd47451b97cdd895b | [
"MIT-0"
] | null | null | null | day_1/e.go | RomarQ/AdventOfCode_2021 | e5483f600ecaeeb824f13edcd47451b97cdd895b | [
"MIT-0"
] | null | null | null | day_1/e.go | RomarQ/AdventOfCode_2021 | e5483f600ecaeeb824f13edcd47451b97cdd895b | [
"MIT-0"
] | null | null | null | package main
import (
"os"
"strconv"
"strings"
)
func exercise_1(inputs []string) uint {
stringToUint := func(value string) uint {
n, err := strconv.Atoi(value)
if err != nil {
panic(err)
}
return uint(n)
}
counter := uint(0)
for idx := 1; idx < len(inputs); idx++ {
if stringToUint(inputs[idx]) > stringToUint(inputs[idx-1]) {
counter++
}
}
return counter
}
func exercise_2(inputs []string) uint {
sum3 := func(inputs []string) uint {
sum := uint(0)
for _, value := range inputs {
n, err := strconv.Atoi(value)
if err != nil {
panic(err)
}
sum += uint(n)
}
return sum
}
counter := uint(0)
for idx := range inputs {
if idx+4 <= len(inputs) && sum3(inputs[idx+1:idx+4]) > sum3(inputs[idx:idx+3]) {
counter++
}
}
return counter
}
func main() {
data, err := os.ReadFile("input.txt")
if err != nil {
panic(err)
}
inputs := strings.Split(strings.Trim(string(data), "\n "), "\n")
println("Exercise 1:", exercise_1(inputs))
println("Exercise 2:", exercise_2(inputs))
}
| 17.644068 | 82 | 0.603266 |
90e94693e3fa4c22c730c0d064afee2f335d0d9a | 860 | py | Python | lstm_dao.py | goiaba/c19-cases-by-day | 1b97c51a2e0c091c8a1baba530a40ec8686e1ee5 | [
"MIT"
] | null | null | null | lstm_dao.py | goiaba/c19-cases-by-day | 1b97c51a2e0c091c8a1baba530a40ec8686e1ee5 | [
"MIT"
] | 6 | 2021-05-21T14:40:12.000Z | 2022-03-12T00:37:27.000Z | lstm_dao.py | goiaba/c19-cases-by-day | 1b97c51a2e0c091c8a1baba530a40ec8686e1ee5 | [
"MIT"
] | 1 | 2020-08-05T23:30:02.000Z | 2020-08-05T23:30:02.000Z | import pandas
from mariadb_handler import MariaDBHandler
class LstmDao(MariaDBHandler):
def __init__(self, host: str, database: str, user: str, password: str):
super(LstmDao, self).__init__(host, database, user, password)
def persist_cases_prediction(self, data: list):
if data:
stmt = """INSERT INTO covid_cases_prediction_by_country (idCountry, predictedCases, datePrediction, entranceDate)
VALUES (%(idCountry)s, %(predictedCases)s, %(datePrediction)s, %(entranceDate)s)"""
self._batch_executor(stmt, data)
def delete_cases_prediction_if_exists(self, entrance_date_str):
stmt = """DELETE FROM covid_cases_prediction_by_country
WHERE entranceDate = %(entranceDate)s"""
self._batch_executor(stmt, [{"entranceDate": entrance_date_str}])
| 45.263158 | 125 | 0.684884 |
56847f4ea002603929dd98ce87b1434803f74e3a | 1,170 | dart | Dart | cookbook/design_problems/shaped_navbars/lib/appbar_theme.dart | fredgrott/code_with_me | 4a82315217fefb56a38054c40c412f88275b1a18 | [
"BSD-3-Clause"
] | 26 | 2021-09-10T02:52:28.000Z | 2022-03-16T23:59:51.000Z | cookbook/design_problems/shaped_navbars/lib/appbar_theme.dart | fredgrott/code_with_me | 4a82315217fefb56a38054c40c412f88275b1a18 | [
"BSD-3-Clause"
] | null | null | null | cookbook/design_problems/shaped_navbars/lib/appbar_theme.dart | fredgrott/code_with_me | 4a82315217fefb56a38054c40c412f88275b1a18 | [
"BSD-3-Clause"
] | 4 | 2021-10-12T16:07:37.000Z | 2022-01-10T00:49:41.000Z | // Copyright 2021 Fredrick Allan Grott. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:shaped_navbars/my_color_schemes.dart';
AppBarTheme appBarTheme = AppBarTheme(
//brightness: Brightness.light, depreciated
color: myPrimaryColor,
backgroundColor: myPrimaryVariantColor,
foregroundColor: myPrimaryVariantColor,
elevation: 0,
//shadowColor:
//textTheme: myBaseTextTheme, depreciated
centerTitle: true, // cross platform wise needed as Apple products have center title
titleSpacing: 0,
toolbarHeight: 56,
toolbarTextStyle: myToolbarTextStyle,
titleTextStyle: myTitleTextStyle,
iconTheme: myIconTheme,
actionsIconTheme: myActionIconTheme,
);
TextStyle myToolbarTextStyle = const TextStyle(
color: myOnPrimaryColor,
);
TextStyle myTitleTextStyle = const TextStyle(
color: myOnPrimaryColor,
);
IconThemeData myIconTheme = const IconThemeData(
color: mySecondaryColor,
opacity: 0,
);
IconThemeData myActionIconTheme = const IconThemeData(
color: mySecondaryVariantColor,
opacity: 20,
);
| 25.434783 | 87 | 0.778632 |
6171b5e33158278a06c08084f6970664eecd2590 | 655 | asm | Assembly | programs/oeis/249/A249037.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/249/A249037.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/249/A249037.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A249037: Number of even terms in first n terms of A249036.
; 0,1,2,2,3,4,4,4,5,5,6,7,7,7,8,9,9,9,10,10,11,11,12,13,13,13,14,15,15,15,16,17,17,17,18,19,19,19,20,20,21,21,22,22,23,23,24,25,25,25,26,27,27,27,28,29,29,29,30,31,31,31,32,33,33,33,34,35,35,35,36,37,37,37,38,39,39,39
mov $5,$0
mov $7,$0
lpb $7,1
clr $0,5
mov $0,$5
sub $7,1
sub $0,$7
cal $0,249036 ; a(1)=1, a(2)=2; thereafter a(n) = a(n-1-(number of even terms so far)) + a(n-1-(number of odd terms so far)).
gcd $0,2
add $0,1
add $2,1
sub $0,$2
mul $0,12
sub $4,$0
mov $1,$4
cal $1,144478 ; Period 9: repeat 1,0,5,7,6,2,4,3,8.
div $1,6
add $6,$1
lpe
mov $1,$6
| 27.291667 | 217 | 0.583206 |
83dd8015bb9ee4e987fdd3c9e3d55437436df22f | 1,134 | java | Java | Programmers/07. DP/School/Solution.java | Minoolian/Coding_Test | 5eb781b880919733b07d6a0313f592a6a9ac117a | [
"MIT"
] | null | null | null | Programmers/07. DP/School/Solution.java | Minoolian/Coding_Test | 5eb781b880919733b07d6a0313f592a6a9ac117a | [
"MIT"
] | null | null | null | Programmers/07. DP/School/Solution.java | Minoolian/Coding_Test | 5eb781b880919733b07d6a0313f592a6a9ac117a | [
"MIT"
] | null | null | null | package School;
import java.util.*;
class Solution {
private int[][] dp;
private int[] dx, dy;
Solution(){
this.dx=new int[]{0,1};
this.dy=new int[]{1,0};
}
public int dfs(int x, int y, int[][] puddles, int m, int n){
if(x==n-1 && y==m-1){
return 1;
}
if(dp[x][y]==-1){
dp[x][y]=0;
for(int i=0; i<2; i++){
int nx=x+dx[i];
int ny=y+dy[i];
if(0<=nx && nx<n && 0<=ny && ny<m){
if(Arrays.stream(puddles).allMatch(s->!Arrays.equals(s, new int[]{ny+1,nx+1}))){
dp[x][y]+=dfs(nx, ny, puddles, m, n);
}
}
}
}
return dp[x][y];
}
public int solution(int m, int n, int[][] puddles) {
dp=new int[n][m];
Arrays.stream(dp).forEach(s->Arrays.fill(s, -1));
return dfs(0,0,puddles,m,n)%1000000007;
}
public static void main(String[] args) {
Solution s=new Solution();
System.out.println(s.solution(4, 3, new int[][]{{2,2}}));
}
} | 24.12766 | 100 | 0.431217 |
47f8e2c90d517c5b1d48f9e2af9f7b594c53a216 | 215 | asm | Assembly | data/pokemon/dex_entries/delibird.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 28 | 2019-11-08T07:19:00.000Z | 2021-12-20T10:17:54.000Z | data/pokemon/dex_entries/delibird.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 13 | 2020-01-11T17:00:40.000Z | 2021-09-14T01:27:38.000Z | data/pokemon/dex_entries/delibird.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 22 | 2020-05-28T17:31:38.000Z | 2022-03-07T20:49:35.000Z | db "DELIVERY@" ; species name
dw 211, 350 ; height, weight
db "It always carries"
next "its food with it,"
next "wherever it goes."
page "If attacked, it"
next "throws its food at"
next "the opponent.@"
| 19.545455 | 30 | 0.665116 |
0a2c58f91c280d5d660a6f90fc70c8304040dc90 | 2,096 | dart | Dart | lib/better_player.dart | danielz-nenda/betterplayer | ec77a05005fbf619cb51cea2d61a320b0cd9407b | [
"Apache-2.0"
] | 1 | 2021-11-24T14:27:05.000Z | 2021-11-24T14:27:05.000Z | lib/better_player.dart | danielz-nenda/betterplayer | ec77a05005fbf619cb51cea2d61a320b0cd9407b | [
"Apache-2.0"
] | null | null | null | lib/better_player.dart | danielz-nenda/betterplayer | ec77a05005fbf619cb51cea2d61a320b0cd9407b | [
"Apache-2.0"
] | null | null | null | library better_player;
export 'src/asms/better_player_asms_audio_track.dart';
export 'src/asms/better_player_asms_data_holder.dart';
export 'src/asms/better_player_asms_subtitle.dart';
export 'src/asms/better_player_asms_subtitle_segment.dart';
export 'src/asms/better_player_asms_track.dart';
export 'src/asms/better_player_asms_utils.dart';
export 'src/configuration/better_player_cache_configuration.dart';
export 'src/configuration/better_player_configuration.dart';
export 'src/configuration/better_player_controls_configuration.dart';
export 'src/configuration/better_player_data_source.dart';
export 'src/configuration/better_player_data_source_type.dart';
export 'src/configuration/better_player_drm_configuration.dart';
export 'src/configuration/better_player_drm_type.dart';
export 'src/configuration/better_player_event.dart';
export 'src/configuration/better_player_event_type.dart';
export 'src/configuration/better_player_notification_configuration.dart';
export 'src/configuration/better_player_theme.dart';
export 'src/configuration/better_player_translations.dart';
export 'src/configuration/better_player_video_format.dart';
export 'src/configuration/better_player_buffering_configuration.dart';
export 'src/controls/better_player_controls_state.dart';
export 'src/controls/better_player_overflow_menu_item.dart';
export 'src/controls/better_player_progress_colors.dart';
export 'src/core/better_player.dart';
export 'src/core/better_player_controller.dart';
export 'src/core/better_player_controller_provider.dart';
export 'src/list/better_player_list_video_player.dart';
export 'src/list/better_player_list_video_player_controller.dart';
export 'src/playlist/better_player_playlist.dart';
export 'src/playlist/better_player_playlist_configuration.dart';
export 'src/playlist/better_player_playlist_controller.dart';
export 'src/subtitles/better_player_subtitles_configuration.dart';
export 'src/subtitles/better_player_subtitles_source.dart';
export 'src/subtitles/better_player_subtitles_source_type.dart';
export 'src/video_player/video_player.dart' show VideoPlayerValue;
| 55.157895 | 73 | 0.86355 |
5847663bdfb7d3f18e49d4660c1c4bcb621fe356 | 2,850 | asm | Assembly | emulator/misc/faster.asm | paulscottrobson/ace-next | 00c573fdcfaeb021ac43de8cf7a0f9b44607d042 | [
"MIT"
] | null | null | null | emulator/misc/faster.asm | paulscottrobson/ace-next | 00c573fdcfaeb021ac43de8cf7a0f9b44607d042 | [
"MIT"
] | null | null | null | emulator/misc/faster.asm | paulscottrobson/ace-next | 00c573fdcfaeb021ac43de8cf7a0f9b44607d042 | [
"MIT"
] | null | null | null | fillback
( ASCII - )
RST 24 223
LD HL,9216 33 0 36
LD B,23 6 23
PUSH BC 197
LD B,32 6 32
LD A,(HL) 126
CP 32 254 32
JR NZ +2 32 2
LD A,E 123
LD (HL),A 119
INC HL 35
DJNZ -10 16 246
POP BC 193
DJNZ -16 16 240
JP (IY) 253 233
fillfore
( ASCII - )
RST 24 223
LD HL,9216 33 0 36
LD B,23 6 23
PUSH BC 197
LD B,32 6 32
LD A,(HL) 126
CP 32 254 32
JR Z +2 40 2
LD A,E 123
LD (HL),A 119
INC HL 35
DJNZ -10 16 246
POP BC 193
DJNZ -16 16 240
JP (IY) 253 233
search
( ASCII SEARCH, ASCII REPLACE - )
RST 24 223
LD C,E 75
RST 24 223
LD HL,9216 33 0 36
LD B,23 6 23
PUSH BC 197
LD B,32 6 32
LD A,(HL) 126
CP E 187
JR NZ +2 32 2
LD A,C 121
LD (HL),A 119
INC HL 35
DJNZ -9 16 247
POP BC 193
DJNZ -15 16 241
JP (IY) 253 233
invert
( - )
LD HL,9216 33 0 36
LD B,23 6 23
PUSH BC 197
LD B,32 6 32
LD A,(HL) 126
ADD A,128 198 128
LD (HL),A 119
INC HL 35
DJNZ -7 16 249
POP BC 193
DJNZ -13 16 243
JP (IY) 253 233
fill
( ASCII - )
RST 24 223
LD A,E 123
LD HL,9216 33 0 36
LD B,23 6 23
PUSH BC 197
LD B,32 6 32
LD (HL),A 119
INC HL 35
DJNZ -4 16 252
POP BC 193
DJNZ -10 16 246
JP (IY) 253 233
border
( ASCII - )
RST 24 223
LD A,E 123
LD HL,9216 33 0 36
LD B,32 6 32
LD (HL),A 119
INC HL 35
DJNZ -4 16 252
LD DE,31 17 31 0
LD B,21 6 21
LD (HL),A 119
ADD HL,DE 25
LD (HL),A 119
INC HL 35
DJNZ -6 16 250
LD B,32 6 32
LD (HL),A 119
INC HL 35
DJNZ -4 16 252
JP (IY) 253 233
scrlup
( - )
LD HL,9248 33 32 36
LD DE,9216 17 0 36
LD B,22 6 22
PUSH BC 197
LD B,32 6 32
LD A,(HL) 119
EX DE,HL 235
LD (HL),A 119
INC HL 35
EX DE,HL 235
DJNZ -8 16 248
POP BC 193
DJNZ -14 16 242
DEC HL 43
LD A,32 62 32
LD B,A 71
LD (HL),A 119
DEC HL 43
DJNZ -4 16 252
JP (IY) 253 233
scrldown
( - )
LD HL,9919 33 191 38
LD DE,9951 17 223 38
LD B,22 6 22
PUSH BC 197
LD B,32 6 32
LD A,(HL) 126
EX DE,HL 235
LD (HL),A 119
INC HL 35
EX DE,HL 235
DJNZ -8 16 248
POP BC 193
DJNZ -14 16 242
INC HL 35
LD A,32 62 32
LD B,A 71
LD (HL),A 119
DEC HL 35
DJNZ -4 16 252
JP (IY) 253 233
scrlright
( - )
LD HL,9950 33 222 38
LD DE,9951 33 223 38
LD B,23 6 23
PUSH BC 197
LD B,31 6 31
LD A,(HL) 126
EX DE,HL 235
LD (HL),A 119
DEC HL 43
EX DE,HL 235
DEC HL 43
DJNZ -8 16 248
EX DE,HL 235
LD A,32 62 32
LD (HL),A 119
DEC HL 43
EX DE,HL 235
DEC HL 43
POP BC 193
DJNZ -21 16 235
JP (IY) 253 233
scrlleft
( - )
LD HL,9217 33 1 36
LD DE,9216 33 0 36
LD B,23 6 23
PUSH BC 197
LD B,31 6 31
LD A,(HL) 126
EX DE,HL 235
LD (HL),A 119
INC HL 35
EX DE,HL 235
INC HL 35
DJNZ -8 16 248
EX DE,HL 235
LD A,32 62 32
LD (HL),A 119
INC HL 35
EX DE,HL 235
INC HL 35
POP BC 193
DJNZ -21 16 235
JP (IY) 253 233
| 14.108911 | 34 | 0.576842 |
66d497a5d7af6c217e9a0e4def438cc36ecf1e33 | 25,463 | cpp | C++ | src/gpio_event.cpp | knro/JetsonGPIO | e87413daa4fbd32a46554669f49033e68039fccc | [
"MIT"
] | null | null | null | src/gpio_event.cpp | knro/JetsonGPIO | e87413daa4fbd32a46554669f49033e68039fccc | [
"MIT"
] | null | null | null | src/gpio_event.cpp | knro/JetsonGPIO | e87413daa4fbd32a46554669f49033e68039fccc | [
"MIT"
] | null | null | null | /*
Copyright (c) 2012-2017 Ben Croston ben@croston.org.
Copyright (c) 2019, NVIDIA CORPORATION.
Copyright (c) 2019 Jueon Park(pjueon) bluegbg@gmail.com.
Copyright (c) 2021 Adam Rasburn blackforestcheesecake@protonmail.ch
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include "private/gpio_event.h"
#include "private/PythonFunctions.h"
#include <fcntl.h>
#include <sys/epoll.h>
#include <time.h>
#include <unistd.h>
#include <atomic>
#include <chrono>
#include <deque>
#include <map>
#include <mutex>
#include <thread>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cerrno>
#include "JetsonGPIO.h"
#define MAX_EPOLL_EVENTS 20
#define READ_SIZE 10
namespace GPIO
{
// Error messages for all errors produced by this module
std::map<EventResultCode, const char*> event_error_code_to_message = {
{EventResultCode::SysFD_EdgeOpen, "Failure to open the /sys/class/gpio/gpio{$ch}/edge file"},
{EventResultCode::UnallowedEdgeNone, "Specifying Edge as 'none' was not allowed"},
{EventResultCode::IllegalEdgeArgument, "Illegal Edge argument"},
{EventResultCode::SysFD_EdgeWrite, "Failure to write to the /sys/class/gpio/gpio{$ch}/edge file"},
{EventResultCode::SysFD_ValueOpen, "Failure to open the channels System value file descriptor"},
{EventResultCode::SysFD_ValueNonBlocking,
"Failure to set to non-blocking the channels System value file descriptor"},
{EventResultCode::ChannelAlreadyBlocked,
"This channel is already being blocked (Probably by a concurrent wait_for_edge call)"},
{EventResultCode::ConflictingEdgeType, "Already opened channel is currently detecting a different edge type"},
{EventResultCode::ConflictingBounceTime, "Already opened channel is currently employing a different bounce time"},
{EventResultCode::InternalTrackingError, "Internal Event Tracking Error"},
{EventResultCode::EpollFD_CreateError, "Failed to create the EPOLL file descriptor"},
{EventResultCode::EpollCTL_Add, "Failure to add an event to the EPOLL file descriptor"},
{EventResultCode::EpollWait, "Error occurred during call to epoll_wait"},
{EventResultCode::GPIO_Event_Not_Found,
"A channel event was not added to add a callback to. Call add_event_detect() first"},
};
struct _gpioEventObject {
enum ModifyEvent { NONE, ADD, INITIAL_ABSCOND, REMOVE, MODIFY } _epoll_change_flag;
struct epoll_event _epoll_event;
int channel_id;
int gpio;
int fd;
Edge edge;
uint64_t bounce_time;
uint64_t last_event;
bool event_occurred;
bool blocking_usage, concurrent_usage;
std::vector<Callback> callbacks;
};
std::recursive_mutex _epmutex;
std::unique_ptr<std::thread> _epoll_fd_thread = nullptr;
std::atomic_bool _epoll_run_loop;
std::map<int, std::shared_ptr<_gpioEventObject>> _gpio_events;
std::atomic_int _auth_event_channel_count(0);
std::map<int, int> _fd_to_gpio_map;
//----------------------------------
int _write_sysfs_edge(int gpio, Edge edge, bool allow_none = true)
{
auto buf = format("%s/gpio%i/edge", _SYSFS_ROOT, gpio);
int edge_fd = open(buf.c_str(), O_WRONLY);
if (edge_fd == -1) {
// I/O Error
std::perror("sysfs/edge open");
return (int)GPIO::EventResultCode::SysFD_EdgeOpen;
}
auto get_result = [=]() -> int
{
switch (edge) {
case Edge::RISING:
return write(edge_fd, "rising", 7);
case Edge::FALLING:
return write(edge_fd, "falling", 7);
case Edge::BOTH:
return write(edge_fd, "both", 7);
case Edge::NONE: {
if (!allow_none) {
return (int)GPIO::EventResultCode::UnallowedEdgeNone;
}
return write(edge_fd, "none", 7);
}
case Edge::UNKNOWN:
default:
std::cerr << format("Bad argument, edge=%i\n", (int)edge);
return (int)GPIO::EventResultCode::IllegalEdgeArgument;
}
};
int result = get_result();
if (result >= 0)
result = 0;
else if (result == -1) {
// Print additional detail and label as a edge write error
std::perror("sysfs/edge write");
result = (int)GPIO::EventResultCode::SysFD_EdgeWrite;
}
close(edge_fd);
return result;
}
int _open_sysfd_value(int gpio, int& fd)
{
auto buf = format("%s/gpio%i/value", _SYSFS_ROOT, gpio);
fd = open(buf.c_str(), O_RDONLY);
if (fd == -1) {
std::perror("sysfs/value open");
return (int)GPIO::EventResultCode::SysFD_ValueOpen;
}
// Set the file descriptor to a non-blocking usage
int result = fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
if (result == -1) {
std::perror("fcntl");
close(fd);
return (int)GPIO::EventResultCode::SysFD_ValueNonBlocking;
}
return 0;
}
std::map<int, std::shared_ptr<_gpioEventObject>>::iterator
_epoll_thread_remove_event(int epoll_fd, std::map<int, std::shared_ptr<_gpioEventObject>>::iterator geo_it)
{
auto geo = geo_it->second;
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, geo->fd, 0) == -1) {
// Okay to ignore I believe. File will be closed just below anyways.
}
auto fg_it = _fd_to_gpio_map.find(geo->fd);
if (fg_it != _fd_to_gpio_map.end())
_fd_to_gpio_map.erase(fg_it);
// Close the fd
if (close(geo->fd) == -1) {
std::cerr << "[WARNING] Failed to close Epoll_Thread file descriptor\n";
}
// Erase from the map collection
return _gpio_events.erase(geo_it);
}
void _epoll_thread_loop()
{
int epoll_fd = epoll_create1(0);
if (epoll_fd == -1) {
std::perror("[Fatal Error] Failed to create epoll file descriptor for concurrent Epoll Thread\n");
return;
}
auto cleanup_and_return = [&epoll_fd]()
{
// Cleanup - thread is ending
// -- GPIO Event Objects
{
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
for (auto geo_it = _gpio_events.begin(); geo_it != _gpio_events.end();) {
geo_it = _epoll_thread_remove_event(epoll_fd, geo_it);
}
}
// epoll
if (close(epoll_fd) == -1) {
std::perror("[WARNING] Failed to close epoll file descriptor during closure of concurrent Epoll_Thread\n");
}
};
epoll_event events[MAX_EPOLL_EVENTS]{};
while (_epoll_run_loop) {
// Wait a small time for events
int event_count = epoll_wait(epoll_fd, events, MAX_EPOLL_EVENTS, 1);
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
// Handle Events
if (event_count) {
if (event_count < 0) {
if (errno != EINTR) {
std::perror("[Fatal Error] epoll_wait");
return cleanup_and_return();
}
break;
}
// Handle event modifications
auto tick = (uint64_t)std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
// Iterate through each collected event
for (int e = 0; e < event_count; e++) {
// Obtain the event object for the event
auto gpio_it = _fd_to_gpio_map.find(events[e].data.fd);
if (gpio_it == _fd_to_gpio_map.end()) {
// Shouldn't happen - ignore it if it does
continue;
}
auto geo_it = _gpio_events.find(gpio_it->second);
if (geo_it == _gpio_events.end()) {
// Shouldn't happen
// If it does -- ensure the fd is deleted & ignore any errors
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, events[e].data.fd, 0);
// Remove the item from the map
_fd_to_gpio_map.erase(gpio_it);
continue;
}
if (geo_it->second->_epoll_change_flag != _gpioEventObject::ModifyEvent::NONE) {
// To be dealt with later. No events should be fired in this case
continue;
}
// Event & GPIO
auto geo = geo_it->second;
// Check event filter conditions
if (geo->bounce_time) {
if (tick - geo->last_event < geo->bounce_time) {
continue;
}
geo->last_event = tick;
}
// Fire event
geo->event_occurred = true;
for (auto& cb : geo->callbacks) {
cb(geo->channel_id);
}
}
}
// Handle changes/modifications to GPIO event objects
for (auto geo_it = _gpio_events.begin(); geo_it != _gpio_events.end();) {
auto geo = geo_it->second;
switch (geo->_epoll_change_flag) {
case _gpioEventObject::ModifyEvent::NONE: {
// No change
} break;
case _gpioEventObject::ModifyEvent::INITIAL_ABSCOND: {
geo->_epoll_change_flag = _gpioEventObject::ModifyEvent::NONE;
} break;
case _gpioEventObject::ModifyEvent::MODIFY: {
// For now this just means modification of the edge type, which is done on the calling thread
// Just set back to NONE and continue
geo->_epoll_change_flag = _gpioEventObject::ModifyEvent::NONE;
} break;
case _gpioEventObject::ModifyEvent::ADD: {
geo->_epoll_event.events = EPOLLIN | EPOLLPRI | EPOLLET;
geo->_epoll_event.data.fd = geo->fd;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, geo->fd, &geo->_epoll_event) == -1) {
// Error - Leave loop immediately
std::perror("epoll_ctl()");
return cleanup_and_return();
}
// Avoid the initial event (that would have occurred before this unit has been added)
geo->_epoll_change_flag = _gpioEventObject::ModifyEvent::INITIAL_ABSCOND;
} break;
case _gpioEventObject::ModifyEvent::REMOVE: {
if (geo->blocking_usage) {
// Do not remove it during a concurrent blocking usage
break;
}
geo_it = _epoll_thread_remove_event(epoll_fd, geo_it);
// Skip past the iteration so as to not iterate past the returned element
// -- (which is the next element)
continue;
}
}
// Iterate to next element
geo_it++;
}
}
return cleanup_and_return();
}
void _epoll_start_thread()
{
_epoll_run_loop = true;
_epoll_fd_thread = std::make_unique<std::thread>(_epoll_thread_loop);
}
void _epoll_end_thread()
{
_epoll_run_loop = false;
// Wait to join
_epoll_fd_thread->join();
{
// Enter Mutex and clear thread
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
_epoll_fd_thread = nullptr;
}
}
//-------------- Operations -------------------- //
int _blocking_wait_for_edge(int gpio, int channel_id, Edge edge, uint64_t bounce_time, uint64_t timeout)
{
timespec timeout_time{};
if (timeout) {
clock_gettime(CLOCK_REALTIME, &timeout_time);
timeout_time.tv_nsec += (timeout % 1000) * 1e6;
long overlap = timeout_time.tv_nsec / 1e9;
timeout_time.tv_nsec -= overlap;
timeout_time.tv_sec += timeout / 1000 + overlap;
}
int result{};
std::shared_ptr<_gpioEventObject> geo{};
uint64_t gpio_last_event = 0;
{
// Enter Mutex
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
// Ensure a conflict does not exist with the concurrent event detecting thread and its collection of gpio events
auto find_result = _gpio_events.find(gpio);
if (find_result != _gpio_events.end()) {
geo = find_result->second;
if (geo->blocking_usage) {
// Channel already being blocked (can only be by another thread call)
return (int)GPIO::EventResultCode::ChannelAlreadyBlocked;
}
switch (geo->_epoll_change_flag) {
case _gpioEventObject::ModifyEvent::NONE:
case _gpioEventObject::ModifyEvent::ADD:
case _gpioEventObject::ModifyEvent::MODIFY: {
if (geo->edge != edge) {
return (int)GPIO::EventResultCode::ConflictingEdgeType;
}
if (bounce_time && geo->bounce_time != bounce_time) {
return (int)GPIO::EventResultCode::ConflictingBounceTime;
}
} break;
case _gpioEventObject::ModifyEvent::REMOVE: {
// The epoll thread is inbetween concurrent transactions. Modify the existing
// object instead of removing it
if (geo->edge != edge) {
// Update
geo->_epoll_change_flag = _gpioEventObject::ModifyEvent::MODIFY;
geo->edge = edge;
// Set Event
result = _write_sysfs_edge(gpio, edge);
if (result) {
return result;
}
}
// Reset GPIO
geo->event_occurred = false;
geo->bounce_time = bounce_time;
geo->last_event = 0;
++_auth_event_channel_count;
} break;
default:
// Shouldn't happen
return (int)GPIO::EventResultCode::InternalTrackingError;
}
} else {
// Create a gpio-event-object to avoid concurrent conflicts for the channel while blocking
geo = std::make_shared<_gpioEventObject>();
geo->_epoll_change_flag = _gpioEventObject::ModifyEvent::ADD;
geo->gpio = gpio;
geo->channel_id = channel_id;
geo->edge = edge;
geo->bounce_time = bounce_time;
geo->last_event = 0;
// Open the value fd
result = _open_sysfd_value(gpio, geo->fd);
if (result) {
return result;
}
// Set Event
result = _write_sysfs_edge(gpio, edge);
if (result) {
close(geo->fd);
return result;
}
// Set
_fd_to_gpio_map[geo->fd] = gpio;
_gpio_events[gpio] = geo;
++_auth_event_channel_count;
}
geo->blocking_usage = true;
}
// Execute the epoll awaiting the event
int epoll_fd = 0, error = 0;
auto cleanup_and_return_result = [&]() -> int
{
if (epoll_fd >= 0)
close(epoll_fd);
// GPIO Event Object Tidy-up
{
// Enter Mutex
std::unique_lock<std::recursive_mutex> mutex_lock(_epmutex);
geo->blocking_usage = false;
if (!geo->concurrent_usage) {
// Remove it
if (geo->_epoll_change_flag == _gpioEventObject::ModifyEvent::ADD) {
// It hasn't been added to the concurrent epoll-thread yet (if there even is one)
auto ftg_it = _fd_to_gpio_map.find(geo->fd);
if (ftg_it != _fd_to_gpio_map.end())
_fd_to_gpio_map.erase(ftg_it);
// Close the fd
if (close(geo->fd) == -1) {
std::cerr << "[WARNING] Failed to close Epoll_Thread file descriptor\n";
}
auto geo_it = _gpio_events.find(gpio);
if (geo_it != _gpio_events.end())
_gpio_events.erase(geo_it);
--_auth_event_channel_count;
if (_auth_event_channel_count == 0 && _epoll_fd_thread) {
// Signal shutdown of thread
// -- Doesn't need to run if there are no events
mutex_lock.unlock();
_epoll_end_thread();
}
} else {
// Set for removal from the concurrent epoll-thread
_remove_edge_detect(gpio);
}
}
}
if (error)
return error;
return result;
};
result = (int)EventResultCode::None; // 0
{
epoll_fd = epoll_create1(0);
if (epoll_fd == -1) {
error = (int)GPIO::EventResultCode::EpollFD_CreateError;
std::perror("epoll_create1(0)");
return cleanup_and_return_result();
}
geo->_epoll_event.events = EPOLLIN | EPOLLPRI | EPOLLET;
geo->_epoll_event.data.fd = geo->fd;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, geo->fd, &geo->_epoll_event) == -1) {
close(epoll_fd);
std::perror("epoll_ctl():");
error = (int)GPIO::EventResultCode::EpollCTL_Add;
return cleanup_and_return_result();
}
epoll_event events[1]{};
bool initial_edge = true;
// Remove Initial Event
timespec current_time{};
while (true) {
if (timeout) {
clock_gettime(CLOCK_REALTIME, ¤t_time);
if (current_time.tv_sec > timeout_time.tv_sec ||
(current_time.tv_sec == timeout_time.tv_sec && current_time.tv_nsec >= timeout_time.tv_nsec)) {
// Time-out
break;
}
}
// Wait a small time for events
int event_count = epoll_wait(epoll_fd, events, 1, 1);
// First trigger is with current state so ignore
if (initial_edge) {
initial_edge = false;
continue;
}
// Handle Events
if (event_count) {
if (event_count == -1) {
if (errno != EINTR) {
std::perror("epoll_wait");
error = (int)EventResultCode::EpollWait;
}
return cleanup_and_return_result();
}
if (events[0].data.fd == geo->fd) {
auto tick = (uint64_t)std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
if (!geo->bounce_time || tick - geo->last_event > geo->bounce_time) {
result = (int)EventResultCode::EdgeDetected;
break;
}
}
}
}
}
return cleanup_and_return_result();
}
bool _edge_event_detected(int gpio)
{
bool result = false;
// Enter Mutex
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
std::shared_ptr<_gpioEventObject> geo;
auto find_result = _gpio_events.find(gpio);
if (find_result != _gpio_events.end()) {
geo = find_result->second;
result = geo->event_occurred;
geo->event_occurred = false;
}
return result;
}
bool _edge_event_exists(int gpio)
{
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
auto find_result = _gpio_events.find(gpio);
if (find_result == _gpio_events.end()) {
return find_result->second->_epoll_change_flag != _gpioEventObject::ModifyEvent::REMOVE;
}
return false;
}
int _add_edge_detect(int gpio, int channel_id, Edge edge, uint64_t bounce_time)
{
int result{};
// Enter Mutex
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
// auto geo;
std::shared_ptr<_gpioEventObject> geo;
auto find_result = _gpio_events.find(gpio);
if (find_result != _gpio_events.end()) {
geo = find_result->second;
switch (geo->_epoll_change_flag) {
case _gpioEventObject::ModifyEvent::NONE:
case _gpioEventObject::ModifyEvent::ADD:
case _gpioEventObject::ModifyEvent::MODIFY: {
if (geo->edge != edge) {
return (int)GPIO::EventResultCode::ConflictingEdgeType;
}
if (bounce_time && geo->bounce_time != bounce_time) {
return (int)GPIO::EventResultCode::ConflictingBounceTime;
}
// Otherwise, do nothing more
} break;
case _gpioEventObject::ModifyEvent::REMOVE: {
// The epoll thread is inbetween concurrent transactions. Modify the existing
// object instead of removing it
if (geo->edge != edge) {
// Update
geo->_epoll_change_flag = _gpioEventObject::ModifyEvent::MODIFY;
geo->edge = edge;
// Set Event
result = _write_sysfs_edge(gpio, edge);
if (result) {
return result;
}
}
geo->bounce_time = bounce_time;
geo->last_event = 0;
++_auth_event_channel_count;
} break;
default:
// Shouldn't happen
return (int)GPIO::EventResultCode::InternalTrackingError;
}
} else {
// Configure anew
geo = std::make_shared<_gpioEventObject>();
geo->_epoll_change_flag = _gpioEventObject::ModifyEvent::ADD;
geo->gpio = gpio;
geo->channel_id = channel_id;
geo->edge = edge;
geo->last_event = 0;
geo->blocking_usage = false;
geo->event_occurred = false;
// Open the value fd
result = _open_sysfd_value(gpio, geo->fd);
if (result) {
return result;
}
_fd_to_gpio_map[geo->fd] = gpio;
// Set Event
result = _write_sysfs_edge(gpio, edge);
if (result) {
close(geo->fd);
return result;
}
// Set
_gpio_events[gpio] = geo;
++_auth_event_channel_count;
}
geo->bounce_time = bounce_time;
geo->concurrent_usage = true;
if (!_epoll_fd_thread) {
_epoll_start_thread();
}
return 0;
}
void _remove_edge_detect(int gpio)
{
// Enter Mutex
std::unique_lock<std::recursive_mutex> mutex_lock(_epmutex);
auto find_result = _gpio_events.find(gpio);
if (find_result != _gpio_events.end()) {
auto geo = find_result->second;
geo->_epoll_change_flag = _gpioEventObject::ModifyEvent::REMOVE;
--_auth_event_channel_count;
geo->concurrent_usage = false;
if (geo->blocking_usage) {
// Channel is currently in a blocking usage on a concurrent thread
// -- At least remove all callbacks right now
geo->callbacks.clear();
return;
}
if (_auth_event_channel_count == 0 && _epoll_fd_thread) {
// Signal shutdown of thread
// -- Doesn't need to run if there are no events
mutex_lock.unlock();
_epoll_end_thread();
}
}
}
int _add_edge_callback(int gpio, const Callback& callback)
{
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
auto find_result = _gpio_events.find(gpio);
if (find_result == _gpio_events.end()) {
return (int)GPIO::EventResultCode::GPIO_Event_Not_Found;
}
auto geo = find_result->second;
geo->callbacks.push_back(callback);
return 0;
}
void _remove_edge_callback(int gpio, const Callback& callback)
{
std::lock_guard<std::recursive_mutex> mutex_lock(_epmutex);
auto find_result = _gpio_events.find(gpio);
if (find_result == _gpio_events.end()) {
// Couldn't find it, Doesn't matter.
return;
}
auto geo = find_result->second;
for (auto geo_it = geo->callbacks.begin(); geo_it != geo->callbacks.end();) {
if (*geo_it == callback) {
geo->callbacks.erase(geo_it);
} else {
geo_it++;
}
}
}
void _event_cleanup(int gpio) { _remove_edge_detect(gpio); }
} // namespace GPIO | 33.503947 | 120 | 0.573185 |
3e901b4d9f3fc4d7d31ac4b48124a2985565f170 | 224 | c | C | platforms/win32/vm/sqWin32GUID.c | pavel-krivanek/opensmalltalk-vm | 694dfe3ed015e16f5b8e9cf17d37e4bdd32bea16 | [
"MIT"
] | 110 | 2015-01-10T17:54:56.000Z | 2021-08-08T05:06:55.000Z | platforms/win32/vm/sqWin32GUID.c | pavel-krivanek/opensmalltalk-vm | 694dfe3ed015e16f5b8e9cf17d37e4bdd32bea16 | [
"MIT"
] | 36 | 2015-05-08T07:45:52.000Z | 2019-04-30T13:41:12.000Z | platforms/win32/vm/sqWin32GUID.c | pavel-krivanek/opensmalltalk-vm | 694dfe3ed015e16f5b8e9cf17d37e4bdd32bea16 | [
"MIT"
] | 45 | 2015-02-26T13:55:13.000Z | 2020-11-25T09:17:43.000Z | #define INITGUID
#include <windows.h>
#ifdef __MINGW32__
#define HMONITOR_DECLARED
#undef WINNT
#endif
#include <ddraw.h>
#include <dsound.h>
#include <dsconf.h>
#include <d3d.h>
#include <dinput.h>
#include <unknwn.h>
| 12.444444 | 25 | 0.727679 |
e91668d95cb252067c36c918235f22e4ffdb00f8 | 2,548 | cpp | C++ | src/generic/model/board.cpp | jgadrow/connect | 65aef8590281e94fdd78b94adaba3192868c54d0 | [
"Unlicense"
] | null | null | null | src/generic/model/board.cpp | jgadrow/connect | 65aef8590281e94fdd78b94adaba3192868c54d0 | [
"Unlicense"
] | null | null | null | src/generic/model/board.cpp | jgadrow/connect | 65aef8590281e94fdd78b94adaba3192868c54d0 | [
"Unlicense"
] | null | null | null | #include "../../../include/generic/model/board.h"
Board::Board ()
{
firstPlayer = true;
gameOver = false;
for (int i = 0; i < Board::height; ++i)
{
for (int j = 0; j < Board::width; ++j)
{
spaces[i][j] = ' ';
}
}
}
void Board::CheckBoardFull ()
{
for (int i = 0; i < Board::height; ++i)
{
for (int j = 0; j < Board::width; ++j)
{
if (' ' == spaces[i][j])
{
return;
}
}
}
gameOver = true;
}
void Board::CheckGameWon (int row, int col)
{
int deltas [4][2] = {
{0,1},
{1,0},
{1,1},
{-1,1}
};
for (int i = 0; i < 4; ++i)
{
int rowDelta = deltas[i][0];
int colDelta = deltas[i][1];
{
int j = 1;
int curRow = row;
int curCol = col;
bool isInverted = false;
for ( ; j < Board::winLength; ++j)
{
curRow += isInverted ? -rowDelta : rowDelta;
curCol += isInverted ? -colDelta : colDelta;
bool matched = curRow >= 0
&& curRow < Board::height
&& curCol >= 0
&& curCol < Board::width
&& spaces[curRow][curCol] == spaces[row][col];
// If this is the last match, the game is over.
if (matched && Board::winLength == j+1)
{
gameOver = true;
return;
}
else if (matched)
{
continue;
}
curRow = row;
curCol = col;
--j;
// Is row non-zero and not inverted? Invert it.
if (!isInverted)
{
isInverted = true;
continue;
}
else
{
break;
}
}
}
}
}
void Board::Claim(int column)
{
int row = 0;
for (int i = Board::height-1; i > 0; --i)
{
if (' ' == spaces[i][column])
{
row = i;
break;
}
}
spaces[row][column] = firstPlayer? 'x' : 'o';
firstPlayer = !firstPlayer;
CheckGameWon (row, column);
if (!gameOver) {
CheckBoardFull ();
}
Notify("ALL");
}
char Board::GetToken (int row, int col) const
{
return spaces[row][col];
}
| 21.057851 | 66 | 0.375196 |
ab7b0444c9ffa83c14ae1b1724970e66d00ab773 | 594 | dart | Dart | html/lib/src/style_sheet.dart | eukreign/rampage | 64ced1385476aa77235b4ef861a2cbf8c4aca731 | [
"Zlib"
] | null | null | null | html/lib/src/style_sheet.dart | eukreign/rampage | 64ced1385476aa77235b4ef861a2cbf8c4aca731 | [
"Zlib"
] | null | null | null | html/lib/src/style_sheet.dart | eukreign/rampage | 64ced1385476aa77235b4ef861a2cbf8c4aca731 | [
"Zlib"
] | null | null | null | // Copyright (c) 2019 the Rampage Project Authors.
// Please see the AUTHORS file for details. All rights reserved.
// Use of this source code is governed by a zlib license that can be found in
// the LICENSE file.
/// An object implementing the [StyleSheet] interface represents a single style
/// sheet.
///
/// CSS style sheets will further implement the more specialized [CssStyleSheet]
/// interface.
abstract class StyleSheet {
/// Whether the current stylesheet has been applied or not.
bool get disabled;
/// The advisory title of the current style sheet.
String get title;
}
| 33 | 80 | 0.740741 |
4a1e3479e607235382ff9d71404ee707cc1b69b6 | 499 | asm | Assembly | SoundEngine/UnitTests/test_nesasm.asm | bbbradsmith/FamiStudio | 7222b96401d7308271f5f9b926c6a044b69391ac | [
"MIT"
] | 989 | 2019-08-04T04:07:13.000Z | 2022-03-30T04:59:58.000Z | SoundEngine/UnitTests/test_nesasm.asm | bbbradsmith/FamiStudio | 7222b96401d7308271f5f9b926c6a044b69391ac | [
"MIT"
] | 113 | 2019-08-05T17:52:06.000Z | 2022-03-20T14:10:43.000Z | SoundEngine/UnitTests/test_nesasm.asm | bbbradsmith/FamiStudio | 7222b96401d7308271f5f9b926c6a044b69391ac | [
"MIT"
] | 63 | 2019-08-05T01:03:08.000Z | 2022-02-25T09:12:51.000Z | ; HEADER
.inesprg 2 ; 1x 16KB PRG code
.ineschr 1 ; 1x 8KB CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring
; CODE
.bank 0
.org $8000
FAMISTUDIO_CFG_EXTERNAL = 1
FAMISTUDIO_NESASM_ZP_RSSET = $0000
FAMISTUDIO_NESASM_BSS_RSSET = $0300
FAMISTUDIO_NESASM_CODE_BANK = 0
FAMISTUDIO_NESASM_CODE_ORG = $8000
.include "test_defs.inc"
.include "..\famistudio_nesasm.asm"
.bank 4
.org $0000
.rs 8192
| 21.695652 | 50 | 0.661323 |
0f5e6be1b88b3d4fa4840593271590a37fc54ff3 | 11,349 | cc | C++ | src/c++/examples/simple_http_cudashm_client.cc | BobLiu20/client | fb291d78595fe69624f9c220eb6654f98ab4202f | [
"BSD-3-Clause"
] | 107 | 2021-04-20T03:14:18.000Z | 2022-03-29T02:53:26.000Z | src/c++/examples/simple_http_cudashm_client.cc | BobLiu20/client | fb291d78595fe69624f9c220eb6654f98ab4202f | [
"BSD-3-Clause"
] | 28 | 2021-05-05T12:05:57.000Z | 2022-03-30T21:10:11.000Z | src/c++/examples/simple_http_cudashm_client.cc | BobLiu20/client | fb291d78595fe69624f9c220eb6654f98ab4202f | [
"BSD-3-Clause"
] | 90 | 2021-04-20T14:12:34.000Z | 2022-03-30T02:40:14.000Z | // Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <unistd.h>
#include <iostream>
#include <string>
#include "http_client.h"
#include "shm_utils.h"
#include <cuda_runtime_api.h>
namespace tc = triton::client;
#define FAIL_IF_ERR(X, MSG) \
{ \
tc::Error err = (X); \
if (!err.IsOk()) { \
std::cerr << "error: " << (MSG) << ": " << err << std::endl; \
exit(1); \
} \
}
namespace {
void
ValidateShapeAndDatatype(
const std::string& name, std::shared_ptr<tc::InferResult> result)
{
std::vector<int64_t> shape;
FAIL_IF_ERR(
result->Shape(name, &shape), "unable to get shape for '" + name + "'");
// Validate shape
if ((shape.size() != 2) || (shape[0] != 1) || (shape[1] != 16)) {
std::cerr << "error: received incorrect shapes for '" << name << "'"
<< std::endl;
exit(1);
}
std::string datatype;
FAIL_IF_ERR(
result->Datatype(name, &datatype),
"unable to get datatype for '" + name + "'");
// Validate datatype
if (datatype.compare("INT32") != 0) {
std::cerr << "error: received incorrect datatype for '" << name
<< "': " << datatype << std::endl;
exit(1);
}
}
void
Usage(char** argv, const std::string& msg = std::string())
{
if (!msg.empty()) {
std::cerr << "error: " << msg << std::endl;
}
std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
std::cerr << "\t-v" << std::endl;
std::cerr << "\t-u <URL for inference service>" << std::endl;
std::cerr << "\t-H <HTTP header>" << std::endl;
std::cerr << std::endl;
std::cerr
<< "For -H, header must be 'Header:Value'. May be given multiple times."
<< std::endl;
exit(1);
}
} // namespace
#define FAIL_IF_CUDA_ERR(FUNC) \
{ \
const cudaError_t result = FUNC; \
if (result != cudaSuccess) { \
std::cerr << "CUDA exception (line " << __LINE__ \
<< "): " << cudaGetErrorName(result) << " (" \
<< cudaGetErrorString(result) << ")" << std::endl; \
exit(1); \
} \
}
void
CreateCUDAIPCHandle(
cudaIpcMemHandle_t* cuda_handle, void* input_d_ptr, int device_id = 0)
{
// Set the GPU device to the desired GPU
FAIL_IF_CUDA_ERR(cudaSetDevice(device_id));
// Create IPC handle for data on the gpu
FAIL_IF_CUDA_ERR(cudaIpcGetMemHandle(cuda_handle, input_d_ptr));
}
int
main(int argc, char** argv)
{
bool verbose = false;
std::string url("localhost:8000");
tc::Headers http_headers;
// Parse commandline...
int opt;
while ((opt = getopt(argc, argv, "vu:H:")) != -1) {
switch (opt) {
case 'v':
verbose = true;
break;
case 'u':
url = optarg;
break;
case 'H': {
std::string arg = optarg;
std::string header = arg.substr(0, arg.find(":"));
http_headers[header] = arg.substr(header.size() + 1);
break;
}
case '?':
Usage(argv);
break;
}
}
// We use a simple model that takes 2 input tensors of 16 integers
// each and returns 2 output tensors of 16 integers each. One output
// tensor is the element-wise sum of the inputs and one output is
// the element-wise difference.
std::string model_name = "simple";
std::string model_version = "";
// Create a InferenceServerHttpClient instance to communicate with the
// server using http protocol.
std::unique_ptr<tc::InferenceServerHttpClient> client;
FAIL_IF_ERR(
tc::InferenceServerHttpClient::Create(&client, url, verbose),
"unable to create http client");
// Unregistering all shared memory regions for a clean
// start.
FAIL_IF_ERR(
client->UnregisterSystemSharedMemory(),
"unable to unregister all system shared memory regions");
FAIL_IF_ERR(
client->UnregisterCudaSharedMemory(),
"unable to unregister all cuda shared memory regions");
std::vector<int64_t> shape{1, 16};
size_t input_byte_size = 64;
size_t output_byte_size = 64;
// Initialize the inputs with the data.
tc::InferInput* input0;
tc::InferInput* input1;
FAIL_IF_ERR(
tc::InferInput::Create(&input0, "INPUT0", shape, "INT32"),
"unable to get INPUT0");
std::shared_ptr<tc::InferInput> input0_ptr;
input0_ptr.reset(input0);
FAIL_IF_ERR(
tc::InferInput::Create(&input1, "INPUT1", shape, "INT32"),
"unable to get INPUT1");
std::shared_ptr<tc::InferInput> input1_ptr;
input1_ptr.reset(input1);
// Create Input0 and Input1 in CUDA Shared Memory. Initialize Input0 to
// unique integers and Input1 to all ones.
int input_data[32];
for (size_t i = 0; i < 16; ++i) {
input_data[i] = i;
input_data[16 + i] = 1;
}
// copy INPUT0 and INPUT1 data in GPU shared memory
int* input_d_ptr;
cudaMalloc((void**)&input_d_ptr, input_byte_size * 2);
cudaMemcpy(
(void*)input_d_ptr, (void*)input_data, input_byte_size * 2,
cudaMemcpyHostToDevice);
cudaIpcMemHandle_t input_cuda_handle;
CreateCUDAIPCHandle(&input_cuda_handle, (void*)input_d_ptr);
FAIL_IF_ERR(
client->RegisterCudaSharedMemory(
"input_data", input_cuda_handle, 0 /* device_id */,
input_byte_size * 2),
"failed to register input shared memory region");
FAIL_IF_ERR(
input0_ptr->SetSharedMemory(
"input_data", input_byte_size, 0 /* offset */),
"unable to set shared memory for INPUT0");
FAIL_IF_ERR(
input1_ptr->SetSharedMemory(
"input_data", input_byte_size, input_byte_size /* offset */),
"unable to set shared memory for INPUT1");
// Generate the outputs to be requested.
tc::InferRequestedOutput* output0;
tc::InferRequestedOutput* output1;
FAIL_IF_ERR(
tc::InferRequestedOutput::Create(&output0, "OUTPUT0"),
"unable to get 'OUTPUT0'");
std::shared_ptr<tc::InferRequestedOutput> output0_ptr;
output0_ptr.reset(output0);
FAIL_IF_ERR(
tc::InferRequestedOutput::Create(&output1, "OUTPUT1"),
"unable to get 'OUTPUT1'");
std::shared_ptr<tc::InferRequestedOutput> output1_ptr;
output1_ptr.reset(output1);
// Create Output0 and Output1 in CUDA Shared Memory
int *output0_d_ptr, *output1_d_ptr;
cudaMalloc((void**)&output0_d_ptr, output_byte_size * 2);
output1_d_ptr = (int*)output0_d_ptr + 16;
cudaIpcMemHandle_t output_cuda_handle;
CreateCUDAIPCHandle(&output_cuda_handle, (void*)output0_d_ptr);
FAIL_IF_ERR(
client->RegisterCudaSharedMemory(
"output_data", output_cuda_handle, 0 /* device_id */,
output_byte_size * 2),
"failed to register output shared memory region");
FAIL_IF_ERR(
output0_ptr->SetSharedMemory(
"output_data", output_byte_size, 0 /* offset */),
"unable to set shared memory for 'OUTPUT0'");
FAIL_IF_ERR(
output1_ptr->SetSharedMemory(
"output_data", output_byte_size, output_byte_size /* offset */),
"unable to set shared memory for 'OUTPUT1'");
// The inference settings. Will be using default for now.
tc::InferOptions options(model_name);
options.model_version_ = model_version;
std::vector<tc::InferInput*> inputs = {input0_ptr.get(), input1_ptr.get()};
std::vector<const tc::InferRequestedOutput*> outputs = {output0_ptr.get(),
output1_ptr.get()};
tc::InferResult* results;
FAIL_IF_ERR(
client->Infer(&results, options, inputs, outputs, http_headers),
"unable to run model");
std::shared_ptr<tc::InferResult> results_ptr;
results_ptr.reset(results);
// Validate the results...
ValidateShapeAndDatatype("OUTPUT0", results_ptr);
ValidateShapeAndDatatype("OUTPUT1", results_ptr);
// Copy input and output data back to the CPU
int output0_data[16], output1_data[16];
cudaMemcpy(
output0_data, output0_d_ptr, output_byte_size, cudaMemcpyDeviceToHost);
cudaMemcpy(
output1_data, output1_d_ptr, output_byte_size, cudaMemcpyDeviceToHost);
for (size_t i = 0; i < 16; ++i) {
std::cout << input_data[i] << " + " << input_data[16 + i] << " = "
<< output0_data[i] << std::endl;
std::cout << input_data[i] << " + " << input_data[16 + i] << " = "
<< output1_data[i] << std::endl;
if ((input_data[i] + input_data[16 + i]) != output0_data[i]) {
std::cerr << "error: incorrect sum" << std::endl;
exit(1);
}
if ((input_data[i] - input_data[16 + i]) != output1_data[i]) {
std::cerr << "error: incorrect difference" << std::endl;
exit(1);
}
}
// Get shared memory regions active/registered within triton
std::string shm_status;
FAIL_IF_ERR(
client->CudaSharedMemoryStatus(&shm_status),
"failed to get shared memory status");
std::cout << "Shared Memory Status:\n" << shm_status << "\n";
// Unregister shared memory
FAIL_IF_ERR(
client->UnregisterCudaSharedMemory("input_data"),
"unable to unregister shared memory input region");
FAIL_IF_ERR(
client->UnregisterCudaSharedMemory("output_data"),
"unable to unregister shared memory output region");
// Free GPU memory
FAIL_IF_CUDA_ERR(cudaFree(input_d_ptr));
FAIL_IF_CUDA_ERR(cudaFree(output0_d_ptr));
std::cout << "PASS : Cuda Shared Memory " << std::endl;
return 0;
}
| 35.027778 | 78 | 0.62305 |
520bb3cb94c545702a37dd92a0aad876991e9708 | 36,695 | swift | Swift | stdlib/public/core/StringGuts.swift | a2/swift | 661c30f93e08a39dcf8f787fe8f1ab0a087960ce | [
"Apache-2.0"
] | 3 | 2018-07-27T01:54:17.000Z | 2020-10-21T16:09:43.000Z | stdlib/public/core/StringGuts.swift | a2/swift | 661c30f93e08a39dcf8f787fe8f1ab0a087960ce | [
"Apache-2.0"
] | 2 | 2016-05-19T16:42:43.000Z | 2016-06-23T03:45:22.000Z | stdlib/public/core/StringGuts.swift | a2/swift | 661c30f93e08a39dcf8f787fe8f1ab0a087960ce | [
"Apache-2.0"
] | null | null | null | //===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import SwiftShims
//
// Largely inspired by string-recore at
// https://github.com/apple/swift/pull/10747.
//
//
// StringGuts is always 16 bytes on both 32bit and 64bit platforms. This
// effectively makes the worse-case (from a spare bit perspective) ABIs be the
// 64bit ones, as all 32bit pointers effectively have a 32-bit address space
// while the 64bit ones have a 56-bit address space.
//
// Of the 64bit ABIs, x86_64 has the fewest spare bits, so that's the ABI we
// design for.
//
// FIXME: what about ppc64 and s390x?
//
@_fixed_layout
public // FIXME
struct _StringGuts {
public // FIXME for testing only
var _object: _StringObject
public // FIXME for testing only
var _otherBits: UInt // (Mostly) count or inline storage
@inlinable
@inline(__always)
public
init(object: _StringObject, otherBits: UInt) {
self._object = object
self._otherBits = otherBits
_invariantCheck()
}
public typealias _RawBitPattern = (_StringObject._RawBitPattern, UInt)
@inlinable
internal var rawBits: _RawBitPattern {
@inline(__always)
get {
return (_object.rawBits, _otherBits)
}
}
init(rawBits: _RawBitPattern) {
self.init(
object: _StringObject(noReallyHereAreTheRawBits: rawBits.0),
otherBits: rawBits.1)
}
}
extension _StringGuts {
@inlinable // FIXME(sil-serialize-all)
internal func _invariantCheck() {
#if INTERNAL_CHECKS_ENABLED
_object._invariantCheck()
if _object.isNative {
_sanityCheck(UInt(_object.nativeRawStorage.count) == self._otherBits)
} else if _object.isUnmanaged {
} else if _object.isCocoa {
if _object.isContiguous {
_sanityCheck(_isValidAddress(_otherBits))
} else {
_sanityCheck(_otherBits == 0)
}
} else if _object.isSmall {
_smallUTF8String._invariantCheck()
} else {
fatalError("Unimplemented string form")
}
#if arch(i386) || arch(arm)
_sanityCheck(MemoryLayout<String>.size == 12, """
the runtime is depending on this, update Reflection.mm and \
this if you change it
""")
#else
_sanityCheck(MemoryLayout<String>.size == 16, """
the runtime is depending on this, update Reflection.mm and \
this if you change it
""")
#endif
#endif // INTERNAL_CHECKS_ENABLED
}
@inlinable
@inline(__always)
internal mutating func _isUniqueNative() -> Bool {
guard _isNative else { return false }
// Note that the isUnique test must be in a separate statement;
// `isNative && _isUnique` always evaluates to false in debug builds,
// because SILGen keeps the self reference in `isNative` alive for the
// duration of the expression.
// Note that we have to perform this operation here, and not as a (even
// mutating) method on our _StringObject to avoid all chances of a semantic
// copy.
//
// FIXME: Super hacky. Is there a better way?
defer { _fixLifetime(self) }
var bitPattern = _object.referenceBits
return _isUnique_native(&bitPattern)
}
}
extension _StringGuts {
@inlinable
internal var isASCII: Bool {
@inline(__always) get { return _object.isContiguousASCII }
}
@inlinable
internal
var _isASCIIOrSmallASCII: Bool {
@inline(__always) get {
return isASCII || _isSmall && _smallUTF8String.isASCII
}
}
@inlinable
internal var _isNative: Bool {
return _object.isNative
}
@inlinable
internal var _isCocoa: Bool {
return _object.isCocoa
}
@inlinable
internal var _isUnmanaged: Bool {
return _object.isUnmanaged
}
@inlinable
internal var _isSmall: Bool {
return _object.isSmall
}
@inlinable
internal var _owner: AnyObject? {
return _object.owner
}
@inlinable
internal var isSingleByte: Bool {
// FIXME: Currently used to sometimes mean contiguous ASCII
return _object.isSingleByte
}
@inlinable
internal
var _isEmptySingleton: Bool {
return _object.isEmptySingleton
}
@inlinable
internal var byteWidth: Int {
return _object.byteWidth
}
@inlinable
internal
var _nativeCount: Int {
@inline(__always) get {
_sanityCheck(_object.isNative)
return Int(bitPattern: _otherBits)
}
@inline(__always) set {
_sanityCheck(_object.isNative)
_sanityCheck(newValue >= 0)
_otherBits = UInt(bitPattern: newValue)
}
}
// TODO(SSO): consider a small-checking variant
@inlinable
@inline(__always)
internal
init<CodeUnit>(_large storage: _SwiftStringStorage<CodeUnit>)
where CodeUnit : FixedWidthInteger & UnsignedInteger {
_sanityCheck(storage.count >= 0)
self.init(
object: _StringObject(storage),
otherBits: UInt(bitPattern: storage.count))
}
}
extension _StringGuts {
@inlinable
@inline(__always)
internal init() {
self.init(object: _StringObject(), otherBits: 0)
_invariantCheck()
}
}
#if _runtime(_ObjC)
extension _StringGuts {
//
// FIXME(TODO: JIRA): HACK HACK HACK: Work around for ARC :-(
//
@usableFromInline
@_effects(readonly)
internal static func getCocoaLength(_unsafeBitPattern: UInt) -> Int {
return _stdlib_binary_CFStringGetLength(
Builtin.reinterpretCast(_unsafeBitPattern))
}
@inlinable
var _cocoaCount: Int {
@inline(__always)
get {
_sanityCheck(_object.isCocoa)
defer { _fixLifetime(self) }
return _StringGuts.getCocoaLength(
_unsafeBitPattern: _object.referenceBits)
// _stdlib_binary_CFStringGetLength(_object.asCocoaObject)
}
}
@inlinable
var _cocoaRawStart: UnsafeRawPointer {
@inline(__always)
get {
_sanityCheck(_object.isContiguousCocoa)
_sanityCheck(_isValidAddress(_otherBits))
return UnsafeRawPointer(
bitPattern: _otherBits
)._unsafelyUnwrappedUnchecked
}
}
@inlinable
func _asContiguousCocoa<CodeUnit>(
of codeUnit: CodeUnit.Type = CodeUnit.self
) -> _UnmanagedString<CodeUnit>
where CodeUnit : FixedWidthInteger & UnsignedInteger {
_sanityCheck(_object.isContiguousCocoa)
_sanityCheck(CodeUnit.bitWidth == _object.bitWidth)
let start = _cocoaRawStart.assumingMemoryBound(to: CodeUnit.self)
return _UnmanagedString(start: start, count: _cocoaCount)
}
// TODO(SSO): consider a small-checking variant
@usableFromInline
internal
init(
_largeNonTaggedCocoaObject s: _CocoaString,
count: Int,
isSingleByte: Bool,
start: UnsafeRawPointer?
) {
_sanityCheck(!_isObjCTaggedPointer(s))
guard count > 0 else {
self.init()
return
}
self.init(
object: _StringObject(
cocoaObject: s,
isSingleByte: isSingleByte,
isContiguous: start != nil),
otherBits: UInt(bitPattern: start))
if start == nil {
_sanityCheck(_object.isOpaque)
} else {
_sanityCheck(_object.isContiguous)
}
}
}
#else // !_runtime(_ObjC)
extension _StringGuts {
// TODO(SSO): consider a small-checking variant
@inline(never)
@usableFromInline
internal
init<S: _OpaqueString>(_large opaqueString: S) {
self.init(
object: _StringObject(opaqueString: opaqueString),
otherBits: UInt(bitPattern: opaqueString.length))
}
}
#endif // _runtime(_ObjC)
extension _StringGuts {
@inlinable
internal var _unmanagedRawStart: UnsafeRawPointer {
@inline(__always) get {
_sanityCheck(_object.isUnmanaged)
return _object.asUnmanagedRawStart
}
}
@inlinable
internal var _unmanagedCount: Int {
@inline(__always) get {
_sanityCheck(_object.isUnmanaged)
return Int(bitPattern: _otherBits)
}
}
@inlinable
@inline(__always)
internal
func _asUnmanaged<CodeUnit>(
of codeUnit: CodeUnit.Type = CodeUnit.self
) -> _UnmanagedString<CodeUnit>
where CodeUnit : FixedWidthInteger & UnsignedInteger {
_sanityCheck(_object.isUnmanaged)
_sanityCheck(CodeUnit.bitWidth == _object.bitWidth)
let start = _unmanagedRawStart.assumingMemoryBound(to: CodeUnit.self)
let count = _unmanagedCount
_sanityCheck(count >= 0)
return _UnmanagedString(start: start, count: count)
}
// TODO(SSO): consider a small-checking variant
@inlinable
init<CodeUnit>(_large s: _UnmanagedString<CodeUnit>)
where CodeUnit : FixedWidthInteger & UnsignedInteger {
_sanityCheck(s.count >= 0)
self.init(
object: _StringObject(unmanaged: s.start),
otherBits: UInt(bitPattern: s.count))
_sanityCheck(_object.isUnmanaged)
_sanityCheck(_unmanagedRawStart == s.rawStart)
_sanityCheck(_unmanagedCount == s.count)
_invariantCheck()
}
}
// Small strings
extension _StringGuts {
@inlinable
internal var _smallUTF8Count: Int {
@inline(__always) get {
#if arch(i386) || arch(arm)
unsupportedOn32bit()
#else
return _object.smallUTF8Count
#endif
}
}
@inlinable
internal var _smallUTF8String: _SmallUTF8String {
@inline(__always) get {
#if arch(i386) || arch(arm)
unsupportedOn32bit()
#else
return _SmallUTF8String(
_rawBits: (_otherBits, _object.asSmallUTF8SecondWord))
#endif
}
}
@inlinable
@inline(__always)
internal init(_ small: _SmallUTF8String) {
#if arch(i386) || arch(arm)
unsupportedOn32bit()
#else
self.init(
object: _StringObject(_smallUTF8SecondWord: small._rawBits.high),
otherBits: small._rawBits.low)
#endif
}
}
extension _StringGuts {
@inlinable
internal
var _unmanagedASCIIView: _UnmanagedString<UInt8> {
@_effects(readonly)
get {
_sanityCheck(_object.isContiguousASCII)
if _object.isUnmanaged {
return _asUnmanaged()
} else if _object.isNative {
return _object.nativeStorage(of: UInt8.self).unmanagedView
} else {
#if _runtime(_ObjC)
_sanityCheck(_object.isContiguousCocoa)
return _asContiguousCocoa(of: UInt8.self)
#else
Builtin.unreachable()
#endif
}
}
}
@inlinable
internal
var _unmanagedUTF16View: _UnmanagedString<UTF16.CodeUnit> {
@_effects(readonly)
get {
_sanityCheck(_object.isContiguousUTF16)
if _object.isUnmanaged {
return _asUnmanaged()
} else if _object.isNative {
return _object.nativeStorage(of: UTF16.CodeUnit.self).unmanagedView
} else {
#if _runtime(_ObjC)
_sanityCheck(_object.isContiguousCocoa)
return _asContiguousCocoa(of: UTF16.CodeUnit.self)
#else
Builtin.unreachable()
#endif
}
}
}
}
extension _StringGuts {
@inlinable
internal
var _isOpaque: Bool {
@inline(__always)
get { return _object.isOpaque }
}
@inlinable
internal
var _isContiguous: Bool {
@inline(__always)
get { return _object.isContiguous }
}
}
#if _runtime(_ObjC)
extension _StringGuts {
@usableFromInline
var _underlyingCocoaString: _CocoaString? {
if _object.isNative {
return _object.nativeRawStorage
}
if _object.isCocoa {
return _object.asCocoaObject
}
return nil
}
}
#endif
extension _StringGuts {
/// Return the object identifier for the reference counted heap object
/// referred to by this string (if any). This is useful for testing allocation
/// behavior.
@usableFromInline
internal var _objectIdentifier: ObjectIdentifier? {
if _object.isNative {
return ObjectIdentifier(_object.nativeRawStorage)
}
#if _runtime(_ObjC)
if _object.isCocoa {
return ObjectIdentifier(_object.asCocoaObject)
}
#endif
return nil
}
}
extension _StringGuts {
// @opaque
internal func _asOpaque() -> _UnmanagedOpaqueString {
#if _runtime(_ObjC)
if _object.isSmall {
fatalError("Invariant violated: opaque small strings")
}
_sanityCheck(_object.isNoncontiguousCocoa)
return _UnmanagedOpaqueString(_object.asCocoaObject, count: _cocoaCount)
#else
_sanityCheck(_object.isOpaque)
return _UnmanagedOpaqueString(_object.asOpaqueObject, count: _opaqueCount)
#endif
}
@usableFromInline
internal var _opaqueCount: Int {
fatalError("TODO: non-cocoa opaque string support")
}
}
extension _StringGuts {
internal
func _dump() {
#if INTERNAL_CHECKS_ENABLED
func printHex<U: UnsignedInteger>(_ uint: U, newline: Bool = true) {
print(String(uint, radix: 16), terminator: newline ? "\n" : "")
}
func fromAny(_ x: AnyObject) -> UInt {
return Builtin.reinterpretCast(x)
}
func fromPtr(_ x: UnsafeMutableRawPointer) -> UInt {
return Builtin.reinterpretCast(x)
}
print("_StringGuts(", terminator: "")
defer { print(")") }
printHex(rawBits.0, newline: false)
print(" ", terminator: "")
printHex(rawBits.1, newline: false)
print(": ", terminator: "")
if _object.isNative {
let storage = _object.nativeRawStorage
print("native ", terminator: "")
printHex(Builtin.reinterpretCast(storage) as UInt, newline: false)
print(" start: ", terminator: "")
printHex(
Builtin.reinterpretCast(storage.rawStart) as UInt, newline: false)
print(" count: ", terminator: "")
print(storage.count, terminator: "")
print("/", terminator: "")
print(storage.capacity, terminator: "")
return
}
if _object.isSmall {
self._smallUTF8String._dump()
return
}
#if _runtime(_ObjC)
if _object.isCocoa {
print("cocoa ", terminator: "")
printHex(
Builtin.reinterpretCast(_object.asCocoaObject) as UInt, newline: false)
print(" start: ", terminator: "")
if _object.isContiguous {
printHex(
Builtin.reinterpretCast(_cocoaRawStart) as UInt, newline: false)
} else {
print("<opaque>", terminator: "")
}
print(" count: ", terminator: "")
print(_cocoaCount, terminator: "")
return
}
#else // no ObjC
if _object.isOpaque {
print("opaque ", terminator: "")
printHex(
Builtin.reinterpretCast(_object.asOpaqueObject) as UInt, newline: false)
print(" count: ", terminator: "")
print(_opaqueCount, terminator: "")
return
}
#endif // ObjC
if _object.isUnmanaged {
print("unmanaged ", terminator: "")
printHex(
Builtin.reinterpretCast(_unmanagedRawStart) as UInt, newline: false)
print(" count: ", terminator: "")
print(_unmanagedCount, terminator: "")
return
}
print("error", terminator: "")
if isASCII {
print(" <ascii>", terminator: "")
}
else {
print(" <utf16>", terminator: "")
}
#endif // INTERNAL_CHECKS_ENABLED
}
}
//
// String API helpers
//
extension _StringGuts {
// Return a contiguous _StringGuts with the same contents as this one.
// Use the existing guts if possible; otherwise copy the string into a
// new buffer.
@usableFromInline
internal
func _extractContiguous<CodeUnit>(
of codeUnit: CodeUnit.Type = CodeUnit.self
) -> _StringGuts
where CodeUnit : FixedWidthInteger & UnsignedInteger {
if _fastPath(
_object.isContiguous && CodeUnit.bitWidth == _object.bitWidth) {
return self
}
// TODO (TODO: JIRA): check if we're small, extract that.
let count = self.count
return _StringGuts(
_large: _copyToNativeStorage(of: CodeUnit.self, from: 0..<count))
}
@usableFromInline
internal
func _extractContiguousUTF16() -> _StringGuts {
return _extractContiguous(of: UTF16.CodeUnit.self)
}
@usableFromInline
internal
func _extractContiguousASCII() -> _StringGuts {
return _extractContiguous(of: UInt8.self)
}
// Return a native storage object with the same contents as this string.
// Use the existing buffer if possible; otherwise copy the string into a
// new buffer.
@usableFromInline
@_specialize(where CodeUnit == UInt8)
@_specialize(where CodeUnit == UInt16)
internal
func _extractNativeStorage<CodeUnit>(
of codeUnit: CodeUnit.Type = CodeUnit.self
) -> _SwiftStringStorage<CodeUnit>
where CodeUnit : FixedWidthInteger & UnsignedInteger {
if _fastPath(_object.isNative && CodeUnit.bitWidth == _object.bitWidth) {
return _object.nativeStorage()
}
let count = self.count
return _copyToNativeStorage(of: CodeUnit.self, from: 0..<count)
}
@_specialize(where CodeUnit == UInt8)
@_specialize(where CodeUnit == UInt16)
internal
func _copyToNativeStorage<CodeUnit>(
of codeUnit: CodeUnit.Type = CodeUnit.self,
from range: Range<Int>,
unusedCapacity: Int = 0
) -> _SwiftStringStorage<CodeUnit>
where CodeUnit : FixedWidthInteger & UnsignedInteger {
_sanityCheck(unusedCapacity >= 0)
let storage = _SwiftStringStorage<CodeUnit>.create(
capacity: range.count + unusedCapacity,
count: range.count)
self._copy(range: range, into: storage.usedBuffer)
return storage
}
@usableFromInline // @testable
func _extractSlice(_ range: Range<Int>) -> _StringGuts {
if range.isEmpty { return _StringGuts() }
if range == 0..<count { return self }
if self._isSmall {
return _StringGuts(self._smallUTF8String[range])
}
if self.isASCII {
defer { _fixLifetime(self) }
let ascii = self._unmanagedASCIIView[range]
if let small = _SmallUTF8String(ascii.buffer) {
return _StringGuts(small)
}
if _object.isUnmanaged {
return _StringGuts(_large: ascii)
}
return _StringGuts(
_large: _copyToNativeStorage(of: UInt8.self, from: range))
}
// TODO(SSO): small UTF-16 strings
if _object.isUnmanaged {
return _StringGuts(_large: _unmanagedUTF16View[range])
}
return _StringGuts(
_large: _copyToNativeStorage(of: UTF16.CodeUnit.self, from: range))
}
internal mutating func allocationParametersForMutableStorage<CodeUnit>(
of type: CodeUnit.Type,
unusedCapacity: Int
) -> (count: Int, capacity: Int)?
where CodeUnit : FixedWidthInteger & UnsignedInteger {
if _slowPath(!_object.isNative) {
return (self.count, count + unusedCapacity)
}
unowned(unsafe) let storage = _object.nativeRawStorage
defer { _fixLifetime(self) }
if _slowPath(storage.unusedCapacity < unusedCapacity) {
// Need more space; borrow Array's exponential growth curve.
return (
storage.count,
Swift.max(
_growArrayCapacity(storage.capacity),
count + unusedCapacity))
}
// We have enough space; check if it's unique and of the correct width.
if _fastPath(_object.bitWidth == CodeUnit.bitWidth) {
if _fastPath(_isUniqueNative()) {
return nil
}
}
// If not, allocate new storage, but keep existing capacity.
return (storage.count, storage.capacity)
}
// Convert ourselves (if needed) to a native string with the specified storage
// parameters and call `body` on the resulting native storage.
internal
mutating func withMutableStorage<CodeUnit, R>(
of type: CodeUnit.Type = CodeUnit.self,
unusedCapacity: Int,
_ body: (Unmanaged<_SwiftStringStorage<CodeUnit>>) -> R
) -> R
where CodeUnit : FixedWidthInteger & UnsignedInteger {
let paramsOpt = allocationParametersForMutableStorage(
of: CodeUnit.self,
unusedCapacity: unusedCapacity)
if _fastPath(paramsOpt == nil) {
unowned(unsafe) let storage = _object.nativeStorage(of: CodeUnit.self)
let result = body(Unmanaged.passUnretained(storage))
self._nativeCount = storage.count
_fixLifetime(self)
return result
}
let params = paramsOpt._unsafelyUnwrappedUnchecked
let unmanagedRef = Unmanaged.passRetained(
self._copyToNativeStorage(
of: CodeUnit.self,
from: 0..<params.count,
unusedCapacity: params.capacity - params.count))
let result = body(unmanagedRef)
self = _StringGuts(_large: unmanagedRef.takeRetainedValue())
_fixLifetime(self)
return result
}
@inline(__always)
internal
mutating func withMutableASCIIStorage<R>(
unusedCapacity: Int,
_ body: (Unmanaged<_ASCIIStringStorage>) -> R
) -> R {
return self.withMutableStorage(
of: UInt8.self, unusedCapacity: unusedCapacity, body)
}
@inline(__always)
internal
mutating func withMutableUTF16Storage<R>(
unusedCapacity: Int,
_ body: (Unmanaged<_UTF16StringStorage>) -> R
) -> R {
return self.withMutableStorage(
of: UTF16.CodeUnit.self, unusedCapacity: unusedCapacity, body)
}
}
//
// String API
//
extension _StringGuts {
@inlinable
internal var _hasStoredCount: Bool {
@inline(__always) get { return !_object.isSmallOrCocoa }
}
@inlinable
internal var startIndex: Int {
return 0
}
@inlinable
internal var endIndex: Int {
@inline(__always) get { return count }
}
@inlinable
internal var count: Int {
if _slowPath(!_hasStoredCount) {
return _nonStoredCount
}
// TODO(StringObject): Mask off the high bits
_sanityCheck(Int(self._otherBits) >= 0)
return Int(bitPattern: self._otherBits)
}
@usableFromInline
internal
var _nonStoredCount: Int {
@_effects(readonly)
get {
if _object.isSmall {
return _object.smallUTF8Count
}
#if _runtime(_ObjC)
_sanityCheck(_object.isCocoa)
return _cocoaCount
#else
_sanityCheck(_object.isOpaque)
return _opaqueCount
#endif
}
}
@inlinable
internal var capacity: Int {
if _fastPath(_object.isNative) {
return _object.nativeRawStorage.capacity
}
return 0
}
/// Get the UTF-16 code unit stored at the specified position in this string.
@inlinable // FIXME(sil-serialize-all)
func codeUnit(atCheckedOffset offset: Int) -> UTF16.CodeUnit {
if _slowPath(_isOpaque) {
return _opaqueCodeUnit(atCheckedOffset: offset)
} else if isASCII {
return _unmanagedASCIIView.codeUnit(atCheckedOffset: offset)
} else {
return _unmanagedUTF16View.codeUnit(atCheckedOffset: offset)
}
}
@usableFromInline // @opaque
func _opaqueCodeUnit(atCheckedOffset offset: Int) -> UTF16.CodeUnit {
_sanityCheck(_isOpaque)
// TODO: ascii fast path, and reconsider this whole API anyways
if self._isSmall {
return self._smallUTF8String.withUnmanagedASCII {
$0.codeUnit(atCheckedOffset: offset)
}
}
defer { _fixLifetime(self) }
return _asOpaque().codeUnit(atCheckedOffset: offset)
}
// Copy code units from a slice of this string into a buffer.
internal func _copy<CodeUnit>(
range: Range<Int>,
into dest: UnsafeMutableBufferPointer<CodeUnit>)
where CodeUnit : FixedWidthInteger & UnsignedInteger {
_sanityCheck(CodeUnit.bitWidth == 8 || CodeUnit.bitWidth == 16)
_sanityCheck(dest.count >= range.count)
if _slowPath(_isOpaque) {
_opaqueCopy(range: range, into: dest)
return
}
defer { _fixLifetime(self) }
if isASCII {
_unmanagedASCIIView[range]._copy(into: dest)
} else {
_unmanagedUTF16View[range]._copy(into: dest)
}
}
internal func _opaqueCopy<CodeUnit>(
range: Range<Int>,
into dest: UnsafeMutableBufferPointer<CodeUnit>)
where CodeUnit : FixedWidthInteger & UnsignedInteger {
_sanityCheck(_isOpaque)
if _fastPath(self._isSmall) {
var slice = self._smallUTF8String[range]
slice._copy(into: dest)
return
}
defer { _fixLifetime(self) }
_asOpaque()[range]._copy(into: dest)
}
@usableFromInline
mutating func reserveUnusedCapacity(
_ unusedCapacity: Int,
ascii: Bool = false
) {
if _fastPath(_isUniqueNative()) {
if _fastPath(
ascii == (_object.bitWidth == 8) &&
_object.nativeRawStorage.unusedCapacity >= unusedCapacity) {
return
}
}
// TODO (TODO: JIRA): check if we're small and still within capacity
if ascii {
let storage = _copyToNativeStorage(
of: UInt8.self,
from: 0..<self.count,
unusedCapacity: unusedCapacity)
self = _StringGuts(_large: storage)
} else {
let storage = _copyToNativeStorage(
of: UTF16.CodeUnit.self,
from: 0..<self.count,
unusedCapacity: unusedCapacity)
self = _StringGuts(_large: storage)
}
_invariantCheck()
}
@usableFromInline // @testable
mutating func reserveCapacity(_ capacity: Int) {
if _fastPath(_isUniqueNative()) {
if _fastPath(_object.nativeRawStorage.capacity >= capacity) {
return
}
}
// Small strings can accomodate small capacities
if capacity <= _SmallUTF8String.capacity {
return
}
let selfCount = self.count
if isASCII {
let storage = _copyToNativeStorage(
of: UInt8.self,
from: 0..<selfCount,
unusedCapacity: Swift.max(capacity - count, 0))
self = _StringGuts(_large: storage)
} else {
let storage = _copyToNativeStorage(
of: UTF16.CodeUnit.self,
from: 0..<selfCount,
unusedCapacity: Swift.max(capacity - count, 0))
self = _StringGuts(_large: storage)
}
_invariantCheck()
}
internal
mutating func append(_ other: _UnmanagedASCIIString) {
guard other.count > 0 else { return }
if self._isSmall {
if let result = self._smallUTF8String._appending(other.buffer) {
self = _StringGuts(result)
return
}
}
if _object.isSingleByte {
withMutableASCIIStorage(unusedCapacity: other.count) { storage in
storage._value._appendInPlace(other)
}
} else {
withMutableUTF16Storage(unusedCapacity: other.count) { storage in
storage._value._appendInPlace(other)
}
}
}
internal
mutating func append(_ other: _UnmanagedUTF16String) {
guard other.count > 0 else { return }
withMutableUTF16Storage(unusedCapacity: other.count) { storage in
storage._value._appendInPlace(other)
}
}
internal
mutating func append(_ other: _UnmanagedOpaqueString) {
guard other.count > 0 else { return }
withMutableUTF16Storage(unusedCapacity: other.count) { storage in
storage._value._appendInPlace(other)
}
}
internal
mutating func append<S: StringProtocol>(_ other: S) {
self.append(other._wholeString._guts, range: other._encodedOffsetRange)
}
@usableFromInline // @testable
internal
mutating func append(_ other: _StringGuts) {
// FIXME(TODO: JIRA): shouldn't _isEmptySingleton be sufficient?
if _isEmptySingleton || self.count == 0 && !_object.isNative {
// We must be careful not to discard any capacity that
// may have been reserved for the append -- this is why
// we check for the empty string singleton rather than
// a zero `count` above.
self = other
return
}
if _slowPath(other._isOpaque) {
_opaqueAppend(opaqueOther: other)
return
}
defer { _fixLifetime(other) }
if other.isASCII {
self.append(other._unmanagedASCIIView)
} else {
self.append(other._unmanagedUTF16View)
}
}
mutating func _opaqueAppend(opaqueOther other: _StringGuts) {
if other._isSmall {
// TODO: Fix the visitation pattern for append here. For now, we funnel
// through _UnmanagedASCIIString.
other._smallUTF8String.withUnmanagedASCII {
self.append($0)
}
return
}
_sanityCheck(other._isOpaque)
defer { _fixLifetime(other) }
self.append(other._asOpaque())
}
@usableFromInline
internal
mutating func append(_ other: _StringGuts, range: Range<Int>) {
_sanityCheck(range.lowerBound >= 0 && range.upperBound <= other.count)
guard range.count > 0 else { return }
if _isEmptySingleton && range.count == other.count {
self = other
return
}
if _slowPath(other._isOpaque) {
_opaqueAppend(opaqueOther: other, range: range)
return
}
defer { _fixLifetime(other) }
if other.isASCII {
self.append(other._unmanagedASCIIView[range])
} else {
self.append(other._unmanagedUTF16View[range])
}
}
mutating func _opaqueAppend(opaqueOther other: _StringGuts, range: Range<Int>) {
if other._isSmall {
other._smallUTF8String.withUnmanagedASCII {
self.append($0[range])
}
return
}
_sanityCheck(other._isOpaque)
defer { _fixLifetime(other) }
self.append(other._asOpaque()[range])
}
//
// FIXME (TODO JIRA): Appending a character onto the end of a string should
// really have a less generic implementation, then we can drop @specialize.
//
@usableFromInline
@_specialize(where C == Character._SmallUTF16)
mutating func append<C : RandomAccessCollection>(contentsOf other: C)
where C.Element == UInt16 {
if self._isSmall {
if let result = self._smallUTF8String._appending(other) {
self = _StringGuts(result)
return
}
}
if _object.isSingleByte && !other.contains(where: { $0 > 0x7f }) {
withMutableASCIIStorage(
unusedCapacity: numericCast(other.count)) { storage in
storage._value._appendInPlaceUTF16(contentsOf: other)
}
return
}
withMutableUTF16Storage(
unusedCapacity: numericCast(other.count)) { storage in
storage._value._appendInPlaceUTF16(contentsOf: other)
}
}
}
extension _StringGuts {
@usableFromInline
mutating func _replaceSubrange<C, CodeUnit>(
_ bounds: Range<Int>,
with newElements: C,
of codeUnit: CodeUnit.Type
) where C : Collection, C.Element == UTF16.CodeUnit,
CodeUnit : FixedWidthInteger & UnsignedInteger {
_precondition(bounds.lowerBound >= 0,
"replaceSubrange: subrange start precedes String start")
let newCount: Int = numericCast(newElements.count)
let deltaCount = newCount - bounds.count
let paramsOpt = allocationParametersForMutableStorage(
of: CodeUnit.self,
unusedCapacity: Swift.max(0, deltaCount))
if _fastPath(paramsOpt == nil) {
// We have unique native storage of the correct code unit,
// with enough capacity to do the replacement inline.
unowned(unsafe) let storage = _object.nativeStorage(of: CodeUnit.self)
_sanityCheck(storage.unusedCapacity >= deltaCount)
let tailCount = storage.count - bounds.upperBound
_precondition(tailCount >= 0,
"replaceSubrange: subrange extends past String end")
let dst = storage.start + bounds.lowerBound
if deltaCount != 0 && tailCount > 0 {
// Move tail to make space for new data
(dst + newCount).moveInitialize(
from: dst + bounds.count,
count: tailCount)
}
// Copy new elements in place
var it = newElements.makeIterator()
for p in dst ..< (dst + newCount) {
p.pointee = CodeUnit(it.next()!)
}
_precondition(it.next() == nil, "Collection misreported its count")
storage.count += deltaCount
_nativeCount += deltaCount
_invariantCheck()
_fixLifetime(self)
return
}
// Allocate new storage.
let params = paramsOpt._unsafelyUnwrappedUnchecked
_precondition(bounds.upperBound <= params.count,
"replaceSubrange: subrange extends past String end")
let storage = _SwiftStringStorage<CodeUnit>.create(
capacity: params.capacity,
count: params.count + deltaCount)
var dst = storage.start
// Copy prefix up to replaced range
let prefixRange: Range<Int> = 0..<bounds.lowerBound
_copy(
range: prefixRange,
into: UnsafeMutableBufferPointer(start: dst, count: prefixRange.count))
dst += prefixRange.count
// Copy new data
var it = newElements.makeIterator()
for p in dst ..< (dst + newCount) {
p.pointee = CodeUnit(it.next()!)
}
_precondition(it.next() == nil, "Collection misreported its count")
dst += newCount
// Copy suffix from end of replaced range
let suffixRange: Range<Int> = bounds.upperBound..<params.count
_copy(
range: suffixRange,
into: UnsafeMutableBufferPointer(start: dst, count: suffixRange.count))
_sanityCheck(dst + suffixRange.count == storage.end)
self = _StringGuts(_large: storage)
_invariantCheck()
}
@usableFromInline
mutating func replaceSubrange<C>(
_ bounds: Range<Int>,
with newElements: C
) where C : Collection, C.Element == UTF16.CodeUnit {
if isASCII && !newElements.contains(where: {$0 > 0x7f}) {
self._replaceSubrange(bounds, with: newElements, of: UInt8.self)
} else {
self._replaceSubrange(bounds, with: newElements, of: UTF16.CodeUnit.self)
}
}
}
extension _StringGuts {
// TODO: Drop or unify with String._fromCodeUnits
internal
static func fromCodeUnits<Encoding : _UnicodeEncoding>(
_ input: UnsafeBufferPointer<Encoding.CodeUnit>,
encoding: Encoding.Type,
repairIllFormedSequences: Bool,
minimumCapacity: Int = 0
) -> (_StringGuts?, hadError: Bool) {
// Determine how many UTF-16 code units we'll need
guard let (utf16Count, isASCII) = UTF16.transcodedLength(
of: input.makeIterator(),
decodedAs: Encoding.self,
repairingIllFormedSequences: repairIllFormedSequences) else {
return (nil, true)
}
if isASCII {
if let small = _SmallUTF8String(
_fromCodeUnits: input,
utf16Length: utf16Count,
isASCII: true,
Encoding.self
) {
return (_StringGuts(small), false)
}
let storage = _SwiftStringStorage<UTF8.CodeUnit>.create(
capacity: Swift.max(minimumCapacity, utf16Count),
count: utf16Count)
let hadError = storage._initialize(
fromCodeUnits: input,
encoding: Encoding.self)
return (_StringGuts(_large: storage), hadError)
}
let storage = _SwiftStringStorage<UTF16.CodeUnit>.create(
capacity: Swift.max(minimumCapacity, utf16Count),
count: utf16Count)
let hadError = storage._initialize(
fromCodeUnits: input,
encoding: Encoding.self)
return (_StringGuts(_large: storage), hadError)
}
}
extension _SwiftStringStorage {
/// Initialize a piece of freshly allocated storage instance from a sequence
/// of code units, which is assumed to contain exactly as many code units as
/// fits in the current storage count.
///
/// Returns true iff `input` was found to contain invalid code units in the
/// specified encoding. If any invalid sequences are found, they are replaced
/// with REPLACEMENT CHARACTER (U+FFFD).
internal
func _initialize<Encoding: _UnicodeEncoding>(
fromCodeUnits input: UnsafeBufferPointer<Encoding.CodeUnit>,
encoding: Encoding.Type
) -> Bool {
var p = self.start
let hadError = transcode(
input.makeIterator(),
from: Encoding.self,
to: UTF16.self,
stoppingOnError: false) { cu in
_sanityCheck(p < end)
p.pointee = CodeUnit(cu)
p += 1
}
_sanityCheck(p == end)
return hadError
}
}
extension _StringGuts {
// FIXME: Remove. Still used by swift-corelibs-foundation
@available(*, deprecated)
public var startASCII: UnsafeMutablePointer<UTF8.CodeUnit> {
return UnsafeMutablePointer(mutating: _unmanagedASCIIView.start)
}
// FIXME: Remove. Still used by swift-corelibs-foundation
@available(*, deprecated)
public var startUTF16: UnsafeMutablePointer<UTF16.CodeUnit> {
return UnsafeMutablePointer(mutating: _unmanagedUTF16View.start)
}
}
extension _StringGuts {
@available(*, deprecated)
public // SPI(Foundation)
var _isContiguousASCII: Bool {
return _object.isContiguousASCII
}
@available(*, deprecated)
public // SPI(Foundation)
var _isContiguousUTF16: Bool {
return _object.isContiguousUTF16
}
@available(*, deprecated)
public // SPI(Foundation)
func _withUnsafeUTF8CodeUnitsIfAvailable<Result>(
_ f: (UnsafeBufferPointer<UInt8>) throws -> Result
) rethrows -> Result? {
guard _object.isContiguousASCII else { return nil }
return try f(_unmanagedASCIIView.buffer)
}
@available(*, deprecated)
public // SPI(Foundation)
func _withUnsafeUTF16CodeUnitsIfAvailable<Result>(
_ f: (UnsafeBufferPointer<UInt16>) throws -> Result
) rethrows -> Result? {
guard _object.isContiguousUTF16 else { return nil }
return try f(_unmanagedUTF16View.buffer)
}
}
| 28.248653 | 82 | 0.676768 |
707ec0cc2a0dcb25542cee3dcc78baffb2fe1919 | 3,522 | cs | C# | BallLogic.cs | famerij/breakout-clone | c2c832b8ce2189db1aff04eea5badf64fecc7d5d | [
"MIT"
] | null | null | null | BallLogic.cs | famerij/breakout-clone | c2c832b8ce2189db1aff04eea5badf64fecc7d5d | [
"MIT"
] | null | null | null | BallLogic.cs | famerij/breakout-clone | c2c832b8ce2189db1aff04eea5badf64fecc7d5d | [
"MIT"
] | null | null | null | using UnityEngine;
using System.Collections;
public class BallLogic : MonoBehaviour {
// Speed set in editor
public float speed;
// Different sound effects
public AudioClip blockImpact;
public AudioClip playerImpact;
public AudioClip wallImpact;
public AudioClip destruction;
// Keep track of the direction in which the ball is moving
private Vector2 velocity;
// used for velocity calculation
private Vector2 lastPos;
private GameObject player;
// GameSetup script access
private GameObject mainCamera;
private GameSetup setupScript;
void Start () {
// Random direction
GetComponent<Rigidbody2D>().velocity = Random.insideUnitCircle.normalized * speed;
// Set the player
player = GameObject.Find("Player");
// Set camera for global game setup script
mainCamera = GameObject.Find ("MainCamera");
setupScript = (GameSetup) mainCamera.GetComponent (typeof(GameSetup));
}
void FixedUpdate () {
// Get pos 2d of the ball.
Vector3 pos3D = transform.position;
Vector2 pos2D = new Vector2(pos3D.x, pos3D.y);
// Velocity calculation. Will be used for the bounce
velocity = pos2D - lastPos;
lastPos = pos2D;
// Preventing the ball from stopping in corners, cheap fix I know
if (GetComponent<Rigidbody2D>().velocity.magnitude < speed / 2) {
GetComponent<Rigidbody2D>().velocity = new Vector2(-1f,1f) * speed;
}
}
void OnCollisionEnter2D(Collision2D coll) {
// If hit by player, set the velocity according to the angle in which the palyer was hit
if (coll.collider.transform.tag == "Player") {
Vector2 playerPos = player.transform.position;
// The vector from player to the ball
Vector2 delta = lastPos - playerPos;
// Normalized vector
Vector2 direction = delta.normalized;
//Debug.DrawRay(lastPos, direction, Color.yellow, 3f);
// Set the velocity to be the direction vector scaled to the constant speed
GetComponent<Rigidbody2D>().velocity = direction * speed;
// Playing sound effect, randomizing pitch for variation
GetComponent<AudioSource>().pitch = Random.Range (0.8f,1f);
GetComponent<AudioSource>().PlayOneShot(playerImpact);
}
// Bounce from anywhere else
else {
// Normal
Vector3 N = coll.contacts[0].normal;
// Direction
Vector3 V = velocity.normalized;
// Reflection
Vector3 R = Vector3.Reflect(V, N).normalized;
//Debug.DrawRay(lastPos, R, Color.white, 3f);
// Assign normalized reflection with the constant speed
GetComponent<Rigidbody2D>().velocity = new Vector2(R.x, R.y) * speed;
// Playing sound effect
// Block impacts give different sound
if (coll.gameObject.tag != "Block") {
GetComponent<AudioSource>().pitch = Random.Range (0.8f,1f);
GetComponent<AudioSource>().PlayOneShot(wallImpact);
}
}
if (coll.gameObject.tag == "Block") {
BlockDestroy destroyScript;
destroyScript = (BlockDestroy) coll.gameObject.GetComponent (typeof(BlockDestroy));
destroyScript.Destroy();
// Playing sound effect
GetComponent<AudioSource>().pitch = Random.Range (0.6f,1f);
GetComponent<AudioSource>().PlayOneShot(blockImpact);
}
}
void OnTriggerEnter2D(Collider2D other) {
// Detect when the bottom is hit
if (other.tag == "Bottom") {
StartCoroutine(DestroyBall());
}
}
IEnumerator DestroyBall() {
// Playing sound effect
GetComponent<AudioSource>().PlayOneShot(destruction);
yield return new WaitForSeconds(destruction.length);
Destroy(gameObject);
setupScript.CheckExtraBalls();
}
}
| 28.176 | 90 | 0.714367 |
85ab6b832a5bb2dea3bf32130e135ebbaa5daa5e | 432 | js | JavaScript | app/config/machine.js | heidgera/CCIS-2020-001-AquaticFlowController | 9612a7f7bb50382c3419add4c3c4943b62f55e6b | [
"MIT"
] | null | null | null | app/config/machine.js | heidgera/CCIS-2020-001-AquaticFlowController | 9612a7f7bb50382c3419add4c3c4943b62f55e6b | [
"MIT"
] | null | null | null | app/config/machine.js | heidgera/CCIS-2020-001-AquaticFlowController | 9612a7f7bb50382c3419add4c3c4943b62f55e6b | [
"MIT"
] | null | null | null | exports.config = {
machine: {
autostart: true,
gitWatch: true,
preventSleep: true,
// softShutdown: {
// monitorPin: 24,
// controlPin: 25,
// delayTime: 1000,
// },
// wifi: {
// ssid: 'SensorServer',
// password: 'defaultPass',
// },
// wifiHotspot: {
// ssid: 'Template',
// password: 'template!',
// domainName: 'template.net',
// },
},
};
| 19.636364 | 36 | 0.483796 |
9097853087ab15eaaace46c39ff168cdffaa86f6 | 6,612 | py | Python | sw3d.py | TorHou/ContigAnalysisScripts | 7cd240babf6c8889a25604d3cfb262e241fcfa11 | [
"MIT"
] | 1 | 2018-07-27T00:54:35.000Z | 2018-07-27T00:54:35.000Z | sw3d.py | DiltheyLab/ContigAnalysisScripts | 7cd240babf6c8889a25604d3cfb262e241fcfa11 | [
"MIT"
] | null | null | null | sw3d.py | DiltheyLab/ContigAnalysisScripts | 7cd240babf6c8889a25604d3cfb262e241fcfa11 | [
"MIT"
] | null | null | null | import argparse
import numpy as np
from Bio import SeqIO
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from bidict import bidict
parser = argparse.ArgumentParser(description = "Calculates the multiple sequence alignment for three sequences using dynamic programming. ONLY calculates the MSA for the first sequence in each input file.")
parser.add_argument("input1", help = "Shold be the long read (Nanopore, Pacbio)")
parser.add_argument("input2", help = "Contig 1")
parser.add_argument("input3", help = "Contig 2")
args=parser.parse_args()
records = { }
rec = SeqIO.parse(args.input1, "fasta").__next__()
records[rec.id] = str(rec.seq.upper())
rec1 = rec.id
rec = SeqIO.parse(args.input2, "fasta").__next__()
records[rec.id] = str(rec.seq.upper())
rec2 = rec.id
rec = SeqIO.parse(args.input3, "fasta").__next__()
records[rec.id] = str(rec.seq.upper())
rec3 = rec.id
mat = np.zeros((len(records[rec1])+1,len(records[rec2])+1,len(records[rec3])+1), dtype=np.uint8)
traceback = np.zeros((len(records[rec1])+1,len(records[rec2])+1,len(records[rec3])+1), dtype=np.uint8)
gap = -1
match = 3
lrmissmatch = -1
srmissmatch = -3
bits = bidict({'sx':0, 'sy':128, 'sz':256, 'x':1, 'y':2, 'z':4, 'xy': 8, 'xz': 16, 'yz': 32, 'xyz': 64})
moves = {'sx':(0,0,0), 'sy':(0,0,0), 'sz':(0,0,0), 'x':(1,0,0), 'y':(0,1,0), 'z':(0,0,1), 'xy': (1,1,0), 'xz': (1,0,1), 'yz': (0,1,1), 'xyz': (1,1,1)}
print("Calculating matrix...")
# Initialization of the three sides
for i in range(1, len(records[rec1])+1):
l1 = records[rec1][i-1]
for j in range(1, len(records[rec2])+1):
l2 = records[rec2][j-1]
s12 = match if l1 == l2 else lrmissmatch
d = {'s':0, 'xy': mat[i-1][j-1][0] + s12, 'x': mat[i-1][j][0] + gap, 'y': mat[i][j-1][0] + gap}
a = max(d, key=d.get)
mat[i][j][0] = d[a]
for i in range(1, len(records[rec1])+1):
l1 = records[rec1][i-1]
for k in range(1, len(records[rec3])+1):
l3 = records[rec3][k-1]
s13 = match if l1 == l3 else lrmissmatch
d = {'s':0, 'xz': mat[i-1][0][k-1] + s13, 'x': mat[i-1][0][k] + gap, 'z': mat[i][0][k-1] + gap}
a = max(d, key=d.get)
mat[i][0][k] = d[a]
for j in range(1, len(records[rec2])+1):
l2 = records[rec2][j-1]
for k in range(1, len(records[rec3])+1):
l3 = records[rec3][k-1]
s23 = match if l2 == l3 else srmissmatch
d = {'s':0, 'yz': mat[0][j-1][k-1] + s23, 'y': mat[0][j-1][0] + gap, 'z': mat[0][j][k-1] + gap}
a = max(d, key=d.get)
mat[0][j][k] = d[a]
for i in range(1,len(records[rec1])+1):
print("step " + str(i) + "/" + str(len(records[rec1])))
l1 = records[rec1][i-1]
for j in range(1,len(records[rec2])+1):
l2 = records[rec2][j-1]
s12 = match if l1 == l2 else lrmissmatch
for k in range(1,len(records[rec3])+1):
l3 = records[rec3][k-1]
s13 = match if l1 == l3 else lrmissmatch
s23 = match if l2 == l3 else srmissmatch
gapxy = gap
gapxz = gap
gapyz = gap
if k == len(records[rec3]):
gapyz = 0
gapxz = 0
if j == len(records[rec2]):
gapxy = 0
gapyz = 0
if i == len(records[rec1]):
gapxy = 0
gapxz = 0
d = {'sx':mat[0][j][k], 'sy':mat[i][0][k], 'sz':mat[i][j][0], 'xyz': mat[i-1][j-1][k-1] + s12 + s23 + s13, 'xy': mat[i-1][j-1][k] + s12 + gapyz + gapxz, 'xz': mat[i-1][j][k-1] + s13 + gapxy + gapyz, 'yz': mat[i][j-1][k-1] + s23 + gapxy + gapxz, 'x': mat[i-1][j][k] + gapxy + gapxz, 'y': mat[i][j-1][k] + gapxy + gapyz, 'z': mat[i][j][k-1]+ gapxz + gapyz}
#d = {'s':0, 'xyz':mat[i-1][j-1][k-1] + s12 + s23 + s13}
a = max(d, key=d.get)
traceback[i][j][k] = 0|bits[a];
#print("ijk" + str(i) + ":"+ str(j) + ":" + str(k))
#mat[i][j][k] = max(0, mat[i-1][j-1][k-1] + s12 + s23 + s13, mat[i-1][j-1][k] + s12 + gap,mat[i-1][j][k-1] + s13 + gap, mat[i][j-1][k-1] + s23 + gap, mat[i-1][j][k] + 2*gap, mat[i][j-1][k] + 2*gap, mat[i][j][k-1]+ 2*gap)
mat[i][j][k] = d[a]
#gap = gapo
#print(mat)
#fig = plt.figure()
#ax = fig.add_subplot(111, projection='3d')
#surf(mat[1,:],mat[2,:],mat[3,1])
#print(traceback)
y = np.arange(0.0, len(records[rec1]))
x = np.arange(0.0, len(records[rec2]))
x,y = np.meshgrid(x,y)
#print(x)
#print(y)
fig = plt.figure()
ax = fig.gca(projection='3d')
#print(mat[0,1,:])
#print(mat[1,1,:])
#print(mat[1,:,:])
maxz = mat.max()
minz = mat.min()
#print(maxz)
#print(minz)
#for i in range(len(records[rec3])):
# plt.subplot(len(records[rec3]), 1, i+1)
# z = mat[i,:,:]
# plt.imshow(z, cmap=plt.get_cmap('hot'), vmin= minz, vmax=maxz)
#plt.show()
print("mat max: "+ str(mat.max()))
#p.rint(np.argmax(mat,axis=1))
ind = np.unravel_index(np.argmax(mat, axis=None), mat.shape)
#print(ind)
#print(traceback[ind])
#print(mat[ind])
val = traceback[ind]
al = ["", "", ""]
#print(ind[2]-1)
#print(records[rec3][3])
i= 1
while val != 0 and val !=256 and val != 128:
#print("step: " + str(i))
i += 1
#print(str(ind) + "\t" + str(bits.inv[traceback[ind]])+ "\t" + str(mat[ind[0]][ind[1]][ind[2]])+ str(records[rec1][ind[0]-1]))
if val & 64:
al[0] = records[rec1][ind[0]-1] + al[0]
al[1] = records[rec2][ind[1]-1] + al[1]
al[2] = records[rec3][ind[2]-1] + al[2]
ind = (ind[0]-1, ind[1]-1, ind[2]-1)
elif val & 32:
al[0] = "_" + al[0]
al[1] = records[rec2][ind[1]-1] + al[1]
al[2] = records[rec3][ind[2]-1] + al[2]
ind = (ind[0], ind[1]-1, ind[2]-1)
elif val & 16:
al[0] = records[rec1][ind[0]-1] + al[0]
al[1] = "_" + al[1]
al[2] = records[rec3][ind[2]-1] + al[2]
ind = (ind[0]-1, ind[1], ind[2]-1)
elif val & 8:
al[0] = records[rec1][ind[0]-1] + al[0]
al[1] = records[rec2][ind[1]-1] + al[1]
al[2] = "_" + al[2]
ind = (ind[0]-1, ind[1]-1, ind[2])
elif val & 4:
al[0] = "_" + al[0]
al[1] = "_" + al[1]
al[2] = records[rec3][ind[2]-1] + al[2]
ind = (ind[0], ind[1], ind[2]-1)
elif val & 2:
al[0] = "_" + al[0]
al[1] = records[rec2][ind[1]-1] + al[1]
al[2] = "_" + al[2]
ind = (ind[0], ind[1]-1, ind[2])
elif val & 1:
al[0] = records[rec1][ind[0]-1] + al[0]
al[1] = "_" + al[1]
al[2] = "_" + al[2]
ind = (ind[0]-1, ind[1], ind[2])
val = traceback[ind]
print(al[1])
print(al[0])
print(al[2])
| 36.938547 | 366 | 0.515729 |
5cbfe102e231207be7dd5736eeb789e06f39b5f8 | 39,028 | asm | Assembly | Library/Text/TextAttr/taParaAttr.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/Text/TextAttr/taParaAttr.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/Text/TextAttr/taParaAttr.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: User/Text
FILE: textMethodParaAttr.asm
METHODS:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
DESCRIPTION:
This file contains method handlers for paraAttr methods
$Id: taParaAttr.asm,v 1.1 97/04/07 11:18:48 newdeal Exp $
------------------------------------------------------------------------------@
TextAttributes segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: VisTextSetSelectedTab -- MSG_VIS_TEXT_SET_SELECTED_TAB
for VisTextClass
DESCRIPTION: Set the selected tab
PASS:
*ds:si - instance data
es - segment of VisTextClass
ax - The message
cx - selected tab
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 4/ 8/92 Initial version
------------------------------------------------------------------------------@
VisTextSetSelectedTab proc far ; MSG_VIS_TEXT_SET_SELECTED_TAB
mov dx, cx
mov ax, ATTR_VIS_TEXT_SELECTED_TAB
call ObjVarFindData
jnc addNew
cmp dx, ds:[bx]
jz done
common:
mov ds:[bx], dx
mov ax, mask VTNF_PARA_ATTR
call TA_SendNotification
done:
ret
addNew:
mov cx, size word
call ObjVarAddData
jmp common
VisTextSetSelectedTab endp
COMMENT @----------------------------------------------------------------------
METHOD: VisTextSetParaAttrByDefault --
MSG_VIS_TEXT_SET_PARA_ATTR_BY_DEFAULT for VisTextClass
DESCRIPTION: Set the entire paraAttr structure for the selected area to a
default value. If the object does not have multiple paraAttrs,
set the paraAttr for the entire object.
PASS:
*ds:si - instance data (VisTextInstance)
ss:bp - VisTextSetParaAttrByDefaultParams
RETURN:
none
DESTROYED:
ax, bx, cx, dx, di, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
SetParaAttrFrame struct
SPAF_range VisTextRange
SPAF_paraAttr VisTextMaxParaAttr
SetParaAttrFrame ends
VisTextSetParaAttrByDefault proc far
; MSG_VIS_TEXT_SET_PARA_ATTR_BY_DEFAULT
class VisTextClass
push bp
mov ax, ss:[bp].VTSPABDP_paraAttr
; allocate a temporary structure
sub sp, size SetParaAttrFrame
segmov es, ss, cx ;stack segment is also in cx
mov di, sp ;es:di = dest
push si, ds
mov ds, cx
mov si, bp ;ds:si = source
mov cx, (size VisTextRange)/2
rep movsw
pop si, ds
; get default into structure, set up frame
lea bp, ss:[di-(size VisTextRange)].SPAF_paraAttr
call TextMapDefaultParaAttr
sub bp, offset SPAF_paraAttr
call SetParaAttrCommon
add sp, size SetParaAttrFrame
pop bp
ret
VisTextSetParaAttrByDefault endp
COMMENT @----------------------------------------------------------------------
METHOD: VisTextSetParaAttrByToken --
MSG_VIS_TEXT_SET_PARA_ATTR_BY_TOKEN for VisTextClass
DESCRIPTION: Set the entire paraAttr structure for the selected area to a
given token.
PASS:
*ds:si - instance data (VisTextInstance)
ss:bp - VisTextSetParaAttrByTokenParams
RETURN:
none
DESTROYED:
ax, bx, cx, dx, di, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
VisTextSetParaAttrByToken proc far
; MSG_VIS_TEXT_SET_PARA_ATTR_BY_TOKEN
class VisTextClass
; unhilite and get the range of the selected area
call UnHiliteAndFixupParaAttrRange
push bx ;save vm file
mov ax, offset FormattingString
call TU_StartChainIfUndoable
mov ax, ss:[bp].VTSPABTP_paraAttr
mov bx, offset VTI_paraAttrRuns
clr cx
EC < call ECCheckRun >
call ModifyRun
EC < call ECCheckRun >
call UpdateLastRunPositionByRunOffset
call TU_EndChainIfUndoable
; reflect the change
pop bx
call ReflectChangeUpdateGeneric
ret
VisTextSetParaAttrByToken endp
COMMENT @----------------------------------------------------------------------
METHOD: VisTextSetParaAttr -- MSG_VIS_TEXT_SET_PARA_ATTR for VisTextClass
DESCRIPTION: Set the entire paraAttr structure for the selected area. If the
object does not have multiple paraAttrs, set the paraAttr for the
entire object.
PASS:
*ds:si - instance data (VisTextInstance)
ss:bp - VisTextSetParaAttrParams structure
RETURN:
none
DESTROYED:
ax, bx, cx, dx, di, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
John 11/90 Fixed to handle paragraphs across page
boundaries.
------------------------------------------------------------------------------@
VisTextSetParaAttr proc far ; MSG_VIS_TEXT_SET_PARA_ATTR
class VisTextClass
if ERROR_CHECK
;
; Validate that the para attr is not in a movable code segment
;
FXIP< push bx, si >
FXIP< movdw bxsi, ss:[bp].VTSPAP_paraAttr >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< pop bx, si >
endif
; copy charAttr onto the stack
push bp
sub sp, size SetParaAttrFrame
segmov es, ss
mov di, sp
push si, ds
segmov ds, ss
mov si, bp
mov cx, (size VisTextRange) / 2
rep movsw ;copy range
lds si, ss:[bp].VTSPAP_paraAttr
mov cx, (size VisTextMaxParaAttr) / 2
rep movsw
pop si, ds
mov bp, sp
call SetParaAttrCommon
add sp, size SetParaAttrFrame
pop bp
ret
VisTextSetParaAttr endp
;---
SetParaAttrCommon proc far
class VisTextClass
; unhilite and get the range of the selected area to change
mov bx, mask VTRC_PARAGRAPH_CHANGE
call UnHiliteAndFixupParaAttrRange
push bx ;save vm file
EC < add bp, offset SPAF_paraAttr >
EC < call ECCheckParaAttr >
EC < sub bp, offset SPAF_paraAttr >
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].VTI_storageFlags, mask VTSF_MULTIPLE_PARA_ATTRS
jnz multiple
; Single charAttr -- set it
add bp, offset SPAF_paraAttr
call SetSingleParaAttr
sub bp, offset SPAF_paraAttr
jmp done
; Multiple paraAttrs -- add the paraAttrs
multiple:
mov bx, offset VTI_paraAttrRuns
call SetCharAttrOrParaAttrMultiple
; reflect the change
done:
; expand the range to include everything that needs to be invalidated
mov bx, mask VTRC_PARAGRAPH_CHANGE \
or mask VTRC_PARA_ATTR_BORDER_CHANGE
call TA_GetTextRange
pop bx
call ReflectChangeUpdateGeneric
ret
SetParaAttrCommon endp
COMMENT @----------------------------------------------------------------------
METHOD: VisTextGetParaAttr -- MSG_VIS_TEXT_GET_PARA_ATTR for VisTextClass
DESCRIPTION: Return the paraAttr structure for the selected area.
PASS:
*ds:si - instance data (VisTextInstance)
dx - size VisTextGetAttrParams (if called remotely)
ss:bp - VisTextGetAttrParams structure
RETURN:
ax - paraAttr token (CA_NULL_ELEMENT if multiple)
buffer - filled
DESTROYED:
bx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
VTGPA_Frame struct
VTGPA_element VisTextMaxParaAttr <>
; the following fields are pushed on the stack
VTGPA_passedFrame word ;frame passed
VTGPA_Frame ends
VisTextGetParaAttr proc far ; MSG_VIS_TEXT_GET_PARA_ATTR
class VisTextClass
if ERROR_CHECK
;
; Validate that the char attr is *not* in a movable code segment
;
FXIP< push bx, si >
FXIP< movdw bxsi, ss:[bp].VTGAP_attr >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< pop bx, si >
endif
push si, ds
; zero out return values
test ss:[bp].VTGAP_flags, mask VTGAF_MERGE_WITH_PASSED
jnz skipZero
les di, ss:[bp].VTGAP_return
clr ax
stosw
stosw
stosw
stosw
skipZero:
; allocate stack space and save vars
movdw dxax, ss:[bp].VTR_start
mov di, bp
push bp ;passed frame
sub sp, (size VTGPA_Frame)-2
mov bp, sp
; if we are to merge with the passed attributes then copy the passed
; structure in
test ss:[di].VTGAP_flags, mask VTGAF_MERGE_WITH_PASSED
jz skipCopy
push si, di, ds, es
lds si, ss:[di].VTGAP_attr ;ds:si = source
segmov es, ss
mov di, bp ;es:di = dest
mov cx, (size VisTextParaAttr) / 2
rep movsw
pop si, di, ds, es
skipCopy:
mov bx, ds:[si]
add bx, ds:[bx].Vis_offset
test ds:[bx].VTI_storageFlags, mask VTSF_MULTIPLE_PARA_ATTRS
jnz multiple
; one paraAttr -- get it
; ss:bp = VTGPA_Frame, ss:di = VisTextGetAttrParams
call GetSingleParaAttr
test ss:[di].VTGAP_flags, mask VTGAF_MERGE_WITH_PASSED
jnz oneRun
jmp done
multiple:
; ss:bp = VTGCA_Frame, ss:di = VisTextGetAttrParams
xchg bp, di ;ss:di = VTGPA_Frame
;ss:bp = VisTextGetAttrParams
call FixupParaAttrRange
clr bx
call TA_GetTextRange
; first fill the buffer with the first run
movdw dxax, ss:[bp].VTR_start
cmpdw dxax, ss:[bp].VTR_end ;if area selected then
xchg bp, di ;ss:bp = VTGPA_Frame
;ss:di = VisTextGetAttrParams
push si, ds
mov bx, offset VTI_paraAttrRuns
call GetRunForPosition ;returns cx = token
call GetElement
; if (selectionEnd >= run.end) {
; selection in one run, return token
; } else {
; selection in more than one run, return 0
; }
push bx
call RunArrayNext ;dxax = next run position
pop bx
call RunArrayUnlock
pop si, ds
mov di, ss:[bp].VTGPA_passedFrame
cmpdw dxax, ss:[di].VTR_end
mov_tr ax, bx ;ax = token
jae oneRun
; use enumeration function to scan all runs
mov dx, offset GetParaAttrCallback
xchg di, bp ;ss:di = frame, ss:bp = range
mov bx, offset VTI_paraAttrRuns
call EnumRunsInRange
xchg di, bp ;ss:bp = frame, ss:di = frame
mov ax, CA_NULL_ELEMENT ;return multiple tokens
jmp done
oneRun:
test ss:[di].VTGAP_flags, mask VTGAF_MERGE_WITH_PASSED
jz done
; diff this single structure with the passed structure
push di
movdw dxbx, ss:[di].VTGAP_return ;dx:bx=VisTextParaAttrDiffs
lds si, ss:[di].VTGAP_attr ;dssi = passed
segmov es, ss
mov di, bp ;es:di = single attr
call DiffParaAttr
pop di
done:
; fill the destination buffer
segmov ds, ss ;ds:si = source
mov si, bp
les di, ss:[di].VTGAP_attr ;es:di = dest
CalcParaAttrSize <ds:[si]>, cx
shr cx
rep movsw
; recover local space
add sp, (size VTGPA_Frame)-2
pop bp
pop si, ds
ret
VisTextGetParaAttr endp
COMMENT @----------------------------------------------------------------------
FUNCTION: GetParaAttrCallback
DESCRIPTION: Mark the differences between the given paraAttr and the base
paraAttr
CALLED BY: INTERNAL -- Callback from EnumRunsInRange
(from VisTextGetParaAttr)
PASS:
ss:bp - element from run
ss:di - VTGPA_Frame
RETURN:
DESTROYED:
ax, bx, cx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
GetParaAttrCallback proc near
; load parameters and call the diff routine
segmov es, ss ;es:di = element #2
segmov ds, es
mov si, bp ;ds:si = element #1
mov bx, ss:[di].VTGPA_passedFrame ;ss:bx=VisTextGetCharAttrParams
mov dx, ss:[bx].VTGAP_return.segment
mov bx, ss:[bx].VTGAP_return.offset ;dx:bx=VisTextCharAttrDiffs
call DiffParaAttr
ret
GetParaAttrCallback endp
COMMENT @----------------------------------------------------------------------
FUNCTION: DiffParaAttr
DESCRIPTION: Compute the difference between two paragraph attribute
structures
CALLED BY: INTERNAL
PASS:
ds:si - para attr #1
es:di - para attr #2
dx:bx - VisTextParaAttrDiffs to "or" results into
RETURN:
dx:bx - structure updated
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 12/30/91 Initial version
------------------------------------------------------------------------------@
DiffParaAttr proc far uses ax, cx
.enter
clr cx
; compare names
mov ax, ds:[si].VTPA_meta.SSEH_style
cmp ax, es:[di].VTPA_meta.SSEH_style
jz sameName
ornf cx, mask VTPAF_MULTIPLE_STYLES
sameName:
; compare left margins
mov ax, ds:[si].VTPA_leftMargin
cmp ax, es:[di].VTPA_leftMargin
jz sameLeftMargin
ornf cx, mask VTPAF_MULTIPLE_LEFT_MARGINS
sameLeftMargin:
; compare right margins
mov ax, ds:[si].VTPA_rightMargin
cmp ax, es:[di].VTPA_rightMargin
jz sameRightMargin
ornf cx, mask VTPAF_MULTIPLE_RIGHT_MARGINS
sameRightMargin:
; compare para margins
mov ax,ds:[si].VTPA_paraMargin
cmp ax,es:[di].VTPA_paraMargin
jz sameParaMargin
ornf cx, mask VTPAF_MULTIPLE_PARA_MARGINS
sameParaMargin:
; compare line spacings
mov ax, {word} ds:[si].VTPA_lineSpacing
cmp ax, {word} es:[di].VTPA_lineSpacing
jz sameLineSpacing
ornf cx, mask VTPAF_MULTIPLE_LINE_SPACINGS
sameLineSpacing:
; compare extra leadings
mov ax, ds:[si].VTPA_leading
cmp ax, es:[di].VTPA_leading
jz sameLeading
ornf cx, mask VTPAF_MULTIPLE_LEADINGS
sameLeading:
; compare default tabs
mov ax, ds:[si].VTPA_defaultTabs
cmp ax, es:[di].VTPA_defaultTabs
jz sameDefaultTabs
ornf cx, mask VTPAF_MULTIPLE_DEFAULT_TABS
sameDefaultTabs:
; compare top spacing
mov ax, ds:[si].VTPA_spaceOnTop
cmp ax, es:[di].VTPA_spaceOnTop
jz sameTopSpacing
ornf cx, mask VTPAF_MULTIPLE_TOP_SPACING
sameTopSpacing:
; compare bottom spacing
mov ax, ds:[si].VTPA_spaceOnBottom
cmp ax, es:[di].VTPA_spaceOnBottom
jz sameBottomSpacing
ornf cx, mask VTPAF_MULTIPLE_BOTTOM_SPACING
sameBottomSpacing:
; compare background colors
mov ax, ds:[si].VTPA_bgColor.low
cmp ax, es:[di].VTPA_bgColor.low
jnz diffColor
mov ax, ds:[si].VTPA_bgColor.high
cmp ax, es:[di].VTPA_bgColor.high
jz sameColor
diffColor:
ornf cx, mask VTPAF_MULTIPLE_BG_COLORS
sameColor:
; compare gray screens
mov al, ds:[si].VTPA_bgGrayScreen
cmp al, es:[di].VTPA_bgGrayScreen
jz sameGrayScreen
ornf cx, mask VTPAF_MULTIPLE_BG_GRAY_SCREENS
sameGrayScreen:
; compare hatches
mov ax, {word} ds:[si].VTPA_bgPattern
cmp ax, {word} es:[di].VTPA_bgPattern
jz sameBGPattern
ornf cx,mask VTPAF_MULTIPLE_BG_PATTERNS
sameBGPattern:
; compare tab lists
push cx, dx, si, di
clr cx
mov cl, ds:[si].VTPA_numberOfTabs
cmp cl, es:[di].VTPA_numberOfTabs
jnz differentTabs
tst cl
jz sameTabs ;carry clear
mov ax, (size Tab) / 2
mul cx ;ax = list size in words
mov_tr cx, ax
add si, offset VTPA_tabList
add di, offset VTPA_tabList
repe cmpsw
clc
jz sameTabs
differentTabs:
stc
sameTabs:
pop cx, dx, si, di
jnc 40$
ornf cx, mask VTPAF_MULTIPLE_TAB_LISTS
40$:
; compare prepend characters
mov ax, {word} ds:[si].VTPA_prependChars
cmp ax, {word} es:[di].VTPA_prependChars
jnz diffPrependChars
mov ax, {word} ds:[si].VTPA_prependChars+2
cmp ax, {word} es:[di].VTPA_prependChars+2
jz samePrependChars
diffPrependChars:
ornf cx, mask VTPAF_MULTIPLE_PREPEND_CHARS
samePrependChars:
; compare paragraph numbers
mov ax, ds:[si].VTPA_startingParaNumber
cmp ax, es:[di].VTPA_startingParaNumber
jz sameParaNumbers
ornf cx, mask VTPAF_MULTIPLE_STARTING_PARA_NUMBERS
sameParaNumbers:
; compare next styles
mov ax, ds:[si].VTPA_nextStyle
cmp ax, es:[di].VTPA_nextStyle
jz sameNextStyles
ornf cx, mask VTPAF_MULTIPLE_NEXT_STYLES
sameNextStyles:
push ds
mov ds, dx
or ds:[bx].VTPAD_diffs, cx
pop ds
;----------
clr cx
; compare border sides
push bx
mov ax, ds:[si].VTPA_borderFlags
xor ax, es:[di].VTPA_borderFlags
mov bx, ax
and bx, (mask VTPBF_LEFT or mask VTPBF_TOP or mask VTPBF_RIGHT \
or mask VTPBF_BOTTOM)
or cx, bx
pop bx
; compare border anchors
test ax, mask VTPBF_ANCHOR
jz sameBorderAnchors
ornf cx, mask VTPABF_MULTIPLE_BORDER_ANCHORS
sameBorderAnchors:
; compare border double flags
test ax, mask VTPBF_DOUBLE
jz sameBorderDoubles
ornf cx, mask VTPABF_MULTIPLE_BORDER_DOUBLES
sameBorderDoubles:
; compare border inner flags
test ax, mask VTPBF_DRAW_INNER_LINES
jz sameBorderInnerFlags
ornf cx, mask VTPABF_MULTIPLE_BORDER_DRAW_INNERS
sameBorderInnerFlags:
; compare border widths
mov al, ds:[si].VTPA_borderWidth
cmp al, es:[di].VTPA_borderWidth
jz sameBorderWidths
ornf cx, mask VTPABF_MULTIPLE_BORDER_WIDTHS
sameBorderWidths:
; compare border spacing
mov al, ds:[si].VTPA_borderSpacing
cmp al, es:[di].VTPA_borderSpacing
jz sameBorderSpacings
ornf cx, mask VTPABF_MULTIPLE_BORDER_SPACINGS
sameBorderSpacings:
; compare border shadows
mov al, ds:[si].VTPA_borderShadow
cmp al, es:[di].VTPA_borderShadow
jz sameBorderShadows
ornf cx, mask VTPABF_MULTIPLE_BORDER_SHADOWS
sameBorderShadows:
; compare border colors
mov ax, ds:[si].VTPA_borderColor.low
cmp ax, es:[di].VTPA_borderColor.low
jnz diffBorderColor
mov ax, ds:[si].VTPA_borderColor.high
cmp ax, es:[di].VTPA_borderColor.high
jz sameBorderColor
diffBorderColor:
ornf cx, mask VTPABF_MULTIPLE_BORDER_COLORS
sameBorderColor:
; compare gray screens
mov al, ds:[si].VTPA_borderGrayScreen
cmp al, es:[di].VTPA_borderGrayScreen
jz sameBorderGrayScreen
ornf cx, mask VTPABF_MULTIPLE_BORDER_GRAY_SCREENS
sameBorderGrayScreen:
; compare hatches
mov ax, {word} ds:[si].VTPA_borderPattern
cmp ax, {word} es:[di].VTPA_borderPattern
jz sameBorderPattern
ornf cx,mask VTPABF_MULTIPLE_BORDER_PATTERNS
sameBorderPattern:
mov ax, ds:[si].VTPA_hyphenationInfo
xor ax, es:[di].VTPA_hyphenationInfo
push ds
mov ds, dx
or ds:[bx].VTPAD_borderDiffs, cx
or ds:[bx].VTPAD_hyphenationInfo, ax
pop ds
;----------
mov ax, ds:[si].VTPA_dropCapInfo
xor ax, es:[di].VTPA_dropCapInfo
mov cx, ds:[si].VTPA_attributes
xor cx, es:[di].VTPA_attributes
push ds
mov ds, dx
or ds:[bx].VTPAD_dropCapInfo, ax
or ds:[bx].VTPAD_attributes, cx
pop ds
;----------
clr cx
; compare next styles
mov al, ds:[si].VTPA_language
cmp al, es:[di].VTPA_language
jz sameLanguage
ornf cx, mask VTPAF2_MULTIPLE_LANGUAGES
sameLanguage:
if CHAR_JUSTIFICATION
;
; compare full justification types
;
mov al, ds:[si].VTPA_miscMode
cmp al, es:[di].VTPA_miscMode
jz sameJustType
ornf cx, mask VTPAF2_MULTIPLE_JUSTIFICATION_TYPES
sameJustType:
endif
mov al, ds:[si].VTPA_keepInfo
xor al, es:[di].VTPA_keepInfo
push ds
mov ds, dx
or ds:[bx].VTPAD_diffs2, cx
or ds:[bx].VTPAD_keepInfo, al
pop ds
.leave
ret
DiffParaAttr endp
COMMENT @----------------------------------------------------------------------
METHOD: VisTextParaAttrAdd -- MSG_VIS_TEXT_ADD_PARA_ATTR for VisTextClass
DESCRIPTION: Add a given paraAttr to the paraAttr array and initialize its
reference count to one.
*** Note: Calling this method on a text object that does not have
*** multiple paraAttrs will result in a fatal error.
PASS:
*ds:si - instance data (VisTextInstance)
dx - size of paraAttr passed (if called remotely)
ss:bp - VisTextParaAttr
RETURN:
ax - paraAttr token
DESTROYED:
dx, si, ds
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
VisTextParaAttrAdd proc far ; MSG_VIS_TEXT_ADD_PARA_ATTR
class VisTextClass
mov ax, offset AddElement
FALL_THRU AddRemoveParaAttrCommon
VisTextParaAttrAdd endp
;---
AddRemoveParaAttrCommon proc far
class VisTextClass
mov bx, offset VTI_paraAttrRuns
call LockAndCall ;ax = token
ret
AddRemoveParaAttrCommon endp
COMMENT @----------------------------------------------------------------------
METHOD: VisTextParaAttrRemove -- MSG_VIS_TEXT_REMOVE_PARA_ATTR for VisTextClass
DESCRIPTION: Remove a given paraAttr from the paraAttr array.
*** Note: Calling this method on a text object that does not have
*** multiple paraAttrs will result in a fatal error.
PASS:
*ds:si - instance data (VisTextInstance)
dx - size of paraAttr passed (if called remotely)
cx - token to remove
RETURN:
none
DESTROYED:
dx, si, ds
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
VisTextParaAttrRemove proc far ; MSG_VIS_TEXT_REMOVE_PARA_ATTR
class VisTextClass
mov ax, offset RemoveElement
GOTO AddRemoveParaAttrCommon
VisTextParaAttrRemove endp
;-----------------------------------------------------------------------------
; Utility routines below here
;-----------------------------------------------------------------------------
COMMENT @----------------------------------------------------------------------
FUNCTION: ParaAttrChangeCommon
DESCRIPTION: Do a change for a charAttr routine
CALLED BY: INTERNAL
PASS:
*ds:si - instance data (VisTextInstance)
ss:bp - VisTextRange
ax, dx - callback data
di - offset of callback
bx - VisTextRangeContext for invalidation
RETURN:
none
DESTROYED:
ax, bx, cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 11/89 Initial version
------------------------------------------------------------------------------@
ParaAttrChangeCommon proc far
clr bx
GOTO DoParaAttrChangeCommon
ParaAttrChangeCommon endp
;---
ParaAttrBorderChangeCommon proc far
mov bx, mask VTRC_PARAGRAPH_CHANGE or mask VTRC_PARA_ATTR_BORDER_CHANGE
FALL_THRU DoParaAttrChangeCommon
ParaAttrBorderChangeCommon endp
;---
DoParaAttrChangeCommon proc far
class VisTextClass
push bx
call UnHiliteAndFixupParaAttrRange
push bx ;save vm file
mov cx, cs ;segment of callback
push di
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].VTI_storageFlags, mask VTSF_MULTIPLE_PARA_ATTRS
pop di
jnz multiple
call DoSingleParaAttrChange
clr ax
clrdw ss:[bp].VTR_start, ax
movdw ss:[bp].VTR_end, TEXT_ADDRESS_PAST_END
jmp done
; Multiple paraAttrs -- add the paraAttr
multiple:
; modify the paraAttr run
push ax
mov ax, offset FormattingString
call TU_StartChainIfUndoable
pop ax
mov bx, offset VTI_paraAttrRuns
EC < call ECCheckRun >
call ModifyRun
EC < call ECCheckRun >
call UpdateLastRunPositionByRunOffset
call TU_EndChainIfUndoable
done:
pop ax ;recover vm file
pop bx ;recover context
tst bx
jz noInvalidateContext
call TA_GetTextRange
noInvalidateContext:
; since we are changing a paragraph related thing we *must* have
; a non-zero range to recalculate (unless there is no text al all)
push ax
movdw dxax, ss:[bp].VTR_start
cmpdw dxax, ss:[bp].VTR_end
jnz noRangeProblem
tstdw dxax
jz noRangeProblem
decdw dxax
movdw ss:[bp].VTR_start, dxax
noRangeProblem:
pop bx ;pass vm file
GOTO ReflectChangeUpdateGeneric
DoParaAttrChangeCommon endp
COMMENT @----------------------------------------------------------------------
FUNCTION: SetSingleParaAttr
DESCRIPTION: Set the paraAttr for a single paraAttr text object
CALLED BY: INTERNAL
PASS:
*ds:si - VisTextInstance
ss:bp - VisTextParaAttr
RETURN:
none
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
SetSingleParaAttr proc near uses ax, cx, si, di
class VisTextClass
.enter
EC < call ECCheckParaAttr >
mov di, ds:[si] ;ds:si = instance
add di, ds:[di].Vis_offset
; check for a default
call TextFindDefaultParaAttr
jnc noDefault
; its a default -- remove the chunk
test ds:[di].VTI_storageFlags, mask VTSF_DEFAULT_PARA_ATTR
xchg ax,ds:[di].VTI_paraAttrRuns
jnz done
ornf ds:[di].VTI_storageFlags, mask VTSF_DEFAULT_PARA_ATTR
call ObjFreeChunk
jmp done
; not a default paraAttr -- must make a chunk
noDefault:
CalcParaAttrSize <ss:[bp]>, cx
test ds:[di].VTI_storageFlags, mask VTSF_DEFAULT_PARA_ATTR
mov ax, ds:[di].VTI_paraAttrRuns
jz chunkExists
; no chunk exists -- create one
mov ax, si
call ObjGetFlags
and al, mask OCF_IGNORE_DIRTY
or al, mask OCF_DIRTY
call LMemAlloc
mov di, ds:[si] ;ds:si = instance
add di, ds:[di].Vis_offset
and ds:[di].VTI_storageFlags, not mask VTSF_DEFAULT_PARA_ATTR
mov ds:[di].VTI_paraAttrRuns, ax
jmp common
; if the chunk exists realloc it to the correct size (since the size
; might have changed)
chunkExists:
call LMemReAlloc
; *ds:ax = chunk to set
common:
mov_tr di, ax
push ds, es
segmov es, ds ;es:di = dest
mov di, ds:[di]
segmov ds, ss ;ds:si = source
mov si, bp
rep movsb
pop ds, es
done:
.leave
ret
SetSingleParaAttr endp
COMMENT @----------------------------------------------------------------------
FUNCTION: DoSingleParaAttrChange
DESCRIPTION: Make a change to a text object with a single paraAttr
CALLED BY: INTERNAL
PASS:
*ds:si - VisTextObject
ss:bp - parameter structure
cx:di - callback routine to make change
ax, dx - data passed to callback
Callback routine:
PASS:
ss:bp - element
ss:di - parameter structure
ax, dx - modData
RETURN:
ss:bp - updated
DESTROYED:
ax, bx, cx, dx, si, di, bp, es
RETURN:
none
DESTROYED:
ax, bc, cx, dx, di, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
DSRC_frame struct
DSRC_paraAttr VisTextMaxParaAttr <>
DSRC_callback dword
DSRC_frame ends
DoSingleParaAttrChange proc near uses bp
.enter
; save calllback address in frame
push cx
push di
mov di, bp ;ss:di = passed frame
; allocate charAttr structure no stack
sub sp, (size DSRC_frame)-4
mov bp, sp
; get current paraAttr
call GetSingleParaAttr
; make the change
EC < tst cx >
EC < ERROR_Z CANNOT_SUBSTITUTE_IN_DO_SINGLE_PARA_ATTR_CHANGE >
push si, bp
call ss:[bp].DSRC_callback
pop si, bp
; get the new paraAttr
call SetSingleParaAttr
; recover stack space
add sp, size DSRC_frame
.leave
ret
DoSingleParaAttrChange endp
COMMENT @----------------------------------------------------------------------
FUNCTION: GetSingleParaAttr
DESCRIPTION: Get the paraAttr for a single paraAttr text object
CALLED BY: CreateParaAttrRuns, DoSingleParaAttrChange, ParaAttrRunGetParaAttr,
VisTextGetParaAttr
PASS:
*ds:si - VisTextInstance
ss:bp - buffer for VisTextParaAttr
RETURN:
buffer - filled
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
TextFixed segment resource
GetSingleParaAttr proc far
class VisTextClass
uses ax, cx, di, si, es
.enter
call TextFixed_DerefVis_DI
test ds:[di].VTI_storageFlags,mask VTSF_DEFAULT_PARA_ATTR
mov si, ds:[di].VTI_paraAttrRuns
jnz default
; not default paraAttr -- load from chunk
mov si, ds:[si] ;ds:si = VisTextParaAttr
segmov es, ss ;es:di = dest
mov di, bp
ChunkSizePtr ds, si, cx
rep movsb
jmp done
; default paraAttr -- use routine
default:
mov_tr ax, si
call TextMapDefaultParaAttr
done:
EC < call ECCheckParaAttr >
.leave
ret
GetSingleParaAttr endp
COMMENT @----------------------------------------------------------------------
FUNCTION: TextMapDefaultParaAttr
DESCRIPTION: Load a defualt paraAttr
CALLED BY: INTERNAL
PASS:
ax - VisTextDefaultParaAttr
ss:bp - buffer for VisTextParaAttr
RETURN:
buffer - set
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
TextMapDefaultParaAttr proc far
uses ax, bx, cx, di, si, es
.enter
mov_tr bx, ax ;bx = default
; zero out the entire paraAttr
mov cx, (size VisTextParaAttr)/2
segmov es, ss
mov di, bp
clr ax
rep stosw
mov ss:[bp].VTPA_meta.SSEH_style, CA_NULL_ELEMENT
mov ss:[bp].VTPA_lineSpacing.BBF_int, 1
mov ss:[bp].VTPA_language, SL_ENGLISH
mov ss:[bp].VTPA_startingParaNumber,
VIS_TEXT_DEFAULT_STARTING_NUMBER
; set the left margin
mov ax, bx
and ax, mask VTDPA_LEFT_MARGIN
mov cl, offset VTDPA_LEFT_MARGIN
shr ax, cl
mov cx, (PIXELS_PER_INCH/2)*8
mul cx
mov ss:[bp].VTPA_leftMargin, ax
; set the right margin
mov ax, bx
and ax, mask VTDPA_RIGHT_MARGIN
mov cl, offset VTDPA_RIGHT_MARGIN
shr ax, cl
mov cx, (PIXELS_PER_INCH/2)*8
mul cx
mov ss:[bp].VTPA_rightMargin, ax
; set the para margin
mov ax, bx
and ax, mask VTDPA_PARA_MARGIN
mov cl, offset VTDPA_PARA_MARGIN
shr ax, cl
mov cx, (PIXELS_PER_INCH/2)*8
mul cx
mov ss:[bp].VTPA_paraMargin, ax
; set the default tabs
mov ax, bx
and ax, mask VTDPA_DEFAULT_TABS
mov cl, (offset VTDPA_DEFAULT_TABS) - 1
shr ax, cl
mov_tr si, ax
mov ax, cs:[si].defaultDefaultTabs
mov ss:[bp].VTPA_defaultTabs, ax
; set the justification
and bx, mask VTPAA_JUSTIFICATION
mov ss:[bp].VTPA_attributes, bx
; set the bg color
mov ss:[bp].VTPA_bgColor.low, C_WHITE
mov ss:[bp].VTPA_bgGrayScreen, SDM_0
; set the border color
mov ss:[bp].VTPA_borderColor.CQ_redOrIndex, C_BLACK
mov ss:[bp].VTPA_borderGrayScreen, SDM_100
mov ss:[bp].VTPA_startingParaNumber,
VIS_TEXT_DEFAULT_STARTING_NUMBER
mov ss:[bp].VTPA_borderWidth, 1*8
mov ss:[bp].VTPA_borderSpacing, 2*8
mov ss:[bp].VTPA_borderShadow, 1*8
mov ss:[bp].VTPA_hyphenationInfo, VisTextHyphenationInfo <,,,>
mov ss:[bp].VTPA_dropCapInfo, VisTextDropCapInfo <,,>
mov ss:[bp].VTPA_nextStyle, CA_NULL_ELEMENT
EC < call ECCheckParaAttr >
.leave
ret
TextMapDefaultParaAttr endp
defaultDefaultTabs word \
0,
(PIXELS_PER_INCH / 2) * 8,
PIXELS_PER_INCH * 8,
227
TextFixed ends
COMMENT @----------------------------------------------------------------------
FUNCTION: TextFindDefaultParaAttr
DESCRIPTION: Given an paraAttr structure, determine if it is one of the
default paraAttrs
CALLED BY: INTERNAL
PASS:
ss:bp - VisTextParaAttr
RETURN:
carry - set if paraAttr is one of the default paraAttrs
ax - VisTextDefaultParaAttr
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 9/89 Initial version
------------------------------------------------------------------------------@
TextFindDefaultParaAttr proc far uses bx, cx, dx
.enter
EC < call ECCheckParaAttr >
; test many things that must be 0
mov ax, {word} ss:[bp].VTPA_spaceOnTop
or ax, {word} ss:[bp].VTPA_spaceOnBottom
or al, ss:[bp].VTPA_numberOfTabs
or ax, ss:[bp].VTPA_borderFlags
or ax, ss:[bp].VTPA_leading
or ax, {word} ss:[bp].VTPA_prependChars
or ax, {word} ss:[bp].VTPA_prependChars+2
or al, ss:[bp].VTPA_keepInfo
tst ax
jz 10$
toNoDefault:
jmp noDefault
10$:
cmp ss:[bp].VTPA_startingParaNumber,
VIS_TEXT_DEFAULT_STARTING_NUMBER
jnz toNoDefault
cmp ss:[bp].VTPA_borderWidth, 1*8
jnz toNoDefault
cmp ss:[bp].VTPA_borderSpacing, 2*8
jnz toNoDefault
cmp ss:[bp].VTPA_borderShadow, 1*8
jnz toNoDefault
cmp ss:[bp].VTPA_hyphenationInfo, VisTextHyphenationInfo <,,,>
jnz toNoDefault
cmp ss:[bp].VTPA_dropCapInfo, VisTextDropCapInfo <,,>
jnz toNoDefault
cmp ss:[bp].VTPA_nextStyle, CA_NULL_ELEMENT
jnz toNoDefault
cmp ss:[bp].VTPA_bgGrayScreen, SDM_0
jne toNoDefault
cmp ss:[bp].VTPA_borderGrayScreen, SDM_100
jne toNoDefault
; test the line spacing
cmp {word} ss:[bp].VTPA_lineSpacing,1 * 256
jne noDefault
; test the bg color
cmp ss:[bp].VTPA_bgColor.low, C_WHITE
jne noDefault
; test the border color
cmp ss:[bp].VTPA_borderColor.low, C_BLACK
jne noDefault
; deal with the default tabs
mov ax, ss:[bp].VTPA_defaultTabs
mov bx, VTDDT_NONE shl offset VTDPA_DEFAULT_TABS
tst ax
jz gotDefaultTabs
mov bx, VTDDT_HALF_INCH shl offset VTDPA_DEFAULT_TABS
cmp ax, (PIXELS_PER_INCH / 2) * 8
jz gotDefaultTabs
mov bx, VTDDT_INCH shl offset VTDPA_DEFAULT_TABS
cmp ax, PIXELS_PER_INCH * 8
jz gotDefaultTabs
mov bx, VTDDT_CENTIMETER shl offset VTDPA_DEFAULT_TABS
cmp ax, 227
jnz noDefault
gotDefaultTabs:
; test the left margin
mov ax, ss:[bp].VTPA_leftMargin
clr dx
mov cx, (PIXELS_PER_INCH/2)*8
div cx
tst dx
jnz noDefault
mov cl, offset VTDPA_LEFT_MARGIN
shl ax, cl
or bx, ax
; test the right margin
mov ax, ss:[bp].VTPA_rightMargin ;dx already 0
cmp ax, VIS_TEXT_MAX_PARA_WIDTH*8 ;test for special case
jz afterRightMargin
mov cx, (PIXELS_PER_INCH/2)*8
div cx
tst dx
jnz noDefault
mov cl, offset VTDPA_RIGHT_MARGIN
shl ax, cl
or bx, ax
afterRightMargin:
; test the para margin
mov ax, ss:[bp].VTPA_paraMargin
mov cx, (PIXELS_PER_INCH/2)*8
div cx
tst dx
jnz noDefault
mov cl, offset VTDPA_PARA_MARGIN
shl ax, cl
or bx, ax
; test the attributes
mov ax, ss:[bp].VTPA_attributes
test ax, not mask VTPAA_JUSTIFICATION
jnz noDefault
or ax, bx
; its a default
stc
done:
.leave
ret
; its not a default
noDefault:
clc
jmp done
TextFindDefaultParaAttr endp
TextAttributes ends
;============================================================================
;============================================================================
; Error checking code below
;============================================================================
TextEC segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: ECCheckParaAttr
DESCRIPTION: Make sure that a VisTextParaAttr structure is legal
CALLED BY: INTERNAL
PASS:
ss:bp - pointer to paraAttr on stack.
RETURN:
none
DESTROYED:
none -- FLAGS PRESERVED
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 1/90 Initial version
------------------------------------------------------------------------------@
if ERROR_CHECK
ECCheckParaAttr proc far uses ax, bx, cx, di, es
.enter
pushf
; reference count -- must be <= 10000
tst ss:[bp].VTPA_meta.SSEH_meta.REH_refCount.WAAH_high
ERROR_NZ VIS_TEXT_CHAR_ATTR_HAS_REF_COUNT_OVER_10000
cmp ss:[bp].VTPA_meta.SSEH_meta.REH_refCount.WAAH_low, 10000
ERROR_A VIS_TEXT_PARA_ATTR_HAS_REF_COUNT_OVER_10000
; margins must be < VIS_TEXT_MAX_PARA_ATTR_WIDTH
; (right-left) must be >= VIS_TEXT_MIN_LEFT_TO_RIGHT_MARGIN_DISTANCE
; (right-para) must be >= VIS_TEXT_MIN_LEFT_TO_RIGHT_MARGIN_DISTANCE
cmp ss:[bp].VTPA_leftMargin, VIS_TEXT_MAX_PARA_WIDTH*8
ERROR_A VIS_TEXT_ILLEGAL_LEFT_MARGIN
cmp ss:[bp].VTPA_paraMargin, VIS_TEXT_MAX_PARA_WIDTH*8
ERROR_A VIS_TEXT_ILLEGAL_PARA_MARGIN
cmp ss:[bp].VTPA_rightMargin, VIS_TEXT_MAX_PARA_WIDTH*8
ERROR_A VIS_TEXT_ILLEGAL_RIGHT_MARGIN
; line spacing must be <= VIS_TEXT_MAX_LINE_SPACING
cmp {word} ss:[bp].VTPA_lineSpacing, \
VIS_TEXT_MIN_NON_ZERO_LINE_SPACING
ERROR_B VIS_TEXT_ILLEGAL_LINE_SPACING
cmp {word} ss:[bp].VTPA_lineSpacing, VIS_TEXT_MAX_LINE_SPACING
ERROR_A VIS_TEXT_ILLEGAL_LINE_SPACING
; leading must be < VIS_TEXT_MAX_LEADING
cmp {word} ss:[bp].VTPA_leading, 0
jz 20$
cmp {word} ss:[bp].VTPA_leading, VIS_TEXT_MIN_NON_ZERO_LEADING
ERROR_B VIS_TEXT_ILLEGAL_LEADING
20$:
; Value is ThirteenIntThreeFrac, so multiply by 8
cmp {word} ss:[bp].VTPA_leading, VIS_TEXT_MAX_LEADING*8
ERROR_A VIS_TEXT_ILLEGAL_LEADING
; no checking for space on top/bottom
; check the attributes
test ss:[bp].VTPA_attributes, not VisTextParaAttrAttributes
ERROR_NZ VIS_TEXT_ILLEGAL_PARA_ATTR_ATTRIBUTE_BITS_SET
; check border flags
test ss:[bp].VTPA_borderFlags, not VisTextParaBorderFlags
ERROR_NZ VIS_TEXT_ILLEGAL_BORDER_BITS_SET
; check language
cmp ss:[bp].VTPA_language, StandardLanguage
ERROR_AE VIS_TEXT_ILLEGAL_LANGUAGE
; compare tabs
clr cx
mov cl, ss:[bp].VTPA_numberOfTabs
cmp cx, VIS_TEXT_MAX_TABS
ERROR_A VIS_TEXT_PARA_ATTR_HAS_TOO_MANY_TABS
jcxz noTabs
push bp
add bp, size VisTextParaAttr
clr ax
; ss:bp = tab, ax = minimum tab position (last tab)
tabLoop:
cmp ss:[bp].T_position, VIS_TEXT_MAX_PARA_WIDTH*8
ERROR_A VIS_TEXT_ILLEGAL_TAB_POSITION
add bp, size Tab
loop tabLoop
pop bp
noTabs:
; reserved -- must be 0
segmov es, ss
lea di, ss:[bp].VTPA_reserved
mov cx, size VTPA_reserved
clr ax
repe scasb
ERROR_NZ VIS_TEXT_PARA_ATTR_RESERVED_MUST_BE_0
popf
.leave
ret
ECCheckParaAttr endp
endif
TextEC ends
| 21.467547 | 81 | 0.656477 |
8976a51252748f2c91190d6b7be8a5486560970f | 127 | sql | SQL | sql/akash/alter-channel-table.sql | akashbachhania/jeet99 | f4084e294ae218758c9c0a6a3ab74e228b2f08a4 | [
"MIT"
] | null | null | null | sql/akash/alter-channel-table.sql | akashbachhania/jeet99 | f4084e294ae218758c9c0a6a3ab74e228b2f08a4 | [
"MIT"
] | null | null | null | sql/akash/alter-channel-table.sql | akashbachhania/jeet99 | f4084e294ae218758c9c0a6a3ab74e228b2f08a4 | [
"MIT"
] | null | null | null | ALTER TABLE `channel` ADD `group_type` VARCHAR(255) NOT NULL AFTER `image`, ADD `group_id` INT(11) NOT NULL AFTER `group_type`; | 127 | 127 | 0.748031 |
f750fe59e7be5935ab4fbcd3a38074f558d7032d | 46 | ps1 | PowerShell | sync.ps1 | terry-haire/dropbox-ignore | e0c5a7d76fe4d8b32ed5b0d67a732a3b489d52b4 | [
"Apache-2.0"
] | null | null | null | sync.ps1 | terry-haire/dropbox-ignore | e0c5a7d76fe4d8b32ed5b0d67a732a3b489d52b4 | [
"Apache-2.0"
] | null | null | null | sync.ps1 | terry-haire/dropbox-ignore | e0c5a7d76fe4d8b32ed5b0d67a732a3b489d52b4 | [
"Apache-2.0"
] | null | null | null | # TODO: Loop through all ignores in .dbignore
| 23 | 45 | 0.76087 |
cb6707dab1ac6fb6613ee27141be18e38a53dc48 | 13,448 | c | C | devel/bison-2.4.1/src/print-xml.c | myzhang1029/zmymingw | 4c6b6088fb8a03248a1e6d9d6126dfaf225ffa56 | [
"CC0-1.0"
] | null | null | null | devel/bison-2.4.1/src/print-xml.c | myzhang1029/zmymingw | 4c6b6088fb8a03248a1e6d9d6126dfaf225ffa56 | [
"CC0-1.0"
] | null | null | null | devel/bison-2.4.1/src/print-xml.c | myzhang1029/zmymingw | 4c6b6088fb8a03248a1e6d9d6126dfaf225ffa56 | [
"CC0-1.0"
] | null | null | null | /* Print an xml on generated parser, for Bison,
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
Bison is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Bison is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bison; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <config.h>
#include "system.h"
#include <stdarg.h>
#include <bitset.h>
#include <quotearg.h>
#include "LR0.h"
#include "closure.h"
#include "conflicts.h"
#include "files.h"
#include "getargs.h"
#include "gram.h"
#include "lalr.h"
#include "print.h"
#include "print-xml.h"
#include "reader.h"
#include "reduce.h"
#include "state.h"
#include "symtab.h"
#include "tables.h"
static bitset no_reduce_set;
struct escape_buf
{
char *ptr;
size_t size;
};
static struct escape_buf escape_bufs[2];
/*--------------------------------.
| Report information on a state. |
`--------------------------------*/
static void
print_core (FILE *out, int level, state *s)
{
size_t i;
item_number *sitems = s->items;
size_t snritems = s->nitems;
/* Output all the items of a state, not only its kernel. */
closure (sitems, snritems);
sitems = itemset;
snritems = nitemset;
if (!snritems) {
xml_puts (out, level, "<itemset/>");
return;
}
xml_puts (out, level, "<itemset>");
for (i = 0; i < snritems; i++)
{
bool printed = false;
item_number *sp;
item_number *sp1;
rule_number r;
sp1 = sp = ritem + sitems[i];
while (*sp >= 0)
sp++;
r = item_number_as_rule_number (*sp);
sp = rules[r].rhs;
/* Display the lookahead tokens? */
if (item_number_is_rule_number (*sp1))
{
reductions *reds = s->reductions;
int red = state_reduction_find (s, &rules[r]);
/* Print item with lookaheads if there are. */
if (reds->lookahead_tokens && red != -1)
{
xml_printf (out, level + 1,
"<item rule-number=\"%d\" point=\"%d\">",
rules[r].number, sp1 - sp);
state_rule_lookahead_tokens_print_xml (s, &rules[r],
out, level + 2);
xml_puts (out, level + 1, "</item>");
printed = true;
}
}
if (!printed)
{
xml_printf (out, level + 1,
"<item rule-number=\"%d\" point=\"%d\"/>",
rules[r].number,
sp1 - sp);
}
}
xml_puts (out, level, "</itemset>");
}
/*-----------------------------------------------------------.
| Report the shifts if DISPLAY_SHIFTS_P or the gotos of S on |
| OUT. |
`-----------------------------------------------------------*/
static void
print_transitions (state *s, FILE *out, int level)
{
transitions *trans = s->transitions;
int n = 0;
int i;
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i))
{
n++;
}
/* Nothing to report. */
if (!n) {
xml_puts (out, level, "<transitions/>");
return;
}
/* Report lookahead tokens and shifts. */
xml_puts (out, level, "<transitions>");
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i)
&& TRANSITION_IS_SHIFT (trans, i))
{
symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)];
char const *tag = sym->tag;
state *s1 = trans->states[i];
xml_printf (out, level + 1,
"<transition type=\"shift\" symbol=\"%s\" state=\"%d\"/>",
xml_escape (tag), s1->number);
}
for (i = 0; i < trans->num; i++)
if (!TRANSITION_IS_DISABLED (trans, i)
&& !TRANSITION_IS_SHIFT (trans, i))
{
symbol *sym = symbols[TRANSITION_SYMBOL (trans, i)];
char const *tag = sym->tag;
state *s1 = trans->states[i];
xml_printf (out, level + 1,
"<transition type=\"goto\" symbol=\"%s\" state=\"%d\"/>",
xml_escape (tag), s1->number);
}
xml_puts (out, level, "</transitions>");
}
/*--------------------------------------------------------.
| Report the explicit errors of S raised from %nonassoc. |
`--------------------------------------------------------*/
static void
print_errs (FILE *out, int level, state *s)
{
errs *errp = s->errs;
bool count = false;
int i;
for (i = 0; i < errp->num; ++i)
if (errp->symbols[i])
count = true;
/* Nothing to report. */
if (!count) {
xml_puts (out, level, "<errors/>");
return;
}
/* Report lookahead tokens and errors. */
xml_puts (out, level, "<errors>");
for (i = 0; i < errp->num; ++i)
if (errp->symbols[i])
{
char const *tag = errp->symbols[i]->tag;
xml_printf (out, level + 1,
"<error symbol=\"%s\">nonassociative</error>",
xml_escape (tag));
}
xml_puts (out, level, "</errors>");
}
/*-------------------------------------------------------------------------.
| Report a reduction of RULE on LOOKAHEAD_TOKEN (which can be `default'). |
| If not ENABLED, the rule is masked by a shift or a reduce (S/R and |
| R/R conflicts). |
`-------------------------------------------------------------------------*/
static void
print_reduction (FILE *out, int level, char const *lookahead_token,
rule *r, bool enabled)
{
if (r->number)
xml_printf (out, level,
"<reduction symbol=\"%s\" rule=\"%d\" enabled=\"%s\"/>",
xml_escape (lookahead_token),
r->number,
enabled ? "true" : "false");
else
xml_printf (out, level,
"<reduction symbol=\"%s\" rule=\"accept\" enabled=\"%s\"/>",
xml_escape (lookahead_token),
enabled ? "true" : "false");
}
/*-------------------------------------------.
| Report on OUT the reduction actions of S. |
`-------------------------------------------*/
static void
print_reductions (FILE *out, int level, state *s)
{
transitions *trans = s->transitions;
reductions *reds = s->reductions;
rule *default_rule = NULL;
int report = false;
int i, j;
if (reds->num == 0) {
xml_puts (out, level, "<reductions/>");
return;
}
if (yydefact[s->number] != 0)
default_rule = &rules[yydefact[s->number] - 1];
bitset_zero (no_reduce_set);
FOR_EACH_SHIFT (trans, i)
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
for (i = 0; i < s->errs->num; ++i)
if (s->errs->symbols[i])
bitset_set (no_reduce_set, s->errs->symbols[i]->number);
if (default_rule)
report = true;
if (reds->lookahead_tokens)
for (i = 0; i < ntokens; i++)
{
bool count = bitset_test (no_reduce_set, i);
for (j = 0; j < reds->num; ++j)
if (bitset_test (reds->lookahead_tokens[j], i))
{
if (! count)
{
if (reds->rules[j] != default_rule)
report = true;
count = true;
}
else
{
report = true;
}
}
}
/* Nothing to report. */
if (!report) {
xml_puts (out, level, "<reductions/>");
return;
}
xml_puts (out, level, "<reductions>");
/* Report lookahead tokens (or $default) and reductions. */
if (reds->lookahead_tokens)
for (i = 0; i < ntokens; i++)
{
bool defaulted = false;
bool count = bitset_test (no_reduce_set, i);
for (j = 0; j < reds->num; ++j)
if (bitset_test (reds->lookahead_tokens[j], i))
{
if (! count)
{
if (reds->rules[j] != default_rule)
print_reduction (out, level + 1, symbols[i]->tag,
reds->rules[j], true);
else
defaulted = true;
count = true;
}
else
{
if (defaulted)
print_reduction (out, level + 1, symbols[i]->tag,
default_rule, true);
defaulted = false;
print_reduction (out, level + 1, symbols[i]->tag,
reds->rules[j], false);
}
}
}
if (default_rule)
print_reduction (out, level + 1,
"$default", default_rule, true);
xml_puts (out, level, "</reductions>");
}
/*--------------------------------------------------------------.
| Report on OUT all the actions (shifts, gotos, reductions, and |
| explicit erros from %nonassoc) of S. |
`--------------------------------------------------------------*/
static void
print_actions (FILE *out, int level, state *s)
{
xml_puts (out, level, "<actions>");
print_transitions (s, out, level + 1);
print_errs (out, level + 1, s);
print_reductions (out, level + 1, s);
xml_puts (out, level, "</actions>");
}
/*----------------------------------.
| Report all the data on S on OUT. |
`----------------------------------*/
static void
print_state (FILE *out, int level, state *s)
{
fputc ('\n', out);
xml_printf (out, level, "<state number=\"%d\">", s->number);
print_core (out, level + 1, s);
print_actions (out, level + 1, s);
if (s->solved_conflicts_xml)
{
xml_puts (out, level + 1, "<solved-conflicts>");
fputs (s->solved_conflicts_xml, out);
xml_puts (out, level + 1, "</solved-conflicts>");
}
else
xml_puts (out, level + 1, "<solved-conflicts/>");
xml_puts (out, level, "</state>");
}
/*-----------------------------------------.
| Print information on the whole grammar. |
`-----------------------------------------*/
static void
print_grammar (FILE *out, int level)
{
symbol_number i;
fputc ('\n', out);
xml_puts (out, level, "<grammar>");
grammar_rules_print_xml (out, level);
/* Terminals */
xml_puts (out, level + 1, "<terminals>");
for (i = 0; i < max_user_token_number + 1; i++)
if (token_translations[i] != undeftoken->number)
{
char const *tag = symbols[token_translations[i]]->tag;
int precedence = symbols[token_translations[i]]->prec;
assoc associativity = symbols[token_translations[i]]->assoc;
xml_indent (out, level + 2);
fprintf (out,
"<terminal symbol-number=\"%d\" token-number=\"%d\""
" name=\"%s\" usefulness=\"%s\"",
token_translations[i], i, xml_escape (tag),
reduce_token_unused_in_grammar (token_translations[i])
? "unused-in-grammar" : "useful");
if (precedence)
fprintf (out, " prec=\"%d\"", precedence);
if (associativity != undef_assoc)
fprintf (out, " assoc=\"%s\"", assoc_to_string (associativity) + 1);
fputs ("/>\n", out);
}
xml_puts (out, level + 1, "</terminals>");
/* Nonterminals */
xml_puts (out, level + 1, "<nonterminals>");
for (i = ntokens; i < nsyms + nuseless_nonterminals; i++)
{
char const *tag = symbols[i]->tag;
xml_printf (out, level + 2,
"<nonterminal symbol-number=\"%d\" name=\"%s\""
" usefulness=\"%s\"/>",
i, xml_escape (tag),
reduce_nonterminal_useless_in_grammar (i)
? "useless-in-grammar" : "useful");
}
xml_puts (out, level + 1, "</nonterminals>");
xml_puts (out, level, "</grammar>");
}
void
xml_indent (FILE *out, int level)
{
int i;
for (i = 0; i < level; i++)
fputs (" ", out);
}
void
xml_puts (FILE *out, int level, char const *s)
{
xml_indent (out, level);
fputs (s, out);
fputc ('\n', out);
}
void
xml_printf (FILE *out, int level, char const *fmt, ...)
{
va_list arglist;
xml_indent (out, level);
va_start (arglist, fmt);
vfprintf (out, fmt, arglist);
va_end (arglist);
fputc ('\n', out);
}
static char const *
xml_escape_string (struct escape_buf *buf, char const *str)
{
size_t len = strlen (str);
size_t max_expansion = sizeof """ - 1;
char *p;
if (buf->size <= max_expansion * len)
{
buf->size = max_expansion * len + 1;
buf->ptr = x2realloc (buf->ptr, &buf->size);
}
p = buf->ptr;
for (; *str; str++)
switch (*str)
{
default: *p++ = *str; break;
case '&': p = stpcpy (p, "&" ); break;
case '<': p = stpcpy (p, "<" ); break;
case '>': p = stpcpy (p, ">" ); break;
case '"': p = stpcpy (p, """); break;
}
*p = '\0';
return buf->ptr;
}
char const *
xml_escape_n (int n, char const *str)
{
return xml_escape_string (escape_bufs + n, str);
}
char const *
xml_escape (char const *str)
{
return xml_escape_n (0, str);
}
void
print_xml (void)
{
state_number i;
int level = 0;
FILE *out = xfopen (spec_xml_file, "w");
fputs ("<?xml version=\"1.0\"?>\n\n", out);
xml_printf (out, level, "<bison-xml-report version=\"%s\">",
xml_escape (VERSION));
fputc ('\n', out);
xml_printf (out, level + 1, "<filename>%s</filename>",
xml_escape (grammar_file));
/* print grammar */
print_grammar (out, level + 1);
new_closure (nritems);
no_reduce_set = bitset_create (ntokens, BITSET_FIXED);
/* print automaton */
fputc ('\n', out);
xml_puts (out, level + 1, "<automaton>");
for (i = 0; i < nstates; i++)
print_state (out, level + 2, states[i]);
xml_puts (out, level + 1, "</automaton>");
bitset_free (no_reduce_set);
free_closure ();
xml_puts (out, 0, "</bison-xml-report>");
free (escape_bufs[0].ptr);
free (escape_bufs[1].ptr);
xfclose (out);
}
| 25.042831 | 78 | 0.549375 |
92f6ff97238dba5191041763621dc4226c5ebc47 | 8,986 | h | C | bsp/yichip/yc3121-pos/Libraries/sdk/yc_gpio.h | cazure/rt-thread | 1bdde743433d331740766c895ff867df6268df20 | [
"Apache-2.0"
] | 7,482 | 2015-01-01T09:23:08.000Z | 2022-03-31T19:34:05.000Z | bsp/yichip/yc3121-pos/Libraries/sdk/yc_gpio.h | cazure/rt-thread | 1bdde743433d331740766c895ff867df6268df20 | [
"Apache-2.0"
] | 2,543 | 2015-01-09T02:01:34.000Z | 2022-03-31T23:10:14.000Z | bsp/yichip/yc3121-pos/Libraries/sdk/yc_gpio.h | cazure/rt-thread | 1bdde743433d331740766c895ff867df6268df20 | [
"Apache-2.0"
] | 4,645 | 2015-01-06T07:05:31.000Z | 2022-03-31T18:21:50.000Z | /*
File Name : yc_gpio.c
Author : Yichip
Version : V1.0
Date : 2019/12/03
Description : gpio encapsulation.
*/
#ifndef __YC_GPIO_H__
#define __YC_GPIO_H__
#include "yc3121.h"
/**
* @brief Configuration Mode enumeration
*/
typedef enum
{
GPIO_Mode_IN_FLOATING = 0x01,
GPIO_Mode_IPU = 0x02,
GPIO_Mode_IPD = 0x03,
GPIO_Mode_AIN = 0x04,
GPIO_Mode_Out_PP = 0x05 /*!< analog signal mode */
} GPIO_ModeTypeDef;
#define IS_GPIO_MODE(mode) (((mode) == GPIO_Mode_IN_FLOATING) || \
((mode) == GPIO_Mode_IPU) || \
((mode) == GPIO_Mode_IPD) || \
((mode) == GPIO_Mode_Out_PP) || \
((mode) == GPIO_Mode_AIN))
/**
* @brief Bit_SET and Bit_RESET enumeration
*/
typedef enum
{
Bit_RESET = 0,
Bit_SET
} BitAction;
/**
* @brief gpio output enumeration
*/
typedef enum
{
OutputLow = 0,
OutputHigh = 1
} GPIO_OutputTypeDef;
#define IS_GPIO_WAKE_MODE(MODE) (((MODE) == GPIO_WakeMode_Now) || \
((MODE) == GPIO_WakeMode_AfterGlitch))
/**
* @brief GPIO function enumeration
*/
typedef enum
{
INPUT = GPCFG_INPUT,
QSPI_NCS = GPCFG_QSPI_NCS,
QSPI_SCK = GPCFG_QSPI_SCK,
QSPI_IO0 = GPCFG_QSPI_IO0,
QSPI_IO1 = GPCFG_QSPI_IO1,
QSPI_IO2 = GPCFG_QSPI_IO2,
QSPI_IO3 = GPCFG_QSPI_IO3,
UART0_TXD = GPCFG_UART0_TXD,
UART0_RXD = GPCFG_UART0_RXD,
UART0_RTS = GPCFG_UART0_RTS,
UART0_CTS = GPCFG_UART0_CTS,
UART1_TXD = GPCFG_UART1_TXD,
UART1_RXD = GPCFG_UART1_RXD,
UART1_RTS = GPCFG_UART1_RTS,
UART1_CTS = GPCFG_UART1_CTS,
PWM_OUT0 = GPCFG_PWM_OUT0,
PWM_OUT1 = GPCFG_PWM_OUT1,
PWM_OUT2 = GPCFG_PWM_OUT2,
PWM_OUT3 = GPCFG_PWM_OUT3,
PWM_OUT4 = GPCFG_PWM_OUT4,
PWM_OUT5 = GPCFG_PWM_OUT5,
PWM_OUT6 = GPCFG_PWM_OUT6,
PWM_OUT7 = GPCFG_PWM_OUT7,
PWM_OUT8 = GPCFG_PWM_OUT8,
SPID0_NCS = GPCFG_SPID0_NCS,
SPID0_SCK = GPCFG_SPID0_SCK,
SPID0_MOSI = GPCFG_SPID0_MOSI,
SPID0_SDIO = GPCFG_SPID0_SDIO,
SPID0_MISO = GPCFG_SPID0_MISO,
SPID0_NCSIN = GPCFG_SPID0_NCSIN,
SPID0_SCKIN = GPCFG_SPID0_SCKIN,
SPID1_NCS = GPCFG_SPID1_NCS,
SPID1_SCK = GPCFG_SPID1_SCK,
SPID1_MOSI = GPCFG_SPID1_MOSI,
SPID1_SDIO = GPCFG_SPID1_SDIO,
SPID1_MISO = GPCFG_SPID1_MISO,
SPID1_NCSIN = GPCFG_SPID1_NCSIN,
SPID1_SCKIN = GPCFG_SPID1_SCKIN,
NFC_CLK_OUT = GPCFG_NFC_CLK_OUT,
SCI7816_IO = GPCFG_SCI7816_IO,
IIC_SCL = GPCFG_IIC_SCL,
IIC_SDA = GPCFG_IIC_SDA,
JTAG_SWCLK = GPCFG_JTAG_SWCLK,
JTAG_SWDAT = GPCFG_JTAG_SWDAT,
OUTPUT_LOW = GPCFG_OUTPUT_LOW,
OUTPUT_HIGH = GPCFG_OUTPUT_HIGH,
PULL_UP = GPCFG_PU,
PULL_DOWN = GPCFG_PD,
ANALOG = GPCFG_ANALOG
} GPIO_FunTypeDef;
#define GPIO_Pin_0 ((uint16_t)0x0001) /*!< Pin 0 selected */
#define GPIO_Pin_1 ((uint16_t)0x0002) /*!< Pin 1 selected */
#define GPIO_Pin_2 ((uint16_t)0x0004) /*!< Pin 2 selected */
#define GPIO_Pin_3 ((uint16_t)0x0008) /*!< Pin 3 selected */
#define GPIO_Pin_4 ((uint16_t)0x0010) /*!< Pin 4 selected */
#define GPIO_Pin_5 ((uint16_t)0x0020) /*!< Pin 5 selected */
#define GPIO_Pin_6 ((uint16_t)0x0040) /*!< Pin 6 selected */
#define GPIO_Pin_7 ((uint16_t)0x0080) /*!< Pin 7 selected */
#define GPIO_Pin_8 ((uint16_t)0x0100) /*!< Pin 8 selected */
#define GPIO_Pin_9 ((uint16_t)0x0200) /*!< Pin 9 selected */
#define GPIO_Pin_10 ((uint16_t)0x0400) /*!< Pin 10 selected */
#define GPIO_Pin_11 ((uint16_t)0x0800) /*!< Pin 11 selected */
#define GPIO_Pin_12 ((uint16_t)0x1000) /*!< Pin 12 selected */
#define GPIO_Pin_13 ((uint16_t)0x2000) /*!< Pin 13 selected */
#define GPIO_Pin_14 ((uint16_t)0x4000) /*!< Pin 14 selected */
#define GPIO_Pin_15 ((uint16_t)0x8000) /*!< Pin 15 selected */
#define GPIO_Pin_All ((uint16_t)0xffff) /*!< Pin All selected */
#define IS_GPIO_PIN(PIN) (((((PIN) & ~(uint16_t)0xFFFF)) == 0x00) && ((PIN) != (uint16_t)0x00))
#define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \
((PIN) == GPIO_Pin_1) || \
((PIN) == GPIO_Pin_2) || \
((PIN) == GPIO_Pin_3) || \
((PIN) == GPIO_Pin_4) || \
((PIN) == GPIO_Pin_5) || \
((PIN) == GPIO_Pin_6) || \
((PIN) == GPIO_Pin_7) || \
((PIN) == GPIO_Pin_8) || \
((PIN) == GPIO_Pin_9) || \
((PIN) == GPIO_Pin_10) || \
((PIN) == GPIO_Pin_11) || \
((PIN) == GPIO_Pin_12) || \
((PIN) == GPIO_Pin_13) || \
((PIN) == GPIO_Pin_14) || \
((PIN) == GPIO_Pin_15))
/**
* @brief GPIO group enumeration
*/
typedef enum
{
GPIOA = 0,
GPIOB,
GPIOC
} GPIO_TypeDef;
#define ISGPIOGROUP(groupx) (groupx < GPIO_GROUP_NUM)
/**
* @brief GPIO Init structure definition
*/
typedef struct
{
uint16_t GPIO_Pin;
GPIO_ModeTypeDef GPIO_Mode;
} GPIO_InitTypeDef;
/**
* @brief config gpio function(Only one can be configured at a time)
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param GPIO_Pin: select the pin to read.(GPIO_Pin_0...GPIO_Pin_15)(Only one can be configured at a time)
*
* @param function:gpio function
*
* @retval none
*/
void GPIO_Config(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin, GPIO_FunTypeDef function);
/**
* @brief gpio mode Init
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param GPIO_InitStruct:GPIO_InitStruct
*
* @retval none
*/
void GPIO_Init(GPIO_TypeDef GPIOx, GPIO_InitTypeDef *GPIO_InitStruct);
/**
* @brief
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param GPIO_Pin: select the pin to read.(GPIO_Pin_0...GPIO_Pin_7)
*
* @param NewState: new state of the port pin Pull Up.(ENABLE or DISABLE)
*
* @retval
*/
void GPIO_PullUpCmd(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin, FunctionalState NewState);
/**
* @brief Reads the GPIO input data(status) for byte.
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @retval GPIO input data(status).
*/
uint16_t GPIO_ReadInputData(GPIO_TypeDef GPIOx);
/**
* @brief Reads the GPIO input data(status) for bit.
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param GPIO_Pin: select the pin to read.(GPIO_Pin_0...GPIO_Pin_15)
*
* @retval The input status
*/
uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin);
/**
* @brief Reads the GPIO output data(status) for byte.
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @retval GPIO output data(status).
*/
uint16_t GPIO_ReadOutputData(GPIO_TypeDef GPIOx);
/**
* @brief Reads the GPIO output data(status) for bit.
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param GPIO_Pin: select the pin to read.(GPIO_Pin_0...GPIO_Pin_15)
*
* @retval The output status
*/
uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin);
/**
* @brief Clears the selected pin(only output mode)
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param GPIO_Pin: select the pin to read.(GPIO_Pin_0...GPIO_Pin_15)
*
* @retval None
*/
void GPIO_ResetBits(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin);
/**
* @brief sets the selected pin(only output mode)
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param GPIO_Pin: select the pin to read.(GPIO_Pin_0...GPIO_Pin_15)
*
* @retval None
*/
void GPIO_SetBits(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin);
/**
* @brief init GPIO_InitStruct to default value.
* @param GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure which will be initialized.
* @retval None
*/
void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct);
/**
* @brief Writes data to the GPIO group port(only output mode)
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param value: specifies the value to be written to the port output data register.
*
* @retval None
*/
void GPIO_Write(GPIO_TypeDef GPIOx, uint16_t value);
/**
* @brief Sets or clears the selected data port bit(only output mode)
*
* @param GPIOx: where x can be (GPIOA...GPIOF) to select the GPIO group.
*
* @param GPIO_Pin: select the pin to read.(GPIO_Pin_0...GPIO_Pin_7)
*
* @param BitVal: specifies the value to be written to the selected bit.
* This parameter can be one of the BitAction enum values:
* @arg Bit_RESET: to clear the port pin
* @arg Bit_SET: to set the port pin
* @retval None
*/
void GPIO_WriteBit(GPIO_TypeDef GPIOx, uint16_t GPIO_Pin, BitAction BitVal);
#endif /* __YC_GPIO_H__ */
| 29.953333 | 108 | 0.639996 |
c0a17e21f106e9dcf5decd7102beb6de47bf6488 | 1,888 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_ht_un_/i7-7700_9_0x48_notsx.log_37_1451.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_ht_un_/i7-7700_9_0x48_notsx.log_37_1451.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_ht_un_/i7-7700_9_0x48_notsx.log_37_1451.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1afaa, %r8
nop
nop
nop
nop
nop
cmp $30103, %r11
mov (%r8), %r10d
sub %r8, %r8
lea addresses_WT_ht+0x1c70a, %rsi
lea addresses_normal_ht+0x1632a, %rdi
nop
nop
nop
nop
add $6903, %rbp
mov $120, %rcx
rep movsq
nop
nop
nop
nop
dec %rbp
lea addresses_normal_ht+0x580a, %rsi
lea addresses_UC_ht+0x1aaea, %rdi
clflush (%rsi)
add %r14, %r14
mov $24, %rcx
rep movsw
nop
nop
cmp $26740, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r15
push %r9
push %rbp
push %rcx
push %rsi
// Faulty Load
lea addresses_WT+0x113aa, %r9
nop
nop
nop
nop
nop
sub $55753, %rsi
vmovaps (%r9), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %r15
lea oracles, %rbp
and $0xff, %r15
shlq $12, %r15
mov (%rbp,%r15,1), %r15
pop %rsi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_WT', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 8}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}}
{'4a': 1, '5f': 1, '44': 33, '49': 1, '4d': 1}
44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 5f 44 44 44 44 44 44 49 44 44 44 44 44 4a 4d 44
*/
| 19.265306 | 152 | 0.653602 |
70dda505e02b5fa477b4017db4d471d16c2508ff | 528 | cs | C# | Extensions/NavigationManagerExtension.cs | SAM-tak/GaaSTemplateForUnityAndDotNetServer | 03fceb82f29df43d963a0e80950710cc79e0f791 | [
"MIT"
] | null | null | null | Extensions/NavigationManagerExtension.cs | SAM-tak/GaaSTemplateForUnityAndDotNetServer | 03fceb82f29df43d963a0e80950710cc79e0f791 | [
"MIT"
] | null | null | null | Extensions/NavigationManagerExtension.cs | SAM-tak/GaaSTemplateForUnityAndDotNetServer | 03fceb82f29df43d963a0e80950710cc79e0f791 | [
"MIT"
] | null | null | null | using System.Linq;
using Microsoft.AspNetCore.Components;
namespace YourGameServer.Extensions;
static class NavigationManagerExtension
{
public static string ToLocalBasePathComponent(this NavigationManager self)
{
var localPath = self.Uri[self.BaseUri.Length..].ToLower().Split('/').FirstOrDefault();
return localPath?.StartsWith("/") ?? false ? localPath : "/" + localPath;
}
public static string BasePath(this NavigationManager self) => self.ToLocalBasePathComponent().Split('?').First();
}
| 33 | 117 | 0.729167 |
7439977e17be1a9abd30720ca844c26436f3ba55 | 3,491 | html | HTML | sandboxmgt/app/templates/home.html | alphagov/sandbox-mgt | 6fa2681c84b509ab65fe86de32f78cd2abf064a6 | [
"MIT"
] | 2 | 2017-07-24T17:00:58.000Z | 2017-12-20T18:01:31.000Z | sandboxmgt/app/templates/home.html | alphagov/sandbox-mgt | 6fa2681c84b509ab65fe86de32f78cd2abf064a6 | [
"MIT"
] | 7 | 2017-06-21T10:19:01.000Z | 2017-09-27T16:16:26.000Z | sandboxmgt/app/templates/home.html | alphagov/sandbox-mgt | 6fa2681c84b509ab65fe86de32f78cd2abf064a6 | [
"MIT"
] | 2 | 2019-08-29T11:53:53.000Z | 2021-04-10T19:53:28.000Z | {% extends 'main.html' %}
{% load static %}
{% load i18n %}
{% block content %}
<main id="main" role="main" tabindex="-1">
<div class="masthead">
<div class="hero">
<div class="hero__content">
<div class="hero__body">
<h1 class="hero__title">Write code in your browser to analyse data</h1>
<div class="hero__inline-image">
<img src="//placehold.it/646x492/005ea5/ffffff?text=A+supporting+image" alt="" role="presentation">
</div>
<p class="hero__description">
Set-up a government data science sandbox to analyse open data if you work for a UK government department or agency
</p>
<!-- <a href="{% url 'my_sandbox' %}" role="button" class="hero-button">My sandbox</a> -->
<a href="{% url 'register_github_intro' %}" role="button" class="hero-button">
Register
</a>
<span class="hero-alternative-action">
or <a href="{% url 'auth0_login' %}">sign in</a> if you already have one
</span>
</div>
<!--
<div c="hero__aside-image">
<img="//placehold.it/646x492/005ea5/ffffff?text=A+supporting+image" alt="" role="presentation">
</div>
-->
</div>
</div>
</div>
<div class="container">
<section class="content-section">
{% blocktrans %}
<h2 class="content-section__title">Government data science sandbox</h2>
<p class="content-section__body">
Create your own government data science sandbox to try new ways of analysing data, improve your coding skills or to help build a case for your department to invest in data science tools.
</p>
{% endblocktrans %}
</section>
</div>
<div class="container">
<section class="content-section">
{% blocktrans %}
<h2 class="content-section__title">Signing up to the alpha</h2>
<p class="content-section__body">
To sign up to the alpha version of this service, you need a government email address and a GitHub account. We use GitHub to authenticate you and to save the work you do in your sandbox.
</p>
{% endblocktrans %}
</section>
</div>
<div class="container">
<section class="content-section">
<h2 class="content-section__title">Your commitments</h2>
<p class="content-section__body">For security reasons, only open data can be loaded into your government data science sandbox. In signing up for one, you’ll be agreeing not to load any sensitive, personal or classified data. You’ll also be agreeing to uphold the <a href="https://www.gov.uk/government/publications/data-science-ethical-framework" target="_blank">Data Science Ethical Data Framework</a>.
</p>
</section>
</div>
<div class="container">
<section class="content-section content-section--with-top-border">
{% blocktrans %}
<h2 class="content-section__title">Get help</h2>
<p class="content-section__body">
The government data science sandbox is being developed by the Better Use of Data team at the <a href="https://www.gov.uk/government/organisations/government-digital-service" target="_blank">Government Digital Service</a>.
</p>
<p><a href="mailto:data-science-sandbox@digital.cabinet-office.gov.uk">Contact the team</a> if you have feedback, need help, or have a question.</p>
{% endblocktrans %}
</section>
</div>
</main>
{% endblock %}
| 44.189873 | 411 | 0.635634 |
13b9146246737e18cd15fdee640139e1467d53d2 | 10,739 | dart | Dart | lib/Pages/add_available_course.dart | Abhishekkr3003/CORES | 51ae36d53bf17023ffd885519d148ebfa5a2be93 | [
"MIT"
] | null | null | null | lib/Pages/add_available_course.dart | Abhishekkr3003/CORES | 51ae36d53bf17023ffd885519d148ebfa5a2be93 | [
"MIT"
] | null | null | null | lib/Pages/add_available_course.dart | Abhishekkr3003/CORES | 51ae36d53bf17023ffd885519d148ebfa5a2be93 | [
"MIT"
] | null | null | null | import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_application_1/Stores/course.dart';
bool adding = false;
class AddAvlbCourse extends StatefulWidget {
final Course course;
const AddAvlbCourse({
Key? key,
required this.course,
}) : super(key: key);
@override
State<AddAvlbCourse> createState() => _AddAvlbCourseState();
}
class _AddAvlbCourseState extends State<AddAvlbCourse> {
TextEditingController branch = TextEditingController();
TextEditingController semester = TextEditingController();
TextEditingController seats = TextEditingController();
TextEditingController grp = TextEditingController();
List<String> branches = ["CSE", "CCE", "ECE", "ME", "CSE Dual", "ECE Dual"];
List<String> sems = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
_showPickerSemester() {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(25.0))),
builder: (BuildContext bc) {
return SingleChildScrollView(
child: Column(
children: <Widget>[
"Semester".text.bold.xl2.make().p12().centered(),
ListView.builder(
itemCount: sems.length,
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return ListTile(
// leading: Icon(CupertinoIcons.person_alt_circle),
title: Text(sems[index]).centered(),
onTap: () async {
semester.text = sems[index];
setState(() {});
Navigator.pop(context);
});
},
)
],
),
);
});
}
_showPickerBranch() {
showModalBottomSheet(
context: context,
builder: (BuildContext bc) {
return SingleChildScrollView(
child: Column(
children: <Widget>[
"Branch".text.bold.xl2.make().p12().centered(),
ListView.builder(
itemCount: branches.length,
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return ListTile(
// leading: Icon(CupertinoIcons.person_alt_circle),
title: Text(branches[index]).centered(),
onTap: () async {
branch.text = branches[index];
setState(() {});
Navigator.pop(context);
});
},
)
],
),
);
});
}
@override
Widget build(BuildContext context) {
final _formKey2 = GlobalKey<FormState>();
Future<void> sendQuery() async {
if (_formKey2.currentState!.validate()) {
adding = true;
// print(adding);
setState(() {});
try {
final Dio _dio = Dio();
Response response = await _dio.post(
'https://guarded-mesa-99449.herokuapp.com/course/addAvailableCourse',
data: {
"course_id": widget.course.course_id,
"semester": semester.text,
"branch": branch.text,
"totalSeats": seats.text,
"grp": grp.text
},
);
// print(widget.course.course_id);
// print(semester.text);
// print(branch.text);
// print(seats.text);
// print(grp.text);
// print('Adding: ${response.data}');
if (response.data.toString() == "success") {
Navigator.pop(context);
setState(() {
adding = false;
});
Fluttertoast.showToast(msg: "Availability Added.");
} else {
setState(() {
adding = false;
});
// print(response.data);
Fluttertoast.showToast(msg: "Not able to Add.");
}
} catch (e) {
setState(() {
adding = false;
});
Fluttertoast.showToast(msg: 'Some error occured');
// print('Error: $e');
}
}
}
return Scaffold(
body: SafeArea(
child: Container(
padding: Vx.m32,
child: SingleChildScrollView(
child: Form(
key: _formKey2,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
"Add Course Availability".text.bold.xl5.make().expand(),
IconButton(
onPressed: () => Navigator.pop(context),
icon: const Icon(CupertinoIcons.chevron_back),
iconSize: 40,
)
],
).pOnly(bottom: 20),
10.heightBox,
"${widget.course.coursename} (${widget.course.course_id})"
.text
.xl
.make(),
10.heightBox,
CupertinoFormSection(
backgroundColor: Colors.transparent,
header: "Course Properties".text.make(),
children: [
CupertinoFormRow(
//padding: EdgeInsets.only(left: 0),
child: CupertinoTextFormFieldRow(
controller: branch,
onTap: _showPickerBranch,
placeholder: "Branch",
validator: (value) {
if (value!.isEmpty) {
return "Branch can't be empty";
}
return null;
},
prefix: "Branch ".text.caption(context).make(),
decoration: const BoxDecoration(color: Colors.white),
readOnly: true,
padding: const EdgeInsets.only(left: 0),
),
),
CupertinoFormRow(
//padding: EdgeInsets.only(left: 0),
child: CupertinoTextFormFieldRow(
controller: semester,
onTap: _showPickerSemester,
placeholder: "Semester",
validator: (value) {
if (value!.isEmpty) {
return "Semester can't be empty";
}
return null;
},
prefix: "Semester ".text.caption(context).make(),
decoration: const BoxDecoration(color: Colors.white),
readOnly: true,
padding: const EdgeInsets.only(left: 0),
),
),
CupertinoFormRow(
//padding: EdgeInsets.only(left: 0),
child: CupertinoTextFormFieldRow(
controller: seats,
keyboardType: TextInputType.number,
validator: (value) {
if (value!.isEmpty) {
return "Seats can't be empty";
}
return null;
},
placeholder: "Seats",
prefix: "Seats ".text.caption(context).make(),
padding: const EdgeInsets.only(left: 0),
),
),
CupertinoFormRow(
//padding: EdgeInsets.only(left: 0),
child: CupertinoTextFormFieldRow(
controller: grp,
validator: (value) {
if (widget.course.type == "Elective" &&
value!.isEmpty) {
return "Group for elevtive course can't be empty.";
}
return null;
},
placeholder: "Group",
keyboardType: TextInputType.number,
prefix: "Group ".text.caption(context).make(),
padding: const EdgeInsets.only(left: 0),
),
),
],
),
50.heightBox,
Container(
width: 70,
height: 70,
// color: Colors.white,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(50),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
blurRadius: 7,
offset:
const Offset(0, 3), // changes position of shadow
),
],
),
child: adding
? const CircularProgressIndicator(
color: Colors.grey,
)
: IconButton(
onPressed: () {
sendQuery();
},
icon:
const Icon(CupertinoIcons.checkmark_seal_fill),
iconSize: 60,
color: Colors.grey,
).centered(),
).centered(),
],
),
),
),
),
),
);
}
}
| 37.548951 | 81 | 0.417078 |