query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Get DNS entries for a specific domain | def get_domain_dns_records(domain):
url_suffix = "v1/domains/{}/records".format(domain)
ret = _call_endpoint(url_suffix)
if isinstance(ret, dict) and ret.get('code', None) == "UNKNOWN_DOMAIN":
# e.g. {'code': 'UNKNOWN_DOMAIN', 'message': 'The given domain is not registered, or does not have a zone file'}
raise Exception(f"Can't find domain {domain}. Are you sure your API key and secret are correct?: {ret}")
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self, domain):\n return request(\n API_LIST.DNS_LIST.value,\n {\n 'email': self.email,\n 'token': self.token,\n 'domain': domain\n }\n )",
"def print_all_dns_records():\n for domain in sorted(get_domains()):\n... | [
"0.754245",
"0.69325036",
"0.6888839",
"0.6870619",
"0.68629503",
"0.6824631",
"0.67168874",
"0.66804457",
"0.6670255",
"0.6651589",
"0.664277",
"0.66395545",
"0.66219234",
"0.6609759",
"0.6591403",
"0.65406996",
"0.6507059",
"0.64893925",
"0.647041",
"0.64417464",
"0.6440061... | 0.7584279 | 0 |
Print each domain and its DNS records (for domains linked to this API key). | def print_all_dns_records():
for domain in sorted(get_domains()):
dns_records = get_domain_dns_records(domain)
print(domain)
pprint(dns_records)
print("*" * 50)
# TODO: poor man's rate limiter. improve?
time.sleep(2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cb_listdomains(self, cmd):\n for cur in sorted(self.d.listDomains(),\n key=lambda x: _domreverse(x['domain'])):\n print \"%(domain)60s %(expiration_date)15s\" % cur",
"def cli(ctx, domain, ip_address, hostname):\n zone = getzone(domain)\n #print('.%s:%s:%s' % ... | [
"0.70802027",
"0.6874424",
"0.67829025",
"0.6670683",
"0.6497714",
"0.64597666",
"0.6447752",
"0.6308665",
"0.62406534",
"0.6203262",
"0.619593",
"0.6123511",
"0.60674375",
"0.6036058",
"0.6034905",
"0.6027634",
"0.59853095",
"0.5983278",
"0.59728104",
"0.5970376",
"0.5966782... | 0.8448762 | 0 |
Extracts MFCCs from music dataset and saves them into a json file. | def preprocess_dataset(dataset_path, SAMPLES_TO_CONSIDER: int, num_mfcc = 13, n_fft = 2048, hop_length = 512):
data = {
'mapping': [],
'labels': [],
'MFCCs': [],
'files': []
}
# loop through all sub-dirs
total_samples = 0
valid_samples = 0
for i, (dirpath, dirname, filenames) in tqdm(enumerate(os.walk(dataset_path))):
# ensure we're at sub-folder level
if dirpath is not dataset_path:
# save label (i.e., sub-folder name) in the mapping
label = dirpath.partition('speech_commands_subset')[-1][1:]
data['mapping'].append(label)
print("\nProcessing: '{}'".format(label))
print("number of files for each class: ", len(filenames))
# process all audio files
for f in filenames:
total_samples += 1
file_path = os.path.join(dirpath, f)
# load audio file and slice it to ensure length consistency among different files
signal, sample_rate = librosa.load(file_path)
# print(signal.shape)
# print(type(signal[0]))
# drop audio files with less than pre-decided number of samples
if len(signal) >= SAMPLES_TO_CONSIDER:
valid_samples += 1
# ensure consistency of the length of the signal
signal = signal[:SAMPLES_TO_CONSIDER]
# extract MFCCs
MFCCs = librosa.feature.mfcc(signal, sample_rate, n_mfcc = num_mfcc, n_fft = n_fft,
hop_length = hop_length)
# print(MFCCs.shape)
# print(type(MFCCs[0,0]))
# store data for analysed track
data['MFCCs'].append(MFCCs.T.tolist())
data['labels'].append(i-1)
# data['files'].append(file_path)
# print("{}: {}".format(file_path, i-1))
# if valid_samples == 20:
# valid_samples =0
# break
print("\ntotal samples: ", total_samples)
print("\nvalid_samples: ", valid_samples)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_mfcc(dataset_path, json_path, num_mfcc=13, n_fft=2048, hop_length=512, num_segments=5):\n\n # dictionary to store mapping, labels, and MFCCs\n data = {\n \"mapping\": [],\n \"labels\": [],\n \"mfcc\": []\n }\n\n samples_per_segment = int(SAMPLES_PER_TRACK / num_segments)\n... | [
"0.74878",
"0.6018327",
"0.57007396",
"0.56769806",
"0.55784905",
"0.55092484",
"0.5501925",
"0.54827094",
"0.5445455",
"0.5390397",
"0.5368815",
"0.53593296",
"0.5321659",
"0.5301206",
"0.5285528",
"0.52711874",
"0.5266658",
"0.52634954",
"0.523695",
"0.52124006",
"0.5208634... | 0.55278736 | 5 |
Loads training dataset from json file. | def load_data_from_fold(data_path):
print("\nLoading data from json folder {}".format(data_path))
SAMPLES_TO_CONSIDER = 22050
data = preprocess_dataset(data_path, SAMPLES_TO_CONSIDER)
X = np.array(data["MFCCs"])
y = np.array(data["labels"])
print("Training sets loaded!")
print("data size :", X.shape, "labels size: ", y.shape)
print("release the 'data' for memories")
del data
return X, y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_training_data(\n self,\n train_data_file=\"datasets/train_data.json\",\n test_data_file=\"datasets/test_data.json\",\n ):\n train_data = pd.read_json(train_data_file)\n test_data = pd.read_json(test_data_file)\n return train_data, test_data",
"def load_traini... | [
"0.7791885",
"0.7707302",
"0.71105415",
"0.70239383",
"0.6984626",
"0.6925664",
"0.6893865",
"0.6847589",
"0.67815673",
"0.6773288",
"0.66926444",
"0.6675152",
"0.6651707",
"0.6640259",
"0.66312504",
"0.6630534",
"0.6623066",
"0.66220605",
"0.6606385",
"0.65876716",
"0.658102... | 0.61219925 | 55 |
Loads training dataset from json file. | def load_data_from_json(json_path):
print("\nLoading data from json file")
with open(json_path, "r") as fp:
data = json.load(fp)
X = np.array(data["MFCCs"])
y = np.array(data["labels"])
print("Training sets loaded!")
print("data size :", X.shape, "labels size: ", y.shape)
print("release the 'data' for memories")
del data
return X, y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_training_data(\n self,\n train_data_file=\"datasets/train_data.json\",\n test_data_file=\"datasets/test_data.json\",\n ):\n train_data = pd.read_json(train_data_file)\n test_data = pd.read_json(test_data_file)\n return train_data, test_data",
"def load_traini... | [
"0.7791885",
"0.7707302",
"0.70239383",
"0.6984626",
"0.6925664",
"0.6893865",
"0.6847589",
"0.67815673",
"0.6773288",
"0.66926444",
"0.6675152",
"0.6651707",
"0.6640259",
"0.66312504",
"0.6630534",
"0.6623066",
"0.66220605",
"0.6606385",
"0.65876716",
"0.65810245",
"0.657136... | 0.71105415 | 2 |
Creates train, validation and test sets. | def prepare_dataset(data_path, test_size=0.2, validation_size=0.2):
# load dataset
if data_path.endswith('json'):
X, y = load_data_from_json(data_path)
else:
X, y = load_data_from_fold(data_path)
# create train, validation, test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=test_size)
X_train, X_validation, y_train, y_validation = train_test_split(X_train, y_train, test_size=validation_size)
# add an axis to nd array
X_train = X_train[..., np.newaxis]
X_test = X_test[..., np.newaxis]
X_validation = X_validation[..., np.newaxis]
return X_train, y_train, X_validation, y_validation, X_test, y_test | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_train_valid_set(self):\n\n if not self.eq_train:\n X_train_high_level, X_valid_high_level, X_train_low_level, X_valid_low_level, train_w, valid_w, y_train, y_valid = train_test_split(self.X_train_high_level, self.X_train_low_level, self.train_weights, self.y_train,\n ... | [
"0.76895845",
"0.715086",
"0.7096839",
"0.7073061",
"0.70712376",
"0.7044257",
"0.70330745",
"0.69933313",
"0.69472665",
"0.6942843",
"0.69403505",
"0.6925283",
"0.6864578",
"0.6856286",
"0.6808348",
"0.67936116",
"0.6744948",
"0.67354846",
"0.67186093",
"0.6708335",
"0.66697... | 0.0 | -1 |
Build neural network using keras. | def build_model(input_shape, loss="sparse_categorical_crossentropy", learning_rate=0.0001):
# build network architecture using convolutional layers
model = tf.keras.models.Sequential()
# 1st conv layer
model.add(tf.keras.layers.Conv2D(64, (3, 3), activation='relu', input_shape=input_shape,
kernel_regularizer=tf.keras.regularizers.l2(0.001)))
model.add(tf.keras.layers.BatchNormalization())
model.add(tf.keras.layers.MaxPooling2D((3, 3), strides=(2,2), padding='same'))
# 2nd conv layer
model.add(tf.keras.layers.Conv2D(32, (3, 3), activation='relu',
kernel_regularizer=tf.keras.regularizers.l2(0.001)))
model.add(tf.keras.layers.BatchNormalization())
model.add(tf.keras.layers.MaxPooling2D((3, 3), strides=(2,2), padding='same'))
# 3rd conv layer
model.add(tf.keras.layers.Conv2D(32, (2, 2), activation='relu',
kernel_regularizer=tf.keras.regularizers.l2(0.001)))
model.add(tf.keras.layers.BatchNormalization())
model.add(tf.keras.layers.MaxPooling2D((2, 2), strides=(2,2), padding='same'))
# flatten output and feed into dense layer
model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(64, activation='relu'))
tf.keras.layers.Dropout(0.3)
# softmax output layer
model.add(tf.keras.layers.Dense(10, activation='softmax'))
optimiser = tf.optimizers.Adam(learning_rate=learning_rate)
# compile model
model.compile(optimizer=optimiser,
loss=loss,
metrics=["accuracy"])
# print model parameters on console
model.summary()
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_neural_network():\n network_input = keras.layers.Input((NETWORK_INPUT_SIZE,))\n network_layer = keras.layers.Dense(100, kernel_initializer='random_uniform', activation='tanh')(network_input)\n network_layer = keras.layers.Dense(100, kernel_initializer='random_uniform', activation='tanh')(networ... | [
"0.76426136",
"0.737351",
"0.73625165",
"0.7330011",
"0.7327857",
"0.7225237",
"0.7213768",
"0.7154049",
"0.71528256",
"0.7138571",
"0.710223",
"0.7046471",
"0.70461565",
"0.70441526",
"0.7029958",
"0.7021955",
"0.7017469",
"0.7014341",
"0.7011238",
"0.70006037",
"0.69785774"... | 0.67458504 | 61 |
Plots accuracy/loss for training/validation set as a function of the epochs | def plot_history(history):
fig, axs = plt.subplots(2)
# create accuracy subplot
axs[0].plot(history.history["accuracy"], label="accuracy")
axs[0].plot(history.history['val_accuracy'], label="val_accuracy")
axs[0].set_ylabel("Accuracy")
axs[0].legend(loc="lower right")
axs[0].set_title("Accuracy evaluation")
# create loss subplot
axs[1].plot(history.history["loss"], label="loss")
axs[1].plot(history.history['val_loss'], label="val_loss")
axs[1].set_xlabel("Epoch")
axs[1].set_ylabel("Loss")
axs[1].legend(loc="upper right")
axs[1].set_title("Loss evaluation")
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_accuracy(self):\n plot_title, img_title = self.prep_titles(\"\")\n test_legend = ['training data', 'test data']\n\n # Data for plotting x- and y-axis\n x = np.arange(1, CFG.EPOCHS + 1)\n y = [self.tr_accuracy, self.test_accuracy]\n\n # prints x and y-axis values\n... | [
"0.8396251",
"0.8177083",
"0.8090178",
"0.79906076",
"0.79561436",
"0.77318394",
"0.77222484",
"0.76527697",
"0.76454616",
"0.7617511",
"0.7601171",
"0.75999707",
"0.75929874",
"0.7586753",
"0.7510082",
"0.7505088",
"0.7487265",
"0.74864775",
"0.74474126",
"0.7441814",
"0.741... | 0.0 | -1 |
Refresh the contents of the projects. | def refresh(self):
metadata = project_scrape(self.url)
if metadata:
if not self.done:
self.progress.set_fraction(metadata['percent_raised'])
self.progress.set_text(metadata['pretty_percent'])
self.progress.set_show_text(True)
self.pledged.set_text(metadata['pledged'])
self.backers.set_text(metadata['backers'])
self.updates.set_label(metadata['updates'])
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_refresh_all():\n project_list = Project.objects()\n analyser.add_repos(current_user.username, [repo.project_name for repo in project_list])\n flash('Refresh all successfully!', 'success')\n return redirect(url_for('main.admin_manage'))",
"def update_projects(self):\n self._read_dir... | [
"0.76175606",
"0.7572136",
"0.75084645",
"0.69303507",
"0.65593135",
"0.6468245",
"0.64175284",
"0.6360456",
"0.63405234",
"0.6282787",
"0.6265902",
"0.6220813",
"0.6210531",
"0.6204316",
"0.6168462",
"0.6165451",
"0.6165451",
"0.6127819",
"0.6123018",
"0.6102209",
"0.6101717... | 0.69102895 | 4 |
Refresh the project countdown for each project. If the project has expired, move the ProjBox to the completed tab. | def refresh_time(container):
now = datetime.utcnow().replace(microsecond=0)
for widget in container.get_children():
if widget in win.default_texts:
continue
if widget.end_date > now:
widget.left.set_text(str(widget.end_date - now))
else:
widget.left.set_text('Done!')
widget.done = True
win.complete.pack_start(widget, False, False, 0)
container.remove(widget)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poll_advanced(self):\r\n osName = platform.system()\r\n\r\n ## Check if user updated project name\r\n try:\r\n ## Check if user updated project name\r\n checkName = self.widgetList[3].get()\r\n if checkName != self.newProj.name:\r\n if kT.che... | [
"0.6487655",
"0.6308911",
"0.6178959",
"0.6015678",
"0.59574705",
"0.59144545",
"0.58194315",
"0.5614993",
"0.54217035",
"0.53814393",
"0.53416014",
"0.5321008",
"0.5291773",
"0.5270808",
"0.5252898",
"0.5235397",
"0.52225703",
"0.51972866",
"0.5182955",
"0.5182299",
"0.51771... | 0.56734455 | 7 |
Returns a request handler class that redirects to supplied `url` | def redirect_handler_factory():
class RedirectHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(301)
domain = self.headers['host']
if ':' in domain:
domain = domain.split(':')[0]
self.send_header('Location', "https://" + domain + self.path)
self.end_headers()
return RedirectHandler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_handler_factory(url):\n class RedirectHandler(http.server.SimpleHTTPRequestHandler):\n def do_GET(self):\n self.send_response(302)\n self.send_header('Location', url)\n self.end_headers()\n\n return RedirectHandler",
"def redirect(url):",
"def __call__... | [
"0.8006581",
"0.63602716",
"0.60251427",
"0.5762764",
"0.562808",
"0.5593964",
"0.5454222",
"0.5417794",
"0.54076666",
"0.5355651",
"0.5345712",
"0.53292465",
"0.53158814",
"0.53054017",
"0.526144",
"0.5258285",
"0.52532136",
"0.5251986",
"0.52408147",
"0.5233149",
"0.5226429... | 0.6883462 | 1 |
loop and copy serial>console | def reader(self):
try:
line = ''
while self.alive:
data = self.serial.read(1)
if data == '\r':
continue
line += data
if data == '\n':
self.log.print_distant(datetime.now().strftime(
"%d/%m/%Y %H:%M:%S> "))
if line.startswith('ALARM:'):
self.log.alert(line)
elif line.startswith('EVENT:') or line.startswith('INFO'):
self.log.warn(line)
else:
self.log.print_distant(line)
self.parse(line.strip())
line = ''
sys.stdout.flush()
except serial.SerialException:
self.alive = False
# would be nice if the console reader could be interruptted at this
# point...
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_terminal(self):\n if (self.is_connected):\n self.mySerialConnection.do_serial()",
"def programflow(serial_port):\n print (\"\")\n print (\"Program flow: \")\n print (\" 1. Connect to the Arduino on port: \" + serial_port)\n print (\" 2. Start polling for commands\")\n prin... | [
"0.6927939",
"0.6439883",
"0.61899203",
"0.6172371",
"0.6096557",
"0.60786813",
"0.6066571",
"0.599614",
"0.59852797",
"0.5948746",
"0.5931728",
"0.5931728",
"0.5916063",
"0.589414",
"0.5853896",
"0.5821321",
"0.579844",
"0.57957584",
"0.57879835",
"0.57793695",
"0.57518065",... | 0.5474405 | 37 |
loop and copy console>serial until config.exit_char character is found. when config.menu_char is found, interpret the next key locally. | def writer(self):
menu_active = False
try:
while self.alive:
try:
char = self.console.getkey()
except KeyboardInterrupt:
char = '\x03'
if menu_active:
# Menu character again/exit char -> send itself
if char in self.config.menu_char:
self.serial.write(char) # send character
elif char in self.config.exit_char:
self.stop()
break # exit app
elif char in 'hH?': # h, H, ? -> Show help
sys.stderr.write(self.get_help_text())
elif char in self.config.photo_char:
ENV.send_image_f = "Asked by console"
else:
sys.stderr.write('--- unknown menu character %s ---\n' %
char)
menu_active = False
elif char in self.config.menu_char: # next char will be for menu
menu_active = True
elif char == '\n' or ord(char) == 10:
sys.stderr.write('\n')
else:
self.serial.write(char) # send character
except:
self.alive = False
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getKey(self):\n while not rospy.is_shutdown():\n tty.setraw(sys.stdin.fileno())\n select.select([sys.stdin], [], [], 0)\n self.key = sys.stdin.read(1)\n termios.tcsetattr(sys.stdin, termios.TCSADRAIN, self.settings)\n time.sleep(.05)",
"def run(se... | [
"0.60768646",
"0.5757084",
"0.57472295",
"0.572881",
"0.5679723",
"0.5675239",
"0.56368023",
"0.5612974",
"0.560551",
"0.5580252",
"0.55787677",
"0.5541301",
"0.55385447",
"0.5523714",
"0.54723734",
"0.5423755",
"0.54224914",
"0.5421046",
"0.54165447",
"0.5408846",
"0.5373981... | 0.66630965 | 0 |
Getting mrp (most recent price) Returns None if no price exists | def _get_mrp(journal):
try:
return Price.objects.filter(journal__issn=journal.issn).order_by('-date_stamp')[0]
except IndexError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getprice():\n\n print(\"Get price\")\n latest_price = get_latest_price(item_code)\n return latest_price",
"def get_last_price(args):\n\tmarket = get_market(args)\n\trequest = api.get_ticker(market)\n\tif not request['message']:\n\t\tlast = str(request['result']['Last'])\n\t\treturn (last)\n\telse:\n... | [
"0.71819454",
"0.68884295",
"0.68377554",
"0.6776221",
"0.6669529",
"0.64981353",
"0.635797",
"0.6276958",
"0.6204579",
"0.61832917",
"0.61458886",
"0.6095841",
"0.6082221",
"0.5979007",
"0.5943353",
"0.5930433",
"0.59218645",
"0.5913669",
"0.5907561",
"0.5898487",
"0.5897379... | 0.68424475 | 2 |
Getting mri (most recent influence) Returns 0 if no influence exists | def _get_mri(journal):
try:
return Influence.objects.filter(journal__issn=journal.issn).order_by('-date_stamp')[0]
except IndexError:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_reward(self):\n if self.is_game_done:\n return self.price - 1\n else:\n return 0.0",
"def get_reward(state, resolution, grid_x, grid_y):\n a,b = single_index_to_index(state, resolution)\n position = index_to_obs(a, b, grid_x, grid_y )[0]\n if position >= 0.5:... | [
"0.575768",
"0.5676095",
"0.56729364",
"0.56670934",
"0.559796",
"0.55813545",
"0.5575672",
"0.55736303",
"0.55562896",
"0.55536056",
"0.5553515",
"0.5538506",
"0.5526368",
"0.55253816",
"0.5502831",
"0.5489734",
"0.5470172",
"0.5469639",
"0.5466303",
"0.5466303",
"0.54242605... | 0.70698816 | 0 |
Create a multipart http request | def encode_multipart(fields, files, boundary=None):
def escape_quote(s):
return s.replace('"', '\\"')
if boundary is None:
boundary = ''.join(random.choice(_BOUNDARY_CHARS) for i in range(30))
lines = []
for name, value in fields.items():
lines.extend((
f'--{boundary}',
f'Content-Disposition: form-data; name="{escape_quote(name)}"',
'',
value,
))
for name, value in files.items():
filename = value['filename']
mimetype = (value.get('mimetype') or
mimetypes.guess_type(filename)[0] or
'application/octet-stream')
name, filename = escape_quote(name), escape_quote(filename)
lines.extend((
f'--{boundary}',
f'Content-Disposition: form-data; name="{name}"; filename="{filename}"',
f'Content-Type: {mimetype}',
'',
value['content'],
))
lines.extend((
f'--{boundary}--',
'',
))
body = '\r\n'.join(lines)
headers = {
'Content-Type': f'multipart/form-data; boundary={boundary}',
'Content-Length': str(len(body)),
}
return (body, headers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_request(self, theurl, fields, files, txheaders=None):\n\n content_type, body = self.encode_multipart_formdata(fields, files)\n if not txheaders: txheaders = {}\n txheaders['Content-type'] = content_type\n txheaders['Content-length'] = str(len(body))\n\n return urllib2.R... | [
"0.72485816",
"0.67776537",
"0.6666745",
"0.65953016",
"0.64735705",
"0.6339751",
"0.63103724",
"0.62898654",
"0.6287804",
"0.61854047",
"0.6174467",
"0.60619015",
"0.6049812",
"0.6040689",
"0.60222596",
"0.6001722",
"0.60011226",
"0.5974838",
"0.59656656",
"0.5947115",
"0.59... | 0.57908267 | 27 |
Vectorized function to calculate the greatcircle distance between two points or between vectors of points. Please note that this method is copied from OSMnx method of the same name, | def great_circle_vec(lat1: float,
lng1: float,
lat2: float,
lng2: float,
earth_radius: float=6371009.0) -> float:
phi1 = np.deg2rad(90 - lat1)
phi2 = np.deg2rad(90 - lat2)
theta1 = np.deg2rad(lng1)
theta2 = np.deg2rad(lng2)
cos = (np.sin(phi1) * np.sin(phi2) * np.cos(theta1 - theta2)
+ np.cos(phi1) * np.cos(phi2))
# Ignore warnings during this calculation because numpy warns it cannot
# calculate arccos for self-loops since u==v
with warnings.catch_warnings():
warnings.simplefilter('ignore')
arc = np.arccos(cos)
# Return distance in units of earth_radius
distance = arc * earth_radius
return distance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle_distance(A, B):\n AdotB = numpy.einsum('...i,...i', A, B)\n AcrossB = numpy.cross(A, B)\n last_axis = len(AcrossB.shape) - 1\n return arctan2(linalg.norm(AcrossB, axis=last_axis), AdotB)",
"def great_circle_distance(theta1,phi1,theta2,phi2):\n alt1 = np.pi/2.-theta1\n alt2 = np... | [
"0.7289671",
"0.70696187",
"0.70524025",
"0.69750804",
"0.69441026",
"0.69271106",
"0.6895158",
"0.6836602",
"0.6820166",
"0.6789631",
"0.67889583",
"0.6785679",
"0.67835736",
"0.67750597",
"0.6772455",
"0.67694485",
"0.6763788",
"0.6762551",
"0.6762438",
"0.6759875",
"0.6751... | 0.67869925 | 11 |
Helper to handle indices and logical indices of NaNs. | def nan_helper(y):
return (np.isnan(y), lambda z: z.to_numpy().nonzero()[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _index_to_nan_fast(data, existing_nans, to_nan):\n index_nan = []\n randgen = (np.random.choice(len(data)) for _ in cnt(start=1))\n for i in range(to_nan):\n ix = next(filter(lambda x: x not in existing_nans and x not in index_nan, randgen))\n index_nan.append(ix)\n da... | [
"0.67927897",
"0.67377245",
"0.67024386",
"0.6659169",
"0.6472418",
"0.6472418",
"0.6472418",
"0.6458507",
"0.64417696",
"0.6441317",
"0.6435194",
"0.643293",
"0.63825434",
"0.63670725",
"0.63670725",
"0.6343384",
"0.6341767",
"0.6341767",
"0.62725896",
"0.6230789",
"0.622121... | 0.6226348 | 20 |
Return True if the node is a "real" endpoint of an edge in the network, \ otherwise False. OSM data includes lots of nodes that exist only as \ points to help streets bend around curves. An end point is a node that \ | def is_endpoint(G: nx.Graph, node: int, strict=True):
neighbors = set(list(G.predecessors(node)) + list(G.successors(node)))
n = len(neighbors)
d = G.degree(node)
if node in neighbors:
# If the node appears in its list of neighbors, it self-loops. this is
# always an endpoint.
return True
# If node has no incoming edges or no outgoing edges, it must be an
# endpoint
elif G.out_degree(node) == 0 or G.in_degree(node) == 0:
return True
elif not (n == 2 and (d == 2 or d == 4)):
# Else, if it does NOT have 2 neighbors AND either 2 or 4 directed
# edges, it is an endpoint. either it has 1 or 3+ neighbors, in which
# case it is a dead-end or an intersection of multiple streets or has
# 2 neighbors but 3 degree (indicating a change from oneway to twoway)
# or more than 4 degree (indicating a parallel edge) and thus is an
# endpoint
return True
elif not strict:
# Non-strict mode
osmids = []
# Add all the edge OSM IDs for incoming edges
for u in G.predecessors(node):
for key in G[u][node]:
osmids.append(G.edges[u, node, key]['osmid'])
# Add all the edge OSM IDs for outgoing edges
for v in G.successors(node):
for key in G[node][v]:
osmids.append(G.edges[node, v, key]['osmid'])
# If there is more than 1 OSM ID in the list of edge OSM IDs then it is
# an endpoint, if not, it isn't
return len(set(osmids)) > 1
else:
# If none of the preceding rules returned true, then it is not an
# endpoint
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_is_edge(self, node: MazeCell) -> bool:\n return node.x == 0 or node.x == self._ncols - 1 or node.y == 0 or node.y == self._nrows - 1",
"def door_in_edge(self, edge: list) -> bool:\n doors = self.get_interior_doors()\n room1 = self.get_rooms()[edge[0]]\n room2 = self.get_rooms... | [
"0.6984057",
"0.62434214",
"0.62212586",
"0.61637247",
"0.6161208",
"0.6138825",
"0.61363894",
"0.6098323",
"0.60917765",
"0.6071788",
"0.60438186",
"0.6020851",
"0.5994252",
"0.5977758",
"0.59772736",
"0.59747833",
"0.5952888",
"0.5948707",
"0.5904112",
"0.58738995",
"0.5869... | 0.77966064 | 0 |
Recursively build a path of nodes until you hit an endpoint node. Please note this method is taken directly from OSMnx, and can be found in \ | def build_path(
G: nx.Graph,
node: int,
endpoints: List[int],
path: List[int]) -> List[int]:
# For each successor in the passed-in node
for successor in G.successors(node):
if successor not in path:
# If successor is already in path, ignore it, otherwise add to path
path.append(successor)
if successor not in endpoints:
# If successor not endpoint, recursively call
# build_path until endpoint found
path = build_path(G, successor, endpoints, path)
else:
# If successor is endpoint, path is completed, so return
return path
if (path[-1] not in endpoints) and (path[0] in G.successors(path[-1])):
# If end of the path is not actually an endpoint and the path's
# first node is a successor of the path's final node, then this is
# actually a self loop, so add path's first node to end of path to
# close it
path.append(path[0])
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(self,first_node,last_node):\n edge_pattern=re.compile('edge_(?P<begin_node>\\w+)_(?P<end_node>\\w+)_(?P<iterator>\\w+)')\n exit_paths=self.get_exiting_edges(first_node)\n next_nodes=self.get_exiting_nodes(first_node)\n #be careful here using the wrong assignment statement b... | [
"0.66372293",
"0.5984706",
"0.5966498",
"0.5830176",
"0.58110154",
"0.58090067",
"0.5781353",
"0.577707",
"0.5756183",
"0.5688646",
"0.56742686",
"0.5663207",
"0.5620114",
"0.56037915",
"0.5599367",
"0.55866355",
"0.5558341",
"0.5553427",
"0.5551647",
"0.55495954",
"0.5524534... | 0.7077985 | 0 |
Create a list of all the paths to be simplified between endpoint nodes. \ The path is ordered from the first endpoint, through the interstitial \ nodes, to the second endpoint. Please note this method is taken directly from OSMnx, and can be found in \ | def get_paths_to_simplify(G: nx.Graph, strict: bool=True) -> List[List[int]]:
# First identify all the nodes that are endpoints
endpoints = set([node for node in G.nodes()
if is_endpoint(G, node, strict=strict)])
# Initialize the list to be returned; an empty list
paths_to_simplify = []
# For each endpoint node, look at each of its successor nodes
for node in endpoints:
for successor in G.successors(node):
if successor not in endpoints:
# if the successor is not an endpoint, build a path from the
# endpoint node to the next endpoint node
try:
paths_to_simplify.append(
build_path(G,
successor,
endpoints,
path=[node, successor]))
except RuntimeError:
# Note: Recursion errors occur if some connected component
# is a self-contained ring in which all nodes are not
# end points handle it by just ignoring that
# component and letting its topology remain intact
# (this should be a rare occurrence).
log(('Recursion error: exceeded max depth, moving on to '
'next endpoint successor'), level=lg.WARNING)
return paths_to_simplify | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_paths(self):\n # convert to node sequences, dropping s'\n self.nodeseq_paths = []\n for path in self.paths:\n node_seq = [] # don't include s'\n for arc in path:\n node_seq.append(self.arc_info[arc]['destin'])\n self.nodeseq_paths.ap... | [
"0.66736597",
"0.65876526",
"0.64044726",
"0.6344763",
"0.6287056",
"0.6267099",
"0.6243408",
"0.6209103",
"0.61667985",
"0.6163704",
"0.61539465",
"0.6153504",
"0.61441976",
"0.61239386",
"0.6118913",
"0.611599",
"0.6104713",
"0.6080712",
"0.60661316",
"0.6046239",
"0.604591... | 0.68498194 | 0 |
Download a project from Dash and create a GIT repo for it. | def import_project(name, apikey, repo):
def validump_resource(jsonres, restype):
get_schema_validator(restype).validate(jsonres)
return json.dumps(jsonres)
def split_templates(spider, spider_filename, files):
templates = spider['templates']
spider['templates'] = []
spider['template_names'] = []
for template in templates:
template['name'] = template['page_id']
spider['template_names'].append(template['name'])
template_fname = os.path.join(
spider_filename.rpartition('.')[0],
str(template['name']) + '.json')
files[template_fname] = validump_resource(template, 'template')
archive = zipfile.ZipFile(StringIO(_download_project(name, apikey)))
files = {}
for filename in archive.namelist():
contents = archive.read(filename)
if filename == 'items.json':
resource = 'items'
elif filename == 'extractors.json':
resource = 'extractors'
elif filename.startswith('spiders'):
resource = 'spider'
else:
resource = None
if resource in ['items', 'spider', 'extractors']:
as_json = json.loads(contents)
if resource == 'items':
as_json = _fix_items(as_json)
elif resource == 'spider':
split_templates(as_json, filename, files)
contents = validump_resource(as_json, resource)
files[filename] = contents
if 'extractors.json' not in files:
files['extractors.json'] = '{}'
if ('items.json' not in files or not files['items.json'] or
files['items.json'] == '{}'):
files['items.json'] = DEFAULT_DASH_ITEM
repo.save_files(files, 'master', 'Publishing initial import.')
# XXX: Tell dash that project has been opened in Portia
deploy_project(name, apikey, changed_files=[]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_project(soup, github_user, github_pass, github_repo, github_name):\n giturl = 'https://{user}:{password}@github.com/{user}/{repo}.git'.format(\n user=github_user, password=github_pass, repo=github_repo\n )\n oldcwd = os.getcwd()\n tmpdir = tempfile.mkdtemp()\n gitdir = os.path.join(tm... | [
"0.6979374",
"0.6772234",
"0.65194136",
"0.6498187",
"0.6447341",
"0.6415485",
"0.63567287",
"0.62652856",
"0.62006974",
"0.6198321",
"0.6183075",
"0.61510575",
"0.61366624",
"0.6131653",
"0.6120334",
"0.6097073",
"0.60869515",
"0.6049519",
"0.6030718",
"0.60099995",
"0.59977... | 0.55959404 | 75 |
Archive a GIT project and upload it to Dash. | def deploy_project(name, apikey, changed_files=None, repo=None,
branch='master'):
zbuff = StringIO()
if changed_files is not None:
changed_files = list(set(changed_files) | REQUIRED_FILES)
_archive_project(name, zbuff, changed_files, repo, branch)
zbuff.reset()
payload = {'apikey': apikey, 'project': name}
req = requests.post(
DASH_API_URL + 'as/import.json?version=portia',
files=[('archive', ('archive', zbuff, 'application/zip'))],
params=payload
)
if req.status_code == 200:
project_url = DASH_API_URL.rsplit('/', 2)[0] + '/p/' + name
return {
'status': 'ok',
'schedule_url': project_url
}
else:
raise DeployError('Deploy to Dash failed: %s' % req.text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gitCreateArchive(self):\n self.vcs.gitCreateArchive(self.project.getProjectPath())",
"def upload_tar_from_git():\n require(\"release\", provided_by=[deploy])\n tree = prompt(\"Please enter a branch or SHA1 to deploy\", default=\"master\")\n local(\"git archive --format=tar %s | gzip > %s.ta... | [
"0.75925666",
"0.6769014",
"0.6449582",
"0.6398534",
"0.6263004",
"0.6191235",
"0.6138252",
"0.61108285",
"0.60195297",
"0.60129213",
"0.5945884",
"0.5934544",
"0.59011316",
"0.58871365",
"0.5878439",
"0.586114",
"0.58004034",
"0.57955575",
"0.5776379",
"0.5756278",
"0.572796... | 0.72552186 | 1 |
Search existing spider names in a project | def search_spider_names(project, apikey, name=''):
payload = {'project': project, 'apikey': apikey, 'spider': name}
req = requests.get(DASH_API_URL + 'spiders/list.json',
params=payload)
if req.status_code == 200:
return [s.get('id') for s in req.json().get('spiders', [])]
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dorkScanner():\n pysearch.PySearch()\n openfile = open(\"sites.txt\", 'r')\n urls = openfile.read()\n openfile.close()\n return urls",
"def _search(self, log, progressbar):\n self._urls = []\n for filename in os.listdir(self._path):\n url = 'file://... | [
"0.56716776",
"0.54362226",
"0.54334825",
"0.53485537",
"0.53356576",
"0.53022844",
"0.52963454",
"0.5276801",
"0.5274018",
"0.5273827",
"0.5265692",
"0.5207114",
"0.51662695",
"0.5152858",
"0.514631",
"0.512449",
"0.5115938",
"0.5112054",
"0.51114047",
"0.51075816",
"0.50923... | 0.7393245 | 0 |
Fixes issues with the imported items. | def _fix_items(items):
for _, item in items.iteritems():
if 'url' in item['fields']:
del item['fields']['url']
return items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OldItems(self) -> _n_1_t_7:",
"def _update_items(self):\n\n self._item_list = []\n for f in os.listdir(self._folder):\n # Skip text files\n # -> It is important that we don't delete the list file if the user puts it here!\n ext = os.path.splitext(f)[1]\n ... | [
"0.64752066",
"0.6060498",
"0.5853492",
"0.5822626",
"0.57927734",
"0.5723781",
"0.57142884",
"0.56797194",
"0.56612074",
"0.56152695",
"0.5584632",
"0.55636257",
"0.5530712",
"0.5489828",
"0.5485509",
"0.5458437",
"0.5394774",
"0.5328444",
"0.53041655",
"0.5287095",
"0.52847... | 0.5501716 | 13 |
Download a zipped project from Dash. | def _download_project(name, apikey):
payload = {'apikey': apikey, 'project': name, 'version': 'portia'}
r = requests.get(DASH_API_URL + 'as/project-slybot.zip', params=payload)
return r.content | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_data():\n url = 'https://www.dropbox.com/s/h9ubx22ftdkyvd5/ml-latest-small.zip?dl=1'\n urllib.request.urlretrieve(url, 'ml-latest-small.zip')\n zfile = zipfile.ZipFile('ml-latest-small.zip')\n zfile.extractall()\n zfile.close()",
"def x_download():\n\t#_loadconfig()\n\tconf = _get_con... | [
"0.6970031",
"0.6887985",
"0.68189776",
"0.681829",
"0.6720921",
"0.66710734",
"0.65784806",
"0.65546376",
"0.6551284",
"0.6536828",
"0.64772105",
"0.63660634",
"0.63608265",
"0.635872",
"0.634232",
"0.63057834",
"0.630051",
"0.6292988",
"0.6290236",
"0.62840354",
"0.62497574... | 0.7049751 | 0 |
Add a file to a zip archive. | def _add_to_archive(archive, filename, contents, tstamp):
fileinfo = zipfile.ZipInfo(filename, tstamp)
fileinfo.external_attr = 0666 << 16L
archive.writestr(fileinfo, contents, zipfile.ZIP_DEFLATED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, *args, **kwargs):\n self.zipfile.write(*args, **kwargs)",
"def add_to_zip(zipfile, zippath, files):\n \n if zipfile == 'n' or zipfile == '':\n return False\n zippath = os.path.normpath(zippath) + '/'\n if os.path.isdir(zippath):\n z = subprocess.call(['zip', '-0', z... | [
"0.73756856",
"0.7169092",
"0.6900707",
"0.68461806",
"0.66883737",
"0.6629361",
"0.66237056",
"0.64670384",
"0.6460916",
"0.64255655",
"0.636943",
"0.6339873",
"0.6218348",
"0.6186335",
"0.6168846",
"0.6077438",
"0.6057466",
"0.6050394",
"0.6045798",
"0.60440147",
"0.5943286... | 0.6727953 | 4 |
Archive a project stored in GIT into a zip file. | def _archive_project(name, buff, files=None, repo=None, branch='master',
ignore_deleted=False):
if repo is None:
repo = Repoman.open_repo(name)
now = datetime.now().timetuple()[:6]
archive = zipfile.ZipFile(buff, "w", zipfile.ZIP_DEFLATED)
files_list = files if files is not None else \
repo.list_files_for_branch(branch)
all_files = files_list if files is None else \
repo.list_files_for_branch(branch)
template_paths = defaultdict(list)
for file_path in all_files:
split_file_path = file_path.split('/')
if len(split_file_path) > 2:
template_paths[split_file_path[1]].append(file_path)
extractors = json.loads(repo.file_contents_for_branch('extractors.json',
branch) or '{}')
seen_files = set()
spiders = set()
for file_path in files_list:
if file_path.startswith('spiders'):
try:
parts = file_path.split("/")
if len(parts) >= 2:
spider_name = parts[1]
if spider_name.endswith('.json'):
spider_name = spider_name[:-5]
if spider_name not in spiders:
# Load spider if necessary
if len(parts) > 2:
file_path = 'spiders/' + spider_name + '.json'
file_contents = repo.file_contents_for_branch(
file_path, branch)
as_json = json.loads(file_contents)
templates = []
# Load all spider templates
spider_templates = template_paths.get(spider_name, [])
for template_path in spider_templates:
seen_files.add(template_path)
existing = {}
# Ignore deleted templates
try:
templ_contents = repo.file_contents_for_branch(
template_path, branch)
except (TypeError, ValueError):
continue
json_template = json.loads(templ_contents)
# Validate extractors
template_extractors = json_template.get(
'extractors', {})
for field, eids in template_extractors.items():
existing[field] = [eid for eid in eids
if eid in extractors]
json_template['extractors'] = existing
spider_name = parts[1]
templates.append(json_template)
spiders.add(spider_name)
as_json.pop('template_names', None)
as_json['templates'] = templates
_add_to_archive(archive, file_path,
json.dumps(as_json), now)
except TypeError:
if ignore_deleted:
continue
# Handle Deleted Spiders
file_contents = repo.file_contents_for_branch(file_path,
'master')
file_info = {'deleted': True}
if file_contents:
as_json = json.loads(file_contents)
_add_to_archive(archive, file_path, json.dumps(file_info), now)
else:
file_contents = repo.file_contents_for_branch(file_path, branch)
_add_to_archive(archive, file_path, file_contents, now)
seen_files.add(file_path)
# Add empty placeholders for missing files required by dash
for file_path in {'extractors.json', 'items.json'} - seen_files:
_add_to_archive(archive, file_path, '{}', now)
archive.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gitCreateArchive(self):\n self.vcs.gitCreateArchive(self.project.getProjectPath())",
"def archive(project, filename, pack_envs=False):\n return archiver._archive_project(project, filename, pack_envs)",
"def archive_projectbuild(projectbuild, archive):\n transport = get_transport_for_projectb... | [
"0.76189184",
"0.7322678",
"0.67856395",
"0.6666653",
"0.6537198",
"0.65115416",
"0.6488287",
"0.64775175",
"0.6187276",
"0.6164838",
"0.6076534",
"0.6037745",
"0.5955031",
"0.58592504",
"0.5741227",
"0.5725475",
"0.56754285",
"0.56595165",
"0.5650359",
"0.56347746",
"0.56084... | 0.6150292 | 10 |
Convert to front facing coordinates | def get_front_facing_xz(self):
yaw_radian = math.radians(self.cur_rotation)
return cam.step * math.sin(yaw_radian) * math.cos(0), cam.step * math.cos(
yaw_radian) * math.cos(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frontFace(self):\n\n if not self.threedee:\n return gl.GL_CCW\n\n # Only looking at the mesh -> display\n # transform, thus we are assuming that\n # the MVP matrix does not have any\n # negative scales.\n xform = self.opts.getTransform('mesh', 'display')\n\n... | [
"0.6466102",
"0.5958782",
"0.59478974",
"0.59458196",
"0.5798166",
"0.57393557",
"0.5688547",
"0.56672025",
"0.56672025",
"0.56627524",
"0.5614368",
"0.5602697",
"0.5566901",
"0.5562923",
"0.55597514",
"0.5549741",
"0.55102384",
"0.55058265",
"0.54947865",
"0.54475546",
"0.54... | 0.7374416 | 0 |
Returns the projection matrix for perspective Multiply the position of the camera by the matrix that this function returns | def get_perspective_matrix(fov_degrees, aspect, near, far):
radians = math.radians(fov_degrees)
zoom = 1 / math.tan(radians / 2)
y_zoom = zoom
x_zoom = y_zoom / aspect
z_clip_a = (far + near) / (far - near)
z_clip_b = (-2 * near * far) / (far - near)
return np.matrix([[x_zoom, 0, 0, 0],
[0, y_zoom, 0, 0],
[0, 0, z_clip_a, z_clip_b],
[0, 0, 1, 0]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def projection_matrix(self):\n scene = self.figure.scene\n scene_size = tuple(scene.get_size())\n aspect_ratio = float(scene_size[0]) / float(scene_size[1])\n p = scene.camera.get_perspective_transform_matrix(\n aspect_ratio, -1, 1).to_array().astype(np.float32)\n retu... | [
"0.82109255",
"0.76279783",
"0.7519905",
"0.7222865",
"0.72145",
"0.7192118",
"0.71746266",
"0.71618414",
"0.71552086",
"0.7016673",
"0.7000344",
"0.69891137",
"0.68717843",
"0.6742718",
"0.6740875",
"0.6684819",
"0.66156596",
"0.66130567",
"0.6575204",
"0.6541649",
"0.652216... | 0.6639653 | 16 |
Return the x,y coordinates to be drawn onto the screen | def to_screen_space(vertex_coordinates):
w = DISPLAY_WIDTH / 2
h = DISPLAY_HEIGHT / 2
screen_matrix = np.matrix([[w, 0, w],
[0, -h, h],
[0, 0, 1]])
x, y = vertex_coordinates.item(0), vertex_coordinates.item(1)
xy_matrix = np.array([[x],
[y],
[1]])
new_coordinates = screen_matrix * xy_matrix
return new_coordinates.item(0), new_coordinates.item(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos(self):\n x = (self.ec._win._mouse_x -\n self.ec._win.width / 2.) / (self.ec._win.width / 2.)\n y = (self.ec._win._mouse_y -\n self.ec._win.height / 2.) / (self.ec._win.height / 2.)\n return np.array([x, y])",
"def position(self):\n return self.x, self.y... | [
"0.74338204",
"0.7273958",
"0.7184046",
"0.71780956",
"0.7090324",
"0.7082188",
"0.70618874",
"0.7055416",
"0.6984277",
"0.6973121",
"0.6973121",
"0.69694185",
"0.6959739",
"0.69450396",
"0.6911599",
"0.69074255",
"0.6878503",
"0.68669933",
"0.68637353",
"0.6858139",
"0.68471... | 0.0 | -1 |
Use push so that you can apply some transformations at the same time? 1. Push the matrix from stack 2. Translate to position 3. Rotate it 4. Draw it 5. Pop the matrix | def animate_car():
car_lines = []
tire_lines = []
# move car along
# glPushMatrix()
offset = [car.position.x, car.position.y, car.position.z]
transformation_matrix = push_translation_rotation_matrix(offset, 0)
# glTranslated(car.position.x, car.position.y, car.position.z)
car_lines.extend(draw_object(loadCar(), transformation_matrix)) # draw car
# drawCar()
# translate and rotate tires
for tire in car.tires:
offset = [tire.x, tire.y, tire.z]
transformation_matrix = push_translation_rotation_matrix(offset, car.tire_rotation,
rot_type="z")
tire_lines.extend(draw_object(loadTire(), transformation_matrix))
pop_matrix()
pop_matrix()
return car_lines, tire_lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_back(self, *args):\n return _osgAnimation.vectorMatrixKeyframe_push_back(self, *args)",
"def __compose_transformation(self):\n s = self.scale\n rotR = self.rotation\n t = self.translation\n T = np.eye(4)\n T[0:3, 3] = t\n R = np.eye(4)\n R[0:3, 0:3... | [
"0.5731514",
"0.55714095",
"0.5549019",
"0.5508666",
"0.54710567",
"0.5439961",
"0.54302526",
"0.54240656",
"0.54170287",
"0.538028",
"0.5372096",
"0.53379256",
"0.5318458",
"0.52991873",
"0.5291928",
"0.5278679",
"0.52785045",
"0.5269717",
"0.5255685",
"0.5236553",
"0.522799... | 0.0 | -1 |
Return escaped replacement text | def esc(matchObj):
if matchObj.group(1) == None: # no tags found
return u'<xsl:text>%s</xsl:text>' % \
escape(matchObj.group(3), escDict)
if matchObj.group(1): # leading text and tag
return u'<xsl:text>%s</xsl:text>%s' % \
(escape(matchObj.group(1), escDict), matchObj.group(2))
return matchObj.group(2) # tag only | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape_tex(value):\n newval = value\n for pattern, replacement in LATEX_SUBS:\n newval = pattern.sub(replacement, newval)\n return newval",
"def escape_tex(value):\n # This code, and the code that call this is courtesy of Clemens Kaposi\n # http://flask.pocoo.org/snippets/55/\n\n LAT... | [
"0.7457513",
"0.72451824",
"0.70088613",
"0.7005204",
"0.69938093",
"0.69180393",
"0.6908549",
"0.6808867",
"0.67575586",
"0.6719324",
"0.6687371",
"0.66694325",
"0.66232425",
"0.6604365",
"0.6604365",
"0.65418816",
"0.65407073",
"0.6530385",
"0.6503265",
"0.64981174",
"0.638... | 0.6266012 | 25 |
Any prefix, suffix, html info in attrs dict | def __init__(self, name, attrs={}):
self.name = name
self.enName = '' # used only by fileFormat field for i18n
self.format = attrs.get(u'format', self.defaultFormat)
self.prefix = attrs.get(u'prefix', '')
self.suffix = attrs.get(u'suffix', '')
# defaults to no html (line breaks preserved)
self.html = attrs.get(u'html', '').startswith('y') and True or False
self.isRequired = attrs.get(u'required', '').startswith('y') and \
True or False
self.hidden = attrs.get(u'hidden', '').startswith('y') and \
True or False
try:
self.numLines = int(attrs.get(u'lines',
repr(self.defaultNumLines)))
except ValueError:
self.numLines = 1
self.initDefault = attrs.get(u'init', '')
self.linkAltField = attrs.get(u'linkalt', '')
self.parentLevel = 0
self.useFileInfo = False
self.showInDialog = True
self.initFormat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html",
"def attrs(context):\n result = \"\"\n for key, value in context.flatten().items():\n if key not in [\"True\", \"False\", \"None\", \"content\",... | [
"0.7300376",
"0.6683452",
"0.6659504",
"0.64727515",
"0.64727515",
"0.62650347",
"0.6180911",
"0.6167985",
"0.6159097",
"0.61425793",
"0.60942423",
"0.60043186",
"0.59867054",
"0.5983518",
"0.5977403",
"0.59542763",
"0.5950838",
"0.59435284",
"0.593862",
"0.5918919",
"0.59183... | 0.0 | -1 |
Called by base init, after class change or format text change | def initFormat(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_text(self):\n d = self.declaration\n if d.text:\n self.set_text(d.text)\n if d.text_color:\n self.set_text_color(d.text_color)\n if d.text_alignment:\n self.set_text_alignment(d.text_alignment)\n if d.font_family or d.text_size:\n ... | [
"0.70883477",
"0.6957401",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6801035",
"0.67764556",
"0.67764556",
"0.6772573",
"0.67218834",
"0.6665987",
"0.6530844",
"0.6495981",
"0.6494592",
"0.6494592",... | 0.7095915 | 0 |
Assign other field's parameters to this field | def duplicateSettings(self, otherField):
self.name = otherField.name
self.enName = otherField.enName
self.format = otherField.format
self.prefix = otherField.prefix
self.suffix = otherField.suffix
self.html = otherField.html
self.isRequired = otherField.isRequired
self.hidden = otherField.hidden
self.numLines = otherField.numLines
self.initDefault = otherField.initDefault
self.linkAltField = otherField.linkAltField
self.parentLevel = otherField.parentLevel
self.useFileInfo = otherField.useFileInfo
self.showInDialog = otherField.showInDialog | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assign_fields_to_params(cls, fields, params):\n if fields is None:\n fields = cls.get_default_read_fields()\n if fields:\n params['fields'] = ','.join(fields)",
"def set(self, other):\n if self.id is None:\n self._values = other\n else:\n ... | [
"0.65146065",
"0.6420237",
"0.6390991",
"0.6363737",
"0.6293439",
"0.6233246",
"0.6145043",
"0.6098568",
"0.6090508",
"0.6078845",
"0.6076885",
"0.60532725",
"0.60103554",
"0.60103554",
"0.60075897",
"0.5986646",
"0.5981647",
"0.59416527",
"0.5925342",
"0.5911154",
"0.5895669... | 0.6253937 | 5 |
Change this field's type to newType with default format | def changeType(self, newType):
self.__class__ = globals()[newType + 'Format']
self.format = self.defaultFormat
self.initFormat() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_type_converter(self, old_type):\n\n if old_type == 'String':\n new_type = 'Text'\n elif old_type == 'Integer':\n new_type = 'Short'\n elif old_type == 'Date':\n new_type = 'Date'\n elif old_type == 'GlobalID':\n new_type = 'GUID'\n ... | [
"0.7694419",
"0.6731671",
"0.6345279",
"0.6247612",
"0.6140391",
"0.6116279",
"0.60566497",
"0.60437393",
"0.6029452",
"0.6012749",
"0.5938881",
"0.589731",
"0.58825034",
"0.58494186",
"0.582059",
"0.58018064",
"0.57945174",
"0.57587177",
"0.57267576",
"0.5711055",
"0.5708371... | 0.7249991 | 1 |
Returns English name if assigned, o/w name | def englishName(self):
if self.enName:
return self.enName
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def english_name(self) -> str | None:\n return self.get_display_name(Locale('en'))",
"def get_localized_name(name):\n locale = \"{}_{}\".format(\n name[\"preferredLocale\"][\"language\"],\n name[\"preferredLocale\"][\"country\"]\n )\n return name['localized'].get(locale, '')",
"de... | [
"0.7934382",
"0.73227644",
"0.7047755",
"0.6930511",
"0.68412167",
"0.6786411",
"0.67855275",
"0.6760979",
"0.6730141",
"0.6662109",
"0.6648933",
"0.66485107",
"0.66408026",
"0.6632018",
"0.65623486",
"0.655018",
"0.65476584",
"0.6501709",
"0.64950544",
"0.64857614",
"0.64754... | 0.80885744 | 0 |
Return name enclosed with { } separators | def sepName(self, englishOnly=False):
name = englishOnly and self.enName or self.name
if not self.useFileInfo:
return u'{*%s*}' % name
return u'{*!%s*}' % name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_name():\n def _extract_name(quoted_name):\n return e.String(quoted_name.subexpression.name)\n yield (\"(λ &[name] . str)\", _extract_name)",
"def _extract_name(line: str) -> str:\n tokens = line[19:-2].split(\" {\")\n name = tokens[0]\n return name",
"def format_na... | [
"0.70919734",
"0.69829744",
"0.68450254",
"0.67303866",
"0.6666624",
"0.66044873",
"0.65953267",
"0.65891093",
"0.65593725",
"0.623893",
"0.6218805",
"0.61895317",
"0.61869186",
"0.6163495",
"0.6100971",
"0.6099947",
"0.6092239",
"0.607046",
"0.60489154",
"0.6042493",
"0.6029... | 0.0 | -1 |
Return name used for labels add for required fields | def labelName(self):
if self.isRequired:
return '%s*' % self.name
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"label_name\")",
"def build_label_text(field_name: str, field: dict):\n\n label = \"\"\n if \"required\" in field:\n label = \" * \" if field.get(\"required\") else \"\"\n\n # If we don't have a label def... | [
"0.7235186",
"0.7140648",
"0.7047591",
"0.7011272",
"0.69102323",
"0.678387",
"0.678387",
"0.678387",
"0.678387",
"0.678387",
"0.678387",
"0.67811215",
"0.67751276",
"0.67363954",
"0.67283016",
"0.6711237",
"0.6679455",
"0.6657541",
"0.66369164",
"0.65833545",
"0.65801924",
... | 0.82659084 | 0 |
Return text for xml attributes | def writeXml(self):
text = u' type="%s"' % self.typeName
if self.format:
text += u' format="%s"' % escape(self.format, treedoc.escDict)
if self.prefix:
text += u' prefix="%s"' % escape(self.prefix, treedoc.escDict)
if self.suffix:
text += u' suffix="%s"' % escape(self.suffix, treedoc.escDict)
if self.html:
text += u' html="y"'
if self.isRequired:
text += u' required="y"'
if self.hidden:
text += u' hidden="y"'
if self.numLines > 1:
text += u' lines="%d"' % self.numLines
if self.initDefault:
text += u' init="%s"' % escape(self.initDefault, treedoc.escDict)
if self.linkAltField:
text += u' linkalt="%s"' % escape(self.linkAltField,
treedoc.escDict)
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attrs(xml):\r\n return lxml.html.fromstring(xml).attrib",
"def AttributeString(self) -> str:",
"def AttributeString(self) -> str:",
"def attrsToString(self, attrs):\n string = \"\"\n # for every attribut\n for attr in attrs:\n # converts its name and value to string and... | [
"0.7418472",
"0.7217796",
"0.7217796",
"0.6662724",
"0.6609409",
"0.65585464",
"0.65371746",
"0.6463625",
"0.6277733",
"0.6217797",
"0.6175163",
"0.6160595",
"0.61249447",
"0.61248875",
"0.6103389",
"0.60987955",
"0.6094574",
"0.60763466",
"0.6030213",
"0.60041815",
"0.599579... | 0.0 | -1 |
Return formatted text for this field | def outputText(self, item, titleMode, internal=False):
if self.useFileInfo:
item = globalref.docRef.fileInfoItem
storedText = item.data.get(self.name, '')
if storedText:
return self.formatOutput(storedText, titleMode, internal)
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_text(self):\n\n return \"{}{}{}\".format(self.get_text(),\n Message.format_performers(self.get_performers()),\n Message.format_keywords(self.get_keywords())).strip()",
"def formatted(self) -> str:\r\n ...",
"def format(self) -> str:",
"def text(self) -> str:",
... | [
"0.75734353",
"0.7379207",
"0.7205578",
"0.68481845",
"0.67844886",
"0.67808527",
"0.67703915",
"0.67703915",
"0.67655444",
"0.6745665",
"0.6687435",
"0.66469747",
"0.6644202",
"0.66413474",
"0.65842545",
"0.65842545",
"0.65842545",
"0.65842545",
"0.65842545",
"0.65741307",
"... | 0.0 | -1 |
Remove HTML Markup and unescape entities | def removeMarkup(self, text):
text = TextFormat.stripTagRe.sub('', text)
return unescape(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape_html_entities(self, text):\n text = html.unescape(text)\n return text",
"def unescape_html(text):\n\n def fixup(m):\n text = m.group(0)\n if text[:2] == \"&#\":\n # character reference\n try:\n if text[:3] == \"&#x\":\n ... | [
"0.8015007",
"0.77196825",
"0.7664597",
"0.75644994",
"0.75601804",
"0.74361134",
"0.74127716",
"0.7398852",
"0.7363433",
"0.72552484",
"0.72305125",
"0.7151913",
"0.71092284",
"0.7063701",
"0.70483255",
"0.7035279",
"0.7028564",
"0.702725",
"0.7001328",
"0.6975736",
"0.69723... | 0.68237066 | 25 |
Return formatted text, properly escaped if not in titleMode | def formatOutput(self, storedText, titleMode, internal=False):
prefix = self.prefix
suffix = self.suffix
if titleMode:
if self.html:
storedText = self.removeMarkup(storedText)
if globalref.docRef.formHtml:
prefix = self.removeMarkup(prefix)
suffix = self.removeMarkup(suffix)
else:
if not self.html:
storedText = escape(storedText).replace('\n', '<br />')
if not globalref.docRef.formHtml:
prefix = escape(prefix)
suffix = escape(suffix)
return u'%s%s%s' % (prefix, storedText, suffix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def title(text, level=0):\n return '\\n' + text + '\\n' + '=-~_#%^' [level] * len(text) + '\\n\\n'",
"def format_title(self, data):\n return data",
"def output_plain_sep_title(title):\n print(f\"{plain_sep_mark}\\t{title}{plain_sep_mark}\")",
"def formatOutput(self, storedText, titleMode, intern... | [
"0.6623557",
"0.64947814",
"0.6347113",
"0.6307539",
"0.621596",
"0.6210496",
"0.60684896",
"0.60674477",
"0.60663515",
"0.60421175",
"0.6019259",
"0.59935653",
"0.59802073",
"0.59790826",
"0.595393",
"0.5948588",
"0.5939195",
"0.590317",
"0.5872387",
"0.58521676",
"0.5838757... | 0.67517006 | 0 |
Return tuple of this field's text in edit format and bool validity, using edit format option | def editText(self, item):
storedText = item.data.get(self.name, '')
result = self.formatEditText(storedText)
if self.isRequired and not result[0]:
return (result[0], False)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.7739331",
"0.76100457",
"0.7482231",
"0.7482231",
"0.7214738",
"0.7091386",
"0.702513",
"0.7018469",
"0.6923507",
"0.67845714",
"0.67359626",
"0.6618689",
"0.6553471",
"0.6410668",
"0.63894486",
"0.6138071",
"0.56394523",
"0.5639128",
"0.5639128",
"0.5639128",
"0.5639128",... | 0.76801556 | 1 |
Return tuple of text in edit format and bool validity, using edit format option | def formatEditText(self, storedText):
return (storedText, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.74409115",
"0.7369682",
"0.71582556",
"0.7035388",
"0.7028556",
"0.6883685",
"0.6550002",
"0.6452589",
"0.6391841",
"0.6309491",
"0.6299821",
"0.61874855",
"0.60250795",
"0.583455",
"0.5770457",
"0.573678",
"0.5614053",
"0.5609872",
"0.56041586",
"0.55477756",
"0.53100324"... | 0.7101609 | 3 |
Return tuple of stored text from edited text and bool validity, using edit format option | def storedText(self, editText):
return (editText, editText or not self.isRequired) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.78716373",
"0.76830506",
"0.75691116",
"0.75691116",
"0.7379154",
"0.73117137",
"0.7183602",
"0.7152062",
"0.7089976",
"0.6903923",
"0.6863199",
"0.68065554",
"0.6748621",
"0.6604557",
"0.61224514",
"0.6009547",
"0.5690611",
"0.5690611",
"0.5690611",
"0.5690611",
"0.569061... | 0.62711895 | 14 |
Return initial stored value for new nodes | def getInitDefault(self):
return self.initDefault | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_value(self):\r\n if self.initial_value is None:\r\n return None\r\n\r\n return deepcopy(self.initial_value)",
"def initial_value(self):\n return self._initial_value",
"def initial(self):\n return zero",
"def initial_value(self) -> float:\n return self... | [
"0.6917573",
"0.6599723",
"0.64693916",
"0.62434894",
"0.6088791",
"0.605029",
"0.6040265",
"0.5898664",
"0.58754563",
"0.5820543",
"0.5805469",
"0.5794411",
"0.57890224",
"0.57560384",
"0.5747938",
"0.57314616",
"0.5730434",
"0.5725593",
"0.57140493",
"0.57140493",
"0.569943... | 0.0 | -1 |
Set initial value from editor version using edit format option | def setInitDefault(self, editText):
self.initDefault = self.storedText(editText)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setInitDefault(self, editText):\n if editText in DateFormat.dateStampStrings:\n self.initDefault = DateFormat.dateStampStrings[0]\n else:\n TextFormat.setInitDefault(self, editText)",
"def getEditInitDefault(self):\n if self.initDefault in DateFormat.dateStampString... | [
"0.62972623",
"0.62713385",
"0.62475604",
"0.60933644",
"0.6084278",
"0.60778177",
"0.6009081",
"0.5782725",
"0.561945",
"0.5530775",
"0.54974884",
"0.549157",
"0.54463965",
"0.54128057",
"0.5395345",
"0.5382154",
"0.53760034",
"0.5361667",
"0.53412473",
"0.52998084",
"0.5289... | 0.6216652 | 3 |
Return initial value in edit format, found in edit format option | def getEditInitDefault(self):
return self.formatEditText(self.initDefault)[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditInitDefault(self):\n if self.initDefault in DateFormat.dateStampStrings:\n return DateFormat.dateStampStrings[1]\n return TextFormat.getEditInitDefault(self)",
"def getEditInitDefault(self):\n if self.initDefault in TimeFormat.timeStampStrings:\n return TimeF... | [
"0.69168735",
"0.6777391",
"0.6163817",
"0.5962609",
"0.59190995",
"0.5825621",
"0.5639453",
"0.55958575",
"0.5588548",
"0.55880916",
"0.55728984",
"0.5547174",
"0.55372924",
"0.5518307",
"0.55125266",
"0.54999983",
"0.54888153",
"0.54888153",
"0.54887563",
"0.5471209",
"0.54... | 0.7327655 | 0 |
Return a list of choices for setting the init default | def initDefaultChoices(self):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initDefaultChoices(self):\n return [entry[0] for entry in self.getEditChoices()]",
"def initDefaultChoices(self):\n return [text for text in self.formatList]",
"def initDefaultChoices(self):\n choices = [entry[0] for entry in self.getEditChoices()]\n choices.insert(0, DateFormat... | [
"0.83096915",
"0.8089902",
"0.7565213",
"0.7451019",
"0.699929",
"0.699929",
"0.680488",
"0.67091656",
"0.66209406",
"0.65692645",
"0.6532258",
"0.6486172",
"0.64289325",
"0.6406578",
"0.63146526",
"0.62376446",
"0.62375015",
"0.62119025",
"0.61605716",
"0.6160515",
"0.608993... | 0.8791058 | 0 |
Return value to be compared for sorting and conditionals | def sortValue(self, data):
storedText = data.get(self.name, '')
return storedText.lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(self, value: int, /) -> None:",
"def compare(self) -> int:",
"def compareFunction( self, first, second ):\n for ascending,column in self.sortOrder:\n aValue,bValue = column.get(first),column.get(second)\n diff = cmp(aValue,bValue)\n if diff:\n ... | [
"0.6866802",
"0.6862163",
"0.6673221",
"0.63514173",
"0.63514173",
"0.63162124",
"0.6138884",
"0.6054708",
"0.60404193",
"0.5911979",
"0.5881882",
"0.5874233",
"0.58493686",
"0.58137196",
"0.5800126",
"0.57923204",
"0.57919735",
"0.5789459",
"0.57723606",
"0.576029",
"0.57464... | 0.0 | -1 |
Return conditional comparison value with realtime adjustments, used for date and time types' 'now' value | def adjustedCompareValue(self, value):
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjustedCompareValue(self, value):\n if value.startswith('now'):\n return repr(GenTime())\n return value",
"def adjustedCompareValue(self, value):\n if value.startswith('now'):\n return repr(GenDate())\n return value",
"def condition(self):\n HH = st... | [
"0.71395195",
"0.68972015",
"0.61192656",
"0.6031985",
"0.60295343",
"0.5849544",
"0.5812679",
"0.5812679",
"0.58069235",
"0.56918633",
"0.56755346",
"0.5637127",
"0.55914676",
"0.558945",
"0.557699",
"0.55746406",
"0.55669403",
"0.5496197",
"0.5487749",
"0.54704833",
"0.5465... | 0.517292 | 51 |
Return what we need to write into an XSL file for this type | def xslText(self):
return u'<xsl:if test="normalize-space(./%s)">%s'\
'<xsl:value-of select="./%s"/>%s</xsl:if>' % \
(self.name, xslEscape(self.prefix), self.name,
xslEscape(self.suffix)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, f):\n tree = f.build_etree(lxml=True)\n return self.xslt(tree)",
"def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)... | [
"0.63645554",
"0.61521673",
"0.5836575",
"0.58352655",
"0.58135927",
"0.56414604",
"0.5629727",
"0.56010044",
"0.55846775",
"0.55454504",
"0.552621",
"0.5517293",
"0.55145675",
"0.5513024",
"0.54559094",
"0.54535353",
"0.5428844",
"0.5306545",
"0.52981937",
"0.52909887",
"0.5... | 0.54010373 | 17 |
Return XSL file test for data existance | def xslTestText(self):
return u'normalize-space(./%s)' % self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)\n newdom = transform(dom)\n except IOError:\n print \"Xml or Xsl file not found... | [
"0.5755427",
"0.5572019",
"0.5549192",
"0.5519365",
"0.5482828",
"0.5464173",
"0.5427079",
"0.54160964",
"0.536601",
"0.5338898",
"0.52344614",
"0.5227911",
"0.51953274",
"0.5182521",
"0.51584786",
"0.51524824",
"0.51514745",
"0.51503146",
"0.511027",
"0.5074203",
"0.5046354"... | 0.46658367 | 85 |
Any format, prefix, suffix, html info in attrs dict | def __init__(self, name, attrs={}):
TextFormat.__init__(self, name, attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html",
"def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)",
"def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite... | [
"0.735201",
"0.6754294",
"0.67166066",
"0.67071074",
"0.66780305",
"0.65807486",
"0.6522693",
"0.6522693",
"0.65187657",
"0.6471306",
"0.6269984",
"0.62653935",
"0.6153201",
"0.6090701",
"0.60323846",
"0.60278016",
"0.6011661",
"0.60042846",
"0.59841794",
"0.5941162",
"0.5920... | 0.0 | -1 |
Any format, prefix, suffix, html info in attrs dict | def __init__(self, name, attrs={}):
TextFormat.__init__(self, name, attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html",
"def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)",
"def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite... | [
"0.735201",
"0.6754294",
"0.67166066",
"0.67071074",
"0.66780305",
"0.65807486",
"0.6522693",
"0.6522693",
"0.65187657",
"0.6471306",
"0.6269984",
"0.62653935",
"0.6153201",
"0.6090701",
"0.60323846",
"0.60278016",
"0.6011661",
"0.60042846",
"0.59841794",
"0.5941162",
"0.5920... | 0.0 | -1 |
Return formatted text, properly escaped if not in titleMode | def formatOutput(self, storedText, titleMode, internal=False):
try:
text = GenNumber(storedText).numStr(self.format)
except GenNumberError:
text = _errorStr
return TextFormat.formatOutput(self, text, titleMode, internal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatOutput(self, storedText, titleMode, internal=False):\n prefix = self.prefix\n suffix = self.suffix\n if titleMode:\n if self.html:\n storedText = self.removeMarkup(storedText)\n if globalref.docRef.formHtml:\n prefix = self.removeMa... | [
"0.67517006",
"0.6623557",
"0.64947814",
"0.6347113",
"0.6307539",
"0.621596",
"0.6210496",
"0.60684896",
"0.60674477",
"0.60663515",
"0.60421175",
"0.6019259",
"0.59935653",
"0.59802073",
"0.59790826",
"0.595393",
"0.5948588",
"0.5939195",
"0.590317",
"0.5872387",
"0.5852167... | 0.5630319 | 47 |
Return tuple of text in edit format and bool validity, using self.format | def formatEditText(self, storedText):
try:
return (GenNumber(storedText).numStr(self.format), True)
except GenNumberError:
return (storedText, not storedText) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.75339824",
"0.75120217",
"0.7407906",
"0.73783916",
"0.73783916",
"0.7370748",
"0.7224785",
"0.71053016",
"0.6644924",
"0.66019595",
"0.6499535",
"0.6417826",
"0.64168525",
"0.6153556",
"0.6028552",
"0.58961284",
"0.5666202",
"0.5544326",
"0.5529664",
"0.552194",
"0.551375... | 0.68091875 | 8 |
Return tuple of stored text from edited text and bool validity, using self.format | def storedText(self, editText):
try:
return (repr(GenNumber().setFromStr(editText, self.format)), True)
except GenNumberError:
return (editText, not editText and not self.isRequired) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.7803675",
"0.77552223",
"0.7596814",
"0.7596814",
"0.73449266",
"0.7324226",
"0.7316339",
"0.7187415",
"0.71592367",
"0.6829843",
"0.67425257",
"0.6727259",
"0.66042066",
"0.6263688",
"0.6086649",
"0.5922825",
"0.58909976",
"0.58909976",
"0.58909976",
"0.58909976",
"0.5890... | 0.68767637 | 9 |
Return value to be compared for sorting and conditionals | def sortValue(self, data):
storedText = data.get(self.name, '')
try:
return GenNumber(storedText).num
except GenNumberError:
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(self, value: int, /) -> None:",
"def compare(self) -> int:",
"def compareFunction( self, first, second ):\n for ascending,column in self.sortOrder:\n aValue,bValue = column.get(first),column.get(second)\n diff = cmp(aValue,bValue)\n if diff:\n ... | [
"0.68654275",
"0.68611443",
"0.66724616",
"0.6351402",
"0.6351402",
"0.63162804",
"0.6138383",
"0.6053028",
"0.6039845",
"0.5910521",
"0.58821",
"0.58723485",
"0.5849007",
"0.5812883",
"0.5799768",
"0.57915914",
"0.5790346",
"0.57894623",
"0.5771585",
"0.5759572",
"0.5746019"... | 0.0 | -1 |
Any format, prefix, suffix, html info in attrs dict | def __init__(self, name, attrs={}):
TextFormat.__init__(self, name, attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html",
"def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)",
"def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite... | [
"0.735201",
"0.6754294",
"0.67166066",
"0.67071074",
"0.66780305",
"0.65807486",
"0.6522693",
"0.6522693",
"0.65187657",
"0.6471306",
"0.6269984",
"0.62653935",
"0.6153201",
"0.6090701",
"0.60323846",
"0.60278016",
"0.6011661",
"0.60042846",
"0.59841794",
"0.5941162",
"0.5920... | 0.0 | -1 |
Called by base init, after class change or format text change | def initFormat(self):
self.formatList = self.splitText(self.format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initFormat(self):\n pass",
"def init_text(self):\n d = self.declaration\n if d.text:\n self.set_text(d.text)\n if d.text_color:\n self.set_text_color(d.text_color)\n if d.text_alignment:\n self.set_text_alignment(d.text_alignment)\n i... | [
"0.7095915",
"0.70883477",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6801035",
"0.67764556",
"0.67764556",
"0.6772573",
"0.67218834",
"0.6665987",
"0.6530844",
"0.6495981",
"0.6494592",
"0.6494592",... | 0.6957401 | 2 |
Return formatted text, properly escaped if not in titleMode | def formatOutput(self, storedText, titleMode, internal=False):
if storedText not in self.formatList:
storedText = _errorStr
return TextFormat.formatOutput(self, storedText, titleMode, internal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatOutput(self, storedText, titleMode, internal=False):\n prefix = self.prefix\n suffix = self.suffix\n if titleMode:\n if self.html:\n storedText = self.removeMarkup(storedText)\n if globalref.docRef.formHtml:\n prefix = self.removeMa... | [
"0.67517006",
"0.6623557",
"0.64947814",
"0.6347113",
"0.6307539",
"0.621596",
"0.6210496",
"0.60684896",
"0.60674477",
"0.60663515",
"0.60421175",
"0.6019259",
"0.59935653",
"0.59802073",
"0.59790826",
"0.595393",
"0.5948588",
"0.5939195",
"0.590317",
"0.5872387",
"0.5852167... | 0.58123326 | 31 |
Return tuple of text in edit format and bool validity, using edit format option | def formatEditText(self, storedText):
if storedText in self.formatList:
return (storedText, True)
return (storedText, not storedText) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.74414396",
"0.73706305",
"0.7158762",
"0.7101311",
"0.7101311",
"0.70359075",
"0.7028627",
"0.655066",
"0.6453073",
"0.6392096",
"0.63097495",
"0.63002694",
"0.61881006",
"0.60249096",
"0.58351296",
"0.5770396",
"0.5735489",
"0.56134075",
"0.5609827",
"0.5604693",
"0.55462... | 0.68839306 | 7 |
Return tuple of stored text from edited text and bool validity, using edit format option | def storedText(self, editText):
if editText in self.formatList:
return (editText, True)
return (editText, not editText and not self.isRequired) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def formatEditText(se... | [
"0.76840067",
"0.7569935",
"0.7569935",
"0.73801994",
"0.7312141",
"0.7185404",
"0.71525943",
"0.70902133",
"0.69048536",
"0.6863909",
"0.6808694",
"0.67496157",
"0.66044503",
"0.62728953",
"0.6122511",
"0.60096884",
"0.5692688",
"0.5692688",
"0.5692688",
"0.5692688",
"0.5692... | 0.787282 | 0 |
Return list of choices for combo box, each a tuple of edit text and any annotation text | def getEditChoices(self, currentText=''):
return [(text, '') for text in self.formatList] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_choices(self):\n raise NotImplementedError()",
"def get_choices(self):\n raise NotImplementedError()",
"def choices(cls):\n # return list(map(tuple, cls.__members__.items()))\n return [(int(code), name) for name, code in cls.__members__.items()]",
"def getEditChoices(self,... | [
"0.64435107",
"0.64435107",
"0.6406375",
"0.6369448",
"0.6282898",
"0.61602914",
"0.61550856",
"0.6096663",
"0.6079173",
"0.6074226",
"0.599768",
"0.5979722",
"0.5946701",
"0.59085536",
"0.58665997",
"0.5852769",
"0.5851758",
"0.5840527",
"0.58387506",
"0.5816007",
"0.5803215... | 0.6981332 | 0 |
Return a list of choices for setting the init default | def initDefaultChoices(self):
return [text for text in self.formatList] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initDefaultChoices(self):\n return []",
"def initDefaultChoices(self):\n return [entry[0] for entry in self.getEditChoices()]",
"def initDefaultChoices(self):\n choices = [entry[0] for entry in self.getEditChoices()]\n choices.insert(0, DateFormat.dateStampStrings[1])\n r... | [
"0.8791058",
"0.83096915",
"0.7565213",
"0.7451019",
"0.699929",
"0.699929",
"0.680488",
"0.67091656",
"0.66209406",
"0.65692645",
"0.6532258",
"0.6486172",
"0.64289325",
"0.6406578",
"0.63146526",
"0.62376446",
"0.62375015",
"0.62119025",
"0.61605716",
"0.6160515",
"0.608993... | 0.8089902 | 2 |
Split textStr using editSep, double sep's become char | def splitText(self, textStr):
return [text.strip().replace('\0', self.editSep) for text in
textStr.replace(self.editSep * 2, '\0').
split(self.editSep)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(string, sep='\\t'):\n return text_type.split(string, sep)",
"def extended(self, new_char, new_char_index, sep=' '):\n if new_char == sep:\n return TextState(self.text + new_char, '', new_char_index), self.last_word\n if sep == '':\n return TextState(self.text + new_... | [
"0.61333054",
"0.5867214",
"0.5828028",
"0.58185434",
"0.5792178",
"0.5787775",
"0.573595",
"0.5613339",
"0.5568093",
"0.5554935",
"0.55341613",
"0.5515633",
"0.5514492",
"0.55078864",
"0.5440001",
"0.5372514",
"0.5367604",
"0.53267324",
"0.5326295",
"0.52897936",
"0.52483726... | 0.7283009 | 0 |
Any format, prefix, suffix, html info in attrs dict | def __init__(self, name, attrs={}):
ChoiceFormat.__init__(self, name, attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html",
"def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)",
"def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite... | [
"0.735201",
"0.6754294",
"0.67166066",
"0.67071074",
"0.66780305",
"0.65807486",
"0.6522693",
"0.6522693",
"0.65187657",
"0.6471306",
"0.6269984",
"0.62653935",
"0.6153201",
"0.6090701",
"0.60323846",
"0.60278016",
"0.6011661",
"0.60042846",
"0.59841794",
"0.5941162",
"0.5920... | 0.0 | -1 |
Called by base init, after class change or format text change | def initFormat(self):
ChoiceFormat.initFormat(self)
fullFormat = ''.join(self.formatList)
try:
self.sep = [sep for sep in CombinationFormat.outputSepList
if sep not in fullFormat][0] + ' '
except IndexError:
self.sep = CombinationFormat.outputSepList[0] + ' ' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initFormat(self):\n pass",
"def init_text(self):\n d = self.declaration\n if d.text:\n self.set_text(d.text)\n if d.text_color:\n self.set_text_color(d.text_color)\n if d.text_alignment:\n self.set_text_alignment(d.text_alignment)\n i... | [
"0.7095915",
"0.70883477",
"0.6957401",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6801035",
"0.67764556",
"0.67764556",
"0.6772573",
"0.67218834",
"0.6665987",
"0.6530844",
"0.6495981",
"0.6494592",... | 0.0 | -1 |
Return tuple of choices from inText sorted like format and True if all splits are valid and included | def sortedChoices(self, inText):
choices = self.splitText(inText)
sortedChoices = [text for text in self.formatList if text in choices]
if len(choices) == len(sortedChoices):
return (sortedChoices, True)
else:
return (sortedChoices, False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatEditText(self, storedText):\n for choice in self.splitText(storedText):\n if choice not in self.formatList:\n return (storedText, not storedText)\n return (storedText, True)",
"def complete_opt_allow_select_scan(self, text, *_):\n return [t for t in (\"tru... | [
"0.58024824",
"0.5749306",
"0.5671507",
"0.55511814",
"0.5483213",
"0.5446786",
"0.54443884",
"0.54241514",
"0.54228777",
"0.52902573",
"0.52757835",
"0.5264248",
"0.5196836",
"0.5174921",
"0.5168787",
"0.5146945",
"0.51274663",
"0.5122783",
"0.5096883",
"0.509225",
"0.507958... | 0.7824299 | 0 |
Return formatted text, properly escaped if not in titleMode | def formatOutput(self, storedText, titleMode, internal=False):
choices, valid = self.sortedChoices(storedText)
if valid:
result = self.sep.join(choices)
else:
result = _errorStr
return TextFormat.formatOutput(self, result, titleMode, internal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatOutput(self, storedText, titleMode, internal=False):\n prefix = self.prefix\n suffix = self.suffix\n if titleMode:\n if self.html:\n storedText = self.removeMarkup(storedText)\n if globalref.docRef.formHtml:\n prefix = self.removeMa... | [
"0.6751716",
"0.6623542",
"0.6494783",
"0.63471186",
"0.6307567",
"0.62159866",
"0.6210506",
"0.60685015",
"0.6067435",
"0.6066372",
"0.6042128",
"0.60192853",
"0.59935206",
"0.5980245",
"0.59791267",
"0.5953967",
"0.59486204",
"0.5939183",
"0.59032184",
"0.58724236",
"0.5852... | 0.5575392 | 55 |
Return tuple of text in edit format and bool validity, using edit format option | def formatEditText(self, storedText):
for choice in self.splitText(storedText):
if choice not in self.formatList:
return (storedText, not storedText)
return (storedText, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.74409115",
"0.7369682",
"0.7101609",
"0.7101609",
"0.7035388",
"0.7028556",
"0.6883685",
"0.6550002",
"0.6452589",
"0.6391841",
"0.6309491",
"0.6299821",
"0.61874855",
"0.60250795",
"0.583455",
"0.5770457",
"0.573678",
"0.5614053",
"0.5609872",
"0.56041586",
"0.55477756",
... | 0.71582556 | 2 |
Return tuple of stored text from edited text and bool validity, using edit format option | def storedText(self, editText):
choices, valid = self.sortedChoices(editText)
if valid:
return (self.editSep.join(choices), True)
else:
return (editText, not editText and not self.isRequired) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.78716373",
"0.76830506",
"0.75691116",
"0.75691116",
"0.7379154",
"0.73117137",
"0.7183602",
"0.7152062",
"0.7089976",
"0.6903923",
"0.6863199",
"0.6748621",
"0.6604557",
"0.62711895",
"0.61224514",
"0.6009547",
"0.5690611",
"0.5690611",
"0.5690611",
"0.5690611",
"0.569061... | 0.68065554 | 11 |
Return list of choices for combo box, each a tuple of edit text and any annotation text | def getEditChoices(self, currentText=''):
currentChoices, valid = self.sortedChoices(currentText)
nonChoices = [text for text in self.formatList
if text not in currentChoices]
results = []
for choice in nonChoices: # menu entries to add a choice
allChoices = currentChoices + [choice]
allChoices = [text for text in self.formatList
if text in allChoices]
results.append((self.editSep.join(allChoices),
'(%s %s)' % (_('add'), choice)))
if currentChoices:
results.append((None, None)) # separator
for choice in currentChoices: # menu entries to remove a choice
allChoices = currentChoices[:]
allChoices.remove(choice)
allChoices = [text for text in self.formatList
if text in allChoices]
results.append((self.editSep.join(allChoices),
'(%s %s)' % (_('remove'), choice)))
return results | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditChoices(self, currentText=''):\n return [(text, '') for text in self.formatList]",
"def get_choices(self):\n raise NotImplementedError()",
"def get_choices(self):\n raise NotImplementedError()",
"def choices(cls):\n # return list(map(tuple, cls.__members__.items()))\n ... | [
"0.6981332",
"0.64435107",
"0.64435107",
"0.6406375",
"0.6282898",
"0.61602914",
"0.61550856",
"0.6096663",
"0.6079173",
"0.6074226",
"0.599768",
"0.5979722",
"0.5946701",
"0.59085536",
"0.58665997",
"0.5852769",
"0.5851758",
"0.5840527",
"0.58387506",
"0.5816007",
"0.5803215... | 0.6369448 | 4 |
Return a list of choices for setting the init default | def initDefaultChoices(self):
return [entry[0] for entry in self.getEditChoices()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initDefaultChoices(self):\n return []",
"def initDefaultChoices(self):\n return [text for text in self.formatList]",
"def initDefaultChoices(self):\n choices = [entry[0] for entry in self.getEditChoices()]\n choices.insert(0, DateFormat.dateStampStrings[1])\n return choic... | [
"0.8790614",
"0.8089398",
"0.7564882",
"0.74508727",
"0.70026475",
"0.70026475",
"0.680855",
"0.67124087",
"0.6624441",
"0.65727",
"0.653437",
"0.64892524",
"0.6431678",
"0.6409585",
"0.63181144",
"0.6240514",
"0.6240365",
"0.62128824",
"0.6163351",
"0.6163266",
"0.6090951",
... | 0.83091384 | 1 |
Any format, prefix, suffix, html info in attrs dict | def __init__(self, name, attrs={}):
TextFormat.__init__(self, name, attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html",
"def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)",
"def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite... | [
"0.735201",
"0.6754294",
"0.67166066",
"0.67071074",
"0.66780305",
"0.65807486",
"0.6522693",
"0.6522693",
"0.65187657",
"0.6471306",
"0.6269984",
"0.62653935",
"0.6153201",
"0.6090701",
"0.60323846",
"0.60278016",
"0.6011661",
"0.60042846",
"0.59841794",
"0.5941162",
"0.5920... | 0.0 | -1 |
Called by base init, after class change or format text change | def initFormat(self):
self.formatList = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initFormat(self):\n pass",
"def init_text(self):\n d = self.declaration\n if d.text:\n self.set_text(d.text)\n if d.text_color:\n self.set_text_color(d.text_color)\n if d.text_alignment:\n self.set_text_alignment(d.text_alignment)\n i... | [
"0.7095915",
"0.70883477",
"0.6957401",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6811701",
"0.6801035",
"0.67764556",
"0.67764556",
"0.6772573",
"0.67218834",
"0.6665987",
"0.6530844",
"0.6495981",
"0.6494592",... | 0.6490198 | 22 |
Add choice to edit menu list if not already there | def addChoice(self, choice, sort=False):
if choice and choice not in self.formatList:
self.formatList.append(choice)
if sort:
self.sortChoices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_add_to_menu ( self, action ):\r\n return True",
"def menu(update, context):\n\n update_message_text = update.callback_query.edit_message_text if update.callback_query else update.message.reply_text\n update_message_text(\n text='Please choose an option.',\n repl... | [
"0.63300127",
"0.618695",
"0.61733586",
"0.6054791",
"0.5977106",
"0.5969435",
"0.5963501",
"0.5931149",
"0.5929675",
"0.5912512",
"0.59039843",
"0.58893913",
"0.58734757",
"0.58428335",
"0.5820409",
"0.57708883",
"0.5754952",
"0.5752344",
"0.5730824",
"0.5724889",
"0.5722107... | 0.5936115 | 7 |
Sort menu list choices | def sortChoices(self):
self.formatList.sort() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SortList(self, key: callable = str.lower):\n temp_list = self.Items\n temp_list.sort(key=key)\n # delete contents of present listbox\n self.delete(0, Tags.End.value)\n # load listbox with sorted data\n for item in temp_list:\n self.insert(Tags.End.value, ite... | [
"0.6233976",
"0.6216146",
"0.6190673",
"0.598364",
"0.59764874",
"0.5956966",
"0.59059286",
"0.5865083",
"0.58410734",
"0.58394575",
"0.5783629",
"0.5779133",
"0.5769487",
"0.57629895",
"0.5747787",
"0.57295066",
"0.57123274",
"0.5697192",
"0.5693883",
"0.567952",
"0.56586474... | 0.77374196 | 0 |
Return formatted text, properly escaped if not in titleMode | def formatOutput(self, storedText, titleMode, internal=False):
return TextFormat.formatOutput(self, storedText, titleMode, internal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatOutput(self, storedText, titleMode, internal=False):\n prefix = self.prefix\n suffix = self.suffix\n if titleMode:\n if self.html:\n storedText = self.removeMarkup(storedText)\n if globalref.docRef.formHtml:\n prefix = self.removeMa... | [
"0.67517006",
"0.6623557",
"0.64947814",
"0.6347113",
"0.621596",
"0.6210496",
"0.60684896",
"0.60674477",
"0.60663515",
"0.60421175",
"0.6019259",
"0.59935653",
"0.59802073",
"0.59790826",
"0.595393",
"0.5948588",
"0.5939195",
"0.590317",
"0.5872387",
"0.58521676",
"0.583875... | 0.6307539 | 4 |
Return tuple of text in edit format and bool validity, using edit format option | def formatEditText(self, storedText):
return (storedText, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.74416876",
"0.7370665",
"0.71592844",
"0.70363986",
"0.7028924",
"0.68846506",
"0.6550997",
"0.64535177",
"0.6392951",
"0.63109875",
"0.6300976",
"0.6188802",
"0.6026202",
"0.5835225",
"0.5771935",
"0.5735613",
"0.5613498",
"0.5609731",
"0.56050605",
"0.5547816",
"0.530934... | 0.71025413 | 4 |
Return tuple of stored text from edited text and bool validity, using edit format option | def storedText(self, editText):
if editText:
return (editText, True)
return (editText, not self.isRequired) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.78716373",
"0.76830506",
"0.75691116",
"0.75691116",
"0.7379154",
"0.73117137",
"0.7152062",
"0.7089976",
"0.6903923",
"0.6863199",
"0.68065554",
"0.6748621",
"0.6604557",
"0.62711895",
"0.61224514",
"0.6009547",
"0.5690611",
"0.5690611",
"0.5690611",
"0.5690611",
"0.56906... | 0.7183602 | 6 |
Any format, prefix, suffix, html info in attrs dict | def __init__(self, name, attrs={}):
TextFormat.__init__(self, name, attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html",
"def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)",
"def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite... | [
"0.735201",
"0.6754294",
"0.67166066",
"0.67071074",
"0.66780305",
"0.65807486",
"0.6522693",
"0.6522693",
"0.65187657",
"0.6471306",
"0.6269984",
"0.62653935",
"0.6153201",
"0.6090701",
"0.60323846",
"0.60278016",
"0.6011661",
"0.60042846",
"0.59841794",
"0.5941162",
"0.5920... | 0.0 | -1 |
Return formatted text, properly escaped if not in titleMode | def formatOutput(self, storedText, titleMode, internal=False):
try:
text = GenDate(storedText).dateStr(self.format)
except GenDateError:
text = _errorStr
return TextFormat.formatOutput(self, text, titleMode, internal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatOutput(self, storedText, titleMode, internal=False):\n prefix = self.prefix\n suffix = self.suffix\n if titleMode:\n if self.html:\n storedText = self.removeMarkup(storedText)\n if globalref.docRef.formHtml:\n prefix = self.removeMa... | [
"0.67517006",
"0.6623557",
"0.64947814",
"0.6347113",
"0.6307539",
"0.621596",
"0.6210496",
"0.60684896",
"0.60674477",
"0.60663515",
"0.60421175",
"0.6019259",
"0.59935653",
"0.59802073",
"0.59790826",
"0.595393",
"0.5948588",
"0.5939195",
"0.590317",
"0.5872387",
"0.5852167... | 0.5773666 | 34 |
Return tuple of text in edit format and bool validity, using edit format option | def formatEditText(self, storedText):
format = globalref.options.strData('EditDateFormat', True)
try:
return (GenDate(storedText).dateStr(format), True)
except GenDateError:
return (storedText, not storedText) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.74416876",
"0.7370665",
"0.71592844",
"0.71025413",
"0.71025413",
"0.70363986",
"0.7028924",
"0.68846506",
"0.6550997",
"0.64535177",
"0.6392951",
"0.63109875",
"0.6300976",
"0.6188802",
"0.5835225",
"0.5771935",
"0.5735613",
"0.5613498",
"0.5609731",
"0.56050605",
"0.5547... | 0.6026202 | 14 |
Return tuple of stored text from edited text and bool validity, using edit format option | def storedText(self, editText):
format = globalref.options.strData('EditDateFormat', True)
try:
return (repr(GenDate().setFromStr(editText, format)), True)
except GenDateError:
return (editText, not editText and not self.isRequired) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.78716373",
"0.76830506",
"0.75691116",
"0.75691116",
"0.7379154",
"0.73117137",
"0.7183602",
"0.7152062",
"0.7089976",
"0.6863199",
"0.68065554",
"0.6748621",
"0.6604557",
"0.62711895",
"0.61224514",
"0.6009547",
"0.5690611",
"0.5690611",
"0.5690611",
"0.5690611",
"0.56906... | 0.6903923 | 9 |
Return list of choices for combo box, each a tuple of edit text and any annotation text | def getEditChoices(self, currentText=''):
format = globalref.options.strData('EditDateFormat', True)
today = GenDate().dateStr(format)
yesterday = (GenDate() - 1).dateStr(format)
tomorrow = (GenDate() + 1).dateStr(format)
return [(today, '(%s)' % _('today')),
(yesterday, '(%s)' % _('yesterday')),
(tomorrow, '(%s)' % _('tomorrow'))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditChoices(self, currentText=''):\n return [(text, '') for text in self.formatList]",
"def get_choices(self):\n raise NotImplementedError()",
"def get_choices(self):\n raise NotImplementedError()",
"def choices(cls):\n # return list(map(tuple, cls.__members__.items()))\n ... | [
"0.6981832",
"0.64423245",
"0.64423245",
"0.6404376",
"0.63695693",
"0.62808853",
"0.615837",
"0.61527145",
"0.60969144",
"0.60806596",
"0.6074747",
"0.59950155",
"0.59769976",
"0.59458613",
"0.59082",
"0.5853147",
"0.5850785",
"0.58412063",
"0.58367765",
"0.58151263",
"0.580... | 0.5867416 | 15 |
Return initial stored value for new nodes | def getInitDefault(self):
if self.initDefault in DateFormat.dateStampStrings:
return GenDate().dateStr()
return TextFormat.getInitDefault(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_value(self):\r\n if self.initial_value is None:\r\n return None\r\n\r\n return deepcopy(self.initial_value)",
"def initial_value(self):\n return self._initial_value",
"def initial(self):\n return zero",
"def initial_value(self) -> float:\n return self... | [
"0.6917573",
"0.6599723",
"0.64693916",
"0.62434894",
"0.6088791",
"0.605029",
"0.6040265",
"0.5898664",
"0.58754563",
"0.5820543",
"0.5805469",
"0.5794411",
"0.57890224",
"0.57560384",
"0.5747938",
"0.57314616",
"0.5730434",
"0.5725593",
"0.57140493",
"0.57140493",
"0.569943... | 0.0 | -1 |
Set initial value from editor version using edit format option | def setInitDefault(self, editText):
if editText in DateFormat.dateStampStrings:
self.initDefault = DateFormat.dateStampStrings[0]
else:
TextFormat.setInitDefault(self, editText) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditInitDefault(self):\n if self.initDefault in DateFormat.dateStampStrings:\n return DateFormat.dateStampStrings[1]\n return TextFormat.getEditInitDefault(self)",
"def getEditInitDefault(self):\n return self.formatEditText(self.initDefault)[0]",
"def setInitDefault(self,... | [
"0.62732863",
"0.62497866",
"0.62184155",
"0.6095079",
"0.6085302",
"0.6077205",
"0.6007599",
"0.57824373",
"0.5620094",
"0.552909",
"0.54974353",
"0.5490214",
"0.5446925",
"0.54123217",
"0.53948015",
"0.5381172",
"0.53762734",
"0.53609794",
"0.5341126",
"0.5302158",
"0.52889... | 0.6298632 | 0 |
Return initial value in edit format, found in edit format option | def getEditInitDefault(self):
if self.initDefault in DateFormat.dateStampStrings:
return DateFormat.dateStampStrings[1]
return TextFormat.getEditInitDefault(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditInitDefault(self):\n return self.formatEditText(self.initDefault)[0]",
"def getEditInitDefault(self):\n if self.initDefault in TimeFormat.timeStampStrings:\n return TimeFormat.timeStampStrings[1]\n return TextFormat.getEditInitDefault(self)",
"def format(self) -> pulu... | [
"0.7327655",
"0.6777391",
"0.6163817",
"0.5962609",
"0.59190995",
"0.5825621",
"0.5639453",
"0.55958575",
"0.5588548",
"0.55880916",
"0.55728984",
"0.5547174",
"0.55372924",
"0.5518307",
"0.55125266",
"0.54999983",
"0.54888153",
"0.54888153",
"0.54887563",
"0.5471209",
"0.546... | 0.69168735 | 1 |
Return a list of choices for setting the init default | def initDefaultChoices(self):
choices = [entry[0] for entry in self.getEditChoices()]
choices.insert(0, DateFormat.dateStampStrings[1])
return choices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initDefaultChoices(self):\n return []",
"def initDefaultChoices(self):\n return [entry[0] for entry in self.getEditChoices()]",
"def initDefaultChoices(self):\n return [text for text in self.formatList]",
"def initDefaultChoices(self):\n choices = [entry[0] for entry in self.g... | [
"0.8790614",
"0.83091384",
"0.8089398",
"0.74508727",
"0.70026475",
"0.70026475",
"0.680855",
"0.67124087",
"0.6624441",
"0.65727",
"0.653437",
"0.64892524",
"0.6431678",
"0.6409585",
"0.63181144",
"0.6240514",
"0.6240365",
"0.62128824",
"0.6163351",
"0.6163266",
"0.6090951",... | 0.7564882 | 3 |
Return conditional comparison value with realtime adjustments, used for date and time types' 'now' value | def adjustedCompareValue(self, value):
if value.startswith('now'):
return repr(GenDate())
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjustedCompareValue(self, value):\n if value.startswith('now'):\n return repr(GenTime())\n return value",
"def condition(self):\n HH = str(time.localtime().tm_hour)\n MM = str(time.localtime().tm_min)\n return eval(self._cond_str)",
"def get_state_by_time(pyth... | [
"0.7139558",
"0.61179876",
"0.6032351",
"0.60296464",
"0.5851021",
"0.5813862",
"0.5813862",
"0.58051044",
"0.5691663",
"0.56752634",
"0.563707",
"0.55923384",
"0.5590049",
"0.55772096",
"0.5574569",
"0.5568509",
"0.5496361",
"0.54885936",
"0.54716676",
"0.5465949",
"0.544361... | 0.689713 | 1 |
Any format, prefix, suffix, html info in attrs dict | def __init__(self, name, attrs={}):
TextFormat.__init__(self, name, attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html",
"def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)",
"def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite... | [
"0.735201",
"0.6754294",
"0.67166066",
"0.67071074",
"0.66780305",
"0.65807486",
"0.6522693",
"0.6522693",
"0.65187657",
"0.6471306",
"0.6269984",
"0.62653935",
"0.6153201",
"0.6090701",
"0.60323846",
"0.60278016",
"0.6011661",
"0.60042846",
"0.59841794",
"0.5941162",
"0.5920... | 0.0 | -1 |
Return formatted text, properly escaped if not in titleMode | def formatOutput(self, storedText, titleMode, internal=False):
try:
text = GenTime(storedText).timeStr(self.format)
except GenTimeError:
text = _errorStr
return TextFormat.formatOutput(self, text, titleMode, internal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatOutput(self, storedText, titleMode, internal=False):\n prefix = self.prefix\n suffix = self.suffix\n if titleMode:\n if self.html:\n storedText = self.removeMarkup(storedText)\n if globalref.docRef.formHtml:\n prefix = self.removeMa... | [
"0.67517006",
"0.6623557",
"0.64947814",
"0.6347113",
"0.6307539",
"0.621596",
"0.6210496",
"0.60684896",
"0.60674477",
"0.60663515",
"0.60421175",
"0.6019259",
"0.59935653",
"0.59802073",
"0.59790826",
"0.595393",
"0.5948588",
"0.5939195",
"0.590317",
"0.5872387",
"0.5852167... | 0.55989367 | 50 |
Return tuple of text in edit format and bool validity, using edit format option | def formatEditText(self, storedText):
format = globalref.options.strData('EditTimeFormat', True)
try:
return (GenTime(storedText).timeStr(format), True)
except GenTimeError:
return (storedText, not storedText) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.74414396",
"0.73706305",
"0.7158762",
"0.7101311",
"0.7101311",
"0.70359075",
"0.7028627",
"0.68839306",
"0.655066",
"0.6453073",
"0.6392096",
"0.63097495",
"0.63002694",
"0.61881006",
"0.60249096",
"0.58351296",
"0.5735489",
"0.56134075",
"0.5609827",
"0.5604693",
"0.5546... | 0.5770396 | 16 |
Return tuple of stored text from edited text and bool validity, using edit format option | def storedText(self, editText):
try:
return (repr(GenTime(editText)), True)
except GenTimeError:
return (editText, not editText and not self.isRequired) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)",
"def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\... | [
"0.787282",
"0.76840067",
"0.7569935",
"0.7569935",
"0.73801994",
"0.7312141",
"0.7185404",
"0.71525943",
"0.70902133",
"0.69048536",
"0.6863909",
"0.6808694",
"0.66044503",
"0.62728953",
"0.6122511",
"0.60096884",
"0.5692688",
"0.5692688",
"0.5692688",
"0.5692688",
"0.569268... | 0.67496157 | 12 |
Return list of choices for combo box, each a tuple of edit text and annotated text | def getEditChoices(self, currentText=''):
format = globalref.options.strData('EditTimeFormat', True)
now = GenTime().timeStr(format)
choices = [(now, '(%s)' % _('now'))]
for hr in (6, 9, 12, 15, 18, 21, 0):
time = GenTime((hr, 0)).timeStr(format)
choices.append((time, ''))
return choices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditChoices(self, currentText=''):\n return [(text, '') for text in self.formatList]",
"def getEditChoices(self, currentText=''):\n currentChoices, valid = self.sortedChoices(currentText)\n nonChoices = [text for text in self.formatList\n if text not in currentCho... | [
"0.7317573",
"0.67196256",
"0.64775187",
"0.64775187",
"0.6326026",
"0.6246536",
"0.62373483",
"0.621034",
"0.6183985",
"0.6159754",
"0.60702986",
"0.60540736",
"0.6048126",
"0.6031349",
"0.59674495",
"0.59313804",
"0.59044296",
"0.589701",
"0.58720684",
"0.5854758",
"0.58472... | 0.6083853 | 10 |
Return initial stored value for new nodes | def getInitDefault(self):
if self.initDefault in TimeFormat.timeStampStrings:
return GenTime().timeStr()
return TextFormat.getInitDefault(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_value(self):\r\n if self.initial_value is None:\r\n return None\r\n\r\n return deepcopy(self.initial_value)",
"def initial_value(self):\n return self._initial_value",
"def initial(self):\n return zero",
"def initial_value(self) -> float:\n return self... | [
"0.6917573",
"0.6599723",
"0.64693916",
"0.62434894",
"0.6088791",
"0.605029",
"0.6040265",
"0.5898664",
"0.58754563",
"0.5820543",
"0.5805469",
"0.5794411",
"0.57890224",
"0.57560384",
"0.5747938",
"0.57314616",
"0.5730434",
"0.5725593",
"0.57140493",
"0.57140493",
"0.569943... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.