Dataset Viewer
hexsha
stringlengths 40
40
| size
int64 10
1.01M
| ext
stringclasses 8
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
237
| max_stars_repo_name
stringlengths 5
113
| max_stars_repo_head_hexsha
stringlengths 40
41
| max_stars_repo_licenses
sequence | max_stars_count
int64 1
95.2k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
237
| max_issues_repo_name
stringlengths 5
113
| max_issues_repo_head_hexsha
stringlengths 40
41
| max_issues_repo_licenses
sequence | max_issues_count
int64 1
67k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
237
| max_forks_repo_name
stringlengths 5
113
| max_forks_repo_head_hexsha
stringlengths 40
41
| max_forks_repo_licenses
sequence | max_forks_count
int64 1
33.1k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 10
1.01M
| avg_line_length
float64 2.26
46k
| max_line_length
int64 3
990k
| alphanum_fraction
float64 0.1
1
| label
int64 0
2
| cost
float64 0
5.77
| embedding
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d99a1e98eccb58cbc0c0cef6e9e6702f33461b0e | 5,886 | py | Python | public_data/serializers.py | MTES-MCT/sparte | 3b8ae6d21da81ca761d64ae9dfe2c8f54487211c | [
"MIT"
] | null | null | null | public_data/serializers.py | MTES-MCT/sparte | 3b8ae6d21da81ca761d64ae9dfe2c8f54487211c | [
"MIT"
] | 3 | 2022-02-10T11:47:58.000Z | 2022-02-23T18:50:24.000Z | public_data/serializers.py | MTES-MCT/sparte | 3b8ae6d21da81ca761d64ae9dfe2c8f54487211c | [
"MIT"
] | null | null | null | from rest_framework_gis import serializers
from rest_framework import serializers as s
from .models import (
Artificialisee2015to2018,
Artificielle2018,
CommunesSybarval,
CouvertureSol,
EnveloppeUrbaine2018,
Ocsge,
Renaturee2018to2015,
Sybarval,
Voirie2018,
ZonesBaties2018,
UsageSol,
)
def get_label(code="", label=""):
if code is None:
code = "-"
if label is None:
label = "inconnu"
return f"{code} {label[:30]}"
class Artificialisee2015to2018Serializer(serializers.GeoFeatureModelSerializer):
usage_2015 = s.SerializerMethodField()
usage_2018 = s.SerializerMethodField()
couverture_2015 = s.SerializerMethodField()
couverture_2018 = s.SerializerMethodField()
def get_usage_2015(self, obj):
return get_label(code=obj.us_2015, label=obj.us_2015_label)
def get_usage_2018(self, obj):
return get_label(code=obj.us_2018, label=obj.us_2018_label)
def get_couverture_2015(self, obj):
return get_label(code=obj.cs_2015, label=obj.cs_2015_label)
def get_couverture_2018(self, obj):
return get_label(code=obj.cs_2018, label=obj.cs_2018_label)
class Meta:
fields = (
"id",
"surface",
"usage_2015",
"usage_2018",
"couverture_2015",
"couverture_2018",
)
geo_field = "mpoly"
model = Artificialisee2015to2018
class Artificielle2018Serializer(serializers.GeoFeatureModelSerializer):
couverture = s.SerializerMethodField()
def get_couverture(self, obj):
return get_label(code=obj.couverture, label=obj.couverture_label)
class Meta:
fields = (
"id",
"surface",
"couverture",
)
geo_field = "mpoly"
model = Artificielle2018
class CommunesSybarvalSerializer(serializers.GeoFeatureModelSerializer):
"""Marker GeoJSON serializer."""
class Meta:
"""Marker serializer meta class."""
fields = (
"nom",
"code_insee",
"surface",
)
geo_field = "mpoly"
model = CommunesSybarval
class EnveloppeUrbaine2018Serializer(serializers.GeoFeatureModelSerializer):
couverture = s.SerializerMethodField()
def get_couverture(self, obj):
return get_label(code=obj.couverture, label=obj.couverture_label)
class Meta:
fields = (
"id",
"couverture",
"surface",
)
geo_field = "mpoly"
model = EnveloppeUrbaine2018
class OcsgeSerializer(serializers.GeoFeatureModelSerializer):
couverture = s.SerializerMethodField()
usage = s.SerializerMethodField()
def get_couverture(self, obj):
return get_label(code=obj.couverture, label=obj.couverture_label)
def get_usage(self, obj):
return get_label(code=obj.usage, label=obj.usage_label)
class Meta:
fields = (
"id",
"couverture",
"usage",
"millesime",
"map_color",
"year",
)
geo_field = "mpoly"
model = Ocsge
class Renaturee2018to2015Serializer(serializers.GeoFeatureModelSerializer):
usage_2015 = s.SerializerMethodField()
usage_2018 = s.SerializerMethodField()
couverture_2015 = s.SerializerMethodField()
couverture_2018 = s.SerializerMethodField()
def get_usage_2015(self, obj):
return get_label(code=obj.us_2015, label=obj.us_2015_label)
def get_usage_2018(self, obj):
return get_label(code=obj.us_2018, label=obj.us_2018_label)
def get_couverture_2015(self, obj):
return get_label(code=obj.cs_2015, label=obj.cs_2015_label)
def get_couverture_2018(self, obj):
return get_label(code=obj.cs_2018, label=obj.cs_2018_label)
class Meta:
fields = (
"id",
"surface",
"usage_2015",
"usage_2018",
"couverture_2015",
"couverture_2018",
)
geo_field = "mpoly"
model = Renaturee2018to2015
class SybarvalSerializer(serializers.GeoFeatureModelSerializer):
class Meta:
fields = (
"id",
"surface",
)
geo_field = "mpoly"
model = Sybarval
class Voirie2018Serializer(serializers.GeoFeatureModelSerializer):
couverture = s.SerializerMethodField()
usage = s.SerializerMethodField()
def get_couverture(self, obj):
return get_label(code=obj.couverture, label=obj.couverture_label)
def get_usage(self, obj):
return get_label(code=obj.usage, label=obj.usage_label)
class Meta:
fields = (
"id",
"surface",
"couverture",
"usage",
)
geo_field = "mpoly"
model = Voirie2018
class ZonesBaties2018Serializer(serializers.GeoFeatureModelSerializer):
couverture = s.SerializerMethodField()
usage = s.SerializerMethodField()
def get_couverture(self, obj):
return get_label(code=obj.couverture, label=obj.couverture_label)
def get_usage(self, obj):
return get_label(code=obj.usage, label=obj.usage_label)
class Meta:
fields = (
"id",
"couverture",
"usage",
"surface",
)
geo_field = "mpoly"
model = ZonesBaties2018
class CouvertureSolSerializer(serializers.ModelSerializer):
class Meta:
fields = (
"id",
"parent",
"code",
"label",
"is_artificial",
)
model = CouvertureSol
class UsageSolSerializer(serializers.ModelSerializer):
class Meta:
fields = (
"id",
"parent",
"code",
"label",
)
model = UsageSol
| 25.37069 | 80 | 0.613829 | 1 | 2.1546 | [
-0.023032253608107567,
0.006429505534470081,
-0.0065226564183831215,
0.047430142760276794,
-0.002568622585386038,
0.029553258791565895,
-0.021700186654925346,
-0.007212890312075615,
-0.01698347181081772,
0.036334093660116196,
0.029200436547398567,
-0.0010587513679638505,
0.009213053621351719,
0.0109388567507267,
-0.026772193610668182,
0.003361908718943596,
0.03590482845902443,
0.022275764495134354,
-0.03531678020954132,
-0.019978158175945282,
-0.008622609078884125,
0.017582036554813385,
0.0005737731698900461,
-0.01753886230289936,
0.009688545018434525,
0.03572089225053787,
0.019366424530744553,
0.02575067989528179,
0.023029161617159843,
0.0072186654433608055,
-0.012929624877870083,
-0.02945210412144661,
-0.010766944848001003,
0.020036647096276283,
0.020536599680781364,
0.020622050389647484,
0.01603376865386963,
-0.036795616149902344,
-0.009853306226432323,
0.009654728695750237,
-0.023695306852459908,
0.0052321841940283775,
0.006061663385480642,
0.03159143775701523,
0.01832052879035473,
0.029445232823491096,
-0.014611927792429924,
-0.000706724647898227,
-0.03357257321476936,
0.027949167415499687,
-0.009271022863686085,
0.02005734108388424,
0.007537890691310167,
-0.006210981402546167,
-0.01536873634904623,
-0.033271368592977524,
0.02422097884118557,
0.03605525940656662,
-0.004860084969550371,
0.017895599827170372,
0.012516104616224766,
0.006077852565795183,
-0.0049101910553872585,
0.021298274397850037,
0.026195064187049866,
0.01142497081309557,
0.0263934638351202,
-0.006676370743662119,
-0.00548219308257103,
0.005401971749961376,
-0.016650402918457985,
-0.00604248745366931,
0.0037192499730736017,
0.029143212363123894,
-0.0018697339110076427,
0.014313810504972935,
-0.0076742577366530895,
0.011004863306879997,
0.0030678752809762955,
0.03014780953526497,
-0.019765891134738922,
0.031452476978302,
0.030675336718559265,
-0.030359791591763496,
0.003516010707244277,
0.03718113154172897,
0.042029544711112976,
-0.0029519435483962297,
0.051016274839639664,
-0.0023008082062005997,
-0.04022729769349098,
0.04885047301650047,
-0.0526447631418705,
-0.017069337889552116,
0.015132986009120941,
-0.03986474871635437,
0.017331009730696678,
0.024880819022655487,
-0.04830421507358551,
0.011693828739225864,
0.0179192665964365,
-0.022650644183158875,
0.016055697575211525,
-0.037722356617450714,
-0.0026676878333091736,
0.003059134352952242,
-0.047698162496089935,
0.011376654729247093,
0.0007822553743608296,
0.006207637023180723,
0.02262355200946331,
0.007211440242826939,
-0.0033185845240950584,
-0.04706120118498802,
-0.02671344205737114,
-0.003787618363276124,
0.027653012424707413,
-0.003272884525358677,
0.01592670939862728,
0.030177773907780647,
-0.0268180463463068,
-0.0024158242158591747,
0.02698349393904209,
-0.028873935341835022,
-0.03001679852604866,
0.0728081688284874,
-0.00017709226813167334,
0.05211753025650978,
0.03387364000082016,
-0.009776037186384201,
0.02134968899190426,
0.001823876053094864,
-0.009463155642151833,
-0.03891511261463165,
-0.0072526694275438786,
-0.027202390134334564,
-0.02830658107995987,
0.027103159576654434,
-0.04585833102464676,
-0.004779340233653784,
0.018678877502679825,
-0.028130263090133667,
0.020668165758252144,
-0.019729243591427803,
-0.038355983793735504,
-0.04419836774468422,
-0.010248064994812012,
0.001696007326245308,
-0.014291050843894482,
0.004144361242651939,
0.002008061623200774,
-0.0005444040871225297,
0.014376072213053703,
0.042405784130096436,
-0.0028501187916845083,
0.004881121683865786,
-0.006804684642702341,
-0.031663138419389725,
-0.004481378477066755,
-0.015328890644013882,
-0.022918405011296272,
0.015678972005844116,
-0.009209473617374897,
0.0046127839013934135,
0.014031716622412205,
0.008886364288628101,
-0.017594626173377037,
0.019804339855909348,
-0.00632582837715745,
0.015555771999061108,
-0.021445058286190033,
-0.03958277031779289,
-0.024266192689538002,
-0.01822584681212902,
-0.03485732898116112,
-0.01594705507159233,
-0.007036988623440266,
-0.0020716791041195393,
0.01914500631392002,
-0.022394569590687752,
-0.0011834044707939029,
0.0012348697055131197,
0.02921777404844761,
0.057312119752168655,
0.014059198088943958,
-0.014869633130729198,
-0.07424736022949219,
-0.01414668932557106,
0.006745317485183477,
0.027991902083158493,
-0.0011400148505344987,
0.022958112880587578,
0.016609538346529007,
0.001287603285163641,
0.02155793271958828,
0.021013818681240082,
-0.012061847373843193,
0.01777053251862526,
-0.0073379832319915295,
0.002769491169601679,
-0.007237040437757969,
-0.0007420538458973169,
-0.00891049113124609,
-0.004466277081519365,
-0.011348524130880833,
-0.003250874811783433,
-0.7565611004829407,
-0.019580014050006866,
-0.004358305595815182,
-0.014078526757657528,
0.02874818444252014,
0.06150175258517265,
-0.03931150585412979,
0.03225506842136383,
-0.07550354301929474,
-0.014525672420859337,
-0.006300728768110275,
-0.015996964648365974,
0.0016168036963790655,
-0.015447182580828667,
-0.012325523421168327,
-0.012613551691174507,
0.02010713703930378,
0.0046585239470005035,
0.01188972219824791,
0.028422800824046135,
0.003157083410769701,
-0.005558836739510298,
-0.006229301914572716,
0.024898478761315346,
-0.002511806320399046,
0.029087800532579422,
0.0438866913318634,
0.016603730618953705,
-0.0022955951280891895,
-0.041391968727111816,
-0.009066916070878506,
0.01159537024796009,
-0.023148247972130775,
-0.015949860215187073,
0.04165197163820267,
0.0045630899257957935,
0.030443333089351654,
0.01086375955492258,
0.004256291314959526,
-0.01327746082097292,
-0.009302797727286816,
-0.024577246978878975,
0.008388577960431576,
-0.060667652636766434,
-0.001935492968186736,
-0.006457577925175428,
-0.011786412447690964,
-0.02121281437575817,
0.005589313339442015,
0.006297185551375151,
-0.015169907361268997,
0.005346634890884161,
0.03090975061058998,
-0.007705149240791798,
0.023674514144659042,
0.03219595551490784,
0.011851373128592968,
-0.010872140526771545,
0.0031021644826978445,
0.004857026506215334,
0.05869293212890625,
0.019966961815953255,
0.0037410371005535126,
-0.018018899485468864,
-0.012915129773318768,
0.007627797778695822,
0.017460308969020844,
-0.05367337539792061,
-0.013955198228359222,
0.008550659753382206,
-0.03745012730360031,
-0.0038056643679738045,
-0.0013406365178525448,
0.09272757917642593,
-0.0072669158689677715,
0.01637434959411621,
-0.016332590952515602,
0.001389873563311994,
-0.02140788547694683,
0.02290419489145279,
0.03432897850871086,
-0.005536623299121857,
0.023255780339241028,
-0.0034577809274196625,
-0.038724228739738464,
0.01831689290702343,
-0.0032218003179877996,
-0.025912417098879814,
0.01636520028114319,
0.033832091838121414,
-0.0044028726406395435,
0.0025944262742996216,
-0.0053807469084858894,
0.015155320055782795,
0.007645580917596817,
0.04148491844534874,
-0.01706678979098797,
0.0734160766005516,
0.011240466497838497,
-0.011962609365582466,
0.0033925031311810017,
-0.006724955514073372,
-0.019725406542420387,
0.026527874171733856,
0.021663065999746323,
0.02259981259703636,
0.003193751908838749,
0.0010359069565311074,
0.057584259659051895,
-0.07515992224216461,
0.006706632673740387,
-0.014955652877688408,
-0.029861072078347206,
-0.02110709249973297,
-0.022030027583241463,
-0.03339405357837677,
-0.04498744755983353,
-0.0291872788220644,
0.01205475628376007,
-0.014123190194368362,
-0.004328252747654915,
-0.012713843956589699,
-0.0037600495852530003,
0.004092302639037371,
-0.008780959993600845,
0.015509948134422302,
-0.01036300603300333,
-0.01299242302775383,
-0.007725267205387354,
0.04582652077078819,
0.011014692485332489,
-0.00506077753379941,
-0.004172169137746096,
-0.027136798948049545,
-0.0032172061037272215,
0.020454516634345055,
-0.020862730219960213,
-0.02168847993016243,
0.0029640523716807365,
0.00881828274577856,
0.014642883092164993,
0.014788035303354263,
-0.008918987587094307,
-0.02595221810042858,
0.02589988149702549,
-0.007133935112506151,
-0.000605373177677393,
-0.004477681126445532,
0.024682914838194847,
-0.02358739823102951,
-0.0037362384609878063,
0.0377783365547657,
0.007908991537988186,
0.010651306249201298,
-0.007597596850246191,
0.005852206144481897,
-0.023613419383764267,
0.021299736574292183,
0.04567624256014824,
0.042737629264593124,
0.02103765867650509,
-0.014275908470153809,
0.004985641688108444,
0.01442665047943592,
-0.010844622738659382,
-0.0007929224520921707,
-0.013185986317694187,
0.04887428879737854,
0.037835389375686646,
0.02779066562652588,
-0.015109565109014511,
-0.037099726498126984,
0.016596423462033272,
-0.0059387655928730965,
0.0024596722796559334,
0.01625906489789486,
-0.010587284341454506,
-0.0055539910681545734,
-0.025712398812174797,
-0.02413680963218212,
0.00539398705586791,
-0.015940718352794647,
-0.02538374252617359,
-0.011491105891764164,
-0.020782314240932465,
0.002638893434777856,
-0.01092136837542057,
0.009783454239368439,
0.001974631566554308,
-0.02282562479376793,
0.032802172005176544,
0.02276735194027424,
-0.033305421471595764,
0.017584051936864853,
-0.030673010274767876,
0.010722609236836433,
-0.016248734667897224,
-0.008248081430792809,
0.01537366583943367,
-0.03756745532155037,
0.011495384387671947,
-0.0009262298117391765,
0.013266189955174923,
-0.023102235049009323,
-0.014102853834629059,
0.01896841451525688,
-0.028820587322115898,
0.009527340531349182,
0.004532759077847004,
-0.01669992320239544,
0.009178707376122475,
0.01329979207366705,
0.009620118886232376,
-0.001628378638997674,
-0.022315021604299545,
0.04817559942603111,
-0.009646308608353138,
-0.021704575046896935,
-0.0057066320441663265,
-0.05293117091059685,
-0.025794412940740585,
-0.022975342348217964,
-0.007311063352972269,
-0.003699151100590825,
-0.008350077085196972,
-0.0017233936814591289,
-0.05174941197037697,
0.026888323947787285,
-0.012700982391834259,
0.027143551036715508,
-0.0027011597994714975,
0.01000116765499115,
-0.027751464396715164,
-0.010539140552282333,
-0.0043499586172401905,
0.008650642819702625,
0.004522605799138546,
0.00822401698678732,
0.0355447493493557,
0.002391582587733865,
0.028606683015823364,
-0.010178511030972004,
-0.010543189011514187,
0.025940654799342155,
0.0002799085923470557,
-0.012493107467889786,
0.005769324954599142,
0.008311757817864418,
-0.028066599741578102,
0.0018013296648859978,
-0.028857968747615814,
0.04253200814127922,
0.0015214004088193178,
-0.008341027423739433,
0.01253460068255663,
0.0005844840197823942,
-0.024321867153048515,
-0.023148085922002792,
0.018655285239219666,
0.009450400248169899,
0.007226725574582815,
-0.01080062985420227,
-0.01514367200434208,
0.0009172451100312173,
-0.01182621717453003,
-0.017094817012548447,
0.0020871725864708424,
0.019007962197065353,
-0.009690999984741211,
0.03480473905801773,
-0.016040485352277756,
0.0045103165321052074,
-0.00846171472221613,
-0.0050558289512991905,
-0.00742466701194644,
-0.007515156175941229,
0.007598766125738621,
-0.018433474004268646,
0.0004740865551866591,
-0.0054280683398246765,
-0.02566980943083763,
0.0020786470267921686,
0.025009121745824814,
0.002052498050034046,
-0.02812805026769638,
0.01498386263847351,
0.0042256382293999195,
-0.008753919042646885,
-0.05156119540333748,
-0.015734834596514702,
-0.013348695822060108,
-0.06145624443888664,
-0.02785675786435604,
-0.027510304003953934,
-0.05860084667801857,
0.01161610521376133,
-0.032302435487508774,
-0.003953283187001944,
0.023798469454050064,
0.039990995079278946,
-0.0007895379094406962,
0.03005799651145935,
-0.0033592518884688616,
0.014740838669240475,
0.03590969741344452,
-0.012568219564855099,
-0.004838111810386181,
-0.010532021522521973,
0.02269958332180977,
-0.00010631747136358172,
0.007902941666543484,
0.014911559410393238,
0.016577618196606636,
0.004584760405123234,
0.007051973603665829,
0.011971140280365944,
0.031135784462094307,
0.0018045621691271663,
0.013044754043221474,
-0.021305829286575317,
-0.03784054145216942,
-0.019063206389546394,
-0.04921294003725052,
0.003977738320827484,
-0.0018788399174809456,
-0.007328426465392113,
-0.010334303602576256,
-0.025882218033075333,
0.01765872910618782,
0.043268173933029175,
-0.018410978838801384,
-0.019916974008083344,
-0.004870029166340828,
0.03135855868458748,
0.011266861110925674,
-0.030402228236198425,
-0.014743142761290073,
0.04493442550301552,
0.012342588976025581,
0.013104179874062538,
0.023011881858110428,
0.019186202436685562,
0.008338251151144505,
-0.008406021632254124,
0.004476861096918583,
0.012765535153448582,
-0.013246539048850536,
0.026645256206393242,
0.002318997634574771,
0.03097633831202984,
0.020648470148444176,
-0.036271922290325165,
-0.014593780972063541,
0.0023251441307365894,
0.007658870425075293,
-0.024583039805293083,
0.002994790207594633,
0.010523597709834576,
0.01802327111363411,
-0.03654249384999275,
0.029534034430980682,
-0.025352220982313156,
-0.009009343571960926,
-0.00463904719799757,
-0.026155294850468636,
-0.04734903946518898,
0.02004360407590866,
-0.012546752579510212,
0.014822802506387234,
0.0190466046333313,
0.00325893796980381,
-0.015351586043834686,
0.01669013500213623,
0.009169763885438442,
0.009702902287244797,
0.04139453172683716,
0.03201008960604668,
0.005710873752832413,
-0.00729849748313427,
-0.018119702115654945,
-0.006542666349560022,
-0.06403901427984238,
0.012089818716049194,
-0.02779366634786129,
0.03425639867782593,
-0.01640528254210949,
-0.01829330436885357,
0.013344011269509792,
0.020152034237980843,
-0.030665986239910126,
-0.028559179976582527,
-0.04374101758003235,
0.011886070482432842,
0.01439589262008667,
-0.0031660052482038736,
-0.0023139279801398516,
-0.025436390191316605,
-0.0041117072105407715,
0.021617786958813667,
-0.02808791771531105,
0.018744267523288727,
-0.016593337059020996,
-0.004346114117652178,
-0.004869355354458094,
0.024206316098570824,
-0.020946867763996124,
0.018157580867409706,
-0.032301921397447586,
-0.006183920428156853,
0.025305790826678276,
0.02346799336373806,
0.004781364928930998,
0.009250006638467312,
0.005256152246147394,
-0.006058166269212961,
0.0066993567161262035,
-0.03352362662553787,
0.027356551960110664,
0.027551982551813126,
0.00958971306681633,
0.010946172289550304,
-0.050910428166389465,
-0.0411047600209713,
0.01940508931875229,
-0.028047988191246986,
0.0015127715887501836,
0.03419014811515808,
0.007798764854669571,
0.0007998181972652674,
0.0008467002771794796,
-0.03485580161213875,
-0.01963694579899311,
0.005234716460108757,
-0.010708398185670376,
0.0019541168585419655,
-0.010241799056529999,
-0.009658066555857658,
-0.028708579018712044,
-0.00021078322606626898,
-0.0002807191922329366,
-0.02825970947742462,
0.012255913577973843,
-0.005475331097841263,
0.007616558112204075,
0.014007637277245522,
0.00034669696469791234,
0.003458465216681361,
0.0310014970600605,
-0.008171201683580875,
-0.015516296960413456,
0.018966061994433403,
0.012224319390952587,
0.025850854814052582,
0.02399110421538353,
0.012660047970712185,
0.0051256041042506695,
0.0008670762763358653,
0.02586447261273861,
0.02601231262087822,
-0.0034769228659570217,
-0.02034216746687889,
0.012564996257424355,
-0.0381176732480526,
0.0566621869802475,
0.0017658998258411884,
0.021839778870344162,
-0.0026203980669379234,
-0.0008119485573843122,
-0.002155390102416277,
-0.011625711806118488,
0.03704306483268738,
0.021095622330904007,
-0.027341729030013084,
0.019186800345778465,
-0.0029563303105533123,
0.011163182556629181,
-0.024604707956314087,
0.021078407764434814,
0.06434158235788345,
0.03920707106590271,
-0.022020762786269188,
0.003312041750177741,
0.018391640856862068,
0.009265159256756306,
-0.012136726640164852,
-0.04141189530491829,
-0.013513139449059963,
0.05112238973379135,
-0.01788417063653469,
0.038056474179029465,
-0.0075378515757620335,
-0.004286961164325476,
-0.011739236302673817,
-0.002799248555675149,
-0.00041546308784745634,
-0.0349007323384285,
0.0254339762032032,
-0.010665444657206535,
0.044528789818286896,
-0.015372308902442455,
0.016688337549567223,
-0.07123244553804398,
0.02560470812022686,
-0.038775693625211716,
0.0328039675951004,
-0.004945737309753895,
0.06144368648529053,
0.03983921930193901,
-0.0030964247416704893,
-0.03980672359466553,
-0.002024575136601925,
-0.009041227400302887,
-0.04629811644554138,
-0.018702877685427666,
-0.017780650407075882,
0.009725445881485939,
0.02737041562795639,
-0.020238444209098816,
0.017744047567248344,
0.012807306833565235,
-0.013649958185851574,
0.043371204286813736,
0.009496430866420269,
0.013044455088675022,
-0.030619554221630096,
0.01223656814545393,
-0.032458722591400146,
-0.0377088226377964,
0.0061340294778347015,
-0.004824117757380009,
-0.008642389439046383,
-0.035532400012016296,
-0.010680600069463253,
-0.020730817690491676,
-0.007048380561172962,
-0.06690144538879395,
0.03574052453041077,
0.005911946762353182,
-0.022556208074092865,
-0.01910344697535038,
0.027181174606084824,
0.004887126851826906,
0.012926580384373665,
-0.010970351286232471,
0.0012866932665929198,
-0.03410918265581131,
-0.011456247419118881,
0.017662111669778824,
0.013650376349687576,
0.035099223256111145,
0.0007051347638480365,
-0.0353277325630188,
0.023707428947091103,
-0.03049374744296074,
-0.06526459753513336,
-0.028212346136569977,
-0.004958650097250938,
0.004465089179575443,
0.04277313873171806,
-0.06450463831424713,
0.006619914434850216,
0.008718997240066528
] |
d99a20277c32bb1e28312f42ab6d732f38323169 | 241 | py | Python | quick_search/admin.py | naman1901/django-quick-search | 7b93554ed9fa4721e52372f9fd1a395d94cc04a7 | [
"MIT"
] | null | null | null | quick_search/admin.py | naman1901/django-quick-search | 7b93554ed9fa4721e52372f9fd1a395d94cc04a7 | [
"MIT"
] | 2 | 2020-02-11T23:28:22.000Z | 2020-06-05T19:27:40.000Z | quick_search/admin.py | HereWithoutPermission/django-quick-search | 7b93554ed9fa4721e52372f9fd1a395d94cc04a7 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import SearchResult
# Register your models here.
class SearchResultAdmin(admin.ModelAdmin):
fields = ["query", "heading", "url", "text"]
admin.site.register(SearchResult, SearchResultAdmin) | 30.125 | 52 | 0.771784 | 1 | 0.6921 | [
0.0025107087567448616,
0.02395726554095745,
0.01138845831155777,
0.0019029398681595922,
0.004242513794451952,
-0.0038108981680125,
-0.010250198654830456,
0.0033133511897176504,
-0.008153465576469898,
0.002060966333374381,
0.006194288842380047,
0.0056234137155115604,
0.010188437066972256,
-0.016815679147839546,
0.0021273691672831774,
0.016809703782200813,
-0.053419627249240875,
0.0026138145476579666,
-0.006093225441873074,
0.001765781780704856,
-0.008068284019827843,
0.010597608052194118,
0.010564031079411507,
0.006592272315174341,
0.005693970248103142,
-0.0015910206129774451,
0.009741051122546196,
0.004464102443307638,
-0.008493805304169655,
-0.005608382169157267,
-0.004750736523419619,
-0.0017693277914077044,
-0.0029988777823746204,
-0.009946271777153015,
0.007166046183556318,
-0.0010889261029660702,
0.0006613322766497731,
-0.021077876910567284,
0.010856619104743004,
-0.0036370381712913513,
-0.005255785305052996,
-0.01700032688677311,
-0.0004896052414551377,
0.0033816208597272635,
-0.012565406039357185,
0.004568604286760092,
-0.006417827680706978,
0.004529937636107206,
-0.009411740116775036,
0.004394456744194031,
-0.01089674886316061,
0.001563314232043922,
0.014057286083698273,
0.0022952710278332233,
-0.005223826505243778,
-0.006490210071206093,
0.011140619404613972,
0.0010472346330061555,
-0.01249015238136053,
-0.0005941169220022857,
-0.004301316104829311,
-0.001365005038678646,
0.006756028160452843,
0.003954899962991476,
-0.01906384713947773,
-0.005985668860375881,
-0.0018899454735219479,
0.003996184095740318,
-0.0004293079546187073,
0.004960423801094294,
0.0033815510105341673,
-0.0022780471481382847,
0.010064492002129555,
0.0022363823372870684,
0.006942696403712034,
-0.003975766710937023,
0.0005968844052404165,
0.0026146986056119204,
0.0059613315388560295,
0.004004267044365406,
0.005655291955918074,
-0.0070184641517698765,
0.0063711972907185555,
0.012092006392776966,
0.010587228462100029,
0.009318968281149864,
0.021808844059705734,
-0.013875236734747887,
0.046708106994628906,
0.007161009591072798,
-0.008963876403868198,
0.0036153218243271112,
-0.007456197869032621,
-0.002623743610456586,
-0.005219509359449148,
-0.03348900377750397,
-0.0003368073666933924,
-0.004519063513725996,
-0.00047638657269999385,
0.001619342714548111,
0.001765933004207909,
0.005102843977510929,
0.001984718721359968,
-0.003782074199989438,
-0.010090285912156105,
0.015655260533094406,
-0.010070428252220154,
-0.002120968187227845,
0.008062899112701416,
0.0022807535715401173,
-0.011817967519164085,
-0.0009534405544400215,
0.0011727006640285254,
-0.014519834890961647,
0.006009048316627741,
0.004043198190629482,
-0.007319594733417034,
0.05537291243672371,
-0.001827039523050189,
0.003349896287545562,
-0.0067083523608744144,
-0.0014046311844140291,
0.001216207747347653,
0.010158377699553967,
0.008777201175689697,
-0.001133561716414988,
0.011204009875655174,
0.005602209363132715,
0.005329786334186792,
0.007495217490941286,
-0.0005605514743365347,
0.005337996874004602,
-0.001845372375100851,
-0.003449586918577552,
-0.0003942999755963683,
-0.009884451515972614,
0.009297877550125122,
-0.002584679750725627,
-0.010360372252762318,
0.002676223171874881,
-0.00012188335676910356,
-0.011608666740357876,
-0.00041371790575794876,
-0.002126192906871438,
-0.001610416336916387,
-0.013240807689726353,
-0.001636288478039205,
-0.0013153823092579842,
-0.005512161646038294,
0.005444980692118406,
0.008701415732502937,
0.005032454151660204,
0.0017869898583739996,
-0.004211724270135164,
-0.009493880905210972,
0.0003736641665454954,
-0.00453863013535738,
0.0028600713703781366,
0.008851271122694016,
0.003096552798524499,
-0.007904427126049995,
-0.000533352023921907,
0.0021712221205234528,
0.0055824811570346355,
-0.00181124871596694,
0.001919982605613768,
-0.006304419599473476,
0.009396420791745186,
-0.0013533069286495447,
0.003765217727050185,
0.011312438175082207,
-0.006179444957524538,
0.00003826874672085978,
0.00040728916064836085,
0.005113975610584021,
-0.001216432428918779,
0.008154036477208138,
0.01195736788213253,
-0.0028058155439794064,
-0.004031111020594835,
0.004829250741750002,
0.004736397415399551,
0.010072840377688408,
0.00830130185931921,
0.00044367241207510233,
0.002562921727076173,
-0.004023361019790173,
-0.001114572281949222,
0.003089221427217126,
-0.00885462574660778,
0.007596581242978573,
0.006807386875152588,
-0.01331824716180563,
-0.005642877425998449,
0.0010738244745880365,
-0.009956258349120617,
0.0019808118231594563,
0.015732159838080406,
0.01075264997780323,
-0.0029884588439017534,
0.004606657195836306,
-0.01195231918245554,
0.003087220946326852,
0.004607136361300945,
0.004273328464478254,
-0.01280191633850336,
-0.9536270499229431,
0.0059068165719509125,
0.001430056756362319,
-0.001314345165155828,
0.004687048960477114,
0.0019021655898541212,
0.0010553613537922502,
0.004076685290783644,
0.012726737186312675,
-0.00698279682546854,
-0.007740618195384741,
-0.012239394709467888,
-0.013041328638792038,
-0.002504728501662612,
-0.010398270562291145,
-0.00045330272405408323,
-0.0027665793895721436,
-0.006816062144935131,
-0.002865756629034877,
-0.0055280039086937904,
-0.003781611565500498,
0.009637268260121346,
-0.0016068137483671308,
0.005279350094497204,
0.0028066965751349926,
0.004278422333300114,
-0.004603560082614422,
-0.00013527243572752923,
-0.0014108053874224424,
-0.006002810318022966,
-0.00680606858804822,
-0.013798747211694717,
-0.005925587844103575,
-0.0016352103557437658,
0.011259657330811024,
0.0012589354300871491,
0.012216679751873016,
-0.0008738228352740407,
0.004550337791442871,
-0.008237623609602451,
0.006381221115589142,
0.0036714551970362663,
0.0014288666425272822,
-0.028630828484892845,
-0.0006080053863115609,
-0.0044657704420387745,
-0.005504058673977852,
0.012475780211389065,
0.0006711012101732194,
-0.003054229309782386,
-0.005000327713787556,
-0.0034080303739756346,
0.007869771681725979,
-0.009933973662555218,
0.006480993703007698,
-0.006368942558765411,
-0.007111432496458292,
-0.0019521299982443452,
-0.00983267929404974,
0.0017609868664294481,
0.005790429655462503,
0.00011216456914553419,
-0.00488287815824151,
-0.0044624945148825645,
0.0024421545676887035,
0.0028274809010326862,
-0.0018021370051428676,
-0.01990148238837719,
-0.010554217733442783,
-0.0034275404177606106,
0.00027101466548629105,
-0.0023461286909878254,
-0.005740059074014425,
0.0011837108759209514,
-0.012606576085090637,
0.007503861095756292,
0.003742681350558996,
0.000597186794038862,
-0.01149604469537735,
0.002327954163774848,
-0.010124091990292072,
-0.009434633888304234,
0.0005040646647103131,
-0.00860382616519928,
-0.001638105371966958,
0.00007076932524796575,
0.0031540479976683855,
0.006573517806828022,
-0.00533715495839715,
0.0019368571229279041,
0.014135313220322132,
-0.002786011900752783,
-0.006899258121848106,
0.009101757779717445,
0.006992035545408726,
0.0034393095411360264,
-0.003348632948473096,
0.0016411623219028115,
0.010684477165341377,
0.008838276378810406,
0.0015598611207678914,
0.0059396736323833466,
-0.001029293634928763,
0.01343896146863699,
-0.0032424491364508867,
0.0007227124879136682,
-0.004844530485570431,
0.00011841287050629035,
-0.0021110009402036667,
-0.00048056081868708134,
-0.001263358280993998,
-0.002750922227278352,
-0.010222368873655796,
-0.011843600310385227,
-0.0040354481898248196,
-0.0009809090988710523,
0.0007187523297034204,
-0.00381101225502789,
0.0011926040751859546,
0.003956668544560671,
0.01177234947681427,
0.002697136253118515,
-0.0033514751121401787,
0.0019590065348893404,
0.002503960393369198,
-0.012051046825945377,
0.015654996037483215,
-0.016053011640906334,
0.005379523616284132,
-0.001083826762624085,
-0.016846854239702225,
0.007161754183471203,
0.007032047025859356,
-0.0070657022297382355,
-0.0019103210652247071,
0.004962901584804058,
0.0017073125345632434,
-0.0003851437650155276,
-0.005465429741889238,
-0.0008675571880303323,
-0.01714206486940384,
-0.0012518231524154544,
0.020577488467097282,
0.0023742085322737694,
0.010545103810727596,
0.011579588986933231,
-0.0064491890370845795,
-0.00010324319737264886,
0.009191872552037239,
0.0012121604522690177,
0.01598035916686058,
-0.00996516365557909,
0.0016493529547005892,
0.002726637991145253,
-0.008476117625832558,
-0.0004313503159210086,
0.004646772984415293,
0.0052850921638309956,
-0.0004559100780170411,
0.000345084466971457,
-0.010240377858281136,
-0.00664339167997241,
-0.0210335124284029,
-0.004462846089154482,
0.007531880401074886,
-0.005261229816824198,
0.005735724698752165,
-0.009513510391116142,
0.005985968746244907,
0.007170443888753653,
0.005757512990385294,
0.0030862768180668354,
0.00036658288445323706,
0.005370641127228737,
0.012699958868324757,
-0.007154248189181089,
0.0026094468776136637,
0.0005571613437496126,
-0.0003272402100265026,
0.004374724812805653,
0.011991757899522781,
-0.009683131240308285,
-0.002696931827813387,
0.0007447159150615335,
0.002501546870917082,
0.001503156148828566,
-0.003524594474583864,
-0.007330413907766342,
-0.004056679550558329,
0.0010146445129066706,
-0.00560697540640831,
0.004152344539761543,
0.00032663618912920356,
0.003430370707064867,
-0.007619214244186878,
-0.0008783522062003613,
0.001280538272112608,
-0.009093938395380974,
0.011393941938877106,
-0.0026747584342956543,
0.0010974342003464699,
0.014528824016451836,
0.004658477380871773,
-0.015148761682212353,
0.0069920457899570465,
0.01087561622262001,
-0.005514563526958227,
0.003545865649357438,
0.009060834534466267,
-0.0057919882237911224,
-0.025374894961714745,
0.0036465157754719257,
-0.012725766748189926,
0.003311130916699767,
-0.003213010961189866,
0.0036104682367295027,
-0.004909193608909845,
0.008671220391988754,
0.004372545052319765,
-0.014399048872292042,
-0.002231849590316415,
-0.012425122782588005,
0.012210902757942677,
-0.0015600906917825341,
-0.0017762396018952131,
-0.005157561972737312,
-0.003208605106920004,
-0.003142418572679162,
-0.00408980343490839,
-0.0013088393025100231,
0.005820749327540398,
0.0008224118500947952,
-0.005726836156100035,
0.0008303688955493271,
-0.001218069577589631,
-0.0002589006908237934,
0.003119450295343995,
-0.011182786896824837,
-0.00023331491684075445,
0.005552262999117374,
-0.001494468073360622,
-0.003591888351365924,
0.000860703585203737,
-0.0034706834703683853,
-0.006999636068940163,
-0.011605406180024147,
-0.0050745075568556786,
-0.001548077678307891,
-0.0012042076559737325,
-0.010368754155933857,
-0.0037356384564191103,
-0.007463688030838966,
0.004285327158868313,
-0.0074417623691260815,
0.009508181363344193,
0.0034468742087483406,
-0.007027667015790939,
0.0037992901634424925,
-0.0022829677909612656,
0.00435848580673337,
0.007233025971800089,
0.011319977231323719,
-0.0033583338372409344,
-0.0075123608112335205,
-0.00929894670844078,
0.011595992371439934,
-0.009427730925381184,
-0.0009576578158885241,
0.015320215374231339,
0.0029411932919174433,
0.007894206792116165,
0.0003380854905117303,
0.0011434684274718165,
0.002495110034942627,
0.00665633287280798,
-0.015188268385827541,
0.002956012962386012,
-0.006785964127629995,
-0.00019140925724059343,
0.005573767237365246,
-0.004033309873193502,
0.005546196363866329,
0.010369179770350456,
0.0030813422054052353,
-0.009735409170389175,
-0.0013962320517748594,
-0.0010253563523292542,
0.003035422181710601,
-0.013690018095076084,
0.0002522213035263121,
-0.00180079136043787,
-0.0026858521159738302,
-0.0012158877216279507,
-0.004376107826828957,
-0.0019436143338680267,
0.0072288173250854015,
-0.002951686503365636,
0.004709809087216854,
0.00035814527655020356,
-0.0015773068880662322,
0.01219952292740345,
-0.007238579448312521,
-0.008011875674128532,
0.0029245708137750626,
0.0011219559237360954,
-0.0022685357835143805,
-0.008242376148700714,
-0.0034730657935142517,
0.0026946517173200846,
0.004407190252095461,
-0.002248066943138838,
-0.00724007049575448,
0.00004268367410986684,
0.0013035685988143086,
-0.00659587886184454,
0.0019705737940967083,
0.013130918145179749,
-0.00012581582996062934,
0.004670270252972841,
-0.0024603994097560644,
-0.006769128609448671,
-0.013605319894850254,
0.055607300251722336,
-0.0011092211352661252,
0.0029014807660132647,
0.00611796835437417,
-0.006206628866493702,
-0.0009409379563294351,
-0.005073423497378826,
0.005778233986347914,
-0.00657395925372839,
-0.00388244166970253,
0.00997241586446762,
-0.0025945529341697693,
0.0034408278297632933,
0.0018415297381579876,
-0.004323869943618774,
0.021172242239117622,
-0.0008080928237177432,
-0.015611277893185616,
-0.019955428317189217,
0.006398449651896954,
-0.005070563871413469,
-0.00812617875635624,
0.00853736326098442,
-0.0021119534503668547,
-0.006282631307840347,
0.003613492241129279,
0.005681514274328947,
0.000057772362197283655,
-0.00048137127305381,
-0.0026843759696930647,
-0.0033243251964449883,
-0.00012643910304177552,
0.0007831042166799307,
0.006345398258417845,
0.009918858297169209,
-0.0026176103856414557,
0.0075968047603964806,
-0.00348403281532228,
-0.0014170720241963863,
0.00043539173202589154,
0.00703671108931303,
0.00610373867675662,
-0.00029384615481831133,
-0.0008578883716836572,
0.006042082328349352,
0.0017592980293557048,
-0.0021011685021221638,
0.012570765800774097,
0.0019981188233941793,
-0.0032014416065067053,
0.009486614726483822,
0.008497480303049088,
-0.001913072424940765,
0.0077507225796580315,
-0.00042873082566075027,
0.006178500130772591,
0.004793161526322365,
-0.007572291884571314,
-0.01308203861117363,
-0.0027571399696171284,
0.005579699762165546,
0.00918018352240324,
0.0008622191962786019,
0.0016485140658915043,
0.0007831745897419751,
-0.000911128765437752,
-0.010608105920255184,
-0.0061410339549183846,
-0.0029093425255268812,
-0.0008987490436993539,
0.0037759991828352213,
0.07067614793777466,
-0.006767537444829941,
-0.0001422013301635161,
-0.008640789426863194,
0.0023276263382285833,
0.0014439173974096775,
-0.002738578710705042,
0.002259407192468643,
-0.0007101533119566739,
0.0016656803200021386,
0.005473421420902014,
-0.007234746590256691,
-0.011156134307384491,
-0.0011638172436505556,
0.0030680166091769934,
-0.002492080442607403,
0.006601179949939251,
0.005032794084399939,
-0.006933834403753281,
0.0017364798113703728,
-0.015593144111335278,
-0.005465778522193432,
-0.0019142074743285775,
-0.006138788070529699,
-0.0030972876120358706,
-0.00126108736731112,
0.004659141879528761,
0.0052439868450164795,
0.004646162036806345,
-0.005471907090395689,
0.005740738939493895,
-0.003941752947866917,
-0.0004138289950788021,
-0.004301850683987141,
-0.0027185992803424597,
-0.005545909516513348,
0.008819445967674255,
-0.0006893655518069863,
-0.014396692626178265,
-0.003964225295931101,
-0.0012459130957722664,
-0.0003026662743650377,
-0.006376789417117834,
0.0030980973970144987,
-0.000542395981028676,
0.006428046617656946,
-0.0035902776289731264,
0.003959743306040764,
-0.004718047566711903,
-0.0010171582689508796,
-0.013968036510050297,
0.0034282563719898462,
-0.18367397785186768,
0.013069858774542809,
0.0034553087316453457,
-0.005051852203905582,
-0.0035015626344829798,
-0.01412748172879219,
-0.012120679020881653,
0.0052477531135082245,
0.009396356530487537,
0.004621047992259264,
0.0009125442011281848,
-0.000948769215028733,
0.002535676583647728,
0.0030766851268708706,
-0.004707233514636755,
-0.0039519816637039185,
0.0033931825309991837,
-0.006679053883999586,
-0.0004691986250691116,
0.004734459798783064,
0.005342801101505756,
0.008299000561237335,
0.0030068904161453247,
0.0009980036411434412,
0.0004927885020151734,
-0.004753321409225464,
0.005627587903290987,
-0.0033358228392899036,
0.004623799119144678,
-0.013325675390660763,
-0.006835911422967911,
-0.005392097868025303,
-0.005721019580960274,
0.003180398605763912,
0.0009136704029515386,
0.00016094607417471707,
0.00795671809464693,
0.001206747954711318,
-0.00914329569786787,
0.00897466205060482,
-0.008272159844636917,
0.029325176030397415,
0.00740832882001996,
0.005132943857461214,
0.0000991946435533464,
-0.0047881025820970535,
-0.00396535312756896,
0.009575323201715946,
0.004741827491670847,
0.013669760897755623,
-0.014220158569514751,
-0.0025629857555031776,
0.0024537660647183657,
0.018714597448706627,
-0.0038825604133307934,
-0.009662234224379063,
-0.008353112265467644,
-0.004893229342997074,
0.003433259204030037,
0.01021686103194952,
0.009818940423429012,
-0.0018208777764812112,
0.010183589532971382,
-0.006144721060991287,
-0.025886017829179764,
0.00613808911293745,
0.0005978606641292572,
-0.00703844940289855,
0.004881412722170353,
0.00598159758374095,
0.011019640602171421,
-0.00361012015491724,
0.004759883973747492,
-0.000043894269765587524,
0.00017356319585815072,
-0.001283341902308166,
0.005361662246286869,
-0.004935641307383776,
0.006494707893580198,
-0.010419719852507114,
0.008336472325026989,
-0.008953564800322056,
-0.003235770622268319,
0.0017654049443081021,
-0.005882473196834326,
0.010957037098705769,
0.005256031174212694,
-0.004356661345809698,
-0.0000933449191506952,
-0.014218777418136597,
-0.0005124040180817246,
0.0005518175312317908,
0.004124781116843224,
-0.00857821386307478,
0.0006528888479806483,
-0.001258872332982719,
0.004693220369517803,
0.008520510978996754,
-0.008062146604061127,
0.009880626574158669,
0.0014593100640922785,
-0.005439138971269131,
0.0004088349814992398,
-0.005600190721452236,
0.0011864490807056427,
0.0047744158655405045,
-0.00874016061425209,
-0.008462106809020042,
0.004608543124049902,
-0.007930859923362732,
-0.004537583328783512,
0.004984588827937841,
-0.008512330241501331,
-0.008692506700754166,
-0.0014069637982174754,
-0.013183089904487133,
-0.00014817460032645613
] |
d99b5ab0ec594ac30b1d197b23a5cda7c48151d5 | 18,065 | py | Python | rasa/train.py | Amirali-Shirkh/rasa-for-botfront | 36aa24ad31241c5d1a180bbe34e1c8c50da40ff7 | [
"Apache-2.0"
] | null | null | null | rasa/train.py | Amirali-Shirkh/rasa-for-botfront | 36aa24ad31241c5d1a180bbe34e1c8c50da40ff7 | [
"Apache-2.0"
] | null | null | null | rasa/train.py | Amirali-Shirkh/rasa-for-botfront | 36aa24ad31241c5d1a180bbe34e1c8c50da40ff7 | [
"Apache-2.0"
] | null | null | null | import asyncio
import os
import tempfile
from contextlib import ExitStack
from typing import Text, Optional, List, Union, Dict
from rasa.importers.importer import TrainingDataImporter
from rasa import model
from rasa.model import FingerprintComparisonResult
from rasa.core.domain import Domain
from rasa.utils.common import TempDirectoryPath
from rasa.cli.utils import (
print_success,
print_warning,
print_error,
bcolors,
print_color,
)
from rasa.constants import DEFAULT_MODELS_PATH, DEFAULT_CORE_SUBDIRECTORY_NAME
def train(
domain: Text,
config: Text,
training_files: Union[Text, List[Text]],
output: Text = DEFAULT_MODELS_PATH,
force_training: bool = False,
fixed_model_name: Optional[Text] = None,
persist_nlu_training_data: bool = False,
additional_arguments: Optional[Dict] = None,
loop: Optional[asyncio.AbstractEventLoop] = None,
) -> Optional[Text]:
if loop is None:
try:
loop = asyncio.get_event_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
return loop.run_until_complete(
train_async(
domain=domain,
config=config,
training_files=training_files,
output_path=output,
force_training=force_training,
fixed_model_name=fixed_model_name,
persist_nlu_training_data=persist_nlu_training_data,
additional_arguments=additional_arguments,
)
)
async def train_async(
domain: Union[Domain, Text],
config: Dict[Text, Text],
training_files: Optional[Union[Text, List[Text]]],
output_path: Text = DEFAULT_MODELS_PATH,
force_training: bool = False,
fixed_model_name: Optional[Text] = None,
persist_nlu_training_data: bool = False,
additional_arguments: Optional[Dict] = None,
) -> Optional[Text]:
"""Trains a Rasa model (Core and NLU).
Args:
domain: Path to the domain file.
config: Dict of paths to the config for Core and NLU. Keys are language codes
training_files: Paths to the training data for Core and NLU.
output_path: Output path.
force_training: If `True` retrain model even if data has not changed.
fixed_model_name: Name of model to be stored.
persist_nlu_training_data: `True` if the NLU training data should be persisted
with the model.
additional_arguments: Additional training parameters.
Returns:
Path of the trained model archive.
"""
# file_importer = TrainingDataImporter.load_from_config(
# config, domain, training_files
# )
with ExitStack() as stack:
train_path = stack.enter_context(TempDirectoryPath(tempfile.mkdtemp()))
# bf mod
from rasa_addons.importers import BotfrontFileImporter
file_importer = BotfrontFileImporter(config, domain, training_files)
# domain = await file_importer.get_domain()
# if domain.is_empty():
# return await handle_domain_if_not_exists(
# file_importer, output_path, fixed_model_name
# )
# /bf mod
return await _train_async_internal(
file_importer,
train_path,
output_path,
force_training,
fixed_model_name,
persist_nlu_training_data,
additional_arguments,
)
async def handle_domain_if_not_exists(
file_importer: TrainingDataImporter, output_path, fixed_model_name
):
nlu_model_only = await _train_nlu_with_validated_data(
file_importer, output=output_path, fixed_model_name=fixed_model_name
)
print_warning(
"Core training was skipped because no valid domain file was found. Only an nlu-model was created."
"Please specify a valid domain using '--domain' argument or check if the provided domain file exists."
)
return nlu_model_only
async def _train_async_internal(
file_importer: TrainingDataImporter,
train_path: Text,
output_path: Text,
force_training: bool,
fixed_model_name: Optional[Text],
persist_nlu_training_data: bool,
additional_arguments: Optional[Dict],
) -> Optional[Text]:
"""Trains a Rasa model (Core and NLU). Use only from `train_async`.
Args:
file_importer: `TrainingDataImporter` which supplies the training data.
train_path: Directory in which to train the model.
output_path: Output path.
force_training: If `True` retrain model even if data has not changed.
persist_nlu_training_data: `True` if the NLU training data should be persisted
with the model.
fixed_model_name: Name of model to be stored.
additional_arguments: Additional training parameters.
Returns:
Path of the trained model archive.
"""
stories, nlu_data = await asyncio.gather(
file_importer.get_stories(), file_importer.get_nlu_data()
)
# if stories.is_empty() and nlu_data.is_empty():
# print_error(
# "No training data given. Please provide stories and NLU data in "
# "order to train a Rasa model using the '--data' argument."
# )
# return
# if nlu_data.is_empty():
# print_warning("No NLU data present. Just a Rasa Core model will be trained.")
# return await _train_core_with_validated_data(
# file_importer,
# output=output_path,
# fixed_model_name=fixed_model_name,
# additional_arguments=additional_arguments,
# )
new_fingerprint = await model.model_fingerprint(file_importer)
old_model = model.get_latest_model(output_path)
fingerprint_comparison = FingerprintComparisonResult(force_training=force_training)
if not force_training:
fingerprint_comparison = model.should_retrain(
new_fingerprint, old_model, train_path
)
# bf mod >
if fingerprint_comparison.nlu == True: # replace True with list of all langs
fingerprint_comparison.nlu = list(new_fingerprint.get("nlu-config", {}).keys())
domain = await file_importer.get_domain()
core_untrainable = domain.is_empty() or stories.is_empty()
nlu_untrainable = [l for l, d in nlu_data.items() if d.is_empty()]
fingerprint_comparison.core = fingerprint_comparison.core and not core_untrainable
fingerprint_comparison.nlu = [l for l in fingerprint_comparison.nlu if l not in nlu_untrainable]
if core_untrainable:
print_color("Skipping Core training since domain or stories are empty.", color=bcolors.OKBLUE)
for lang in nlu_untrainable:
print_color("No NLU data found for language <{}>, skipping training...".format(lang), color=bcolors.OKBLUE)
# </ bf mod
if fingerprint_comparison.is_training_required():
await _do_training(
file_importer,
output_path=output_path,
train_path=train_path,
fingerprint_comparison_result=fingerprint_comparison,
fixed_model_name=fixed_model_name,
persist_nlu_training_data=persist_nlu_training_data,
additional_arguments=additional_arguments,
)
return model.package_model(
fingerprint=new_fingerprint,
output_directory=output_path,
train_path=train_path,
fixed_model_name=fixed_model_name,
)
print_success(
"Nothing changed. You can use the old model stored at '{}'."
"".format(os.path.abspath(old_model))
)
return old_model
async def _do_training(
file_importer: TrainingDataImporter,
output_path: Text,
train_path: Text,
fingerprint_comparison_result: Optional[FingerprintComparisonResult] = None,
fixed_model_name: Optional[Text] = None,
persist_nlu_training_data: bool = False,
additional_arguments: Optional[Dict] = None,
):
if not fingerprint_comparison_result:
fingerprint_comparison_result = FingerprintComparisonResult()
if fingerprint_comparison_result.should_retrain_core():
await _train_core_with_validated_data(
file_importer,
output=output_path,
train_path=train_path,
fixed_model_name=fixed_model_name,
additional_arguments=additional_arguments,
)
elif fingerprint_comparison_result.should_retrain_nlg():
print_color(
"Core stories/configuration did not change. "
"Only the templates section has been changed. A new model with "
"the updated templates will be created.",
color=bcolors.OKBLUE,
)
await model.update_model_with_new_domain(file_importer, train_path)
else:
print_color(
"Core stories/configuration did not change. No need to retrain Core model.",
color=bcolors.OKBLUE,
)
if fingerprint_comparison_result.should_retrain_nlu():
await _train_nlu_with_validated_data(
file_importer,
output=output_path,
train_path=train_path,
fixed_model_name=fixed_model_name,
retrain_nlu=fingerprint_comparison_result.nlu,
persist_nlu_training_data=persist_nlu_training_data,
)
else:
print_color(
"NLU data/configuration did not change. No need to retrain NLU model.",
color=bcolors.OKBLUE,
)
def train_core(
domain: Union[Domain, Text],
config: Text,
stories: Text,
output: Text,
train_path: Optional[Text] = None,
fixed_model_name: Optional[Text] = None,
additional_arguments: Optional[Dict] = None,
) -> Optional[Text]:
loop = asyncio.get_event_loop()
return loop.run_until_complete(
train_core_async(
domain=domain,
config=config,
stories=stories,
output=output,
train_path=train_path,
fixed_model_name=fixed_model_name,
additional_arguments=additional_arguments,
)
)
async def train_core_async(
domain: Union[Domain, Text],
config: Text,
stories: Text,
output: Text,
train_path: Optional[Text] = None,
fixed_model_name: Optional[Text] = None,
additional_arguments: Optional[Dict] = None,
) -> Optional[Text]:
"""Trains a Core model.
Args:
domain: Path to the domain file.
config: Path to the config file for Core.
stories: Path to the Core training data.
output: Output path.
train_path: If `None` the model will be trained in a temporary
directory, otherwise in the provided directory.
fixed_model_name: Name of model to be stored.
uncompress: If `True` the model will not be compressed.
additional_arguments: Additional training parameters.
Returns:
If `train_path` is given it returns the path to the model archive,
otherwise the path to the directory with the trained model files.
"""
file_importer = TrainingDataImporter.load_core_importer_from_config(
config, domain, [stories]
)
domain = await file_importer.get_domain()
if domain.is_empty():
print_error(
"Core training was skipped because no valid domain file was found. "
"Please specify a valid domain using '--domain' argument or check if the provided domain file exists."
)
return None
if not await file_importer.get_stories():
print_error(
"No stories given. Please provide stories in order to "
"train a Rasa Core model using the '--stories' argument."
)
return
return await _train_core_with_validated_data(
file_importer,
output=output,
train_path=train_path,
fixed_model_name=fixed_model_name,
additional_arguments=additional_arguments,
)
async def _train_core_with_validated_data(
file_importer: TrainingDataImporter,
output: Text,
train_path: Optional[Text] = None,
fixed_model_name: Optional[Text] = None,
additional_arguments: Optional[Dict] = None,
) -> Optional[Text]:
"""Train Core with validated training and config data."""
import rasa.core.train
with ExitStack() as stack:
if train_path:
# If the train path was provided, do nothing on exit.
_train_path = train_path
else:
# Otherwise, create a temp train path and clean it up on exit.
_train_path = stack.enter_context(TempDirectoryPath(tempfile.mkdtemp()))
# normal (not compare) training
print_color("Training Core model...", color=bcolors.OKBLUE)
domain, config = await asyncio.gather(
file_importer.get_domain(), file_importer.get_config()
)
await rasa.core.train(
domain_file=domain,
training_resource=file_importer,
output_path=os.path.join(_train_path, DEFAULT_CORE_SUBDIRECTORY_NAME),
policy_config=config,
additional_arguments=additional_arguments,
)
print_color("Core model training completed.", color=bcolors.OKBLUE)
if train_path is None:
# Only Core was trained.
new_fingerprint = await model.model_fingerprint(file_importer)
return model.package_model(
fingerprint=new_fingerprint,
output_directory=output,
train_path=_train_path,
fixed_model_name=fixed_model_name,
model_prefix="core-",
)
return _train_path
def train_nlu(
config: Text,
nlu_data: Text,
output: Text,
train_path: Optional[Text] = None,
fixed_model_name: Optional[Text] = None,
persist_nlu_training_data: bool = False,
) -> Optional[Text]:
"""Trains an NLU model.
Args:
config: Path to the config file for NLU.
nlu_data: Path to the NLU training data.
output: Output path.
train_path: If `None` the model will be trained in a temporary
directory, otherwise in the provided directory.
fixed_model_name: Name of the model to be stored.
persist_nlu_training_data: `True` if the NLU training data should be persisted
with the model.
Returns:
If `train_path` is given it returns the path to the model archive,
otherwise the path to the directory with the trained model files.
"""
loop = asyncio.get_event_loop()
return loop.run_until_complete(
_train_nlu_async(
config,
nlu_data,
output,
train_path,
fixed_model_name,
persist_nlu_training_data,
)
)
async def _train_nlu_async(
config: Text,
nlu_data: Text,
output: Text,
train_path: Optional[Text] = None,
fixed_model_name: Optional[Text] = None,
persist_nlu_training_data: bool = False,
):
if not nlu_data:
print_error(
"No NLU data given. Please provide NLU data in order to train "
"a Rasa NLU model using the '--nlu' argument."
)
return
# training NLU only hence the training files still have to be selected
file_importer = TrainingDataImporter.load_nlu_importer_from_config(
config, training_data_paths=[nlu_data]
)
training_datas = await file_importer.get_nlu_data()
if training_datas.is_empty():
print_error(
f"Path '{nlu_data}' doesn't contain valid NLU data in it. "
"Please verify the data format. "
"The NLU model training will be skipped now."
)
return
return await _train_nlu_with_validated_data(
file_importer,
output=output,
train_path=train_path,
fixed_model_name=fixed_model_name,
persist_nlu_training_data=persist_nlu_training_data,
)
async def _train_nlu_with_validated_data(
file_importer: TrainingDataImporter,
output: Text,
train_path: Optional[Text] = None,
fixed_model_name: Optional[Text] = None,
persist_nlu_training_data: bool = False,
retrain_nlu: Union[bool, List[Text]] = True
) -> Optional[Text]:
"""Train NLU with validated training and config data."""
import rasa.nlu.train
with ExitStack() as stack:
models = {}
from rasa.nlu import config as cfg_loader
if train_path:
# If the train path was provided, do nothing on exit.
_train_path = train_path
else:
# Otherwise, create a temp train path and clean it up on exit.
_train_path = stack.enter_context(TempDirectoryPath(tempfile.mkdtemp()))
# bf mod
config = await file_importer.get_nlu_config(retrain_nlu)
for lang in config:
if config[lang]:
print_color("Start training {} NLU model ...".format(lang), color=bcolors.OKBLUE)
_, models[lang], _ = await rasa.nlu.train(
config[lang],
file_importer,
_train_path,
fixed_model_name="nlu-{}".format(lang),
persist_nlu_training_data=persist_nlu_training_data,
)
else:
print_color("NLU data for language <{}> didn't change, skipping training...".format(lang), color=bcolors.OKBLUE)
# /bf mod
print_color("NLU model training completed.", color=bcolors.OKBLUE)
if train_path is None:
# Only NLU was trained
new_fingerprint = await model.model_fingerprint(file_importer)
return model.package_model(
fingerprint=new_fingerprint,
output_directory=output,
train_path=_train_path,
fixed_model_name=fixed_model_name,
model_prefix="nlu-",
)
return _train_path
| 34.673704 | 128 | 0.654027 | 1 | 1.9476 | [
-0.028531698510050774,
0.015354073606431484,
-0.0034953681752085686,
-0.053973238915205,
-0.03265426680445671,
-0.014266532845795155,
0.0019289333140477538,
-0.02750026248395443,
0.0009564444771967828,
-0.011207676492631435,
-0.018872573971748352,
-0.003423982532694936,
0.009573208168148994,
-0.02166062220931053,
-0.010725564323365688,
-0.018650002777576447,
-0.005483879242092371,
0.02323223277926445,
-0.029567506164312363,
-0.03738561272621155,
0.008445538580417633,
0.013048207387328148,
0.011807739734649658,
0.022877056151628494,
0.03983135521411896,
0.021734971553087234,
0.021523429080843925,
0.04102146625518799,
0.03045034222304821,
-0.020153017714619637,
-0.013023474253714085,
0.0181107334792614,
-0.01606256514787674,
-0.026651348918676376,
-0.004791251849383116,
-0.005199813283979893,
0.006389644928276539,
-0.022801969200372696,
0.014265211299061775,
0.032753296196460724,
-0.00859873741865158,
0.008495044894516468,
0.0012264105025678873,
-0.02202717587351799,
0.02049340307712555,
0.0261695459485054,
0.007620456162840128,
0.04858888313174248,
-0.018568163737654686,
0.0094077680259943,
-0.015079904347658157,
0.011400118470191956,
0.011187640950083733,
-0.024730049073696136,
0.01749546267092228,
-0.03972150385379791,
0.009486374445259571,
0.039000362157821655,
-0.009176620282232761,
0.011531784199178219,
-0.02204635925590992,
-0.019816221669316292,
-0.0072191632352769375,
-0.005238774232566357,
0.012423915788531303,
0.000009464220966037828,
0.001566216698847711,
-0.004163788631558418,
-0.04806295782327652,
-0.005670587532222271,
0.012884426862001419,
0.0018351178150624037,
-0.006224536336958408,
0.016949787735939026,
0.04850432649254799,
-0.008562958799302578,
-0.02292518876492977,
-0.018467333167791367,
-0.011578211560845375,
0.00615466246381402,
-0.010555915534496307,
0.055113840848207474,
-0.0031872738618403673,
0.0008298997418023646,
0.015867451205849648,
0.086829774081707,
0.02126493863761425,
-0.004005607217550278,
-0.02340647764503956,
-0.01100082602351904,
-0.012559521943330765,
0.040895164012908936,
-0.012821204960346222,
-0.002962574828416109,
-0.031700942665338516,
-0.0658576563000679,
0.020239274948835373,
0.01655041240155697,
-0.005011409055441618,
0.01674545183777809,
0.00824129581451416,
0.0066082663834095,
-0.010939164087176323,
-0.004663069732487202,
0.0206645205616951,
-0.03335737809538841,
-0.03615289553999901,
-0.023223772644996643,
0.013145020231604576,
-0.03368178755044937,
-0.08006390184164047,
-0.0005961897550150752,
0.03493879735469818,
-0.011572696268558502,
-0.0024474661331623793,
-0.00755745405331254,
-0.007167799398303032,
0.012550399638712406,
-0.001414893427863717,
0.10819392651319504,
0.029540719464421272,
-0.017178459092974663,
0.028366202488541603,
-0.06333433836698532,
-0.023707786574959755,
0.05147232487797737,
0.03457516431808472,
-0.013026034459471703,
-0.013304228894412518,
-0.012520652264356613,
-0.017130209133028984,
0.01874355785548687,
0.02614027075469494,
0.009667369537055492,
0.012939857318997383,
-0.01552402414381504,
0.02991602197289467,
0.029880117624998093,
-0.0018692680168896914,
0.0135953389108181,
0.02832048386335373,
0.008218863978981972,
0.018886268138885498,
-0.03993520885705948,
-0.0042240209877491,
-0.007311388850212097,
-0.025910407304763794,
0.0028139431960880756,
-0.01832127384841442,
-0.015154058113694191,
0.013710583560168743,
-0.035519666969776154,
0.003560570999979973,
0.014702795073390007,
0.0005915208021178842,
-0.026486743241548538,
0.003986934665590525,
-0.05006179213523865,
-0.04032338038086891,
-0.005910580512136221,
-0.0073897275142371655,
0.033976685255765915,
-0.021612567827105522,
0.03105846419930458,
0.028595639392733574,
-0.039053745567798615,
-0.013837163336575031,
0.007334779482334852,
0.024131542071700096,
0.0202031172811985,
0.012388882227241993,
-0.0006766052101738751,
0.028358815237879753,
0.01632494293153286,
-0.056124113500118256,
0.02141740918159485,
0.02679092437028885,
0.011477977968752384,
-0.012224684469401836,
-0.0018089854856953025,
-0.020628318190574646,
-0.01124916784465313,
0.003537981305271387,
0.03294553980231285,
-0.009086296893656254,
-0.02974211797118187,
-0.051875773817300797,
-0.016595032066106796,
0.0206883754581213,
-0.01876106485724449,
-0.0095409220084548,
-0.007668131962418556,
-0.01825598068535328,
0.016040045768022537,
0.022487085312604904,
-0.004629290662705898,
0.021649209782481194,
-0.030042501166462898,
0.001557745155878365,
-0.004279964603483677,
0.032302550971508026,
-0.0044301943853497505,
-0.011269185692071915,
0.07109733670949936,
-0.010325931943953037,
-0.01818343624472618,
-0.7157067060470581,
0.018976017832756042,
-0.026506999507546425,
-0.02521735429763794,
-0.00044704924221150577,
0.04011612758040428,
-0.0341535322368145,
-0.03499310463666916,
-0.06054600700736046,
-0.01751144602894783,
-0.007347242906689644,
0.007115507498383522,
-0.027065938338637352,
0.04467080533504486,
-0.007008208427578211,
-0.03035975620150566,
-0.004354465287178755,
0.01601974479854107,
-0.019126931205391884,
-0.014025259763002396,
-0.0077125681564211845,
-0.02951754815876484,
-0.010299472138285637,
0.01265200786292553,
-0.0017988784238696098,
-0.014228870160877705,
0.046905819326639175,
0.02467496506869793,
-0.05729595199227333,
0.010948178358376026,
-0.0048730019479990005,
-0.011211173608899117,
0.0000010301207566953963,
0.00667224358767271,
0.03730833902955055,
0.010543491691350937,
0.00044534189510159194,
-0.05196060985326767,
-0.02494213543832302,
-0.017389724031090736,
0.048813894391059875,
-0.03010903112590313,
-0.00027761870296671987,
-0.03521059453487396,
-0.07366907596588135,
-0.02363300882279873,
-0.029454492032527924,
-0.05181953310966492,
0.007505724206566811,
0.012137271463871002,
-0.010495933704078197,
0.019511297345161438,
0.0456368625164032,
-0.036479704082012177,
-0.053288426250219345,
0.0008487829472869635,
-0.03514857590198517,
-0.004604216665029526,
-0.022185862064361572,
-0.0072397710755467415,
0.025275995954871178,
-0.005900852847844362,
-0.012828388251364231,
0.008997923694550991,
-0.020353272557258606,
0.0038239990826696157,
0.053821541368961334,
0.004072149284183979,
0.008865132927894592,
0.018037457019090652,
-0.05377085134387016,
0.03659478574991226,
0.0055949571542441845,
0.06649106740951538,
0.02541077323257923,
-0.00966354738920927,
-0.006945481523871422,
0.012519525364041328,
-0.04069702327251434,
-0.014675237238407135,
-0.011774655431509018,
-0.0025463318452239037,
-0.0053989882580935955,
-0.022517642006278038,
-0.011629476211965084,
-0.0005142669542692602,
0.016534097492694855,
-0.013509316369891167,
-0.02431088499724865,
0.019742753356695175,
0.015842419117689133,
0.034842316061258316,
0.040744997560977936,
-0.009610207751393318,
-0.003438960760831833,
0.035221442580223083,
0.04287653788924217,
0.03419763594865799,
0.009482843801379204,
-0.01441405713558197,
-0.033761028200387955,
0.007443379145115614,
-0.014259085059165955,
0.06755080074071884,
-0.01343041192740202,
0.00280843791551888,
-0.021213103085756302,
-0.0197024904191494,
0.03192273899912834,
-0.017406586557626724,
0.03947438299655914,
0.003449690528213978,
-0.02881184220314026,
0.011179938912391663,
0.014524801634252071,
-0.010021839290857315,
-0.0018113846890628338,
-0.027187829837203026,
0.009504415094852448,
-0.008192263543605804,
-0.016231687739491463,
0.009918167255818844,
-0.00980567466467619,
0.027955619618296623,
-0.04313722252845764,
0.029231686145067215,
-0.06761129200458527,
0.005501134786754847,
-0.04196624085307121,
0.021875249221920967,
-0.010573082603514194,
-0.0024168111849576235,
0.023976264521479607,
0.02018395997583866,
0.009681402705609798,
0.003738909726962447,
-0.015867609530687332,
-0.008922343142330647,
0.018464960157871246,
0.0028702414128929377,
0.05041809380054474,
-0.013668968342244625,
-0.02010105736553669,
-0.023572105914354324,
0.01393007393926382,
0.011037557385861874,
0.02636360190808773,
-0.02634468674659729,
-0.002010439056903124,
-0.013573271222412586,
0.010958042927086353,
0.03970110043883324,
0.008683646097779274,
0.017508625984191895,
-0.0006990963011048734,
-0.005890352185815573,
-0.011280196718871593,
-0.015208801254630089,
0.006676868535578251,
0.004526092205196619,
-0.043383318930864334,
-0.013852073810994625,
-0.025740329176187515,
-0.01536323968321085,
-0.0064690676517784595,
0.019524237141013145,
-0.0038665635511279106,
0.04536959528923035,
-0.003504501422867179,
0.0034425274934619665,
0.010243790224194527,
-0.026003073900938034,
0.018200499936938286,
0.0004703021259047091,
-0.00038767518708482385,
0.007448634132742882,
0.01652470789849758,
-0.07180891931056976,
-0.00889807753264904,
0.012413045391440392,
-0.006491521373391151,
0.015963135287165642,
0.0072457268834114075,
-0.01000848039984703,
-0.015811016783118248,
0.026382483541965485,
-0.01962297596037388,
0.0327780619263649,
0.017143256962299347,
-0.030805127695202827,
-0.01475485973060131,
0.00570368068292737,
-0.03194902837276459,
-0.0005375532782636583,
-0.021521328017115593,
-0.01874435879290104,
0.019665591418743134,
0.01648937538266182,
-0.027580969035625458,
-0.000745448109228164,
-0.015170607715845108,
0.03881453350186348,
-0.0035827448591589928,
0.01711917109787464,
0.017920169979333878,
0.001191429910250008,
0.0002502536226529628,
-0.028513867408037186,
-0.015046750195324421,
-0.020160024985671043,
0.047737158834934235,
-0.015641752630472183,
0.03409147262573242,
0.027834735810756683,
0.03310097008943558,
0.037585921585559845,
-0.031029611825942993,
-0.032349854707717896,
-0.014479268342256546,
-0.021920431405305862,
0.00627592159435153,
-0.001423613983206451,
-0.008266075514256954,
-0.004882707726210356,
-0.020086117088794708,
0.016427621245384216,
-0.023226942867040634,
0.0028878042940050364,
-0.0041395677253603935,
0.017556464299559593,
0.01343072671443224,
-0.01016897615045309,
0.0031551155261695385,
-0.016441727057099342,
-0.03548910468816757,
-0.002444084268063307,
-0.02258637174963951,
-0.02742423489689827,
-0.04562710225582123,
-0.02857244201004505,
0.017877018079161644,
-0.030332505702972412,
-0.035314612090587616,
0.016559522598981857,
0.02375275455415249,
-0.03885414078831673,
0.014761511236429214,
-0.043410394340753555,
-0.06689408421516418,
-0.03031224198639393,
-0.01835915632545948,
0.019365482032299042,
0.02338550239801407,
-0.004755339119583368,
0.024750493466854095,
0.00198488705791533,
-0.021098408848047256,
0.012850983068346977,
0.011521188542246819,
0.005315102636814117,
-0.020801639184355736,
-0.022479470819234848,
-0.00014409571303986013,
0.04501088336110115,
-0.09954468160867691,
-0.026003621518611908,
-0.03352191299200058,
-0.0039296625182032585,
-0.018067635595798492,
0.02919720858335495,
0.02505257911980152,
-0.021006343886256218,
0.0034567874390631914,
-0.0034655756317079067,
-0.02941982075572014,
-0.02164829708635807,
0.0032635643146932125,
0.011790700256824493,
0.017029834911227226,
0.02012772485613823,
-0.029165633022785187,
-0.007719007320702076,
0.022896993905305862,
0.03199562057852745,
0.016882067546248436,
0.04220404848456383,
0.021551035344600677,
-0.03113127499818802,
-0.019771337509155273,
0.00012965890346094966,
0.020114876329898834,
-0.07563084363937378,
-0.001914672669954598,
0.026450108736753464,
0.00041415475425310433,
-0.03141721338033676,
-0.00401859637349844,
0.02819089964032173,
0.06165192276239395,
0.04080696776509285,
0.00283852219581604,
-0.029932944104075432,
0.013234804384410381,
0.007889949716627598,
0.010364852845668793,
0.004431812558323145,
0.027446672320365906,
0.007366647478193045,
0.02041645348072052,
0.04112885519862175,
0.027256866917014122,
0.013123723678290844,
-0.011268172413110733,
-0.00492474902421236,
0.009590496309101582,
0.007426825352013111,
0.02290550246834755,
0.04306532070040703,
-0.0037031560204923153,
0.0001011808926705271,
-0.03470537066459656,
0.04080044850707054,
-0.017772648483514786,
-0.04011010751128197,
-0.02801511250436306,
-0.01744937337934971,
-0.009583358652889729,
-0.019417688250541687,
-0.019920319318771362,
-0.006271014921367168,
-0.007533477619290352,
-0.001609294442459941,
0.0045453207567334175,
-0.006122348830103874,
0.004200896248221397,
0.004123392514884472,
-0.023792460560798645,
0.02687964215874672,
0.04781871661543846,
-0.018733900040388107,
0.0035845478996634483,
0.006067967973649502,
0.02062719687819481,
0.005871974863111973,
0.0000652505477773957,
-0.045745544135570526,
0.04838557913899422,
0.04727594554424286,
0.015654481947422028,
0.025208259001374245,
0.006078808102756739,
-0.02661081589758396,
-0.01890507899224758,
0.008570735342800617,
-0.00535655627027154,
0.0021910781506448984,
0.022841306403279305,
0.04036356881260872,
0.02701876498758793,
-0.006465805694460869,
0.008144342340528965,
-0.0009442844311706722,
-0.007709868717938662,
-0.0032519742380827665,
-0.013236225582659245,
-0.010697816498577595,
0.0487503856420517,
-0.0027201243210583925,
-0.026183417066931725,
0.02378954365849495,
0.034696031361818314,
0.003238316159695387,
0.055245693773031235,
-0.02777181938290596,
0.03746464475989342,
-0.01953132264316082,
0.029587747529149055,
-0.013820123858749866,
0.008479692041873932,
-0.015856275334954262,
-0.015455389395356178,
0.004035551100969315,
0.013588166795670986,
0.04606325924396515,
0.04025821015238762,
-0.04285600036382675,
0.020834283903241158,
0.0032428584527224302,
-0.014546835795044899,
-0.0027759536169469357,
-0.01644076220691204,
0.016058051958680153,
0.03487985208630562,
0.027041111141443253,
-0.019686132669448853,
-0.002873200923204422,
0.020273391157388687,
-0.00766115402802825,
0.011987734586000443,
0.016490694135427475,
-0.022701166570186615,
-0.03871312737464905,
0.00757194310426712,
0.005388012621551752,
0.049488745629787445,
-0.024096250534057617,
0.011160011403262615,
0.019909577444195747,
-0.0139027563855052,
0.00900645274668932,
-0.0050723678432404995,
0.052246756851673126,
-0.04894055053591728,
-0.008982108905911446,
0.043884921818971634,
0.011829068884253502,
0.005956854671239853,
0.015392996370792389,
0.011394143104553223,
0.02624557539820671,
-0.008027143776416779,
-0.024274565279483795,
0.02114427462220192,
-0.03010278381407261,
-0.016889967024326324,
-0.047060295939445496,
0.01613142155110836,
-0.007637746632099152,
0.014533588662743568,
-0.0025117548648267984,
-0.025103028863668442,
-0.036461152136325836,
-0.00348961865529418,
0.014559862203896046,
0.02264426462352276,
-0.009056201204657555,
0.017038922756910324,
0.017957307398319244,
-0.04443622753024101,
-0.010977813974022865,
-0.000851758464705199,
-0.012353491969406605,
-0.0244599636644125,
0.025996491312980652,
0.032730262726545334,
0.06502000242471695,
0.007268800865858793,
-0.010609280318021774,
-0.013139312155544758,
-0.02207869291305542,
-0.012156558223068714,
0.008975900709629059,
0.031838711351156235,
0.02648027427494526,
-0.013180428184568882,
0.01691030152142048,
0.059490304440259933,
0.030080825090408325,
0.030263597145676613,
0.029529189690947533,
0.01403277087956667,
0.026802703738212585,
-0.000530023651663214,
-0.011905534192919731,
0.04054056107997894,
0.025722038000822067,
-0.030697545036673546,
0.004685606341809034,
-0.01184574980288744,
-0.01403927244246006,
0.03320949152112007,
-0.01480578538030386,
-0.002062989631667733,
0.00011426545097492635,
0.004347844980657101,
0.022201741114258766,
0.026803232729434967,
0.01791229099035263,
0.02517963945865631,
0.00971771590411663,
-0.05617890506982803,
0.026765191927552223,
0.022635197266936302,
0.0430174246430397,
-0.0028148300480097532,
0.02029583975672722,
-0.008149764500558376,
0.006166602484881878,
-0.01617247983813286,
-0.01908821426331997,
-0.04605197533965111,
-0.026114916428923607,
0.002550235716626048,
0.05471406877040863,
-0.015558257699012756,
-0.04982348158955574,
0.02190430648624897,
-0.028864815831184387,
0.013417216017842293,
0.002305459463968873,
0.002236132277175784,
-0.03544415906071663,
-0.009790871292352676,
-0.016149524599313736,
0.015129541978240013,
0.011855178512632847,
0.030768442898988724,
0.017439136281609535,
0.006014566868543625,
0.018323751166462898,
-0.01083548367023468,
0.00518674124032259,
-0.04852606728672981,
0.018970396369695663,
0.008104097098112106,
0.022943709045648575,
0.008100097998976707,
-0.04269496724009514,
0.024332301691174507,
0.00866660475730896,
0.007030431181192398,
0.02321232669055462,
0.01998044364154339,
-0.032303646206855774,
-0.007019113749265671,
-0.01530811470001936,
-0.0008830940932966769,
-0.004622314125299454,
-0.007148458622395992,
0.025636941194534302,
-0.03330792859196663,
0.007131682708859444,
-0.0463649146258831,
-0.03573117032647133,
0.03355252742767334,
0.00439991382881999,
-0.0028842866886407137,
0.018081465736031532,
-0.017355430871248245,
-0.02639026753604412,
0.004870446398854256,
0.0012770226458087564,
0.010233073495328426,
-0.021434515714645386,
-0.00524199940264225,
0.016744669526815414,
-0.01214537676423788,
0.012165314517915249,
0.017932847142219543,
-0.007671720813959837,
0.022808367386460304,
-0.023276351392269135,
-0.033988405019044876,
-0.0008329704869538546,
-0.033282570540905,
0.0021789404563605785,
0.018354468047618866,
0.032992172986269,
-0.013123438693583012,
-0.029101809486746788,
0.01948869414627552,
-0.0012516144197434187
] |
d99e8a9a95f28da6c2d4d1ee42e95a270ab08977 | 421 | py | Python | coding_intereview/1475. Final Prices With a Special Discount in a Shop.py | Jahidul007/Python-Bootcamp | 3c870587465ff66c2c1871c8d3c4eea72463abda | [
"MIT"
] | 2 | 2020-12-07T16:07:07.000Z | 2020-12-07T16:08:53.000Z | coding_intereview/1475. Final Prices With a Special Discount in a Shop.py | purusharthmalik/Python-Bootcamp | 2ed1cf886d1081de200b0fdd4cb4e28008c7e3d1 | [
"MIT"
] | null | null | null | coding_intereview/1475. Final Prices With a Special Discount in a Shop.py | purusharthmalik/Python-Bootcamp | 2ed1cf886d1081de200b0fdd4cb4e28008c7e3d1 | [
"MIT"
] | 1 | 2020-10-03T16:38:02.000Z | 2020-10-03T16:38:02.000Z | class Solution:
def finalPrices(self, prices: List[int]) -> List[int]:
res = []
for i in range(len(prices)):
for j in range(i+1,len(prices)):
if prices[j]<=prices[i]:
res.append(prices[i]-prices[j])
break
if j==len(prices)-1:
res.append(prices[i])
res.append(prices[-1])
return res | 35.083333 | 58 | 0.460808 | 1 | 0.7581 | [
0.004136830568313599,
0.024741284549236298,
0.005890393629670143,
0.0010446994565427303,
0.0069979047402739525,
-0.004574206657707691,
-0.014335148967802525,
0.005877647083252668,
-0.00842252466827631,
0.0033554919064044952,
-0.002617230173200369,
0.005115893203765154,
0.0107621094211936,
-0.01584349386394024,
0.000012740574675262906,
0.030049839988350868,
-0.05895683169364929,
0.001840320066548884,
-0.0030286824330687523,
0.003490280592814088,
-0.010908657684922218,
0.009647172875702381,
0.008843092247843742,
0.008459829725325108,
0.008535714820027351,
-0.00017208098142873496,
0.011634261347353458,
0.006508318707346916,
-0.008698088116943836,
-0.0027009216137230396,
-0.0009079608134925365,
-0.003502033418044448,
-0.0015282018575817347,
-0.014762870036065578,
0.010333009995520115,
-0.00534013332799077,
0.0012392140924930573,
-0.015219328925013542,
0.008861154317855835,
-0.00914869736880064,
-0.007882152684032917,
-0.01897924765944481,
-0.00041047888225875795,
0.011547769419848919,
-0.012963062152266502,
0.003936755005270243,
-0.004482238087803125,
0.0006279611261561513,
-0.007905990816652775,
0.0022839109878987074,
-0.016457006335258484,
0.005623820703476667,
0.010106377303600311,
0.006896491162478924,
-0.0038327116053551435,
-0.009167403914034367,
0.009150725789368153,
-0.003838031552731991,
-0.009236188605427742,
0.001752207987010479,
-0.0034610333386808634,
-0.0019023275235667825,
0.0017654957482591271,
0.0008255895227193832,
-0.02285519428551197,
-0.00862610898911953,
-0.005099294241517782,
0.003501188475638628,
-0.007192117627710104,
0.0021554066333919764,
0.002716518472880125,
-0.0012243051314726472,
0.007724830415099859,
0.005643101874738932,
0.0026404785457998514,
0.0003220285871066153,
-0.0037716154474765062,
0.0022167142014950514,
0.012546567246317863,
0.004198790993541479,
0.005590997636318207,
-0.012278961017727852,
0.0098368925973773,
0.01573951169848442,
0.014413800090551376,
0.005290170665830374,
0.015413487330079079,
-0.013462778180837631,
0.03959035500884056,
0.00661429250612855,
-0.01089442614465952,
0.001699984073638916,
-0.008628283627331257,
-0.0026632356457412243,
-0.004648020025342703,
-0.033001113682985306,
0.0038670094218105078,
-0.004373927600681782,
0.002505338517948985,
0.0061639342457056046,
0.0009399604168720543,
0.005978855304419994,
-0.002392929047346115,
-0.005588408559560776,
-0.013144086115062237,
0.02039411850273609,
-0.009546060115098953,
-0.0018840081756934524,
0.008901204913854599,
0.002202387200668454,
-0.015882553532719612,
0.00044165714643895626,
0.006349039729684591,
-0.01692698895931244,
0.005096311680972576,
-0.002324586734175682,
-0.008093736134469509,
0.06198745593428612,
-0.0012688812566921115,
0.0003893167886417359,
-0.008099517785012722,
-0.004326577298343182,
0.005771402735263109,
0.00956672988831997,
0.01177549920976162,
-0.007250085473060608,
0.012183578684926033,
0.0020663547329604626,
0.00003311119871796109,
0.004882809240370989,
0.0005114847444929183,
0.011351694352924824,
-0.007971473969519138,
-0.0025297862011939287,
-0.0018366770818829536,
-0.005943809635937214,
0.007830241695046425,
0.00014117738464847207,
-0.00300045870244503,
0.002270575612783432,
-0.000669981527607888,
-0.018197132274508476,
0.002047718269750476,
0.0006073535769246519,
-0.0020493154879659414,
-0.011616199277341366,
-0.0016081874491646886,
-0.003182915272191167,
-0.008591470308601856,
0.002512545557692647,
0.013375042006373405,
0.004539649933576584,
0.0025667205918580294,
-0.004681827500462532,
-0.007367647252976894,
0.002816688735038042,
-0.008207789622247219,
0.0015664169332012534,
0.007681861519813538,
0.004806303884834051,
-0.009198702871799469,
-0.005099609959870577,
0.002417679177597165,
0.00041878840420395136,
-0.0007518994971178472,
0.005074651446193457,
-0.009718403220176697,
0.01232093758881092,
0.003486956236883998,
-0.0006750869797542691,
0.012495295144617558,
-0.0052755847573280334,
-0.0021333142649382353,
0.0028307342436164618,
0.004329268354922533,
0.001126205432228744,
0.005604819394648075,
0.008393778465688229,
-0.009312977083027363,
-0.002927974332123995,
0.010166455060243607,
0.002067176392301917,
0.009261694736778736,
0.007947676815092564,
-0.002245643176138401,
0.002803865820169449,
-0.006237862166017294,
0.0014782020589336753,
0.005781111307442188,
-0.004069940652698278,
0.00789609830826521,
0.004931037779897451,
-0.018136706203222275,
-0.010423536412417889,
-0.0013127382844686508,
-0.012438107281923294,
-0.0007999187218956649,
0.022086024284362793,
0.008787422440946102,
0.007001977879554033,
0.002657378790900111,
-0.01423129066824913,
-0.001511640497483313,
0.003115086816251278,
-0.0005729683325625956,
-0.01125264260917902,
-0.9464601278305054,
0.003047557082027197,
0.005215710029006004,
0.00022101371723692864,
0.005079235415905714,
-0.000593347183894366,
0.0022148594725877047,
0.0009601768688298762,
0.015037416480481625,
-0.010847755707800388,
-0.005367605946958065,
-0.014534670859575272,
-0.01567164435982704,
0.003488526213914156,
-0.0039115953259170055,
-0.0014539860421791673,
-0.006236589048057795,
-0.012857847847044468,
-0.0037921657785773277,
-0.006300634704530239,
-0.0012003304436802864,
0.006504879333078861,
0.0005212606047280133,
0.0054571377113461494,
0.003575848415493965,
0.0076145995408296585,
-0.006555722560733557,
-0.004005055874586105,
0.002291641430929303,
0.0009663634118624032,
-0.006857683882117271,
-0.014607174322009087,
-0.009292821399867535,
0.0029658563435077667,
0.01590433530509472,
0.0018909337231889367,
0.007398194633424282,
0.0010159137891605496,
0.0012961787870153785,
-0.013658029027283192,
0.007469747215509415,
0.00311517552472651,
0.0037607220001518726,
-0.028218872845172882,
0.003348512342199683,
-0.001474514720030129,
-0.010469435714185238,
0.006945374421775341,
0.008299970999360085,
-0.0020743145141750574,
-0.0034703239798545837,
-0.0034336992539465427,
0.01202258188277483,
-0.006211940199136734,
0.0040067462250590324,
-0.0033299748320132494,
-0.0010362362954765558,
0.00018867421022150666,
-0.013787961564958096,
-0.0005032764165662229,
0.0031610208097845316,
-0.005027585197240114,
-0.00364357209764421,
-0.00592685816809535,
0.0014273757115006447,
0.0017387542175129056,
0.0034438238944858313,
-0.017646122723817825,
-0.00618960615247488,
-0.002452465705573559,
0.00670350668951869,
0.001724759116768837,
-0.005374506581574678,
0.0013487304095178843,
-0.011137970723211765,
0.002581053413450718,
0.004886523354798555,
0.00386056792922318,
-0.013041582889854908,
0.0032280588056892157,
-0.009093224070966244,
-0.009515278041362762,
0.0030450294725596905,
-0.007189157884567976,
-0.0061660753563046455,
0.0010522447992116213,
0.009410384111106396,
0.010597397573292255,
-0.007001760881394148,
0.002965181600302458,
0.010047716088593006,
-0.0020387405529618263,
-0.014551381580531597,
0.0071533252485096455,
0.0037054806016385555,
0.0055897594429552555,
-0.0013502745423465967,
0.006521140690892935,
0.005990310572087765,
0.007375492248684168,
-0.0033432492054998875,
0.006121386773884296,
0.00471712090075016,
0.009272427298128605,
0.0026812846772372723,
0.002847913885489106,
-0.0022186527494341135,
0.0004779942973982543,
-0.008657854050397873,
0.003871246473863721,
-0.007676543202251196,
-0.0005284108920022845,
-0.01443944126367569,
-0.011484110727906227,
-0.0074247573502361774,
0.0038960527162998915,
-0.0023621362634003162,
-0.006945519242435694,
-0.0002988582127727568,
-0.0003661446098703891,
0.009190857410430908,
-0.004047463648021221,
-0.00854707881808281,
0.0010208104504272342,
0.006378538906574249,
-0.010947512462735176,
0.013745205476880074,
-0.012563769705593586,
0.008403590880334377,
-0.0010601674439385533,
-0.017098188400268555,
0.007453876081854105,
0.009390500374138355,
-0.008798402734100819,
0.0013181348331272602,
-0.001121535780839622,
0.0025746426545083523,
-0.002361730206757784,
-0.00959173496812582,
-0.0028319864068180323,
-0.021418705582618713,
0.0015259829815477133,
0.026483258232474327,
0.006138228811323643,
0.012347719632089138,
0.014004845172166824,
-0.008273397572338581,
-0.00006952666444703937,
0.011752980761229992,
0.0015682914527133107,
0.017492001876235008,
-0.010466712526977062,
0.0016839549643918872,
0.0022404238115996122,
-0.005781577900052071,
0.0032742274925112724,
0.001783240819349885,
0.003608685452491045,
-0.004160420969128609,
0.0005894601927138865,
-0.008230667561292648,
0.0004606253351084888,
-0.016465459018945694,
0.002436333801597357,
0.009474774822592735,
0.00132865144405514,
0.005304867401719093,
-0.012270280160009861,
0.005593220703303814,
0.0030670955311506987,
0.0022613173350691795,
0.004270873963832855,
0.0015805894508957863,
0.005118867848068476,
0.010420827195048332,
-0.00917903333902359,
0.0031614457257092,
0.006203958764672279,
-0.006796249654144049,
0.004003746900707483,
0.0032370921690016985,
-0.005354132037609816,
-0.004465148784220219,
0.005136181600391865,
-0.0015036603435873985,
-0.0020690865349024534,
-0.005234857089817524,
-0.008118231780827045,
-0.0045095207169651985,
0.008203459903597832,
-0.014045831747353077,
0.00624356372281909,
-0.0029481202363967896,
0.003269268898293376,
-0.010815388523042202,
0.000699376396369189,
-0.001926272758282721,
-0.008311325684189796,
0.01129173394292593,
-0.002905964618548751,
0.004449876490980387,
0.010113975964486599,
0.004522454459220171,
-0.01379389874637127,
0.005975552834570408,
0.009374094195663929,
-0.0068367524072527885,
0.0014525152510032058,
0.014264052733778954,
-0.005060725379735231,
-0.02416842244565487,
0.003932592459022999,
-0.01378257293254137,
0.006024444475769997,
-0.008693289011716843,
0.0007369739469140768,
-0.008514678105711937,
0.006359900813549757,
0.006166461855173111,
-0.013686367310583591,
-0.002315593883395195,
-0.008084718137979507,
0.00875597633421421,
-0.0017107289750128984,
-0.0035161913838237524,
-0.002469200175255537,
-0.005069246515631676,
-0.0028183739632368088,
0.0007445148658007383,
0.001259466866031289,
0.003069343976676464,
0.004453812260180712,
-0.005678611807525158,
0.002347896806895733,
-0.0025364879984408617,
0.001321169431321323,
0.002972198650240898,
-0.009055153466761112,
0.006683288607746363,
0.011225433088839054,
-0.004473631735891104,
-0.001095189480111003,
-0.0024113073013722897,
-0.0032250303775072098,
-0.004142090678215027,
-0.012536615133285522,
-0.005699376575648785,
-0.004372237250208855,
-0.006245631258934736,
-0.012058851309120655,
-0.0016529153799638152,
-0.008697347715497017,
0.00932234339416027,
-0.00824801530689001,
0.007937837392091751,
0.00796361081302166,
-0.004282449372112751,
0.008827030658721924,
-0.003919173497706652,
0.005250358488410711,
-0.0010925326496362686,
0.009064669720828533,
-0.0013908775290474296,
-0.008844993077218533,
-0.012792330235242844,
0.016162680462002754,
-0.010900285094976425,
-0.002785052638500929,
0.021797653287649155,
0.007132500410079956,
0.01034698635339737,
-0.0009358777315355837,
-0.0004009563126601279,
0.003735980251803994,
0.0054685501381754875,
-0.014318703673779964,
0.0014469915768131614,
-0.002448917366564274,
-0.0033570067025721073,
0.006804790813475847,
-0.00477355532348156,
0.0005115136737003922,
0.007187901996076107,
0.002467002486810088,
-0.008913115598261356,
-0.002584240399301052,
-0.0007393756532110274,
0.001822356483899057,
-0.011260162107646465,
-0.0014545849990099669,
-0.004500726703554392,
-0.004882235545665026,
-0.009075316600501537,
-0.0010538656497374177,
0.001610536826774478,
0.0006977985613048077,
-0.0016813045367598534,
0.004977232310920954,
0.0074674817733466625,
-0.005983551498502493,
0.015566743910312653,
-0.006988315377384424,
-0.00021317599748726934,
0.007061294745653868,
0.004320889711380005,
-0.0016015478176996112,
-0.00431449431926012,
-0.0015796486986801028,
0.002144193509593606,
0.003149786964058876,
0.00014028773875907063,
-0.010458768345415592,
-0.0038588927127420902,
-0.0022137986961752176,
-0.009260564111173153,
-0.0016810853267088532,
0.012163084000349045,
-0.00694330595433712,
0.0013062733924016356,
0.00033267680555582047,
-0.006759485695511103,
-0.01551839243620634,
0.06373722106218338,
0.0008368224953301251,
-0.0008445814019069076,
0.009462660178542137,
-0.005286465864628553,
-0.003687713760882616,
-0.004998715594410896,
0.004737640731036663,
-0.008413083851337433,
-0.006246156059205532,
0.008879216387867928,
-0.002787505043670535,
0.0027968452777713537,
0.001950333476997912,
-0.0035226179752498865,
0.019190698862075806,
-0.008371011354029179,
-0.015641825273633003,
-0.01413566805422306,
0.005350278224796057,
-0.0018595021683722734,
-0.0016063988441601396,
0.008132019080221653,
-0.0035791213158518076,
0.007157567422837019,
0.004133947659283876,
0.004969058558344841,
-0.003478980390354991,
0.0009680649964138865,
-0.0009380013216286898,
-0.0013525173999369144,
0.0047890180721879005,
0.003830336034297943,
0.0020479001104831696,
0.010817725211381912,
-0.0013128139544278383,
0.00800090841948986,
0.0008868712466210127,
0.002417341573163867,
-0.00007244126754812896,
0.00884268432855606,
0.0071780066937208176,
0.00015138156595639884,
0.0010944122914224863,
0.001202907063998282,
0.0010798750445246696,
0.00210699369199574,
0.017737025395035744,
0.0005818635108880699,
-0.005270985420793295,
0.012457363307476044,
0.009700355120003223,
-0.005205376539379358,
0.010522852651774883,
0.002171376720070839,
0.004346323199570179,
0.003241492435336113,
-0.013043210841715336,
-0.0072007570415735245,
-0.004029540810734034,
0.0077482652850449085,
0.012129665352404118,
-0.0021844275761395693,
-0.003125034039840102,
0.0016565094701945782,
-0.0009085191995836794,
-0.008919629268348217,
-0.0002997989649884403,
-0.00326182646676898,
0.0031301812268793583,
0.007003118749707937,
0.07535483688116074,
-0.008883296512067318,
-0.007275398820638657,
-0.007271540351212025,
0.0016430445248261094,
-0.0018742678221315145,
-0.002153154695406556,
-0.002499089576303959,
0.005283438600599766,
0.0036740119103342295,
0.003203159663826227,
-0.006269785575568676,
-0.003527272492647171,
0.004725506994873285,
0.0009602852514944971,
-0.002094272058457136,
0.00584502425044775,
0.004620603751391172,
-0.005833826027810574,
0.0004978303331881762,
-0.01209136564284563,
-0.008592427708208561,
-0.0035092835314571857,
-0.0067467219196259975,
0.0008000085363164544,
-0.005244179628789425,
-0.0012262441450729966,
0.006045839283615351,
0.0077227079309523106,
-0.0041387309320271015,
0.0059446669183671474,
-0.005369083024561405,
0.0031165138352662325,
-0.005503956228494644,
-0.001783447922207415,
-0.007889988832175732,
0.010653560981154442,
-0.00026911988970823586,
-0.015445241704583168,
-0.002977662952616811,
-0.002930111950263381,
-0.0019875881262123585,
-0.006942139472812414,
0.0070668174885213375,
-0.004137272946536541,
0.013399889692664146,
-0.00005255041833152063,
0.0031191573943942785,
-0.0016253864159807563,
0.0029097713995724916,
-0.016084514558315277,
0.002510536229237914,
-0.1976277232170105,
0.01065888348966837,
-0.0005298357573337853,
-0.003312967484816909,
-0.006551928818225861,
-0.01608187146484852,
-0.011033790186047554,
0.005145933944731951,
0.006110954098403454,
0.0026961283292621374,
0.0009534899145364761,
-0.004753627814352512,
0.006004830822348595,
0.003702392801642418,
-0.0032929524313658476,
-0.003107068594545126,
0.01016507763415575,
-0.00899653509259224,
-0.001730922027491033,
0.008449210785329342,
0.011884506791830063,
0.01039164699614048,
0.005228562746196985,
0.0019594510085880756,
0.003688070923089981,
-0.006611380260437727,
0.003376780077815056,
-0.001913572777993977,
0.009475156664848328,
-0.00667659193277359,
-0.007132697384804487,
-0.008314418606460094,
-0.003851118963211775,
0.004351363983005285,
0.004502291791141033,
-0.005037018097937107,
0.005317314527928829,
-0.001000217511318624,
-0.008155657909810543,
0.007451570127159357,
-0.008306439034640789,
0.03024871274828911,
-0.0018458697013556957,
0.010767935775220394,
0.000015411369531648234,
0.0004498513008002192,
-0.001510856207460165,
0.00934363342821598,
-0.0006412197835743427,
0.009333630092442036,
-0.014579758048057556,
-0.009708336554467678,
0.0018611764535307884,
0.017209535464644432,
-0.00699468282982707,
-0.01130884513258934,
-0.0059353443793952465,
-0.012110492214560509,
0.004293883219361305,
0.011003991588950157,
0.010887403972446918,
-0.006997040472924709,
0.005688938312232494,
-0.0052531021647155285,
-0.024340704083442688,
0.0024128053337335587,
-0.004052823409438133,
-0.009443449787795544,
-0.005498827435076237,
0.005959274247288704,
0.010348379611968994,
-0.0034641048405319452,
0.008140484802424908,
-0.000154309076606296,
0.0002949862100649625,
0.0006002349546179175,
0.0059803142212331295,
-0.006440764758735895,
0.009194720536470413,
-0.008708864450454712,
0.00783060397952795,
-0.01011643372476101,
-0.0023957418743520975,
0.0008856735075823963,
-0.005639695096760988,
0.010242312215268612,
0.004868231248110533,
0.00178773223888129,
0.0007288440829142928,
-0.012140227481722832,
-0.005615767557173967,
0.004327297676354647,
0.008559375070035458,
-0.002612629672512412,
0.0019065873930230737,
-0.0076483674347400665,
-0.000873871729709208,
0.006996121723204851,
-0.005065360572189093,
0.006082933396100998,
0.010190177708864212,
-0.006890184246003628,
-0.0003166156529914588,
-0.0031089703552424908,
0.0023141896817833185,
0.004758178722113371,
-0.008247253485023975,
-0.012078679166734219,
0.005897879600524902,
-0.0063983723521232605,
-0.007306080311536789,
-0.0002601174055598676,
-0.007563939318060875,
-0.007314581889659166,
-0.0011111502535641193,
-0.011261766776442528,
0.0047552213072776794
] |
d99ed7256245422c7c5dd3c60b0661e4f78183ea | 35,585 | py | Python | rplugin/python3/denite/ui/default.py | timgates42/denite.nvim | 12a9b5456f5a4600afeb0ba284ce1098bd35e501 | [
"MIT"
] | null | null | null | rplugin/python3/denite/ui/default.py | timgates42/denite.nvim | 12a9b5456f5a4600afeb0ba284ce1098bd35e501 | [
"MIT"
] | null | null | null | rplugin/python3/denite/ui/default.py | timgates42/denite.nvim | 12a9b5456f5a4600afeb0ba284ce1098bd35e501 | [
"MIT"
] | null | null | null | # ============================================================================
# FILE: default.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
import re
import typing
from denite.util import echo, error, clearmatch, regex_convert_py_vim
from denite.util import Nvim, UserContext, Candidates, Candidate
from denite.parent import SyncParent
class Default(object):
@property
def is_async(self) -> bool:
return self._is_async
def __init__(self, vim: Nvim) -> None:
self._vim = vim
self._denite: typing.Optional[SyncParent] = None
self._selected_candidates: typing.List[int] = []
self._candidates: Candidates = []
self._cursor = 0
self._entire_len = 0
self._result: typing.List[typing.Any] = []
self._context: UserContext = {}
self._bufnr = -1
self._winid = -1
self._winrestcmd = ''
self._initialized = False
self._winheight = 0
self._winwidth = 0
self._winminheight = -1
self._is_multi = False
self._is_async = False
self._matched_pattern = ''
self._displayed_texts: typing.List[str] = []
self._statusline_sources = ''
self._titlestring = ''
self._ruler = False
self._prev_action = ''
self._prev_status: typing.Dict[str, typing.Any] = {}
self._prev_curpos: typing.List[typing.Any] = []
self._save_window_options: typing.Dict[str, typing.Any] = {}
self._sources_history: typing.List[typing.Any] = []
self._previous_text = ''
self._floating = False
self._filter_floating = False
self._updated = False
self._timers: typing.Dict[str, int] = {}
self._matched_range_id = -1
self._matched_char_id = -1
self._check_matchdelete = bool(self._vim.call(
'denite#util#check_matchdelete'))
def start(self, sources: typing.List[typing.Any],
context: UserContext) -> typing.List[typing.Any]:
if not self._denite:
# if hasattr(self._vim, 'run_coroutine'):
# self._denite = ASyncParent(self._vim)
# else:
self._denite = SyncParent(self._vim)
self._result = []
context['sources_queue'] = [sources]
self._start_sources_queue(context)
return self._result
def do_action(self, action_name: str,
command: str = '', is_manual: bool = False) -> None:
if is_manual:
candidates = self._get_selected_candidates()
elif self._get_cursor_candidate():
candidates = [self._get_cursor_candidate()]
else:
candidates = []
if not self._denite or not candidates or not action_name:
return
self._prev_action = action_name
action = self._denite.get_action(
self._context, action_name, candidates)
if not action:
return
post_action = self._context['post_action']
is_quit = action['is_quit'] or post_action == 'quit'
if is_quit:
self.quit()
self._denite.do_action(self._context, action_name, candidates)
self._result = candidates
if command != '':
self._vim.command(command)
if is_quit and post_action == 'open':
# Re-open denite buffer
prev_cursor = self._cursor
cursor_candidate = self._get_cursor_candidate()
self._init_buffer()
self.redraw(False)
if cursor_candidate == self._get_candidate(prev_cursor):
# Restore the cursor
self._move_to_pos(prev_cursor)
# Disable quit flag
is_quit = False
if not is_quit and is_manual:
self._selected_candidates = []
self.redraw(action['is_redraw'])
if is_manual and self._context['sources_queue']:
self._context['input'] = ''
self._context['quick_move'] = ''
self._start_sources_queue(self._context)
return
def redraw(self, is_force: bool = True) -> None:
self._context['is_redraw'] = is_force
if is_force:
self._gather_candidates()
if self._update_candidates():
self._update_buffer()
else:
self._update_status()
self._context['is_redraw'] = False
def quit(self) -> None:
if self._denite:
self._denite.on_close(self._context)
self._quit_buffer()
self._result = []
return
def _restart(self) -> None:
self._context['input'] = ''
self._quit_buffer()
self._init_denite()
self._gather_candidates()
self._init_buffer()
self._update_candidates()
self._update_buffer()
def _start_sources_queue(self, context: UserContext) -> None:
if not context['sources_queue']:
return
self._sources_history.append({
'sources': context['sources_queue'][0],
'path': context['path'],
})
self._start(context['sources_queue'][0], context)
if context['sources_queue']:
context['sources_queue'].pop(0)
context['path'] = self._context['path']
def _start(self, sources: typing.List[typing.Any],
context: UserContext) -> None:
from denite.ui.map import do_map
self._vim.command('silent! autocmd! denite')
if re.search(r'\[Command Line\]$', self._vim.current.buffer.name):
# Ignore command line window.
return
resume = self._initialized and context['resume']
if resume:
# Skip the initialization
update = ('immediately', 'immediately_1',
'cursor_pos', 'prev_winid',
'start_filter', 'quick_move')
for key in update:
self._context[key] = context[key]
self._check_move_option()
if self._check_do_option():
return
self._init_buffer()
if context['refresh']:
self.redraw()
self._move_to_pos(self._cursor)
else:
if self._context != context:
self._context.clear()
self._context.update(context)
self._context['sources'] = sources
self._context['is_redraw'] = False
self._is_multi = len(sources) > 1
if not sources:
# Ignore empty sources.
error(self._vim, 'Empty sources')
return
self._init_denite()
self._gather_candidates()
self._update_candidates()
self._init_cursor()
self._check_move_option()
if self._check_do_option():
return
self._init_buffer()
self._update_displayed_texts()
self._update_buffer()
self._move_to_pos(self._cursor)
if self._context['quick_move'] and do_map(self, 'quick_move', []):
return
if self._context['start_filter']:
do_map(self, 'open_filter_buffer', [])
def _init_buffer(self) -> None:
self._prev_status = dict()
self._displayed_texts = []
self._prev_bufnr = self._vim.current.buffer.number
self._prev_curpos = self._vim.call('getcurpos')
self._prev_wininfo = self._get_wininfo()
self._prev_winid = self._context['prev_winid']
self._winrestcmd = self._vim.call('winrestcmd')
self._ruler = self._vim.options['ruler']
self._switch_buffer()
self._bufnr = self._vim.current.buffer.number
self._winid = self._vim.call('win_getid')
self._resize_buffer(True)
self._winheight = self._vim.current.window.height
self._winwidth = self._vim.current.window.width
self._bufvars = self._vim.current.buffer.vars
self._bufvars['denite'] = {
'buffer_name': self._context['buffer_name'],
}
self._bufvars['denite_statusline'] = {}
self._vim.vars['denite#_previewed_buffers'] = {}
self._save_window_options = {}
window_options = {
'colorcolumn',
'concealcursor',
'conceallevel',
'cursorcolumn',
'cursorline',
'foldcolumn',
'foldenable',
'list',
'number',
'relativenumber',
'signcolumn',
'spell',
'winfixheight',
'wrap',
}
for k in window_options:
self._save_window_options[k] = self._vim.current.window.options[k]
# Note: Have to use setlocal instead of "current.window.options"
# "current.window.options" changes global value instead of local in
# neovim.
self._vim.command('setlocal colorcolumn=')
self._vim.command('setlocal conceallevel=3')
self._vim.command('setlocal concealcursor=inv')
self._vim.command('setlocal nocursorcolumn')
self._vim.command('setlocal nofoldenable')
self._vim.command('setlocal foldcolumn=0')
self._vim.command('setlocal nolist')
self._vim.command('setlocal nonumber')
self._vim.command('setlocal norelativenumber')
self._vim.command('setlocal nospell')
self._vim.command('setlocal winfixheight')
self._vim.command('setlocal nowrap')
if self._context['prompt']:
self._vim.command('setlocal signcolumn=yes')
else:
self._vim.command('setlocal signcolumn=auto')
if self._context['cursorline']:
self._vim.command('setlocal cursorline')
options = self._vim.current.buffer.options
if self._floating:
# Disable ruler
self._vim.options['ruler'] = False
options['buftype'] = 'nofile'
options['bufhidden'] = 'delete'
options['swapfile'] = False
options['buflisted'] = False
options['modeline'] = False
options['modifiable'] = False
options['filetype'] = 'denite'
if self._vim.call('exists', '#WinEnter'):
self._vim.command('doautocmd WinEnter')
if self._vim.call('exists', '#BufWinEnter'):
self._vim.command('doautocmd BufWinEnter')
if not self._vim.call('has', 'nvim'):
# In Vim8, FileType autocmd is not fired after set filetype option.
self._vim.command('silent doautocmd FileType denite')
if self._context['auto_action']:
self._vim.command('autocmd denite '
'CursorMoved <buffer> '
'call denite#call_map("auto_action")')
self._init_syntax()
def _switch_buffer(self) -> None:
split = self._context['split']
if (split != 'no' and self._winid > 0 and
self._vim.call('win_gotoid', self._winid)):
if split != 'vertical' and not self._floating:
# Move the window to bottom
self._vim.command('wincmd J')
self._winrestcmd = ''
return
self._floating = split in [
'floating',
'floating_relative_cursor',
'floating_relative_window',
]
self._filter_floating = False
if self._vim.current.buffer.options['filetype'] != 'denite':
self._titlestring = self._vim.options['titlestring']
command = 'edit'
if split == 'tab':
self._vim.command('tabnew')
elif self._floating:
self._split_floating(split)
elif self._context['filter_split_direction'] == 'floating':
self._filter_floating = True
elif split != 'no':
command = self._get_direction()
command += ' vsplit' if split == 'vertical' else ' split'
bufname = '[denite]-' + self._context['buffer_name']
if self._vim.call('exists', '*bufadd'):
bufnr = self._vim.call('bufadd', bufname)
vertical = 'vertical' if split == 'vertical' else ''
command = (
'buffer' if split
in ['no', 'tab', 'floating',
'floating_relative_window',
'floating_relative_cursor'] else 'sbuffer')
self._vim.command(
'silent keepalt %s %s %s %s' % (
self._get_direction(),
vertical,
command,
bufnr,
)
)
else:
self._vim.call(
'denite#util#execute_path',
f'silent keepalt {command}', bufname)
def _get_direction(self) -> str:
direction = str(self._context['direction'])
if direction == 'dynamictop' or direction == 'dynamicbottom':
self._update_displayed_texts()
winwidth = self._vim.call('winwidth', 0)
is_fit = not [x for x in self._displayed_texts
if self._vim.call('strwidth', x) > winwidth]
if direction == 'dynamictop':
direction = 'aboveleft' if is_fit else 'topleft'
else:
direction = 'belowright' if is_fit else 'botright'
return direction
def _get_wininfo(self) -> typing.List[typing.Any]:
return [
self._vim.options['columns'], self._vim.options['lines'],
self._vim.call('win_getid'), self._vim.call('tabpagebuflist')
]
def _switch_prev_buffer(self) -> None:
if (self._prev_bufnr == self._bufnr or
self._vim.buffers[self._prev_bufnr].name == ''):
self._vim.command('enew')
else:
self._vim.command('buffer ' + str(self._prev_bufnr))
def _init_syntax(self) -> None:
self._vim.command('syntax case ignore')
self._vim.command('highlight default link deniteInput ModeMsg')
self._vim.command('highlight link deniteMatchedRange ' +
self._context['highlight_matched_range'])
self._vim.command('highlight link deniteMatchedChar ' +
self._context['highlight_matched_char'])
self._vim.command('highlight default link ' +
'deniteStatusLinePath Comment')
self._vim.command('highlight default link ' +
'deniteStatusLineNumber LineNR')
self._vim.command('highlight default link ' +
'deniteSelectedLine Statement')
if self._floating:
self._vim.current.window.options['winhighlight'] = (
'Normal:' + self._context['highlight_window_background']
)
self._vim.command(('syntax match deniteSelectedLine /^[%s].*/' +
' contains=deniteConcealedMark') % (
self._context['selected_icon']))
self._vim.command(('syntax match deniteConcealedMark /^[ %s]/' +
' conceal contained') % (
self._context['selected_icon']))
if self._denite:
self._denite.init_syntax(self._context, self._is_multi)
def _update_candidates(self) -> bool:
if not self._denite:
return False
[self._is_async, pattern, statuses, self._entire_len,
self._candidates] = self._denite.filter_candidates(self._context)
prev_displayed_texts = self._displayed_texts
self._update_displayed_texts()
prev_matched_pattern = self._matched_pattern
self._matched_pattern = pattern
prev_statusline_sources = self._statusline_sources
self._statusline_sources = ' '.join(statuses)
if self._is_async:
self._start_timer('update_candidates')
else:
self._stop_timer('update_candidates')
updated = (self._displayed_texts != prev_displayed_texts or
self._matched_pattern != prev_matched_pattern or
self._statusline_sources != prev_statusline_sources)
if updated:
self._updated = True
self._start_timer('update_buffer')
if self._context['search'] and self._context['input']:
self._vim.call('setreg', '/', self._context['input'])
return self._updated
def _update_displayed_texts(self) -> None:
candidates_len = len(self._candidates)
if not self._is_async and self._context['auto_resize']:
winminheight = self._context['winminheight']
max_height = min(self._context['winheight'],
self._get_max_height())
if (winminheight != -1 and candidates_len < winminheight):
self._winheight = winminheight
elif candidates_len > max_height:
self._winheight = max_height
elif candidates_len != self._winheight:
self._winheight = candidates_len
max_source_name_len = 0
if self._candidates:
max_source_name_len = max([
len(self._get_display_source_name(x['source_name']))
for x in self._candidates])
self._context['max_source_name_len'] = max_source_name_len
self._context['max_source_name_format'] = (
'{:<' + str(self._context['max_source_name_len']) + '}')
self._displayed_texts = [
self._get_candidate_display_text(i)
for i in range(0, candidates_len)
]
def _update_buffer(self) -> None:
is_current_buffer = self._bufnr == self._vim.current.buffer.number
self._update_status()
if self._check_matchdelete and self._context['match_highlight']:
matches = [x['id'] for x in
self._vim.call('getmatches', self._winid)]
if self._matched_range_id in matches:
self._vim.call('matchdelete',
self._matched_range_id, self._winid)
self._matched_range_id = -1
if self._matched_char_id in matches:
self._vim.call('matchdelete',
self._matched_char_id, self._winid)
self._matched_char_id = -1
if self._matched_pattern != '':
self._matched_range_id = self._vim.call(
'matchadd', 'deniteMatchedRange',
r'\c' + regex_convert_py_vim(self._matched_pattern),
10, -1, {'window': self._winid})
matched_char_pattern = '[{}]'.format(re.sub(
r'([\[\]\\^-])',
r'\\\1',
self._context['input'].replace(' ', '')
))
self._matched_char_id = self._vim.call(
'matchadd', 'deniteMatchedChar',
matched_char_pattern,
10, -1, {'window': self._winid})
prev_linenr = self._vim.call('line', '.')
prev_candidate = self._get_cursor_candidate()
buffer = self._vim.buffers[self._bufnr]
buffer.options['modifiable'] = True
self._vim.vars['denite#_candidates'] = [
x['word'] for x in self._candidates]
buffer[:] = self._displayed_texts
buffer.options['modifiable'] = False
self._previous_text = self._context['input']
self._resize_buffer(is_current_buffer)
is_changed = (self._context['reversed'] or
(is_current_buffer and
self._previous_text != self._context['input']))
if self._updated and is_changed:
if not is_current_buffer:
save_winid = self._vim.call('win_getid')
self._vim.call('win_gotoid', self._winid)
self._init_cursor()
self._move_to_pos(self._cursor)
if not is_current_buffer:
self._vim.call('win_gotoid', save_winid)
elif is_current_buffer:
self._vim.call('cursor', [prev_linenr, 0])
if is_current_buffer:
if (self._context['auto_action'] and
prev_candidate != self._get_cursor_candidate()):
self.do_action(self._context['auto_action'])
self._updated = False
self._stop_timer('update_buffer')
def _update_status(self) -> None:
inpt = ''
if self._context['input']:
inpt = self._context['input'] + ' '
if self._context['error_messages']:
inpt = '[ERROR] ' + inpt
path = '[' + self._context['path'] + ']'
status = {
'input': inpt,
'sources': self._statusline_sources,
'path': path,
# Extra
'buffer_name': self._context['buffer_name'],
'line_total': len(self._candidates),
}
if status == self._prev_status:
return
self._bufvars['denite_statusline'] = status
self._prev_status = status
linenr = "printf('%'.(len(line('$'))+2).'d/%d',line('.'),line('$'))"
if self._context['statusline']:
if self._floating or self._filter_floating:
self._vim.options['titlestring'] = (
"%{denite#get_status('input')}%* " +
"%{denite#get_status('sources')} " +
" %{denite#get_status('path')}%*" +
"%{" + linenr + "}%*")
else:
winnr = self._vim.call('win_id2win', self._winid)
self._vim.call('setwinvar', winnr, '&statusline', (
"%#deniteInput#%{denite#get_status('input')}%* " +
"%{denite#get_status('sources')} %=" +
"%#deniteStatusLinePath# %{denite#get_status('path')}%*" +
"%#deniteStatusLineNumber#%{" + linenr + "}%*"))
def _get_display_source_name(self, name: str) -> str:
source_names = self._context['source_names']
if not self._is_multi or source_names == 'hide':
source_name = ''
else:
short_name = (re.sub(r'([a-zA-Z])[a-zA-Z]+', r'\1', name)
if re.search(r'[^a-zA-Z]', name) else name[:2])
source_name = short_name if source_names == 'short' else name
return source_name
def _get_candidate_display_text(self, index: int) -> str:
source_names = self._context['source_names']
candidate = self._candidates[index]
terms = []
if self._is_multi and source_names != 'hide':
terms.append(self._context['max_source_name_format'].format(
self._get_display_source_name(candidate['source_name'])))
encoding = self._context['encoding']
abbr = candidate.get('abbr', candidate['word']).encode(
encoding, errors='replace').decode(encoding, errors='replace')
terms.append(abbr[:int(self._context['max_candidate_width'])])
return (str(self._context['selected_icon'])
if index in self._selected_candidates
else ' ') + ' '.join(terms).replace('\n', '')
def _get_max_height(self) -> int:
return int(self._vim.options['lines']) if not self._floating else (
int(self._vim.options['lines']) -
int(self._context['winrow']) -
int(self._vim.options['cmdheight']))
def _resize_buffer(self, is_current_buffer: bool) -> None:
split = self._context['split']
if (split == 'no' or split == 'tab' or
self._vim.call('winnr', '$') == 1):
return
winheight = max(self._winheight, 1)
winwidth = max(self._winwidth, 1)
is_vertical = split == 'vertical'
if not is_current_buffer:
restore = self._vim.call('win_getid')
self._vim.call('win_gotoid', self._winid)
if not is_vertical and self._vim.current.window.height != winheight:
if self._floating:
wincol = self._context['winrow']
row = wincol
if split == 'floating':
if self._context['auto_resize'] and row > 1:
row += self._context['winheight']
row -= self._winheight
self._vim.call('nvim_win_set_config', self._winid, {
'relative': 'editor',
'row': row,
'col': self._context['wincol'],
'width': winwidth,
'height': winheight,
})
filter_row = 0 if wincol == 1 else row + winheight
filter_col = self._context['wincol']
else:
init_pos = self._vim.call('nvim_win_get_config',
self._winid)
self._vim.call('nvim_win_set_config', self._winid, {
'relative': 'win',
'win': init_pos['win'],
'row': init_pos['row'],
'col': init_pos['col'],
'width': winwidth,
'height': winheight,
})
filter_col = init_pos['col']
if init_pos['anchor'] == 'NW':
winpos = self._vim.call('nvim_win_get_position',
self._winid)
filter_row = winpos[0] + winheight
filter_winid = self._vim.vars['denite#_filter_winid']
self._context['filter_winrow'] = row
if self._vim.call('win_id2win', filter_winid) > 0:
self._vim.call('nvim_win_set_config', filter_winid, {
'relative': 'editor',
'row': filter_row,
'col': filter_col,
})
self._vim.command('resize ' + str(winheight))
if self._context['reversed']:
self._vim.command('normal! zb')
elif is_vertical and self._vim.current.window.width != winwidth:
self._vim.command('vertical resize ' + str(winwidth))
if not is_current_buffer:
self._vim.call('win_gotoid', restore)
def _check_do_option(self) -> bool:
if self._context['do'] != '':
self._do_command(self._context['do'])
return True
elif (self._candidates and self._context['immediately'] or
len(self._candidates) == 1 and self._context['immediately_1']):
self._do_immediately()
return True
return not (self._context['empty'] or
self._is_async or self._candidates)
def _check_move_option(self) -> None:
if self._context['cursor_pos'].isnumeric():
self._cursor = int(self._context['cursor_pos']) + 1
elif re.match(r'\+\d+', self._context['cursor_pos']):
for _ in range(int(self._context['cursor_pos'][1:])):
self._move_to_next_line()
elif re.match(r'-\d+', self._context['cursor_pos']):
for _ in range(int(self._context['cursor_pos'][1:])):
self._move_to_prev_line()
elif self._context['cursor_pos'] == '$':
self._move_to_last_line()
def _do_immediately(self) -> None:
goto = self._winid > 0 and self._vim.call(
'win_gotoid', self._winid)
if goto:
# Jump to denite window
self._init_buffer()
self.do_action('default')
candidate = self._get_cursor_candidate()
if not candidate:
return
echo(self._vim, 'Normal', '[{}/{}] {}'.format(
self._cursor, len(self._candidates),
candidate.get('abbr', candidate['word'])))
if goto:
# Move to the previous window
self._vim.command('wincmd p')
def _do_command(self, command: str) -> None:
self._init_cursor()
cursor = 1
while cursor < len(self._candidates):
self.do_action('default', command)
self._move_to_next_line()
self._quit_buffer()
def _cleanup(self) -> None:
self._stop_timer('update_candidates')
self._stop_timer('update_buffer')
if self._vim.current.buffer.number == self._bufnr:
self._cursor = self._vim.call('line', '.')
# Note: Close filter window before preview window
self._vim.call('denite#filter#_close_filter_window')
if not self._context['has_preview_window']:
self._vim.command('pclose!')
# Clear previewed buffers
for bufnr in self._vim.vars['denite#_previewed_buffers'].keys():
if not self._vim.call('win_findbuf', bufnr):
self._vim.command('silent bdelete ' + str(bufnr))
self._vim.vars['denite#_previewed_buffers'] = {}
self._vim.command('highlight! link CursorLine CursorLine')
if self._floating or self._filter_floating:
self._vim.options['titlestring'] = self._titlestring
self._vim.options['ruler'] = self._ruler
def _close_current_window(self) -> None:
if self._vim.call('winnr', '$') == 1:
self._vim.command('buffer #')
else:
self._vim.command('close!')
def _quit_buffer(self) -> None:
self._cleanup()
if self._vim.call('bufwinnr', self._bufnr) < 0:
# Denite buffer is already closed
return
winids = self._vim.call('win_findbuf',
self._vim.vars['denite#_filter_bufnr'])
if winids:
# Quit filter buffer
self._vim.call('win_gotoid', winids[0])
self._close_current_window()
# Move to denite window
self._vim.call('win_gotoid', self._winid)
# Restore the window
if self._context['split'] == 'no':
self._switch_prev_buffer()
for k, v in self._save_window_options.items():
self._vim.current.window.options[k] = v
else:
if self._context['split'] == 'tab':
self._vim.command('tabclose!')
if self._context['split'] != 'tab':
self._close_current_window()
self._vim.call('win_gotoid', self._prev_winid)
# Restore the position
self._vim.call('setpos', '.', self._prev_curpos)
if self._get_wininfo() and self._get_wininfo() == self._prev_wininfo:
# Note: execute restcmd twice to restore layout properly
self._vim.command(self._winrestcmd)
self._vim.command(self._winrestcmd)
clearmatch(self._vim)
def _get_cursor_candidate(self) -> Candidate:
return self._get_candidate(self._cursor)
def _get_candidate(self, pos: int) -> Candidate:
if not self._candidates or pos > len(self._candidates):
return {}
return self._candidates[pos - 1]
def _get_selected_candidates(self) -> Candidates:
if not self._selected_candidates:
return [self._get_cursor_candidate()
] if self._get_cursor_candidate() else []
return [self._candidates[x] for x in self._selected_candidates]
def _init_denite(self) -> None:
if self._denite:
self._denite.start(self._context)
self._denite.on_init(self._context)
self._initialized = True
self._winheight = self._context['winheight']
self._winwidth = self._context['winwidth']
def _gather_candidates(self) -> None:
self._selected_candidates = []
if self._denite:
self._denite.gather_candidates(self._context)
def _init_cursor(self) -> None:
if self._context['reversed']:
self._move_to_last_line()
else:
self._move_to_first_line()
def _move_to_pos(self, pos: int) -> None:
self._vim.call('cursor', pos, 0)
self._cursor = pos
if self._context['reversed']:
self._vim.command('normal! zb')
def _move_to_next_line(self) -> None:
if self._cursor < len(self._candidates):
self._cursor += 1
def _move_to_prev_line(self) -> None:
if self._cursor >= 1:
self._cursor -= 1
def _move_to_first_line(self) -> None:
self._cursor = 1
def _move_to_last_line(self) -> None:
self._cursor = len(self._candidates)
def _start_timer(self, key: str) -> None:
if key in self._timers:
return
if key == 'update_candidates':
self._timers[key] = self._vim.call(
'denite#helper#_start_update_candidates_timer', self._bufnr)
elif key == 'update_buffer':
self._timers[key] = self._vim.call(
'denite#helper#_start_update_buffer_timer', self._bufnr)
def _stop_timer(self, key: str) -> None:
if key not in self._timers:
return
self._vim.call('timer_stop', self._timers[key])
# Note: After timer_stop is called, self._timers may be removed
if key in self._timers:
self._timers.pop(key)
def _split_floating(self, split: str) -> None:
# Use floating window
if split == 'floating':
self._vim.call(
'nvim_open_win',
self._vim.call('bufnr', '%'), True, {
'relative': 'editor',
'row': self._context['winrow'],
'col': self._context['wincol'],
'width': self._context['winwidth'],
'height': self._context['winheight'],
})
elif split == 'floating_relative_cursor':
opened_pos = (self._vim.call('nvim_win_get_position', 0)[0] +
self._vim.call('winline') - 1)
if self._context['auto_resize']:
height = max(self._winheight, 1)
width = max(self._winwidth, 1)
else:
width = self._context['winwidth']
height = self._context['winheight']
if opened_pos + height + 3 > self._vim.options['lines']:
anchor = 'SW'
row = 0
self._context['filter_winrow'] = row + opened_pos
else:
anchor = 'NW'
row = 1
self._context['filter_winrow'] = row + height + opened_pos
self._vim.call(
'nvim_open_win',
self._vim.call('bufnr', '%'), True, {
'relative': 'cursor',
'row': row,
'col': 0,
'width': width,
'height': height,
'anchor': anchor,
})
elif split == 'floating_relative_window':
self._vim.call(
'nvim_open_win',
self._vim.call('bufnr', '%'), True, {
'relative': 'win',
'row': self._context['winrow'],
'col': self._context['wincol'],
'width': self._context['winwidth'],
'height': self._context['winheight'],
})
| 37.816153 | 79 | 0.54863 | 1 | 1.9941 | [
-0.018333425745368004,
0.02908499538898468,
0.010924612171947956,
-0.004513473715633154,
-0.008477273397147655,
0.009763168171048164,
-0.0280748400837183,
-0.022467469796538353,
-0.03421676903963089,
0.042118459939956665,
-0.004003908019512892,
0.026279257610440254,
0.01818988472223282,
-0.018296686932444572,
-0.021461626514792442,
-0.01202486827969551,
0.1293419897556305,
-0.023563317954540253,
-0.031779564917087555,
0.008315617218613625,
-0.04158857837319374,
-0.02064298652112484,
-0.021578876301646233,
0.022406192496418953,
0.022192534059286118,
0.0014918774832040071,
0.041675031185150146,
0.006686771288514137,
0.019285881891846657,
-0.006763135548681021,
-0.02683543600142002,
0.014577319845557213,
0.008210874162614346,
-0.0005206292844377458,
0.00043097088928334415,
0.009933743625879288,
0.009344874881207943,
-0.012635666877031326,
0.029704472050070763,
-0.0107038589194417,
0.02338894084095955,
0.005348482169210911,
-0.008483287878334522,
-0.012049408629536629,
0.012629260309040546,
-0.019809849560260773,
-0.01571996696293354,
-0.00535983219742775,
0.000272927078185603,
0.0170888788998127,
0.03795742616057396,
0.010502773337066174,
-0.008095292374491692,
-0.023839110508561134,
0.01663638837635517,
-0.039999548345804214,
0.03272302821278572,
0.003393998835235834,
-0.024019761011004448,
-0.02209562063217163,
0.0048906272277235985,
-0.004477418027818203,
0.006284195929765701,
-0.03651511296629906,
0.026063598692417145,
0.023262187838554382,
-0.026417486369609833,
-0.017615418881177902,
-0.04669889807701111,
0.020870709791779518,
-0.012571016326546669,
-0.040672458708286285,
0.01260879822075367,
0.03427209332585335,
0.06718552857637405,
-0.02951415814459324,
-0.012039829045534134,
0.00726349325850606,
0.008428603410720825,
0.025178775191307068,
-0.006099614780396223,
0.06020784378051758,
-0.005811764393001795,
0.026748690754175186,
-0.018021604046225548,
0.015326214954257011,
0.05533027648925781,
-0.054403867572546005,
0.03558293357491493,
0.012491627596318722,
-0.04907413572072983,
0.022083934396505356,
-0.0014600965660065413,
0.00809111911803484,
-0.018865883350372314,
-0.00752745708450675,
0.027621138840913773,
0.015734625980257988,
0.029704755172133446,
0.013871319591999054,
0.004858785774558783,
-0.04345571622252464,
-0.016505597159266472,
-0.015929143875837326,
0.007569482084363699,
-0.0021145206410437822,
-0.04010961204767227,
-0.00851699709892273,
0.002316489350050688,
-0.020490624010562897,
0.05009787157177925,
-0.01092441938817501,
0.02602183260023594,
-0.026079298928380013,
-0.03612090274691582,
-0.018783042207360268,
0.03731631115078926,
-0.01024109497666359,
0.017449965700507164,
0.034119587391614914,
0.016939677298069,
-0.0035135638900101185,
0.028550786897540092,
-0.022334221750497818,
-0.015086381696164608,
0.06724600493907928,
0.021150384098291397,
0.006029289215803146,
0.03350828215479851,
0.007821641862392426,
-0.010442478582262993,
-0.001979903317987919,
-0.0071599348448216915,
-0.009101645089685917,
0.003967609256505966,
0.015131189487874508,
0.006728919688612223,
0.04396362975239754,
-0.01706259325146675,
0.0410749725997448,
-0.022718163207173347,
-0.037921760231256485,
0.033748868852853775,
0.00044876764877699316,
0.0053316219709813595,
-0.04226363077759743,
-0.021087566390633583,
-0.023115452378988266,
-0.018651962280273438,
0.004195961635559797,
0.001356716500595212,
-0.0030870470218360424,
-0.005773297045379877,
-0.02527197077870369,
-0.01440221443772316,
-0.010284733958542347,
-0.011473528109490871,
-0.03662189468741417,
0.01293595228344202,
-0.003300886135548353,
-0.02015240304172039,
0.018312811851501465,
-0.01554990466684103,
0.010058239102363586,
-0.00465161120519042,
0.04569152370095253,
-0.014653830789029598,
0.012269251048564911,
-0.025004569441080093,
0.005342983175069094,
0.0320252925157547,
-0.01202845387160778,
0.010251486673951149,
-0.0008515326771885157,
-0.016908204182982445,
0.04106663912534714,
0.030668113380670547,
-0.008064838126301765,
0.01650937646627426,
-0.042996082454919815,
0.03102942928671837,
0.0000638174606137909,
0.02718215063214302,
-0.0018076609121635556,
-0.0015923607861623168,
-0.010477096773684025,
-0.0528169646859169,
-0.008943469263613224,
0.009733849205076694,
-0.019244950264692307,
-0.002196571556851268,
0.024887358769774437,
-0.022235414013266563,
-0.01633247174322605,
0.022933252155780792,
0.015019889920949936,
0.01693619415163994,
0.006754432339221239,
-0.01309063471853733,
0.013544971123337746,
0.0316438302397728,
-0.04900209233164787,
-0.017283616587519646,
0.007091070991009474,
0.005664523225277662,
-0.006605421658605337,
-0.7063649296760559,
0.0245529692620039,
0.01992727443575859,
-0.015697188675403595,
0.0075209904462099075,
0.032422780990600586,
-0.02266998030245304,
0.006108197383582592,
-0.05089624226093292,
-0.013337227515876293,
0.010194741189479828,
-0.027118010446429253,
-0.02906821481883526,
0.00991853792220354,
-0.0177835114300251,
-0.010829743929207325,
0.021068986505270004,
-0.012108148075640202,
-0.024414999410510063,
0.013056526891887188,
0.026107413694262505,
-0.05263826251029968,
-0.02272251434624195,
0.002860989887267351,
-0.013690236024558544,
0.009688934311270714,
0.0007784066256135702,
-0.00565860653296113,
-0.0047000497579574585,
-0.03909265622496605,
-0.005288616754114628,
-0.011278046295046806,
0.01782107539474964,
-0.03473429009318352,
-0.002301329979673028,
0.02273876778781414,
0.025387944653630257,
-0.004949525464326143,
-0.05064934119582176,
-0.012153546325862408,
-0.007328435312956572,
-0.005471744574606419,
-0.019548529759049416,
-0.05801616236567497,
-0.0654180496931076,
-0.004381681326776743,
-0.057099372148513794,
-0.014390330761671066,
0.010886955074965954,
0.05014173686504364,
-0.022377807646989822,
0.03846148028969765,
0.057138632982969284,
-0.028360489755868912,
-0.004055445082485676,
-0.026778098195791245,
-0.02643887884914875,
-0.03801234811544418,
-0.035947706550359726,
0.01958439126610756,
0.014385313726961613,
0.028625164180994034,
-0.023425299674272537,
0.007651336956769228,
-0.029713720083236694,
0.012947693467140198,
0.029507657513022423,
-0.039136212319135666,
-0.012652330100536346,
0.015898175537586212,
-0.045596856623888016,
-0.021648509427905083,
-0.053907327353954315,
0.09610408544540405,
-0.02114039659500122,
0.01812310703098774,
0.003111386438831687,
0.029999934136867523,
0.0023290435783565044,
-0.019921131432056427,
-0.00009381117706652731,
0.0011836185585707426,
-0.05734977498650551,
0.032364629209041595,
-0.06567700952291489,
0.035123929381370544,
0.010375186800956726,
0.015643402934074402,
0.025674687698483467,
-0.0017308664973825216,
0.011666636914014816,
-0.024074101820588112,
0.029583537951111794,
-0.011865824460983276,
0.01568812131881714,
0.0202109906822443,
0.01603575237095356,
0.054011937230825424,
-0.004491946194320917,
0.014004147611558437,
-0.031213348731398582,
0.012718938291072845,
0.000698466959875077,
0.034652892500162125,
-0.012153136543929577,
-0.039659108966588974,
-0.042772889137268066,
0.0019434710266068578,
0.034821074455976486,
-0.01800709031522274,
-0.025070304051041603,
0.011850729584693909,
-0.019998246803879738,
0.0025801220908761024,
-0.004627787973731756,
-0.014564897865056992,
0.011993815191090107,
-0.030677439644932747,
-0.005154757760465145,
-0.014825436286628246,
-0.012510380707681179,
-0.0352628119289875,
-0.0068175881169736385,
0.01736191287636757,
-0.006319442763924599,
-0.014739899896085262,
-0.05640425905585289,
-0.02222103625535965,
0.018549460917711258,
0.0003509792732074857,
-0.004527938086539507,
-0.010977176949381828,
0.007703836541622877,
0.0069030881859362125,
0.008175894618034363,
-0.025410426780581474,
-0.016818152740597725,
-0.02216370217502117,
0.030573289841413498,
-0.029658649116754532,
-0.014542676508426666,
-0.037990204989910126,
-0.002250844379886985,
-0.021564656868577003,
0.03682395815849304,
-0.00782063603401184,
0.0031042571645230055,
-0.01918291673064232,
0.03674611821770668,
0.0018486607586964965,
-0.01666121929883957,
0.06730004400014877,
-0.021709587424993515,
0.007235524244606495,
-0.006918717175722122,
0.014591607265174389,
-0.04151660203933716,
0.024143099784851074,
0.038271501660346985,
-0.01285897009074688,
-0.026035120710730553,
-0.01671500876545906,
-0.0020837222691625357,
0.012716878205537796,
0.0014933471102267504,
-0.019385123625397682,
-0.018485400825738907,
0.02785135619342327,
0.038196198642253876,
0.02988283708691597,
0.06272897124290466,
-0.009481921792030334,
0.018802441656589508,
-0.004799256566911936,
-0.0027923176530748606,
0.0401773639023304,
-0.0057771881110966206,
-0.027032047510147095,
-0.015167090110480785,
-0.021301448345184326,
-0.020067458972334862,
0.005545072257518768,
0.0118650421500206,
-0.017868315801024437,
0.018081828951835632,
-0.006226354744285345,
-0.031345609575510025,
0.0338161364197731,
0.0011039151577278972,
0.0004050496791023761,
-0.0071716043166816235,
-0.0032382917124778032,
0.0016199839301407337,
0.003418832551687956,
-0.04366413131356239,
-0.018816616386175156,
-0.005589589476585388,
-0.043992675840854645,
0.011874268762767315,
-0.01186893880367279,
0.009592426009476185,
0.0004854370199609548,
0.001249241060577333,
-0.057050224393606186,
0.011233041062951088,
0.030674142763018608,
0.03294841945171356,
-0.029102513566613197,
0.047116994857788086,
-0.04401186481118202,
0.044642288237810135,
-0.00658887205645442,
-0.002859029220417142,
-0.044739533215761185,
-0.017546240240335464,
0.04416048154234886,
-0.04685619845986366,
-0.05671475827693939,
0.0013760551810264587,
-0.01159725897014141,
-0.006112927570939064,
-0.018095536157488823,
0.03886958211660385,
0.005880875512957573,
0.005138825159519911,
-0.02236548438668251,
-0.02989686094224453,
0.01661917194724083,
-0.018025435507297516,
-0.002257127547636628,
0.021828744560480118,
0.0015100318705663085,
0.001390722580254078,
-0.036914288997650146,
-0.027599601075053215,
0.024957070127129555,
-0.01015891507267952,
-0.03344958275556564,
0.00420333631336689,
0.0032940588425844908,
0.017451699823141098,
-0.02926412969827652,
0.004427800420671701,
0.017649928107857704,
0.03389384597539902,
0.012759607285261154,
0.021210694685578346,
-0.02484726533293724,
-0.030341383069753647,
0.0032097145449370146,
-0.02729516290128231,
0.005145075730979443,
0.012479993514716625,
0.006820331793278456,
0.002076480071991682,
0.028450176119804382,
-0.02721412479877472,
0.015035569667816162,
0.028221532702445984,
0.027169736102223396,
-0.010018800385296345,
0.011701319366693497,
0.009593340568244457,
-0.019645551219582558,
0.015014957636594772,
0.0024223169311881065,
-0.005014838185161352,
0.009274656884372234,
-0.042086195200681686,
0.027264028787612915,
0.009803158231079578,
-0.02152148261666298,
-0.014615921303629875,
-0.02024342678487301,
-0.017912916839122772,
0.0018502834718674421,
0.011837497353553772,
-0.022069184109568596,
-0.014017520472407341,
0.06465809792280197,
0.006217305548489094,
0.004716632887721062,
0.011631088331341743,
0.03382593393325806,
0.047122202813625336,
0.01585967466235161,
0.018557799980044365,
0.02286316268146038,
-0.048709623515605927,
0.026585256680846214,
0.002337557729333639,
-0.03153074160218239,
-0.012328144162893295,
0.04494699090719223,
-0.029549075290560722,
0.030782602727413177,
-0.03085549734532833,
0.02901397831737995,
0.041581496596336365,
-0.017114782705903053,
-0.003924319986253977,
0.005557497497648001,
0.0039947256445884705,
-0.047847386449575424,
0.008264120668172836,
-0.014937274158000946,
0.015379514545202255,
-0.01463262178003788,
0.040307722985744476,
0.03515190631151199,
0.019856831058859825,
0.04618960991501808,
0.0021387054584920406,
-0.004068268928676844,
0.02560833841562271,
-0.029227375984191895,
0.008303646929562092,
0.02078324742615223,
0.03168560937047005,
-0.008373800665140152,
-0.015366247855126858,
-0.00517854792997241,
-0.0032798750326037407,
-0.02317745052278042,
0.01333626639097929,
0.004854986909776926,
-0.03527718037366867,
0.009247520938515663,
-0.009020639583468437,
0.029274284839630127,
-0.014817922376096249,
-0.021268269047141075,
-0.0005759752239100635,
-0.021627310663461685,
0.007235619705170393,
-0.010859823785722256,
0.0031085314694792032,
0.028629226610064507,
0.014292223379015923,
0.016881108283996582,
0.012269705533981323,
0.03171011060476303,
-0.02997204288840294,
0.03626714646816254,
-0.004426916595548391,
0.03125956282019615,
-0.04010767489671707,
0.030486954376101494,
0.022098790854215622,
0.034946490079164505,
-0.0037812748923897743,
-0.00278546754270792,
0.018296433612704277,
0.004146859981119633,
0.0008838062640279531,
-0.017028624191880226,
-0.03509897738695145,
0.009535177610814571,
0.004944161046296358,
-0.017018288373947144,
0.008456002920866013,
-0.01982393115758896,
0.0003819924604613334,
0.026891715824604034,
0.03584742173552513,
-0.00991747621446848,
0.044329915195703506,
-0.0030106522608548403,
-0.023881325498223305,
-0.012775691226124763,
-0.017200971022248268,
-0.0048493389040231705,
0.016446612775325775,
0.04041150212287903,
-0.0071089970879256725,
0.03556673228740692,
-0.021064411848783493,
0.015726618468761444,
-0.002404649741947651,
0.01583680510520935,
-0.028923336416482925,
-0.0030095225665718317,
0.022946948185563087,
-0.04018924757838249,
0.019470233470201492,
-0.054269108921289444,
0.023120751604437828,
-0.002353405812755227,
-0.027328405529260635,
-0.01208010409027338,
-0.017561420798301697,
0.0229294802993536,
0.009716257452964783,
0.012319887056946754,
0.009816824458539486,
-0.0034172118175774813,
-0.029191121459007263,
-0.0016299443086609244,
0.03038693405687809,
0.01940310187637806,
0.007729360368102789,
0.04181617498397827,
-0.01483255997300148,
-0.03426971286535263,
-0.009287048131227493,
-0.038364436477422714,
0.03304809704422951,
0.03619812801480293,
-0.005837426986545324,
-0.005626079626381397,
0.026033025234937668,
0.01841438002884388,
0.005638295318931341,
-0.029259612783789635,
0.006303251720964909,
0.02255845256149769,
-0.02622934803366661,
0.03327198699116707,
0.04292227700352669,
0.009020514786243439,
-0.042700160294771194,
-0.019224543124437332,
0.0010252002393826842,
-0.02074705809354782,
-0.0025281633716076612,
-0.020716795697808266,
-0.005899424664676189,
0.003963662777096033,
-0.02589769847691059,
0.009450731799006462,
-0.004459764808416367,
-0.031380947679281235,
-0.003941481467336416,
0.045570943504571915,
0.004874727223068476,
-0.017768211662769318,
-0.025918234139680862,
0.014157019555568695,
-0.009319506585597992,
0.00491374172270298,
0.024595851078629494,
-0.00775287626311183,
0.028272472321987152,
-0.012009738944470882,
0.01156268548220396,
0.003181959269568324,
0.015216699801385403,
-0.02886943705379963,
-0.00739580811932683,
0.0007292185327969491,
0.019351251423358917,
0.03708820417523384,
-0.0039961133152246475,
0.01908308081328869,
-0.009760342538356781,
-0.019201407209038734,
-0.014208061620593071,
0.024780528619885445,
-0.016942782327532768,
0.025716569274663925,
0.003952531609684229,
-0.0013955887407064438,
-0.02546713873744011,
0.019089583307504654,
0.033239275217056274,
0.03514827415347099,
0.026588793843984604,
-0.013363136909902096,
0.0008787061087787151,
-0.015653176233172417,
-0.021440528333187103,
0.0059350039809942245,
-0.018367968499660492,
-0.015017768368124962,
-0.000007556676337117096,
0.03631757199764252,
0.006123027298599482,
0.02142709121108055,
-0.003732811426743865,
0.005783078260719776,
-0.05439133942127228,
0.0007978871581144631,
0.022293252870440483,
0.009268408641219139,
0.025492994114756584,
0.005046183243393898,
0.012226427905261517,
0.004412055481225252,
-0.016395943239331245,
0.0238307174295187,
-0.0667339563369751,
-0.01721269078552723,
-0.018965639173984528,
0.024554312229156494,
0.0030531540978699923,
-0.010130717419087887,
0.045112691819667816,
0.037510570138692856,
0.060747180134058,
-0.007390628103166819,
0.002766018034890294,
-0.014528067782521248,
0.00018229271518066525,
-0.021869473159313202,
0.06481906026601791,
0.012199205346405506,
0.08904724568128586,
0.013101622462272644,
-0.010009391233325005,
-0.031900402158498764,
-0.027746018022298813,
-0.0285927876830101,
0.0008131322683766484,
0.0524175688624382,
0.0064794402569532394,
0.035066720098257065,
0.04061505198478699,
-0.06415074318647385,
0.008551687002182007,
-0.0533117912709713,
0.03213392198085785,
0.02223197929561138,
0.022178061306476593,
-0.041736096143722534,
0.00011899301171069965,
-0.032683320343494415,
-0.012313798069953918,
-0.01101299561560154,
-0.0036658402532339096,
-0.01608358882367611,
-0.0158865824341774,
-0.01626134105026722,
-0.03176821023225784,
-0.02043847180902958,
0.010030278004705906,
-0.03764862194657326,
0.006415088661015034,
0.051988329738378525,
-0.03297243267297745,
-0.009103226475417614,
0.026150060817599297,
0.0243906918913126,
-0.015925325453281403,
-0.02849486470222473,
-0.02430209331214428,
0.02745685912668705,
-0.0019803487230092287,
0.0014554355293512344,
-0.005263762082904577,
0.04794197157025337,
-0.0236489437520504,
0.026263384148478508,
-0.021122319623827934,
0.0008350482094101608,
-0.013772496022284031,
-0.05890527740120888,
-0.022376909852027893,
0.031773220747709274,
-0.007290782872587442,
-0.053937364369630814,
-0.03416895493865013,
-0.006741957273334265
] |
d99f875863138f11af1d76f0c753c198ad6d96bd | 1,329 | py | Python | PyDSTool/core/context_managers.py | yuanz271/PyDSTool | 886c143cdd192aea204285f3a1cb4968c763c646 | [
"Python-2.0",
"OLDAP-2.7"
] | null | null | null | PyDSTool/core/context_managers.py | yuanz271/PyDSTool | 886c143cdd192aea204285f3a1cb4968c763c646 | [
"Python-2.0",
"OLDAP-2.7"
] | null | null | null | PyDSTool/core/context_managers.py | yuanz271/PyDSTool | 886c143cdd192aea204285f3a1cb4968c763c646 | [
"Python-2.0",
"OLDAP-2.7"
] | null | null | null | # -*- coding: utf-8 -*-
"""Context managers implemented for (mostly) internal use"""
import contextlib
import functools
from io import UnsupportedOperation
import os
import sys
__all__ = ["RedirectStdout", "RedirectStderr"]
@contextlib.contextmanager
def _stdchannel_redirected(stdchannel, dest_filename, mode="w"):
"""
A context manager to temporarily redirect stdout or stderr
Originally by Marc Abramowitz, 2013
(http://marc-abramowitz.com/archives/2013/07/19/python-context-manager-for-redirected-stdout-and-stderr/)
"""
oldstdchannel = None
dest_file = None
try:
if stdchannel is None:
yield iter([None])
else:
oldstdchannel = os.dup(stdchannel.fileno())
dest_file = open(dest_filename, mode)
os.dup2(dest_file.fileno(), stdchannel.fileno())
yield
except (UnsupportedOperation, AttributeError):
yield iter([None])
finally:
if oldstdchannel is not None:
os.dup2(oldstdchannel, stdchannel.fileno())
if dest_file is not None:
dest_file.close()
RedirectStdout = functools.partial(_stdchannel_redirected, sys.stdout)
RedirectStderr = functools.partial(_stdchannel_redirected, sys.stderr)
RedirectNoOp = functools.partial(_stdchannel_redirected, None, "")
| 28.891304 | 109 | 0.68924 | 1 | 1.0656 | [
0.002766088815405965,
0.02626906707882881,
0.0092936335131526,
0.001260734279640019,
0.005067666061222553,
-0.0006234981119632721,
-0.012263655662536621,
0.0020680618472397327,
-0.007391772698611021,
0.00004425959923537448,
0.0006775525980629027,
0.006125213578343391,
0.006633738521486521,
-0.018031243234872818,
-0.0007053783047012985,
0.016945000737905502,
-0.053434330970048904,
0.003201625309884548,
-0.004603804554790258,
0.002218765439465642,
-0.008551351726055145,
0.010334360413253307,
0.008022474125027657,
0.008428194560110569,
0.008885703049600124,
-0.001694673323072493,
0.010676011443138123,
0.000742176256608218,
-0.007708392105996609,
-0.008690095506608486,
-0.0007883287034928799,
-0.0007834603311493993,
-0.0051391455344855785,
-0.008183514699339867,
0.007470814045518637,
-0.0015075349947437644,
0.00005758275801781565,
-0.018312649801373482,
0.012178000062704086,
-0.004853878635913134,
-0.007044229656457901,
-0.017357103526592255,
-0.0010548039572313428,
0.004155055619776249,
-0.009121591225266457,
0.0017552546923980117,
-0.003942339681088924,
0.003376259235665202,
-0.011810660362243652,
0.005899811163544655,
-0.009384325705468655,
0.00746091129258275,
0.01459128875285387,
0.0016644158167764544,
-0.006669186986982822,
-0.007245879620313644,
0.013265948742628098,
0.001130234682932496,
-0.01101089920848608,
-0.0002626078203320503,
-0.0014330769190564752,
-0.003983465954661369,
0.005265089217573404,
0.004919047467410564,
-0.01570224203169346,
-0.006493334658443928,
-0.004400281701236963,
0.002634224249050021,
-0.0009543864289298654,
0.006581027060747147,
0.00018174285651184618,
-0.0010572109604254365,
0.008638340048491955,
0.0045456537045538425,
0.0033919652923941612,
-0.0038805052172392607,
-0.0015009453054517508,
-0.0005537414108403027,
0.006955048535019159,
0.0008734837174415588,
0.002927427878603339,
-0.007208291441202164,
0.006189912091940641,
0.008157494477927685,
0.016604265198111534,
0.008175050839781761,
0.01913244090974331,
-0.011989378370344639,
0.047637563198804855,
0.006467767991125584,
-0.00948141235858202,
0.0004432839050423354,
-0.009602402336895466,
-0.0027426413726061583,
-0.005016625858843327,
-0.02947869710624218,
0.0007242715219035745,
-0.0032679338473826647,
0.0005603872123174369,
0.004762269556522369,
-0.0005133514059707522,
0.005682890769094229,
-0.0017343199579045177,
-0.0012256699847057462,
-0.009229512885212898,
0.013279960490763187,
-0.010413284413516521,
-0.003817192278802395,
0.006507106125354767,
0.0022849291563034058,
-0.009985829703509808,
-0.001605807337909937,
0.0010196665534749627,
-0.011665153317153454,
0.00390650937333703,
0.0025505253579467535,
-0.005244865547865629,
0.05830398201942444,
0.0009660893701948225,
0.00237848749384284,
-0.005116007290780544,
-0.00041006715036928654,
0.0022896616719663143,
0.004074949771165848,
0.009151194244623184,
-0.002919739345088601,
0.007698373403400183,
0.008381574414670467,
0.0019640878308564425,
0.00749526172876358,
-0.0007488310220651329,
0.006932500284165144,
-0.005053751170635223,
-0.0015165533404797316,
0.0010936274193227291,
-0.007655796129256487,
0.008439953438937664,
0.0004549853620119393,
-0.0054471855983138084,
-0.0016475607408210635,
-0.001849753432907164,
-0.011126517318189144,
0.0015589530812576413,
-0.0029997010715305805,
0.002654105192050338,
-0.012827365659177303,
-0.005670587997883558,
-0.004540739580988884,
-0.004805892240256071,
0.0027589465025812387,
0.008394740521907806,
0.0054948944598436356,
0.0034860267769545317,
-0.0054804254323244095,
-0.009192567318677902,
-0.003787646535784006,
-0.005354596767574549,
0.0033815097995102406,
0.008345207199454308,
0.004301330540329218,
-0.00909027922898531,
-0.00023250709637068212,
0.0038505326956510544,
0.004114882554858923,
0.0014504746068269014,
0.002354067750275135,
-0.009460066445171833,
0.006634823977947235,
0.0013710444327443838,
0.004993941634893417,
0.011150487698614597,
-0.0029676996637135744,
-0.0014609751524403691,
0.0005502133863046765,
0.002937939250841737,
0.00021740309603046626,
0.004707563202828169,
0.011882326565682888,
-0.005506597459316254,
-0.005004390608519316,
0.004888503812253475,
0.005046740639954805,
0.009181630797684193,
0.005434487480670214,
-0.0032619049306958914,
-0.00021784420823678374,
-0.005633590742945671,
-0.0009171055862680078,
0.00559900002554059,
-0.004869784694164991,
0.008497359231114388,
0.003852232825011015,
-0.01595655269920826,
-0.008041939698159695,
0.0007223099819384515,
-0.008287678472697735,
0.0006467226194217801,
0.015090733766555786,
0.011191093362867832,
-0.003950400277972221,
0.0031008797232061625,
-0.010040061548352242,
0.0014804857783019543,
0.007484508212655783,
0.0017253980040550232,
-0.014830884523689747,
-0.956539511680603,
0.0034871308598667383,
0.0026752823032438755,
-0.0008461042307317257,
0.005485128611326218,
0.003193536540493369,
0.002562107052654028,
0.004277173429727554,
0.016633091494441032,
-0.009706499986350536,
-0.006505046505481005,
-0.011484612710773945,
-0.01056245993822813,
-0.0026289620436728,
-0.005715422797948122,
-0.0033740929793566465,
-0.005320619326084852,
-0.006729640997946262,
-0.002772025065496564,
-0.0017858403734862804,
-0.0023924047127366066,
0.009353810921311378,
0.0009985609212890267,
0.004828436765819788,
0.004313027020543814,
0.004019052255898714,
-0.0042132362723350525,
-0.000799860164988786,
-0.0010674752993509173,
-0.0018781247781589627,
-0.006499695125967264,
-0.016414834186434746,
-0.0022878714371472597,
-0.001464880770072341,
0.009230653755366802,
0.0017542724963277578,
0.009549470618367195,
-0.001637621782720089,
-0.0003389111370779574,
-0.007565373554825783,
0.007185855880379677,
0.0019860020838677883,
0.004762758035212755,
-0.031448520720005035,
-0.00044581081601791084,
-0.0016138199716806412,
-0.012866126373410225,
0.007768666371703148,
0.002805134980008006,
-0.0001541225501568988,
-0.0004649950424209237,
-0.005348296370357275,
0.009850012138485909,
-0.007666071876883507,
0.004461644217371941,
-0.0023680003359913826,
-0.0064332857728004456,
-0.003770456649363041,
-0.010389840230345726,
0.002705644117668271,
0.004782507196068764,
-0.005446255207061768,
-0.006323079578578472,
-0.00357383256778121,
0.0041908929124474525,
0.0005291562993079424,
-0.0011284248903393745,
-0.016918735578656197,
-0.005163697991520166,
-0.0011342816287651658,
-0.0013157495995983481,
-0.002612329088151455,
-0.004894677549600601,
0.006435058545321226,
-0.010101992636919022,
0.004803081974387169,
-0.0003113477141596377,
-0.00030368322040885687,
-0.010800234973430634,
0.003871857188642025,
-0.007113019935786724,
-0.009716510772705078,
0.0012646644609048963,
-0.004773573949933052,
-0.005574144423007965,
0.0021521637681871653,
-0.0009348444291390479,
0.00665235472843051,
-0.003871154272928834,
0.000713663874194026,
0.010147594846785069,
-0.003507800167426467,
-0.007978927344083786,
0.006740145850926638,
0.006262028589844704,
0.0012696899939328432,
-0.0015593485441058874,
0.00021778681548312306,
0.009804385714232922,
0.007593696936964989,
0.002871518721804023,
0.005825130268931389,
0.0007636190857738256,
0.00807732529938221,
0.001048206351697445,
0.001910841790959239,
-0.0015911258524283767,
-0.0013271187199279666,
-0.004935191012918949,
-0.000014345057024911512,
-0.0046325973235070705,
-0.0021869561169296503,
-0.01370926946401596,
-0.009178441017866135,
-0.00399042246863246,
0.0000071427502916776575,
0.0022645597346127033,
-0.004782720934599638,
0.0009443048620596528,
0.0014660117449238896,
0.00961084384471178,
0.0014826328260824084,
-0.002187018981203437,
0.0007335666450671852,
0.0056520490907132626,
-0.009946051053702831,
0.013916252180933952,
-0.012022498995065689,
0.006377002689987421,
-0.001732022617943585,
-0.01836300827562809,
0.00807182863354683,
0.010383274406194687,
-0.008805773220956326,
0.0029637187253683805,
0.0043863411992788315,
0.005113136023283005,
-0.0012014713138341904,
-0.005201867315918207,
-0.005209638737142086,
-0.015147806145250797,
0.0007009977125562727,
0.020268579944968224,
0.0020766747184097767,
0.0112856300547719,
0.011834986507892609,
-0.0035498477518558502,
0.0014716770965605974,
0.0038120723329484463,
-0.00020627742924261838,
0.01337889302521944,
-0.009384376928210258,
-0.0008344832458533347,
0.00018789888417813927,
-0.006052109412848949,
0.0010940720094367862,
0.006512704771012068,
0.005105107557028532,
-0.002323663327842951,
0.0030104839242994785,
-0.006757042370736599,
-0.00568319670855999,
-0.016223909333348274,
-0.003441950073465705,
0.005996302701532841,
-0.005649141035974026,
0.006356367841362953,
-0.013650225475430489,
0.007108813151717186,
0.007357071619480848,
0.0022925797384232283,
-0.0002844830451067537,
0.0015424583107233047,
0.006460894364863634,
0.011380011215806007,
-0.006041630171239376,
0.002759284572675824,
0.0016379886073991656,
0.00035037926863878965,
-0.000007834671123418957,
0.006805961020290852,
-0.005053644999861717,
-0.005674981512129307,
0.001840383978560567,
0.003063758136704564,
-0.001025875099003315,
-0.004757155664265156,
-0.008832842111587524,
-0.004266710020601749,
0.005785689689218998,
-0.006728616077452898,
0.0055200932547450066,
0.0021561714820563793,
0.0025836178101599216,
-0.00993033405393362,
-0.0016239085234701633,
-0.005020326469093561,
-0.01251780055463314,
0.010404210537672043,
-0.0038004196248948574,
0.002187985461205244,
0.012891222722828388,
0.0046557174064219,
-0.0143405981361866,
0.0049620745703577995,
0.0051050870679318905,
-0.005396138411015272,
0.0033748657442629337,
0.005680523347109556,
-0.005378612782806158,
-0.02232438512146473,
-0.0018351132748648524,
-0.015736958011984825,
0.008265931159257889,
-0.0009156319429166615,
0.0021536233834922314,
-0.006975129712373018,
0.006677725352346897,
0.006337846163660288,
-0.011389380320906639,
-0.0052352845668792725,
-0.00984319020062685,
0.00904056802392006,
0.00024098766152746975,
-0.0011368825798854232,
-0.0044440277852118015,
-0.000280766369542107,
-0.003438102314248681,
-0.0031091345008462667,
-0.0012373083736747503,
0.005684906151145697,
0.002329795155674219,
-0.003415636718273163,
0.002995831426233053,
-0.0035892424639314413,
0.0011541300918906927,
0.00129372114315629,
-0.011652935296297073,
0.0016458502504974604,
0.005754635203629732,
-0.0024693135637789965,
-0.0035116104409098625,
0.00023004579998087138,
-0.0015310361050069332,
-0.003978486638516188,
-0.008765342645347118,
-0.0018936998676508665,
-0.0035222209990024567,
-0.0031257106456905603,
-0.010364653542637825,
-0.0038647542241960764,
-0.00861276499927044,
0.00795701239258051,
-0.008163783699274063,
0.007756450679153204,
0.005372869316488504,
-0.003363643540069461,
0.008408061228692532,
-0.0025085306260734797,
0.004494393244385719,
0.004068281501531601,
0.004472448490560055,
0.002635714365169406,
-0.006958989426493645,
-0.010406031273305416,
0.011705635115504265,
-0.008660647086799145,
0.0014043458504602313,
0.010747456923127174,
0.005075359717011452,
0.009003154933452606,
0.00015358100063167512,
-0.0016471499111503363,
0.0039878725074231625,
0.009099284186959267,
-0.011962574906647205,
0.002383089391514659,
-0.0016989848809316754,
-0.0023847026750445366,
0.00620242627337575,
-0.004158478230237961,
0.0029699041042476892,
0.007575811818242073,
0.0008105135639198124,
-0.006946137640625238,
-0.0022355024702847004,
0.0011988948099315166,
0.00466161547228694,
-0.013955233618617058,
-0.00022550720314029604,
-0.003925508353859186,
-0.0053321062587201595,
-0.004022947978228331,
-0.0008468172745779157,
0.00021490523067768663,
0.006701095029711723,
-0.0022601268719881773,
0.005125793628394604,
0.004376939032226801,
-0.0054560257121920586,
0.017376089468598366,
-0.004543593153357506,
-0.0059300935827195644,
0.0013795011909678578,
0.0039480263367295265,
-0.00017262002802453935,
-0.00682061305269599,
-0.002975430805236101,
0.0035109948366880417,
0.0037775447126477957,
-0.0029175046365708113,
-0.0033400370739400387,
-0.0024033328518271446,
0.002474184613674879,
-0.00796185526996851,
-0.0001272052904823795,
0.01251183170825243,
-0.0036572213284671307,
0.003019926371052861,
-0.001434261561371386,
-0.007956738583743572,
-0.0149709926918149,
0.053431034088134766,
-0.0009245545952580869,
0.003082014387473464,
0.005641641560941935,
-0.008059988729655743,
0.0001335310807917267,
-0.0030367153231054544,
0.007328016683459282,
-0.007650535088032484,
-0.007795058190822601,
0.009536395780742168,
-0.004905246663838625,
0.0039529078640043736,
0.000988420215435326,
-0.002978890435770154,
0.015012855641543865,
-0.003817481454461813,
-0.015466516837477684,
-0.015370549634099007,
0.009091068059206009,
-0.002376498654484749,
-0.008402422070503235,
0.007822485640645027,
-0.0028304620645940304,
-0.0018704726826399565,
0.001826853840611875,
0.005460492800921202,
0.0029517533257603645,
0.002065378939732909,
-0.004000007640570402,
-0.0037671516183763742,
-0.00029892398742958903,
0.004617785103619099,
0.006936237681657076,
0.008854342624545097,
-0.002318877261132002,
0.0036701553035527468,
-0.0015919719589874148,
-0.0023351782001554966,
-0.0009838565019890666,
0.003988299984484911,
0.008924238383769989,
-0.002599142026156187,
-0.00288867624476552,
0.004938411060720682,
0.0065103210508823395,
0.002602161141112447,
0.009325668215751648,
0.0023611190263181925,
-0.004274538718163967,
0.007294353097677231,
0.009011127054691315,
-0.001335530891083181,
0.009602050296962261,
-0.002356054959818721,
0.004713852424174547,
0.0015532404650002718,
-0.0037315411027520895,
-0.01589503511786461,
-0.0032245307229459286,
0.005144394468516111,
0.011232245713472366,
0.000014653929611085914,
-0.0005423504044301808,
-0.0027626247610896826,
-0.002042772015556693,
-0.008243639953434467,
-0.008505665697157383,
-0.004186526872217655,
-0.00012037507258355618,
-0.0000262331868725596,
0.07215669751167297,
-0.006186422426253557,
-0.0012722872197628021,
-0.008961530402302742,
-0.0011227274080738425,
-0.0009790335316210985,
-0.0019649374298751354,
0.00005907576996833086,
-0.0018676992040127516,
0.00215709931217134,
0.0031276841182261705,
-0.011082564480602741,
-0.011645987629890442,
0.0021741753444075584,
0.0008596220286563039,
-0.0016782452585175633,
0.0033674505539238453,
0.0074418955482542515,
-0.00944170355796814,
0.0018860880518332124,
-0.009930244646966457,
-0.0026885387487709522,
-0.0027897304389625788,
-0.012049080803990364,
-0.004295618738979101,
-0.0032189663033932447,
0.004094509407877922,
0.0024121489841490984,
0.005634539760649204,
-0.0011768502881750464,
0.0063040005043148994,
-0.0017978843534365296,
-0.0002805615949910134,
-0.0054323612712323666,
0.0004662014252971858,
-0.0071755750104784966,
0.004818826448172331,
0.0018441579304635525,
-0.008128752931952477,
-0.004602357745170593,
-0.0012091323733329773,
-0.0005676165455952287,
-0.005172496661543846,
0.004895556252449751,
0.0004985883715562522,
0.0026647914201021194,
-0.0024678821209818125,
0.0017641609301790595,
-0.007047112099826336,
0.001562741119414568,
-0.012214446440339088,
0.0028214759659022093,
-0.17758537828922272,
0.010927049443125725,
0.0043402425944805145,
-0.0043966700322926044,
-0.003909524530172348,
-0.013432092033326626,
-0.006591735873371363,
0.0038086436688899994,
0.012784549966454506,
-0.0009216805920004845,
-0.0017504822462797165,
-0.002989034401252866,
0.00441516051068902,
0.004053615033626556,
-0.002164221368730068,
-0.005585599225014448,
0.003899217117577791,
-0.0042325458489358425,
-0.00024010654306039214,
0.003580933902412653,
0.0033938719425350428,
0.00925511121749878,
0.0022404815535992384,
0.0006875262479297817,
-0.0023310251999646425,
-0.005348245147615671,
0.00615377351641655,
-0.0017493052873760462,
0.005972255486994982,
-0.012741176411509514,
-0.001308066421188414,
-0.005928160157054663,
-0.00558203412219882,
0.002362178871408105,
0.006022216286510229,
-0.0027989905793219805,
0.006936877965927124,
0.00443632947281003,
-0.009156797081232071,
0.00711319362744689,
-0.007640725467354059,
0.03005746565759182,
0.006593713071197271,
0.009093414060771465,
-0.00036084032035432756,
-0.004927353002130985,
-0.0029587976168841124,
0.008941233158111572,
0.0026873957831412554,
0.011705305427312851,
-0.012395963072776794,
-0.0031019628513604403,
0.00306545477360487,
0.01993156597018242,
-0.005888654850423336,
-0.01089593768119812,
-0.005201336927711964,
-0.005129477474838495,
0.001963414018973708,
0.011045718565583229,
0.014007441699504852,
-0.002252295147627592,
0.00991347711533308,
-0.0026983264833688736,
-0.02111877128481865,
0.001864679274149239,
-0.0049660587683320045,
-0.008604339323937893,
0.0028940855991095304,
0.005128741730004549,
0.012354942038655281,
0.0022449828684329987,
0.005565572064369917,
-0.0008946025045588613,
0.004365192260593176,
-0.00029847852420061827,
0.00527080986648798,
-0.0020977212116122246,
0.004307165276259184,
-0.009391357190907001,
0.00875688623636961,
-0.009848401881754398,
-0.003508720314130187,
0.002852943493053317,
-0.003575611859560013,
0.011301835998892784,
0.0047356607392430305,
-0.00013945784303359687,
-0.0005850499146617949,
-0.010015233419835567,
-0.002521463204175234,
0.0011428657453507185,
0.0009767147712409496,
-0.010051194578409195,
0.004522984381765127,
-0.0009066623169928789,
0.005152381025254726,
0.006356033496558666,
-0.0067446171306073666,
0.005983786191791296,
0.005763242952525616,
-0.007692569401115179,
0.002501009264960885,
-0.004442212171852589,
0.0015472201630473137,
0.002054372103884816,
-0.006344564724713564,
-0.007399177178740501,
0.002842748537659645,
-0.008807162754237652,
-0.004993653390556574,
0.005894072819501162,
-0.008433976210653782,
-0.007928004488348961,
-0.0012486838968470693,
-0.012922673486173153,
0.00044382724445313215
] |
d99ff34b5f61cee604590c456f40398d7da18182 | 3,215 | py | Python | pos_kiosk/hooks.py | Muzzy73/pos_kiosk | 1ed42cfaeb15f009293b76d05dd85bd322b42f03 | [
"MIT"
] | 1 | 2022-03-05T11:42:36.000Z | 2022-03-05T11:42:36.000Z | pos_kiosk/hooks.py | Muzzy73/pos_kiosk | 1ed42cfaeb15f009293b76d05dd85bd322b42f03 | [
"MIT"
] | null | null | null | pos_kiosk/hooks.py | Muzzy73/pos_kiosk | 1ed42cfaeb15f009293b76d05dd85bd322b42f03 | [
"MIT"
] | 1 | 2022-03-05T11:42:37.000Z | 2022-03-05T11:42:37.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "pos_kiosk"
app_title = "Pos Kiosk"
app_publisher = "9t9it"
app_description = "Kiosk App"
app_icon = "octicon octicon-file-directory"
app_color = "grey"
app_email = "info@9t9it.com"
app_license = "MIT"
# Includes in <head>
# ------------------
# include js, css files in header of desk.html
# app_include_css = "/assets/pos_kiosk/css/pos_kiosk.css"
# app_include_js = "/assets/pos_kiosk/js/pos_kiosk.js"
# include js, css files in header of web template
# web_include_css = "/assets/pos_kiosk/css/pos_kiosk.css"
# web_include_js = "/assets/pos_kiosk/js/pos_kiosk.js"
# include js in page
# page_js = {"page" : "public/js/file.js"}
# page_js = {
# "kiosk": ["public/js/pos_page_js.js", "public/js/includes/number_to_words.js"]
# }
# include js in doctype views
# doctype_js = {"doctype" : "public/js/doctype.js"}
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}
fixtures = [
{
"doctype": "Custom Field",
"filters": [
[
"name",
"in",
[
"Sales Invoice Item-pos_kiosk",
"Mode of Payment-logo"
]
]
]
}
]
# Home Pages
# ----------
# application home page (will override Website Settings)
# home_page = "login"
# website user home page (by Role)
# role_home_page = {
# "Role": "home_page"
# }
# Website user home page (by function)
# get_website_user_home_page = "pos_kiosk.utils.get_home_page"
# Generators
# ----------
# automatically create page for each record of this doctype
# website_generators = ["Web Page"]
# Installation
# ------------
# before_install = "pos_kiosk.install.before_install"
# after_install = "pos_kiosk.install.after_install"
# Desk Notifications
# ------------------
# See frappe.core.notifications.get_notification_config
# notification_config = "pos_kiosk.notifications.get_notification_config"
# Permissions
# -----------
# Permissions evaluated in scripted ways
# permission_query_conditions = {
# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
# }
#
# has_permission = {
# "Event": "frappe.desk.doctype.event.event.has_permission",
# }
# Document Events
# ---------------
# Hook on document methods and events
# doc_events = {
# "*": {
# "on_update": "method",
# "on_cancel": "method",
# "on_trash": "method"
# }
# }
# Scheduled Tasks
# ---------------
# scheduler_events = {
# "all": [
# "pos_kiosk.tasks.all"
# ],
# "daily": [
# "pos_kiosk.tasks.daily"
# ],
# "hourly": [
# "pos_kiosk.tasks.hourly"
# ],
# "weekly": [
# "pos_kiosk.tasks.weekly"
# ]
# "monthly": [
# "pos_kiosk.tasks.monthly"
# ]
# }
# Testing
# -------
# before_tests = "pos_kiosk.install.before_tests"
# Overriding Whitelisted Methods
# ------------------------------
#
# override_whitelisted_methods = {
# "pos_bahrain.api.get_item_details.get_item_details": "pos_kiosk.api.item.get_item_details" # noqa
# }
| 22.964286 | 101 | 0.631415 | 1 | 1.9221 | [
-0.03399652987718582,
0.05334565043449402,
-0.010739530436694622,
-0.04139868915081024,
0.00542831514030695,
0.038012780249118805,
-0.026146767660975456,
-0.0020863921381533146,
-0.028625687584280968,
0.022263024002313614,
0.015511955134570599,
0.02092256397008896,
0.03750109300017357,
-0.029423987492918968,
-0.028867751359939575,
-0.019701605662703514,
0.17439863085746765,
-0.040338411927223206,
-0.031088372692465782,
0.009681611321866512,
0.026311054825782776,
0.014720957726240158,
-0.008155854418873787,
-0.023672500625252724,
0.030504150316119194,
-0.0024782023392617702,
0.06298892945051193,
0.015719745308160782,
0.011017761193215847,
-0.01412941049784422,
0.006289397832006216,
0.00421952037140727,
0.013038269244134426,
0.03274579346179962,
0.001567527069710195,
-0.012980734929442406,
-0.01712462306022644,
-0.06019492447376251,
0.023719072341918945,
-0.01666492596268654,
0.014418628998100758,
-0.007927263155579567,
-0.02093752846121788,
-0.03654002398252487,
0.017970474436879158,
-0.04146268218755722,
-0.03234759345650673,
0.014611590653657913,
-0.03319251164793968,
0.016048705205321312,
-0.01973840780556202,
0.05020388960838318,
0.0014051736798137426,
-0.04997290298342705,
-0.03910275176167488,
-0.034547023475170135,
0.03829057514667511,
-0.0074891215190291405,
0.00396278640255332,
-0.026573657989501953,
-0.02364298515021801,
0.031808700412511826,
-0.009172863326966763,
-0.0003225174732506275,
-0.03669804707169533,
0.0299855824559927,
0.007624619174748659,
-0.03336440399289131,
-0.03906119987368584,
-0.005699485074728727,
-0.0003777065721806139,
-0.013883041217923164,
-0.022685611620545387,
0.09344474971294403,
0.015413383021950722,
-0.011385212652385235,
-0.0345366895198822,
-0.014989643357694149,
0.0013903415529057384,
-0.004189085680991411,
0.0014433787437155843,
0.07072578370571136,
-0.009196669794619083,
-0.003480619518086314,
-0.045434728264808655,
0.0027705857064574957,
0.06914938241243362,
-0.04809202253818512,
0.03924969583749771,
0.02450624294579029,
-0.011552981100976467,
0.043092694133520126,
-0.07226002961397171,
0.008293777704238892,
-0.037264034152030945,
-0.08470351248979568,
-0.0035511995665729046,
0.005602176766842604,
-0.021605893969535828,
0.02230824902653694,
-0.043010782450437546,
-0.022113729268312454,
0.01654570922255516,
-0.010701071470975876,
-0.012751376256346703,
0.038480617105960846,
0.012978821061551571,
0.013046110048890114,
0.025594407692551613,
-0.004221893846988678,
-0.042976394295692444,
0.003883030265569687,
0.0100748585537076,
-0.011477162130177021,
-0.017941482365131378,
-0.021222399547696114,
0.004756269510835409,
0.0013300314312800765,
-0.003300224896520376,
-0.026229441165924072,
-0.0017379354685544968,
0.0573570616543293,
0.03655117005109787,
-0.02454930730164051,
-0.013381563127040863,
0.05389983579516411,
-0.01072271540760994,
0.0017834861064329743,
0.02885490097105503,
-0.013905386440455914,
-0.008737031370401382,
0.036427054554224014,
-0.04063677042722702,
0.03595510497689247,
0.0033806811552494764,
0.013267077505588531,
-0.010665633715689182,
0.0027503916062414646,
-0.05430423840880394,
-0.006545010022819042,
-0.007209086790680885,
-0.022236188873648643,
0.0015578471357002854,
-0.004212899133563042,
0.010420742444694042,
-0.026716867461800575,
0.045973241329193115,
0.011571289971470833,
-0.031697653234004974,
-0.022537067532539368,
0.007089444436132908,
-0.024298038333654404,
-0.019130263477563858,
0.05621853843331337,
-0.038670387119054794,
0.007420258596539497,
0.004476282745599747,
-0.01475613284856081,
-0.03352899104356766,
-0.02098945900797844,
-0.015426776371896267,
0.04046078771352768,
-0.006229352205991745,
0.004814747255295515,
0.02799815870821476,
0.0476151779294014,
-0.0011580158025026321,
-0.017240196466445923,
-0.023418376222252846,
-0.01922895759344101,
0.008421634323894978,
-0.027894670143723488,
-0.0523977167904377,
-0.013114714995026588,
-0.002787351841107011,
0.007528494577854872,
0.03149470314383507,
0.027134913951158524,
-0.0505312979221344,
0.01108540315181017,
0.016157113015651703,
-0.02496490813791752,
0.03664544224739075,
-0.023532714694738388,
0.0017875278135761619,
0.03864353522658348,
-0.025628652423620224,
-0.01130072120577097,
-0.01043025590479374,
-0.021819820627570152,
-0.001504965708591044,
-0.015572312287986279,
0.027720101177692413,
-0.03433099016547203,
0.023575281724333763,
-0.019911058247089386,
0.0027293339371681213,
-0.01264653354883194,
-0.024034157395362854,
-0.02234812267124653,
-0.0074863191694021225,
-0.004103181883692741,
-0.004391412250697613,
0.010372781194746494,
-0.005535628646612167,
-0.0023276018910109997,
-0.649021327495575,
0.005686373449862003,
-0.0031464078929275274,
-0.022175198420882225,
-0.016117388382554054,
0.01266329176723957,
0.03669865429401398,
0.013799379579722881,
0.016968710348010063,
-0.000019311009964440018,
-0.0205313079059124,
-0.0007826648652553558,
-0.03850241005420685,
-0.024427469819784164,
0.012326819822192192,
-0.04699964076280594,
-0.010817885398864746,
-0.025111285969614983,
0.010664619505405426,
0.03142008185386658,
0.008384505286812782,
-0.016214899718761444,
0.022684788331389427,
0.0006622381042689085,
-0.0039710369892418385,
0.031113456934690475,
-0.015898704528808594,
0.024306029081344604,
-0.02986946329474449,
-0.024546056985855103,
-0.004055203404277563,
0.0154600590467453,
0.040479790419340134,
-0.028028767555952072,
0.01972968876361847,
0.03939499333500862,
0.034861594438552856,
-0.03733011335134506,
-0.008009769022464752,
0.010802612639963627,
-0.057267624884843826,
-0.0035224708262830973,
0.023715127259492874,
-0.0700884684920311,
-0.039968982338905334,
0.016591213643550873,
-0.0532357431948185,
-0.006526189390569925,
0.006368221715092659,
0.042686570435762405,
-0.03241908922791481,
0.009682755917310715,
0.07471118122339249,
-0.01892656832933426,
-0.0010098962811753154,
-0.0266385730355978,
-0.027345603331923485,
-0.020920565351843834,
-0.025304662063717842,
-0.0012271861778572202,
-0.0005985571187920868,
0.04941024258732796,
-0.027981020510196686,
0.019306698814034462,
-0.01735919900238514,
0.026094909757375717,
0.047392357140779495,
0.009284448809921741,
0.022903120145201683,
0.054868184030056,
-0.05374087020754814,
0.0018082988681271672,
-0.007884685881435871,
0.10592296719551086,
-0.04846438392996788,
0.03602699562907219,
0.024625228717923164,
0.021396180614829063,
-0.03682759031653404,
-0.0034664685372263193,
-0.010377956554293633,
-0.0017096619121730328,
0.008276768960058689,
-0.018802912905812263,
-0.0521557442843914,
-0.0005470821633934975,
-0.0065338630229234695,
-0.029315538704395294,
0.004746941849589348,
0.024585241451859474,
0.04315091669559479,
0.02663949877023697,
0.0351417101919651,
-0.01091406773775816,
-0.003667315701022744,
0.018828773871064186,
0.000383667676942423,
0.0231756754219532,
0.0070137991569936275,
0.026793159544467926,
-0.02245517075061798,
-0.016581682488322258,
0.008190888911485672,
0.004018918611109257,
0.011407218873500824,
-0.006999811623245478,
-0.013800614513456821,
0.004320133943110704,
-0.009781233966350555,
0.0015966558130457997,
-0.026455504819750786,
-0.0030807137954980135,
0.037689510732889175,
0.042843639850616455,
-0.03140458092093468,
-0.01403955277055502,
0.014647903852164745,
-0.0459764190018177,
-0.004501428455114365,
0.0024813718628138304,
-0.006578338798135519,
0.021694254130125046,
0.041953328996896744,
-0.0035171317867934704,
0.003196262987330556,
-0.003760008839890361,
-0.03458261489868164,
0.0004616914375219494,
0.018900834023952484,
-0.023123260587453842,
0.003984656650573015,
-0.030573150143027306,
-0.019501883536577225,
-0.003460247302427888,
0.026131220161914825,
0.04425115883350372,
0.012324788607656956,
-0.039424214512109756,
0.005774930585175753,
-0.012201298959553242,
-0.017795681953430176,
-0.0015582182677462697,
0.009289571084082127,
-0.037592947483062744,
0.015497172251343727,
0.003989770542830229,
0.06582454591989517,
0.020525069907307625,
0.04356799274682999,
0.02747250534594059,
-0.0031751561909914017,
0.027669807896018028,
0.020199349150061607,
0.016475776210427284,
-0.022454362362623215,
0.001778955920599401,
-0.020944418385624886,
0.04392635077238083,
0.02542908862233162,
0.018037309870123863,
-0.008400972001254559,
0.020681796595454216,
0.021209197118878365,
0.005676042288541794,
-0.0193372443318367,
0.0319954976439476,
-0.022992752492427826,
-0.003954413812607527,
-0.028855348005890846,
0.029843691736459732,
-0.01197428721934557,
0.01911480538547039,
0.020892633125185966,
0.011207343079149723,
0.026748953387141228,
0.019924413412809372,
0.006807566620409489,
-0.03699374943971634,
-0.011368070729076862,
0.014482379890978336,
-0.008860548958182335,
-0.024184100329875946,
-0.008066707290709019,
0.0001881561183836311,
0.013923325575888157,
-0.012971335090696812,
-0.030216244980692863,
-0.00858091376721859,
-0.010871217586100101,
-0.014598110690712929,
0.010409173555672169,
-0.003251217771321535,
-0.015616180375218391,
0.00790317077189684,
-0.032075803726911545,
-0.015742767602205276,
0.03746742382645607,
-0.061963170766830444,
0.022027743980288506,
-0.013568961061537266,
-0.01782841607928276,
-0.02548094466328621,
0.02436545304954052,
-0.013990177772939205,
-0.009806327521800995,
-0.013140557333827019,
0.017509061843156815,
0.030392643064260483,
-0.014821860939264297,
-0.045073624700307846,
0.021743763238191605,
0.037054914981126785,
0.015439888462424278,
-0.002396568190306425,
-0.010527842678129673,
0.026158984750509262,
-0.017974525690078735,
0.00283839856274426,
0.024215728044509888,
-0.04323242977261543,
-0.04056394472718239,
-0.04455607756972313,
0.006135540548712015,
-0.006807126570492983,
-0.011525333859026432,
-0.03706502169370651,
0.0358574204146862,
0.020119357854127884,
-0.04538062959909439,
-0.011697734706103802,
0.023793216794729233,
0.02196178026497364,
0.003609101055189967,
0.009845308028161526,
-0.03262430056929588,
0.009053676389157772,
-0.027563603594899178,
-0.048499543219804764,
0.011800669133663177,
-0.015066113322973251,
0.009871162474155426,
-0.01848944090306759,
0.015389850363135338,
0.034352246671915054,
0.015646763145923615,
-0.022314079105854034,
-0.00448252446949482,
-0.044699277728796005,
-0.030376790091395378,
-0.019595453515648842,
-0.03995038568973541,
0.027456777170300484,
0.015361325815320015,
-0.028286073356866837,
-0.00903679896146059,
0.041382286697626114,
0.010591062717139721,
0.020175572484731674,
0.03190042823553085,
0.026600657030940056,
-0.037181079387664795,
0.010457384400069714,
-0.007271830923855305,
-0.01194047648459673,
-0.04685157537460327,
-0.009987065568566322,
0.0317862406373024,
-0.018649373203516006,
-0.033001236617565155,
0.040503669530153275,
0.032421160489320755,
-0.013884575106203556,
-0.01819256693124771,
0.006205752491950989,
-0.030095258727669716,
-0.035618044435977936,
0.0029494876507669687,
0.03536884859204292,
-0.010683398693799973,
0.02768375724554062,
-0.009353136643767357,
-0.0506051629781723,
0.03366757556796074,
-0.0068073272705078125,
-0.004889970645308495,
0.0380108617246151,
0.06166132166981697,
0.01074159424751997,
-0.0849415585398674,
-0.006882895715534687,
0.01425213273614645,
0.003010448766872287,
0.042704563587903976,
-0.0002925253938883543,
0.03400139510631561,
0.036315884441137314,
-0.020006850361824036,
0.009654512628912926,
-0.0016190026653930545,
-0.003671463578939438,
-0.005016692448407412,
0.015445939265191555,
-0.025844687595963478,
0.032682906836271286,
-0.018810711801052094,
0.009180503897368908,
0.008809013292193413,
-0.002949728164821863,
0.023048631846904755,
0.021085532382130623,
0.003117308486253023,
0.03614713251590729,
0.04160887748003006,
0.009799516759812832,
-0.010025233961641788,
-0.017041414976119995,
0.03438058868050575,
0.011049054563045502,
0.028978485614061356,
0.0014975342201068997,
0.0033270155545324087,
0.02989361807703972,
-0.023245060816407204,
0.0024038003757596016,
-0.04257744178175926,
0.0007331283995881677,
-0.03695935010910034,
-0.01458511222153902,
-0.015928229317069054,
-0.033264435827732086,
0.027921607717871666,
-0.051588740199804306,
0.008656001649796963,
-0.005106532014906406,
0.002096017822623253,
-0.02221306599676609,
0.011169537901878357,
0.01520424522459507,
0.04053669050335884,
-0.007065165787935257,
-0.023716695606708527,
0.025049038231372833,
0.001734548364765942,
0.02211937867105007,
-0.0043241111561656,
0.046659331768751144,
0.013785033486783504,
0.027341198176145554,
0.05834364891052246,
0.05727492645382881,
-0.010617136023938656,
0.014605612494051456,
-0.047925207763910294,
-0.012915953062474728,
0.033900655806064606,
-0.06669009476900101,
-0.010844269767403603,
-0.003786179469898343,
0.0025477795861661434,
0.03135141730308533,
-0.026585428044199944,
0.009409939870238304,
-0.026569979265332222,
0.0006128657842054963,
0.012510152533650398,
-0.023961128666996956,
0.02473529428243637,
-0.007558246608823538,
-0.023302482441067696,
0.02137124165892601,
-0.02845430187880993,
-0.01402280479669571,
-0.014687547460198402,
0.02649770677089691,
0.030730685219168663,
0.042753852903842926,
-0.006724703125655651,
-0.0195542573928833,
0.01299063116312027,
0.014504080638289452,
0.015024558641016483,
-0.03681475296616554,
0.040236834436655045,
-0.03285649046301842,
0.04395318776369095,
-0.027999868616461754,
-0.0032945689745247364,
0.004964736755937338,
0.022592872381210327,
-0.0071192337200045586,
-0.010450589470565319,
0.012331497855484486,
0.0671755000948906,
0.04581565409898758,
-0.01803012192249298,
-0.01815054938197136,
-0.005311326589435339,
-0.03996055945754051,
-0.00017340820340905339,
-0.024486936628818512,
0.022064879536628723,
-0.0017946969019249082,
-0.009588281624019146,
-0.0036433502100408077,
-0.0034955854061990976,
-0.047600340098142624,
0.01067047007381916,
-0.0002209402882726863,
0.004653437994420528,
0.0551769956946373,
0.0008740709745325148,
-0.03722306340932846,
-0.009427189826965332,
-0.0178082138299942,
0.0626506432890892,
-0.0006156893214210868,
-0.06271543353796005,
0.013271874748170376,
0.013182158581912518,
0.015803184360265732,
-0.06184642016887665,
0.020883716642856598,
0.009855605661869049,
0.006503133103251457,
0.014591554179787636,
-0.013746882788836956,
0.012551015242934227,
-0.027659595012664795,
0.0078119453974068165,
0.0100862430408597,
-0.03162786364555359,
0.013304609805345535,
-0.047893475741147995,
0.0016021751798689365,
-0.0030461058486253023,
0.0059334575198590755,
0.023272128775715828,
-0.00547418650239706,
-0.006237728986889124,
-0.009059757925570011,
0.001922412309795618,
-0.018399951979517937,
-0.018938390538096428,
-0.005120015237480402,
0.0015022895531728864,
-0.047330599278211594,
0.00726537499576807,
0.006287125404924154,
0.029265915974974632,
0.023673398420214653,
-0.006624630186706781,
0.004093271680176258,
0.009064339101314545,
0.004599539563059807,
0.020694363862276077,
-0.01390546653419733,
0.003540330333635211,
0.022300515323877335,
0.010381031781435013,
0.009261056780815125,
0.0023482604883611202,
0.01696997508406639,
0.018525030463933945,
-0.0022551321890205145,
0.022369924932718277,
0.027654338628053665,
0.012209744192659855,
-0.028649503365159035,
-0.02296905778348446,
0.00000735167714083218,
0.028832869604229927,
-0.003052925458177924,
-0.019325902685523033,
0.022250480949878693,
-0.03067553974688053,
0.0529160238802433,
-0.017610082402825356,
-0.0019559282809495926,
0.05876823142170906,
-0.006084184627979994,
-0.07024780660867691,
-0.010534162633121014,
0.021446889266371727,
0.02351965755224228,
0.020933622494339943,
0.0009056284325197339,
-0.014911187812685966,
-0.04086418077349663,
-0.018339363858103752,
-0.0011312341084703803,
-0.009249283000826836,
-0.010262302123010159,
0.0072416942566633224,
0.029101381078362465,
0.017512958496809006,
-0.0377349779009819,
-0.00179809529799968,
0.008448176085948944,
0.026575980708003044,
-0.015080415643751621,
0.0061734518967568874,
-0.051496319472789764,
0.050790935754776,
-0.016795773059129715,
0.010855811648070812,
0.039214715361595154,
0.007702501490712166,
0.012914962135255337,
-0.04855864867568016,
-0.02022572234272957,
-0.028268562629818916,
-0.01936863549053669,
-0.021730005741119385,
0.018862204626202583,
0.012664658017456532,
0.027731863781809807,
0.020501088351011276,
0.024657921865582466,
-0.03475042060017586,
-0.014977487735450268,
0.011661903001368046,
0.03624633327126503,
-0.030529601499438286,
-0.0034556598402559757,
-0.015024637803435326,
-0.051366791129112244,
-0.06358411908149719,
0.01650429703295231,
0.005524283740669489,
-0.02430640533566475,
0.034381259232759476,
-0.028836868703365326,
-0.0024837288074195385,
-0.015979867428541183,
-0.008369388058781624,
-0.020676501095294952,
-0.029850279912352562,
0.0407952144742012,
0.0263470858335495,
-0.010427509434521198,
0.029336262494325638,
0.03460622578859329,
-0.01812765747308731,
0.0005198769504204392,
0.007649955805391073,
0.009825954213738441,
0.015494055114686489,
-0.0055512236431241035,
0.013834202662110329,
0.03882519528269768,
0.03980250284075737,
0.0037579392082989216,
-0.0080903060734272,
0.006546769756823778,
-0.01538054458796978,
-0.03973804786801338,
0.029764093458652496,
-0.012883959338068962,
0.02354811504483223,
-0.005614456720650196,
-0.06485561281442642,
-0.009119653142988682
] |
d9a00b2c6f1a0e88ad5b4a7def2a45bd074f417f | 3,880 | py | Python | pypagai/models/model_lstm.py | gcouti/pypagAI | d08fac95361dcc036d890a88cb86ce090322a612 | [
"Apache-2.0"
] | 1 | 2018-07-24T18:53:26.000Z | 2018-07-24T18:53:26.000Z | pypagai/models/model_lstm.py | gcouti/pypagAI | d08fac95361dcc036d890a88cb86ce090322a612 | [
"Apache-2.0"
] | 7 | 2020-01-28T21:45:14.000Z | 2022-03-11T23:20:53.000Z | pypagai/models/model_lstm.py | gcouti/pypagAI | d08fac95361dcc036d890a88cb86ce090322a612 | [
"Apache-2.0"
] | null | null | null | "from keras import Model, Input\nfrom keras.layers import Dense, concatenate, LSTM, Reshape, Permute(...TRUNCATED) | 33.162393 | 114 | 0.650773 | 1 | 2.0676 | [-0.06796137243509293,0.046021826565265656,0.015118476003408432,-0.006145813502371311,-0.00505826761(...TRUNCATED) |
d9a09cb6f497e8ccdf9de40f4b8ebd6b96a1c43a | 113 | py | Python | lib/variables/latent_variables/__init__.py | joelouismarino/variational_rl | 11dc14bfb56f3ebbfccd5de206b78712a8039a9a | [
"MIT"
] | 15 | 2020-10-20T22:09:36.000Z | 2021-12-24T13:40:36.000Z | lib/variables/latent_variables/__init__.py | joelouismarino/variational_rl | 11dc14bfb56f3ebbfccd5de206b78712a8039a9a | [
"MIT"
] | null | null | null | lib/variables/latent_variables/__init__.py | joelouismarino/variational_rl | 11dc14bfb56f3ebbfccd5de206b78712a8039a9a | [
"MIT"
] | 1 | 2020-10-23T19:48:06.000Z | 2020-10-23T19:48:06.000Z | "from .fully_connected import FullyConnectedLatentVariable\nfrom .convolutional import Convolutional(...TRUNCATED) | 37.666667 | 57 | 0.911504 | 1 | 0.6561 | [0.0019677402451634407,0.02590874955058098,0.005700739100575447,0.0012360074324533343,0.004866733681(...TRUNCATED) |
d9a0c8935f1da040f76922b94d20a857d8b8cd7d | 3,338 | py | Python | easyai/model/backbone/cls/pnasnet.py | lpj0822/image_point_cloud_det | 7b20e2f42f3f2ff4881485da58ad188a1f0d0e0f | [
"MIT"
] | 1 | 2020-09-05T09:18:56.000Z | 2020-09-05T09:18:56.000Z | easyai/model/backbone/cls/pnasnet.py | lpj0822/image_point_cloud_det | 7b20e2f42f3f2ff4881485da58ad188a1f0d0e0f | [
"MIT"
] | 8 | 2020-04-20T02:18:55.000Z | 2022-03-12T00:24:50.000Z | easyai/model/backbone/cls/pnasnet.py | lpj0822/image_point_cloud_det | 7b20e2f42f3f2ff4881485da58ad188a1f0d0e0f | [
"MIT"
] | null | null | null | "#!/usr/bin/env python\n# -*- coding:utf-8 -*-\n# Author:\n''' PNASNet in PyTorch.\nPaper: Progressi(...TRUNCATED) | 35.892473 | 95 | 0.612942 | 1 | 1.6491 | [0.0018799806712195277,0.023405689746141434,0.009430041536688805,0.0011929558822885156,0.00374648859(...TRUNCATED) |
End of preview. Expand
in Data Studio
- Downloads last month
- 38