/*
Rejects a meta field if it contains embedded listtool code.
this forces people to use the fields and short code [[listtool]]
327201
public function rejectInlineListTool(Errors &$errors, Meta &$meta)
    {
        if (stristr((string)$meta->getValue(), '://listtool') !== false) {
            $errors->reject('You cannot embed the List Tool inline, use the provided fields and input [[listtool]] into the contents instead.');
        }
    }
271412
function mustBeNonEmptyArray(filter, keyword, field) {
  if (!Array.isArray(filter[field])) {
    return Bluebird.reject(new BadRequestError(`Attribute "${field}" in "${keyword}" must be an array`));
  }

  if (filter[field].length === 0) {
    return Bluebird.reject(new BadRequestError(`Attribute "${field}" in  "${keyword}" cannot be empty`));
  }

  return Bluebird.resolve();
}
95072
function validatorBarcode(fieldValue, fieldDefinition, previousFieldValues, cb) {
      if (typeof(fieldValue) !== "object" || fieldValue === null) {
        return cb(new Error("Expected object but got " + typeof(fieldValue)));
      }

      if (typeof(fieldValue.text) !== "string" || fieldValue.text.length === 0) {
        return cb(new Error("Expected text parameter."));
      }

      if (typeof(fieldValue.format) !== "string" || fieldValue.format.length === 0) {
        return cb(new Error("Expected format parameter."));
      }

      return cb();
    }
62153
function stripMeta (markdownContent) {
  switch (true) {
    case _metaRegex.test(markdownContent):
      return markdownContent.replace(_metaRegex, '').trim();
    case _metaRegexYaml.test(markdownContent):
      return markdownContent.replace(_metaRegexYaml, '').trim();
    default:
      return markdownContent.trim();
  }
}
775806
public boolean acceptTemplate(String tpl)
	{

		if (isInWhiteList(tpl) && !isInBlackList(tpl)) {
			if (containsAllowedPrefix(tpl) && !containsRestrictedPrefix(tpl)) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			return false;
		}

	}
756777
private void validateField(FieldDefinition fieldDef) {
        if (fieldDef.isScalarField()) {
            Utils.require(Utils.isEmpty(fieldDef.getAnalyzerName()),
                          "'analyzer' not allowed for OLAP application fields:" + fieldDef);
        } else if (fieldDef.isLinkType()) {
            Utils.require(!fieldDef.isSharded(),
                          "Link and xlink fields cannot be sharded: {}", fieldDef);
        }
    }
1363645
def reject_args!(args, *names)
      names.each do |name|
        if args.include?(name.to_s) || args.include?(name.to_sym)
          raise ArgumentError, "Argument '#{name}' is not allowed"
        end
      end
    end
1155527
def validate_meta_object(meta: Dict[str, Any], allow_extra_meta_fields: bool) -> None:
    
    for key, value in meta.items():
        if key in META_FIELDS:
            if type(value) is not META_FIELDS[key]:
                raise ValidationError(
                    f"Values for {key} are expected to have the type {META_FIELDS[key]}, "
                    f"instead got {type(value)}."
                )
        elif allow_extra_meta_fields:
            if key[:2] != "x-":
                raise ValidationError(
                    "Undefined meta fields need to begin with 'x-', "
                    f"{key} is not a valid undefined meta field."
                )
        else:
            raise ValidationError(
                f"{key} is not a permitted meta field. To allow undefined fields, "
                "set `allow_extra_meta_fields` to True."
            )
175137
function protectMethod(name, meta, instance) {
        instance[cacheKeyword].methods[name] = meta.implementation;

        if (meta.isPrivate) {
            Object.defineProperty(instance, name, {
                get: function get() {
                    var method = instance[cacheKeyword].methods[name],
                        isConstructor = name === 'initialize',
                        currCaller;

                    currCaller = caller;

                    if (instance.$initializing || (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && meta.allowed === currCaller.constructorId)) {
                        return method;
                    }

                    if (!isConstructor) {
                        throw new Error('Cannot access private method "' + name + '" of class "' + instance.$name + '".');
                    } else {
                        throw new Error('Constructor of class "' + instance.$name + '" is private.');
                    }
                },
                set: function set(newVal) {
                    if (instance.$initializing || !instance.$static[$class].locked || instance.$static[$class].forceUnlocked) {
                        instance[cacheKeyword].methods[name] = newVal;
                        instance[redefinedCacheKeyword].methods[name] = true; // This is just for the inspect
                    } else {
                        throw new Error('Cannot set private method "' + name + '" of class "' + instance.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        } else if (meta.isProtected) {
            Object.defineProperty(instance, name, {
                get: function get() {
                    var method = instance[cacheKeyword].methods[name],
                        isConstructor = name === 'initialize',
                        currCaller;

                    currCaller = caller;

                    if (instance.$initializing || (currCaller && (currCaller.method[$name] || currCaller.method[$anonymous]) && (contains(meta.allowed, currCaller.constructorId) || instance instanceof currCaller.constructor))) {
                        return method;
                    }

                    if (!isConstructor) {
                        throw new Error('Cannot access protected method "' + name + '" of class "' + instance.$name + '".');
                    } else {
                        throw new Error('Constructor of class "' + instance.$name + '" is protected.');
                    }
                },
                set: function set(newVal) {
                    if (instance.$initializing || !instance.$static[$class].locked || instance.$static[$class].forceUnlocked) {
                        instance[cacheKeyword].methods[name] = newVal;
                        instance[redefinedCacheKeyword].methods[name] = true; // This is just for the inspect
                    } else {
                        throw new Error('Cannot set protected method "' + name + '" of class "' + instance.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        } else {
            Object.defineProperty(instance, name, {
                get: function get() {
                    return instance[cacheKeyword].methods[name];
                },
                set: function set(newVal) {
                    if (instance.$initializing || !instance.$static[$class].locked || instance.$static[$class].forceUnlocked) {
                        instance[cacheKeyword].methods[name] = newVal;
                        instance[redefinedCacheKeyword].methods[name] = true;
                    } else {
                        throw new Error('Cannot set public method "' + name + '" of class "' + instance.$name + '".');
                    }
                },
                configurable: false,
                enumerable: true
            });
        }
    }
196349
private void validateField(FieldDefinition fieldDef) {
        if (fieldDef.isScalarField()) {
            Utils.require(Utils.isEmpty(fieldDef.getAnalyzerName()),
                          "'analyzer' not allowed for OLAPMono application fields:" + fieldDef);
        } else if (fieldDef.isXLinkField()) {
            Utils.require(false, "XLinks are not allowed for OLAPMono applications: " + fieldDef);
        } else if (fieldDef.isLinkField()) {
            Utils.require(!fieldDef.isSharded(),
                          "Link fields cannot be sharded: {}", fieldDef);
        }
    }
762351
function () {
/*Line 112 - 'AtomFormField.js' */                this._validate = true;
/*Line 113 - 'AtomFormField.js' */                if (!(this._required || this._regex || this._dataType))
/*Line 114 - 'AtomFormField.js' */                    return this._isValid === undefined ? true : this._isValid;



/*Line 118 - 'AtomFormField.js' */                if (this._isValid) {
/*Line 119 - 'AtomFormField.js' */                    AtomBinder.setValue(this, "error", "");
/*Line 120 - 'AtomFormField.js' */                    if (this._isValidSet) {
/*Line 121 - 'AtomFormField.js' */                        return true;
/*Line 122 - 'AtomFormField.js' */                    }
/*Line 123 - 'AtomFormField.js' */                }

/*Line 125 - 'AtomFormField.js' */                this._isValid = true;

/*Line 127 - 'AtomFormField.js' */                if (this._fieldValue !== undefined) {
/*Line 128 - 'AtomFormField.js' */                    this.validateValue(this._fieldValue);
/*Line 129 - 'AtomFormField.js' */                } else {
/*Line 130 - 'AtomFormField.js' */                    // check validity..
/*Line 131 - 'AtomFormField.js' */                    this.validateChildren(this._element);
/*Line 132 - 'AtomFormField.js' */                }
/*Line 133 - 'AtomFormField.js' */                if (this._isValid) {
/*Line 134 - 'AtomFormField.js' */                    AtomBinder.setValue(this, "error", "");
/*Line 135 - 'AtomFormField.js' */                }
/*Line 136 - 'AtomFormField.js' */                return this._isValid;
/*Line 137 - 'AtomFormField.js' */            }
850663
@Override
  protected boolean reject(LogItem log) {
    if (blacklistTags != null) {
      for (String disabledTag : blacklistTags) {
        if (log.tag.equals(disabledTag)) {
          return true;
        }
      }
    }
    return false;
  }
1137421
def _validate_excludes(self, excludes, field, value):
        
        if isinstance(excludes, Hashable):
            excludes = [excludes]

        # Save required field to be checked latter
        if 'required' in self.schema[field] and self.schema[field]['required']:
            self._unrequired_by_excludes.add(field)
        for exclude in excludes:
            if (exclude in self.schema and
                'required' in self.schema[exclude] and
                    self.schema[exclude]['required']):

                self._unrequired_by_excludes.add(exclude)

        if [True for key in excludes if key in self.document]:
            # Wrap each field in `excludes` list between quotes
            exclusion_str = ', '.join("'{0}'"
                                      .format(word) for word in excludes)
            self._error(field, errors.EXCLUDES_FIELD, exclusion_str)
1151469
private static void setTextAndDiscardEdits(JTextComponent field, String value) {
		if (value == null) {
			return;
		}

		field.setText(value);
		if (field instanceof ZapTextField) {
			((ZapTextField) field).discardAllEdits();
		} else if (field instanceof ZapTextArea) {
			((ZapTextArea) field).discardAllEdits();
		}
	}
1165895
public final void selectItems(BaseStatementMeta meta) throws RecognitionException {
		AggItem ai =null;
		Pair<String, String> sd =null;

		try {
			// druidG.g:270:2: (ai= aggItem |sd= simpleDim )
			int alt129=2;
			int LA129_0 = input.LA(1);
			if ( (LA129_0==COUNT||LA129_0==DOUBLE_SUM||LA129_0==HYPER_UNIQUE||LA129_0==JAVASCRIPT||LA129_0==LONG_SUM||LA129_0==MAX||LA129_0==MIN||LA129_0==UNIQUE) ) {
				alt129=1;
			}
			else if ( (LA129_0==ID) ) {
				alt129=2;
			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 129, 0, input);
				throw nvae;
			}

			switch (alt129) {
				case 1 :
					// druidG.g:270:5: ai= aggItem
					{
					pushFollow(FOLLOW_aggItem_in_selectItems1943);
					ai=aggItem();
					state._fsp--;

					 
						      if (meta instanceof QueryMeta) {
						        ((BaseAggQueryMeta)meta).aggregations.add(ai);
						      } else if (meta instanceof InsertMeta) {
					 	        ((InsertMeta)meta).aggregations.add(ai);
					   	        if (ai.isDirectMetric()) {//Unique, hyperUnique, Count etc are not part of the data
						      	  ((InsertMeta)meta).addColumnInOrder(ai.getCanonicalName());
						        }
						      }
						      
						   
					}
					break;
				case 2 :
					// druidG.g:281:5: sd= simpleDim
					{
					pushFollow(FOLLOW_simpleDim_in_selectItems1953);
					sd=simpleDim();
					state._fsp--;

					 
						      if (meta instanceof QueryMeta) {
						         ((PlainDimQueryMeta)meta).fetchDimensions.put(sd.a, sd.b);
						      } else if (meta instanceof InsertMeta) {
					 	         ((InsertMeta)meta).fetchDimensions.put(sd.a, sd.b);
					 	         ((InsertMeta)meta).addColumnInOrder((sd.b != null)? sd.b : sd.a);
						      }
						   
					}
					break;

			}
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
		}
	}
393388
function unexpandEntity(sourceObject, includeFields) {
  _.each(sourceObject.links || [], (val, key) => {
    if (!_.isArray(sourceObject.links[key])) {
      // I know the extra .toString seems unnecessary, but sometimes val.id is already an objectId, and other times its
      // a string.
      sourceObject.links[key] = val.id && val.id.toString() || val && val.toString && val.toString();
    } else {
      _.each(sourceObject.links[key], (innerVal, innerKey) => {
        sourceObject.links[key][innerKey] = innerVal.id.toString();
      });
    }
  });

  return (includeFields && includeFields.length) ? Util.includeFields(sourceObject, includeFields) : sourceObject;
}
1125659
function getMetaKeyCode(unknown) {
            var CTRL_MASK = 4096;
            var ALT_MASK = 8192;
            var SHIFT_MASK = 16384;
            var metaKeyCode = 0;
            if (typeof unknown == "string") {
                // unknown as string
                unknown.toLowerCase().split(/\+\s*/).forEach(function(name) {
                    switch (name) {
                      case "ctrl":
                      case "cmd":
                        metaKeyCode |= CTRL_MASK;
                        break;

                      case "alt":
                        metaKeyCode |= ALT_MASK;
                        break;

                      case "shift":
                        metaKeyCode |= SHIFT_MASK;
                        break;

                      default:
                        metaKeyCode |= keymap[name];
                    }
                });
            } else {
                // unknown as key event
                if (unknown.ctrlKey || unknown.metaKey) {
                    metaKeyCode |= CTRL_MASK;
                }
                if (unknown.altKey) {
                    metaKeyCode |= ALT_MASK;
                }
                if (unknown.shiftKey) {
                    metaKeyCode |= SHIFT_MASK;
                }
                metaKeyCode |= unknown.keyCode;
            }
            return metaKeyCode;
        }