コード例 #1
0
def delete_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.delete(
        url,
        headers=context.headers,
        auth=context.auth
    )
コード例 #2
0
ファイル: actions.py プロジェクト: tjacek/conv_frames
def read_action(action_path):
    action_name=get_action_name(action_path)
    category=get_category(action_name)
    person=get_person(action_name)
    all_files=utils.get_files(action_path)
    all_files=utils.append_path(action_path+"/",all_files)
    frames=utils.read_images(all_files)
    return Action(category,person,frames)
コード例 #3
0
ファイル: deep_frames.py プロジェクト: tjacek/deep_frames
def get_actions(action_dir,nn_path,cls_path):
    action_files=utils.get_all_dirs(action_dir)
    action_files=utils.append_path(action_dir,action_files)
    reduction=AutoEncoderReduction(nn_path)
    cls=Clusters(cls_path)
    def curried(action_path):
        return get_deep_frames(action_path,reduction,cls)
    return map(curried,action_files)
コード例 #4
0
def get_image_with_bbox(attrs):
    images = parse_file(config.get('deepfashion', 'attributes_file'),
                        val_type=int, key_item_id=None, validate_fields=False)
    attrs = parse_attr(attrs, _PREDEFINED_ATTR)
    filtered = filter_items(images, attrs)

    image_files = append_path(config.get('deepfashion', 'image_dir'), filtered, key='image_name')
    boxes = bbox(filtered)

    return image_files, boxes
コード例 #5
0
def step_impl(context, timeinseconds):
    # This can be used if no WAIT-blocking is available
    jobId = context.job.get_jobId()
    url = append_path(context.server, jobId + "/phase")

    phase = None
    status_code = 200
    final_phases = ["ABORTED", "COMPLETED", "ERROR", "ARCHIVED"]
    while phase not in final_phases and status_code == 200:
        time.sleep(int(timeinseconds))

        response = requests.get(url, headers=context.headers, auth=context.auth)
        phase = response.text
        status_code = response.status_code

    if status_code != 200:
        raise NotImplementedError("Got status_code %d while waiting for final state." % (status_code))

    # make one final request to get all the job details
    url = append_path(context.server, jobId)
    context.response = requests.get(url, headers=context.headers, auth=context.auth)
コード例 #6
0
def step_impl(context, timeinseconds):
    # This can be used if no WAIT-blocking is available
    jobId = context.job.get_jobId()
    url = append_path(context.server, jobId + "/phase")

    phase = "PENDING"
    status_code = 200
    pre_starting_phase = ["PENDING", "QUEUED", "HELD", "SUSPENDED"]
    while phase in pre_starting_phase and status_code == 200:
        time.sleep(int(timeinseconds))

        response = requests.get(url, headers=context.headers, auth=context.auth)
        phase = response.text
        status_code = response.status_code

    if status_code != 200:
        raise NotImplementedError("Got status_code %d while waiting for job execution." % (status_code))

    # make one final request to get all the job details
    url = append_path(context.server, jobId)
    context.response = requests.get(url, headers=context.headers, auth=context.auth)
コード例 #7
0
def step_impl(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    print("      GET request to: ", url)
    if context.auth != (u'', u''):
        print("      with authentication details: ", context.auth)

#    if not url_path_segment.startswith('?'):
    # raise NotImplementedError("url: %r" % url)
    context.response = requests.get(
        url,
        headers=context.headers,
        auth=context.auth
    )
コード例 #8
0
    async def get_sensitive_urls(self, paths, valid_status_codes=None):
        session = self.get_http_session()
        results = {}

        async with trio.open_nursery() as nursery:
            for path, description in paths.items():
                for domain, _ in self.iter_domains():
                    nursery.start_soon(
                        self.probe_url, session,
                        utils.append_path(f"http://{domain}", path),
                        description, valid_status_codes[domain]
                        if valid_status_codes else None, results)

        return results
コード例 #9
0
ファイル: dim_reduction.py プロジェクト: tjacek/deep_frames
def load_data(path,batch_size=25):
    all_files=utils.get_all_files(path)
    all_files=utils.append_path(path,all_files)
    images=utils.read_images(all_files)
    images=utils.flatten_images(images)
    images=map(utils.normalize,images)
    images=np.array(images)
    n_batches=get_number_of_batches(batch_size,len(images))
    def get_batch(i):
        return images[i * batch_size: (i+1) * batch_size]
    batches=map(get_batch,range(n_batches))
    batches = [np.array(batch) for batch in batches]
    print("Dataset loaded")
    return np.array(batches)
コード例 #10
0
def step_impl(context, url_path_segment):

    # convert given table-data to dictionary
    datadict = get_dict_from_paramtable(context.table)

    url = append_path(context.server, url_path_segment)

    print("      POST request to URL: ", url)
    if context.auth != (u'', u''):
        print("      with authentication details: ", context.auth)

    context.response = requests.post(
        url,
        data=datadict,
        headers=context.headers,
        auth=context.auth
    )
コード例 #11
0
ファイル: actions.py プロジェクト: tjacek/autoencoder_frames
def read_action_frame(dir_path):
    actions_paths=utils.get_dirs(dir_path)
    actions_paths=utils.append_path(dir_path, actions_paths)
    actions=[read_action(path) for path in actions_paths]
    return create_action_frame(actions)
コード例 #12
0
ファイル: celeba.py プロジェクト: devkook/ChangeGAN
def get_image_files(attrs):
    images = parse_file(config.get('celeba', 'attributes_file'))
    attrs = parse_attr(attrs, _PREDEFINED_ATTR)
    filtered = filter_items(images, attrs)
    return append_path(config.get('celeba', 'image_dir'), filtered)
コード例 #13
0
ファイル: conv_frames.py プロジェクト: tjacek/conv_frames
def get_actions(action_dir,cls):
    action_files=utils.get_dirs(action_dir)
    action_files=utils.append_path(action_dir,action_files)
    return [compute_sequence(path,cls) for path in action_files]