Defines the library.
777096
function defineLib() {
    var jsbayes = {};
    jsbayes.newGraph = function() {
      return {
        nodes: [],
        saveSamples: false,
        samples: [],
        reinit: function() {
          var f = function(g) {
            for(var i=0; i < g.nodes.length; i++) {
              var node = g.nodes[i];
              if(node.dirty === undefined || node.dirty) {
                node.cpt = initCptWithParents(node.values, node.parents, 0);
                node.dirty = false;
              }
            }
          };
          return async(f, [this]);
        },
        samplesAsCsv: function(options) {
          var opts = options || {};
          var D_ROW = opts.rowDelimiter || '\n';
          var D_FIELD = opts.fieldDelimiter || ',';
          var csv = '';
          var row = '';
          for(var i=0; i < this.nodes.length; i++) {
            row += this.nodes[i].name;
            if(i < this.nodes.length-1) {
              row += D_FIELD;
            }
          }
          csv += row + D_ROW;

          for(var i=0; i < this.samples.length; i++) {
            var sample = this.samples[i];
            row = '';
            for(var j=0; j < this.nodes.length; j++) {
              var node = this.nodes[j];
              row += sample[node.name];
              if(j < this.nodes.length-1) {
                row += D_FIELD;
              }
            }
            csv += row;
            if(i < this.samples.length-1) {
              csv += D_ROW;
            }
          }
          
          return csv;
        },
        sample: function(samples) {
          var f = function(g, samples) {
            if(g.saveSamples) {
              //reset the samples if we want to save them
              g.samples = [];
            }
            
            for(var h=g.nodes.length-1; h >= 0; h--) {
              g.nodes[h].initSampleLw();
            }

            var lwSum = 0;
            for(var count=0; count < samples; count++) {
              for(var h=g.nodes.length-1; h >= 0; h--) {
                var n = g.nodes[h];
                if(!n.isObserved) {
                  n.value = -1;
                }
                n.wasSampled = false;
              }

              var fa = 1;
              for(var h=g.nodes.length-1; h >= 0; h--) {
                var n = g.nodes[h];
                fa *= n.sampleLw();
              }
              lwSum += fa;
              for(var h=g.nodes.length-1; h >= 0; h--) {
                var n = g.nodes[h];
                n.saveSampleLw(fa);
              }
              
              if(g.saveSamples) {
                var sample = {};
                for(var h=g.nodes.length-1; h >= 0; h--) {
                  var n = g.nodes[h];
                  sample[n.name] = n.values[n.value];
                }
                g.samples.push(sample);
              }
            }

            return lwSum;
          };
          return async(f, [this, samples]);
        },
        update: function(m) {
          for(var i=0; i < this.nodes.length; i++) {
            var tnode = this.nodes[i]; //'this' node
            var unode = m[tnode.name]; //update node

            if(!unode) {
              continue;
            }

            tnode.value = unode.value;
            tnode.wasSampled = unode.wasSampled;
            tnode.sampledLw = unode.sampledLw;
          }
        },
        node: function(name) {
          if(!this.nodeMap) {
            this.nodeMap = {};
            for(var i=0; i < this.nodes.length; i++) {
              var node = this.nodes[i];
              this.nodeMap[node.name] = node;
            }
          }
          return this.nodeMap[name];
        },
        observe: function(name, value) {
          var node = this.node(name);
          if(node) {
            var index = node.valueIndex(value);
            if(index >= 0) {
              node.isObserved = true;
              node.value = index;
            } else {
              console.error('could not find value ' + value + ' for node ' + name);
            }
          } else {
            console.error('could not find node with name ' + name);
          }
        },
        unobserve: function(name) {
          var node = this.node(name);
          if(node) {
            node.isObserved = false;
            node.value = -1;
          }
        },
        addNode: function(name, values) {
          var node = {
            name: name,
            values: values,
            value: -1,
            parents: [],
            wasSampled: false,
            sampledLw: undefined,
            addParent: function(parent) {
              this.parents.push(parent);
              this.dirty = true;
              return this;
            },
            valueIndex: function(v) {
              if(!this.valueIndexMap) {
                this.valueIndexMap = {};
                for(var i=0; i < this.values.length; i++) {
                  var value = this.values[i];
                  this.valueIndexMap[value] = i;
                }
              }
              return this.valueIndexMap[v];
            },
            initSampleLw: function() {
              this.sampledLw = undefined;
            },
            sampleLw: function() {
              if(this.wasSampled) {
                return 1;
              }

              var fa = 1;
              for(var h=0; h < this.parents.length; h++) {
                var pa = this.parents[h];
                var pSampleLw = pa.sampleLw();
                fa *= pSampleLw;
              }

              this.wasSampled = true;

              var dh = this.cpt;
              for(var h=0; h < this.parents.length; h++) {
                var p = this.parents[h];
                var v = p.value;
                dh = dh[v];
              }

              if(this.value != -1) {
                var v = dh[this.value];
                fa *= v;
              } else {
                var fv = Math.random();
                for(var h=0; h < dh.length; h++) {
                  var v = dh[h];
                  fv -= v;
                  if(fv < 0) {
                    this.value = h;
                    break;
                  }
                }
              }

              return fa;
            },
            saveSampleLw: function(f) {
              if(!this.sampledLw) {
                this.sampledLw = new Array(this.values.length);
                for(var h=this.values.length-1; h >= 0; h--) {
                  this.sampledLw[h] = 0;
                }
              }
              this.sampledLw[this.value] += f;
            },
            setCpt: function(probs) {
              if(this.parents.length === 0) {
                this.cpt = normalizeProbs(probs);
              } else {
                this.cpt = initNodeCpt(this.values, this.parents, normalizeCpts(probs));
              }
            },
            probs: function() {
              if(!this.sampledLw) {
                return [];
              }
              var sum = 0.0;
              var probs = [];
              for(var i=0; i < this.sampledLw.length; i++) {
                var s = this.sampledLw[i];
                sum += s;
                probs.push(s);
              }
              for(var i=0; i < this.sampledLw.length; i++) {
                probs[i] = probs[i] / sum;
              }
              return probs;
            }
          }
          this.nodes.push(node);
          return node;
        }
      };
    }

    jsbayes.toMessage = function(g) {
      var nodes = {};
      var parents = {};

      for(var i=0; i < g.nodes.length; i++) {
        var n = g.nodes[i];
        var node = {
          name: n.name,
          values: n.values,
          value: n.value,
          parents: [],
          wasSampled: n.wasSampled,
          sampledLw: n.sampledLw,
          cpt: n.cpt
        };
        nodes[n.name] = node;

        var pas = [];
        for(var j=0; j < n.parents.length; j++) {
          var pa = n.parents[j];
          pas.push(pa.name);
        }
        parents[n.name] = pas;
      }

      var msg = {
        samples: 10000,
        nodes: nodes,
        parents: parents
      };

      return JSON.stringify(msg);
    }

    return jsbayes;
  }
206595
function initLibraries(cfg = {}) {
	_.each(configMap, (keys, libName) => {
		let lib = libs[libName];
		let options = {};
		_.each(keys, (key) => options[key] = cfg[key]);
		lib.setOptions && lib.setOptions(options);
	});
}
1255962
def _loadlib(lib='standard'):
    """"""
    global _LIB
    if _LIB is not None:
        warnings.warn('rabit.int call was ignored because it has'\
                          ' already been initialized', level=2)
        return
    if lib == 'standard':
        _LIB = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '')
    elif lib == 'mock':
        _LIB = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '_mock')
    elif lib == 'mpi':
        _LIB = ctypes.cdll.LoadLibrary(WRAPPER_PATH % '_mpi')
    else:
        raise Exception('unknown rabit lib %s, can be standard, mock, mpi' % lib)
    _LIB.RabitGetRank.restype = ctypes.c_int
    _LIB.RabitGetWorldSize.restype = ctypes.c_int
    _LIB.RabitVersionNumber.restype = ctypes.c_int
378335
function loadIntoLibrary(schemas) {
  assert(_.isObject(schemas));
  _.extend(library, schemas);
}
631072
def get_library(self, library):
        
        if library in self._library_cache:
            return self._library_cache[library]

        try:
            error = None
            lib = ArcticLibraryBinding(self, library)
            lib_type = lib.get_library_type()
        except (OperationFailure, AutoReconnect) as e:
            error = e

        if error:
            raise LibraryNotFoundException("Library %s was not correctly initialized in %s.\nReason: %r)" %
                                           (library, self, error))
        elif not lib_type:
            raise LibraryNotFoundException("Library %s was not correctly initialized in %s." %
                                           (library, self))
        elif lib_type not in LIBRARY_TYPES:
            raise LibraryNotFoundException("Couldn't load LibraryType '%s' for '%s' (has the class been registered?)" %
                                           (lib_type, library))
        instance = LIBRARY_TYPES[lib_type](lib)
        self._library_cache[library] = instance
        # The library official name may be different from 'library': e.g. 'library' vs 'user.library'
        self._library_cache[lib.get_name()] = instance
        return self._library_cache[library]
757102
function getLibrariesTasks(baseTask) {
	var libraries = getLibraries();
	var tasks = [];

	for (index = 0; index < libraries.length; ++index) {
	    tasks.push(baseTask + '.' + libraries[index]);
	}

	return tasks;
}
1216088
public function prependLibrary($library, $href)
    {
        $href = '/lib/' . $library . '/css/' . $href;
        $this->prepend('library', $href);
        return $this;
    }
383071
private void copyLibraryElementsToClasspath(Library library) {
        Collection<File> files = library.getFiles();
        addToClassPath(library.getContainers());
        if (files != null && !!!files.isEmpty()) {
            for (File file : files) {

                nativeLibraryFiles.add(file);
            }
        }

        for (Fileset fileset : library.getFilesets()) {
            for (File file : fileset.getFileset()) {

                nativeLibraryFiles.add(file);
            }
        }
    }
580039
def define(self):
        
        self.collections = []

        self.camera_collection = \
            SimpleCollection(filename=os.path.join(self.directory, "devices.dat"),
                             row_classes=[
                DataModel.EmptyRow,
                DataModel.RTSPCameraRow,
                DataModel.USBCameraRow
            ]
            )
        self.collections.append(self.camera_collection)

        self.config_collection = \
            SimpleCollection(filename=os.path.join(self.directory, "config.dat"),
                             row_classes=[  # we could dump here all kinds of info related to different kind of configuration forms
                DataModel.MemoryConfigRow
            ]
            )
        self.collections.append(self.config_collection)
1158505
def lib(self):
    """"""
    lib = self.ffi.dlopen(self.binary)
    _FFISpecification(self.ffi, lib).register_cffi_externs()
    return lib
759655
def load_library(self, path):
        '''
        
        '''
        module = import_module(path)
        self.tags.update(module.register.tags)
        self.helpers.update(module.register.helpers)
483812
private static String createLibraryExtension()
    {
        OSType osType = calculateOS();
        switch (osType)
        {
            case APPLE:
                return "dylib";
            case ANDROID:
            case LINUX:
            case SUN:
                return "so";
            case WINDOWS:
                return "dll";
            default:
                break;
        }
        return "";
    }
653757
function isLibrary (node) {
  return nodeType(node, exactMatch(nodeTypes.CONTRACTDEFINITION)) && node.attributes.isLibrary === true
}
1316106
function() {
        var unrar = require("./lib/Unrar"),
            l_sFile = arguments[0],
            l_sOutputDir,
            l_aUnrarredFiles,
            l_oBuffer,
            l_oOptions;

        // check if output dir specified
        if (typeof(arguments[1]) === "string") {
            l_sOutputDir = arguments[1];
            l_oOptions = arguments[2] || {};
        } else {
            l_oOptions = arguments[1] || {};
        }

        _registerEvents(l_oOptions);
        l_oBuffer = fs.readFileSync(l_sFile);
        l_aUnrarredFiles = unrar(l_oBuffer);

        if (l_sOutputDir) {
            l_aUnrarredFiles = storeFilesToDiskSync(l_aUnrarredFiles, l_sOutputDir);
        }

        return l_aUnrarredFiles;
    }
804203
function(opts) {
  if(!opts) opts = {};
  var libpath = opts['path'];
  var key = opts['key'];

  this._library = this._createLibrary(libpath);
  this._initKey(key);
  this._initHandle(this._key);
}
332397
def _install_library(library_name)
      result = run_and_capture(flag_install_library, library_name)

      already_installed = result[:err].include?("Library is already installed: #{library_name}")
      success = result[:success] || already_installed

      @libraries_indexed = (@libraries_indexed || success) if library_name == WORKAROUND_LIB
      success
    end
147728
public function load($library)
    {
        if ($this->_compatibleMode
            && array_key_exists($library, $this->_compatible)
        ) {
            $library = $this->_compatible[$library];
        }
        $library = "\\ArUtil\\I18N\\$library";
        $this->myFile  = $library;
        $this->myClass = $library;
        $class         = $library;

//        if (!$this->_useAutoload) {
//            include_once self::getClassFile($this->myFile);
//        }

        if (!isset($this->myObject)) {
            $this->myObject = new $class();
        }
        
        $this->{$library} = &$this->myObject;
    }