Пример #1
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["decisionStrategy"] = is_none(self.decisionStrategy,
                                          "UNANIMOUS")
     result["name"] = self.name
     result["type"] = is_none(self.type, "role")
     result["roles"] = self.roles
     result["logic"] = is_none(self.logic, "POSITIVE")
     return result
Пример #2
0
 def from_dict(obj) -> 'ScopeRoleRepresentation':
     assert isinstance(obj, dict)
     obj = key_dict_to_camel_case(obj)
     id = obj.get("id")
     name = obj.get("name")
     containerId = obj.get("containerId")
     composite = is_none(obj.get("composite"), False)
     clientRole = is_none(obj.get("clientRole"), True)
     return ScopeRoleRepresentation(id, name, containerId, composite,
                                    clientRole)
Пример #3
0
 def from_dict(obj) -> 'PolicieRoleRepresentation':
     assert isinstance(obj, dict)
     obj = key_dict_to_camel_case(obj)
     decisionStrategy = is_none(obj.get("decisionStrategy"), "UNANIMOUS")
     name = obj.get("name")
     type = is_none(obj.get("type"), "role")
     roles = obj.get("roles")
     logic = is_none(obj.get("logic"), "POSITIVE")
     return PolicieRoleRepresentation(name, roles, type, decisionStrategy,
                                      logic)
Пример #4
0
 def from_dict(obj: dict) -> 'GroupRepresentation':
     assert isinstance(obj, dict)
     obj = key_dict_to_camel_case(obj)
     id = obj.get("id")
     name = obj.get("name")
     path = obj.get("path")
     attributes = is_none(obj.get("attributes"), {})
     realmRoles = is_none(obj.get("realmRoles"), [])
     subGroups = is_none(obj.get("subGroups"), [])
     return GroupRepresentation(id, name, path, attributes, realmRoles,
                                subGroups)
Пример #5
0
    def __init__(self, sentence_tokenizer='normal', raw_reviews_path=None):
        """
            Sentence Tokenizers: normal, punkt
        """
        self.sent_tokenize = sent_tokenize
        if sentence_tokenizer == 'normal':
            pass
        elif sentence_tokenizer == 'punkt':
            self.sent_tokenize = nltk.data.load(
                'tokenizers/punkt/english.pickle').tokenize

        self.tokenizer = utils.get_tokenizer()

        if utils.is_none(raw_reviews_path):
            self.raw_reviews = utils.get_raw_test_reviews(review='tizi')
        else:
            with open(raw_reviews_path, 'r') as fi:
                self.raw_reviews = [line.rstrip() for line in fi]

        self.data = []
        for _ in range(6):
            self.data.append([])

        self.categories = ['food', 'service', 'price', 'place']
        self.conjunctions = [
            "tetapi sayangnya", "namun", "tetapi", "walaupun", "akan tetapi",
            "sayangnya", "hanya sayang", "sayang", "meski", "walau", "but"
        ]
Пример #6
0
 def from_dict(obj) -> 'RealmRepresentation':
     assert isinstance(obj, dict)
     obj = key_dict_to_camel_case(obj)
     enabled = is_none(obj.get("enabled"), True)
     id = obj.get("id")
     realm = obj.get("realm")
     return RealmRepresentation(enabled, id, realm)
Пример #7
0
class Temperature(webapp2.RequestHandler):
    def get(self):
        request, response = self.request, self.response

        mode, qty_str, jsonp_callback = request.get('mode'), request.get(
            'q'), request.get('callback')

        try:
            qty = float(qty_str)
        except Exception, e:
            qty = None

        converted = None
        if not utils.is_none(qty):
            converted = convert_temperature(mode, qty)

        if not utils.is_none(converted):
            result = {"mode": mode, "qty": qty, "v": converted}
        else:
            result = invalid_request

        utils.write_jsonp_output(response, result, jsonp_callback)
Пример #8
0
##################
# Pipeline setup #
##################

# Read in parameter file
P.get_parameters("config_rna.yml")


# Small edits to config to enable cluster usage
P.PARAMS["cluster_queue_manager"] = P.PARAMS.get("pipeline_cluster_queue_manager")
P.PARAMS["conda_env"] = os.path.basename(os.environ["CONDA_PREFIX"])

# Make sure that params dict is typed correctly
for key in P.PARAMS:
    if is_none(P.PARAMS[key]):
        P.PARAMS[key] = None
    elif is_on(P.PARAMS):
        P.PARAMS[key] = True

# Global variables
CREATE_BIGWIGS = P.PARAMS.get("run_options_bigwigs")
CREATE_HUB = P.PARAMS.get("run_options_hub")

#############
# Pipeline  #
#############


@follows(mkdir("statistics"), mkdir("statistics/fastqc"))
@transform("*.fastq.gz", regex(r"(.*).fastq.gz"), r"statistics/fastqc/\1_fastqc.zip")
Пример #9
0
 def _set(cls, lvl, func):
     assert is_none(cls.contents.get(
         str(lvl))), "ambiguity in levels hierarchy"
     cls.contents[str(lvl)] = func