Returns string containing the orientation and script detection (OSD)
167554
def image_to_osd(image,
                 lang='osd',
                 config='',
                 nice=0,
                 output_type=Output.STRING):
    '''
    
    '''
    config = '{}-psm 0 {}'.format(
        '' if get_tesseract_version() < '3.05' else '-',
        config.strip()
    ).strip()
    args = [image, 'osd', lang, config, nice]

    return {
        Output.BYTES: lambda: run_and_get_output(*(args + [True])),
        Output.DICT: lambda: osd_to_dict(run_and_get_output(*args)),
        Output.STRING: lambda: run_and_get_output(*args),
    }[output_type]()
847229
def get_osid_sourceable_mdata():
    """"""
    return {
        'provider': {
            'element_label': {
                'text': 'provider',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
        'branding': {
            'element_label': {
                'text': 'branding',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': True,
            'default_id_values': [],
            'syntax': 'ID',
            'id_set': [],
        },
        'license': {
            'element_label': {
                'text': 'License',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'Optional',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_string_values': [{
                'text': '',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            }],
            'syntax': 'STRING',
            'minimum_string_length': 0,
            'maximum_string_length': None,
            'string_set': []
        }
    }
325556
def str_def(self):
        
        return "classname={!r}; operation_timeout={!r}; message={!r};". \
            format(self.__class__.__name__, self.operation_timeout,
                   self.args[0])
609062
protected static String getOrientation(Context ctx) {
        try {
            String o;
            switch (ctx.getResources().getConfiguration().orientation) {
                case android.content.res.Configuration.ORIENTATION_LANDSCAPE:
                    o = "landscape";
                    break;
                case android.content.res.Configuration.ORIENTATION_PORTRAIT:
                    o = "portrait";
                    break;
                default:
                    o = null;
                    break;
            }
            return o;
        } catch (Exception e) {
            Log.e(TAG, "Error getting device orientation.", e);
            return null;
        }
    }
886432
def get_executable_info
      if not (@servers.empty? )
        if (@script != nil)
          # If script is an uri/url no need to "detect it"
          # https://my.rightscale.com/acct/9202/right_scripts/205347
          if @script =~ /\A#{URI::regexp}\z/
            if not @use_chimpd || !@prompt
              puts "=================================================="
              puts "WARNING! You will be running this script on all "
              puts "server matches! (Press enter to continue)"
              puts "=================================================="
              gets
            end

            script_number = File.basename(@script)

            s = Executable.new
            s.delay = @delay

            s.params['right_script']['href']="right_script_href=/api/right_scripts/"+script_number
            #Make an 1.5 call to extract name, by loading resource.
            Log.debug "[#{Chimp.get_job_uuid}] Making API 1.5 call : client.resource(#{s.params['right_script']['href'].scan(/=(.*)/).last.last})"
            begin
              tries ||= 3
              the_name = Connection.client.resource(s.params['right_script']['href'].scan(/=(.*)/).last.last).name
            rescue
              Log.error "[#{Chimp.get_job_uuid}] Failed to make 1.5 call for rightscript href (retrying)"
              sleep 30
              retry unless (tries -= 1).zero?
              Log.error "[#{Chimp.get_job_uuid}] Failed to make 1.5 call for rightscript href (giving up)"
            end
            s.params['right_script']['name'] = the_name
            @executable = s
          else
            # If its not an url, go ahead try to locate it in the ST"
            @executable = detect_right_script(@server_template, @script)
          end
        else
          # @script could be nil because we want to run ssh
          if @action == :action_ssh
            puts "Using SSH command: \"#{@ssh}\"" if @action == :action_ssh
          end
        end
      end
    end
715899
def get_authentication_mdata():
    """"""
    return {
        'agent': {
            'element_label': {
                'text': 'agent',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
    }
526732
function orientationToRotation (orientation) {
        // VideoRotation enumerable and BitmapRotation enumerable have the same values
        // https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.videorotation.aspx
        // https://msdn.microsoft.com/en-us/library/windows/apps/windows.graphics.imaging.bitmaprotation.aspx

        switch (orientation) {
        // portrait
        case Windows.Devices.Sensors.SimpleOrientation.notRotated:
            return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
        // landscape
        case Windows.Devices.Sensors.SimpleOrientation.rotated90DegreesCounterclockwise:
            return Windows.Media.Capture.VideoRotation.none;
        // portrait-flipped (not supported by WinPhone Apps)
        case Windows.Devices.Sensors.SimpleOrientation.rotated180DegreesCounterclockwise:
            // Falling back to portrait default
            return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
        // landscape-flipped
        case Windows.Devices.Sensors.SimpleOrientation.rotated270DegreesCounterclockwise:
            return Windows.Media.Capture.VideoRotation.clockwise180Degrees;
        // faceup & facedown
        default:
            // Falling back to portrait default
            return Windows.Media.Capture.VideoRotation.clockwise90Degrees;
        }
    }
820318
function getScriptInfo() {
    var bases = [ document.location.protocol + "//" + document.location.host ],
        scripts, src, rootUrl, baseMatch;
    if (typeof window.__vogue__ === "undefined") {
      scripts = document.getElementsByTagName("script");
      for (var i=0; i < scripts.length; i++) {
        src = scripts[i].getAttribute("src");
        if (src && src.slice(-15) === 'vogue-client.js') break;
      }
      rootUrl = src.match(/^https?\:\/\/(.*?)\//)[0];
      // There is an optional base argument, that can be used.
      baseMatch = src.match(/\bbase=(.*)(&|$)/);

      if (baseMatch) {
        bases = bases.concat(baseMatch[1].split(","));
      }
      return {
        rootUrl: rootUrl,
        bases: bases
      };
    } else {
      window.__vogue__.bases = bases;
      return window.__vogue__;
    }
  }
776865
public static function os() : String
    {
        if( stristr(PHP_OS, 'WIN') )
        {
            return 'WIN';
        }
        elseif( stristr(PHP_OS, 'MAC') )
        {
            return 'MAC';
        }
        elseif( stristr(PHP_OS, 'LINUX') )
        {
            return 'LINUX';
        }
        elseif( stristr(PHP_OS, 'UNIX') )
        {
            return 'UNIX';
        }
        else
        {
            return 'UNKNOWN';
        }
    }
1156932
public int getYOrigin (int orient, int frameIdx)
    {
        CompositedMultiFrameImage cmfi = (CompositedMultiFrameImage)
            getFrames(orient);
        return cmfi.getYOrigin(frameIdx);
    }
902836
def guess_fileformat(aUri):
    
    if aUri.endswith(".xml"):
        return "xml"
    elif aUri.endswith(".nt"):
        return "nt"
    elif aUri.endswith(".n3") or aUri.endswith(".ttl"):
        return "n3"
    elif aUri.endswith(".trix"):
        return "trix"
    elif aUri.endswith(".rdfa"):
        return "rdfa"
    else:  # to be handled outside this method
        return None
966931
function parseFormatDescriptor(formatStr, pos) {

    var fd = {};    // return object

    if (typeof formatStr !== 'string' || pos >= formatStr.length)
        return fd;

    // check argument sanity
    if (typeof pos !== 'number' || typeof formatStr !== 'string' || formatStr.length <= pos)
        return fd;

    if (formatStr[pos] !== '%') return fd;
    fd.startPos = pos;      // startPos is the character position where the '%' is
    if (++pos >= formatStr.length) return fd;   // skip the '%'

    // get the flags
    // Flag    Meaning
    // -       The output is left justified in its field, not right justified (the default).
    // +       Signed numbers will always be printed with a leading sign (+ or -).
    // space   Positive numbers are preceded by a space (negative numbers by a - sign).
    // 0       For numeric conversions, pad with leading zeros to the field width.
    // #       An alternative output form. For o, the first digit will be '0'. For x or X,
    //          "0x" or "0X" will be prefixed to a non-zero result. For e, E, f, F, g and G,
    //          the output will always have a decimal point; for g and G, trailing zeros will
    //          not be removed.
    fd.flags = {};
    fd.flags.leftJustified = false;
    fd.flags.forceSign = false;
    fd.flags.showNegSign = false;
    fd.flags.leadingZeros = false;
    fd.flags.altNumeric = false;

    while (pos < formatStr.length && (formatStr[pos] === '-' || formatStr[pos] === '+' ||
             formatStr[pos] === ' ' || formatStr[pos] === '0' || formatStr[pos] === '#')) {
        switch (formatStr[pos]) {
        case '-':
            fd.flags.leftJustified = true;
            break;
        case '+':
            fd.flags.forceSign = true;
            break;
        case ' ':
            fd.flags.showNegSign = true;
            break;
        case '0':
            fd.flags.leadingZeros = true;
            break;
        case '#':
            fd.flags.altNumeric = true;
            break;
        }
        pos++;
    }

    if (pos >= formatStr.length) return fd;

    // get the field width
    // The converted argument will be printed in a field at least this wide, and wider if
    // necessary. If the converted argument has fewer characters than the field width, it
    // will be padded on the left (or right, if left adjustment has been requested) to make
    // up the field width. The padding character is normally ' ' (space), but is '0' if the
    // zero padding flag (0) is present.
    //
    // If the field width is specified as *, the value is computed from the next argument,
    // which must be an int.
    if (formatStr[pos] === '*') {
        fd.fieldWidth = '*';
        pos++;
    } else if (formatStr[pos] >= '0' && formatStr[pos] <= '9') {
        fd.fieldWidth = formatStr[pos++];
        while (pos <= formatStr.length && formatStr[pos] >= '0' && formatStr[pos] <= '9')
            fd.fieldWidth += formatStr[pos++];
        fd.fieldWidth = parseInt(fd.fieldWidth, 10);
    }

    if (pos >= formatStr.length) return fd;

    // get the percision
    // A dot '.' separates the field width from the precision.
    // If the precision is specified as *, the value is computed from the next argument, which must be an int.
    if (formatStr[pos] === '.') {
        if (++pos >= formatStr.length) return fd;

        if (formatStr[pos] === '*') {
            fd.precision = '*';
            pos++;
        } else if (formatStr[pos] >= '0' && formatStr[pos] <= '9') {
            fd.precision = formatStr[pos++];
            while (pos <= formatStr.length && formatStr[pos] >= '0' && formatStr[pos] <= '9')
                fd.precision += formatStr[pos++];
            fd.precision = parseInt(fd.precision, 10);
        }
    }

    if (pos >= formatStr.length) return fd;

    // Get the lenth modifier
    // Char Meaning
    // h    The value is to be displayed as a short or unsigned short.
    // l    For d, i, o, u, x or X conversions: the argument is a long, not an int.
    // L    For e, f, g or G conversions: the argument is a long double.
    // NOTE: We handle a length modifier, if present but don't do anything with it
    if (formatStr[pos] === 'h' || formatStr[pos] === 'l' || formatStr[pos] === 'L')
        pos++;

    if (pos >= formatStr.length) return fd;

    // get the conversion character
    // Conversion   Meaning
    // s    The maximum number of characters to be printed from the string.
    // e, E, f  The number of digits to be printed after the decimal point.
    // g, G The number of significant digits.
    // d, i, o, u, x, X The minimum number of digits to be printed. Leading
    //    zeros will be added to make up the field width.
    if (isConversionChar(formatStr[pos]))
        fd.conversion = formatStr[pos++];
    else
        fd.conversion = false;

    fd.endPos = pos;
    return fd;
}
309526
def _get_destination(script_parts):
    """"""
    for part in script_parts:
        if part not in {'ln', '-s', '--symbolic'} and os.path.exists(part):
            return part
1064915
def get_tl(self):
        """"""

        cell_above_left = CellBorders(self.cell_attributes,
                                      *self.cell.get_above_left_key_rect())
        return cell_above_left.get_r()
744644
function getViewString(view, strLen, byteOffset) {

    var str = '';
    for (var j = 0; j < strLen; ++j) {
        var c = view.getUint8(byteOffset + j);
        str += String.fromCharCode(c);
    }

    return str;
}
237418
def detect_format(program, attributes) -> str:
    '''
        
    '''

    def fmt(attr):
        '''
            For internal use only.
        '''

        return attr.array_length * attr.dimension, attr.shape

    return ' '.join('%d%s' % fmt(program[a]) for a in attributes)
634265
def get_string_index_oid(self, s):
        """"""
        return (len(self.get_bytes(s)), ) + self.get_bytes(s)