GET /screenshots/diffs
5704
def diffs
      params[:sort] ||= "image_file_size desc"
      @diffs = UiChanged::Screenshot.search(params[:search]).not_in_ignored.where(:diff_found => true).paginate(:page => params[:page],
                                                                                  :per_page => params[:per_page],
                                                                                  :order => params[:sort])
      @all_screenshots = []
      @diffs.each do |diff|
        control = UiChanged::Screenshot.find(diff.control_id)
        test = UiChanged::Screenshot.find(diff.test_id)
        @all_screenshots << UiChanged::AllScreenshot.new(control, test, diff)
      end
    end
1053112
def screenshot(self, filename=None):
        '''
        
        '''
        image = self.d.screenshot()
        if self.rotation:
            method = getattr(Image, 'ROTATE_{}'.format(self.rotation*90))
            image = image.transpose(method)
        if filename:
            image.save(filename)
        return image
885376
def _get_diff(self):
        """"""
        diff = []
        self._create_sot_file()
        command = ('show diff rollback-patch file {0} file {1}'.format(
                   'sot_file', self.replace_file.split('/')[-1]))
        diff_out = self.device.send_command(command)
        try:
            diff_out = diff_out.split(
                '#Generating Rollback Patch')[1].replace(
                    'Rollback Patch is Empty', '').strip()
            for line in diff_out.splitlines():
                if line:
                    if line[0].strip() != '!' and line[0].strip() != '.':
                        diff.append(line.rstrip(' '))
        except (AttributeError, KeyError):
            raise ReplaceConfigException(
                'Could not calculate diff. It\'s possible the given file doesn\'t exist.')
        return '\n'.join(diff)
65421
function prettifyDiffOutput(diffArr) {
    const res = [];
    for (const diff of diffArr) {
        res.push(prettifyDiffObj(diff));
    }
    return res;
}
755187
def add_screenshot(self, screenshot):
        
        if screenshot in self.screenshots:
            return
        self.screenshots.append(screenshot)
151711
def screenshot(self, filename, scale=1.0, quality=100):
        ''''''
        result = self.server.screenshot(filename, scale, quality)
        if result:
            return result

        device_file = self.server.jsonrpc.takeScreenshot("screenshot.png",
                                                         scale, quality)
        if not device_file:
            return None
        p = self.server.adb.cmd("pull", device_file, filename)
        p.wait()
        self.server.adb.cmd("shell", "rm", device_file).wait()
        return filename if p.returncode is 0 else None
940543
def diff(**kwargs):
    '''
    
    '''
    kwargs = salt.utils.args.clean_kwargs(**kwargs)
    id_ = kwargs.pop('id', 0)
    if kwargs:
        salt.utils.args.invalid_kwargs(kwargs)

    conn = __proxy__['junos.conn']()
    ret = {}
    ret['out'] = True
    try:
        ret['message'] = conn.cu.diff(rb_id=id_)
    except Exception as exception:
        ret['message'] = 'Could not get diff with error "{0}"'.format(
            exception)
        ret['out'] = False

    return ret
802995
def check(self, diff):
        """"""
        path = pathlib.Path(diff.b_path)
        filename = path.parts[-1]
        if filename == '__init__.py':
            abspath = self.project.path.joinpath(path)
            assert isemptyfile(abspath)
1090331
public function getImages()
    {
        $images = array();
        $image = $this->getImage();
        if (!empty($image)) {
            $images[$image] = $image;
        }

        $screenshotsPath = $this->getFilePath().self::SCREENSHOT_PATH;
        $files = array();
        if (is_dir($screenshotsPath)) {
            $files = scandir($screenshotsPath);
        }

        foreach ($files as $file) {
            $ext = pathinfo($file, PATHINFO_EXTENSION);
            if ($ext === 'gif' || $ext === 'jpg' || $ext === 'png') {
                $images['/theme/images/screenshots/'.$file] = '/theme/images/screenshots/'.$file;
            }
        }


        return $images;
    }
683154
public function getDeleteDiff()
    {
        return array_udiff_assoc(
            $this->snapshot,
            $this->collection->toArray(),
            function($a, $b) { return $a === $b ? 0 : 1; }
        );
    }
456142
def screenshot(self, scale=None, quality=None):
        
        output_dir = BuiltIn().get_variable_value('${OUTPUTDIR}')
        ts = time.time()
        st = datetime.datetime.fromtimestamp(ts).strftime('%Y%m%d%H%M%S')
        screenshot_path = '%s%s%s.png' % (output_dir, os.sep, st)
        self.device.screenshot(screenshot_path, scale, quality)
        logger.info('\n<a href="%s">%s</a><br><img src="%s">' % (screenshot_path, st, screenshot_path), html=True)
1305902
def diff(local_path, remote_path):
    """"""
    with hide('commands'):
        if isinstance(local_path, basestring):
            with open(local_path) as stream:
                local_content = stream.read()
        else:
            pos = local_path.tell()
            local_content = local_path.read()
            local_path.seek(pos)
        remote_content = StringIO()
        with settings(hide('warnings'), warn_only=True):
            if get(remote_path, remote_content).failed:
                return True
        return local_content.strip() != remote_content.getvalue().strip()
239157
def get_modified_files():
    """"""
    c = subprocess.Popen(
        ["git", "diff-index", "--cached", "--name-only", "HEAD"], stdout=subprocess.PIPE
    )
    return c.communicate()[0].splitlines()
854110
def fetch_all_snapshots(self):
        
        """
        api = self.doapi_manager
        for obj in api.paginate(self.url + '/snapshots', 'snapshots'):
            yield Image(obj, doapi_manager=api)
632565
function (diffX, diffY) {
        if (diffX === 0 && diffY === -1) return EasyStar.TOP
        else if (diffX === 1 && diffY === -1) return EasyStar.TOP_RIGHT
        else if (diffX === 1 && diffY === 0) return EasyStar.RIGHT
        else if (diffX === 1 && diffY === 1) return EasyStar.BOTTOM_RIGHT
        else if (diffX === 0 && diffY === 1) return EasyStar.BOTTOM
        else if (diffX === -1 && diffY === 1) return EasyStar.BOTTOM_LEFT
        else if (diffX === -1 && diffY === 0) return EasyStar.LEFT
        else if (diffX === -1 && diffY === -1) return EasyStar.TOP_LEFT
        throw new Error('These differences are not valid: ' + diffX + ', ' + diffY)
    }
1253788
def photos(self):
        """"""
        # Reverse because pictures appear in inverse chronological order.
        for photo_info in self.dest_user.profile.photo_infos:
            self.dest_user.photo.delete(photo_info)
        return [self.dest_user.photo.upload_and_confirm(info)
                for info in reversed(self.source_profile.photo_infos)]
134365
def diff_files(left, right, diff_options=None, formatter=None):
    """"""
    return _diff(etree.parse, left, right,
                 diff_options=diff_options, formatter=formatter)