The original classification considers four style of faulting categories
        (normal, strike-slip, reverse-oblique and reverse).
556849
def _get_fault_type_dummy_variables(self, rup):
        

        Fn, Fr = 0, 0
        if rup.rake >= -112.5 and rup.rake <= -67.5:
            # normal
            Fn = 1
        elif rup.rake >= 22.5 and rup.rake <= 157.5:
            # Joins both the reverse and reverse-oblique categories
            Fr = 1
        return Fn, Fr
872202
def _get_mechanism(self, rup, coeffs):
        
        is_strike_slip = self.get_fault_type_dummy_variables(rup)
        return coeffs['b6']*is_strike_slip
303696
public static <T> Collector<T, ?, List<T>> toListReversed() {
		return Collectors.collectingAndThen(Collectors.toList(), l -> {
			Collections.reverse(l);
			return l;
		});
	}
689803
def category(self) -> Optional[str]:
        ''''''
        if self.statements:
            if self.statements[-1][0] == ':':
                # a hack. ... to avoid calling isValid recursively
                def validDirective():
                    if not self.values:
                        return True
                    if self.values[-1].strip().endswith(','):
                        return False
                    try:
                        compile(
                            'func(' + ''.join(self.values) + ')',
                            filename='<string>',
                            mode='eval')
                    except Exception:
                        return False
                    return True

                if validDirective() and self._action is not None:
                    return 'script'
                return 'directive'
            return 'statements'
        return None
1328715
public function reverse()
    {
        $result = [];

        foreach ($this->components as $i => $component) {
            $result[$i] = $component * -1;
        }

        return new static($result);
    }
474069
def classify_coupling(coupling):
    
    lower, upper = coupling

    if lower is None and upper is None:
        return CouplingClass.Uncoupled
    elif lower is None or upper is None:
        return CouplingClass.DirectionalReverse
    elif lower == 0.0 and upper == 0.0:
        return CouplingClass.Inconsistent
    elif lower <= 0.0 and upper >= 0.0:
        return CouplingClass.DirectionalForward
    elif abs(lower - upper) < 1e-6:
        return CouplingClass.Full
    else:
        return CouplingClass.Partial
505462
public function afterMainTaxonomy()
	{
		// Run the pruning process over the roles taxonomy
		$map = array(
			XBRL_US_GAAP_2015::$us_GAAP_2013_NS => XBRL_US_GAAP_2015::$us_GAAP_2013_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2013_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2013_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2013_ENTRY_POINT_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2013_ROLES_NS,

			XBRL_US_GAAP_2015::$us_GAAP_2014_NS => XBRL_US_GAAP_2015::$us_GAAP_2014_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2014_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2014_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2014_ENTRY_POINT_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2014_ROLES_NS,

			XBRL_US_GAAP_2015::$us_GAAP_2015_NS => XBRL_US_GAAP_2015::$us_GAAP_2015_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2015_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2015_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2015_ENTRY_POINT_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2015_ROLES_NS,

			XBRL_US_GAAP_2015::$us_GAAP_2016_NS => XBRL_US_GAAP_2015::$us_GAAP_2016_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2016_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2016_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2016_ENTRY_POINT_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2016_ROLES_NS,

			XBRL_US_GAAP_2015::$us_GAAP_2017_NS => XBRL_US_GAAP_2015::$us_GAAP_2017_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2017_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2017_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2017_ENTRY_POINT_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2017_ROLES_NS,

			XBRL_US_GAAP_2015::$us_GAAP_2018_NS => XBRL_US_GAAP_2015::$us_GAAP_2018_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2018_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2018_ROLES_NS,
			XBRL_US_GAAP_2015::$us_GAAP_2018_ENTRY_POINT_ALL_NS => XBRL_US_GAAP_2015::$us_GAAP_2018_ROLES_NS,
		);

		/**
		 * @var XBRL $taxonomy
		 */
		$taxonomy = false;
		if ( isset( $map[ $this->getNamespace() ] ) )
		{
			$taxonomy = $this->getTaxonomyForNamespace( $map[ $this->getNamespace() ] );
		}

		if ( ! $taxonomy )
		{
			foreach ( array_unique( array_values( $map ) ) as $namespace => $roleNamespace )
			{
				if ( ! ( $taxonomy = $this->getTaxonomyForNamespace( $roleNamespace ) ) ) continue;
				break;
			}

			if ( ! $taxonomy )
			{
				$this->log()->err( "The Roles schema cannot be located for taxonomy with namespace '{$this->getNamespace()}'" );
				exit;
			}
		}

		// /**
		//  * @var XBRL $taxonomy
		//  */
		// $taxonomy = $this->getTaxonomyForNamespace( XBRL_US_GAAP_2015::$us_GAAP_2015_ROLES_NS );
		// if ( ! $taxonomy )
		// {
		// 	$taxonomy = $this->getTaxonomyForNamespace( XBRL_US_GAAP_2015::$us_GAAP_2014_ROLES_NS );
		// 	if ( ! $taxonomy )
		// 	{
		// 		$this->log()->err( "The Roles schema cannot be located for 2014 or 2015" );
		// 		exit;
		// 	}
		// }

		if ( $this->context->isExtensionTaxonomy() )
		{
			// This is needed because the definitions and presentations are loaded into
			// the roles schema which is loaded early so an additional fixup is required.
			$taxonomy->fixupPresentationHypercubes();
			$taxonomy->fixupDefinitionRoles(); // Mainly adds a 'paths' index to the 'hierarchy' element of each role.
		}

		$this->context->locale = 'en_US';
		$taxonomy->context->locale = 'en_US';
	}
668638
def complex_fault_node(edges):
    
    node = Node('complexFaultGeometry')
    node.append(edge_node('faultTopEdge', edges[0]))
    for edge in edges[1:-1]:
        node.append(edge_node('intermediateEdge', edge))
    node.append(edge_node('faultBottomEdge', edges[-1]))
    return node
829541
def Categories(unicode_dir=_UNICODE_DIR):
  

  categories = {}

  def DoLine(codes, fields):
    """Process single UnicodeData.txt line, updating categories."""
    category = fields[2]
    categories.setdefault(category, []).extend(codes)
    # Add codes from Lu into L, etc.
    if len(category) > 1:
      short = category[0]
      categories.setdefault(short, []).extend(codes)

  ReadUnicodeTable(unicode_dir+"/UnicodeData.txt", 15, DoLine)
  return categories
758867
@Override
	public C classify(T classifiable) {

		if (classifiable == null) {
			return this.defaultValue;
		}

		@SuppressWarnings("unchecked")
		Class<? extends T> exceptionClass = (Class<? extends T>) classifiable.getClass();
		if (this.classified.containsKey(exceptionClass)) {
			return this.classified.get(exceptionClass);
		}

		// check for subclasses
		C value = null;
		for (Class<?> cls = exceptionClass; !cls.equals(Object.class)
				&& value == null; cls = cls.getSuperclass()) {
			value = this.classified.get(cls);
		}

		// ConcurrentHashMap doesn't allow nulls
		if (value != null) {
			this.classified.put(exceptionClass, value);
		}

		if (value == null) {
			value = this.defaultValue;
		}

		return value;
	}
1018465
def process_tectonic_regionalisation(self):
        '''
        
        '''

        if 'tectonic_regionalisation' in self.data.keys():
            tectonic_reg = TectonicRegionalisation()
            tectonic_reg.populate_regions(
                parse_tect_region_dict_to_tuples(
                    self.data['tectonic_regionalisation']))
        else:
            tectonic_reg = None
        return tectonic_reg
367603
private void classifyUnknownEdges() {
        Iterator<EdgeType> edgeIter = graph.edgeIterator();
        while (edgeIter.hasNext()) {
            EdgeType edge = edgeIter.next();
            int dfsEdgeType = getDFSEdgeType(edge);
            if (dfsEdgeType == UNKNOWN_EDGE) {
                int srcDiscoveryTime = getDiscoveryTime(getSource(edge));
                int destDiscoveryTime = getDiscoveryTime(getTarget(edge));

                if (srcDiscoveryTime < destDiscoveryTime) {
                    // If the source was visited earlier than the
                    // target, it's a forward edge.
                    dfsEdgeType = FORWARD_EDGE;
                } else {
                    // If the source was visited later than the
                    // target, it's a cross edge.
                    dfsEdgeType = CROSS_EDGE;
                }

                setDFSEdgeType(edge, dfsEdgeType);
            }
        }
    }
344092
def reversed(self):
        """"""
        return Arc(self.end, self.radius, self.rotation, self.large_arc,
                   not self.sweep, self.start)
281142
function categorizeCommits(rawCommits) {

    const categorizedCommits = {};

    // create a bucket of rawCommits by type:
    // { fixes: [], upgrades: [], breaking: [] }
    rawCommits.forEach(function(commit) {

        const capType = capitalize(commit.type);

        if (!categorizedCommits.hasOwnProperty(capType)) {
            categorizedCommits[capType] = [];
        }

        categorizedCommits[capType].push(commit);
    });

    return categorizedCommits;
}
1367309
def get_ucerf_rupture(self, iloc, src_filter):
        
        trt = self.tectonic_region_type
        ridx = self.get_ridx(iloc)
        mag = self.orig.mags[iloc]
        surface_set = []
        indices = src_filter.get_indices(self, ridx, mag)
        if len(indices) == 0:
            return None
        for trace, plane in self.gen_trace_planes(ridx):
            # build simple fault surface
            for jloc in range(0, plane.shape[2]):
                top_left = Point(
                    plane[0, 0, jloc], plane[0, 1, jloc], plane[0, 2, jloc])
                top_right = Point(
                    plane[1, 0, jloc], plane[1, 1, jloc], plane[1, 2, jloc])
                bottom_right = Point(
                    plane[2, 0, jloc], plane[2, 1, jloc], plane[2, 2, jloc])
                bottom_left = Point(
                    plane[3, 0, jloc], plane[3, 1, jloc], plane[3, 2, jloc])
                try:
                    surface_set.append(
                        ImperfectPlanarSurface.from_corner_points(
                            top_left, top_right, bottom_right, bottom_left))
                except ValueError as err:
                    raise ValueError(err, trace, top_left, top_right,
                                     bottom_right, bottom_left)

        rupture = ParametricProbabilisticRupture(
            mag, self.orig.rake[iloc], trt,
            surface_set[len(surface_set) // 2].get_middle_point(),
            MultiSurface(surface_set), self.orig.rate[iloc], self.tom)

        return rupture
1356598
def get_doctypes(self, default_doctypes=DEFAULT_DOCTYPES):
        """"""
        for action, value in reversed(self.steps):
            if action == 'doctypes':
                return list(value)

        if self.type is not None:
            return [self.type.get_mapping_type_name()]

        return default_doctypes
875164
def check_fault_data(cls, fault_trace, upper_seismogenic_depth,
                         lower_seismogenic_depth, dip, mesh_spacing):
        
        if not len(fault_trace) >= 2:
            raise ValueError("the fault trace must have at least two points")
        if not fault_trace.horizontal():
            raise ValueError("the fault trace must be horizontal")
        tlats = [point.latitude for point in fault_trace.points]
        tlons = [point.longitude for point in fault_trace.points]
        if geo_utils.line_intersects_itself(tlons, tlats):
            raise ValueError("fault trace intersects itself")
        if not 0.0 < dip <= 90.0:
            raise ValueError("dip must be between 0.0 and 90.0")
        if not lower_seismogenic_depth > upper_seismogenic_depth:
            raise ValueError("lower seismogenic depth must be greater than "
                             "upper seismogenic depth")
        if not upper_seismogenic_depth >= fault_trace[0].depth:
            raise ValueError("upper seismogenic depth must be greater than "
                             "or equal to depth of fault trace")
        if not mesh_spacing > 0.0:
            raise ValueError("mesh spacing must be positive")