Search is not available for this dataset
id int64 0 10.8M | vector listlengths 1.54k 1.54k | ast_depth int64 3 164 | ast_data stringlengths 297 510k | full_path stringlengths 0 319 | code stringlengths 60 56.5k |
|---|---|---|---|---|---|
12,701 | [
-0.0072172898799180984,
-0.014249362982809544,
0.03106706775724888,
-0.049712248146533966,
0.009878241457045078,
-0.012174932286143303,
0.006667812820523977,
0.014805013313889503,
0.0011190194636583328,
0.034203410148620605,
0.01708935759961605,
-0.04521764814853668,
-0.0028955594170838594,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def get_candidate(module):
candidate = NetworkConfig(indent=1)
if module.params['src']:
candidate.load(module.params['src'])
elif module.params['lines']:
candidate.add(module.params['lines'])
candidate = dumps(candidate, 'raw')
return candidate | |
12,702 | [
0.05612504854798317,
0.03208306059241295,
-0.03405271843075752,
-0.04055055230855942,
0.005959732923656702,
0.07907053083181381,
0.00533533189445734,
-0.0049190642312169075,
0.03573809191584587,
0.010097026824951172,
0.012305275537073612,
-0.016782689839601517,
0.036245737224817276,
0.0184... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "result", "annotation": null, "type_comment": null}}], "kwarg": ... | def save_config(module, result):
result['changed'] = True
if not module.check_mode:
command = {"command": "save configuration",
"prompt": "Do you want to save configuration", "answer": "y"}
run_commands(module, command)
else:
module.warn('Skipping command `save con... | |
12,703 | [
-0.013833774253726006,
-0.004793972242623568,
0.005796375684440136,
0.008661250583827496,
-0.008727875538170338,
-0.00987867172807455,
-0.047897323966026306,
-0.004845455288887024,
0.005260346923023462,
0.055819641798734665,
0.04431168735027313,
-0.030162958428263664,
0.008176705799996853,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state_indices", "annot... | class UnusedStateFilter(StateFilterBase):
def apply(self, state_indices: Set[int]) -> Set[int]:
used_states = set()
# Add all states used by things.
thing_states = set()
for thing in self.patch.things:
thing_states.update(ThingStateFilter.get_states(thing))
self... | |
12,704 | [
-0.0038312163669615984,
-0.0008249993552453816,
0.025331102311611176,
0.012794330716133118,
-0.0024709736462682486,
-0.006754531059414148,
-0.040308259427547455,
-0.023721346631646156,
0.016651304438710213,
0.06073283031582832,
0.033251095563173294,
-0.02735295332968235,
-0.00368633843027055... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state_indices", "annotation": {"_type": "Subscript", "_fields": {... | def apply(self, state_indices: Set[int]) -> Set[int]:
used_states = set()
# Add all states used by things.
thing_states = set()
for thing in self.patch.things:
thing_states.update(ThingStateFilter.get_states(thing))
self.expand_used_states(thing_states)
used_... | |
12,705 | [
0.02959001623094082,
-0.004556521773338318,
0.047061752527952194,
-0.04725642502307892,
0.0009581471094861627,
0.033167097717523575,
0.025477588176727295,
0.041878633201122284,
0.013310641050338745,
0.027910977602005005,
0.004237139597535133,
0.030904047191143036,
0.004103302955627441,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "time", "annotation": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "datetime", "value": {"_type": "Name", "_fields"... | def echo(time: datetime.datetime, rdd: RDD[Tuple[str, int]]) -> None:
# Get or register the excludeList Broadcast
excludeList = getWordExcludeList(rdd.context)
# Get or register the droppedWordsCounter Accumulator
droppedWordsCounter = getDroppedWordsCounter(rdd.context)
# Use e... | |
12,706 | [
0.04804921895265579,
-0.009783587418496609,
0.0601993203163147,
-0.02156822755932808,
0.009651781991124153,
-0.01961510442197323,
0.03486863523721695,
0.014055294916033745,
-0.03357454016804695,
0.02118479274213314,
0.04692287743091583,
0.04773767665028572,
-0.019435368478298187,
0.0085613... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "host", "annotation": {"_type": "Name", "_fields": {"id": "str", "ctx": {"_type": "Load", "_fields": {}}}}, "type_comment": null}}, {"_type": "arg", "_fie... | def createContext(host: str, port: int, outputPath: str) -> StreamingContext:
# If you do not see this printed, that means the StreamingContext has been loaded
# from the new checkpoint
print("Creating new context")
if os.path.exists(outputPath):
os.remove(outputPath)
sc = SparkContext(appNa... | |
12,707 | [
0.024127965793013573,
0.018828243017196655,
-0.01587809808552265,
-0.02423332817852497,
0.049520280212163925,
0.02945929951965809,
-0.02229466289281845,
-0.04203955829143524,
-0.0075017958879470825,
-0.03721396252512932,
0.03268338367342949,
-0.05875001847743988,
0.028258169069886208,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "oid", "annotation": nu... | class NameAttribute(object):
def __init__(self, oid, value):
if not isinstance(oid, ObjectIdentifier):
raise TypeError(
"oid argument must be an ObjectIdentifier instance."
)
if not isinstance(value, six.text_type):
raise TypeError(
... | |
12,708 | [
-0.0006953184492886066,
0.0060209655202925205,
0.04226059094071388,
-0.023370083421468735,
0.013918675482273102,
0.0008829928701743484,
-0.01286031398922205,
-0.03084014169871807,
0.02535143308341503,
0.04317127540707588,
0.018435169011354446,
0.014767824672162533,
0.05449327453970909,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "tmpdir", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def run_test(tmpdir):
assert(sys.platform.startswith('linux')) # due to OS-specific network stats queries, this test works only on Linux
# find the first non-loopback interface for testing
non_loopback_ip = None
for name,ip in all_interfaces():
if ip != '127.0.0.1':
non_loopback_ip =... | |
12,709 | [
0.008626864291727543,
0.027533676475286484,
-0.008355779573321342,
-0.029808659106492996,
0.05719350650906563,
0.040120501071214676,
-0.012501777149736881,
-0.0415237620472908,
-0.0055758352391421795,
-0.017274990677833557,
0.018125450238585472,
-0.03465628623962402,
0.012395469471812248,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "attributes", "annotati... | class Name(object):
def __init__(self, attributes):
self._attributes = attributes
def get_attributes_for_oid(self, oid):
return [i for i in self if i.oid == oid]
def __eq__(self, other):
if not isinstance(other, Name):
return NotImplemented
return self._attribu... | |
12,710 | [
0.045827485620975494,
0.01464960165321827,
-0.024084068834781647,
-0.006441923789680004,
0.028108347207307816,
-0.003477612277492881,
0.034329552203416824,
0.010892241261899471,
0.01758568175137043,
0.009182949550449848,
0.05494370684027672,
-0.059091176837682724,
0.03839489445090294,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "oid", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def __init__(self, oid, value):
if not isinstance(oid, ObjectIdentifier):
raise TypeError(
"oid argument must be an ObjectIdentifier instance."
)
if not isinstance(value, six.text_type):
raise TypeError(
"value argument must be a text ... | |
12,711 | [
-0.02676568739116192,
0.02581424079835415,
0.01778954267501831,
0.0013794406550005078,
-0.009526981972157955,
-0.004284637980163097,
-0.013295209966599941,
0.0556846484541893,
-0.021082047373056412,
0.014784974977374077,
0.03738182410597801,
-0.06524918973445892,
0.01854068413376808,
0.009... | 21 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def filter_by_and_query(username, customer_name, keys_to_pluck, key = AgentKey.ComputerName,
count=30, offset=0, query=None, uri=None, method=None, conn=None):
if query:
count = (
r
.table(AgentsCollection)
.get_all(customer_name, index=AgentKey.Cus... | |
12,712 | [
-0.006420134101063013,
0.006238603498786688,
0.04046923294663429,
0.009360930882394314,
-0.06113952398300171,
-0.0025293270591646433,
0.011914461851119995,
0.020222514867782593,
-0.0238652303814888,
0.015829473733901978,
0.030255109071731567,
-0.07590401917695999,
0.05644393339753151,
-0.0... | 21 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def get_all_agentids(username, customer_name, count=30, offset=0,
uri=None, method=None, conn=None):
try:
count = (
r
.table(AgentsCollection)
.get_all(customer_name, index=AgentKey.CustomerName)
.count()
.run(conn)
... | |
12,713 | [
-0.021025007590651512,
0.0296794306486845,
0.004448797088116407,
-0.0064284647814929485,
-0.010687088593840599,
-0.0213991180062294,
-0.03162480518221855,
0.019977498799562454,
-0.02022690512239933,
0.009807929396629333,
0.03025306575000286,
-0.04806072264909744,
-0.016024397686123848,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def systems_os_details(username, customer_name, key, query, uri=None, method=None):
keys_to_pluck = [AgentKey.ComputerName, AgentKey.OsCode,
AgentKey.OsString, AgentKey.MachineType, AgentKey.SysArch]
data = filter_by_and_query(username=username, customer_name=customer_name,
key... | |
12,714 | [
-0.014843499287962914,
0.012012824416160583,
0.02914893627166748,
0.010258273221552372,
-0.009983394294977188,
0.000019510238416842185,
0.006678990088403225,
-0.011223276145756245,
0.0004971227026544511,
0.009264027699828148,
0.003143570153042674,
-0.012819917872548103,
-0.044027525931596756... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "agent_info", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyarg... | def system_hardware_details(agent_info):
if agent_info:
hardware_info=agent_info.get(AgentKey.Hardware)
data={
"computer-name":agent_info.get(AgentKey.ComputerName),
"cpu":hardware_info.get('cpu'),
"disk":hardware_info.get('storage'),
... | |
12,715 | [
-0.008961796760559082,
0.007703117560595274,
-0.006331156939268112,
-0.02321004681289196,
-0.005903206299990416,
-0.03833937272429466,
-0.02100735902786255,
0.022089822217822075,
-0.01876690983772278,
0.03106420673429966,
0.010925336740911007,
-0.023235220462083817,
-0.026105009019374847,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def systems_network_details(username, customer_name, key, query,
uri=None, method=None):
network_stats=[]
keys_to_pluck = [AgentKey.ComputerName, AgentKey.Hardware]
data = filter_by_and_query(username=username, customer_name=customer_name,
key=key, query=query,keys_to_pluck=keys_to... | |
12,716 | [
-0.021332211792469025,
0.028787413612008095,
0.016226751729846,
-0.0009549671085551381,
0.008777700364589691,
-0.037152986973524094,
-0.03151852637529373,
0.031174061819911003,
-0.0354306623339653,
0.001710021635517478,
0.04197549447417259,
-0.023448210209608078,
-0.05043948441743851,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def systems_hardware_details (username, customer_name, key, query, uri=None, method=None):
keys_to_pluck = [AgentKey.ComputerName, AgentKey.Hardware]
data = filter_by_and_query(username=username, customer_name=customer_name,
key=key, query=query,keys_to_pluck=keys_to_pluck)
try:
... | |
12,717 | [
0.004005251452326775,
0.026300380006432533,
0.02898598089814186,
-0.021218571811914444,
-0.014041531831026077,
-0.04262235760688782,
-0.03644084185361862,
-0.003643505508080125,
0.007159676402807236,
0.007778985425829887,
0.02209833823144436,
-0.018069935962557793,
-0.012698730453848839,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def systems_cpu_details (username, customer_name, key, query,
uri=None, method=None):
cpu_stats=[]
keys_to_pluck = [AgentKey.ComputerName, AgentKey.MonitStats,]
data = filter_by_and_query(username=username, customer_name=customer_name,
key=key, query=query,keys_to_pluck=keys_... | |
12,718 | [
0.010375719517469406,
0.028958361595869064,
-0.009094158187508583,
0.0027695284225046635,
-0.02789860963821411,
0.000693922454956919,
-0.017978830263018608,
0.0008756823954172432,
-0.010843981988728046,
-0.0022227081935852766,
0.01799115166068077,
-0.03982698917388916,
0.016155069693922997,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def systems_memory_stats(username, customer_name, key, query,
uri=None, method=None):
memory_stats = []
keys_to_pluck = [AgentKey.ComputerName, AgentKey.MonitStats,]
data = filter_by_and_query(username=username, customer_name=customer_name,
key=key, query=query, keys_to_pluck=key... | |
12,719 | [
-0.015311440452933311,
0.009374351240694523,
0.034881845116615295,
-0.01689697988331318,
-0.015461893752217293,
0.034326329827308655,
0.02636391669511795,
-0.026248184964060783,
0.02357475832104683,
0.021341117098927498,
0.0012954833218827844,
-0.02310025319457054,
-0.04437192901968956,
0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "agent_info", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyarg... | def system_disk_stats(agent_info):
if agent_info:
monit_stats=agent_info.get('monit_stats')
if monit_stats:
file_system=monit_stats.get('file_system')
if file_system:
data ={
"computer-name": agent_info.get(AgentKey.ComputerName),
... | |
12,720 | [
-0.0005379784852266312,
0.0018431877251714468,
0.02526053600013256,
-0.015222346410155296,
0.0023643544409424067,
0.0000805725940153934,
-0.040128305554389954,
0.008418140932917595,
0.011609331704676151,
0.008766603656113148,
0.02604304999113083,
-0.0281705092638731,
-0.024147897958755493,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def systems_disk_stats(username, customer_name, key, query,
uri=None, method=None):
fs_stats =[]
keys_to_pluck = [AgentKey.ComputerName, AgentKey.MonitStats,]
data = filter_by_and_query(username=username, customer_name=customer_name,
key=key, query=query,keys_to_pluck=keys_to_pluc... | |
12,721 | [
-0.0018329947488382459,
0.032368604093790054,
0.001813070964999497,
-0.0062101129442453384,
-0.04031362384557724,
0.028714874759316444,
0.0019510053098201752,
-0.019617335870862007,
0.009919015690684319,
0.021910112351179123,
0.021407417953014374,
-0.0461743026971817,
-0.02037750743329525,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def agents_last_updated(username, customer_name, os_code=None,
tag_id=None, uri=None, method=None):
agents_uptime_info=[]
agentids=get_agentids(os_code=os_code, customer_name=customer_name, tag_id=tag_id)
for agentid in agentids:
agent_info=get_agent_info(agentid=agentid)
last_upda... | |
12,722 | [
-0.005269289016723633,
-0.007611825130879879,
0.01258049812167883,
0.007793329190462828,
-0.024525731801986694,
0.03984013572335243,
0.03709488734602928,
-0.03382781520485878,
-0.008859665133059025,
0.0519101545214653,
-0.01430478598922491,
-0.000029467817512340844,
-0.04823469743132591,
-... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "agent_info", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyarg... | def agent_last_updated(agent_info):
if agent_info:
last_updated= agent_info.get('last_agent_update')
data = {
"computer-name": agent_info.get(AgentKey.ComputerName),
"last_agent_update": last_updated.strftime("%b %d %Y %H:%M:%S"),
}
return (dat... | |
12,723 | [
-0.01220380887389183,
0.044503480195999146,
0.015142475254833698,
-0.00235799141228199,
-0.046813346445560455,
0.027872420847415924,
0.010477823205292225,
0.022559722885489464,
0.029361004009842873,
0.02080165408551693,
0.013795051723718643,
-0.06195582449436188,
-0.03575164079666138,
0.01... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def agents_reboot_pending(username, customer_name, os_code=None,
tag_id=None, uri=None, method=None):
agents_need_reboot = []
agents_not_need_reboot =[]
agentids=get_agentids(os_code=os_code, customer_name=customer_name, tag_id=tag_id)
for agentid in agentids:
agent_info=get_agent_info(... | |
12,724 | [
-0.0007479520863853395,
0.030218657106161118,
0.009413892403244972,
0.00140914018265903,
-0.02942538633942604,
0.019373159855604172,
0.010882683098316193,
0.006036294624209404,
0.04023370146751404,
0.018567493185400963,
0.019236816093325615,
-0.05463652312755585,
-0.02573172003030777,
-0.0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "username", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "customer_name", "annotation": null, "type_comment": null}}, {... | def agents_status(username, customer_name, os_code=None,
tag_id=None, uri=None, method=None):
nodes_status=[]
agents_up = []
agents_down = []
agentids=get_agentids(os_code=os_code, customer_name=customer_name, tag_id=tag_id)
for agentid in agentids:
agent_info=get_agent_info(agenti... | |
12,725 | [
0.062116753309965134,
0.053419556468725204,
-0.06531425565481186,
0.009278076700866222,
-0.012267738580703735,
0.03065335936844349,
0.03649412468075752,
0.006453619338572025,
0.015646429732441902,
0.008611931465566158,
0.04783459007740021,
0.006101894658058882,
0.015070879831910133,
-0.019... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}, {"_type": ... | def enable_image(module, client, image, enable):
image.info()
changed = False
state = image.state
if state not in [IMAGE_STATES.index('READY'), IMAGE_STATES.index('DISABLED'), IMAGE_STATES.index('ERROR')]:
if enable:
module.fail_json(msg="Cannot enable " + IMAGE_STATES[state] + " i... | |
12,726 | [
0.004700095392763615,
0.03272232785820961,
-0.013139556162059307,
-0.007777880877256393,
-0.012334153987467289,
-0.0003703410329762846,
-0.023678814992308617,
0.056700292974710464,
0.00451312679797411,
0.014428199268877506,
0.05103946849703789,
-0.07649016380310059,
-0.005324281752109528,
... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}, {"_type": ... | def get_image(module, client, predicate):
pool = oca.ImagePool(client)
# Filter -2 means fetch all images user can Use
pool.info(filter=-2)
for image in pool:
if predicate(image):
return image
return None | |
12,727 | [
0.04815522953867912,
0.059440337121486664,
-0.03650345653295517,
-0.01132584922015667,
-0.046077463775873184,
0.04019046947360039,
0.006727269385010004,
-0.02572760358452797,
0.015461006201803684,
-0.002490260871127248,
0.032042376697063446,
-0.014065645635128021,
0.0164591483771801,
-0.01... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}, {"_type": ... | def rename_image(module, client, image, new_name):
if new_name is None:
module.fail_json(msg="'new_name' option has to be specified when the state is 'renamed'")
if new_name == image.name:
result = get_image_info(image)
result['changed'] = False
return result
tmp_image = ge... | |
12,728 | [
0.039899542927742004,
0.025480296462774277,
-0.03272140398621559,
0.0026773726567626,
-0.03112626075744629,
0.030076825991272926,
0.028523661196231842,
-0.022604843601584435,
-0.0009890930959954858,
-0.0021133010741323233,
0.043110817670822144,
-0.036940135061740875,
0.0016358077991753817,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}, {"_type": ... | def clone_image(module, client, image, new_name):
if new_name is None:
new_name = "Copy of " + image.name
tmp_image = get_image_by_name(module, client, new_name)
if tmp_image:
result = get_image_info(tmp_image)
result['changed'] = False
return result
if image.state == I... | |
12,729 | [
0.0345650315284729,
0.06873276084661484,
-0.024301467463374138,
-0.025537509471178055,
-0.04255515709519386,
0.0662606731057167,
0.016907287761569023,
0.0553128756582737,
0.02785508707165718,
0.0018278522184118629,
0.050103843212127686,
-0.042113713920116425,
-0.0032832364086061716,
-0.045... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "client", "annotation": null, "type_comment": null}}, {"_type": ... | def delete_image(module, client, image):
if not image:
return {'changed': False}
if image.running_vms > 0:
module.fail_json(msg="Cannot delete image. There are " + str(image.running_vms) + " VMs using it.")
if not module.check_mode:
client.call('image.delete', image.id)
wa... | |
12,730 | [
0.016730379313230515,
0.05133917182683945,
-0.01057741791009903,
-0.022612454369664192,
-0.033357564359903336,
0.060007493942976,
0.0033215670846402645,
-0.036556586623191833,
0.02356700226664543,
0.041716303676366806,
0.04780476912856102,
-0.0742483139038086,
0.029307186603546143,
0.01079... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"k... | def main():
fields = {
"api_url": {"required": False, "type": "str"},
"api_username": {"required": False, "type": "str"},
"api_password": {"required": False, "type": "str", "no_log": True},
"id": {"required": False, "type": "int"},
"name": {"required": False, "type": "str"},
... | |
12,731 | [
-0.025042824447155,
-0.012094325385987759,
0.055029504001140594,
-0.04125918820500374,
-0.022959157824516296,
0.01912831887602806,
0.015595144592225552,
0.007376956287771463,
-0.00850291270762682,
0.012993796728551388,
0.008328195661306381,
-0.05658254772424698,
0.00012861141294706613,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestSPBuilder(unittest.TestCase):
def setUp(self):
nest.ResetKernel()
def test_synapse_initialisation_one_to_one(self):
syn_model = 'static_synapse'
syn_dict = {'model': syn_model, 'pre_synaptic_element': 'SE1',
'post_synaptic_element': 'SE2'}
neurons ... | |
12,732 | [
0.02409423515200615,
0.020458346232771873,
0.003902623662725091,
-0.04769125208258629,
0.06530097126960754,
-0.0017557922983542085,
-0.02448786422610283,
0.007085321005433798,
0.0366903617978096,
0.006847071927040815,
-0.008613222278654575,
-0.061157505959272385,
-0.016615284606814384,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "response", "annotation": null, "type_comment": null}}], "kwarg": ... | def parse(self, response):
if not hasattr(self, 'parse_node'):
raise NotConfigured('You must define parse_node method in order to scrape this XML feed')
response = self.adapt_response(response)
if self.iterator == 'iternodes':
nodes = self._iternodes(response)
el... | |
12,733 | [
-0.010506726801395416,
-0.019046183675527573,
0.019610051065683365,
-0.04761545732617378,
-0.012755930423736572,
0.008163545280694962,
0.05212639644742012,
-0.004438888281583786,
0.013357388786971569,
-0.0025452342815697193,
0.013420040719211102,
-0.04726460576057434,
-0.03160162642598152,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_synapse_initialisation_one_to_one(self):
syn_model = 'static_synapse'
syn_dict = {'model': syn_model, 'pre_synaptic_element': 'SE1',
'post_synaptic_element': 'SE2'}
neurons = nest.Create('iaf_neuron', 2, {
'synaptic_elements': {
'SE1': {'z... | |
12,734 | [
0.005976561456918716,
-0.013381012715399265,
0.023020830005407333,
-0.045592714101076126,
-0.024679426103830338,
0.016635853797197342,
0.036938078701496124,
-0.005792619194835424,
0.005801972001791,
0.0006640623905695975,
0.014840079471468925,
-0.037262316793203354,
-0.027111204341053963,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_synapse_initialisation_all_to_all(self):
syn_model = 'static_synapse'
syn_dict = {'model': syn_model, 'pre_synaptic_element': 'SE1',
'post_synaptic_element': 'SE2'}
neurons = nest.Create('iaf_neuron', 2, {
'synaptic_elements': {
'SE1': {'z... | |
12,735 | [
0.03377929702401161,
-0.04898521304130554,
0.0020837539341300726,
0.010384781286120415,
0.029386943206191063,
0.0026824737433344126,
0.040932562202215195,
-0.025287412106990814,
0.015666063874959946,
0.02457626909017563,
0.010071041993796825,
-0.019430940970778465,
0.02551748789846897,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TwitchAccount(ProviderAccount):
def get_profile_url(self):
return 'http://twitch.tv/' + self.account.extra_data.get('name')
def get_avatar_url(self):
return self.account.extra_data.get('logo')
def to_str(self):
dflt = super(TwitchAccount, self).to_str()
return self.ac... | |
12,736 | [
-0.01457742415368557,
0.04259279742836952,
0.004659405909478664,
-0.026561560109257698,
-0.03855879232287407,
0.027268819510936737,
0.02353605628013611,
-0.012868211604654789,
-0.032717347145080566,
0.019881878048181534,
0.012010330334305763,
-0.06884001940488815,
-0.0026882446836680174,
0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_not_implemented_rules(self):
syn_model = 'static_synapse'
syn_dict = {'model': syn_model, 'pre_synaptic_element': 'SE1',
'post_synaptic_element': 'SE2'}
neurons = nest.Create('iaf_neuron', 2, {
'synaptic_elements': {
'SE1': {'z': 0.0, 'gro... | |
12,737 | [
0.030800126492977142,
-0.043574944138526917,
0.005834453273564577,
-0.013870391994714737,
0.03838646411895752,
-0.00694036390632391,
-0.0056329090148210526,
-0.0075811720453202724,
-0.005927473772317171,
-0.01664033718407154,
0.06548643857240677,
-0.03737357631325722,
0.06631328910589218,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "twitch"}}, "targets": [{"_type": "Name", "_fields": {"id": "id", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_... | class TwitchProvider(OAuth2Provider):
id = 'twitch'
name = 'Twitch'
package = 'allauth.socialaccount.providers.twitch'
account_class = TwitchAccount
def extract_uid(self, data):
return str(data['_id'])
def extract_common_fields(self, data):
return dict(username=data.get('name')... | |
12,738 | [
-0.02297138422727585,
0.003637508722022176,
0.011122221127152443,
-0.049163684248924255,
-0.009550906717777252,
0.015668407082557678,
0.005781989078968763,
0.02332926355302334,
0.02216615527868271,
-0.003799672704190016,
-0.028026431798934937,
-0.014147420413792133,
-0.016205227002501488,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class RetryTest(unittest.TestCase):
tags = 'unittest', 'utils', 'retry'
def test_fail_after_n_tries(self):
x = RaisesNTypeErrors(5)
x = retry(4, TypeError, 0.01, 'ERROR')(x)
with self.assertRaises(TypeError):
x()
def test_succeeds_after_retries(self):
x = Raise... | |
12,739 | [
-0.015311814844608307,
-0.04732537269592285,
-0.011255031451582909,
-0.017187653109431267,
0.01693904772400856,
0.013221271336078644,
0.030420225113630295,
0.016746943816542625,
-0.004141535144299269,
0.007458153180778027,
-0.009045835584402084,
-0.03778797760605812,
0.013673280365765095,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class CartesianTest(unittest.TestCase):
tags = 'unittest', 'utils', 'cartesian_product'
def test_cartesian_product(self):
cartesian_dict=cartesian_product({'param1':[1,2,3], 'param2':[42.0, 52.5]},
('param1','param2'))
result_dict = {'param1':[1,1,2,2... | |
12,740 | [
-0.004774740431457758,
-0.05907302349805832,
-0.028462057933211327,
-0.02368183434009552,
0.021960515528917313,
0.029909281060099602,
0.05008269473910332,
0.04065381735563278,
-0.021938588470220566,
0.00538049079477787,
0.011479111388325691,
-0.04330705851316452,
0.01190670020878315,
0.018... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cartesian_product(self):
cartesian_dict=cartesian_product({'param1':[1,2,3], 'param2':[42.0, 52.5]},
('param1','param2'))
result_dict = {'param1':[1,1,2,2,3,3],'param2': [42.0,52.5,42.0,52.5,42.0,52.5]}
self.assertTrue(nested_equal(cartesian_d... | |
12,741 | [
0.012257838621735573,
-0.04493427276611328,
-0.029926493763923645,
-0.018247591331601143,
-0.0002251027908641845,
0.029213957488536835,
0.05606764182448387,
0.03979065641760826,
-0.007960358634591103,
0.01009796466678381,
-0.0019260726403445005,
-0.03613891452550888,
0.0012385871959850192,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_cartesian_product_combined_params(self):
cartesian_dict=cartesian_product( {'param1': [42.0, 52.5], 'param2':['a', 'b'],\
'param3' : [1,2,3]}, (('param3',),('param1', 'param2')))
result_dict={'param3':[1,1,2,2,3,3],'param1' : [42.0,52.5,42.0,52.5,42.0,52.5],
'... | |
12,742 | [
-0.001436398713849485,
-0.023018859326839447,
0.047715798020362854,
-0.031056612730026245,
0.014895986765623093,
0.01348542794585228,
0.009606391191482544,
0.005447675008326769,
0.06537210196256638,
0.008584952913224697,
0.004903515800833702,
-0.012828788720071316,
-0.0055905552580952644,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class ProgressBarTest(unittest.TestCase):
tags = 'unittest', 'utils', 'progress_bar'
def test_progressbar(self):
total = 55
percentage_step = 17
for irun in range(total):
time.sleep(0.005)
progressbar(irun, total, percentage_step)
def test_progressbar_w_w... | |
12,743 | [
-0.01101057231426239,
-0.023465972393751144,
0.022544272243976593,
-0.013974958099424839,
0.03044099546968937,
0.010879791341722012,
0.018558545038104057,
0.025409013032913208,
0.07538007199764252,
0.02099980227649212,
0.007971455343067646,
-0.021423285827040672,
-0.03679324686527252,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_progressbar(self):
total = 55
percentage_step = 17
for irun in range(total):
time.sleep(0.005)
progressbar(irun, total, percentage_step) | |
12,744 | [
-0.001132605946622789,
0.0009339317330159247,
0.01913786493241787,
-0.013379570096731186,
0.024583494290709496,
0.026120776310563087,
0.017887195572257042,
-0.003048509592190385,
0.05846885219216347,
0.013757376931607723,
0.01300827693194151,
-0.026707028970122337,
-0.03744195029139519,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_progressbar_w_wo_time(self):
total = 55
percentage_step = 17
shows_time = False
for irun in range(total):
time.sleep(0.005)
s = progressbar(irun, total, percentage_step, time=True)
if s and 'remaining' in s:
shows_time = True
... | |
12,745 | [
0.0033377096988260746,
-0.0153333880007267,
0.03636346757411957,
-0.02207154594361782,
0.020528169348835945,
-0.0013465337688103318,
0.01735358126461506,
0.014931859448552132,
0.0668545737862587,
0.04238640516996384,
0.01714026927947998,
-0.009235166944563389,
-0.046251121908426285,
-0.046... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_progressbar_float(self):
total = 55
for irun in range(total):
time.sleep(0.005)
progressbar(irun, total, 5.1)
for irun in range(2*total):
time.sleep(0.005)
progressbar(irun, 2*total, 0.5) | |
12,746 | [
-0.006430409848690033,
0.0024694427847862244,
0.03114073909819126,
-0.014883440919220448,
0.006255497690290213,
0.016295460984110832,
0.024703968316316605,
0.028469352051615715,
0.05841432884335518,
0.01671524904668331,
0.019119497388601303,
-0.016689807176589966,
-0.044599439948797226,
-0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_progressbar_resume(self):
total = 55
for irun in range(total):
time.sleep(0.005)
progressbar(irun, total, 5)
for irun in range(2*total):
time.sleep(0.005)
progressbar(irun, 2*total, 10) | |
12,747 | [
-0.0011002413230016828,
-0.04135710000991821,
0.03855963796377182,
-0.017818080261349678,
-0.00014264939818531275,
-0.02719336561858654,
-0.043045658618211746,
-0.023728037253022194,
0.00720157939940691,
0.01707461103796959,
-0.011177253909409046,
-0.03215823322534561,
0.0020177653059363365,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class TestFindUnique(unittest.TestCase):
tags = 'unittest', 'utils', 'find_unique'
def test_find_unique(self):
paramA = Parameter('ggg', 33)
paramA._explore([1, 2, 1, 2, 1, 2])
paramB = Parameter('hhh', 'a')
paramB._explore(['a', 'a', 'a', 'a', 'b', 'b'])
unique_element... | |
12,748 | [
0.02982049062848091,
-0.003108931239694357,
0.061761997640132904,
-0.0363350436091423,
0.015604626387357712,
0.030047742649912834,
0.012126410380005836,
0.009077448397874832,
0.05317692831158638,
0.010220020078122616,
0.011880220845341682,
0.009582452476024628,
-0.04216783866286278,
-0.053... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_progressbar_logging(self):
logger = get_root_logger()
total = 33
for irun in range(total):
time.sleep(0.005)
progressbar(irun, total, logger=logger)
for irun in range(total):
time.sleep(0.005)
progressbar(irun, total, logger='Ge... | |
12,749 | [
-0.002846700372174382,
-0.02029430866241455,
0.013338824734091759,
-0.034912046045064926,
0.03603389859199524,
0.04155341163277626,
0.028136057779192924,
0.019228549674153328,
-0.015245973132550716,
0.01633417047560215,
0.002114691771566868,
-0.02438906952738762,
-0.015526436269283295,
0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class TestDictionaryMethods(unittest.TestCase):
tags = 'unittest', 'utils'
def test_nest_dicitionary(self):
mydict = {'a.b.c' : 4, 'a.c' : 5, 'd':4}
nested = nest_dictionary(mydict, separator='.')
expected = {'a':{'b':{'c':4}, 'c':5}, 'd':4}
self.assertTrue(expected == nested)
... | |
12,750 | [
0.013979296199977398,
-0.05181693285703659,
0.013364259153604507,
-0.020244993269443512,
-0.01859208010137081,
-0.02617754600942135,
-0.023051103577017784,
-0.017490137368440628,
0.02442212589085102,
0.007284353952854872,
0.0049523357301950455,
-0.04438522830605507,
-0.006579623091965914,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_find_unique(self):
paramA = Parameter('ggg', 33)
paramA._explore([1, 2, 1, 2, 1, 2])
paramB = Parameter('hhh', 'a')
paramB._explore(['a', 'a', 'a', 'a', 'b', 'b'])
unique_elements = find_unique_points([paramA, paramB])
self.assertTrue(len(unique_elements) == 4)
... | |
12,751 | [
-0.010404987260699272,
-0.045403577387332916,
0.0016590338200330734,
-0.04918720945715904,
0.0028943796642124653,
-0.008498391136527061,
-0.021558817476034164,
-0.025913935154676437,
-0.01438568253070116,
-0.0026308062952011824,
-0.005842952057719231,
0.001753870863467455,
0.0119026741012930... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class ResultSortFuncTest(unittest.TestCase):
tags = 'unittest', 'utils', 'result_sort'
def result_sort_sorted(the_list, start_index=0):
to_sort = the_list[start_index:]
sorted_list = sorted(to_sort, key=lambda key: key[0])
for idx_count, elem in enumerate(sorted_list):
the_l... | |
12,752 | [
0.015805425122380257,
-0.043404050171375275,
0.021140947937965393,
-0.047003407031297684,
0.020283453166484833,
-0.025216693058609962,
0.0056531126610934734,
-0.02782093733549118,
-0.026148293167352676,
-0.0019200998358428478,
-0.013021214865148067,
-0.007913298904895782,
0.00694994116201996... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "start_index", "annotation": null, "type_comment": null}}, {"_type... | def test_sort(self, start_index=0, n=100):
to_sort = list(range(n)) # list for Python 3
random.shuffle(to_sort)
to_sort = [(x,x) for x in to_sort]
result_sort(to_sort, start_index)
if start_index == 0:
compare = [(x,x,) for x in range(n)]
else:
cop... | |
12,753 | [
0.032640766352415085,
0.014297456480562687,
0.015930548310279846,
-0.0063058421947062016,
0.010915376245975494,
0.010430716909468174,
-0.0520060770213604,
0.00979855190962553,
-0.013791725039482117,
0.021240731701254845,
-0.001862251665443182,
-0.05676838383078575,
0.04231288656592369,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "an... | class MyDummyList(Sequence):
def __init__(self, *args, **kwargs):
self._list = list(*args, **kwargs)
def __len__(self):
return self._list.__len__()
def __getitem__(self, item):
return self._list.__getitem__(item)
def append(self, item):
return self._list.append(item) | |
12,754 | [
0.04892974719405174,
-0.021639320999383926,
0.006459238473325968,
-0.0011598722776398063,
-0.0025581142399460077,
0.009738275781273842,
-0.003235433017835021,
0.042580973356962204,
0.01582542434334755,
-0.017557965591549873,
0.02899971231818199,
-0.08469683676958084,
0.0344182625412941,
-0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "an... | class MyDummySet(Set):
def __init__(self, *args, **kwargs):
self._set = set(*args, **kwargs)
def __getattr__(self, item):
return getattr(self._set, item)
def __contains__(self, item):
return self._set.__contains__(item)
def __len__(self):
return self._set.__len__()
... | |
12,755 | [
0.06276608258485794,
0.04827476292848587,
0.06094355508685112,
0.0026004360988736153,
-0.023492828011512756,
0.0043201688677072525,
0.0189809612929821,
-0.008807032369077206,
-0.028827056288719177,
0.00024257540644612163,
0.018047470599412918,
-0.06605552136898041,
0.02604881301522255,
0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "an... | class MyDummyMapping(Mapping):
def __init__(self, *args, **kwargs):
self._dict = dict(*args, **kwargs)
def __getitem__(self, item):
return self._dict.__getitem__(item)
def __iter__(self):
return self._dict.__iter__()
def __len__(self):
return self._dict.__len__() | |
12,756 | [
0.0037071900442242622,
-0.027400122955441475,
0.06798136979341507,
-0.03710433468222618,
0.04052934795618057,
0.02903478965163231,
-0.0021390130277723074,
0.020264673978090286,
-0.00686300452798605,
-0.0063246022909879684,
-0.008329014293849468,
-0.04722369834780693,
0.014193056151270866,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class TestEqualityOperations(unittest.TestCase):
tags = 'unittest', 'utils', 'equality'
def test_nested_equal(self):
self.assertTrue(nested_equal(4, 4))
self.assertFalse(nested_equal(4, 5))
self.assertFalse(nested_equal(5, 4))
self.assertTrue(nested_equal(4, np.int8(4)))
... | |
12,757 | [
0.01922968588769436,
-0.03689070791006088,
0.059771597385406494,
-0.035051580518484116,
0.04403084143996239,
0.03483521193265915,
0.02772212214767933,
0.006903484463691711,
0.012576377019286156,
-0.010290992446243763,
0.009155062027275562,
-0.049034349620342255,
-0.012623707763850689,
0.01... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_nested_equal(self):
self.assertTrue(nested_equal(4, 4))
self.assertFalse(nested_equal(4, 5))
self.assertFalse(nested_equal(5, 4))
self.assertTrue(nested_equal(4, np.int8(4)))
self.assertTrue(nested_equal(np.int8(4), 4))
self.assertFalse(nested_equal(4, np.int8(... | |
12,758 | [
0.026177294552326202,
-0.03655026853084564,
0.008247182704508305,
-0.05217651277780533,
0.044897619634866714,
0.0418257936835289,
-0.0020464924164116383,
0.00971075240522623,
0.0036617047153413296,
0.008981750346720219,
0.0016764263855293393,
-0.01859789900481701,
0.012331820093095303,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class TestIteratorChain(unittest.TestCase):
tags = 'unittest', 'utils', 'iterators'
def test_next(self):
l1 = (x for x in range(3))
l2 = iter([3,4,5])
l3 = iter([6])
l4 = iter([7,8])
chain = IteratorChain(l1, l2, l3)
for irun in range(9):
element = ... | |
12,759 | [
0.0353914350271225,
-0.03818182647228241,
0.027345813810825348,
-0.07227107882499695,
0.02664821594953537,
0.04139077290892601,
0.005563338287174702,
0.022857937961816788,
0.009958201088011265,
0.02310209721326828,
0.011998673900961876,
-0.012149819172918797,
-0.017556197941303253,
-0.0584... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_iter(self):
l1 = (x for x in range(3))
l2 = iter([3,4,5])
l3 = iter([6])
l4 = iter([7,8])
chain = IteratorChain(l1, l2, l3)
count = 0
elem_list = []
for elem in chain:
self.assertEqual(elem, count)
count += 1
e... | |
12,760 | [
0.040097229182720184,
-0.024725081399083138,
0.030952652916312218,
-0.06037735193967819,
0.044102322310209274,
0.030605390667915344,
0.02076628990471363,
0.031508274376392365,
0.018601687625050545,
0.004025349859148264,
0.004792220890522003,
-0.02134506031870842,
-0.022178491577506065,
-0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_next(self):
l1 = (x for x in range(3))
l2 = iter([3,4,5])
l3 = iter([6])
l4 = iter([7,8])
chain = IteratorChain(l1, l2, l3)
for irun in range(9):
element = next(chain)
self.assertEqual(irun, element)
if irun == 4:
... | |
12,761 | [
0.02138962782919407,
-0.005054762586951256,
0.06110646575689316,
-0.03875909373164177,
0.026745902374386787,
0.018504569306969643,
-0.004646834451705217,
-0.03563755378127098,
0.01232061441987753,
-0.027526287361979485,
0.026627661660313606,
-0.014224279671907425,
0.02105855569243431,
0.00... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class NamingSchemeTest(unittest.TestCase):
tags = 'unittest', 'utils', 'naming', 'slots'
def test_v_property(self):
cp = MyCustomLeaf('test')
self.assertEqual(cp.vars.my_property, cp.v_my_property)
with self.assertRaises(AttributeError):
cp.v_my_other
def test_v_proper... | |
12,762 | [
0.021425070241093636,
-0.029048223048448563,
0.01048899907618761,
-0.023775065317749977,
-0.005588401574641466,
-0.005774681456387043,
-0.0143177704885602,
-0.02171165496110916,
0.005880717653781176,
-0.00999034196138382,
0.050255488604307175,
-0.0035049307625740767,
0.043835993856191635,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class SlotsTest(unittest.TestCase):
tags = 'unittest', 'utils', 'slots'
def test_all_slots(self):
slot = Slots4()
all_slots = set(('hi', 'ho', 'hu', 'he', '__weakref__'))
self.assertEqual(all_slots, slot.__all_slots__)
def test_pickling(self):
slot = Slots4()
all_s... | |
12,763 | [
-0.003939702175557613,
-0.015307565219700336,
0.06104513630270958,
-0.039848264306783676,
0.00021712474699597806,
0.004454582463949919,
-0.015515831299126148,
0.013780280016362667,
0.008602551184594631,
0.053732678294181824,
0.011148027144372463,
-0.041699521243572235,
-0.010986042208969593,... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Tuple", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "unittest"}}, {"_type": "Constant", "_fields": {"kind": n... | class MatchingkwargsTest(unittest.TestCase):
tags = 'unittest', 'utils', 'naming', 'argspec'
def test_more_than_def(self):
kwargs = dict(a=42, f=43)
res = get_matching_kwargs(dummy, kwargs)
self.assertEqual(len(res), 1)
self.assertIn('a', res)
self.assertEqual(res['a'],... | |
12,764 | [
-0.0035207592882215977,
-0.01704907789826393,
0.028596263378858566,
-0.06470951437950134,
0.0018693420570343733,
0.02229059487581253,
-0.021758519113063812,
0.0352075919508934,
0.03224155306816101,
0.04926798865199089,
0.029434001073241234,
-0.053660448640584946,
-0.02866418845951557,
0.00... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_kwargs(self):
kwargs = dict(a=42, f=43)
res = get_matching_kwargs(kwargs_func, kwargs)
self.assertEqual(len(res), 2)
self.assertIn('a', res)
self.assertEqual(res['a'], 42)
self.assertIn('f', res)
self.assertEqual(res['f'], 43) | |
12,765 | [
0.03312364220619202,
0.03783009946346283,
0.0637044608592987,
-0.04858133941888809,
0.048715174198150635,
0.009725190699100494,
0.02020876668393612,
0.008866429328918457,
-0.016952166333794594,
-0.013762482441961765,
0.007656356785446405,
0.011721530929207802,
0.03093770332634449,
-0.04110... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def process(self):
table_name = "log_{0}".format((datetime.datetime.now() + datetime.timedelta(hours=1)).strftime("%Y%m%d%H"))
sqlstr = self.sql_tpl.format(table_name)
with self.dbengine.begin() as conn:
try:
conn.execute(_sql(sqlstr))
log.msg("create ... | |
12,766 | [
0.04741394892334938,
0.0388328954577446,
0.03351389244198799,
-0.05638977140188217,
0.024579623714089394,
0.00943292398005724,
0.01903206668794155,
0.019780052825808525,
-0.0482034869492054,
-0.008731688372790813,
-0.011801543645560741,
0.007672042120248079,
0.039352331310510635,
-0.032080... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "config", "annotation":... | class CreateTableTask:
def __init__(self, config):
self.dbengine = get_engine(config)
self.sql_tpl = 'mysql' in self.dbengine.driver and mysql_create_sql_tpl or create_sql_tpl
def process(self):
table_name = "log_{0}".format((datetime.datetime.now() + datetime.timedelta(hours=1)).strft... | |
12,767 | [
0.02218351513147354,
-0.011078608222305775,
0.004109275992959738,
-0.004832508508116007,
0.017528526484966278,
0.02131563611328602,
-0.001924784854054451,
-0.025168493390083313,
-0.021736426278948784,
-0.012281803414225578,
0.050468482077121735,
-0.027640633285045624,
-0.0005506429588422179,... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null... | def __setstate__(self, data):
self._fact_cache = data.get('fact_cache', defaultdict(dict))
self._nonpersistent_fact_cache = data.get('np_fact_cache', defaultdict(dict))
self._vars_cache = data.get('vars_cache', defaultdict(dict))
self._extra_vars = data.get('extra_vars', dict())
... | |
12,768 | [
0.03140062838792801,
-0.010732983238995075,
0.03152734786272049,
-0.01572565734386444,
0.014103672467172146,
0.020198790356516838,
0.026889480650424957,
-0.03930781036615372,
-0.02396230399608612,
-0.006665347144007683,
0.03573437035083771,
-0.04549162834882736,
-0.0030982461757957935,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def __init__(self):
self._fact_cache = FactCache()
self._nonpersistent_fact_cache = defaultdict(dict)
self._vars_cache = defaultdict(dict)
self._extra_vars = defaultdict(dict)
self._host_vars_files = defaultdict(dict)
self._group_vars_files = defaultdict(dict)
se... | |
12,769 | [
0.02535192109644413,
-0.04730616509914398,
0.022476961836218834,
-0.06586272269487381,
0.01726164110004902,
-0.015978600829839706,
0.028892161324620247,
-0.019245602190494537,
-0.003157110186293721,
-0.03989304229617119,
0.029628721997141838,
-0.02317788079380989,
0.05160672217607498,
-0.0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "play", "annotation": null, "type_comment": null}}, {"_type": "arg... | def _get_cache_entry(self, play=None, host=None, task=None):
play_id = "NONE"
if play:
play_id = play._uuid
host_id = "NONE"
if host:
host_id = host.get_name()
task_id = "NONE"
if task:
task_id = task._uuid
return "PLAY:%s;HO... | |
12,770 | [
0.011431344784796238,
0.006390654481947422,
0.007573420647531748,
-0.05731773003935814,
-0.010564395226538181,
0.01441612746566534,
-0.0037000153679400682,
-0.0642533227801323,
-0.03703111782670021,
0.013326248154044151,
0.02558738738298416,
-0.021587036550045013,
0.044858429580926895,
-0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "loader", "annotation": null, "type_comment": null}}, {"_type": "a... | def _get_delegated_vars(self, loader, play, task, existing_variables):
# we unfortunately need to template the delegate_to field here,
# as we're fetching vars before post_validate has been called on
# the task that has been passed in
vars_copy = existing_variables.copy()
templar... | |
12,771 | [
0.001295962487347424,
-0.0004862660134676844,
0.05162934958934784,
-0.05062544718384743,
0.007995378226041794,
-0.014592462219297886,
-0.03308102861046791,
-0.05688789486885071,
-0.024547843262553215,
0.014472950249910355,
0.030284438282251358,
-0.03755079209804535,
0.014915145933628082,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}], "kwarg": null... | def clear_playbook_hostgroup_vars_files(self, path):
for f in self._host_vars_files.keys():
keepers = []
for entry in self._host_vars_files[f]:
if os.path.dirname(entry.path) != os.path.join(path, 'host_vars'):
keepers.append(entry)
self._h... | |
12,772 | [
0.013149778358638287,
-0.03077607788145542,
0.0712326318025589,
-0.01649317890405655,
-0.006179696414619684,
0.038889769464731216,
0.006543413735926151,
-0.031755317002534866,
0.03611992299556732,
0.01666104979813099,
0.020368168130517006,
-0.05632022023200989,
0.020619971677660942,
0.0308... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestUpdateBuildingPreference(TestBrokerCommand):
def test_000_justification(self):
command = ["update_building_preference", "--building_pair", "utb1,utb2",
"--archetype", "hacluster", "--prefer", "utb1"]
self.justificationmissingtest(command, auth=True, msgcheck=False)
... | |
12,773 | [
-0.013319490477442741,
0.045733530074357986,
0.06399253755807877,
-0.01696883514523506,
-0.04674109071493149,
0.0008117332472465932,
-0.015936696901917458,
-0.039712727069854736,
-0.022117236629128456,
0.03578077256679535,
-0.026393234729766846,
-0.04099060967564583,
0.002280839951708913,
... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "LAYER"}}, "targets": [{"_type": "Name", "_fields": {"id": "LAYER", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {... | class VectorLayerBoundsAlgorithm(GeoAlgorithm):
LAYER = 'LAYER'
XMIN = 'XMIN'
XMAX = 'XMAX'
YMIN = 'YMIN'
YMAX = 'YMAX'
EXTENT = 'EXTENT'
def defineCharacteristics(self):
self.showInModeler = True
self.showInToolbox = False
self.name = self.tr('Vector layer bounds',... | |
12,774 | [
0.006939108483493328,
-0.0498831570148468,
0.06525982916355133,
-0.02763039618730545,
-0.039800092577934265,
0.022168736904859543,
-0.002377222292125225,
-0.00602883193641901,
0.029941098764538765,
-0.015824807807803154,
0.01046818122267723,
-0.03349817916750908,
0.036915216594934464,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def test_105_show_utb12_proto(self):
# Different pair order
command = ["show_building_preference", "--building_pair", "utb2,utb1",
"--archetype", "hacluster", "--format", "proto"]
pref = self.protobuftest(command, expect=1)[0]
self.assertEqual(len(pref.location), 2)
... | |
12,775 | [
0.003240571590140462,
-0.0016570755979046226,
0.019841985777020454,
-0.028181016445159912,
0.021411685273051262,
0.01266796700656414,
0.013097181916236877,
0.003283492987975478,
0.015819629654288292,
0.03472960740327835,
0.005898637231439352,
-0.025777412578463554,
-0.028941338881850243,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "progress", "annotation": null, "type_comment": null}}], "kwarg": ... | def processAlgorithm(self, progress):
uri = self.getParameterValue(self.LAYER)
layer = dataobjects.getObjectFromUri(uri)
self.setOutputValue(self.XMIN, layer.extent().xMinimum())
self.setOutputValue(self.XMAX, layer.extent().xMaximum())
self.setOutputValue(self.YMIN, layer.extent... | |
12,776 | [
-0.025928232818841934,
0.0530659444630146,
0.02769205905497074,
0.011805031448602676,
-0.047094136476516724,
-0.006702536251395941,
-0.04008923098444939,
-0.03701513633131981,
-0.01033097691833973,
0.07156091183423996,
-0.037115924060344696,
-0.016164200380444527,
0.02660856582224369,
-0.0... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def defineCharacteristics(self):
self.showInModeler = True
self.showInToolbox = False
self.name = self.tr('Vector layer bounds', 'VectorLayerBoundsAlgorithm')
self.group = self.tr('Modeler-only tools', 'VectorLayerBoundsAlgorithm')
self.addParameter(ParameterVector(self.LAYER, se... | |
12,777 | [
0.029723195359110832,
0.045579008758068085,
0.034965429455041885,
-0.038503289222717285,
0.03253798931837082,
0.025888361036777496,
-0.012453528121113777,
0.012311497703194618,
-0.024997441098093987,
0.05541788041591644,
-0.0011394752655178308,
0.029723195359110832,
-0.0122146587818861,
0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "level", "annotation": null, "type_comment": null}}, {"_type": "ar... | def _log(self, level, level_str, msg, exc):
if level >= self.log_level:
msg = self.format_str % {'lvl': level_str, 'msg': msg, }
if exc:
# java.lang.System.err.println(msg, exc)
self.log_ctx.log(msg, exc)
else:
# java.lang.System.... | |
12,778 | [
0.007977177388966084,
0.028383130207657814,
0.010665987618267536,
-0.03987472876906395,
0.01930142194032669,
0.03791111707687378,
0.015987824648618698,
-0.02182287909090519,
-0.005433406215161085,
0.06082737073302269,
0.017560945823788643,
-0.03302439674735069,
-0.001518731820397079,
0.050... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "context", "annotation"... | class modjy_logger:
def __init__(self, context):
self.log_ctx = context
self.format_str = "%(lvl)s:\t%(msg)s"
self.log_level = levels_dict[DEBUG]
def _log(self, level, level_str, msg, exc):
if level >= self.log_level:
msg = self.format_str % {'lvl': level_str, 'msg'... | |
12,779 | [
-0.010136308148503304,
-0.015219050459563732,
-0.0409887321293354,
-0.050558991730213165,
0.0053365882486104965,
0.046940967440605164,
0.024835996329784393,
-0.007282735779881477,
0.06853241473436356,
0.03970491513609886,
0.05681467801332474,
-0.031161706894636154,
0.002153308829292655,
0.... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_type_compare():
assert mpf(2) == mpc(2,0)
assert mpf(0) == mpc(0)
assert mpf(2) != mpc(2, 0.00001)
assert mpf(2) == 2.0
assert mpf(2) != 3.0
assert mpf(2) == 2
assert mpf(2) != '2.0'
assert mpc(2) != '2.0' | |
12,780 | [
0.014843625016510487,
-0.03668477386236191,
0.005267724394798279,
-0.02543129399418831,
-0.010692110285162926,
0.02607099339365959,
0.0008065591100603342,
0.017154375091195107,
0.043473415076732635,
0.03073165751993656,
0.06297770142555237,
-0.04193291440606117,
0.0014287151861935854,
0.02... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assert", "_fields": {"msg": null, "test": {"_type": "Compare",... | def test_mixed_misc():
assert 1 + mpf(3) == mpf(3) + 1 == 4
assert 1 - mpf(3) == -(mpf(3) - 1) == -2
assert 3 * mpf(2) == mpf(2) * 3 == 6
assert 6 / mpf(2) == mpf(6) / 2 == 3
assert 1.0 + mpf(3) == mpf(3) + 1.0 == 4
assert 1.0 - mpf(3) == -(mpf(3) - 1.0) == -2
assert 3.0 * mpf(2) == mpf(2) *... | |
12,781 | [
0.020131215453147888,
-0.039631184190511703,
0.006315877195447683,
-0.030848650261759758,
-0.02437153272330761,
0.03738066181540489,
-0.01844332180917263,
-0.004010461736470461,
0.053847912698984146,
0.00405506044626236,
0.04004286602139473,
-0.0406741127371788,
-0.011101672425866127,
0.01... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields":... | def test_add_misc():
mp.dps = 15
assert mpf(4) + mpf(-70) == -66
assert mpf(1) + mpf(1.1)/80 == 1 + 1.1/80
assert mpf((1, 10000000000)) + mpf(3) == mpf((1, 10000000000))
assert mpf(3) + mpf((1, 10000000000)) == mpf((1, 10000000000))
assert mpf((1, -10000000000)) + mpf(3) == mpf(3)
assert mpf... | |
12,782 | [
-0.016515318304300308,
-0.017548343166708946,
0.05314192920923233,
-0.012337453663349152,
0.006727736908942461,
0.03334446996450424,
0.008081129752099514,
0.016031498089432716,
0.02428261935710907,
0.031723011285066605,
0.04893137142062187,
-0.0457669161260128,
-0.019666697829961777,
0.003... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg... | def test_exact_integer_arithmetic():
# XXX: re-fix this so that all operations are tested with all rounding modes
random.seed(0)
for prec in [6, 10, 25, 40, 100, 250, 725]:
for rounding in ['d', 'u', 'f', 'c', 'n']:
mp.dps = prec
M = 10**(prec-2)
M2 = 10**(prec//2-2)
fo... | |
12,783 | [
0.04561464488506317,
0.04526182636618614,
0.05902182310819626,
0.008644101209938526,
-0.026108713820576668,
0.028049226850271225,
0.04034753888845444,
0.011750181205570698,
0.0175528172403574,
0.05448555946350098,
0.030619775876402855,
-0.00037250909372232854,
-0.02193787321448326,
-0.0110... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def validate(self):
self.update_status()
self.validate_reference_doctype()
self.validate_submit_on_creation()
self.validate_dates()
self.validate_email_id()
self.validate_auto_repeat_days()
self.set_dates()
self.update_auto_repeat_id()
self.unlink_if_applicable()
validate_template(self.subject or "... | |
12,784 | [
0.03135104104876518,
0.00016526831313967705,
0.03449629247188568,
-0.04360229894518852,
0.006265135481953621,
0.019251974299550056,
-0.006268306169658899,
-0.0294233076274395,
0.08948744088411331,
0.01854175701737404,
0.03982292488217354,
-0.038072746247053146,
-0.0409897118806839,
-0.0023... | 7 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Lambda", "_fields": {... | def test_monitor():
f = lambda x: x**2
a = []
b = []
g = monitor(f, a.append, b.append)
assert g(3) == 9
assert g(4) == 16
assert a[0] == ((3,), {})
assert b[0] == 9 | |
12,785 | [
0.025716878473758698,
0.060491275042295456,
0.008029304444789886,
0.011420096270740032,
-0.02217012085020542,
0.05004740506410599,
0.014949524775147438,
0.016278114169836044,
-0.01997506059706211,
0.02233186364173889,
0.008959316648542881,
0.0003321474650874734,
0.0040521989576518536,
0.00... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def validate_reference_doctype(self):
if frappe.flags.in_test or frappe.flags.in_patch:
return
if not frappe.get_meta(self.reference_doctype).allow_auto_repeat:
frappe.throw(
_("Enable Allow Auto Repeat for the doctype {0} in Customize Form").format(
self.reference_doctype
)
) | |
12,786 | [
0.006632696837186813,
0.013000527396798134,
0.056857991963624954,
-0.05782917141914368,
0.005095919594168663,
0.026574932038784027,
0.0007325212354771793,
-0.014678014442324638,
-0.001849926426075399,
0.04078942909836769,
0.03332902491092682,
-0.00002186743040510919,
-0.001373994629830122,
... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def validate_dates(self):
if frappe.flags.in_patch:
return
if self.end_date:
self.validate_from_to_dates("start_date", "end_date")
if self.end_date == self.start_date:
frappe.throw(
_("{0} should not be same as {1}").format(frappe.bold("End Date"), frappe.bold("Start Date"))
) | |
12,787 | [
0.017121147364377975,
0.03310088440775871,
0.00953647866845131,
-0.01671023853123188,
-0.014119239524006844,
0.06318844854831696,
0.02355869859457016,
0.00021454937814269215,
-0.025453438982367516,
0.006916943471878767,
0.0035754661075770855,
-0.0491262786090374,
-0.012144600041210651,
-0.... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def update_auto_repeat_id(self):
# check if document is already on auto repeat
auto_repeat = frappe.db.get_value(self.reference_doctype, self.reference_document, "auto_repeat")
if auto_repeat and auto_repeat != self.name and not frappe.flags.in_patch:
frappe.throw(
_("The {0} is already on auto repeat {1}"... | |
12,788 | [
0.00539177842438221,
0.003125556278973818,
0.05251554772257805,
-0.013190933503210545,
-0.024160627275705338,
0.031097345054149628,
0.028764424845576286,
-0.027051961049437523,
0.0016721338033676147,
0.07917041331529617,
-0.008674000389873981,
-0.05038117617368698,
-0.04234004020690918,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def validate_auto_repeat_days(self):
auto_repeat_days = self.get_auto_repeat_days()
if not len(set(auto_repeat_days)) == len(auto_repeat_days):
repeated_days = get_repeated(auto_repeat_days)
plural = "s" if len(repeated_days) > 1 else ""
frappe.throw(
_("Auto Repeat Day{0} {1} has been repeated.").for... | |
12,789 | [
0.03391433134675026,
-0.009580131620168686,
0.028951801359653473,
-0.06515824794769287,
-0.032690390944480896,
0.01779167167842388,
0.045196857303380966,
-0.0026885007973760366,
-0.017213081941008568,
0.026570677757263184,
-0.018926599994301796,
-0.026236874982714653,
-0.009257455356419086,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def get_auto_repeat_schedule(self):
schedule_details = []
start_date = getdate(self.start_date)
end_date = getdate(self.end_date)
if not self.end_date:
next_date = self.get_next_schedule_date(schedule_date=start_date)
row = {
"reference_document": self.reference_document,
"frequency": self.freque... | |
12,790 | [
0.02934209816157818,
0.04518081992864609,
0.03285667672753334,
-0.019307054579257965,
-0.0204053595662117,
-0.024023987352848053,
0.029642686247825623,
0.024255208671092987,
0.007925140671432018,
0.014705732464790344,
0.0034770038910210133,
-0.022648215293884277,
-0.003263123333454132,
-0.... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def create_documents(self):
try:
new_doc = self.make_new_document()
if self.notify_by_email and self.recipients:
self.send_notification(new_doc)
except Exception:
error_log = self.log_error("Auto repeat failed")
self.disable_auto_repeat()
if self.reference_document and not frappe.flags.in_test:... | |
12,791 | [
0.02781534753739834,
0.04657156765460968,
0.011100620031356812,
-0.007368515245616436,
-0.0034795766696333885,
0.025539932772517204,
0.02400881238281727,
0.037363581359386444,
-0.03466285765171051,
-0.025986509397625923,
0.013641854748129845,
0.01333350408822298,
0.0030489491764456034,
-0.... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def make_new_document(self):
reference_doc = frappe.get_doc(self.reference_doctype, self.reference_document)
new_doc = frappe.copy_doc(reference_doc, ignore_no_copy=False)
self.update_doc(new_doc, reference_doc)
new_doc.insert(ignore_permissions=True)
if self.submit_on_creation:
new_doc.submit()
return... | |
12,792 | [
0.005282188765704632,
0.05015714839100838,
0.03362353891134262,
-0.012416898272931576,
-0.039097655564546585,
0.045528627932071686,
0.047709375619888306,
0.020539063960313797,
-0.008183359168469906,
0.005638228729367256,
0.016110815107822418,
0.0016703287838026881,
-0.026146695017814636,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "new_doc", "annotation": null, "type_comment": null}}, {"_type": "... | def update_doc(self, new_doc, reference_doc):
new_doc.docstatus = 0
if new_doc.meta.get_field("set_posting_time"):
new_doc.set("set_posting_time", 1)
if new_doc.meta.get_field("auto_repeat"):
new_doc.set("auto_repeat", self.name)
for fieldname in [
"naming_series",
"ignore_pricing_rule",
"posti... | |
12,793 | [
0.011870376765727997,
-0.02689165621995926,
0.041496776044368744,
-0.03442211076617241,
-0.0321035236120224,
0.05025588721036911,
0.0321035236120224,
0.0046594697050750256,
-0.005068195052444935,
0.000522053858730942,
-0.02016378752887249,
-0.00992831215262413,
0.0052118683233857155,
-0.02... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "schedule_date", "annotation": null, "type_comment": null}}], "kwa... | def get_offset_for_weekly_frequency(self, schedule_date):
# if weekdays are not set, offset is 7 from current schedule date
if not self.repeat_on_days:
return 7
repeat_on_days = self.get_auto_repeat_days()
current_schedule_day = getdate(schedule_date).weekday()
weekdays = list(week_map.keys())
# if rep... | |
12,794 | [
0.004395100753754377,
0.03429070860147476,
0.05421367660164833,
-0.029270924627780914,
-0.039020463824272156,
0.05764944106340408,
0.047832973301410675,
0.011835537850856781,
-0.012136724777519703,
0.03295210003852844,
0.013620349578559399,
-0.023336423560976982,
-0.020993856713175774,
-0.... | 12 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "new_doc", "annotation": null, "type_comment": null}}], "kwarg": n... | def set_auto_repeat_period(self, new_doc):
mcount = month_map.get(self.frequency)
if mcount and new_doc.meta.get_field("from_date") and new_doc.meta.get_field("to_date"):
last_ref_doc = frappe.get_all(
doctype=self.reference_doctype,
fields=["name", "from_date", "to_date"],
filters=[
["auto_repe... | |
12,795 | [
0.001294272835366428,
-0.0042741429060697556,
0.06114006042480469,
0.007574574090540409,
-0.007710441015660763,
0.0042401766404509544,
-0.021274477243423462,
0.05131236091256142,
-0.014164114370942116,
0.0016445544315502048,
-0.011661900207400322,
-0.014401881024241447,
0.026607248932123184,... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def fetch_linked_contacts(self):
if self.reference_doctype and self.reference_document:
res = get_contacts_linking_to(
self.reference_doctype, self.reference_document, fields=["email_id"]
)
res += get_contacts_linked_from(
self.reference_doctype, self.reference_document, fields=["email_id"]
)
e... | |
12,796 | [
0.034676555544137955,
0.027044277638196945,
0.029277516528964043,
0.017780017107725143,
-0.051536280661821365,
-0.023338573053479195,
-0.008294886909425259,
0.025424566119909286,
-0.0033713318407535553,
0.028958482667803764,
0.0019893618300557137,
-0.010454502888023853,
0.0042732167057693005... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "error_log", "annotation": null, "type_comment": null}}], "kwarg":... | def notify_error_to_user(self, error_log):
recipients = list(get_system_managers(only_name=True))
recipients.append(self.owner)
subject = _("Auto Repeat Document Creation Failed")
form_link = frappe.utils.get_link_to_form(self.reference_doctype, self.reference_document)
auto_repeat_failed_for = _("Auto Repea... | |
12,797 | [
-0.0003321245894767344,
0.03974593058228493,
0.060952067375183105,
-0.04617505148053169,
-0.005877787712961435,
0.021654678508639336,
0.04313492402434349,
0.027460824698209763,
-0.05701485276222229,
0.034537844359874725,
0.022888174280524254,
-0.03289318457245827,
0.0019499178742989898,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields":... | def make_auto_repeat_entry():
enqueued_method = "frappe.automation.doctype.auto_repeat.auto_repeat.create_repeated_entries"
jobs = get_jobs()
if not jobs or enqueued_method not in jobs[frappe.local.site]:
date = getdate(today())
data = get_auto_repeat_entries(date)
frappe.enqueue(enqueued_method, data=data) | |
12,798 | [
-0.0033565929625183344,
-0.013353174552321434,
0.044127169996500015,
-0.03390054404735565,
-0.008313057012856007,
0.022398199886083603,
0.046511292457580566,
0.010906312614679337,
0.001709666452370584,
0.03170464187860489,
0.007884333841502666,
-0.014419755898416042,
0.00576162850484252,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "current_schedule_day", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "weekdays", "annotation": null, "type_comment": nu... | def get_next_weekday(current_schedule_day, weekdays):
days = list(week_map.keys())
if current_schedule_day > 0:
days = days[(current_schedule_day + 1) :] + days[:current_schedule_day]
else:
days = days[(current_schedule_day + 1) :]
for entry in days:
if entry in weekdays:
return entry | |
12,799 | [
0.024095354601740837,
0.034791890531778336,
0.04393461346626282,
-0.04348423331975937,
-0.006181471981108189,
0.03418387845158577,
0.04051172360777855,
0.00036523042945191264,
-0.03780943900346756,
0.02636977657675743,
-0.008326409384608269,
-0.01253183651715517,
0.005646645091474056,
-0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def create_repeated_entries(data):
for d in data:
doc = frappe.get_doc("Auto Repeat", d.name)
current_date = getdate(today())
schedule_date = getdate(doc.next_schedule_date)
if schedule_date == current_date and not doc.disabled:
doc.create_documents()
schedule_date = doc.get_next_schedule_date(schedule... | |
12,800 | [
-0.0016046402743086219,
0.042827390134334564,
0.03907722234725952,
-0.03004574589431286,
-0.037612657994031906,
0.026184622198343277,
0.009059214033186436,
0.007195223588496447,
-0.05157039314508438,
0.0033008158206939697,
-0.0036641829647123814,
-0.02285606972873211,
-0.004879104904830456,
... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "doctype", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "docname", "annotation": null, "type_comment": null}}, {"_type"... | def make_auto_repeat(doctype, docname, frequency="Daily", start_date=None, end_date=None):
if not start_date:
start_date = getdate(today())
doc = frappe.new_doc("Auto Repeat")
doc.reference_doctype = doctype
doc.reference_document = docname
doc.frequency = frequency
doc.start_date = start_date
if end_date:
d... |