Get all supported OS/browser combinations JSON response
976555
def get_os_and_browsers(self):
        
        resp = self.session.get(os.path.join(self.api_url, 'browsers.json'))
        resp = self._process_response(resp)
        return resp.json()
45396
function() {
      var os
      var clientStrings = [
        {
          s:'Windows',
          r:/(Windows)/,
        }, {
          s:'Android',
          r:/Android/,
        }, {
          s:'Open BSD',
          r:/OpenBSD/,
        }, {
          s:'Linux',
          r:/(Linux|X11)/,
        }, {
          s:'iOS',
          r:/(iPhone|iPad|iPod)/,
        }, {
          s:'Mac',
          r:/Mac/,
        }, {
          s:'UNIX',
          r:/UNIX/,
        }, {
          s:'Robot',
          r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/,
        },
      ]

      for (var i = 0; i < clientStrings.length; i++) {
        var cs = clientStrings[i]
        if (cs.r.test(navigator.userAgent)) {
          return cs.s
        }
      }
    }
785089
def getConfig(option, serverEndpoint=ServerEndpoint, verbose=Verbose, tikaServerJar=TikaServerJar, responseMimeType='application/json',
              services={'mime-types': '/mime-types', 'detectors': '/detectors', 'parsers': '/parsers/details'}):
    '''
    
    '''
    if option not in services:
        die('config option must be one of mime-types, detectors, or parsers')
    service = services[option]
    status, response = callServer('get', serverEndpoint, service, None, {'Accept': responseMimeType}, verbose, tikaServerJar)
    return (status, response)
595379
def as_json(opts={})
      atts = {
        'id'                => id,
        'color'             => color,
        'status'            => display_status,
        'percent_complete'  => percent_complete,
        'work_units'        => work_units.count,
        'time_taken'        => time_taken
      }
      atts['outputs'] = JSON.parse(outputs) if outputs
      atts['email']   = email               if email
      atts
    end
1294351
def fetch_tablist(self):
		""""""
		# find websocket endpoint
		try:
			response = requests.get("http://%s:%s/json" % (self.host, self.port))
		except requests.exceptions.ConnectionError:
			raise cr_exceptions.ChromeConnectFailure("Failed to fetch configuration json from browser!")

		tablist = json.loads(response.text)

		return tablist
916461
def hume_process_jsonld():
    """"""
    if request.method == 'OPTIONS':
        return {}
    response = request.body.read().decode('utf-8')
    body = json.loads(response)
    jsonld_str = body.get('jsonld')
    jsonld = json.loads(jsonld_str)
    hp = hume.process_jsonld(jsonld)
    return _stmts_from_proc(hp)
1235184
def get_json_representation(self):
        
        repres = {}
        repres['type'] = self.TYPE
        repres['parameters'] = self._parameters
        repres['icon'] = self.ICON
        repres['authors'] = self.AUTHORS
        repres['title'] = self.TITLE
        repres['category'] = self.CATEGORY
        repres['description'] = self.DESCRIPTION
        repres['documentation'] = self.DOCUMENTATION
        repres['license'] = self.LICENSE
        repres['version'] = self.VERSION
        repres['selfpath'] = self.SELFPATH
        repres['selfexec'] = self.SELFEXEC
        repres['execshell'] = self.EXECSHELL
        repres['max_number_of_workers'] = self.MAX_NUMBER_OF_WORKERS
        repres['min_number_of_workers'] = self.MIN_NUMBER_OF_WORKERS
        repres['max_memory_limit'] = self.MAX_MEMORY_LIMIT
        repres['max_cpu_limit'] = self.MAX_CPU_LIMIT 
        repres['min_memory_limit'] = self.MIN_MEMORY_LIMIT
        repres['min_cpu_limit'] = self.MIN_CPU_LIMIT 
        repres['min_gpu_limit'] = self.MIN_GPU_LIMIT
        repres['max_gpu_limit'] = self.MAX_GPU_LIMIT
        return repres
291834
def _get_capabilities_from_driver_type(driver_name):
        
        if driver_name == 'firefox':
            return DesiredCapabilities.FIREFOX.copy()
        elif driver_name == 'chrome':
            return DesiredCapabilities.CHROME.copy()
        elif driver_name == 'safari':
            return DesiredCapabilities.SAFARI.copy()
        elif driver_name == 'opera':
            return DesiredCapabilities.OPERA.copy()
        elif driver_name == 'iexplore':
            return DesiredCapabilities.INTERNETEXPLORER.copy()
        elif driver_name == 'edge':
            return DesiredCapabilities.EDGE.copy()
        elif driver_name == 'phantomjs':
            return DesiredCapabilities.PHANTOMJS.copy()
        elif driver_name in ('android', 'ios', 'iphone'):
            return {}
        raise Exception('Unknown driver {0}'.format(driver_name))
954858
function onPrepare() {
    if (IS_JSON_FORMAT) {
        return browser.getCapabilities()
            .then((capabilities) => {
                PID_INSTANCE_DATA.metadata.browser.name = PID_INSTANCE_DATA.metadata.browser.name === ''
                    ? capabilities.get('browserName').toLowerCase()
                    : PID_INSTANCE_DATA.metadata.browser.name;
                PID_INSTANCE_DATA.metadata.browser.version = (capabilities.get('version') || capabilities.get('browserVersion'))
                    || PID_INSTANCE_DATA.metadata.browser.version;
            });
    }
}
536593
def json_or_jsonp(func):
    """"""
    @wraps(func)
    def _(*args, **kwargs):
        mimetype = 'application/javascript'
        callback = request.args.get('callback', None)
        if callback is None:
            content = func(*args, **kwargs)

        else:
            content = "%s(%s)" % (callback, func(*args, **kwargs))
        return current_app.response_class(content, mimetype=mimetype)
    return _
590910
def _get_json(location):
    """"""
    location = os.path.expanduser(location)
    try:
        if os.path.isfile(location):
            with io.open(location, encoding="utf-8") as json_data:
                return json.load(json_data, object_pairs_hook=OrderedDict).get("tests")
        elif "http" in location:
            json_data = requests.get(location)
            if not json_data:
                raise Dump2PolarionException("Failed to download")
            return json.loads(json_data.text, object_pairs_hook=OrderedDict).get("tests")
        else:
            raise Dump2PolarionException("Invalid location")
    except Exception as err:
        raise Dump2PolarionException("Failed to parse JSON from {}: {}".format(location, err))
558872
function getOptions () {
  return {
    compress: ('compress' in program) ? program.compress : false,
    debug: ('debug' in program) ? program.debug : false,
    deploy: false,
    grep: ('grep' in program) ? program.grep : false,
    invert: ('invert' in program) ? program.invert : false,
    maps: ('maps' in program) ? program.maps : false,
    reload: ('reload' in program) ? program.reload : false,
    script: ('script' in program) ? program.script : false,
    serve: ('serve' in program) ? program.serve : false,
    watch: false
  };
}
677946
def get_applications(self):
        """"""
        if ('applications' not in self.data or
                'gecko' not in self.data['applications']):
            return []
        app = self.data['applications']['gecko']
        min_version = app.get('strict_min_version', u'42.0')
        max_version = app.get('strict_max_version', u'*')
        return [{u'guid': FIREFOX_GUID,
                 u'min_version': min_version,
                 u'max_version': max_version}]
1026932
def get_platform_info():
        

        try:
            system_name = platform.system()
            release_name = platform.release()
        except:
            system_name = "Unknown"
            release_name = "Unknown"

        return {
            'system': system_name,
            'release': release_name,
        }
86790
def spec_as_json
      json = {
        :name => spec.name,
        :version => spec.version,
        :manifest_version => calculate_manifest_version
      }

      json[:description] = spec.description if spec.description
      json[:icons] = spec.icons
      json[:default_locale] = spec.default_locale if spec.default_locale
      json[:browser_action] = action_as_json(spec.browser_action) if spec.browser_action
      json[:page_action] = action_as_json(spec.page_action) if spec.page_action
      json[:app] = packaged_app_as_json if spec.packaged_app
      if spec.background_page
        json[:background] = { :page => spec.background_page }
      end
      unless spec.background_scripts.empty?
        json[:background] = { :scripts => spec.background_scripts }
      end
      json[:chrome_url_overrides] = spec.overriden_pages unless spec.overriden_pages.empty?
      json[:content_scripts] = content_scripts_as_json unless spec.content_scripts.empty?
      json[:content_security_policy] = spec.content_security_policy if spec.content_security_policy
      json[:homepage_url] = spec.homepage if spec.homepage
      json[:incognito] = spec.incognito_mode if spec.incognito_mode
      json[:intents] = web_intents_as_json unless spec.web_intents.empty?
      json[:minimum_chrome_version] = spec.minimum_chrome_version if spec.minimum_chrome_version
      json[:nacl_modules] = nacl_modules_as_json unless spec.nacl_modules.empty?
      json[:offline_enabled] = spec.offline_enabled unless spec.offline_enabled.nil?
      json[:omnibox] = spec.omnibox_keyword if spec.omnibox_keyword
      json[:options_page] = spec.options_page if spec.options_page
      json[:permissions] = spec.permissions unless spec.permissions.empty?
      json[:requirements] = requirements_as_json if has_requirements?
      json[:update_url] = spec.update_url if spec.update_url
      json[:web_accessible_resources] = spec.web_accessible_resources unless spec.web_accessible_resources.empty?

      json
    end
41120
function parseOptions(options) {
    if (options.path.indexOf(HOST) !== -1) {
      // Get complete URL
      return getData(options.path);
    } else if (typeof options.value === 'undefined') {
      // Get all results
      return getAll(HOST + options.path + '/');
    } else if (typeof options.value === 'string') {
      // Get search results (paged or all)
      if (options.format === 'paged') {
        return getData(HOST + options.path + '/?search=' + options.value);
      } else {
        return getAll(HOST + options.path + '/?search=' + options.value);
      }
    } else {
      // Get results by ID (paged or single)
      if (options.format === 'paged') {
        return getData(HOST + options.path + '/?page=' + options.value);
      } else {
        return getData(HOST + options.path + '/' + options.value);
      }
    }
  }
916468
def echo_json_response(response, pretty, limit=None, ndjson=False):
    ''''''
    indent = None
    sort_keys = False
    nl = False
    if not ndjson and (pretty or (pretty is None and sys.stdout.isatty())):
        indent = 2
        sort_keys = True
        nl = True
    try:
        if ndjson and hasattr(response, 'items_iter'):
            items = response.items_iter(limit)
            for item in items:
                click.echo(json.dumps(item))
        elif not ndjson and hasattr(response, 'json_encode'):
            response.json_encode(click.get_text_stream('stdout'), limit=limit,
                                 indent=indent, sort_keys=sort_keys)
        else:
            res = response.get_raw()
            res = json.dumps(json.loads(res), indent=indent,
                             sort_keys=sort_keys)
            click.echo(res)
        if nl:
            click.echo()
    except IOError as ioe:
        # hide scary looking broken pipe stack traces
        raise click.ClickException(str(ioe))