An asset is restricted for all dts if it is in the static list.
769734
def is_restricted(self, assets, dt):
        
        if isinstance(assets, Asset):
            return assets in self._restricted_set
        return pd.Series(
            index=pd.Index(assets),
            data=vectorized_is_element(assets, self._restricted_set)
        )
269103
function() {
        var assetKey, newEntry, oldEntry;

        // Reuse existing metadata.
        for ( assetKey in oldAvailableLists ) {
            oldEntry = oldAvailableLists[assetKey];
            newEntry = newAvailableLists[assetKey];
            // List no longer exists. If a stock list, try to convert to
            // imported list if it was selected.
            if ( newEntry === undefined ) {
                µb.removeFilterList(assetKey);
                if ( assetKey.indexOf('://') === -1 ) {
                    customListFromStockList(assetKey);
                }
                continue;
            }
            if ( oldEntry.entryCount !== undefined ) {
                newEntry.entryCount = oldEntry.entryCount;
            }
            if ( oldEntry.entryUsedCount !== undefined ) {
                newEntry.entryUsedCount = oldEntry.entryUsedCount;
            }
            // This may happen if the list name was pulled from the list
            // content.
            // https://github.com/chrisaljoudi/uBlock/issues/982
            // There is no guarantee the title was successfully extracted from
            // the list content.
            if (
                newEntry.title === '' &&
                typeof oldEntry.title === 'string' &&
                oldEntry.title !== ''
            ) {
                newEntry.title = oldEntry.title;
            }
        }

        // Remove unreferenced imported filter lists.
        var dict = new Set(importedListKeys);
        for ( assetKey in newAvailableLists ) {
            newEntry = newAvailableLists[assetKey];
            if ( newEntry.submitter !== 'user' ) { continue; }
            if ( dict.has(assetKey) ) { continue; }
            delete newAvailableLists[assetKey];
            µb.assets.unregisterAssetSource(assetKey);
            µb.removeFilterList(assetKey);
        }
    }
474300
def validate(self,
                 asset,
                 amount,
                 portfolio,
                 algo_datetime,
                 algo_current_data):
        
        if self.restrictions.is_restricted(asset, algo_datetime):
            self.handle_violation(asset, amount, algo_datetime)
1280916
@Override
    public void onValueUnRestricted(final String value) {
        this.restrictedColumns.remove(value);
        
        // Check single column used in data set -> it cannot be unselected.
        if (listEditor.getList().size() == 1) {
            setEditorEnabled(0 ,false, DataSetEditorConstants.INSTANCE.dataSetMustHaveAtLeastOneColumn());
        } else {
            setEditorEnabled(value, true, null);
        }
    }
763649
public void setAggregatedSourceStatusList(java.util.Collection<AggregatedSourceStatus> aggregatedSourceStatusList) {
        if (aggregatedSourceStatusList == null) {
            this.aggregatedSourceStatusList = null;
            return;
        }

        this.aggregatedSourceStatusList = new com.amazonaws.internal.SdkInternalList<AggregatedSourceStatus>(aggregatedSourceStatusList);
    }
705572
static <T> Collection<T> freeze(Collection<T> coll) {
        return coll == null ? null : Collections.unmodifiableCollection(coll);
    }
800780
public static <T> List<T> getListUnsafe(final List list, final Class<T> clazz, final Integer... path) {
        return (List<T>) getUnsafe(list, List.class, path);
    }
1040379
protected <T extends BasicInclude> T aggregateList(final MessageDigest digest, final Deque<T> elements, 
	        final List<File> skinDirectories, final File outputRoot, final File alternateOutput, 
	        final String extension, final AggregatorCallback<T> callback) throws IOException {
	    
        if (null == elements || elements.size() == 0) {
            return null;
        }

		// reference to the head of the list
        final T headElement = elements.getFirst();
        if (elements.size() == 1 && this.resourcesDao.isAbsolute(headElement)) {
            return headElement;
        }
        
        final File tempFile = File.createTempFile("working.", extension);
        final File aggregateOutputFile;
        try {
            //Make sure we're working with a clean MessageDigest
            digest.reset();
            TrimmingWriter trimmingWriter = null;
            try {
                final BufferedOutputStream bufferedFileStream = new BufferedOutputStream(new FileOutputStream(tempFile));
                final MessageDigestOutputStream digestStream = new MessageDigestOutputStream(bufferedFileStream, digest);
                final OutputStreamWriter aggregateWriter = new OutputStreamWriter(digestStream, this.encoding);
                trimmingWriter = new TrimmingWriter(aggregateWriter);
                
                for (final T element: elements) {
                    final File resourceFile = this.findFile(skinDirectories, element.getValue());
                    
                    FileInputStream fis = null;
                    try {
                        fis = new FileInputStream(resourceFile);
                        final BOMInputStream bomIs = new BOMInputStream(new BufferedInputStream(fis));
                        if (bomIs.hasBOM()) {
                            logger.debug("Stripping UTF-8 BOM from: " + resourceFile);
                        }
                        final Reader resourceIn = new InputStreamReader(bomIs, this.encoding);
                        if (element.isCompressed()) {
                            IOUtils.copy(resourceIn, trimmingWriter);
                        }
                        else {
                            callback.compress(resourceIn, trimmingWriter);
                        }
                    }
                    catch (IOException e) {
                        throw new IOException("Failed to read '" + resourceFile + "' for skin: " + skinDirectories.get(0), e);
                    }
                    finally {
                        IOUtils.closeQuietly(fis);
                    }
                    trimmingWriter.write(SystemUtils.LINE_SEPARATOR);
                }
    		}
            finally {
                IOUtils.closeQuietly(trimmingWriter);
            }
            
            if (trimmingWriter.getCharCount() == 0) {
                return null;
            }
    
    		// temp file is created, get checksum
    		final String checksum = Base64.encodeBase64URLSafeString(digest.digest());
    		digest.reset();
    
    		// create a new file name
    		final String newFileName = checksum + extension;
    
    		// Build the new file name and path
    		if (alternateOutput == null) {
    		    final String elementRelativePath = FilenameUtils.getFullPath(headElement.getValue());
    	        final File directoryInOutputRoot = new File(outputRoot, elementRelativePath);
    	        // create the same directory structure in the output root
    	        directoryInOutputRoot.mkdirs();
    
    	        aggregateOutputFile = new File(directoryInOutputRoot, newFileName).getCanonicalFile();
    		}
    		else {
    		    aggregateOutputFile = new File(alternateOutput, newFileName).getCanonicalFile();
    		}
    		
    		//Move the aggregate file into the correct location
    		FileUtils.deleteQuietly(aggregateOutputFile);
            FileUtils.moveFile(tempFile, aggregateOutputFile);
        }
        finally {
            //Make sure the temp file gets deleted
            FileUtils.deleteQuietly(tempFile);
        }

		final String newResultValue = RelativePath.getRelativePath(outputRoot, aggregateOutputFile);
		
		this.logAggregation(elements, newResultValue);
		
		return callback.getAggregateElement(newResultValue, elements);
	}
1276100
@Override
  protected void reserveInternal(int newCapacity) {
    if (isArray() || type instanceof MapType) {
      int[] newLengths = new int[newCapacity];
      int[] newOffsets = new int[newCapacity];
      if (this.arrayLengths != null) {
        System.arraycopy(this.arrayLengths, 0, newLengths, 0, capacity);
        System.arraycopy(this.arrayOffsets, 0, newOffsets, 0, capacity);
      }
      arrayLengths = newLengths;
      arrayOffsets = newOffsets;
    } else if (type instanceof BooleanType) {
      if (byteData == null || byteData.length < newCapacity) {
        byte[] newData = new byte[newCapacity];
        if (byteData != null) System.arraycopy(byteData, 0, newData, 0, capacity);
        byteData = newData;
      }
    } else if (type instanceof ByteType) {
      if (byteData == null || byteData.length < newCapacity) {
        byte[] newData = new byte[newCapacity];
        if (byteData != null) System.arraycopy(byteData, 0, newData, 0, capacity);
        byteData = newData;
      }
    } else if (type instanceof ShortType) {
      if (shortData == null || shortData.length < newCapacity) {
        short[] newData = new short[newCapacity];
        if (shortData != null) System.arraycopy(shortData, 0, newData, 0, capacity);
        shortData = newData;
      }
    } else if (type instanceof IntegerType || type instanceof DateType ||
      DecimalType.is32BitDecimalType(type)) {
      if (intData == null || intData.length < newCapacity) {
        int[] newData = new int[newCapacity];
        if (intData != null) System.arraycopy(intData, 0, newData, 0, capacity);
        intData = newData;
      }
    } else if (type instanceof LongType || type instanceof TimestampType ||
        DecimalType.is64BitDecimalType(type)) {
      if (longData == null || longData.length < newCapacity) {
        long[] newData = new long[newCapacity];
        if (longData != null) System.arraycopy(longData, 0, newData, 0, capacity);
        longData = newData;
      }
    } else if (type instanceof FloatType) {
      if (floatData == null || floatData.length < newCapacity) {
        float[] newData = new float[newCapacity];
        if (floatData != null) System.arraycopy(floatData, 0, newData, 0, capacity);
        floatData = newData;
      }
    } else if (type instanceof DoubleType) {
      if (doubleData == null || doubleData.length < newCapacity) {
        double[] newData = new double[newCapacity];
        if (doubleData != null) System.arraycopy(doubleData, 0, newData, 0, capacity);
        doubleData = newData;
      }
    } else if (childColumns != null) {
      // Nothing to store.
    } else {
      throw new RuntimeException("Unhandled " + type);
    }

    byte[] newNulls = new byte[newCapacity];
    if (nulls != null) System.arraycopy(nulls, 0, newNulls, 0, capacity);
    nulls = newNulls;

    capacity = newCapacity;
  }
131308
public static void validateResourceList(final List<Resource> resourceList) {
        boolean hasNotResource = false;
        boolean hasResource = false;
        for (Resource resource : resourceList) {
            if (resource.isNotType()) {
                hasNotResource = true;
            } else {
                hasResource = true;
            }
            if (hasResource && hasNotResource) {
                // right now only validate that there are only NotResource or only Resource elements
                // in the future could do more validation
                throw new IllegalArgumentException(PolicyUtils.INVALID_RESOURCE);
            }
        }
    }
1216532
def static(path, no_input):
    ''''''
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    cmdenv = CommandLineEnvironment(assets, log)
    cmdenv.build()

    if exists(path):
        warning('{0} directory already exists and will be {1}', white(path), white('erased'))
        if not no_input and not click.confirm('Are you sure'):
            exit_with_error()
        shutil.rmtree(path)

    echo('Copying assets into {0}', white(path))
    shutil.copytree(assets.directory, path)

    success('Done')
549176
<T> boolean isExportEntityInvalid(final List<T> t) {
        return (BasicCollectionUtils.isEmpty(t) || isExportEntityInvalid(t.get(0)));
    }
141705
private boolean checkMultipleColumnsEditorEnabled() {
        final int size = listEditor.getList().size();
        if (size == 2 && !listEditor.getEditors().isEmpty()) {
            final String cId = listEditor.getEditors().get(0).id().getValue();
            if (!restrictedColumns.contains(cId)) {
                setEditorEnabled(0, true, null);
            }
            return true;
        }
        return false;
    }
914565
public ORole checkIfAllowed(final String iResource, final int iOperation) {
		for (ORole r : roles)
			if (r.allow(iResource, iOperation))
				return r;

		return null;
	}
363954
@Override
    @Path("/{assetPath}")
    @ApiOperation(value="Apply rules identified by assetPath.", notes="Query may contain runtime values")
    @ApiImplicitParams({
        @ApiImplicitParam(name="FactsObject", paramType="body", required=true, value="Input to apply rules against"),
        @ApiImplicitParam(name="assetPath", paramType="path", required=true, value="Identifies a .drl or .xlsx asset"),
        @ApiImplicitParam(name="rules-executor", paramType="header", required=false, value="Default is Drools")})
    public JSONObject post(String path, JSONObject content, Map<String,String> headers)
            throws ServiceException, JSONException {

        Asset rules = getRulesAsset(path);

        Operand input = new Operand(content);
        input.setContext(getContext(path));
        Query query = getQuery(path, headers);
        input.setParams(query.getFilters());
        input.setMeta(headers);

        JSONObject response = invokeRules(rules, input, getExecutor(headers));

        Status status = input.getStatus();
        if (status != null) {
            headers.put(Listener.METAINFO_HTTP_STATUS_CODE, String.valueOf(status.getCode()));
            if (response == null)
                return status.getJson();
        }

        return response;
    }
318587
@Override
    boolean changingSuperAllowed(T oldSuperType, T newSuperType) {
        boolean changingSuperAllowed = super.changingSuperAllowed(oldSuperType, newSuperType);
        if (changingSuperAllowed && oldSuperType != null && !Schema.MetaSchema.isMetaLabel(oldSuperType.label())) {
            //noinspection unchecked
            Set<Role> superPlays = oldSuperType.playing().collect(Collectors.toSet());

            //Get everything that this can play bot including the supers
            Set<Role> plays = new HashSet<>(directPlays().keySet());
            subs().flatMap(sub -> TypeImpl.from(sub).directPlays().keySet().stream()).forEach(plays::add);

            superPlays.removeAll(plays);

            //It is possible to be disconnecting from a role which is no longer in use but checking this will take too long
            //So we assume the role is in sure and throw if that is the case
            if (!superPlays.isEmpty() && instancesDirect().findAny().isPresent()) {
                throw TransactionException.changingSuperWillDisconnectRole(oldSuperType, newSuperType, superPlays.iterator().next());
            }

            return true;
        }
        return changingSuperAllowed;
    }
1062700
@Inline(value="$2.$3unmodifiableList($1)", imported=Collections.class)
	public static <T> List<T> unmodifiableView(List<? extends T> list) {
		return Collections.unmodifiableList(list);
	}