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 |
|---|---|---|---|---|---|
11,501 | [
-0.008484089747071266,
-0.02562444470822811,
0.0249832384288311,
0.01854744367301464,
0.027928031980991364,
-0.005901459138840437,
0.03381761536002159,
0.06934511661529541,
0.04167831316590309,
-0.000560683140065521,
-0.0003482469473965466,
-0.04139333218336105,
0.016208233311772346,
-0.01... | 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": "request", "annotation": null, "type_comment": null}}], "kwarg": n... | def initial_context(self, request):
return {
'form': PreferencesForm(request.POST or {
'timeout_period': request.secure_session.get('timeout_period', 15),
}),
'has_pin': 'pin' in request.secure_session,
'session_key': request.secure_session.session... | |
11,502 | [
0.014744698069989681,
-0.01441963855177164,
0.014900727197527885,
-0.022377094253897667,
0.0021437671966850758,
-0.013626493513584137,
0.017215149477124214,
0.008984643965959549,
-0.012371763586997986,
0.012176727876067162,
0.023508302867412567,
-0.03476836159825325,
0.038903120905160904,
... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "secure"}}, "targets": [{"_type": "Name", "_fields": {"id": "app_name", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}... | class IndexView(SecureView):
app_name = 'secure'
def initial_context(self, request):
return {
'form': PreferencesForm(request.POST or {
'timeout_period': request.secure_session.get('timeout_period', 15),
}),
'has_pin': 'pin' in request.secure_sess... | |
11,503 | [
0.022989768534898758,
-0.017037641257047653,
0.008512322790920734,
0.0033659411128610373,
0.008330379612743855,
-0.023522600531578064,
0.00598461739718914,
0.04299047589302063,
0.02983861416578293,
0.033919330686330795,
0.01330131571739912,
-0.03178800269961357,
0.01011731754988432,
0.0148... | 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": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def handle_POST(self, request, context):
forms = context['form'], context['user_sessions'], context['external_service_tokens']
if not all(form.is_valid() for form in forms):
return self.render(request, context, 'auth/index')
if context['has_pin'] and form.cleane... | |
11,504 | [
-0.013331480324268341,
-0.010006922297179699,
-0.007025900762528181,
-0.026818107813596725,
0.017841799184679985,
-0.004803987219929695,
0.004360713064670563,
0.02422495186328888,
0.03196009248495102,
0.030098337680101395,
0.04073692485690117,
-0.032580677419900894,
-0.013143088668584824,
... | 12 | {"_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": "request", "annotation"... | class ClearSessionView(SecureView):
def initial_context(self, request):
return {
'return_url': request.REQUEST.get('return_url', '/'),
'suppress_clear_session_link': True,
}
@BreadcrumbFactory
def breadcrumb(self, request, context):
return Breadcrumb... | |
11,505 | [
0.05546754226088524,
0.027885183691978455,
0.08867741376161575,
-0.0427236370742321,
-0.0026307967491447926,
-0.006419270299375057,
0.02428913116455078,
0.006201614625751972,
0.03278086334466934,
0.04524718225002289,
-0.006996531505137682,
0.00005446324939839542,
0.01693299412727356,
-0.05... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []... | def main_run(args):
with common.temporary_file() as tempfile_path:
rc = common.run_command([
sys.executable,
os.path.join(common.SRC_DIR, 'third_party', 'WebKit',
'Tools', 'Scripts', 'test-webkitpy'),
'--write-full-results-to', tempfile_path,
])
with open(temp... | |
11,506 | [
-0.002334895310923457,
-0.006190409418195486,
0.01762520708143711,
-0.010964960791170597,
-0.008736413903534412,
0.011523684486746788,
-0.0015190312406048179,
0.006634848657995462,
0.0032285365741699934,
0.03022189624607563,
-0.014514128677546978,
-0.005949141923338175,
-0.02783462032675743,... | 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": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def breadcrumb(self, request, context):
return Breadcrumb(
self.conf.local_name,
static_parent(context['return_url'], 'Back'),
_('Clear session'),
lazy_reverse('auth:clear-session'),
) | |
11,507 | [
0.030767135322093964,
-0.02611600048840046,
0.06904572993516922,
0.010496145114302635,
-0.00600357074290514,
-0.007094846572726965,
0.05103812739253044,
0.029523516073822975,
0.0029831312131136656,
0.00991786178201437,
-0.01042774599045515,
-0.008668025024235249,
-0.022322962060570717,
-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 setUp(self):
super().setUp()
self.mail_composer_obj = self.env['mail.compose.message']
self.partner_obj = self.env['res.partner']
self.mail_obj = self.env['mail.mail']
self.config_obj = self.env['ir.config_parameter']
self.priorities_key = "mail.sending.job.priorities... | |
11,508 | [
0.020955635234713554,
-0.0252237468957901,
0.009073982946574688,
-0.014683662913739681,
-0.01829514093697071,
0.032310850918293,
-0.012555267661809921,
0.011440124362707138,
0.006124796811491251,
0.0008377725607715547,
-0.00045957203838042915,
-0.01222695130854845,
0.0072852252051234245,
-... | 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 ImageTest(BaseIntegrationTest):
def test_tag_and_remove(self):
repo = 'dockersdk.tests.images.test_tag'
tag = 'some-tag'
identifier = f'{repo}:{tag}'
client = docker.from_env(version=TEST_API_VERSION)
image = client.images.pull('alpine:latest')
result = image... | |
11,509 | [
0.028390580788254738,
0.03940818831324577,
0.058400675654411316,
-0.0173361673951149,
-0.017127593979239464,
0.0026961236726492643,
0.01722574606537819,
-0.03700345382094383,
0.007152855861932039,
0.026795603334903717,
0.04981233924627304,
-0.024022798985242844,
-0.05992203950881958,
0.017... | 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):
super(SalesInvoice, self).validate()
self.validate_posting_time()
self.so_dn_required()
self.validate_proj_cust()
self.validate_with_previous_doc()
self.validate_uom_is_integer("stock_uom", "qty")
self.check_close_sales_order("sales_order")
self.validate_debit_to_acc()
self.clear_u... | |
11,510 | [
0.03139546513557434,
-0.05230236425995827,
-0.020754719153046608,
-0.01138407550752163,
-0.04256298020482063,
0.024278223514556885,
-0.0192563533782959,
0.000589689239859581,
-0.0010315903928130865,
0.006210027728229761,
0.019080763682723045,
-0.018308168277144432,
0.0010111049050465226,
-... | 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_tag_and_remove(self):
repo = 'dockersdk.tests.images.test_tag'
tag = 'some-tag'
identifier = f'{repo}:{tag}'
client = docker.from_env(version=TEST_API_VERSION)
image = client.images.pull('alpine:latest')
result = image.tag(repo, tag)
assert result is Tr... | |
11,511 | [
0.014173227362334728,
0.035763733088970184,
0.05664104223251343,
-0.00750156631693244,
-0.03864246979355812,
0.048912547528743744,
0.05456627905368805,
0.04455554485321045,
0.0013729098718613386,
-0.008052675053477287,
0.06836345791816711,
-0.019645415246486664,
-0.030084069818258286,
-0.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 on_submit(self):
self.validate_pos_paid_amount()
if not self.recurring_id:
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
self.company, self.base_grand_total, self)
self.check_prev_docstatus()
if self.is_return:
# NOTE status updating bypassed for is_return
... | |
11,512 | [
0.025029568001627922,
-0.00389814842492342,
-0.004826426040381193,
-0.03547808527946472,
-0.0367116779088974,
0.01808444783091545,
0.02123010717332363,
0.003765537403523922,
0.019145337864756584,
0.0019012725679203868,
-0.0029328633099794388,
-0.01393958181142807,
-0.003928988240659237,
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 update_status_updater_args(self):
if cint(self.update_stock):
self.status_updater.extend([{
'source_dt':'Sales Invoice Item',
'target_dt':'Sales Order Item',
'target_parent_dt':'Sales Order',
'target_parent_field':'per_delivered',
'target_field':'delivered_qty',
'target_ref_field':'qty'... | |
11,513 | [
-0.006647379137575626,
-0.009962639771401882,
0.02391483075916767,
-0.038299690932035446,
0.002399349818006158,
0.018542984500527382,
0.04863881319761276,
-0.011575317941606045,
0.013204853050410748,
-0.010322261601686478,
0.02953391708433628,
-0.014047715812921524,
-0.010232356376945972,
... | 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": "sales_invoice", "annotation": null, "type_comment": null}}], "kwa... | def update_time_sheet(self, sales_invoice):
for d in self.timesheets:
if d.time_sheet:
timesheet = frappe.get_doc("Timesheet", d.time_sheet)
self.update_time_sheet_detail(timesheet, d, sales_invoice)
timesheet.calculate_total_amounts()
timesheet.calculate_percentage_billed()
timesheet.flags.ign... | |
11,514 | [
-0.007073639426380396,
0.003491293406113982,
0.021488383412361145,
-0.034736517816782,
-0.006618376821279526,
-0.036238886415958405,
0.01035721879452467,
-0.0403590090572834,
0.016639839857816696,
-0.008610149845480919,
0.030115606263279915,
0.00037523580249398947,
-0.04475229233503342,
-0... | 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": "for_validate", "annotation": null, "type_comment": null}}], "kwar... | def set_missing_values(self, for_validate=False):
pos = self.set_pos_fields(for_validate)
if not self.debit_to:
self.debit_to = get_party_account("Customer", self.customer, self.company)
if not self.due_date and self.customer:
self.due_date = get_due_date(self.posting_date, "Customer", self.customer, self.... | |
11,515 | [
0.00009470790973864496,
-0.05735624209046364,
0.030713634565472603,
0.0026150692719966173,
-0.020456908270716667,
-0.009380323812365532,
0.00393249886110425,
0.045685965567827225,
0.04408017173409462,
0.004316984675824642,
0.02438092604279518,
-0.013592706061899662,
-0.0252629816532135,
-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 set_paid_amount(self):
paid_amount = 0.0
base_paid_amount = 0.0
for data in self.payments:
data.base_amount = flt(data.amount*self.conversion_rate, self.precision("base_paid_amount"))
paid_amount += data.amount
base_paid_amount += data.base_amount
self.paid_amount = paid_amount
self.base_paid_am... | |
11,516 | [
0.007093571592122316,
0.015266100876033306,
0.017240364104509354,
-0.013280360028147697,
0.02908593975007534,
-0.0002575437247287482,
-0.009905748069286346,
0.05711587890982628,
0.015334970317780972,
0.01898506097495556,
0.03787829354405403,
-0.0421711690723896,
-0.014841404743492603,
-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 validate_debit_to_acc(self):
account = frappe.db.get_value("Account", self.debit_to,
["account_type", "report_type", "account_currency"], as_dict=True)
if not account:
frappe.throw(_("Debit To is required"))
if account.report_type != "Balance Sheet":
frappe.throw(_("Debit To account must be a Balan... | |
11,517 | [
0.028569282963871956,
0.033486947417259216,
0.011538946069777012,
-0.043907709419727325,
-0.0059655942022800446,
0.02080640010535717,
0.01690739579498768,
-0.00786240678280592,
-0.00011205613554921001,
0.020185837522149086,
0.02561868540942669,
-0.020548807457089424,
-0.033767957240343094,
... | 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_with_previous_doc(self):
super(SalesInvoice, self).validate_with_previous_doc({
"Sales Order": {
"ref_dn_field": "sales_order",
"compare_fields": [["customer", "="], ["company", "="], ["project", "="],
["currency", "="]],
},
"Delivery Note": {
"ref_dn_field": "delivery_note",
... | |
11,518 | [
0.0019104512175545096,
0.01764429546892643,
0.003434553276747465,
-0.003948671277612448,
0.028060512617230415,
-0.008603114634752274,
0.04137282818555832,
0.013616528362035751,
-0.00272726034745574,
0.022304821759462357,
0.02068641409277916,
-0.006102492101490498,
-0.01154788676649332,
-0.... | 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 update_current_stock(self):
for d in self.get('items'):
if d.item_code and d.warehouse:
bin = frappe.db.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
for d in self.get('pac... | |
11,519 | [
-0.03644060343503952,
-0.02201760746538639,
0.05593418702483177,
-0.03673357143998146,
-0.04216473177075386,
0.008073498494923115,
0.03941534832119942,
0.03736457601189613,
0.02454163134098053,
-0.011172189377248287,
0.020969685167074203,
-0.024226129055023193,
0.014546944759786129,
0.0075... | 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 set_billing_hours_and_amount(self):
for timesheet in self.timesheets:
ts_doc = frappe.get_doc('Timesheet', timesheet.time_sheet)
if not timesheet.billing_hours and ts_doc.total_billable_hours:
timesheet.billing_hours = ts_doc.total_billable_hours
if not timesheet.billing_amount and ts_doc.total_bill... | |
11,520 | [
-0.018188657239079475,
-0.03052375093102455,
0.06732718646526337,
-0.013277046382427216,
-0.01971372216939926,
0.014723616652190685,
0.01565435528755188,
-0.015340371057391167,
0.01939973793923855,
-0.04128892347216606,
0.005713391117751598,
-0.007176782004535198,
0.017246704548597336,
-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 add_timesheet_data(self):
self.set('timesheets', [])
if self.project:
for data in get_projectwise_timesheet_data(self.project):
self.append('timesheets', {
'time_sheet': data.parent,
'billing_hours': data.billing_hours,
'billing_amount': data.billing_amt,
'timesheet_detail': data.... | |
11,521 | [
0.05428310111165047,
0.02782658487558365,
0.04644063487648964,
0.031795062124729156,
0.011444805189967155,
-0.010564889758825302,
0.008917262777686119,
0.04334616661071777,
0.03361394628882408,
-0.0358816497027874,
0.014326675795018673,
-0.009850327856838703,
0.03094467520713806,
-0.044172... | 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 set_income_account_for_fixed_assets(self):
disposal_account = depreciation_cost_center = None
for d in self.get("items"):
if d.is_fixed_asset:
if not disposal_account:
disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(self.company)
d.income_account = disposal_acc... | |
11,522 | [
-0.027618408203125,
-0.006687600165605545,
-0.0113432751968503,
0.0037350610364228487,
0.04605698585510254,
-0.0336681567132473,
-0.00424139853566885,
0.01533479243516922,
-0.03887619823217392,
-0.02429104782640934,
0.02872314490377903,
0.01520327664911747,
0.0256456658244133,
-0.024527776... | 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 get_warehouse(self):
user_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile`
where ifnull(user,'') = %s and company = %s""", (frappe.session['user'], self.company))
warehouse = user_pos_profile[0][1] if user_pos_profile else None
if not warehouse:
global_pos_profile = frappe.db... | |
11,523 | [
-0.015833215788006783,
0.019245127215981483,
0.05697043612599373,
-0.026105377823114395,
0.011656355112791061,
0.0009265891276299953,
-0.004009907599538565,
0.006775256246328354,
0.002284220652654767,
-0.0009205181268043816,
-0.01087926421314478,
-0.006080124527215958,
0.04300709441304207,
... | 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": "gl_entries", "annotation": null, "type_comment": null}}], "kwarg"... | def make_tax_gl_entries(self, gl_entries):
for tax in self.get("taxes"):
if flt(tax.base_tax_amount_after_discount_amount):
account_currency = get_account_currency(tax.account_head)
gl_entries.append(
self.get_gl_dict({
"account": tax.account_head,
"against": self.customer,
"credit":... | |
11,524 | [
-0.0027849653270095587,
0.016234736889600754,
0.0772329717874527,
-0.009488330222666264,
-0.004913144279271364,
-0.02430747076869011,
0.005907888524234295,
0.024741075932979584,
-0.012058086693286896,
0.008582858368754387,
0.02034124545753002,
-0.02081311121582985,
0.0334642194211483,
-0.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": "gl_entries", "annotation": null, "type_comment": null}}], "kwarg"... | def make_customer_gl_entry(self, gl_entries):
if self.grand_total:
# Didnot use base_grand_total to book rounding loss gle
grand_total_in_company_currency = flt(self.grand_total * self.conversion_rate,
self.precision("grand_total"))
gl_entries.append(
self.get_gl_dict({
"account": self.debit_to... | |
11,525 | [
0.003917850088328123,
0.03266463801264763,
0.06782042980194092,
-0.017959194257855415,
-0.00869362335652113,
-0.026157129555940628,
0.024924261495471,
-0.018505724146962166,
0.004778950475156307,
-0.003584213089197874,
0.008185223676264286,
-0.026995986700057983,
0.04359521344304085,
-0.01... | 14 | {"_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": "gl_entries", "annotation": null, "type_comment": null}}], "kwarg"... | def make_item_gl_entries(self, gl_entries):
# income account gl entries
for item in self.get("items"):
if flt(item.base_net_amount):
if item.is_fixed_asset:
asset = frappe.get_doc("Asset", item.asset)
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount)
for g... | |
11,526 | [
-0.008040251210331917,
0.022255126386880875,
0.05377820506691933,
-0.043402910232543945,
-0.008762429468333721,
0.003956934902817011,
0.030379630625247955,
0.0003908037324436009,
-0.0014263020129874349,
-0.00933415349572897,
0.03326834365725517,
-0.028333459049463272,
0.0292722899466753,
-... | 14 | {"_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": "gl_entries", "annotation": null, "type_comment": null}}], "kwarg"... | def make_pos_gl_entries(self, gl_entries):
if cint(self.is_pos):
for payment_mode in self.payments:
if payment_mode.amount:
# POS, make payment entries
gl_entries.append(
self.get_gl_dict({
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
"... | |
11,527 | [
0.03838193044066429,
0.035553786903619766,
0.06610782444477081,
-0.03454373776912689,
0.027927905321121216,
-0.0015403274446725845,
0.014633110724389553,
0.004545228555798531,
-0.01600930467247963,
0.009140959940850735,
0.0533306822180748,
-0.022524133324623108,
0.0019254093058407307,
-0.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": "gl_entries", "annotation": null, "type_comment": null}}], "kwarg"... | def make_write_off_gl_entry(self, gl_entries):
# write off entries, applicable if only pos
if self.write_off_account and self.write_off_amount:
write_off_account_currency = get_account_currency(self.write_off_account)
default_cost_center = frappe.db.get_value('Company', self.company, 'cost_center')
gl_ent... | |
11,528 | [
0.03983069211244583,
0.001282167504541576,
0.035710275173187256,
-0.006499020382761955,
-0.0027890847995877266,
-0.029017720371484756,
0.031864553689956665,
0.02298692986369133,
0.007878735661506653,
0.016743874177336693,
0.04155377671122551,
-0.0135599160566926,
0.009039944037795067,
0.04... | 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": "gl_entries", "annotation": null, "type_comment": null}}], "kwarg"... | def make_gle_for_change_amount(self, gl_entries):
if cint(self.is_pos) and self.change_amount:
if self.account_for_change_amount:
gl_entries.append(
self.get_gl_dict({
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
"against": self.account_for_change_amo... | |
11,529 | [
0.026852115988731384,
0.01560896635055542,
0.030020853504538536,
0.003007366554811597,
-0.01692340523004532,
0.02546725980937481,
0.01932929828763008,
0.012123354710638523,
0.013531683012843132,
0.005636245012283325,
0.028706414625048637,
0.005213746801018715,
-0.04398677125573158,
0.01244... | 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": "update_modified", "annotation": null, "type_comment": null}}], "k... | def update_billing_status_in_dn(self, update_modified=True):
updated_delivery_notes = []
for d in self.get("items"):
if d.dn_detail:
billed_amt = frappe.db.sql("""select sum(amount) from `tabSales Invoice Item`
where dn_detail=%s and docstatus=1""", d.dn_detail)
billed_amt = billed_amt and billed_am... | |
11,530 | [
0.024120943620800972,
0.02061244286596775,
0.01579921692609787,
-0.009686751291155815,
0.023638524115085602,
-0.01871565915644169,
0.053504638373851776,
0.03596213459968567,
0.04063282534480095,
-0.012115292251110077,
0.00797087512910366,
-0.030216963961720467,
0.023682380095124245,
-0.042... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "mode_of_payment", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "company", "annotation": null, "type_comment": null}}],... | def get_bank_cash_account(mode_of_payment, company):
account = frappe.db.get_value("Mode of Payment Account",
{"parent": mode_of_payment, "company": company}, "default_account")
if not account:
frappe.throw(_("Please set default Cash or Bank account in Mode of Payment {0}")
.format(mode_of_payment))
return {
... | |
11,531 | [
0.015914687886834145,
0.021986186504364014,
0.005536793265491724,
-0.06168091297149658,
-0.049307931214571,
-0.024814952164888382,
-0.0052723148837685585,
-0.016719620674848557,
-0.0033490986097604036,
-0.03530208766460419,
0.01747855730354786,
0.03143840655684471,
-0.026769790798425674,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "source_name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "target_doc", "annotation": null, "type_comment": null}}], ... | def make_delivery_note(source_name, target_doc=None):
def set_missing_values(source, target):
target.ignore_pricing_rule = 1
target.run_method("set_missing_values")
target.run_method("calculate_taxes_and_totals")
def update_item(source_doc, target_doc, source_parent):
target_doc.base_amount = (flt(source_doc... | |
11,532 | [
-0.008195659145712852,
-0.03511236980557442,
-0.0323309563100338,
0.01004993449896574,
0.019291596487164497,
-0.015749454498291016,
-0.004014625214040279,
-0.02000477910041809,
0.000936052470933646,
-0.013633678667247295,
-0.007244748994708061,
-0.017948435619473457,
0.052965711802244186,
... | 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": "size", "annotation": n... | class BitArray(object):
def __init__(self, size):
self._size = size
self._size_elements = size >> 3
if size % 8:
self._size_elements += 1
self._array = None
self.clear()
@property
def size(self):
return self._size
@property
def size_byt... | |
11,533 | [
0.012355313636362553,
0.007995652966201305,
0.026452137157320976,
0.013908552937209606,
0.041819795966148376,
-0.017803417518734932,
-0.004139029886573553,
0.035748038440942764,
-0.0145204346626997,
-0.016697322949767113,
0.013920320197939873,
0.0008648719522170722,
0.009554775431752205,
-... | 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 hash(self) -> int:
# noddy xor hash
val = 0
array = ptr8(self._array)
idx = int(self._size_elements)
while idx:
val = val ^ array[idx]
idx -= 1
return val | |
11,534 | [
0.08120550960302353,
-0.024534430354833603,
0.010253275744616985,
0.01683502458035946,
0.00097659882158041,
-0.0050996411591768265,
0.003415058832615614,
-0.045267753303050995,
-0.029631372541189194,
0.05304274708032608,
0.0026888526044785976,
-0.03554900735616684,
-0.017601726576685905,
-... | 7 | {"_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": "size", "annotation": null, "type_comment": null}}], "kwarg": null... | def __init__(self, size):
self._size = size
self._size_elements = size >> 3
if size % 8:
self._size_elements += 1
self._array = None
self.clear() | |
11,535 | [
0.023094696924090385,
0.0014484655112028122,
0.02323601208627224,
0.016533704474568367,
0.0006466364138759673,
-0.0138487434014678,
0.0570099875330925,
-0.0694052204489708,
-0.029413439333438873,
0.043080493807792664,
0.004340349696576595,
-0.010376463644206524,
-0.010517777875065804,
-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": "width", "annotation": null, "type_comment": null}}, {"_type": "ar... | def __init__(self, width, height, pixel_width = PIXEL_WIDTH, pixel_height = PIXEL_HEIGHT, colour_fore = None, colour_back = None):
self._width = width // pixel_width
self._height = height // pixel_height
self._colour_fore = colour_fore
self._colour_back = colour_back
self._pixel_... | |
11,536 | [
-0.01833687722682953,
-0.009864609688520432,
0.029317988082766533,
0.01917753741145134,
0.0028191637247800827,
-0.00557921826839447,
0.04245328903198242,
-0.04471255838871002,
-0.021528756245970726,
0.0232100747525692,
0.009805501438677311,
-0.03328485041856766,
-0.002535112900659442,
0.00... | 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": "width", "annotation": ... | class Grid:
def __init__(self, width, height, pixel_width = PIXEL_WIDTH, pixel_height = PIXEL_HEIGHT, colour_fore = None, colour_back = None):
self._width = width // pixel_width
self._height = height // pixel_height
self._colour_fore = colour_fore
self._colour_back = colour_back
... | |
11,537 | [
0.04481871426105499,
-0.008936125785112381,
0.0743822306394577,
-0.011355915106832981,
-0.02318526804447174,
0.01561027392745018,
0.04860621318221092,
-0.0342978909611702,
-0.010126293636858463,
0.06038953736424446,
-0.01401899941265583,
-0.021212613210082054,
-0.03603382408618927,
0.00398... | 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 next_generation(self):
for x in range(0, self._width):
if x == 0:
x_down = self._width - 1
else:
x_down = x - 1
if x == self._width - 1:
x_up = 0
else:
x_up = x + 1
for y in range(0,... | |
11,538 | [
-0.0039934925734996796,
-0.02299562282860279,
0.06302248686552048,
0.019329654052853584,
-0.011015144176781178,
0.010187715291976929,
0.03987746685743332,
-0.03443022817373276,
-0.011894287541508675,
0.03098260797560215,
-0.03459111601114273,
-0.021271811798214912,
0.016491113230586052,
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": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ... | def add_glider(self, x = None, y = None):
if x is None:
x = self._width // 2
if y is None:
y = self._height // 2
self.set_cell(x + 2, y, display_buffer = True)
self.set_cell(x, y + 1, display_buffer = True)
self.set_cell(x + 2, y + 1, display_buffer = Tru... | |
11,539 | [
-0.006798761431127787,
0.012551559135317802,
0.062271300703287125,
-0.0028505539521574974,
-0.027924787253141403,
0.001696649705991149,
0.022694971412420273,
-0.026878824457526207,
-0.013658334501087666,
0.03612222149968147,
0.0047007533721625805,
-0.0016251958440989256,
-0.01467997301369905... | 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 display_text(self):
idx = 0
for y in range(self._height):
line = ""
for x in range(self._width):
line += '.' if self._cells_display.test_bit(idx) else '0'
idx += 1
print(line) | |
11,540 | [
0.01158304326236248,
-0.010968457907438278,
0.022702012211084366,
0.04490232095122337,
-0.019616544246673584,
-0.006885858718305826,
0.028496669605374336,
-0.027794286608695984,
0.01281221304088831,
0.009105890057981014,
0.02119690552353859,
-0.004562351852655411,
-0.020657576620578766,
-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 display_badge(self):
x = 0
y = 0
x_pixel = 0
y_pixel = 0
block_idx = 0
block_idx_limit = self._cells_display.size_bytes
cells = self._cells_display
width = self._width
colour_fore = self._colour_fore
colour_back = self._colour_back
... | |
11,541 | [
0.002170310355722904,
0.016132444143295288,
-0.007392065599560738,
0.013506782241165638,
-0.014701339416205883,
-0.011951491236686707,
-0.033187415450811386,
-0.0014318430330604315,
-0.026091033592820168,
0.01876993291079998,
0.036972153931856155,
-0.019999971613287926,
-0.02115904726088047,... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rot", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def quaternionToString(rot):
def shorthexfloat(f):
s=f.hex()
mantisse, exponent = f.hex().split('p',1)
return '%sp%s' % (mantisse.rstrip('0'),exponent)
x,y,z,w=rot.Q
return 'q=%s+%s*i+%s*j+%s*k' % (shorthexfloat(w),shorthexfloat(x),
shorthexfloat(y),shorthexfloat(z)) | |
11,542 | [
0.005646413192152977,
0.03648451715707779,
0.062432799488306046,
0.03443891927599907,
-0.0032628001645207405,
-0.01726149208843708,
0.024407077580690384,
0.01758374273777008,
-0.008266461081802845,
0.03177683800458908,
0.03858615830540657,
-0.03738121688365936,
-0.029310910031199455,
-0.00... | 10 | {"_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 do_circle_of_life():
ugfx.init()
buttons.init()
buttons.disable_menu_reset()
colour = get_colour()
grid = Grid(ugfx.width(), ugfx.height(), colour_fore = colour, colour_back = COLOUR_BACK)
grid.randomise()
ugfx.clear(COLOUR_BACK)
hash_count = 0
hash_last = None
hash_last_l... | |
11,543 | [
-0.012947983108460903,
0.027800748124718666,
-0.006802793592214584,
-0.01892310380935669,
-0.01340150274336338,
0.001791402231901884,
-0.016043255105614662,
0.00018512809765525162,
0.021939009428024292,
-0.022290486842393875,
0.005127605516463518,
-0.039592258632183075,
0.029524123296141624,... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "ob", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}... | def formatobjtype(ob):
objtype=ob.TypeId
if (ob.isDerivedFrom('Part::FeaturePython') or \
ob.isDerivedFrom('Part::Part2DObjectPython') or\
ob.isDerivedFrom('App::FeaturePython')) and \
hasattr(ob.Proxy,'__module__'):
return '%s::%s.%s' % (ob.TypeId,ob.Proxy.__module__... | |
11,544 | [
0.029115205630660057,
0.015521164983510971,
0.019961364567279816,
0.024922408163547516,
-0.009759322740137577,
0.006536597851663828,
-0.02195359393954277,
-0.04627703130245209,
0.006559384986758232,
0.03536533936858177,
-0.028307896107435226,
-0.05364697799086571,
0.004293711390346289,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "normal", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ... | def ax2_xdir(normal):
#adaped from gp_Ax2.ccc (c) OpenCascade SAS LGPL 2.1+
xa=abs(normal.x)
ya=abs(normal.y)
za=abs(normal.z)
if ya <= xa and ya <= za:
if xa > za:
return FreeCAD.Vector(-normal.z,0, normal.x)
else:
return FreeCAD.Vector( normal.z,0,-normal.x... | |
11,545 | [
0.026335639879107475,
0.03663558512926102,
0.031534429639577866,
-0.05257365107536316,
-0.07234368473291397,
-0.00809107068926096,
-0.02487119287252426,
-0.06760863959789276,
0.0051499721594154835,
-0.028556719422340393,
0.008188700303435326,
-0.03478061780333519,
0.005601510405540466,
-0.... | 14 | {"_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": "objlst", "annotation": null, "type_comment": null}}], "kwarg": nu... | def export_annotations(self,objlst):
for ob in objlst:
if ob.isDerivedFrom('App::Annotation') :
if ob.Name != ob.Label:
self.csg.write('#Annotation Name %s Label %s"\n' % \
(ob.Name,ob.Label.encode('unicode-escape')))
el... | |
11,546 | [
0.039962563663721085,
-0.008969113230705261,
-0.01740339584648609,
-0.03211124613881111,
0.019243214279413223,
-0.057034362107515335,
0.010049471631646156,
-0.0007714935345575213,
-0.05506618693470955,
-0.01914694532752037,
0.0010248696198686957,
-0.01840887777507305,
-0.015734724700450897,
... | 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": "key", "annotation": null, "type_comment": null}}, {"_type": "arg"... | def current_field_from_key(self, key, fieldname):
app_label, model_name = key.split(".")
# Special, for the magical field from order_with_respect_to
if fieldname == "_order":
field = models.IntegerField()
field.name = "_order"
field.attname = "_order"
... | |
11,547 | [
0.04799731820821762,
-0.010910796001553535,
-0.01462836004793644,
-0.041911717504262924,
-0.04519641399383545,
-0.010356981307268143,
-0.04081681743264198,
-0.0268632210791111,
0.007867995649576187,
0.009803165681660175,
-0.022127145901322365,
-0.019109807908535004,
0.03162475675344467,
-0... | 23 | {"_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 suggest_name(self):
parts = ["auto"]
for change_name, params in self.get_changes():
if change_name == "AddModel":
parts.append("add_%s" % params['model']._meta.object_name.lower())
elif change_name == "DeleteModel":
parts.append("del_%s" % para... | |
11,548 | [
0.06537900865077972,
-0.013991019688546658,
-0.010777902789413929,
-0.06507247686386108,
-0.05394972488284111,
-0.008643122389912605,
-0.029317645356059074,
-0.03930184990167618,
-0.01707824133336544,
0.004463879857212305,
-0.03395942598581314,
-0.003555229865014553,
0.029602283611893654,
... | 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 suggest_name(self):
bits = []
for model_name in self.added_models:
bits.append('add_model_%s' % model_name)
for field_name in self.added_fields:
bits.append('add_field_%s' % field_name)
for index_name in self.added_indexes:
bits.append('add_index_%... | |
11,549 | [
0.034753914922475815,
0.04096178710460663,
0.04348055645823479,
-0.040936343371868134,
-0.055209364742040634,
-0.023203197866678238,
-0.0024885558523237705,
0.009012864902615547,
-0.02719760872423649,
0.01022136490792036,
-0.0013730785576626658,
-0.04083457589149475,
-0.018369199708104134,
... | 18 | {"_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_changes(self):
# Get the frozen models for this app
model_defs = freeze_apps([self.migrations.app_label()])
for model in models.get_models(models.get_app(self.migrations.app_label())):
# Don't do anything for unmanaged, abstract or proxy models
... | |
11,550 | [
0.046740271151065826,
0.04848046973347664,
0.05034321919083595,
-0.05225498601794243,
-0.0507843978703022,
-0.03340691700577736,
0.0009083960903808475,
0.00969364307820797,
-0.029975539073348045,
0.010698546655476093,
0.013174041174352169,
-0.006007975433021784,
-0.01612747646868229,
0.003... | 14 | {"_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_changes(self):
# Get the model defs so we can use them for the yield later
model_defs = freeze_apps([self.migrations.app_label()])
# Make the model changes
for model_name in self.added_models:
model = models.get_model(self.migrations.app_label(), model_name)
... | |
11,551 | [
0.022663559764623642,
-0.018993500620126724,
-0.006143564824014902,
-0.06265585124492645,
-0.010404805652797222,
-0.02190684713423252,
0.0033200790639966726,
-0.030609047040343285,
0.015578832477331161,
0.024612095206975937,
-0.019315103068947792,
-0.0495268777012825,
0.07268229871988297,
... | 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": "template_name", "annotation": null, "type_comment": null}}, {"_ty... | def load_template_source(self, template_name, template_dirs=None):
tried = []
for filepath in self.get_template_sources(template_name, template_dirs):
try:
with io.open(filepath, encoding=self.engine.file_charset) as fp:
return fp.read(), filepath
... | |
11,552 | [
-0.014449832029640675,
-0.0049014706164598465,
0.04173823073506355,
-0.02046952024102211,
-0.019683223217725754,
0.001464640605263412,
-0.023588931187987328,
0.02977619133889675,
-0.00741182267665863,
0.0075793941505253315,
-0.008481702767312527,
0.001223756349645555,
-0.010557013563811779,
... | 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": "Call", "_fields": {"a... | def plot_synergies():
synergies = np.loadtxt('pretrained/synergies_all.csv')
for i in range(114):
synergies[i, i] = 0.5
hero_dict = get_hero_dict()
x_labels = []
for i in range(114):
if i != 23:
x_labels.append(hero_dict[i + 1])
synergies = np.delete(synergies, [2... | |
11,553 | [
-0.009679543785750866,
-0.02909429743885994,
0.05284474417567253,
-0.039633557200431824,
-0.01926012709736824,
-0.01880243606865406,
-0.014831659384071827,
0.011807188391685486,
-0.012988525442779064,
0.021486731246113777,
0.027758333832025528,
0.009221852757036686,
0.0012377755483612418,
... | 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": "Call", "_fields": {"a... | def plot_counters():
counters = np.loadtxt('pretrained/counters_all.csv')
for i in range(114):
counters[i, i] = 0.5
hero_dict = get_hero_dict()
x_labels = []
for i in range(114):
if i != 23:
x_labels.append(hero_dict[i + 1])
counters = np.delete(counters, [23], 0)... | |
11,554 | [
0.03535516932606697,
-0.02981054037809372,
0.004952115472406149,
-0.06588324904441833,
-0.023222215473651886,
0.015274912118911743,
-0.025244373828172684,
0.03787743300199509,
0.011056644842028618,
0.02615760639309883,
0.059316668659448624,
-0.04137815907597542,
0.03161526098847389,
-0.032... | 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": "index", "annotation": null, "type_comment": null}}], "kwarg": nul... | def __getitem__(self, index):
if isinstance(index, integer_types):
index = self._ith_point(index)
return self.coeff(index)
elif isinstance(index, slice):
start, stop = index.start, index.stop
if start is None:
start = 0
if stop ... | |
11,555 | [
0.03286348655819893,
0.004051343537867069,
0.03715118393301964,
0.016378479078412056,
-0.0071039991453289986,
0.07131962478160858,
0.013362442143261433,
-0.016418427228927612,
0.03491412475705147,
0.04327647015452385,
-0.005862297024577856,
-0.05435524508357048,
0.012496912851929665,
-0.01... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "periodical", "annotation": null, "type_comment": null}}, {"_type":... | def __new__(cls, periodical, limits=None):
periodical = sympify(periodical)
def _find_x(periodical):
free = periodical.free_symbols
if len(periodical.free_symbols) == 1:
return free.pop()
else:
return Dummy('k')
x, start, stop... | |
11,556 | [
0.030924281105399132,
0.0004266849427949637,
-0.00316438777372241,
0.007091427221894264,
-0.009883714839816093,
0.00040438969153910875,
0.03658265992999077,
0.003536487929522991,
0.015597449615597725,
0.05840433016419411,
0.00647023506462574,
-0.04937552288174629,
-0.008426066488027573,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "formula", "annotation": null, "type_comment": null}}, {"_type": "a... | def __new__(cls, formula, limits=None):
formula = sympify(formula)
def _find_x(formula):
free = formula.free_symbols
if len(formula.free_symbols) == 1:
return free.pop()
elif len(formula.free_symbols) == 0:
return Dummy('k')
... | |
11,557 | [
0.020912913605570793,
-0.005210374481976032,
-0.018568094819784164,
-0.011575303040444851,
0.06256020069122314,
0.020734373480081558,
0.03727902099490166,
0.020960522815585136,
0.01585429720580578,
0.04294467344880104,
-0.005350230261683464,
-0.04820563271641731,
-0.001008003600873053,
0.0... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "va... | def __new__(cls, *args, **kwargs):
evaluate = kwargs.get('evaluate', global_evaluate[0])
# flatten inputs
args = list(args)
# adapted from sympy.sets.sets.Union
def _flatten(arg):
if isinstance(arg, SeqBase):
if isinstance(arg, SeqAdd):
... | |
11,558 | [
0.046586714684963226,
0.013804810121655464,
-0.027537280693650246,
0.00284385122358799,
0.01579415053129196,
-0.0550263375043869,
-0.0016758678248152137,
-0.005540009122341871,
0.009428263641893864,
0.029080526903271675,
0.012816169299185276,
-0.03590456396341324,
0.0012147027300670743,
0.... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "formula", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def _find_x(formula):
free = formula.free_symbols
if len(formula.free_symbols) == 1:
return free.pop()
elif len(formula.free_symbols) == 0:
return Dummy('k')
else:
raise ValueError(
" specify dummy variab... | |
11,559 | [
0.021432699635624886,
0.0007846638327464461,
-0.011094643734395504,
-0.006235934793949127,
0.06227659434080124,
0.015403645113110542,
0.041092149913311005,
0.022260216996073723,
0.019978635013103485,
0.044000282883644104,
-0.004341511055827141,
-0.05395413562655449,
-0.0012457092525437474,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "va... | def __new__(cls, *args, **kwargs):
evaluate = kwargs.get('evaluate', global_evaluate[0])
# flatten inputs
args = list(args)
# adapted from sympy.sets.sets.Union
def _flatten(arg):
if isinstance(arg, SeqBase):
if isinstance(arg, SeqMul):
... | |
11,560 | [
0.006505795754492283,
-0.004775682929903269,
-0.03694719821214676,
-0.006176931317895651,
0.011534084565937519,
-0.018950214609503746,
0.019474491477012634,
0.01017096545547247,
0.005095015279948711,
0.04381045699119568,
-0.014736938290297985,
-0.010609451681375504,
0.031551916152238846,
-... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "arg", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def _flatten(arg):
if isinstance(arg, SeqBase):
if isinstance(arg, SeqAdd):
return sum(map(_flatten, arg.args), [])
else:
return [arg]
if iterable(arg):
return sum(map(_flatten, arg), [])
raise Ty... | |
11,561 | [
-0.027446385473012924,
-0.01906435377895832,
0.0451081246137619,
-0.03983428701758385,
-0.023115107789635658,
-0.016898714005947113,
0.0003567903768271208,
0.023406852036714554,
-0.001549890381284058,
-0.01761685498058796,
0.03808382526040077,
-0.02621208317577839,
-0.006839154288172722,
-... | 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs... | class DocExtensionTest(TestCase):
def setUp(self):
SERVER.reset()
# Create fake grab instance with fake response
self.g = Grab(HTML, transport=GRAB_TRANSPORT)
def test_extension_in_general(self):
self.assertTrue(self.g.doc)
def test_select_method(self):
self.assert... | |
11,562 | [
0.0021701741497963667,
0.0011900372337549925,
-0.03495440259575844,
0.0022051576524972916,
0.020150411874055862,
-0.025168713182210922,
0.023701826110482216,
0.010634939186275005,
0.007377868518233299,
0.04308019205927849,
-0.012082526460289955,
-0.01352046336978674,
0.0325031541287899,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "arg", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}... | def _flatten(arg):
if isinstance(arg, SeqBase):
if isinstance(arg, SeqMul):
return sum(map(_flatten, arg.args), [])
else:
return [arg]
elif iterable(arg):
return sum(map(_flatten, arg), [])
raise ... | |
11,563 | [
-0.014056128449738026,
-0.014000349678099155,
0.02605961449444294,
-0.05136064440011978,
0.023025276139378548,
0.010843298397958279,
0.04551508277654648,
0.03900017589330673,
-0.008913369849324226,
0.00245982245542109,
0.03435942530632019,
-0.01252780295908451,
0.04174447059631348,
-0.0163... | 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_embedding_lookup(self):
d_embed = 5
n_embed = 10
ids_shape = (2, 3, 4)
embeds = np.random.randn(n_embed, d_embed)
ids = np.random.randint(0, n_embed, ids_shape)
with self.test_session():
embed_np = embeds[ids]
embed_tf = ops.embedding_lookup(embeds, ids).eval()
self.asse... | |
11,564 | [
0.002679709577932954,
-0.03734439238905907,
0.05144210532307625,
-0.05185796692967415,
0.013421939685940742,
-0.003235924756154418,
0.021053005009889603,
0.023516986519098282,
0.012891716323792934,
0.01935836672782898,
-0.0001962347887456417,
0.0028330585919320583,
-0.018505850806832314,
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_softmax_classifier(self):
with self.test_session() as session:
features = tf.placeholder(tf.float32, [None, 3])
labels = tf.placeholder(tf.float32, [None, 2])
weights = tf.constant([[0.1, 0.1], [0.1, 0.1], [0.1, 0.1]])
biases = tf.constant([0.2, 0.3])
class_weight = tf.constan... | |
11,565 | [
-0.00530871981754899,
-0.07365187257528305,
0.012381134554743767,
-0.015720395371317863,
-0.010923147201538086,
0.008077720180153847,
0.03809579834342003,
0.0219050832092762,
0.0038007614202797413,
0.0011236203135922551,
0.04294008016586304,
-0.02925381064414978,
0.0065785800106823444,
-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_categorical_variable(self):
tf.set_random_seed(42)
with self.test_session() as sess:
cat_var_idx = tf.placeholder(tf.int64, [2, 2])
embeddings = ops.categorical_variable(cat_var_idx,
n_classes=5,
embeddi... | |
11,566 | [
-0.013903748244047165,
-0.03548245504498482,
0.02796691656112671,
-0.031200876459479332,
0.059441085904836655,
-0.008227238431572914,
0.02023502066731453,
-0.013049709610641003,
0.025894450023770332,
0.026942070573568344,
0.00883075874298811,
0.011899604462087154,
0.013323001563549042,
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_one_hot_matrix(self):
with self.test_session() as sess:
tensor_in = tf.placeholder(tf.int64, [10, 2])
one_hot_tensor = ops.one_hot_matrix(tensor_in, 3)
res = sess.run(ops.one_hot_matrix([[0, 1], [2, 1]], 3))
self.assertAllEqual(one_hot_tensor.get_shape(), [10, 2, 3])
self.assertAl... | |
11,567 | [
0.01784556917846203,
-0.004734190646559,
-0.009900311939418316,
-0.017743268981575966,
0.025029262527823448,
-0.001208412111736834,
-0.02793911285698414,
-0.02468826435506344,
0.03662319853901863,
0.02573399245738983,
0.03353148326277733,
-0.012196366675198078,
-0.045420948415994644,
0.001... | 12 | {"_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 describe_category(TestCase):
def test_can_get_values(self):
category = Category("work", (50, 100, 150), (0, 0, 0))
self.assertEqual(category.get_id(), None)
self.assertEqual(category.get_name(), "work")
self.assertEqual(category.get_color(), (50, 100, 150))
self.assert... | |
11,568 | [
0.05092253535985947,
-0.03268197923898697,
0.00217830715700984,
-0.03969031944870949,
0.007344596553593874,
-0.005073375999927521,
-0.013568330556154251,
-0.005173663608729839,
0.04389059916138649,
0.03213924542069435,
0.06276828050613403,
-0.018358541652560234,
-0.051630448549985886,
-0.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 test_can_set_values(self):
self.assertEqual(
a_category().set_id(15).get_id(),
15)
self.assertEqual(
a_category().set_name("fun").get_name(),
"fun")
self.assertEqual(
a_category().set_color((33, 66, 99)).get_color(),
(33... | |
11,569 | [
0.053890831768512726,
0.012308635748922825,
0.05719858035445213,
-0.006946268491446972,
-0.042517270892858505,
0.01634790375828743,
0.013536318205296993,
-0.005683599971234798,
0.042517270892858505,
0.00009854661038843915,
0.03221236541867256,
-0.007359737064689398,
0.0094398008659482,
-0.... | 6 | {"_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 main():
m1()
m2()
m3()
m4() | |
11,570 | [
0.001887844642624259,
-0.02283591777086258,
0.02596062608063221,
-0.0007068669656291604,
0.02755245938897133,
-0.012469355016946793,
0.031541865319013596,
0.02863333374261856,
0.01958347111940384,
0.052589431405067444,
0.012754312716424465,
0.015957629308104515,
0.00855855643749237,
-0.012... | 12 | {"_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 TestExample(unittest.TestCase):
def test_example(self):
cmd = 'cd {this_dir} && python entrypoint.py'.format(
this_dir=os.path.dirname(os.path.abspath(__file__))
)
stdout = subprocess.check_output(cmd, shell=True).decode()
expected_stdout = textwrap.dedent(
... | |
11,571 | [
0.021514661610126495,
-0.012022899463772774,
0.02210662141442299,
0.010364391840994358,
0.0016457492019981146,
-0.017666926607489586,
0.040845196694135666,
0.05184747651219368,
0.03047570213675499,
0.05956336110830307,
0.03049611486494541,
0.026229923591017723,
-0.0022989457938820124,
-0.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 test_example(self):
cmd = 'cd {this_dir} && python entrypoint.py'.format(
this_dir=os.path.dirname(os.path.abspath(__file__))
)
stdout = subprocess.check_output(cmd, shell=True).decode()
expected_stdout = textwrap.dedent(
'''
I am task_1.
... | |
11,572 | [
0.009572060778737068,
-0.029394708573818207,
0.020028628408908844,
-0.008857185952365398,
0.029540106654167175,
-0.03145451843738556,
-0.038094379007816315,
0.009244915097951889,
-0.008178659714758396,
-0.005818964913487434,
0.027698393911123276,
-0.004265019670128822,
0.03596187010407448,
... | 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 TestRobots(TestCase):
def setUp(self):
self.rf = RequestFactory()
self.view = views.Robots()
def test_production_disallow_all_is_false(self):
self.view.request = self.rf.get('/', HTTP_HOST='www.mozilla.org')
self.assertFalse(self.view.get_context_data()['disallow_all'])
... | |
11,573 | [
-0.01947065070271492,
-0.02671099454164505,
0.012719521299004555,
-0.0282275527715683,
0.03703337535262108,
-0.025854872539639473,
-0.024913137778639793,
-0.02641746588051319,
-0.017513802275061607,
0.0037975108716636896,
-0.012340381741523743,
-0.001152706565335393,
-0.012633908540010452,
... | 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": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestTechnology(TestCase):
def setUp(self):
self.rf = RequestFactory()
def test_technology_template(self, render_mock):
view = views.TechnologyView()
view.request = RequestFactory().get('/technology/')
view.request.locale = 'en-US'
assert view.get_template_names() =... | |
11,574 | [
-0.024713454768061638,
-0.0019855480641126633,
0.045747026801109314,
-0.011952999979257584,
-0.01198609173297882,
0.024183975532650948,
0.010271902196109295,
0.008577567525207996,
-0.03187466412782669,
-0.0322982482612133,
0.0484473742544651,
-0.015619644895195961,
0.0015404544537886977,
-... | 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 setUp(self):
with patch.object(update_tableau_data, 'get_external_data') as ged:
ged.return_value = (
(date(2015, 2, 2), 'Firefox', 'bugzilla', 100, 10),
(date(2015, 2, 2), 'Firefox OS', 'bugzilla', 100, 10),
(date(2015, 2, 9), 'Sumo', 'sumo', 100,... | |
11,575 | [
-0.004955328069627285,
-0.020419782027602196,
0.022921383380889893,
-0.014255545102059841,
0.040049582719802856,
-0.012124992907047272,
-0.02338819019496441,
-0.018899668008089066,
0.012591799721121788,
0.028247764334082603,
-0.007618517614901066,
-0.033250968903303146,
-0.003207796951755881... | 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": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestHomePage(TestCase):
def setUp(self):
self.rf = RequestFactory()
def test_home_en_template(self, render_mock):
req = RequestFactory().get('/')
req.locale = 'en-US'
views.home_view(req)
render_mock.assert_called_once_with(req, 'mozorg/home/home-en.html', ANY)
... | |
11,576 | [
0.0007845645304769278,
-0.01321962010115385,
0.015350209549069405,
-0.023286964744329453,
0.0345878079533577,
-0.018838893622159958,
-0.03017711639404297,
-0.024096839129924774,
-0.000340107741067186,
0.008590884506702423,
0.010790000669658184,
-0.03366579860448837,
0.0191503819078207,
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": null, "vararg": null, "defaults": [], "kwonlyargs... | class TestAboutPage(TestCase):
def setUp(self):
self.rf = RequestFactory()
@patch.object(views, 'lang_file_is_active', lambda *x: True)
def test_about_2019_template(self, render_mock):
req = RequestFactory().get('/')
req.locale = 'en-US'
views.about_view(req)
render_... | |
11,577 | [
-0.013944524340331554,
-0.05758814513683319,
0.06111297756433487,
-0.006335172336548567,
-0.00919909868389368,
-0.013908798806369305,
0.010425644926726818,
-0.010163664817810059,
0.04853789880871773,
0.024554746225476265,
0.020184431225061417,
-0.028270110487937927,
0.01888643391430378,
0.... | 8 | {"_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 WindowsTestCase(unittest.TestCase):
def test_callconv_1(self):
# Testing stdcall function
IsWindow = windll.user32.IsWindow
# ValueError: Procedure probably called with not enough arguments (4 bytes missing)
self.assertRaises(ValueError, IsWindow)
... | |
11,578 | [
0.007729890290647745,
0.013074362650513649,
0.0686546042561531,
0.02369515225291252,
0.03691718354821205,
-0.02362699806690216,
-0.0145964864641428,
0.000562987057492137,
0.028352398425340652,
-0.013926297426223755,
0.03103315271437168,
-0.06556492298841476,
0.009910844266414642,
0.0504345... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "If", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "varar... | class FunctionCallTestCase(unittest.TestCase):
if is_resource_enabled("SEH"):
def test_SEH(self):
# Call functions with invalid arguments, and make sure
# that access violations are trapped and raise an
# exception.
self.assertRaises(W... | |
11,579 | [
-0.012759135104715824,
0.02291056327521801,
0.06947674602270126,
-0.01225854828953743,
0.018731247633695602,
0.02810269221663475,
0.0010877569438889623,
-0.01573937013745308,
0.008434300310909748,
0.0073923817835748196,
0.008917424827814102,
-0.02773016318678856,
0.022701015695929527,
0.03... | 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": null, "vararg": null, "defaults": [], "kwonlyargs... | class Structures(unittest.TestCase):
def test_struct_by_value(self):
class POINT(Structure):
_fields_ = [("x", c_long),
("y", c_long)]
class RECT(Structure):
_fields_ = [("left", c_long),
("top", c_long),
... | |
11,580 | [
0.007286719977855682,
-0.05373735725879669,
0.04262819141149521,
-0.013246445916593075,
-0.019564343616366386,
-0.01783807761967182,
0.00260114180855453,
-0.008396461606025696,
0.04225240647792816,
0.01621750183403492,
0.02545948140323162,
-0.006059544626623392,
0.01998710259795189,
0.0637... | 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_callconv_1(self):
# Testing stdcall function
IsWindow = windll.user32.IsWindow
# ValueError: Procedure probably called with not enough arguments (4 bytes missing)
self.assertRaises(ValueError, IsWindow)
# This one should succeeed...
self... | |
11,581 | [
-0.030217790976166725,
0.006193886045366526,
-0.05163157358765602,
-0.057644687592983246,
0.012698575854301453,
-0.014715632423758507,
0.0004729458596557379,
-0.01005356851965189,
0.0019377698190510273,
0.017582643777132034,
0.05693427473306656,
-0.05490453541278839,
0.00447177654132247,
-... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "https?://(?:www\\.)?screencast\\.com/t/(?P<id>[a-zA-Z0-9]+)"}}, "targets": [{"_type": "Name", "_fields": {"id": "_VALID_URL", "ctx": {"_t... | class ScreencastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?screencast\.com/t/(?P<id>[a-zA-Z0-9]+)'
_TESTS = [{
'url': 'http://www.screencast.com/t/3ZEjQXlT',
'md5': '917df1c13798a3e96211dd1561fded83',
'info_dict': {
'id': '3ZEjQXlT',
'ext': 'm4v',
... | |
11,582 | [
-0.019373254850506783,
0.022269628942012787,
0.0818195566534996,
0.006165310274809599,
0.0027326266281306744,
0.011861912906169891,
-0.009109756909310818,
-0.005444221198558807,
-0.0013663133140653372,
0.013640598393976688,
0.020478924736380577,
-0.013063727878034115,
0.019829945638775826,
... | 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_struct_by_value(self):
class POINT(Structure):
_fields_ = [("x", c_long),
("y", c_long)]
class RECT(Structure):
_fields_ = [("left", c_long),
("top", c_long),
("right", c_long),
... | |
11,583 | [
-0.025593843311071396,
-0.016053076833486557,
-0.07546085119247437,
-0.04153306782245636,
0.01184056792408228,
-0.01584814488887787,
0.011692561209201813,
-0.00013350880180951208,
0.018796902149915695,
0.019673559814691544,
0.04900173470377922,
-0.03643251582980156,
0.014914561063051224,
-... | 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": "url", "annotation": null, "type_comment": null}}], "kwarg": null,... | def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_url = self._html_search_regex(
r'<embed name="Video".*?src="([^"]+)"', webpage,
'QuickTime embed', default=None)
if video_url is None:
... | |
11,584 | [
0.03002718649804592,
-0.04585128277540207,
0.0019261494744569063,
0.010160227306187153,
0.007810735143721104,
-0.03421478345990181,
0.015611820854246616,
0.031146451830863953,
-0.016692491248250008,
0.03018156811594963,
-0.030200865119695663,
-0.023485273122787476,
0.008500627242028713,
-0... | 10 | {"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "id", "value": {"_type": "Name", "_fields": {"id": "WeiboProvider", "ctx": {"_type": "Load", "_fields": {}}}}}}... | class WeiboOAuth2Adapter(OAuth2Adapter):
provider_id = WeiboProvider.id
access_token_url = 'https://api.weibo.com/oauth2/access_token'
authorize_url = 'https://api.weibo.com/oauth2/authorize'
profile_url = 'https://api.weibo.com/2/users/show.json'
def complete_login(self, request, app, token, **kwa... | |
11,585 | [
-0.005654388107359409,
-0.012440752238035202,
-0.012759463861584663,
0.0164521262049675,
0.03004683554172516,
-0.03195910528302193,
0.018847959116101265,
0.0524885468184948,
0.01242976263165474,
0.031057920306921005,
-0.013627679087221622,
-0.043256890028715134,
0.018144596368074417,
-0.04... | 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": "request", "annotation": null, "type_comment": null}}, {"_type": "... | def complete_login(self, request, app, token, **kwargs):
uid = kwargs.get('response', {}).get('uid')
resp = requests.get(self.profile_url,
params={'access_token': token.token,
'uid': uid})
extra_data = resp.json()
return sel... | |
11,586 | [
0.012061002664268017,
0.025378117337822914,
-0.0018318301299586892,
-0.031263235956430435,
0.03221695125102997,
-0.01352646667510271,
-0.012537860311567783,
0.037218138575553894,
-0.013386898674070835,
0.011967957019805908,
0.032868266105651855,
-0.0011608860222622752,
0.01061298418790102,
... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def action_auth(options):
if not (options.account):
console(
'You must specify an account (local identifier) so we know where to save your access token!'
)
return
try:
db.get_access_token(options.account, options.pin, re_auth=True, called_from_cli=True)
consol... | |
11,587 | [
0.023391570895910263,
0.03648657724261284,
0.03033427521586418,
-0.011610336601734161,
0.038558706641197205,
0.02169327810406685,
0.025079181417822838,
0.03251321613788605,
0.0018304705154150724,
0.021212629973888397,
0.03806737810373306,
-0.020870834589004517,
-0.005607568193227053,
0.009... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def action_refresh(options):
if not options.account:
console('Please specify an account')
return
try:
db.get_access_token(options.account, refresh=True)
console('Successfully refreshed your access token.')
return
except plugin.PluginError as e:
console('Author... | |
11,588 | [
-0.00965332891792059,
0.03447089344263077,
0.02444770373404026,
-0.05202688276767731,
0.016680656000971794,
0.0027415824588388205,
-0.026358643546700478,
0.025840839371085167,
0.00406845286488533,
0.025495637208223343,
0.049783069640398026,
-0.027690136805176735,
-0.0029511693865060806,
0.... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def action_list(options):
with Session() as session:
if not options.account:
# Print all accounts
accounts = session.query(db.TraktUserAuth).all()
if not accounts:
console('No trakt authorizations stored in database.')
return
he... | |
11,589 | [
0.010563813149929047,
0.059958379715681076,
0.028106970712542534,
-0.051189761608839035,
-0.0056048049591481686,
0.0394824743270874,
0.00007299466233234853,
0.019160611554980278,
0.025997763499617577,
0.032491277903318405,
0.028343960642814636,
0.0061261821538209915,
0.02931561879813671,
0... | 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 register_parser_arguments():
acc_text = 'Local identifier which should be used in your config to refer these credentials'
# Register subcommand
parser = options.register_command(
'trakt', do_cli, help='View and manage trakt authentication.'
)
# Set up our subparsers
subparsers = pars... | |
11,590 | [
0.04253069683909416,
0.019142914563417435,
0.020096471533179283,
-0.03949572145938873,
0.005598302930593491,
0.015133874490857124,
0.01178104430437088,
0.06275021284818649,
0.01982988603413105,
-0.0073977573774755,
0.04179245978593826,
-0.046344924718141556,
-0.0013688158942386508,
-0.0024... | 9 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":... | def action_delete(options):
if not options.account:
console('Please specify an account')
return
try:
db.delete_account(options.account)
console('Successfully deleted your access token.')
return
except plugin.PluginError as e:
console('Deletion failed: %s' % e) | |
11,591 | [
0.053846485912799835,
0.06246192380785942,
-0.006323970388621092,
-0.05777129530906677,
0.0421677827835083,
-0.011876141652464867,
0.03094378113746643,
-0.028048036620020866,
-0.017996691167354584,
-0.0018292847089469433,
0.022112956270575523,
-0.0018412506906315684,
0.038530152291059494,
... | 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 __open_config_for_read(self):
if os.path.isfile(self.file):
display.vvv('Opened %s' % self.file)
return open(self.file, 'r')
# config.yml not found, create and chomd u+rw
f = open(self.file,'w')
f.close()
os.chmod(self.file,S_IRUSR|S_IWUSR) # owner has... | |
11,592 | [
-0.01694869063794613,
0.025325627997517586,
0.05133882910013199,
-0.041002307087183,
0.01935519650578499,
0.030872056260704994,
0.022460738196969032,
-0.029519828036427498,
0.0007878447650000453,
0.030046967789530754,
0.018530109897255898,
-0.03188049793243408,
-0.021555433049798012,
0.007... | 12 | {"_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 Module(TermineterModule):
def __init__(self, *args, **kwargs):
TermineterModule.__init__(self, *args, **kwargs)
self.version = 1
self.author = [ 'Spencer McIntyre' ]
self.description = 'Check C12.19 Tables For Differences'
self.detailed_description = 'This module will compare two CSV files created with... | |
11,593 | [
-0.007799803279340267,
0.02962576597929001,
0.025916926562786102,
-0.028569309040904045,
0.00364983594045043,
0.032930005341768265,
0.04050502926111221,
-0.0027493182569742203,
-0.002606022171676159,
0.03149142488837242,
0.013340585865080357,
-0.04371935874223709,
-0.040032997727394104,
-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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v... | def __init__(self, *args, **kwargs):
TermineterModule.__init__(self, *args, **kwargs)
self.version = 1
self.author = [ 'Spencer McIntyre' ]
self.description = 'Check C12.19 Tables For Differences'
self.detailed_description = 'This module will compare two CSV files created with dump_tables and display differen... | |
11,594 | [
0.01895172894001007,
0.028718093410134315,
0.08582227677106857,
-0.048997826874256134,
0.010610201396048069,
0.017208723351359367,
0.007483857683837414,
-0.008051025681197643,
-0.007857359014451504,
0.021344901993870735,
0.021704571321606636,
-0.030682433396577835,
-0.021552402526140213,
-... | 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 run(self):
logger = self.logger
first_file = self.options['FIRSTFILE']
first_file = open(first_file, 'r')
second_file = self.options['SECONDFILE']
second_file = open(second_file, 'r')
self.report = open(self.options['REPORTFILE'], 'w', 1)
self.differ = difflib.HtmlDiff()
self.tables_to_skip = [
c... | |
11,595 | [
0.007749016862362623,
0.04450398311018944,
0.039105791598558426,
-0.042961642146110535,
0.022575385868549347,
0.0318169891834259,
-0.020921101793646812,
-0.04584731161594391,
-0.007991562597453594,
0.016331395134329796,
0.019142434000968933,
-0.011256597004830837,
-0.010236662812530994,
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": "fline", "annotation": null, "type_comment": null}}, {"_type": "ar... | def report_line(self, fline, sline, lineno):
if not self.advanced_options['ALLTABLES'] and lineno in self.tables_to_skip:
return
seq = difflib.SequenceMatcher(None, fline, sline)
opcodes = seq.get_opcodes()
if (len(opcodes) > 1) or (len(fline) != len(sline)):
lineno = "<b>{lineno}</b>".format(lineno = lin... | |
11,596 | [
-0.002857769839465618,
-0.0010401239851489663,
-0.0013767757918685675,
-0.007103285752236843,
0.006220174487680197,
-0.01568756438791752,
0.00546047929674387,
-0.012023476883769035,
0.007322692312300205,
0.013493499718606472,
0.038220614194869995,
-0.011485930532217026,
0.00957160908728838,
... | 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": "csv_file", "annotation": null, "type_comment": null}}], "kwarg": ... | def get_line(self, csv_file):
line = csv_file.readline()
if not line:
return None, ''
line = line.strip().split(',')
if not line:
return None, ''
lid, ldata = int(line[0]), line[-1].decode('hex')
return lid, ldata | |
11,597 | [
0.005682336166501045,
-0.019704053178429604,
0.010832130908966064,
-0.00816942099481821,
0.020837120711803436,
0.04754353687167168,
-0.000897248275578022,
-0.023613138124346733,
0.025743305683135986,
0.06295326352119446,
0.020531192421913147,
-0.055792272090911865,
-0.023567814379930496,
0... | 8 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "current_attached_policies", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "new_attached_policies", "annotation": null, ... | def compare_attached_role_policies(current_attached_policies, new_attached_policies):
# If new_attached_policies is None it means we want to remove all policies
if len(current_attached_policies) > 0 and new_attached_policies is None:
return False
current_attached_policies_arn_list = []
for pol... | |
11,598 | [
0.024960918352007866,
-0.037572748959064484,
0.009731725789606571,
-0.012217712588608265,
-0.0050376588478684425,
0.023364227265119553,
-0.0625336691737175,
-0.057763807475566864,
0.04616253823041916,
0.029468031600117683,
0.002786628669127822,
-0.04470732808113098,
-0.008008715696632862,
... | 11 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_typ... | def convert_friendly_names_to_arns(connection, module, policy_names):
if not any([not policy.startswith('arn:') for policy in policy_names]):
return policy_names
allpolicies = {}
paginator = connection.get_paginator('list_policies')
policies = paginator.paginate().build_full_result()['Policies']... | |
11,599 | [
0.018388165161013603,
0.024145593866705894,
0.015349190682172775,
-0.0051994938403368,
-0.012345829978585243,
0.03338122367858887,
0.020738620311021805,
0.02256675250828266,
0.0321228988468647,
0.050950292497873306,
0.017177322879433632,
-0.027184568345546722,
0.02323152869939804,
0.014114... | 14 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwar... | def create_or_update_role(connection, module):
params = dict()
params['Path'] = module.params.get('path')
params['RoleName'] = module.params.get('name')
params['AssumeRolePolicyDocument'] = module.params.get('assume_role_policy_document')
managed_policies = module.params.get('managed_policy')
i... | |
11,600 | [
0.03571576625108719,
0.04856811463832855,
0.0018368425080552697,
-0.008290763944387436,
-0.044283997267484665,
0.04335170239210129,
-0.029034320265054703,
0.03074352815747261,
0.02716973051428795,
0.04572683572769165,
0.0459488108754158,
-0.05722513794898987,
0.009089873172342777,
0.012142... | 13 | {"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "connection", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwar... | def destroy_role(connection, module):
params = dict()
params['RoleName'] = module.params.get('name')
if get_role(connection, module, params['RoleName']):
# We need to remove any instance profiles from the role before we delete it
try:
instance_profiles = connection.list_instan... |