uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
c460ea7a0b85e7c80156cc75
train
function
@login_required def simulator_import_stock_data(request): """ 模拟股市导入股票数据 """ if not request.user.is_superuser: return render(request, 'market/invalid/no_permission.html') if request.method == 'POST': form = forms.ImportStockDataForm(request.POST) if form.is_valid(): ...
@login_required def simulator_import_stock_data(request):
""" 模拟股市导入股票数据 """ if not request.user.is_superuser: return render(request, 'market/invalid/no_permission.html') if request.method == 'POST': form = forms.ImportStockDataForm(request.POST) if form.is_valid(): stock = form.cleaned_data['stock_symbol'] s...
(driver=request.user) simulator_reset_handler(request, superuser_client) sim_stocks.SimStockSlice.objects.all().delete() sim_stocks.SimTradeHistory.objects.all().delete() return HttpResponseRedirect(reverse('market:sim_welcome')) @login_required def simulator_import_stock_data(request):
63
64
197
10
53
LuoMaimingS/django_virtual_stock_market
market/views.py
Python
simulator_import_stock_data
simulator_import_stock_data
484
506
484
485
66a6bbf3c14e50f0bef4c4935fd261a9381bcd32
bigcode/the-stack
train
f0d5fe7ed627c1ae7ca69e96
train
function
def register(request): """ 注册新用户 """ if request.method != 'POST': # 刚进入页面,未提交数据,创建一个新表单 form = UserCreationForm() else: # POST,提交填写的数据,对数据进行处理 form = UserCreationForm(data=request.POST) if form.is_valid(): new_user = form.save() # 创建相应...
def register(request):
""" 注册新用户 """ if request.method != 'POST': # 刚进入页面,未提交数据,创建一个新表单 form = UserCreationForm() else: # POST,提交填写的数据,对数据进行处理 form = UserCreationForm(data=request.POST) if form.is_valid(): new_user = form.save() # 创建相应的用户client n...
(request, stock_id): """ 具体显示股票市场中某支股票的详细信息 """ this_stock = stocks.Stock.objects.get(id=stock_id) ask_info, bid_info = this_stock.get_level5_data() context = {'stock': this_stock, 'level5_ask': ask_info, 'level5_bid': bid_info} return render(request, 'market/stock.html', context) def regist...
93
93
311
4
89
LuoMaimingS/django_virtual_stock_market
market/views.py
Python
register
register
46
79
46
46
5fd98bb94cfb2df5f102392b8fa1cb4f10fbf39f
bigcode/the-stack
train
3bfb23079e399efe776c9fc8
train
function
def buildFeatureTableSubstitutionRecord(featureIndex, lookupListIndices): """Build a FeatureTableSubstitutionRecord.""" ftsr = ot.FeatureTableSubstitutionRecord() ftsr.FeatureIndex = featureIndex ftsr.Feature = ot.Feature() ftsr.Feature.LookupListIndex = lookupListIndices return ftsr
def buildFeatureTableSubstitutionRecord(featureIndex, lookupListIndices):
"""Build a FeatureTableSubstitutionRecord.""" ftsr = ot.FeatureTableSubstitutionRecord() ftsr.FeatureIndex = featureIndex ftsr.Feature = ot.Feature() ftsr.Feature.LookupListIndex = lookupListIndices return ftsr
fvr.FeatureTableSubstitution = ot.FeatureTableSubstitution() fvr.FeatureTableSubstitution.Version = 0x00010000 fvr.FeatureTableSubstitution.SubstitutionRecord = substitutionRecords return fvr def buildFeatureTableSubstitutionRecord(featureIndex, lookupListIndices):
64
64
74
14
49
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
buildFeatureTableSubstitutionRecord
buildFeatureTableSubstitutionRecord
414
420
414
414
6507863974ba560a02b8b96f86efe7fb5f10fcd0
bigcode/the-stack
train
bdd4bc21f27810454eb13de3
train
function
def addFeatureVariations(font, conditionalSubstitutions): """Add conditional substitutions to a Variable Font. The `conditionalSubstitutions` argument is a list of (Region, Substitutions) tuples. A Region is a list of Boxes. A Box is a dict mapping axisTags to (minValue, maxValue) tuples. Irreleva...
def addFeatureVariations(font, conditionalSubstitutions):
"""Add conditional substitutions to a Variable Font. The `conditionalSubstitutions` argument is a list of (Region, Substitutions) tuples. A Region is a list of Boxes. A Box is a dict mapping axisTags to (minValue, maxValue) tuples. Irrelevant axes may be omitted and they are interpretted as ex...
to change. """ from __future__ import print_function, absolute_import, division from fontTools.misc.py23 import * from fontTools.misc.dictTools import hashdict from fontTools.misc.intTools import popCount from fontTools.ttLib import newTable from fontTools.ttLib.tables import otTables as ot from fontTools.otlLib.build...
102
102
342
12
89
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
addFeatureVariations
addFeatureVariations
16
48
16
16
e1891a03f8c0b35981bb7d5f0105b816fc171651
bigcode/the-stack
train
c709cb68ffd59e2612b45275
train
function
def cleanupBox(box): """Return a sparse copy of `box`, without redundant (default) values. >>> cleanupBox({}) {} >>> cleanupBox({'wdth': (0.0, 1.0)}) {'wdth': (0.0, 1.0)} >>> cleanupBox({'wdth': (-1.0, 1.0)}) {} """ return {tag: limit for tag, limit in box.i...
def cleanupBox(box):
"""Return a sparse copy of `box`, without redundant (default) values. >>> cleanupBox({}) {} >>> cleanupBox({'wdth': (0.0, 1.0)}) {'wdth': (0.0, 1.0)} >>> cleanupBox({'wdth': (-1.0, 1.0)}) {} """ return {tag: limit for tag, limit in box.items() if limit != (-...
out from both sides. Can't cut either. return intersection, bot remainder[axisTag] = minimum,maximum if fullyInside: # bot is fully within intersection. Remainder is empty. return intersection, None return intersection, remainder def cleanupBox(box):
64
64
111
5
58
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
cleanupBox
cleanupBox
240
251
240
240
a12e3d433affb3a04625f6e639f0a1f5d430b61e
bigcode/the-stack
train
8dc83f62ea90f43f1098de3a
train
function
def buildFeatureRecord(featureTag, lookupListIndices): """Build a FeatureRecord.""" fr = ot.FeatureRecord() fr.FeatureTag = featureTag fr.Feature = ot.Feature() fr.Feature.LookupListIndex = lookupListIndices return fr
def buildFeatureRecord(featureTag, lookupListIndices):
"""Build a FeatureRecord.""" fr = ot.FeatureRecord() fr.FeatureTag = featureTag fr.Feature = ot.Feature() fr.Feature.LookupListIndex = lookupListIndices return fr
def buildFeatureVariations(featureVariationRecords): """Build the FeatureVariations subtable.""" fv = ot.FeatureVariations() fv.Version = 0x00010000 fv.FeatureVariationRecord = featureVariationRecords return fv def buildFeatureRecord(featureTag, lookupListIndices):
64
64
55
11
52
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
buildFeatureRecord
buildFeatureRecord
394
400
394
394
e8e0f50c0c3c8fd584b1aacc0b8293fd939fa40e
bigcode/the-stack
train
00c0565b7a188a0d777d0c32
train
function
def _remapLangSys(langSys, featureRemap): if langSys.ReqFeatureIndex != 0xffff: langSys.ReqFeatureIndex = featureRemap[langSys.ReqFeatureIndex] langSys.FeatureIndex = [featureRemap[index] for index in langSys.FeatureIndex]
def _remapLangSys(langSys, featureRemap):
if langSys.ReqFeatureIndex != 0xffff: langSys.ReqFeatureIndex = featureRemap[langSys.ReqFeatureIndex] langSys.FeatureIndex = [featureRemap[index] for index in langSys.FeatureIndex]
Variations is not None: for fvr in table.FeatureVariations.FeatureVariationRecord: for ftsr in fvr.FeatureTableSubstitution.SubstitutionRecord: ftsr.FeatureIndex = featureRemap[ftsr.FeatureIndex] def _remapLangSys(langSys, featureRemap):
64
64
65
13
51
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
_remapLangSys
_remapLangSys
463
466
463
463
290986003d4600529561d4fc55f689b8ca0e8562
bigcode/the-stack
train
09816ec3f18c5781405a80ca
train
function
def remapFeatures(table, featureRemap): """Go through the scripts list, and remap feature indices.""" for scriptIndex, script in enumerate(table.ScriptList.ScriptRecord): defaultLangSys = script.Script.DefaultLangSys if defaultLangSys is not None: _remapLangSys(defaultLangSys, featur...
def remapFeatures(table, featureRemap):
"""Go through the scripts list, and remap feature indices.""" for scriptIndex, script in enumerate(table.ScriptList.ScriptRecord): defaultLangSys = script.Script.DefaultLangSys if defaultLangSys is not None: _remapLangSys(defaultLangSys, featureRemap) for langSysRecordIndex, ...
a in tagIndexFea] featureRemap = dict(zip([index for tag, index, fea in tagIndexFea], range(len(tagIndexFea)))) # Remap the feature indices remapFeatures(table, featureRemap) def remapFeatures(table, featureRemap):
64
64
179
10
54
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
remapFeatures
remapFeatures
447
460
447
447
a6058d860843d286e8188a5ccb5d4ab587cc4fb8
bigcode/the-stack
train
0abb596200a492f9adbf7914
train
function
def makeSubstitutionsHashable(conditionalSubstitutions): """Turn all the substitution dictionaries in sorted tuples of tuples so they are hashable, to detect duplicates so we don't write out redundant data.""" allSubstitutions = set() condSubst = [] for conditionSet, substitutionMaps in conditio...
def makeSubstitutionsHashable(conditionalSubstitutions):
"""Turn all the substitution dictionaries in sorted tuples of tuples so they are hashable, to detect duplicates so we don't write out redundant data.""" allSubstitutions = set() condSubst = [] for conditionSet, substitutionMaps in conditionalSubstitutions: substitutions = [] for ...
langrec.LangSys.FeatureIndex = [0] srec.Script.DefaultLangSys = langrec.LangSys gsub.ScriptList.ScriptRecord.append(srec) gsub.FeatureVariations = None return fontTable def makeSubstitutionsHashable(conditionalSubstitutions):
64
64
133
13
50
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
makeSubstitutionsHashable
makeSubstitutionsHashable
354
367
354
354
87115b36c85787b9518c17830d5c4817a311e139
bigcode/the-stack
train
2cff6c0f6afb2ba8f8fae9cd
train
function
def addFeatureVariationsRaw(font, conditionalSubstitutions): """Low level implementation of addFeatureVariations that directly models the possibilities of the FeatureVariations table.""" # # assert there is no 'rvrn' feature # make dummy 'rvrn' feature with no lookups # sort features, get 'rvrn...
def addFeatureVariationsRaw(font, conditionalSubstitutions):
"""Low level implementation of addFeatureVariations that directly models the possibilities of the FeatureVariations table.""" # # assert there is no 'rvrn' feature # make dummy 'rvrn' feature with no lookups # sort features, get 'rvrn' feature index # add 'rvrn' feature to all scripts #...
if fullyInside: # bot is fully within intersection. Remainder is empty. return intersection, None return intersection, remainder def cleanupBox(box): """Return a sparse copy of `box`, without redundant (default) values. >>> cleanupBox({}) {} >>> cleanupBox({'wdt...
165
165
553
13
152
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
addFeatureVariationsRaw
addFeatureVariationsRaw
258
316
258
258
2a0229c4010ee2b24196a33cbdb9e443124d007f
bigcode/the-stack
train
4e480d807c52d765b542205d
train
function
def buildSubstitutionLookups(gsub, allSubstitutions): """Build the lookups for the glyph substitutions, return a dict mapping the substitution to lookup indices.""" firstIndex = len(gsub.LookupList.Lookup) lookupMap = {} for i, substitutionMap in enumerate(allSubstitutions): lookupMap[substi...
def buildSubstitutionLookups(gsub, allSubstitutions):
"""Build the lookups for the glyph substitutions, return a dict mapping the substitution to lookup indices.""" firstIndex = len(gsub.LookupList.Lookup) lookupMap = {} for i, substitutionMap in enumerate(allSubstitutions): lookupMap[substitutionMap] = i + firstIndex for subst in allSubst...
Maps: subst = tuple(sorted(substitutionMap.items())) substitutions.append(subst) allSubstitutions.add(subst) condSubst.append((conditionSet, substitutions)) return condSubst, sorted(allSubstitutions) def buildSubstitutionLookups(gsub, allSubstitutions):
64
64
143
14
50
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
buildSubstitutionLookups
buildSubstitutionLookups
370
383
370
370
4b2a0233b004e0e2f0b8819dc020433bb4ccda86
bigcode/the-stack
train
438613f66d970abcec2f7306
train
function
def buildGSUB(): """Build a GSUB table from scratch.""" fontTable = newTable("GSUB") gsub = fontTable.table = ot.GSUB() gsub.Version = 0x00010001 # allow gsub.FeatureVariations gsub.ScriptList = ot.ScriptList() gsub.ScriptList.ScriptRecord = [] gsub.FeatureList = ot.FeatureList() gsub....
def buildGSUB():
"""Build a GSUB table from scratch.""" fontTable = newTable("GSUB") gsub = fontTable.table = ot.GSUB() gsub.Version = 0x00010001 # allow gsub.FeatureVariations gsub.ScriptList = ot.ScriptList() gsub.ScriptList.ScriptRecord = [] gsub.FeatureList = ot.FeatureList() gsub.FeatureList.Featu...
[subst] for subst in substitutions] record = buildFeatureTableSubstitutionRecord(rvrnFeatureIndex, lookupIndices) featureVariationRecords.append(buildFeatureVariationRecord(conditionTable, [record])) gsub.FeatureVariations = buildFeatureVariations(featureVariationRecords) # # Building GSUB/Featur...
74
74
248
5
69
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
buildGSUB
buildGSUB
323
351
323
323
716260c51d7afdab568a826b48f8099de903f447
bigcode/the-stack
train
f1e7a3a660c84d4c477b5687
train
function
def buildFeatureVariations(featureVariationRecords): """Build the FeatureVariations subtable.""" fv = ot.FeatureVariations() fv.Version = 0x00010000 fv.FeatureVariationRecord = featureVariationRecords return fv
def buildFeatureVariations(featureVariationRecords):
"""Build the FeatureVariations subtable.""" fv = ot.FeatureVariations() fv.Version = 0x00010000 fv.FeatureVariationRecord = featureVariationRecords return fv
substMap = dict(subst) lookup = buildLookup([buildSingleSubstSubtable(substMap)]) gsub.LookupList.Lookup.append(lookup) assert gsub.LookupList.Lookup[lookupMap[subst]] is lookup return lookupMap def buildFeatureVariations(featureVariationRecords):
64
64
52
9
54
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
buildFeatureVariations
buildFeatureVariations
386
391
386
386
41710af85f0e56d8aed6920af948fd1c8b6afd21
bigcode/the-stack
train
6b8156b83af8969fcfd08b7e
train
function
def buildFeatureVariationRecord(conditionTable, substitutionRecords): """Build a FeatureVariationRecord.""" fvr = ot.FeatureVariationRecord() fvr.ConditionSet = ot.ConditionSet() fvr.ConditionSet.ConditionTable = conditionTable fvr.FeatureTableSubstitution = ot.FeatureTableSubstitution() fvr.Fea...
def buildFeatureVariationRecord(conditionTable, substitutionRecords):
"""Build a FeatureVariationRecord.""" fvr = ot.FeatureVariationRecord() fvr.ConditionSet = ot.ConditionSet() fvr.ConditionSet.ConditionTable = conditionTable fvr.FeatureTableSubstitution = ot.FeatureTableSubstitution() fvr.FeatureTableSubstitution.Version = 0x00010000 fvr.FeatureTableSubstit...
FeatureRecord(featureTag, lookupListIndices): """Build a FeatureRecord.""" fr = ot.FeatureRecord() fr.FeatureTag = featureTag fr.Feature = ot.Feature() fr.Feature.LookupListIndex = lookupListIndices return fr def buildFeatureVariationRecord(conditionTable, substitutionRecords):
64
64
98
11
52
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
buildFeatureVariationRecord
buildFeatureVariationRecord
403
411
403
403
1aa6b92be8880a7835025e5aa3a46aa4c5716b27
bigcode/the-stack
train
595554d7604c667649b9605f
train
function
def sortFeatureList(table): """Sort the feature list by feature tag, and remap the feature indices elsewhere. This is needed after the feature list has been modified. """ # decorate, sort, undecorate, because we need to make an index remapping table tagIndexFea = [(fea.FeatureTag, index, fea) for in...
def sortFeatureList(table):
"""Sort the feature list by feature tag, and remap the feature indices elsewhere. This is needed after the feature list has been modified. """ # decorate, sort, undecorate, because we need to make an index remapping table tagIndexFea = [(fea.FeatureTag, index, fea) for index, fea in enumerate(table....
): """Build a ConditionTable.""" ct = ot.ConditionTable() ct.Format = 1 ct.AxisIndex = axisIndex ct.FilterRangeMinValue = filterRangeMinValue ct.FilterRangeMaxValue = filterRangeMaxValue return ct def sortFeatureList(table):
64
64
165
6
57
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
sortFeatureList
sortFeatureList
433
444
433
433
eb86e35829f844b0acb16b806c93a23d924e8cc9
bigcode/the-stack
train
39b41d7a2ab6aa5af5365b83
train
function
def overlayBox(top, bot): """Overlays `top` box on top of `bot` box. Returns two items: - Box for intersection of `top` and `bot`, or None if they don't intersect. - Box for remainder of `bot`. Remainder box might not be exact (since the remainder might not be a simple box), but is inclusive of ...
def overlayBox(top, bot):
"""Overlays `top` box on top of `bot` box. Returns two items: - Box for intersection of `top` and `bot`, or None if they don't intersect. - Box for remainder of `bot`. Remainder box might not be exact (since the remainder might not be a simple box), but is inclusive of the exact remainder....
[hashdict()] # Generate output items = [] for box,rank in sorted(boxMap.items(), key=(lambda BoxAndRank: -popCount(BoxAndRank[1]))): substsList = [] i = 0 while rank: if rank & 1: substsList.append(conditionalSubstitutions[i][1]) ...
187
187
626
7
180
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
overlayBox
overlayBox
162
238
162
162
f8f1d78b5a8657db1a1f7659056e21f070d94fee
bigcode/the-stack
train
97b9befc5a77f30999d6ea65
train
function
def buildConditionTable(axisIndex, filterRangeMinValue, filterRangeMaxValue): """Build a ConditionTable.""" ct = ot.ConditionTable() ct.Format = 1 ct.AxisIndex = axisIndex ct.FilterRangeMinValue = filterRangeMinValue ct.FilterRangeMaxValue = filterRangeMaxValue return ct
def buildConditionTable(axisIndex, filterRangeMinValue, filterRangeMaxValue):
"""Build a ConditionTable.""" ct = ot.ConditionTable() ct.Format = 1 ct.AxisIndex = axisIndex ct.FilterRangeMinValue = filterRangeMinValue ct.FilterRangeMaxValue = filterRangeMaxValue return ct
r = ot.FeatureTableSubstitutionRecord() ftsr.FeatureIndex = featureIndex ftsr.Feature = ot.Feature() ftsr.Feature.LookupListIndex = lookupListIndices return ftsr def buildConditionTable(axisIndex, filterRangeMinValue, filterRangeMaxValue):
64
64
74
17
46
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
buildConditionTable
buildConditionTable
423
430
423
423
cf797bc444564d380e1e082008bf08792a58a2d1
bigcode/the-stack
train
f593835cb5ce844e1829bedc
train
function
def overlayFeatureVariations(conditionalSubstitutions): """Compute overlaps between all conditional substitutions. The `conditionalSubstitutions` argument is a list of (Region, Substitutions) tuples. A Region is a list of Boxes. A Box is a dict mapping axisTags to (minValue, maxValue) tuples. Irre...
def overlayFeatureVariations(conditionalSubstitutions):
"""Compute overlaps between all conditional substitutions. The `conditionalSubstitutions` argument is a list of (Region, Substitutions) tuples. A Region is a list of Boxes. A Box is a dict mapping axisTags to (minValue, maxValue) tuples. Irrelevant axes may be omitted and they are interpretted...
. A Box represents an orthogonal 'rectangular' subset of an N-dimensional design space. A Region represents a more complex subset of an N-dimensional design space, ie. the union of all the Boxes in the Region. For efficiency, Boxes within a Region should ideally not overlap, but functionality is no...
256
256
1,051
11
245
VivaRado/fonttools
Lib/fontTools/varLib/featureVars.py
Python
overlayFeatureVariations
overlayFeatureVariations
50
150
50
50
191be6ffbe241355d2fb4c70fc80bd9ad87d5c90
bigcode/the-stack
train
9592839c8437961e16202c21
train
class
class _WorkerModel(object): def __init__(self): self.maskFileModel = ImageFilenameModel() self.darkFileModel = ImageFilenameModel() self.flatFileModel = ImageFilenameModel()
class _WorkerModel(object):
def __init__(self): self.maskFileModel = ImageFilenameModel() self.darkFileModel = ImageFilenameModel() self.flatFileModel = ImageFilenameModel()
import units from ...utils import stringutil from ..utils import FilterBuilder from ..model.ImageModel import ImageFilenameModel from ..utils import validators from ...io.ponifile import PoniFile from ...io import integration_config from ... import method_registry class _WorkerModel(object):
64
64
43
6
57
tacaswell/pyFAI
pyFAI/gui/widgets/WorkerConfigurator.py
Python
_WorkerModel
_WorkerModel
66
71
66
67
94918afae5997556d24acfee6ec0694c5ee75280
bigcode/the-stack
train
d89fe661c0c0f37c43eff8fc
train
class
class WorkerConfigurator(qt.QWidget): """Frame displaying integration configuration which can be used as input param of the ~`pyFAI.worker.Worker`. """ def __init__(self, parent=None): qt.QWidget.__init__(self, parent) filename = get_ui_file("worker-configurator.ui") qt.loadUi(f...
class WorkerConfigurator(qt.QWidget):
"""Frame displaying integration configuration which can be used as input param of the ~`pyFAI.worker.Worker`. """ def __init__(self, parent=None): qt.QWidget.__init__(self, parent) filename = get_ui_file("worker-configurator.ui") qt.loadUi(filename, self) self.__model =...
rotron Radiation Facility, Grenoble, France" __date__ = "08/03/2021" __status__ = "development" import logging import json import os.path import collections logger = logging.getLogger(__name__) from silx.gui import qt from ..dialog.DetectorSelectorDialog import DetectorSelectorDialog from ..dialog.OpenClDeviceDialo...
256
256
4,972
8
248
tacaswell/pyFAI
pyFAI/gui/widgets/WorkerConfigurator.py
Python
WorkerConfigurator
WorkerConfigurator
74
626
74
74
8f7bf19cfc62f323cac7c2031897895e573c0aba
bigcode/the-stack
train
18e04d40214ccadb8bf09480
train
function
def add_userdata(username,age,password): c.execute('INSERT INTO userstable(username,age,password) VALUES (?,?,?)',(username,age, password)) conn.commit()
def add_userdata(username,age,password):
c.execute('INSERT INTO userstable(username,age,password) VALUES (?,?,?)',(username,age, password)) conn.commit()
import numpy as np from random import shuffle from random import sample conn = sqlite3.connect("data.db") c= conn.cursor() def create_usertable(): c.execute('CREATE TABLE IF NOT EXISTS userstable(username TEXT, age TEXT, password TEXT)') def add_userdata(username,age,password):
63
64
37
8
56
urbanist-ai/URBANi_turing_game
app.py
Python
add_userdata
add_userdata
30
32
30
30
379f77c608316d23274d049a17ef6bf81c0c66b5
bigcode/the-stack
train
99c4643ae11080516afa733d
train
function
def login_user(username,age,password): c.execute('SELECT * FROM userstable WHERE username =? AND age =? AND password =?',(username,age, password)) data = c.fetchall() return data
def login_user(username,age,password):
c.execute('SELECT * FROM userstable WHERE username =? AND age =? AND password =?',(username,age, password)) data = c.fetchall() return data
('CREATE TABLE IF NOT EXISTS userstable(username TEXT, age TEXT, password TEXT)') def add_userdata(username,age,password): c.execute('INSERT INTO userstable(username,age,password) VALUES (?,?,?)',(username,age, password)) conn.commit() def login_user(username,age,password):
63
64
47
8
55
urbanist-ai/URBANi_turing_game
app.py
Python
login_user
login_user
35
38
35
35
1f58f99ffe3e5910993aa92ee4df3c5338c3c231
bigcode/the-stack
train
30b47eab4d4776e9491ddc64
train
function
def create_usertable(): c.execute('CREATE TABLE IF NOT EXISTS userstable(username TEXT, age TEXT, password TEXT)')
def create_usertable():
c.execute('CREATE TABLE IF NOT EXISTS userstable(username TEXT, age TEXT, password TEXT)')
3 import pandas as pd import time, os, re import streamlit as st import streamlit.components.v1 as components import numpy as np from random import shuffle from random import sample conn = sqlite3.connect("data.db") c= conn.cursor() def create_usertable():
64
64
27
6
58
urbanist-ai/URBANi_turing_game
app.py
Python
create_usertable
create_usertable
27
28
27
27
4164439a4b21e0db03cc9a953d45f36bb0593e41
bigcode/the-stack
train
b8f124a0fa8233d269e917ad
train
function
def main(): images_list = [] for i in os.listdir("images"): images_list.append(i) session = SessionState.get(state = 0, run_id=0,reward = 0, button=0) file_name = "style_home.css" def local_css(file_name): with open(fil...
def main():
images_list = [] for i in os.listdir("images"): images_list.append(i) session = SessionState.get(state = 0, run_id=0,reward = 0, button=0) file_name = "style_home.css" def local_css(file_name): with open(file_name) as f: ...
Mar 28 22:55:18 2021 @author: Ibrahim """ import streamlit as st import SessionState # Assuming SessionState.py lives on this folder import base64 import sqlite3 from PIL import Image import time import sqlite3 import pandas as pd import time, os, re import streamlit as st import streamlit.components...
255
256
1,941
4
250
urbanist-ai/URBANi_turing_game
app.py
Python
main
main
51
282
51
52
2855daddcd4cbea1590600264098b4378fb6d8ee
bigcode/the-stack
train
deb1cc60499d794ec2e11fd8
train
function
def view_all_users(): c.execute('SELECT * FROM userstable') data = c.fetchall() return data
def view_all_users():
c.execute('SELECT * FROM userstable') data = c.fetchall() return data
username,age, password)) conn.commit() def login_user(username,age,password): c.execute('SELECT * FROM userstable WHERE username =? AND age =? AND password =?',(username,age, password)) data = c.fetchall() return data def view_all_users():
64
64
25
5
58
urbanist-ai/URBANi_turing_game
app.py
Python
view_all_users
view_all_users
41
44
41
41
71e18c92113707b3357b95e787058cc913074121
bigcode/the-stack
train
006c3853b89fd02132f57b02
train
class
class CollectSceneVersion(pyblish.api.ContextPlugin): """Finds version in the filename or passes the one found in the context Arguments: version (int, optional): version number of the publish """ order = pyblish.api.CollectorOrder label = 'Collect Version' def process(self, context...
class CollectSceneVersion(pyblish.api.ContextPlugin):
"""Finds version in the filename or passes the one found in the context Arguments: version (int, optional): version number of the publish """ order = pyblish.api.CollectorOrder label = 'Collect Version' def process(self, context): if "standalonepublisher" in context.data.ge...
import os import pyblish.api import pype.api as pype class CollectSceneVersion(pyblish.api.ContextPlugin):
28
64
214
11
16
simonebarbieri/pype
pype/plugins/publish/collect_scene_version.py
Python
CollectSceneVersion
CollectSceneVersion
6
34
6
6
3d19e3e4720084ac88c63e6678847349101adb79
bigcode/the-stack
train
a546bea1cf2f776539fe1409
train
function
def main(): parser = argparse.ArgumentParser() parser.add_argument('--segment', '-S', type=hexint, help='Segment number of PCIe device') parser.add_argument('--bus', '-B', type=hexint, help='Bus number of PCIe device') parser.add_argument('--device', '-D...
def main():
parser = argparse.ArgumentParser() parser.add_argument('--segment', '-S', type=hexint, help='Segment number of PCIe device') parser.add_argument('--bus', '-B', type=hexint, help='Bus number of PCIe device') parser.add_argument('--device', '-D', type=hex...
_quit('unsupport speed mode {}'.format(self.speed)) eth_group_inst.eth_group_close() def eth_group_phy_reg_set_field(self, eth_group, phy, reg, idx, width, value): self.eth_group_reg_set_field(eth_group, 'phy', phy, reg, i...
185
185
617
3
182
rchriste1/opae-sdk
tools/extra/fpgadiag/fpgalpbk.py
Python
main
main
230
299
230
230
e876cd23ca163e440b962f7e430e93abb34d6387
bigcode/the-stack
train
54aedc523df71d1a19f9e1c5
train
class
class FPGALPBK(COMMON): ports = [] phy_number = 0 phy_group_dev = '' speed = 10 def __init__(self, args): self.en = args.en self.side = args.side self.type = args.type self.direction = args.direction self.argport = args.port self.eth_grps = args.eth_g...
class FPGALPBK(COMMON):
ports = [] phy_number = 0 phy_group_dev = '' speed = 10 def __init__(self, args): self.en = args.en self.side = args.side self.type = args.type self.direction = args.direction self.argport = args.port self.eth_grps = args.eth_grps def check_args(...
TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT O...
256
256
1,850
9
246
rchriste1/opae-sdk
tools/extra/fpgadiag/fpgalpbk.py
Python
FPGALPBK
FPGALPBK
42
227
42
42
95ad13e46063584b5442c36e9e078560988e0955
bigcode/the-stack
train
d5433337833cd15bead4791c
train
function
def convert_shares(server_id, ): pass
def convert_shares(server_id, ):
pass
:param y: :type y: str :param cy: :return: """ return pow(int(h2, 16), int(y, 16)) * pow(int(h1, 16), -int(cy, 16)) def convert_shares(server_id, ):
64
64
11
8
56
adiachwal122/he-encription
he_encryption/algorithms.py
Python
convert_shares
convert_shares
69
70
69
69
c9ca0131fb31c777aee0772cdd897ef3befee7e0
bigcode/the-stack
train
db66157654a3e9a82a3d61b4
train
function
def additive_secret_shares(c): """ :param c: string, an encryption message. :return: a r and c-r as {r: c-t}. :rtype: tuple """ import random r = random.getrandbits(512) return int(r, 16), hex(int(c, 16) - int(r, 16))
def additive_secret_shares(c):
""" :param c: string, an encryption message. :return: a r and c-r as {r: c-t}. :rtype: tuple """ import random r = random.getrandbits(512) return int(r, 16), hex(int(c, 16) - int(r, 16))
def prf(data: str): """"hash the data """ hash_num = hashlib.sha512() hash_num.update(bytes(data.encode("utf-8"))) return int(hash_num.hexdigest()[:lamda], 16) return prf def additive_secret_shares(c):
64
64
80
7
56
adiachwal122/he-encription
he_encryption/algorithms.py
Python
additive_secret_shares
additive_secret_shares
42
51
42
42
b9ce8af92b9612ae27eec5c3b34e000e33193bde
bigcode/the-stack
train
68dc717bd3dc1ae84876e302
train
function
def generate_prf(lamda): """generate PRF. :param lamda: a length of the key. :return: a PRF list. :rtype: list of dictionary. """ import hashlib def prf(data: str): """"hash the data """ hash_num = hashlib.sha512() hash_num.update(bytes(data.encode("utf-8"))...
def generate_prf(lamda):
"""generate PRF. :param lamda: a length of the key. :return: a PRF list. :rtype: list of dictionary. """ import hashlib def prf(data: str): """"hash the data """ hash_num = hashlib.sha512() hash_num.update(bytes(data.encode("utf-8"))) return int(hash...
/ delta)) / delta # hash_len = log(2 * m / delta) while int(bin(fi(data=str(h_tag))), 2) != 0 and i < t: h_tag *= g i += 1 return i def generate_prf(lamda):
64
64
106
8
55
adiachwal122/he-encription
he_encryption/algorithms.py
Python
generate_prf
generate_prf
23
39
23
23
a8c0e541ec1f35d5c5d4b35f0b1b454c32b33ff8
bigcode/the-stack
train
f87dee0ee9431ec5386922fd
train
function
def distributed_dlog(h, delta, m, g, fi): """converts a multiplicative secret sharing of g^x to an additive secret sharing of the value x, with inverse polynomial probability of error. :param g: g from ElGamal. :param h: g^t, t is modulo q. :param delta: failure probability. :param m: a polynom...
def distributed_dlog(h, delta, m, g, fi):
"""converts a multiplicative secret sharing of g^x to an additive secret sharing of the value x, with inverse polynomial probability of error. :param g: g from ElGamal. :param h: g^t, t is modulo q. :param delta: failure probability. :param m: a polynomial number smaller then q. :param fi: ...
def distributed_dlog(h, delta, m, g, fi):
14
64
191
14
0
adiachwal122/he-encription
he_encryption/algorithms.py
Python
distributed_dlog
distributed_dlog
1
20
1
1
9a142d4920dcaebd14f0f3b75dd2b06ac0b8d42e
bigcode/the-stack
train
f96b7422a4f287dfdae76fb0
train
function
def multi_shares(h1, h2, y, cy): """ :param h1: :type h1: str :param h2: :type h2: str :param y: :type y: str :param cy: :return: """ return pow(int(h2, 16), int(y, 16)) * pow(int(h1, 16), -int(cy, 16))
def multi_shares(h1, h2, y, cy):
""" :param h1: :type h1: str :param h2: :type h2: str :param y: :type y: str :param cy: :return: """ return pow(int(h2, 16), int(y, 16)) * pow(int(h1, 16), -int(cy, 16))
{r: c-t}. :rtype: tuple """ import random r = random.getrandbits(512) return int(r, 16), hex(int(c, 16) - int(r, 16)) def multi_shares(h1, h2, y, cy):
64
64
100
14
50
adiachwal122/he-encription
he_encryption/algorithms.py
Python
multi_shares
multi_shares
54
66
54
54
f7ad8dc833119a4b452e36081e6c3e03c001afb3
bigcode/the-stack
train
eca515560b45478cf7f9992e
train
function
def diminuir(valor, porcent): novo_valor = valor - (porcent * valor / 100) return novo_valor
def diminuir(valor, porcent):
novo_valor = valor - (porcent * valor / 100) return novo_valor
/ 2 return novo_valor def dobro(valor): novo_valor = valor * 2 return novo_valor def aumentar(valor, porcent): novo_valor = valor + (porcent * valor / 100) return novo_valor def diminuir(valor, porcent):
64
64
28
6
57
Ramon-Erik/Exercicios-Python
tudo/ex107/moeda.py
Python
diminuir
diminuir
16
18
16
16
9074190884e9d45ce37602ce3376e04dd9b16771
bigcode/the-stack
train
3c242d247ac60430eb8f5e1b
train
function
def dobro(valor): novo_valor = valor * 2 return novo_valor
def dobro(valor):
novo_valor = valor * 2 return novo_valor
def metade(valor): novo_valor = valor / 2 return novo_valor def dobro(valor):
24
64
20
4
19
Ramon-Erik/Exercicios-Python
tudo/ex107/moeda.py
Python
dobro
dobro
6
8
6
6
bb07388d5bd0b80c1ff0e119420010a5cd354aae
bigcode/the-stack
train
637704f0d47ba466435ec827
train
function
def metade(valor): novo_valor = valor / 2 return novo_valor
def metade(valor):
novo_valor = valor / 2 return novo_valor
def metade(valor):
4
64
20
4
0
Ramon-Erik/Exercicios-Python
tudo/ex107/moeda.py
Python
metade
metade
1
3
1
1
49c47ef289c114adf65054aaf2c01fb3cbcf84ef
bigcode/the-stack
train
b990bdde134147335ff38739
train
function
def aumentar(valor, porcent): novo_valor = valor + (porcent * valor / 100) return novo_valor
def aumentar(valor, porcent):
novo_valor = valor + (porcent * valor / 100) return novo_valor
def metade(valor): novo_valor = valor / 2 return novo_valor def dobro(valor): novo_valor = valor * 2 return novo_valor def aumentar(valor, porcent):
46
64
28
6
39
Ramon-Erik/Exercicios-Python
tudo/ex107/moeda.py
Python
aumentar
aumentar
11
13
11
11
1af3dbae87459a9518b8a1750dfb2c973c391474
bigcode/the-stack
train
d366306268f3a7782f8b4652
train
class
class TestFitBatchCrossValidation(BotorchTestCase): def test_single_task_batch_cv(self, cuda=False): n = 10 for batch_shape in (torch.Size([]), torch.Size([2])): for num_outputs in (1, 2): for double in (False, True): tkwargs = { ...
class TestFitBatchCrossValidation(BotorchTestCase):
def test_single_task_batch_cv(self, cuda=False): n = 10 for batch_shape in (torch.Size([]), torch.Size([2])): for num_outputs in (1, 2): for double in (False, True): tkwargs = { "device": torch.device("cuda") if cuda else torch....
import math import warnings import torch from botorch.cross_validation import batch_cross_validation, gen_loo_cv_folds from botorch.exceptions.warnings import OptimizationWarning from botorch.models.gp_regression import FixedNoiseGP, SingleTaskGP from gpytorch.mlls.exact_marginal_log_likelihood import ExactMarginalLog...
251
251
837
12
238
jmren168/botorch
test/test_cross_validation.py
Python
TestFitBatchCrossValidation
TestFitBatchCrossValidation
30
122
30
30
5ab86eb170660edc9ffa0685c4fef4c88fe44c1b
bigcode/the-stack
train
1e982c568ffdf44cdbdee73e
train
function
def _get_random_data(batch_shape, num_outputs, n=10, **tkwargs): train_x = torch.linspace(0, 0.95, n, **tkwargs).unsqueeze(-1) + 0.05 * torch.rand( n, 1, **tkwargs ).repeat(batch_shape + torch.Size([1, 1])) train_y = torch.sin(train_x * (2 * math.pi)) + 0.2 * torch.randn( n, num_outputs, **t...
def _get_random_data(batch_shape, num_outputs, n=10, **tkwargs):
train_x = torch.linspace(0, 0.95, n, **tkwargs).unsqueeze(-1) + 0.05 * torch.rand( n, 1, **tkwargs ).repeat(batch_shape + torch.Size([1, 1])) train_y = torch.sin(train_x * (2 * math.pi)) + 0.2 * torch.randn( n, num_outputs, **tkwargs ).repeat(batch_shape + torch.Size([1, 1])) if num...
ression import FixedNoiseGP, SingleTaskGP from gpytorch.mlls.exact_marginal_log_likelihood import ExactMarginalLogLikelihood from .botorch_test_case import BotorchTestCase def _get_random_data(batch_shape, num_outputs, n=10, **tkwargs):
64
64
151
19
44
jmren168/botorch
test/test_cross_validation.py
Python
_get_random_data
_get_random_data
17
27
17
17
d9aff79f7103560943b4b01283224e5ae04e325a
bigcode/the-stack
train
74eb7f54dcfd85c9381165bb
train
function
def get_input_fn(mode, input_files, label_name, sequence_features, dense_sequence_feature, required_sequence_feature, batch_size, shuffle=True): """Creates an input function to an estimator. Args:...
def get_input_fn(mode, input_files, label_name, sequence_features, dense_sequence_feature, required_sequence_feature, batch_size, shuffle=True):
"""Creates an input function to an estimator. Args: mode: The execution mode, as defined in tf.estimator.ModeKeys. input_files: List of input files in TFRecord format containing tf.SequenceExamples. label_name: Name of the label present as context feature in the SequenceExamples. sequen...
[CONTEXT_KEY_PREFIX + label_name] = label for k, v in examples.items(): if k.startswith(CONTEXT_KEY_PREFIX): feature_map[k] = v else: feature_map[k] = _intersect_indices( v, examples[SEQUENCE_KEY_PREFIX + required_sp_tensor_name]) sequence_length = tf.reduce_sum( ...
179
179
597
36
142
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
get_input_fn
get_input_fn
283
353
283
290
5a83952ec8ad14299c4d8b0825f27985c4918605
bigcode/the-stack
train
5c46246c6995ad48b3d4d029
train
function
def _example_index_to_sparse_index(example_indices, batch_size): """Creates a 2D sparse index tensor from a list of 1D example indices. For example, this would do the transformation: [0, 0, 0, 1, 3, 3] -> [[0,0], [0,1], [0,2], [1,0], [3,0], [3,1]] The second column of the output tensor is the running count of...
def _example_index_to_sparse_index(example_indices, batch_size):
"""Creates a 2D sparse index tensor from a list of 1D example indices. For example, this would do the transformation: [0, 0, 0, 1, 3, 3] -> [[0,0], [0,1], [0,2], [1,0], [3,0], [3,1]] The second column of the output tensor is the running count of the occurrences of that example index. Args: example_in...
future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow.compat.v1 as tf from tensorflow.contrib import data as contrib_data CONTEXT_KEY_PREFIX = 'c-' SEQUENCE_KEY_PREFIX = 's-' def _example_index_to_sparse_index(example_indices, batch_size):
69
69
232
13
55
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
_example_index_to_sparse_index
_example_index_to_sparse_index
30
50
30
30
6ca2d30ef8d76e21014c9d01db593edf6be48756
bigcode/the-stack
train
cebd5f5a9f5574c1a46dbd2a
train
function
def _make_parsing_fn(mode, label_name, sequence_features, dense_sequence_feature): """Creates an input function to an estimator. Args: mode: The execution mode, as defined in tf.estimator.ModeKeys. label_name: Name of the label present as context feature in the SequenceExamples. ...
def _make_parsing_fn(mode, label_name, sequence_features, dense_sequence_feature):
"""Creates an input function to an estimator. Args: mode: The execution mode, as defined in tf.estimator.ModeKeys. label_name: Name of the label present as context feature in the SequenceExamples. sequence_features: List of sequence features (strings) that are valid keys in the tf.SequenceE...
( tf.to_int32(required_sp_tensor.indices[:, 0]), tf.to_int32(required_sp_tensor.dense_shape[0])) return tf.expand_dims( tf.sparse_to_dense( indices, tf.stack([required_sp_tensor.dense_shape[0], max_len]), values), axis=2) def _intersect_indices(sequence_feature, required_...
141
141
473
19
122
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
_make_parsing_fn
_make_parsing_fn
158
216
158
159
621fe4ef069ca7c3d71eed6af6d13b61d4fbcbcd
bigcode/the-stack
train
f904ab0e1960bc5162a7c87b
train
function
def _extend_with_dummy(extend_with, to_extend, dummy_value='n/a'): """Extends one SparseTensor with dummy_values at positions of other.""" dense_shape = tf.to_int64( tf.concat([[tf.shape(extend_with)[0]], [tf.maximum(tf.shape(extend_with)[1], tf.shape(to_extend)[1...
def _extend_with_dummy(extend_with, to_extend, dummy_value='n/a'):
"""Extends one SparseTensor with dummy_values at positions of other.""" dense_shape = tf.to_int64( tf.concat([[tf.shape(extend_with)[0]], [tf.maximum(tf.shape(extend_with)[1], tf.shape(to_extend)[1])], [tf.maximum(tf.shape(extend_with)[2], ...
tf.to_int32(sp_tensor.indices[:, 0]), batch_size) indices = tf.concat([indices, tf.zeros_like(indices[:, 0:1])], axis=1) return tf.SparseTensor( indices=indices, values=sp_tensor.values, dense_shape=[batch_size, max_len, 1]) def _extend_with_dummy(extend_with, to_extend, dummy_value='n/a'):
88
88
296
18
70
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
_extend_with_dummy
_extend_with_dummy
75
104
75
75
17a03285d6e9b3aaccc9a2294e84f5111a027d1d
bigcode/the-stack
train
b76dfcded39eacbf8e3176ed
train
function
def _remove_empty_timesteps(sp_tensor): """Creates a 3D SparseTensor skipping empty time steps. Args: sp_tensor: A SparseTensor with at least 2 dimensions (subsequent ones will be ignored and simply flattened into the 2nd dimension). Returns: A 3D SparseTensor with index 0 for dimension 3 and a se...
def _remove_empty_timesteps(sp_tensor):
"""Creates a 3D SparseTensor skipping empty time steps. Args: sp_tensor: A SparseTensor with at least 2 dimensions (subsequent ones will be ignored and simply flattened into the 2nd dimension). Returns: A 3D SparseTensor with index 0 for dimension 3 and a series from [0,..k] for dimension 1 fo...
length of a row in this tensor. """ binned_counts = tf.bincount(example_indices, minlength=batch_size) max_len = tf.to_int64(tf.reduce_max(binned_counts)) return tf.where(tf.sequence_mask(binned_counts)), max_len def _remove_empty_timesteps(sp_tensor):
64
64
197
9
54
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
_remove_empty_timesteps
_remove_empty_timesteps
53
72
53
53
904d80cff1156c778b264f35feb5ec2c79a63a81
bigcode/the-stack
train
c673c8d4d99ede236c66d0fb
train
function
def _intersect_indices(sequence_feature, required_sp_tensor): if isinstance(sequence_feature, tf.SparseTensor): return _sparse_intersect_indices(sequence_feature, required_sp_tensor) else: return _dense_intersect_indices(sequence_feature, required_sp_tensor)
def _intersect_indices(sequence_feature, required_sp_tensor):
if isinstance(sequence_feature, tf.SparseTensor): return _sparse_intersect_indices(sequence_feature, required_sp_tensor) else: return _dense_intersect_indices(sequence_feature, required_sp_tensor)
tf.to_int32(required_sp_tensor.dense_shape[0])) return tf.expand_dims( tf.sparse_to_dense( indices, tf.stack([required_sp_tensor.dense_shape[0], max_len]), values), axis=2) def _intersect_indices(sequence_feature, required_sp_tensor):
64
64
55
12
52
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
_intersect_indices
_intersect_indices
151
155
151
151
09b8585a73b1bd785c3aac025b3a3a3c016a965e
bigcode/the-stack
train
56cc2800737ea527cf7595b6
train
function
def _make_feature_engineering_fn(required_sp_tensor_name, label_name): """Creates an input function to an estimator. Args: required_sp_tensor_name: Name of the SparseTensor that is required. Other sequence features will be reduced to times at which this SparseTensor is also present. label_name:...
def _make_feature_engineering_fn(required_sp_tensor_name, label_name):
"""Creates an input function to an estimator. Args: required_sp_tensor_name: Name of the SparseTensor that is required. Other sequence features will be reduced to times at which this SparseTensor is also present. label_name: Name of label. Returns: Two dictionaries with the parsing confi...
faster than _parse_fn_old. Args: serialized_examples: A batch of serialized tf.SequenceExamples. Returns: A dictionary from name to (Sparse)Tensors of the context and sequence features. """ context, sequence, _ = tf.io.parse_sequence_example( serialized_examples, cont...
164
164
549
15
148
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
_make_feature_engineering_fn
_make_feature_engineering_fn
219
280
219
219
d231838ea43af8ae4ed028c92c57f10e078d8e95
bigcode/the-stack
train
de80ee19e7fffcfc139559da
train
function
def _sparse_intersect_indices(sp_tensor, required_sp_tensor): """Filters timestamps in sp_tensor to those present in required_sp_tensor.""" # We extend both sp_tensor and required_sp_tensor with each others indices # so that they have the same indices. # E.g. their dense representation of one batch entry could ...
def _sparse_intersect_indices(sp_tensor, required_sp_tensor):
"""Filters timestamps in sp_tensor to those present in required_sp_tensor.""" # We extend both sp_tensor and required_sp_tensor with each others indices # so that they have the same indices. # E.g. their dense representation of one batch entry could be: # [dummy, dummy, 1 ] dummy_value = 'n/a' dummy_requi...
_indices)[0]]) string_value = ( tf.as_string(to_extend.values) if to_extend.values.dtype != tf.string else to_extend.values) return tf.sparse_reorder( tf.SparseTensor( indices=tf.concat([to_extend.indices, additional_indices], axis=0), values=tf.concat([string_value, default],...
96
96
323
14
82
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
_sparse_intersect_indices
_sparse_intersect_indices
107
135
107
107
ad32586374e9440c0eb5821fb3032083ba74b8f6
bigcode/the-stack
train
d98e4ca2c16bff61b5a4d30e
train
function
def _dense_intersect_indices(tensor, required_sp_tensor): required_2d_indices = required_sp_tensor.indices[:, 0:2] values = tf.gather_nd(tensor, required_2d_indices) indices, max_len = _example_index_to_sparse_index( tf.to_int32(required_sp_tensor.indices[:, 0]), tf.to_int32(required_sp_tensor.dense_s...
def _dense_intersect_indices(tensor, required_sp_tensor):
required_2d_indices = required_sp_tensor.indices[:, 0:2] values = tf.gather_nd(tensor, required_2d_indices) indices, max_len = _example_index_to_sparse_index( tf.to_int32(required_sp_tensor.indices[:, 0]), tf.to_int32(required_sp_tensor.dense_shape[0])) return tf.expand_dims( tf.sparse_to_dens...
.string: in_required = tf.SparseTensor( indices=in_required.indices, dense_shape=in_required.dense_shape, values=tf.strings.to_number( in_required.values, out_type=sp_tensor.values.dtype)) return in_required def _dense_intersect_indices(tensor, required_sp_tensor):
64
64
125
13
50
egonrian/google-research
explaining_risk_increase/input_fn.py
Python
_dense_intersect_indices
_dense_intersect_indices
138
148
138
138
5d5a1adaa702e4c173921e2f944d96bdc6d52ce7
bigcode/the-stack
train
178d897d17540e87e45b1805
train
function
def main(): trusted_cert_pems = (open('demo2_ca.crt.pem', 'rt').read(),) for fname in ( 'pdf-signed-cms.pdf', 'pdf-signed-fpdf.pdf', 'test-PDFXRef-signed-cms.pdf', 'test-PDFXRefStream-signed-cms.pdf' ): print('*' * 20, fname) try: d...
def main():
trusted_cert_pems = (open('demo2_ca.crt.pem', 'rt').read(),) for fname in ( 'pdf-signed-cms.pdf', 'pdf-signed-fpdf.pdf', 'test-PDFXRef-signed-cms.pdf', 'test-PDFXRefStream-signed-cms.pdf' ): print('*' * 20, fname) try: data = open(f...
# *-* coding: utf-8 *-* from endesive import pdf def main():
21
64
155
3
17
spitoglou/endesive
examples/pdf-verify.py
Python
main
main
5
21
5
5
60be3fb1bba70b951992cd27b4592e44c716be10
bigcode/the-stack
train
43a08b1b0e1aa8fc418c95d4
train
class
class HTTPPaymentRequired(HTTPClientError): status_code = 402
class HTTPPaymentRequired(HTTPClientError):
status_code = 402
############################################################ # 4xx client error ############################################################ class HTTPClientError(HTTPError): pass class HTTPBadRequest(HTTPClientError): status_code = 400 class HTTPUnauthorized(HTTPClientError): status_code = 401 class ...
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPPaymentRequired
HTTPPaymentRequired
218
219
218
218
70440faef3cdab767500895310dd4b0889e5ff57
bigcode/the-stack
train
0a97df597922d5f9f87f4cf1
train
class
class HTTPFound(_HTTPMove): status_code = 302
class HTTPFound(_HTTPMove):
status_code = 302
text=text, content_type=content_type) self.headers['Location'] = str(location) self.location = location class HTTPMultipleChoices(_HTTPMove): status_code = 300 class HTTPMovedPermanently(_HTTPMove): status_code = 301 class HTTPFound(_HTTPMove):
64
64
14
7
56
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPFound
HTTPFound
172
173
172
172
b0079f46692d5854ee40f1d7fa1f6891b22bbd7a
bigcode/the-stack
train
7cad7332c1e1e6be2d79686b
train
class
class HTTPGatewayTimeout(HTTPServerError): status_code = 504
class HTTPGatewayTimeout(HTTPServerError):
status_code = 504
status_code = 500 class HTTPNotImplemented(HTTPServerError): status_code = 501 class HTTPBadGateway(HTTPServerError): status_code = 502 class HTTPServiceUnavailable(HTTPServerError): status_code = 503 class HTTPGatewayTimeout(HTTPServerError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPGatewayTimeout
HTTPGatewayTimeout
386
387
386
386
fb4036b3e1e7a827c88fc478f776c2dfe8fa6304
bigcode/the-stack
train
efa3da7269483190660225d1
train
class
class HTTPRequestRangeNotSatisfiable(HTTPClientError): status_code = 416
class HTTPRequestRangeNotSatisfiable(HTTPClientError):
status_code = 416
(max_size, actual_size) ) super().__init__(**kwargs) class HTTPRequestURITooLong(HTTPClientError): status_code = 414 class HTTPUnsupportedMediaType(HTTPClientError): status_code = 415 class HTTPRequestRangeNotSatisfiable(HTTPClientError):
64
64
20
13
50
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPRequestRangeNotSatisfiable
HTTPRequestRangeNotSatisfiable
301
302
301
301
09e8a53da4c9eb65b1356df4ef6bc0d3ae09e009
bigcode/the-stack
train
a13f9f76c359b73131f621b6
train
class
class HTTPUnprocessableEntity(HTTPClientError): status_code = 422
class HTTPUnprocessableEntity(HTTPClientError):
status_code = 422
class HTTPRequestRangeNotSatisfiable(HTTPClientError): status_code = 416 class HTTPExpectationFailed(HTTPClientError): status_code = 417 class HTTPMisdirectedRequest(HTTPClientError): status_code = 421 class HTTPUnprocessableEntity(HTTPClientError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPUnprocessableEntity
HTTPUnprocessableEntity
313
314
313
313
db6a3f3d74cd9dbb410c03c8b5507214cf96b5f1
bigcode/the-stack
train
54b7ba59cf1a47d8c14b96cb
train
class
class HTTPException(Response, Exception): # You should set in subclasses: # status = 200 status_code = -1 empty_body = False __http_exception__ = True def __init__(self, *, headers: Optional[LooseHeaders]=None, reason: Optional[str]=None, bo...
class HTTPException(Response, Exception): # You should set in subclasses: # status = 200
status_code = -1 empty_body = False __http_exception__ = True def __init__(self, *, headers: Optional[LooseHeaders]=None, reason: Optional[str]=None, body: Any=None, text: Optional[str]=None, content_type: Optional[st...
NotSupported', 'HTTPVariantAlsoNegotiates', 'HTTPInsufficientStorage', 'HTTPNotExtended', 'HTTPNetworkAuthenticationRequired', ) ############################################################ # HTTP Exceptions ############################################################ class HTTPException(Response, Exc...
64
64
179
22
41
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPException
HTTPException
72
96
72
76
28b6b44cb287995653c2e68eae4b79d5d53c962f
bigcode/the-stack
train
8c9819b57537326e4832d816
train
class
class HTTPProxyAuthenticationRequired(HTTPClientError): status_code = 407
class HTTPProxyAuthenticationRequired(HTTPClientError):
status_code = 407
=content_type) self.headers['Allow'] = allow self.allowed_methods = set(allowed_methods) # type: Set[str] self.method = method.upper() class HTTPNotAcceptable(HTTPClientError): status_code = 406 class HTTPProxyAuthenticationRequired(HTTPClientError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPProxyAuthenticationRequired
HTTPProxyAuthenticationRequired
254
255
254
254
131700786d364acb8d487128f97381ece397b989
bigcode/the-stack
train
c28efa8f434a21d10f615663
train
class
class HTTPConflict(HTTPClientError): status_code = 409
class HTTPConflict(HTTPClientError):
status_code = 409
self.method = method.upper() class HTTPNotAcceptable(HTTPClientError): status_code = 406 class HTTPProxyAuthenticationRequired(HTTPClientError): status_code = 407 class HTTPRequestTimeout(HTTPClientError): status_code = 408 class HTTPConflict(HTTPClientError):
64
64
15
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPConflict
HTTPConflict
262
263
262
262
5b3b947a2b7f571e3b3b33155d0509ed2c073977
bigcode/the-stack
train
b457c29fac5c801f36af943f
train
class
class HTTPAccepted(HTTPSuccessful): status_code = 202
class HTTPAccepted(HTTPSuccessful):
status_code = 202
HTTPSuccessful(HTTPException): """Base class for exceptions with status codes in the 200s.""" class HTTPOk(HTTPSuccessful): status_code = 200 class HTTPCreated(HTTPSuccessful): status_code = 201 class HTTPAccepted(HTTPSuccessful):
64
64
15
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPAccepted
HTTPAccepted
119
120
119
119
5b9f1048d7dda404d57f994d1372c6b019198512
bigcode/the-stack
train
d689e4fb2d6f9c01ae5909f2
train
class
class HTTPRedirection(HTTPException): """Base class for exceptions with status codes in the 300s."""
class HTTPRedirection(HTTPException):
"""Base class for exceptions with status codes in the 300s."""
: self.text = "{}: {}".format(self.status, self.reason) def __bool__(self) -> bool: return True class HTTPError(HTTPException): """Base class for exceptions with status codes in the 400s and 500s.""" class HTTPRedirection(HTTPException):
63
64
23
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPRedirection
HTTPRedirection
103
104
103
103
9808c7b0dc4f9b1ac560d9f13cc240560fce2206
bigcode/the-stack
train
f74a3640191f942da98dd8c6
train
class
class HTTPNetworkAuthenticationRequired(HTTPServerError): status_code = 511
class HTTPNetworkAuthenticationRequired(HTTPServerError):
status_code = 511
505 class HTTPVariantAlsoNegotiates(HTTPServerError): status_code = 506 class HTTPInsufficientStorage(HTTPServerError): status_code = 507 class HTTPNotExtended(HTTPServerError): status_code = 510 class HTTPNetworkAuthenticationRequired(HTTPServerError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPNetworkAuthenticationRequired
HTTPNetworkAuthenticationRequired
406
407
406
406
a95e3a592ef60add95c806cd5e7421746eedd72d
bigcode/the-stack
train
b5e14516c29568641f1c9ecf
train
class
class HTTPBadRequest(HTTPClientError): status_code = 400
class HTTPBadRequest(HTTPClientError):
status_code = 400
class HTTPTemporaryRedirect(_HTTPMove): status_code = 307 class HTTPPermanentRedirect(_HTTPMove): status_code = 308 ############################################################ # 4xx client error ############################################################ class HTTPClientError(HTTPError): pass cla...
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPBadRequest
HTTPBadRequest
210
211
210
210
786900cb297c15de1411fa45e6311ecb0a220479
bigcode/the-stack
train
97e1b1afd5c680c2769640c8
train
class
class HTTPRequestEntityTooLarge(HTTPClientError): status_code = 413 def __init__(self, max_size: float, actual_size: float, **kwargs: Any) -> None: kwargs.setdefault( 'text', 'Maximum request body size {} exceeded, ' ...
class HTTPRequestEntityTooLarge(HTTPClientError):
status_code = 413 def __init__(self, max_size: float, actual_size: float, **kwargs: Any) -> None: kwargs.setdefault( 'text', 'Maximum request body size {} exceeded, ' 'actual body size {}'.format(max_size, actual_siz...
= 409 class HTTPGone(HTTPClientError): status_code = 410 class HTTPLengthRequired(HTTPClientError): status_code = 411 class HTTPPreconditionFailed(HTTPClientError): status_code = 412 class HTTPRequestEntityTooLarge(HTTPClientError):
64
64
87
11
52
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPRequestEntityTooLarge
HTTPRequestEntityTooLarge
278
290
278
278
4b63c9f1b131d19b88978a4f6db9f0413a8656e3
bigcode/the-stack
train
ae8ff7755b1c4e1cc46141ed
train
class
class HTTPSeeOther(_HTTPMove): status_code = 303
class HTTPSeeOther(_HTTPMove):
status_code = 303
_code = 300 class HTTPMovedPermanently(_HTTPMove): status_code = 301 class HTTPFound(_HTTPMove): status_code = 302 # This one is safe after a POST (the redirected location will be # retrieved with GET): class HTTPSeeOther(_HTTPMove):
64
64
15
8
56
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPSeeOther
HTTPSeeOther
178
179
178
178
547960c8975a878e91b09e9f15a3bf11dd9d6b7a
bigcode/the-stack
train
e434951467c0658f6d66f525
train
class
class HTTPPermanentRedirect(_HTTPMove): status_code = 308
class HTTPPermanentRedirect(_HTTPMove):
status_code = 308
status_code = 304 empty_body = True class HTTPUseProxy(_HTTPMove): # Not a move, but looks a little like one status_code = 305 class HTTPTemporaryRedirect(_HTTPMove): status_code = 307 class HTTPPermanentRedirect(_HTTPMove):
64
64
15
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPPermanentRedirect
HTTPPermanentRedirect
197
198
197
197
27d926381044bc6f0398ced3c2e07d93be8b0c0b
bigcode/the-stack
train
dd164aa5f5f33a1bd85d4599
train
class
class HTTPLengthRequired(HTTPClientError): status_code = 411
class HTTPLengthRequired(HTTPClientError):
status_code = 411
): status_code = 407 class HTTPRequestTimeout(HTTPClientError): status_code = 408 class HTTPConflict(HTTPClientError): status_code = 409 class HTTPGone(HTTPClientError): status_code = 410 class HTTPLengthRequired(HTTPClientError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPLengthRequired
HTTPLengthRequired
270
271
270
270
0cfc939441be95fa9bd18d3ece70e93a20000c24
bigcode/the-stack
train
ab29290b6e9270ed03e34d21
train
class
class HTTPCreated(HTTPSuccessful): status_code = 201
class HTTPCreated(HTTPSuccessful):
status_code = 201
Base class for exceptions with status codes in the 300s.""" class HTTPSuccessful(HTTPException): """Base class for exceptions with status codes in the 200s.""" class HTTPOk(HTTPSuccessful): status_code = 200 class HTTPCreated(HTTPSuccessful):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPCreated
HTTPCreated
115
116
115
115
6fc295142cacafbddba91f129c6b3240dfb90007
bigcode/the-stack
train
74fe76c7291e447240720e5e
train
class
class HTTPServerError(HTTPError): pass
class HTTPServerError(HTTPError):
pass
# server SHOULD include an entity containing an explanation of the error # situation, and whether it is a temporary or permanent condition. User # agents SHOULD display any included entity to the user. These response # codes are applicable to any request method. class HTTPServerError(HTTPError):
64
64
11
8
56
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPServerError
HTTPServerError
366
367
366
366
db2a424be5fce215d9aaf97f0bbe4784cecd6f90
bigcode/the-stack
train
ff030a1c11cac5a359f6b8c1
train
class
class HTTPPreconditionRequired(HTTPClientError): status_code = 428
class HTTPPreconditionRequired(HTTPClientError):
status_code = 428
_code = 421 class HTTPUnprocessableEntity(HTTPClientError): status_code = 422 class HTTPFailedDependency(HTTPClientError): status_code = 424 class HTTPUpgradeRequired(HTTPClientError): status_code = 426 class HTTPPreconditionRequired(HTTPClientError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPPreconditionRequired
HTTPPreconditionRequired
325
326
325
325
54ac181de100a2320afb7f5c2cfd07d91dd2a443
bigcode/the-stack
train
e264f5bfc282a95d5972b1fe
train
class
class HTTPUpgradeRequired(HTTPClientError): status_code = 426
class HTTPUpgradeRequired(HTTPClientError):
status_code = 426
= 417 class HTTPMisdirectedRequest(HTTPClientError): status_code = 421 class HTTPUnprocessableEntity(HTTPClientError): status_code = 422 class HTTPFailedDependency(HTTPClientError): status_code = 424 class HTTPUpgradeRequired(HTTPClientError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPUpgradeRequired
HTTPUpgradeRequired
321
322
321
321
fb4502fa63db9011efc3bd47b326fdd2c6d37975
bigcode/the-stack
train
106e468591a9913dd4da3515
train
class
class HTTPError(HTTPException): """Base class for exceptions with status codes in the 400s and 500s."""
class HTTPError(HTTPException):
"""Base class for exceptions with status codes in the 400s and 500s."""
, content_type=content_type) Exception.__init__(self, self.reason) if self.body is None and not self.empty_body: self.text = "{}: {}".format(self.status, self.reason) def __bool__(self) -> bool: return True class HTTPError(HTTPException):
64
64
26
7
56
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPError
HTTPError
99
100
99
99
033f092fb7aa060c80d8ccc106f94f4d56cdd8c2
bigcode/the-stack
train
b0b8a543063494ca1d158d47
train
class
class HTTPVersionNotSupported(HTTPServerError): status_code = 505
class HTTPVersionNotSupported(HTTPServerError):
status_code = 505
status_code = 501 class HTTPBadGateway(HTTPServerError): status_code = 502 class HTTPServiceUnavailable(HTTPServerError): status_code = 503 class HTTPGatewayTimeout(HTTPServerError): status_code = 504 class HTTPVersionNotSupported(HTTPServerError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPVersionNotSupported
HTTPVersionNotSupported
390
391
390
390
3f8b52fcf54ae195a0821d73f8e9c1702698ff13
bigcode/the-stack
train
284481337e68f2a96445ce22
train
class
class HTTPUnauthorized(HTTPClientError): status_code = 401
class HTTPUnauthorized(HTTPClientError):
status_code = 401
class HTTPPermanentRedirect(_HTTPMove): status_code = 308 ############################################################ # 4xx client error ############################################################ class HTTPClientError(HTTPError): pass class HTTPBadRequest(HTTPClientError): status_code = 400 clas...
64
64
15
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPUnauthorized
HTTPUnauthorized
214
215
214
214
340388189dff65110b649e7a37411f3fdbb7054c
bigcode/the-stack
train
e20ff915cc500f22c03c77ab
train
class
class HTTPMethodNotAllowed(HTTPClientError): status_code = 405 def __init__(self, method: str, allowed_methods: Iterable[str], *, headers: Optional[LooseHeaders]=None, reason: Optional[str]=None, body: Any=Non...
class HTTPMethodNotAllowed(HTTPClientError):
status_code = 405 def __init__(self, method: str, allowed_methods: Iterable[str], *, headers: Optional[LooseHeaders]=None, reason: Optional[str]=None, body: Any=None, text: Optional[str]=None,...
status_code = 401 class HTTPPaymentRequired(HTTPClientError): status_code = 402 class HTTPForbidden(HTTPClientError): status_code = 403 class HTTPNotFound(HTTPClientError): status_code = 404 class HTTPMethodNotAllowed(HTTPClientError):
64
64
152
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPMethodNotAllowed
HTTPMethodNotAllowed
230
247
230
230
2eb96f094b88d4a9651baf40081385b45aef9032
bigcode/the-stack
train
59376526f38c4e065fece49d
train
class
class HTTPRequestTimeout(HTTPClientError): status_code = 408
class HTTPRequestTimeout(HTTPClientError):
status_code = 408
_methods = set(allowed_methods) # type: Set[str] self.method = method.upper() class HTTPNotAcceptable(HTTPClientError): status_code = 406 class HTTPProxyAuthenticationRequired(HTTPClientError): status_code = 407 class HTTPRequestTimeout(HTTPClientError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPRequestTimeout
HTTPRequestTimeout
258
259
258
258
8d8e84940aca96800612579ce9cd5d42e12d40c4
bigcode/the-stack
train
fef049e15de2e37870caad5d
train
class
class HTTPUnavailableForLegalReasons(HTTPClientError): status_code = 451 def __init__(self, link: str, *, headers: Optional[LooseHeaders]=None, reason: Optional[str]=None, body: Any=None, text: Optional[str]=N...
class HTTPUnavailableForLegalReasons(HTTPClientError):
status_code = 451 def __init__(self, link: str, *, headers: Optional[LooseHeaders]=None, reason: Optional[str]=None, body: Any=None, text: Optional[str]=None, content_type: Optional[str]=None)...
class HTTPPreconditionRequired(HTTPClientError): status_code = 428 class HTTPTooManyRequests(HTTPClientError): status_code = 429 class HTTPRequestHeaderFieldsTooLarge(HTTPClientError): status_code = 431 class HTTPUnavailableForLegalReasons(HTTPClientError):
64
64
127
11
52
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPUnavailableForLegalReasons
HTTPUnavailableForLegalReasons
337
351
337
337
7a693a896837f2fecc83ef9731efcb6e32b2bc86
bigcode/the-stack
train
64b0fe198ea40e9cf575e307
train
class
class HTTPClientError(HTTPError): pass
class HTTPClientError(HTTPError):
pass
looks a little like one status_code = 305 class HTTPTemporaryRedirect(_HTTPMove): status_code = 307 class HTTPPermanentRedirect(_HTTPMove): status_code = 308 ############################################################ # 4xx client error ############################################################ cl...
64
64
11
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPClientError
HTTPClientError
206
207
206
206
154af05993b6d50652abc472828659db5f432e4a
bigcode/the-stack
train
e8be2e9143c6370fdc34cef0
train
class
class HTTPPartialContent(HTTPSuccessful): status_code = 206
class HTTPPartialContent(HTTPSuccessful):
status_code = 206
HTTPSuccessful): status_code = 203 class HTTPNoContent(HTTPSuccessful): status_code = 204 empty_body = True class HTTPResetContent(HTTPSuccessful): status_code = 205 empty_body = True class HTTPPartialContent(HTTPSuccessful):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPPartialContent
HTTPPartialContent
137
138
137
137
e7159aeda473b9a0d321418b70bc45e14a4e02fe
bigcode/the-stack
train
03392fef675f4de86bf4c3d6
train
class
class HTTPTemporaryRedirect(_HTTPMove): status_code = 307
class HTTPTemporaryRedirect(_HTTPMove):
status_code = 307
): # FIXME: this should include a date or etag header status_code = 304 empty_body = True class HTTPUseProxy(_HTTPMove): # Not a move, but looks a little like one status_code = 305 class HTTPTemporaryRedirect(_HTTPMove):
64
64
15
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPTemporaryRedirect
HTTPTemporaryRedirect
193
194
193
193
4a7ad002bb03094eb6d2ca87f997ce2fce517080
bigcode/the-stack
train
b29d045ace86d128fe05fe04
train
class
class HTTPNotImplemented(HTTPServerError): status_code = 501
class HTTPNotImplemented(HTTPServerError):
status_code = 501
User # agents SHOULD display any included entity to the user. These response # codes are applicable to any request method. class HTTPServerError(HTTPError): pass class HTTPInternalServerError(HTTPServerError): status_code = 500 class HTTPNotImplemented(HTTPServerError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPNotImplemented
HTTPNotImplemented
374
375
374
374
333dc8cb4ed3bc1befd96d4b85f119ac0f00afa4
bigcode/the-stack
train
35bdccee614432b16ac63fca
train
class
class HTTPInternalServerError(HTTPServerError): status_code = 500
class HTTPInternalServerError(HTTPServerError):
status_code = 500
error # situation, and whether it is a temporary or permanent condition. User # agents SHOULD display any included entity to the user. These response # codes are applicable to any request method. class HTTPServerError(HTTPError): pass class HTTPInternalServerError(HTTPServerError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPInternalServerError
HTTPInternalServerError
370
371
370
370
1a7fc8c0f0837d5d03b929e5870eba98ffa46ae3
bigcode/the-stack
train
2a374f2813312850e7676fcf
train
class
class _HTTPMove(HTTPRedirection): def __init__(self, location: StrOrURL, *, headers: Optional[LooseHeaders]=None, reason: Optional[str]=None, body: Any=None, text: Optional[str]=None, content_type...
class _HTTPMove(HTTPRedirection):
def __init__(self, location: StrOrURL, *, headers: Optional[LooseHeaders]=None, reason: Optional[str]=None, body: Any=None, text: Optional[str]=None, content_type: Optional[str]=None) -> None: ...
_body = True class HTTPResetContent(HTTPSuccessful): status_code = 205 empty_body = True class HTTPPartialContent(HTTPSuccessful): status_code = 206 ############################################################ # 3xx redirection ############################################################ class _HTTPMo...
64
64
130
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
_HTTPMove
_HTTPMove
146
161
146
147
6f358190bae572b4987d431b2cfb784554047c0c
bigcode/the-stack
train
6dc81324458bf4e98b357212
train
class
class HTTPSuccessful(HTTPException): """Base class for exceptions with status codes in the 200s."""
class HTTPSuccessful(HTTPException):
"""Base class for exceptions with status codes in the 200s."""
: return True class HTTPError(HTTPException): """Base class for exceptions with status codes in the 400s and 500s.""" class HTTPRedirection(HTTPException): """Base class for exceptions with status codes in the 300s.""" class HTTPSuccessful(HTTPException):
63
64
23
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPSuccessful
HTTPSuccessful
107
108
107
107
a911f904a84d5055b9b48697b3eecada6ee7aceb
bigcode/the-stack
train
f247ae40f5207bb0d1de2193
train
class
class HTTPNoContent(HTTPSuccessful): status_code = 204 empty_body = True
class HTTPNoContent(HTTPSuccessful):
status_code = 204 empty_body = True
status_code = 200 class HTTPCreated(HTTPSuccessful): status_code = 201 class HTTPAccepted(HTTPSuccessful): status_code = 202 class HTTPNonAuthoritativeInformation(HTTPSuccessful): status_code = 203 class HTTPNoContent(HTTPSuccessful):
64
64
22
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPNoContent
HTTPNoContent
127
129
127
127
80567bd3541a93cb2f954c0232e57883425c4d57
bigcode/the-stack
train
550aad7e9a48fc5ce39a4995
train
class
class HTTPExpectationFailed(HTTPClientError): status_code = 417
class HTTPExpectationFailed(HTTPClientError):
status_code = 417
class HTTPRequestURITooLong(HTTPClientError): status_code = 414 class HTTPUnsupportedMediaType(HTTPClientError): status_code = 415 class HTTPRequestRangeNotSatisfiable(HTTPClientError): status_code = 416 class HTTPExpectationFailed(HTTPClientError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPExpectationFailed
HTTPExpectationFailed
305
306
305
305
af7c8fbb32eb748b6982e2bbb2c78f06bf8311bc
bigcode/the-stack
train
23781aa862af0781bc930824
train
class
class HTTPMisdirectedRequest(HTTPClientError): status_code = 421
class HTTPMisdirectedRequest(HTTPClientError):
status_code = 421
class HTTPUnsupportedMediaType(HTTPClientError): status_code = 415 class HTTPRequestRangeNotSatisfiable(HTTPClientError): status_code = 416 class HTTPExpectationFailed(HTTPClientError): status_code = 417 class HTTPMisdirectedRequest(HTTPClientError):
64
64
18
11
52
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPMisdirectedRequest
HTTPMisdirectedRequest
309
310
309
309
47d1a6bc56b5134424cc71ac9a503f3ce0d47356
bigcode/the-stack
train
23fafd9de21a5d47d96d5c77
train
class
class HTTPMultipleChoices(_HTTPMove): status_code = 300
class HTTPMultipleChoices(_HTTPMove):
status_code = 300
raise ValueError("HTTP redirects need a location to redirect to.") super().__init__(headers=headers, reason=reason, body=body, text=text, content_type=content_type) self.headers['Location'] = str(location) self.location = location class HTTPMultipleChoices(_H...
64
64
15
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPMultipleChoices
HTTPMultipleChoices
164
165
164
164
44f3b244fec37da99801eddc318122f4b5d0deca
bigcode/the-stack
train
8d0a7078949ae30e14c1233b
train
class
class HTTPNotExtended(HTTPServerError): status_code = 510
class HTTPNotExtended(HTTPServerError):
status_code = 510
504 class HTTPVersionNotSupported(HTTPServerError): status_code = 505 class HTTPVariantAlsoNegotiates(HTTPServerError): status_code = 506 class HTTPInsufficientStorage(HTTPServerError): status_code = 507 class HTTPNotExtended(HTTPServerError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPNotExtended
HTTPNotExtended
402
403
402
402
0b5f403963ce42eb4995b8d423625c1d75f347f3
bigcode/the-stack
train
53e14b3c3242da1c087311e0
train
class
class HTTPForbidden(HTTPClientError): status_code = 403
class HTTPForbidden(HTTPClientError):
status_code = 403
ClientError(HTTPError): pass class HTTPBadRequest(HTTPClientError): status_code = 400 class HTTPUnauthorized(HTTPClientError): status_code = 401 class HTTPPaymentRequired(HTTPClientError): status_code = 402 class HTTPForbidden(HTTPClientError):
64
64
15
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPForbidden
HTTPForbidden
222
223
222
222
b6d114afb954a52ea56ac0410c6d3f7115642c8a
bigcode/the-stack
train
30781b9177aaa6d77a4279cc
train
class
class HTTPTooManyRequests(HTTPClientError): status_code = 429
class HTTPTooManyRequests(HTTPClientError):
status_code = 429
_code = 422 class HTTPFailedDependency(HTTPClientError): status_code = 424 class HTTPUpgradeRequired(HTTPClientError): status_code = 426 class HTTPPreconditionRequired(HTTPClientError): status_code = 428 class HTTPTooManyRequests(HTTPClientError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPTooManyRequests
HTTPTooManyRequests
329
330
329
329
7f9f1d2046c9e60b4d7909b6239bd6d1c544b877
bigcode/the-stack
train
3c462bae82f902f20665c7f5
train
class
class HTTPNotAcceptable(HTTPClientError): status_code = 406
class HTTPNotAcceptable(HTTPClientError):
status_code = 406
headers=headers, reason=reason, body=body, text=text, content_type=content_type) self.headers['Allow'] = allow self.allowed_methods = set(allowed_methods) # type: Set[str] self.method = method.upper() class HTTPNotAcceptable(HTTPClientError):
64
64
17
10
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPNotAcceptable
HTTPNotAcceptable
250
251
250
250
62d152387b94108979c148fda9b7f83f12884903
bigcode/the-stack
train
a52d97ef8a16aada6ef4d764
train
class
class HTTPOk(HTTPSuccessful): status_code = 200
class HTTPOk(HTTPSuccessful):
status_code = 200
and 500s.""" class HTTPRedirection(HTTPException): """Base class for exceptions with status codes in the 300s.""" class HTTPSuccessful(HTTPException): """Base class for exceptions with status codes in the 200s.""" class HTTPOk(HTTPSuccessful):
63
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPOk
HTTPOk
111
112
111
111
cb5ed2a0b754d5ef69fd7861fc8fb6ad0611cb7f
bigcode/the-stack
train
5028cc597df5a15401c22b6d
train
class
class HTTPNotModified(HTTPRedirection): # FIXME: this should include a date or etag header status_code = 304 empty_body = True
class HTTPNotModified(HTTPRedirection): # FIXME: this should include a date or etag header
status_code = 304 empty_body = True
status_code = 302 # This one is safe after a POST (the redirected location will be # retrieved with GET): class HTTPSeeOther(_HTTPMove): status_code = 303 class HTTPNotModified(HTTPRedirection): # FIXME: this should include a date or etag header
64
64
36
23
40
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPNotModified
HTTPNotModified
182
185
182
183
e75c7c8e4b67e69d4d4f05b3badd204a1997a795
bigcode/the-stack
train
89d35a73cc478504aad48d6a
train
class
class HTTPMovedPermanently(_HTTPMove): status_code = 301
class HTTPMovedPermanently(_HTTPMove):
status_code = 301
init__(headers=headers, reason=reason, body=body, text=text, content_type=content_type) self.headers['Location'] = str(location) self.location = location class HTTPMultipleChoices(_HTTPMove): status_code = 300 class HTTPMovedPermanently(_HTTPMove):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPMovedPermanently
HTTPMovedPermanently
168
169
168
168
1d8f01a9a1549bbcf717e51d491b67b24d59eb2c
bigcode/the-stack
train
32e4297b37aae4b3ba74ba9e
train
class
class HTTPUnsupportedMediaType(HTTPClientError): status_code = 415
class HTTPUnsupportedMediaType(HTTPClientError):
status_code = 415
'text', 'Maximum request body size {} exceeded, ' 'actual body size {}'.format(max_size, actual_size) ) super().__init__(**kwargs) class HTTPRequestURITooLong(HTTPClientError): status_code = 414 class HTTPUnsupportedMediaType(HTTPClientError):
64
64
17
10
53
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPUnsupportedMediaType
HTTPUnsupportedMediaType
297
298
297
297
e777ec310f324b1daa53228b883be07f2f2941b1
bigcode/the-stack
train
c85262f4101c29c1cff7434e
train
class
class HTTPUseProxy(_HTTPMove): # Not a move, but looks a little like one status_code = 305
class HTTPUseProxy(_HTTPMove): # Not a move, but looks a little like one
status_code = 305
status_code = 303 class HTTPNotModified(HTTPRedirection): # FIXME: this should include a date or etag header status_code = 304 empty_body = True class HTTPUseProxy(_HTTPMove): # Not a move, but looks a little like one
64
64
28
21
42
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPUseProxy
HTTPUseProxy
188
190
188
189
154685e0eb9107262e525131b8dd6269f8069817
bigcode/the-stack
train
9e62412ca66d3d9850f2591c
train
class
class HTTPServiceUnavailable(HTTPServerError): status_code = 503
class HTTPServiceUnavailable(HTTPServerError):
status_code = 503
HTTPError): pass class HTTPInternalServerError(HTTPServerError): status_code = 500 class HTTPNotImplemented(HTTPServerError): status_code = 501 class HTTPBadGateway(HTTPServerError): status_code = 502 class HTTPServiceUnavailable(HTTPServerError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPServiceUnavailable
HTTPServiceUnavailable
382
383
382
382
339d93a68075d6afbd04b44b73039efe87fd661c
bigcode/the-stack
train
2948e6c6a4188d308d479766
train
class
class HTTPResetContent(HTTPSuccessful): status_code = 205 empty_body = True
class HTTPResetContent(HTTPSuccessful):
status_code = 205 empty_body = True
class HTTPAccepted(HTTPSuccessful): status_code = 202 class HTTPNonAuthoritativeInformation(HTTPSuccessful): status_code = 203 class HTTPNoContent(HTTPSuccessful): status_code = 204 empty_body = True class HTTPResetContent(HTTPSuccessful):
64
64
22
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPResetContent
HTTPResetContent
132
134
132
132
a9dce47788e7b549df3e43ecefd416ff4b1ad8c4
bigcode/the-stack
train
56320343448a21968449162f
train
class
class HTTPVariantAlsoNegotiates(HTTPServerError): status_code = 506
class HTTPVariantAlsoNegotiates(HTTPServerError):
status_code = 506
= 502 class HTTPServiceUnavailable(HTTPServerError): status_code = 503 class HTTPGatewayTimeout(HTTPServerError): status_code = 504 class HTTPVersionNotSupported(HTTPServerError): status_code = 505 class HTTPVariantAlsoNegotiates(HTTPServerError):
64
64
18
11
52
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPVariantAlsoNegotiates
HTTPVariantAlsoNegotiates
394
395
394
394
2531551fed3bb0254bb2d0b7a1a23160dce97b14
bigcode/the-stack
train
57a62022f780557624576625
train
class
class HTTPGone(HTTPClientError): status_code = 410
class HTTPGone(HTTPClientError):
status_code = 410
): status_code = 406 class HTTPProxyAuthenticationRequired(HTTPClientError): status_code = 407 class HTTPRequestTimeout(HTTPClientError): status_code = 408 class HTTPConflict(HTTPClientError): status_code = 409 class HTTPGone(HTTPClientError):
64
64
15
8
55
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPGone
HTTPGone
266
267
266
266
64fced5f4dc69516fa8863a616af778d030ebfdf
bigcode/the-stack
train
983072ce0cd6919f6b228eec
train
class
class HTTPFailedDependency(HTTPClientError): status_code = 424
class HTTPFailedDependency(HTTPClientError):
status_code = 424
= 416 class HTTPExpectationFailed(HTTPClientError): status_code = 417 class HTTPMisdirectedRequest(HTTPClientError): status_code = 421 class HTTPUnprocessableEntity(HTTPClientError): status_code = 422 class HTTPFailedDependency(HTTPClientError):
64
64
16
9
54
vananabu/aiohttp
aiohttp/web_exceptions.py
Python
HTTPFailedDependency
HTTPFailedDependency
317
318
317
317
5434f02617312fd7894cf3f3dee9786249cc9031
bigcode/the-stack
train