prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
while parsed_query: part = parsed_query.pop() if part in binary_operator: result = {part: {parsed_query.pop(): result}} elif part in multiple_operators: if result.get(part): result[part].append( _parsed_query2dict(parsed_query....
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
expr.parseString(query)[0] return _parsed_query2dict(parsed_query) def list2co
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
tuple([o[k] for k in cols]) for o in objs] def format_
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
", ".join(objs[field]) def format_
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
"\n".join( "- " + ", ".join("%s: %s" % (k, v) for k, v in elem.items()) for elem in objs[field]) def format_
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
j[field]: obj["%s/%s" % (field, attr)] = obj[field][attr] del obj[field] def format_
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
st(ap, "definition") format_string_list(ap, "aggregation_methods") def dict_fr
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
attr in attrs: value = getattr(parsed_args, attr) if value is not None: d[attr] = value return d def dict_to
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
n(["%s=%s" % (k, v) for k, v in objs.items() if v is not None])
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
: {parsed_query.pop(): result}} elif
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
part): result[part].append( _parsed_query2dict(parsed_query.pop())) else: result = {part: [result]} elif
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
ppend( _parsed_query2dict(parsed_query.pop())) e
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
: [result]} elif
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
: result} elif
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
tName() if kind == "list": res = part.asList() else: res = _parsed_query2dict(part) if result is None: result = res elif isinstance(result, dict): list(result.values())[0].append(res) else...
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
ist() e
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
query2dict(part) i
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
e
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
lues())[0].append(res) else:
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
return re
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
e return d
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
dict(parsed_query)
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
uilder(query): p
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
, objs):
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
list(objs, field):
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
st(objs, field):
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
ct_to_root(obj, field):
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
_policy(ap): form
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
ed_args(parsed_args,
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
tring(objs): re
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict import codecs def count(corpus, output_file): debug = False dic = defaultdict(int) other = set() fout = codecs.open(output_file, 'w', 'utf8') for line in open(corpus, 'r'): words = line.split() ...
yy = 'N/A' fout.write('%s %i\n' % (yy, x)) i += 1
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict import codecs def count(corpus, output_file): <|fim_middle|> if __name__ =='__main__': count('data/train.zh_parsed', 'output/count.zh') count('data/train.ja_parsed', 'output/count.ja') <|fim▁end|>
debug = False dic = defaultdict(int) other = set() fout = codecs.open(output_file, 'w', 'utf8') for line in open(corpus, 'r'): words = line.split() for word in words: if len(word) % 3 == 0: for i in xrange(len(word) / 3): dic[word[i:i+3...
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict import codecs def count(corpus, output_file): debug = False dic = defaultdict(int) other = set() fout = codecs.open(output_file, 'w', 'utf8') for line in open(corpus, 'r'): words = line.split() ...
for i in xrange(len(word) / 3): dic[word[i:i+3]] += 1
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict import codecs def count(corpus, output_file): debug = False dic = defaultdict(int) other = set() fout = codecs.open(output_file, 'w', 'utf8') for line in open(corpus, 'r'): words = line.split() ...
other.add(word)
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict import codecs def count(corpus, output_file): debug = False dic = defaultdict(int) other = set() fout = codecs.open(output_file, 'w', 'utf8') for line in open(corpus, 'r'): words = line.split() ...
break
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict import codecs def count(corpus, output_file): debug = False dic = defaultdict(int) other = set() fout = codecs.open(output_file, 'w', 'utf8') for line in open(corpus, 'r'): words = line.split() ...
break
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict import codecs def count(corpus, output_file): debug = False dic = defaultdict(int) other = set() fout = codecs.open(output_file, 'w', 'utf8') for line in open(corpus, 'r'): words = line.split() ...
count('data/train.zh_parsed', 'output/count.zh') count('data/train.ja_parsed', 'output/count.ja')
<|file_name|>character_count.py<|end_file_name|><|fim▁begin|>from collections import defaultdict import codecs def <|fim_middle|>(corpus, output_file): debug = False dic = defaultdict(int) other = set() fout = codecs.open(output_file, 'w', 'utf8') for line in open(corpus, 'r'): words = line...
count
<|file_name|>browser_default.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python<|fim▁hole|>from rdflib.namespace import FOAF from flask import Flask import flask_rdf import random app = Flask(__name__) # set up a custom formatter to return turtle in text/plain to browsers custom_formatter = flask_rdf.FormatSelect...
from rdflib import Graph, BNode, Literal, URIRef
<|file_name|>browser_default.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python from rdflib import Graph, BNode, Literal, URIRef from rdflib.namespace import FOAF from flask import Flask import flask_rdf import random app = Flask(__name__) # set up a custom formatter to return turtle in text/plain to browsers cus...
graph = Graph('IOMemory', BNode()) graph.add((URIRef(path), FOAF.age, Literal(random.randint(20, 50)))) return graph
<|file_name|>browser_default.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python from rdflib import Graph, BNode, Literal, URIRef from rdflib.namespace import FOAF from flask import Flask import flask_rdf import random app = Flask(__name__) # set up a custom formatter to return turtle in text/plain to browsers cus...
app.run(host='0.0.0.0', debug=True)
<|file_name|>browser_default.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python from rdflib import Graph, BNode, Literal, URIRef from rdflib.namespace import FOAF from flask import Flask import flask_rdf import random app = Flask(__name__) # set up a custom formatter to return turtle in text/plain to browsers cus...
random_age
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
LOG.info("Created role %s assignment for user %s in tenant %s", role_info["id"], user_info["id"], tenant_info["id"])
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
def execute(self, user_id): user = self.cloud.keystone.users.get(user_id) self.cloud.identity.fetch(user.id) return user.to_dict()
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
user = self.cloud.keystone.users.get(user_id) self.cloud.identity.fetch(user.id) return user.to_dict()
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
def execute(self, user_info, tenant_info): try: user = self.cloud.keystone.users.find(name=user_info["name"]) # TODO(akscram): Current password should be replaced by temporary. except exceptions.keystone_excs.NotFound: user = self.cloud.keystone.users.create( ...
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
try: user = self.cloud.keystone.users.find(name=user_info["name"]) # TODO(akscram): Current password should be replaced by temporary. except exceptions.keystone_excs.NotFound: user = self.cloud.keystone.users.create( name=user_info["name"], ...
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
LOG.info("Created user: %s", user) events.emit("create", { "id": user.id, "type": "user", "cloud": self.cloud.name, "data": user.to_dict(), }, namespace="/events")
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
def execute(self, user_info): super(EnsureOrphanUser, self).execute(user_info, None)
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
super(EnsureOrphanUser, self).execute(user_info, None)
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
def execute(self, user_info, role_info, tenant_info): try: self.cloud.keystone.tenants.add_user(tenant_info["id"], user_info["id"], role_info["id"]) except exceptions.keystone_excs.Conflict:...
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
try: self.cloud.keystone.tenants.add_user(tenant_info["id"], user_info["id"], role_info["id"]) except exceptions.keystone_excs.Conflict: pass else: self.role_assi...
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
LOG.info("Created role %s assignment for user %s in tenant %s", role_info["id"], user_info["id"], tenant_info["id"])
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
user_ensure = "user-{}-ensure".format(user_id) role_ensure = "role-{}-ensure".format(role_id) tenant_ensure = "tenant-{}-ensure".format(tenant_id) user_role_ensure = "user-role-{}-{}-{}-ensure".format(user_id, role_id, tenant_id) task = Ensur...
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
user_binding = "user-{}".format(user_id) user_retrieve = "{}-retrieve".format(user_binding) user_ensure = "{}-ensure".format(user_binding) flow = linear_flow.Flow("migrate-user-{}".format(user_id)) flow.add(RetrieveUser(context.src_cloud, name=user_binding, ...
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
self.role_assigned_event(role_info, user_info, tenant_info)
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
tenant_ensure = "tenant-{}-ensure".format(tenant_id) flow.add(EnsureUser(context.dst_cloud, name=user_ensure, provides=user_ensure, rebind=[user_binding, tenant_ensure]))
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
flow.add(EnsureUser(context.dst_cloud, name=user_ensure, provides=user_ensure, rebind=[user_binding], inject={"tenant_info": None}))
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
execute
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
execute
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
created_event
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
execute
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
execute
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
role_assigned_event
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
migrate_membership
<|file_name|>user.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # Unless re...
migrate_user
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
spec = {"email_key": email_key, "verified": {"$exists": False}} update = {"$set": {"password_hash": password_hash, "verified": c.unixtime()}} success = c.db().users.update(spec, update, safe=True)["updatedExisting"]
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
abort(503, "Not yet implemented")
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
try: return whitelist(c.db().users.find_one({"email": who}), [ "email", "firstName", "pseudonym" ]) except TypeError: logger.warn("Asked about {email}, but that is not a user".format( email=who)) abort(404, "User...
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
if who != user["email"]: response.status = 400 else: return whitelist(user, ["pseudonym", "firstName", "surname", "email", "private_email"])
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
user = whitelist(request.json, [ "pseudonym", "firstName", "surname", "private_email", "token", ]) if "private_email" not in user: abort(400, "You must provide a private_email field") user["email_key"] = str(uuid.uuid4()) us...
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
if "RECALL_TEST_MODE" in c.settings or "RECALL_DEBUG_MODE" in c.settings: salt = bcrypt.gensalt(1) else: salt = bcrypt.gensalt() password_hash = bcrypt.hashpw(request.json["password"], salt) spec = {"email_key": email_key, "verified": {"$exists": False}} update = {"$set": {"password...
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
response.status = 400
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
return whitelist(user, ["pseudonym", "firstName", "surname", "email", "private_email"])
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
abort(400, "You must provide a private_email field")
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
salt = bcrypt.gensalt(1)
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
salt = bcrypt.gensalt()
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
if c.db().users.find_one({"email_key": email_key}): logger.warn("{email} tried to verify a second time".format(email=who)) abort(403, "Already verified") else: logger.warn("Someone tried to verify with a key, but it doesn't exist") abort(404, "Don't know t...
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
logger.warn("{email} tried to verify a second time".format(email=who)) abort(403, "Already verified")
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
logger.warn("Someone tried to verify with a key, but it doesn't exist") abort(404, "Don't know that key")
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
users
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
user_
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
_self
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
request_invite
<|file_name|>people.py<|end_file_name|><|fim▁begin|># Recall is a program for storing bookmarks of different things # Copyright (C) 2012 Cal Paterson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Softwar...
verify_email
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from django.contrib import admin from models import FileMapping <|fim▁hole|>admin.site.register(FileMapping)<|fim▁end|>
# Register your models here.
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
os_windows = 'windows_7' os_linux = 'linux_ubuntu' os_android = 'android' os_mac = 'mac_os_x_10.11'
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
def test_sort_cpes_by_software_version(self): sorted_cpes = sort_cpes_by_version(unsorted_cpes, version) self.assertEqual(len(unsorted_cpes), len(sorted_cpes)) self.assertEqual(unsorted_cpes[5], sorted_cpes[0]) # 4.7.2 self.assertEqual(unsorted_cpes[4], sorted_cpes[1]) # 4.7.1 ...
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
sorted_cpes = sort_cpes_by_version(unsorted_cpes, version) self.assertEqual(len(unsorted_cpes), len(sorted_cpes)) self.assertEqual(unsorted_cpes[5], sorted_cpes[0]) # 4.7.2 self.assertEqual(unsorted_cpes[4], sorted_cpes[1]) # 4.7.1 self.assertEqual(unsorted_cpes[8], sorted_c...
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
sorted_cpes = sort_cpes_by_version(unsorted_cpes, version_without_points) self.assertListEqual(unsorted_cpes, sorted_cpes)
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
sorted_cpes = sort_cpes_by_version(unsorted_cpes_year, version_year) self.assertEqual(len(unsorted_cpes_year), len(sorted_cpes)) self.assertEqual(unsorted_cpes_year[3], sorted_cpes[0]) # 2010 self.assertEqual(unsorted_cpes_year[7], sorted_cpes[1]) # 2010 self.assertEqual(unso...
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
sorted_cpes = sort_cpes_by_operating_system(unsorted_cpes, os_windows) self.assertEqual(len(unsorted_cpes), len(sorted_cpes)) self.assertEqual(unsorted_cpes[3], sorted_cpes[0])
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
sorted_cpes = sort_cpes_by_operating_system(unsorted_cpes, os_linux) self.assertEqual(len(unsorted_cpes), len(sorted_cpes)) self.assertEqual(unsorted_cpes[6], sorted_cpes[0])
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
sorted_cpes = sort_cpes_by_operating_system(unsorted_cpes, os_android) self.assertEqual(len(unsorted_cpes), len(sorted_cpes)) self.assertEqual(unsorted_cpes[4], sorted_cpes[0]) self.assertEqual(unsorted_cpes[0], sorted_cpes[1])
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
unittest.main()
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
test_sort_cpes_by_software_version
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
test_cpes_and_sorted_cpes_are_equal_when_software_version_not_splitted_by_points
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
test_sort_cpes_by_version_with_year
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
test_sort_cpes_by_operating_system_windows
<|file_name|>test_cpe_sorter.py<|end_file_name|><|fim▁begin|>import unittest from matching.cpe_sorter import * unsorted_cpes = [{'wfn': {'version': '4.0', 'target_sw': 'android_marshmallow'}, 'uri_binding': 'cpe:/a:string_value_with\:double_points:internet_explorer:4.0:beta:~~~android_marshmallow~~'...
test_sort_cpes_by_operating_system_linux