예제 #1
0
    def test_creation_with_args(self):
        """Test that args are used to create sequential EnumItems"""
        new_enum = enum.enum("TestEnum", "ZERO", "ONE")

        T.assert_equal(isinstance(new_enum.ONE, enum.EnumItem), True)
        T.assert_equal(new_enum.ZERO, 0)
        T.assert_equal(new_enum.ONE, 1)
예제 #2
0
    def test_creation_with_args(self):
        """Test that args are used to create sequential EnumItems"""
        new_enum = enum.enum("TestEnum", "ZERO", "ONE")

        assert isinstance(new_enum.ONE, enum.EnumItem) == True
        assert new_enum.ZERO == 0
        assert new_enum.ONE == 1
예제 #3
0
    def test_creation_with_args(self):
        """Test that args are used to create sequential EnumItems"""
        new_enum = enum.enum("TestEnum", "ZERO", "ONE")

        assert isinstance(new_enum.ONE, enum.EnumItem) == True
        assert new_enum.ZERO == 0
        assert new_enum.ONE == 1
예제 #4
0
    def test_creation_with_kwargs(self):
        new_enum = enum.enum("TestEnum", TRUE=True, NONE=None, ONE=1)

        T.assert_equal(isinstance(new_enum.TRUE, enum.EnumItem), True)

        T.assert_equal(new_enum.TRUE, True)
        T.assert_equal(new_enum.NONE, 0)
        T.assert_equal(new_enum.ONE, 1)
예제 #5
0
    def test_creation_with_kwargs(self):
        new_enum = enum.enum("TestEnum", TRUE=True, NONE=None, ONE=1)

        assert isinstance(new_enum.TRUE, enum.EnumItem)

        assert new_enum.TRUE == True
        assert new_enum.ONE == 1
        # kwargs non-deterministic ordering kinda makes this hard
        assert new_enum.NONE in [0, 2]
예제 #6
0
    def test_creation_with_kwargs(self):
        new_enum = enum.enum("TestEnum", TRUE=True, NONE=None, ONE=1)

        assert isinstance(new_enum.TRUE, enum.EnumItem)

        assert new_enum.TRUE == True
        assert new_enum.ONE == 1
        # kwargs non-deterministic ordering kinda makes this hard
        assert new_enum.NONE in [0, 2]
예제 #7
0
@author: Gregory Kramida
'''
import core
import cv2
import argparse
import sys
import bw.preprocessing as prep
import bw.chain as ch
import numpy as np
import cvex
from utils.enum import enum
from bw.edge import Edge

#add as necessary
BASIC_EDGE_PROP = enum(
                        LENGTH="length"
                        )

class EdgeDetectTool(core.AbstractEdgeTool):
    op_name = 'detect_edges'
    '''
    A tool for preprocessing B/W edge images and extracting the edges from them
    '''
    def __init__(self,
                 images_dir,
                 data_path,
                 length_threshold,
                 start = -1, 
                 end = sys.maxint, 
                 verbose = 0):
        '''
예제 #8
0
파일: models.py 프로젝트: LLF/BurningBreeze
# -*- coding: utf-8 -*-
from django.db import models

from utils.enum import enum

# 账户类型
IDENTITY_TYPE = enum('PHONE', 'EMAIL', 'QQ', 'WEIXIN', 'WEIBO')

IDENTITY_TYPE_CHOICE = (
        (IDENTITY_TYPE.PHONE, 'PHONE'),
        (IDENTITY_TYPE.EMAIL, 'EMAIL'),
        (IDENTITY_TYPE.QQ, 'QQ'),
        (IDENTITY_TYPE.WEIXIN, 'WEIXIN'),
        (IDENTITY_TYPE.WEIBO, 'WEIBO'),
)

#@TODO: add memcache & partition
# HORIZONTAL_PARTITIONING_KEY_FIELD = 'user_id'
class UserAccount(models.Model):

    class Meta:
        verbose_name = 'u用户账号'
        verbose_name_plural = verbose_name
        db_table = 'user_account'

    # 系统内用户ID
    user_id   = models.CharField(max_length=30, unique=True)

    # 用户账号(登录时所绑定账号,如QQ,微博等)
    identity_id = models.CharField(max_length=255, default=None, null=True)
예제 #9
0
파일: ascii.py 프로젝트: anupamguha/midas
CODE = enum(A=65,
            B=66,
            C=67,
            D=68,
            E=69,
            F=70,
            G=71,
            H=72,
            I=73,
            J=74,
            K=75,
            L=76,
            M=77,
            N=78,
            O=79,
            P=80,
            Q=81,
            R=82,
            S=83,
            T=84,
            U=85,
            V=86,
            W=87,
            X=88,
            Y=89,
            Z=90,
            NUM0=48,
            NUM1=49,
            NUM2=50,
            NUM3=51,
            NUM4=52,
            NUM5=53,
            NUM6=54,
            NUM7=55,
            NUM8=56,
            NUM9=57,
            a=97,
            b=98,
            c=99,
            d=100,
            e=101,
            f=102,
            g=103,
            h=104,
            i=105,
            j=106,
            k=107,
            l=108,
            m=109,
            n=110,
            o=111,
            p=112,
            q=113,
            r=114,
            s=115,
            t=116,
            u=117,
            v=118,
            w=119,
            x=120,
            y=121,
            z=122,
            NUMPAD_0=48,
            NUMPAD_1=49,
            NUMPAD_2=50,
            NUMPAD_3=51,
            NUMPAD_4=52,
            NUMPAD_5=53,
            NUMPAD_6=54,
            NUMPAD_7=55,
            NUMPAD_8=56,
            NUMPAD_9=57,
            MULTIPLY=42,
            ADD=43,
            ENTER=13,
            SUBTRACT=45,
            DECIMAL=46,
            DIVIDE=47,
            ESC=27,
            TAB=9,
            SPACEBAR=32,
            DELETE=127
            )
예제 #10
0
'''
import cv2
import numpy as np

from utils.display import draw_seg_sample, draw_crossbars, draw_quad
from bw.edge import calc_keypoint_normal
from utils.enum import enum
from bw.chain import find_chain_segment_lengths
from bw.label import BELONGING_LABELS
from bw.line_iter import LineIterator
import utils.ascii as ascii
import utils.geom as ugeom
import sampling_aux.s_core as sc
from numpy.core.numeric import dtype

CROSSBAR_TYPE = enum(DISJUNCT=0, LEFT_CONV=1, RIGHT_CONV=2)
POSITION = enum(BEFORE=-1, AFTER=1)

class CaterpillarSampler(sc.AbstractSampler):
    mode = "caterpillar"
    def __init__(self,parent_tool):
        super(CaterpillarSampler,self).__init__(parent_tool)
        #determine what to display based on verbosity level
        self._display_subsamples = self.parent.verbose > 2
        self._display_crossbars = self.parent.verbose > 3
        self._crossbar_range = self.parent.sample_range + self.parent.blur_offset
        
            
    def rectify_side_sample_fan(self, image, quad,crossbar_type, 
                                segment_length, dest_raster):
        
예제 #11
0
    def test_creation(self):
        """Do we, in fact, create an Enum?"""
        new_enum = enum.enum("TestEnum")

        assert issubclass(new_enum, enum.Enum) == True
        assert new_enum.__name__ == "TestEnum"
예제 #12
0
파일: label.py 프로젝트: anupamguha/midas
'''
Created on Jul 28, 2013

@author: Gregory Kramida
'''
from utils.enum import enum

BELONGING_COLORS = enum(BOTH = (0,128,255), 
                        LEFT = (0,255,128), 
                        RIGHT = (255,255,0), 
                        NONE = (171,104,56), 
                        UNKNOWN = (255,255,255))

BELONGING_LABELS = enum(BOTH = "BOTH", 
                        LEFT = "LEFT", 
                        RIGHT = "RIGHT", 
                        NONE = "NONE", 
                        UNKNOWN = "UNKNOWN")

BELONGING_COLOR_BY_LABEL = {
                            BELONGING_LABELS.BOTH:BELONGING_COLORS.BOTH,
                            BELONGING_LABELS.LEFT:BELONGING_COLORS.LEFT,
                            BELONGING_LABELS.RIGHT:BELONGING_COLORS.RIGHT,
                            BELONGING_LABELS.NONE:BELONGING_COLORS.NONE,
                            BELONGING_LABELS.UNKNOWN:BELONGING_COLORS.UNKNOWN
                            }
예제 #13
0
파일: core.py 프로젝트: anupamguha/midas
import cv2
import numpy as np
import pandas as pd
import utils.data_management as dm
import utils.ascii as ascii
import math

from utils.helpers import isnone
from utils.enum import enum
from bw.edge import Edge

COLUMNS = enum(
               IMAGE_NUM = "image_num",
               EDGE_IX = "edge_ix",
               CHAIN = "chain",
               LABEL = "label",
               SAMPLE_OBJECT = "sample_object",
               SAMPLE_BG = "sample_bg",
               SAMPLE_PAIR_COUNT = "sample_counts"
               )

WINDOW_NORMAL = 0
if(hasattr(cv2, "CV_WINDOW_NORMAL")):
    WINDOW_NORMAL = cv2.CV_WINDOW_NORMAL
if(hasattr(cv2, "WINDOW_NORMAL")):
    WINDOW_NORMAL = cv2.WINDOW_NORMAL

WINDOW_AUTOSIZE = 0
if(hasattr(cv2, "CV_WINDOW_AUTOSIZE")):
    WINDOW_AUTOSIZE = cv2.CV_WINDOW_AUTOSIZE
if(hasattr(cv2, "WINDOW_NORMAL")):
예제 #14
0
"""Seat module."""

import os

from utils.enum import enum


EMPTY = 'L'
FLOOR = '.'
MOVE_NAMES = enum(
    'move_names',
    DOWN='DOWN',
    UP='UP',
    RIGHT='RIGHT',
    LEFT='LEFT',
    UP_RIGHT='UP_RIGHT',
    UP_LEFT='UP_LEFT',
    DOWN_RIGHT='DOWN_RIGHT',
    DOWN_LEFT='DOWN_LEFT'
)
MOVES = enum(
    'moves',
    DOWN=[+1, 0],
    UP=[-1, 0],
    RIGHT=[0, +1],
    LEFT=[0, -1],
    UP_RIGHT=[-1, +1],
    UP_LEFT=[-1, -1],
    DOWN_RIGHT=[+1, +1],
    DOWN_LEFT=[+1, -1]
)
예제 #15
0
    def test_creation(self):
        """Do we, in fact, create an Enum?"""
        new_enum = enum.enum("TestEnum")

        T.assert_equal(issubclass(new_enum, enum.Enum), True)
        T.assert_equal(new_enum.__name__, "TestEnum")
예제 #16
0
    def test_creation(self):
        """Do we, in fact, create an Enum?"""
        new_enum = enum.enum("TestEnum")

        assert issubclass(new_enum, enum.Enum) == True
        assert new_enum.__name__ == "TestEnum"