humanizing various things
340205
def human(object)
      if object.is_a?(Date)
        object.strftime('%B %d, %Y')
      elsif object.is_a?(Time)
        object.strftime('%B %d, %Y at %I:%M %p')
      elsif object.is_a?(String)
        object.humanize
      else
        object
      end
    end
343806
function HandMesh(options) {
    this.options = options = Object.assign({}, DEFAULTS, options || {});
    this.options.jointColor = this.options.jointColor || JOINT_COLORS[numInstances % 2];
    this.object3D = new THREE.Object3D();
    this.material = !isNaN(options.opacity) ? new THREE.MeshPhongMaterial({
      fog: false,
      transparent: true,
      opacity: options.opacity
    }) : new THREE.MeshPhongMaterial({fog: false});

    this.createFingers();
    this.createArm();
    numInstances++;
  }
287376
def humanize_placeholders(msgid):
    
    return re.sub(
        r'%(?:\((\w+)\))?([sd])',
        lambda match: r'__{0}__'.format(
            match.group(1).lower() if match.group(1) else 'number' if match.group(2) == 'd' else 'item'),
        msgid)
202169
function(thing, styles) {
			var element = thing instanceof gui.Spirit ? thing.element : thing;
			gui.Object.each(styles, function(prop, value) {
				this.set(element, prop, value);
			}, this);
			return thing;
		}
402283
function(items) {
            var n = items.length - 1;
            for(var i = 0; i < n; i++) {
                if(items[i].relativePosition == items[i + 1].relativePosition) {
                    items[i].label = items[i].label + '<span class="timeline-me-same-position">' + items[i + 1].label + '</span>';
                    items[i].shortContent = items[i].shortContent + '<span class="timeline-me-same-position">' + items[i + 1].shortContent + '</span>';
                    items[i].fullContent = items[i].fullContent + '<span class="timeline-me-same-position">' + items[i + 1].fullContent + '</span>';
                    items.splice(i + 1, 1);
                    n--;
                }
            }
        }
765633
function ( renderer, scene, camera, geometry, material, group ) {

				if ( material.isGLTFSpecularGlossinessMaterial !== true ) {

					return;

				}

				var uniforms = material.uniforms;
				var defines = material.defines;

				uniforms.opacity.value = material.opacity;

				uniforms.diffuse.value.copy( material.color );
				uniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );

				uniforms.map.value = material.map;
				uniforms.specularMap.value = material.specularMap;
				uniforms.alphaMap.value = material.alphaMap;

				uniforms.lightMap.value = material.lightMap;
				uniforms.lightMapIntensity.value = material.lightMapIntensity;

				uniforms.aoMap.value = material.aoMap;
				uniforms.aoMapIntensity.value = material.aoMapIntensity;

				// uv repeat and offset setting priorities
				// 1. color map
				// 2. specular map
				// 3. normal map
				// 4. bump map
				// 5. alpha map
				// 6. emissive map

				var uvScaleMap;

				if ( material.map ) {

					uvScaleMap = material.map;

				} else if ( material.specularMap ) {

					uvScaleMap = material.specularMap;

				} else if ( material.displacementMap ) {

					uvScaleMap = material.displacementMap;

				} else if ( material.normalMap ) {

					uvScaleMap = material.normalMap;

				} else if ( material.bumpMap ) {

					uvScaleMap = material.bumpMap;

				} else if ( material.glossinessMap ) {

					uvScaleMap = material.glossinessMap;

				} else if ( material.alphaMap ) {

					uvScaleMap = material.alphaMap;

				} else if ( material.emissiveMap ) {

					uvScaleMap = material.emissiveMap;

				}

				if ( uvScaleMap !== undefined ) {

					// backwards compatibility
					if ( uvScaleMap.isWebGLRenderTarget ) {

						uvScaleMap = uvScaleMap.texture;

					}

					if ( uvScaleMap.matrixAutoUpdate === true ) {

						uvScaleMap.updateMatrix();

					}

					uniforms.uvTransform.value.copy( uvScaleMap.matrix );

				}

				uniforms.envMap.value = material.envMap;
				uniforms.envMapIntensity.value = material.envMapIntensity;
				uniforms.flipEnvMap.value = ( material.envMap && material.envMap.isCubeTexture ) ? - 1 : 1;

				uniforms.refractionRatio.value = material.refractionRatio;

				uniforms.specular.value.copy( material.specular );
				uniforms.glossiness.value = material.glossiness;

				uniforms.glossinessMap.value = material.glossinessMap;

				uniforms.emissiveMap.value = material.emissiveMap;
				uniforms.bumpMap.value = material.bumpMap;
				uniforms.normalMap.value = material.normalMap;

				uniforms.displacementMap.value = material.displacementMap;
				uniforms.displacementScale.value = material.displacementScale;
				uniforms.displacementBias.value = material.displacementBias;

				if ( uniforms.glossinessMap.value !== null && defines.USE_GLOSSINESSMAP === undefined ) {

					defines.USE_GLOSSINESSMAP = '';
					// set USE_ROUGHNESSMAP to enable vUv
					defines.USE_ROUGHNESSMAP = '';

				}

				if ( uniforms.glossinessMap.value === null && defines.USE_GLOSSINESSMAP !== undefined ) {

					delete defines.USE_GLOSSINESSMAP;
					delete defines.USE_ROUGHNESSMAP;

				}

			}
485742
def display_annotations(self):
        """"""
        for item in self.idx_annot:
            self.scene.removeItem(item)
        self.idx_annot = []
        for item in self.idx_annot_labels:
            self.scene.removeItem(item)
        self.idx_annot_labels = []
        self.highlight = None

        window_start = self.parent.value('window_start')
        window_length = self.parent.value('window_length')
        window_end = window_start + window_length
        y_distance = self.parent.value('y_distance')

        bookmarks = []
        events = []

        if self.parent.notes.annot is not None:
            if self.parent.value('annot_show'):
                bookmarks = self.parent.notes.annot.get_bookmarks()
                events = self.parent.notes.get_selected_events((window_start,
                                                                window_end))
        annotations = bookmarks + events

        for annot in annotations:

            if window_start <= annot['end'] and window_end >= annot['start']:

                mrk_start = max((annot['start'], window_start))
                mrk_end = min((annot['end'], window_end))
                if annot in bookmarks:
                    color = QColor(self.parent.value('annot_bookmark_color'))
                if annot in events:
                    color = convert_name_to_color(annot['name'])

                if logical_or(annot['chan'] == [''],
                              self.action['cross_chan_mrk'].isChecked()):
                    h_annot = len(self.idx_label) * y_distance

                    item = TextItem_with_BG(color.darker(200))
                    item.setText(annot['name'])
                    item.setPos(annot['start'],
                                len(self.idx_label) * y_distance)
                    item.setFlag(QGraphicsItem.ItemIgnoresTransformations)
                    item.setRotation(-90)
                    self.scene.addItem(item)
                    self.idx_annot_labels.append(item)
                    mrk_dur = amax((mrk_end - mrk_start, 
                                  self.parent.value('min_marker_display_dur')))

                    item = RectMarker(mrk_start, 0, mrk_dur,
                                      h_annot, zvalue=-8,
                                      color=color.lighter(120))

                    self.scene.addItem(item)
                    self.idx_annot.append(item)

                if annot['chan'] != ['']:
                    # find indices of channels with annotations
                    chan_idx_in_mrk = in1d(self.chan, annot['chan'])
                    y_annot = asarray(self.chan_pos)[chan_idx_in_mrk]
                    y_annot -= y_distance / 2
                    mrk_dur = amax((mrk_end - mrk_start, 
                                  self.parent.value('min_marker_display_dur')))

                    for y in y_annot:
                        item = RectMarker(mrk_start, y, mrk_dur,
                                          y_distance, zvalue=-7, color=color)
                        self.scene.addItem(item)
                        self.idx_annot.append(item)
391850
function() {
      var objects = this.getObjects();
      var markup = [
        '<g ',
          'width="', this.width, '" ',
          'height="', this.height, '" ',
          'style="', this.getSvgStyles(), '" ',
          'transform="', this.getSvgTransform(), '" ',
        '>'
      ];

      for (var i = 0, len = objects.length; i < len; i++) {
        markup.push(objects[i].toSVG());
      }
      markup.push('</g>');

      return markup.join('');
    }
998606
def get_human_readable_type(item):
    """"""
    if isinstance(item, (ndarray, MaskedArray)):
        return item.dtype.name
    elif isinstance(item, Image):
        return "Image"
    else:
        text = get_type_string(item)
        if text is None:
            text = to_text_string('unknown')
        else:
            return text[text.find('.')+1:]
1229322
def humanize(number):
    
    # units = ('bytes', 'KB', 'MB', 'GB', 'TB')
    # base = 1000
    units = ('bytes', 'KiB', 'MiB', 'GiB', 'TiB')
    base = 1024
    if number is None:
        return None
    pow = int(math.log(number, base)) if number > 0 else 0
    pow = min(pow, len(units) - 1)
    mantissa = number / (base ** pow)
    return "%.4g %s" % (mantissa, units[pow])
241616
def render(self, display):
        """"""

        # to handle changing objects / callable
        if self.shawn_text != self._last_text:
            self._render()

        if self.text:
            papy = self._surface.get_width()
            if papy <= self.width:
                display.blit(self._surface, (self.topleft, self.size))
            else:
                display.blit(self._surface, (self.topleft, self.size), ((papy - self.w, 0), self.size))
        else:
            display.blit(self.default_text, (self.topleft, self.size))

        if self._focus:
            groom = self.cursor_pos()
            line(display, (groom, self.top), (groom, self.bottom), CONCRETE)
840186
function(obj, func, items, func2){
					each(items, function(i, item){
						when(obj, func, item, func2)
					})
				}
347675
function processItems ( items, values, guid, counter ) {
  	if ( counter === void 0 ) counter = 0;

  	return items.map( function ( item ) {
  		if ( item.type === TEXT ) {
  			return item.template;
  		}

  		if ( item.fragment ) {
  			if ( item.fragment.iterations ) {
  				return item.fragment.iterations.map( function ( fragment ) {
  					return processItems( fragment.items, values, guid, counter );
  				}).join( '' );
  			} else {
  				return processItems( item.fragment.items, values, guid, counter );
  			}
  		}

  		var placeholderId = "" + guid + "-" + (counter++);
  		var model = item.model || item.newModel;

  		values[ placeholderId ] = model ?
  			model.wrapper ?
  				model.wrapper.value :
  				model.get() :
  			undefined;

  		return '${' + placeholderId + '}';
  	}).join( '' );
  }
1073925
def items(cls):
        
        return [
            cls.GREEN,
            cls.BLACK_AND_WHITE,
            cls.CONTRAST_SHIFTED,
            cls.CONTRAST_CONTINUOUS
        ]
157467
function(data) {
            var corners = [];
            for (var i = 0; i < data.length; i += 2) {
                corners.push({
                    x: data[i],
                    y: data[i + 1]
                });
            }

            this._image.addDetailData(corners);
        }
654331
function(things) {
				var els = things,
					element = this.spirit.element,
					first = element.firstChild;
				els.reverse().forEach(function(el) {
					element.insertBefore(el, first);
					maybespiritualize(el);
				});
			}
897434
def normalize(self):
        
        order = [
            'sld:Title', 'ogc:Filter', 'sld:MinScaleDenominator',
            'sld:MaxScaleDenominator', 'sld:PolygonSymbolizer',
            'sld:LineSymbolizer', 'sld:TextSymbolizer', 'sld:PointSymbolizer']
        for item in order:
            xpath = self._node.xpath(item, namespaces=SLDNode._nsmap)
            for xitem in xpath:
                # move this to the end
                self._node.remove(xitem)
                self._node.append(xitem)