id
int64
0
1.29M
original_id
stringlengths
32
32
swhid
stringlengths
100
170
sha1
stringlengths
40
40
repo_name
stringlengths
2
45
repo_group
stringclasses
12 values
filepath
stringlengths
5
153
name
stringlengths
1
14.9k
type
stringclasses
3 values
code
stringlengths
7
2.12M
2,600
878ee258846cc8f04ae53dfa4aa9e20e
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1141-1165/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_levenshtein(self, diffs)
function
def diff_levenshtein(self, diffs): """Compute the Levenshtein distance; the number of inserted, deleted or substituted characters. Args: diffs: Array of diff tuples. Returns: Number of changes. """ levenshtein = 0 insertions = 0 deletions = 0 for (op, data) in diffs: ...
2,601
6a350f325f8acee2e82c93f0d4dd95b9
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1296-1312/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::match_bitap::match_bitapScore(e, x)
function
def match_bitapScore(e, x): """Compute and return the score for a match with e errors and x location. Accesses loc and pattern through being a closure. Args: e: Number of errors in match. x: Location of match. Returns: Overall score for match (0.0 = good, 1.0 = bad). ...
2,602
65fd9f30d23be08aa75de15f2a8f081f
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1665-1721/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::patch_addPadding(self, patches)
function
def patch_addPadding(self, patches): """Add some padding on text start and end so that edges can match something. Intended to be called only from within patch_apply. Args: patches: Array of patch objects. Returns: The padding string added to each side. """ paddingLength = self.Pat...
2,603
f6c9532350b46d4364864cf6d1d7fa6f
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1810-1822/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::patch_toText(self, patches)
function
def patch_toText(self, patches): """Take a list of patches and return a textual representation. Args: patches: Array of patch objects. Returns: Text representation of patches. """ text = [] for patch in patches: text.append(str(patch)) return "".join(text)
2,604
e701fb510157b5d590760975679171ef
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1906-1913/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
patch_obj::__init__(self)
function
def __init__(self): """Initializes with an empty list of diffs. """ self.diffs = [] self.start1 = None self.start2 = None self.length1 = 0 self.length2 = 0
2,605
66146dfc8ed073cdbd808633a792b34e
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=944-1053/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_cleanupMerge(self, diffs)
function
def diff_cleanupMerge(self, diffs): """Reorder and merge like edit sections. Merge equalities. Any edit section can move as long as it doesn't cross an equality. Args: diffs: Array of diff tuples. """ diffs.append((self.DIFF_EQUAL, '')) # Add a dummy entry at the end. pointer = 0 co...
2,606
6a7c0533f01a2ce14b9f18d1fdb2d198
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1442-1554/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::patch_make(self, a, b=None, c=None)
function
def patch_make(self, a, b=None, c=None): """Compute a list of patches to turn text1 into text2. Use diffs if provided, otherwise compute it ourselves. There are four ways to call this function, depending on what data is available to the caller: Method 1: a = text1, b = text2 Method 2: a ...
2,607
1b0acc488f2f2da3fe160a411c323ea0
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=401-431/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_linesToChars::diff_linesToCharsMunge(text)
function
def diff_linesToCharsMunge(text): """Split a text into an array of strings. Reduce the texts to a string of hashes where each Unicode character represents one line. Modifies linearray and linehash through being a closure. Args: text: String to encode. Returns: Encoded st...
2,608
8a73dc0e0ffd505da139e86745ab1272
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=782-819/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_cleanupSemanticLossless::diff_cleanupSemanticScore(one, two)
function
def diff_cleanupSemanticScore(one, two): """Given two strings, compute a score representing whether the internal boundary falls on logical boundaries. Scores range from 5 (best) to 0 (worst). Closure, but does not reference any external variables. Args: one: First string. ...
2,609
d35d61cae02156b636b421852d6dbbd0
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1055-1085/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_xIndex(self, diffs, loc)
function
def diff_xIndex(self, diffs, loc): """loc is a location in text1, compute and return the equivalent location in text2. e.g. "The cat" vs "The big cat", 1->1, 5->8 Args: diffs: Array of diff tuples. loc: Location within text1. Returns: Location within text2. """ chars1 = 0 ...
2,610
3355a9e486711bee3962550473fe2a08
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1556-1575/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::patch_deepCopy(self, patches)
function
def patch_deepCopy(self, patches): """Given an array of patches, return another array that is identical. Args: patches: Array of patch objects. Returns: Array of patch objects. """ patchesCopy = [] for patch in patches: patchCopy = patch_obj() # No need to deep copy the...
2,611
ae4bf44b90e453029f6c0e6ba38caa2f
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=254-354/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_bisect(self, text1, text2, deadline)
function
def diff_bisect(self, text1, text2, deadline): """Find the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff. See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. Args: text1: Old string to be diffed. text2: New string to b...
2,612
6bcf8645dc33b93cf5f30f5baeea539b
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=381-435/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_linesToChars(self, text1, text2)
function
def diff_linesToChars(self, text1, text2): """Split two texts into an array of strings. Reduce the texts to a string of hashes where each Unicode character represents one line. Args: text1: First string. text2: Second string. Returns: Three element tuple, containing the encoded text...
2,613
1921f35b14bd68df015e4f71fd279aff
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1245-1275/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::match_main(self, text, pattern, loc)
function
# MATCH FUNCTIONS def match_main(self, text, pattern, loc): """Locate the best instance of 'pattern' in 'text' near 'loc'. Args: text: The text to search. pattern: The pattern to search for. loc: The location to search around. Returns: Best match index or -1. """ # Chec...
2,614
4550db0c98173c586d6554dff28f650d
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1399-1440/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::patch_addContext(self, patch, text)
function
# PATCH FUNCTIONS def patch_addContext(self, patch, text): """Increase the context until it is unique, but don't let the pattern expand beyond Match_MaxBits. Args: patch: The patch to grow. text: Source text. """ if len(text) == 0: return pattern = text[patch.start2 : patc...
2,615
1258e9916c59eb66b31cfc5cef9b7672
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=77-135/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_main(self, text1, text2, checklines=True, deadline=None)
function
def diff_main(self, text1, text2, checklines=True, deadline=None): """Find the differences between two texts. Simplifies the problem by stripping any common prefix or suffix off the texts before diffing. Args: text1: Old string to be diffed. text2: New string to be diffed. checklines: ...
2,616
f2c585ec7e73f5e239600ffc7b32e08c
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=356-379/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_bisectSplit(self, text1, text2, x, y, deadline)
function
def diff_bisectSplit(self, text1, text2, x, y, deadline): """Given the location of the 'middle snake', split the diff in two parts and recurse. Args: text1: Old string to be diffed. text2: New string to be diffed. x: Index of split point in text1. y: Index of split point in text2. ...
2,617
5338c2f5a4b6e0cc2b26c3e1dd14bd24
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=437-493/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_linesToWords(self, text1, text2)
function
def diff_linesToWords(self, text1, text2): """ INSERT BY FABIAN Split two texts into an array of strings. Reduce the texts to a string of hashes where each Unicode character represents one word. Args: text1: First string. text2: Second string. Returns: Three element tuple, c...
2,618
7e6db8c23fc7258fae3a271d63b994ba
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=459-489/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_linesToWords::diff_linesToCharsMunge(text)
function
def diff_linesToCharsMunge(text): """Split a text into an array of strings. Reduce the texts to a string of hashes where each Unicode character represents one line. Modifies linearray and linehash through being a closure. Args: text: String to encode. Returns: Encoded st...
2,619
8552da292418e4598da6b4ba0e280983
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=634-668/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::diff_halfMatch::diff_halfMatchI(longtext, shorttext, i)
function
def diff_halfMatchI(longtext, shorttext, i): """Does a substring of shorttext exist within longtext such that the substring is at least half the length of longtext? Closure, but does not reference any external variables. Args: longtext: Longer string. shorttext: Shorter string. ...
2,620
0df83932065c644960170aa141dd63aa
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1277-1381/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::match_bitap(self, text, pattern, loc)
function
def match_bitap(self, text, pattern, loc): """Locate the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm. Args: text: The text to search. pattern: The pattern to search for. loc: The location to search around. Returns: Best match index or -1. """ ...
2,621
ce475f13e96237dc3e7236a2111a202a
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1824-1899/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::patch_fromText(self, textline)
function
def patch_fromText(self, textline): """Parse a textual representation of patches and return a list of patch objects. Args: textline: Text representation of patches. Returns: Array of patch objects. Raises: ValueError: If invalid input. """ if type(textline) == unicode: ...
2,622
47cb9c0b80f28b6447bbba089b3373fb
swh:1:cnt:0ad37c0bf672a3e86b5945605616f5177410fef3;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=1383-1397/
980ff5ae28069772eca9101a836b46bb2481463e
wikihadoop
analytics
python/diff_match_patch.py
diff_match_patch::match_alphabet(self, pattern)
function
def match_alphabet(self, pattern): """Initialise the alphabet for the Bitap algorithm. Args: pattern: The text to encode. Returns: Hash of character locations. """ s = {} for char in pattern: s[char] = 0 for i in xrange(len(pattern)): s[pattern[i]] |= 1 << (len(patt...
2,623
033539da6bd4298f780f8b6a61e053fe
swh:1:cnt:ef5a3cca13a19d1499c4bb4df3dc4363d251d8cf;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=32-43/
d5a5129c92173fbe7793883389fcd5c1700f7357
wikihadoop
analytics
python/example.py
hashTokens(tokens, hash2Token=[], token2Hash={})
function
def hashTokens(tokens, hash2Token=[], token2Hash={}): hashBuffer = StringIO() for t in tokens: if t in token2Hash: hashBuffer.write(unichr(token2Hash[t]+1)) else: hashId = len(hash2Token) hash2Token.append(t) token2Hash[t] = hashId hashBuffer.write(unichr(hashId+1)) return (hashBuffer.getvalue(...
2,624
e14b2d9079b2b9afc5e6aebb02937dbd
swh:1:cnt:ef5a3cca13a19d1499c4bb4df3dc4363d251d8cf;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=48-64/
d5a5129c92173fbe7793883389fcd5c1700f7357
wikihadoop
analytics
python/example.py
simpleDiff(content1, content2, tokenize=tokenize, sep='', report=[-1,0,1])
function
def simpleDiff(content1, content2, tokenize=tokenize, sep='', report=[-1,0,1]): hashes1, h2t, t2h = hashTokens(tokenize(content1)) hashes2, h2t, t2h = hashTokens(tokenize(content2), h2t, t2h) report = set(report) dmp = diff_match_patch() diffs = dmp.diff_main(hashes1, hashes2, checklines=False) ...
2,625
b6a185f43196b8adcb3c09bbf477a420
swh:1:cnt:ef5a3cca13a19d1499c4bb4df3dc4363d251d8cf;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=10-30/
d5a5129c92173fbe7793883389fcd5c1700f7357
wikihadoop
analytics
python/example.py
tokenize(content)
function
def tokenize(content): return re.findall( r"[\w]+" + #Word r"|\[\[" + #Opening internal link r"|\]\]" + #Closing internal link r"|\{\{" + #Opening template r"|\}\}" + #Closing template r"|\{\{\{" + #Opening template var r"|\}...
2,626
977cb9f688f837f91d4199189d6c5898
swh:1:cnt:ef5a3cca13a19d1499c4bb4df3dc4363d251d8cf;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=45-46/
d5a5129c92173fbe7793883389fcd5c1700f7357
wikihadoop
analytics
python/example.py
unhash(hashes, hash2Token, sep='')
function
def unhash(hashes, hash2Token, sep=''): return sep.join(hash2Token[ord(h)-1] for h in hashes)
2,627
370f049a2e143e7de6a16f333a018336
swh:1:cnt:ef5a3cca13a19d1499c4bb4df3dc4363d251d8cf;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=67-103/
d5a5129c92173fbe7793883389fcd5c1700f7357
wikihadoop
analytics
python/example.py
main()
function
def main(): lastRev = {'content':''} content = '' for rev in revs: buff = StringIO() oldPos = 0 lastPos = 0 for pos, ar, c in simpleDiff(lastRev['content'], rev['content'], report=[-1,1]): equal = content[oldPos:oldPos+pos-lastPos] buff.write(equal) lastPos += len(equal) oldPos += len(equal) ...
2,628
ddf4f5e2e8ab4eece306894419bcd428
swh:1:cnt:7635d7dc14bf20739633f7e22ea1a754a8c0d151;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=30-50/
9d61a70b7f2bd7ed076f603a21d008f1c817bd8d
wikihadoop
analytics
python/revision_differ.py
tokenize(content)
function
def tokenize(content): return re.findall( r"[\w]+" + #Word r"|\[\[" + #Opening internal link r"|\]\]" + #Closing internal link r"|\{\{" + #Opening template r"|\}\}" + #Closing template r"|\{\{\{" + #Opening template var r"|\}\}\}" + #Closing template var r"|\n+" + #Line breaks r"| +" + ...
2,629
71cad833ced8acb4a2bb9fa583ccdb3f
swh:1:cnt:7635d7dc14bf20739633f7e22ea1a754a8c0d151;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=68-84/
9d61a70b7f2bd7ed076f603a21d008f1c817bd8d
wikihadoop
analytics
python/revision_differ.py
simpleDiff(content1, content2, tokenize=tokenize, sep='', report=[-1,0,1])
function
def simpleDiff(content1, content2, tokenize=tokenize, sep='', report=[-1,0,1]): hashes1, h2t, t2h = hashTokens(tokenize(content1)) hashes2, h2t, t2h = hashTokens(tokenize(content2), h2t, t2h) report = set(report) dmp = diff_match_patch() diffs = dmp.diff_main(hashes1, hashes2, checklines=False) position =...
2,630
977cb9f688f837f91d4199189d6c5898
swh:1:cnt:7635d7dc14bf20739633f7e22ea1a754a8c0d151;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=65-66/
9d61a70b7f2bd7ed076f603a21d008f1c817bd8d
wikihadoop
analytics
python/revision_differ.py
unhash(hashes, hash2Token, sep='')
function
def unhash(hashes, hash2Token, sep=''): return sep.join(hash2Token[ord(h)-1] for h in hashes)
2,631
033539da6bd4298f780f8b6a61e053fe
swh:1:cnt:7635d7dc14bf20739633f7e22ea1a754a8c0d151;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=52-63/
9d61a70b7f2bd7ed076f603a21d008f1c817bd8d
wikihadoop
analytics
python/revision_differ.py
hashTokens(tokens, hash2Token=[], token2Hash={})
function
def hashTokens(tokens, hash2Token=[], token2Hash={}): hashBuffer = StringIO() for t in tokens: if t in token2Hash: hashBuffer.write(unichr(token2Hash[t]+1)) else: hashId = len(hash2Token) hash2Token.append(t) token2Hash[t] = hashId hashBuffer.write(unichr(hashId+1)) return (hashBuffer.getvalue(...
2,632
76ace7d1acb85bee07d7929e5716ab49
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=5-61/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper
type
class FileWrapper: def __init__(self, fp, pre='', post=''): self.fp = fp self.pre = StringIO(pre) self.post = StringIO(post) self.closed = False self.mode = "r" def read(self, bytes=sys.maxint): bytes = int(bytes) if self.closed: raise ValueError("I/O operation on closed file") preB...
2,633
019c2e03ae9e2eb97772889ef288585d
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=63-80/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
RecordingFileWrapper
type
class RecordingFileWrapper(FileWrapper): def __init__(self, fp, pre='', post='', record=10000): self.history = deque(maxlen=record) FileWrapper.__init__(self, fp, pre=pre, post=post) def read(self, bytes=sys.maxint): outBytes = FileWrapper.read(self, bytes) self.history.extend(outBytes) return outBytes ...
2,634
2ac4f07ef1528367aa7fe8df4637867a
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=7-12/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::__init__(self, fp, pre='', post='')
function
def __init__(self, fp, pre='', post=''): self.fp = fp self.pre = StringIO(pre) self.post = StringIO(post) self.closed = False self.mode = "r"
2,635
524439182b8b1af27008d600b4196642
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=42-42/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::readlines(self)
function
def readlines(self): raise NotImplementedError()
2,636
a989dd7e549982ea124be65c2448529b
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=52-52/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::seek(self)
function
def seek(self): raise NotImplementedError()
2,637
beadd42457b0a030e723a16c66c75839
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=54-54/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::writelines(self)
function
def writelines(self): raise NotImplementedError()
2,638
8626e7b3df28c38e7f31673b47f66bb0
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=65-67/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
RecordingFileWrapper::__init__(self, fp, pre='', post='', record=10000)
function
def __init__(self, fp, pre='', post='', record=10000): self.history = deque(maxlen=record) FileWrapper.__init__(self, fp, pre=pre, post=post)
2,639
5d8bf45c090d91f91c9af7a5fbb2e357
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=44-49/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::__iter__(self)
function
def __iter__(self): line = self.readline() while line != '': yield line line = self.readline()
2,640
6cdd1fdc6a8acd4025ca9d1da924cba0
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=14-29/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::read(self, bytes=sys.maxint)
function
def read(self, bytes=sys.maxint): bytes = int(bytes) if self.closed: raise ValueError("I/O operation on closed file") preBytes = self.pre.read(bytes) if len(preBytes) < bytes: fpBytes = self.fp.read(bytes-len(preBytes)) else: fpBytes = '' if len(preBytes) + len(fpBytes) < bytes: postBytes = ...
2,641
6d250f5fa80afc8848cbe21c43624e08
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=31-40/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::readline(self)
function
def readline(self): if self.closed: raise ValueError("I/O operation on closed file") output = self.pre.readline() if len(output) == 0 or output[-1] != "\n": output += self.fp.readline() if len(output) == 0 or output[-1] != "\n": output += self.post.readline() return output
2,642
8742ee4d92cf66835f0669379e65afea
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=53-53/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::write(self)
function
def write(self): raise NotImplementedError()
2,643
3cfe19bb5d06e9e126b80492ae48a8a8
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=55-56/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::tell(self)
function
def tell(self): return self.pre.tell() + self.fp.tell() + self.post.tell()
2,644
0869055807fa71979b4282d87276b978
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=59-61/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
FileWrapper::close(self)
function
def close(self): self.closed = True self.fp.close()
2,645
01609c100e1a804fdb1259f9de105170
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=69-72/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
RecordingFileWrapper::read(self, bytes=sys.maxint)
function
def read(self, bytes=sys.maxint): outBytes = FileWrapper.read(self, bytes) self.history.extend(outBytes) return outBytes
2,646
20b9b21b14fce730c36e9f9533761d96
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=74-77/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
RecordingFileWrapper::readline(self)
function
def readline(self): outBytes = FileWrapper.readline(self) self.history.extend(outBytes) return outBytes
2,647
f2c05f63a7129da4821636aa8302d20f
swh:1:cnt:9752f5d4ba80fe276139ac2350543bf18f410f49;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=79-80/
edc71cf95bca77b163d7d4b3522e5e6bf9c20eb2
wikihadoop
analytics
python/xml_simulator.py
RecordingFileWrapper::getHistory(self)
function
def getHistory(self): return ''.join(self.history)
2,648
ff1608dfb8b47c6e2452bdfdeb0e1cad
swh:1:cnt:485dc59120e35bcdbb95b7dc811abecbad023a26;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=24-87/
2dabbe0a61ccf0e31564fefadda5eef2d70dab0a
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/ByteMatcher.java
ByteMatcher
type
public class ByteMatcher { private final InputStream in; private final Seekable pos; private long lastPos; private long currentPos; private long bytes; public ByteMatcher(InputStream in, Seekable pos) throws IOException { this.in = in; this.pos = pos; this.bytes = 0; this.lastPos = -1; t...
2,649
04f7ff80bf31640dad1d56851cfa8c70
swh:1:cnt:485dc59120e35bcdbb95b7dc811abecbad023a26;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=40-42/
2dabbe0a61ccf0e31564fefadda5eef2d70dab0a
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/ByteMatcher.java
ByteMatcher::getReadBytes()
function
public long getReadBytes() { return this.bytes; }
2,650
1b8d53f201ad7d2aad7225fe1e361daa
swh:1:cnt:485dc59120e35bcdbb95b7dc811abecbad023a26;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=46-46/
2dabbe0a61ccf0e31564fefadda5eef2d70dab0a
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/ByteMatcher.java
ByteMatcher::getLastUnmatchPos()
function
public long getLastUnmatchPos() { return this.lastPos; }
2,651
87de636e8bb9d6eae2d3edb867f8d34e
swh:1:cnt:485dc59120e35bcdbb95b7dc811abecbad023a26;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=48-51/
2dabbe0a61ccf0e31564fefadda5eef2d70dab0a
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/ByteMatcher.java
ByteMatcher::skip(long len)
function
public void skip(long len) throws IOException { this.in.skip(len); this.bytes += len; }
2,652
52bd85d26013aaf08405a00641144421
swh:1:cnt:485dc59120e35bcdbb95b7dc811abecbad023a26;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=53-86/
2dabbe0a61ccf0e31564fefadda5eef2d70dab0a
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/ByteMatcher.java
ByteMatcher::readUntilMatch(String textPat, DataOutputBuffer outBufOrNull, long end)
function
boolean readUntilMatch(String textPat, DataOutputBuffer outBufOrNull, long end) throws IOException { byte[] match = textPat.getBytes("UTF-8"); int i = 0; while (true) { int b = this.in.read(); // end of file: if (b == -1) { System.err.println("eof 1"); return false; }...
2,653
9fd12897f08dc7ac53a408ce0da23df5
swh:1:cnt:485dc59120e35bcdbb95b7dc811abecbad023a26;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=43-45/
2dabbe0a61ccf0e31564fefadda5eef2d70dab0a
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/ByteMatcher.java
ByteMatcher::getPos()
function
public long getPos() throws IOException { return this.pos.getPos(); }
2,654
9adc1a870d098a7922966089d8f17777
swh:1:cnt:e5d4eba4b36a8bf14b22bbc19db79b76e03df620;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=28-81/
296393dee034343d0b0c8688e67a630875e1bea5
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/SeekableInputStream.java
SeekableInputStream
type
public class SeekableInputStream extends FilterInputStream implements Seekable { private final Seekable seek; private final SplitCompressionInputStream sin; public SeekableInputStream(FSDataInputStream in) { super(in); this.seek = in; this.sin = null; } public SeekableInputStream(SplitCompressionI...
2,655
cd2c28c6b853a802245fa09431d12b42
swh:1:cnt:e5d4eba4b36a8bf14b22bbc19db79b76e03df620;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=46-70/
296393dee034343d0b0c8688e67a630875e1bea5
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/SeekableInputStream.java
SeekableInputStream::getInstance(Path path, long start, long end, FileSystem fs, CompressionCodecFactory compressionCodecs)
function
public static SeekableInputStream getInstance(Path path, long start, long end, FileSystem fs, CompressionCodecFactory compressionCodecs) throws IOException { CompressionCodec codec = compressionCodecs.getCodec(path); FSDataInputStream din = fs.open(path); if (codec != null) { Decompressor decompressor...
2,656
f7f54d2add8cc50d99ab15428f8e709f
swh:1:cnt:e5d4eba4b36a8bf14b22bbc19db79b76e03df620;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=74-74/
296393dee034343d0b0c8688e67a630875e1bea5
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/SeekableInputStream.java
SeekableInputStream::getSplitCompressionInputStream()
function
public SplitCompressionInputStream getSplitCompressionInputStream() { return this.sin; }
2,657
d4bbb09f20ede71e26d3b4060fdd2e05
swh:1:cnt:e5d4eba4b36a8bf14b22bbc19db79b76e03df620;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=76-76/
296393dee034343d0b0c8688e67a630875e1bea5
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/SeekableInputStream.java
SeekableInputStream::seek(long pos)
function
public void seek(long pos) throws IOException { this.seek.seek(pos); }
2,658
8a4b08aa63fedcad2f7cf4ed4c76cad6
swh:1:cnt:e5d4eba4b36a8bf14b22bbc19db79b76e03df620;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=75-75/
296393dee034343d0b0c8688e67a630875e1bea5
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/SeekableInputStream.java
SeekableInputStream::getPos()
function
public long getPos() throws IOException { return this.seek.getPos(); }
2,659
171d760d798f03380ed9770bdbaf30c1
swh:1:cnt:e5d4eba4b36a8bf14b22bbc19db79b76e03df620;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=71-73/
296393dee034343d0b0c8688e67a630875e1bea5
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/SeekableInputStream.java
SeekableInputStream::getInstance(FileSplit split, FileSystem fs, CompressionCodecFactory compressionCodecs)
function
public static SeekableInputStream getInstance(FileSplit split, FileSystem fs, CompressionCodecFactory compressionCodecs) throws IOException { return getInstance(split.getPath(), split.getStart(), split.getStart() + split.getLength(), fs, compressionCodecs); }
2,660
eec0791a2ccdb1cfe1132e91db0bfb8e
swh:1:cnt:e5d4eba4b36a8bf14b22bbc19db79b76e03df620;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=77-77/
296393dee034343d0b0c8688e67a630875e1bea5
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/SeekableInputStream.java
SeekableInputStream::seekToNewSource(long targetPos)
function
public boolean seekToNewSource(long targetPos) throws IOException { return this.seek.seekToNewSource(targetPos); }
2,661
63dd84849e68524f4de906dc17e927e8
swh:1:cnt:e5d4eba4b36a8bf14b22bbc19db79b76e03df620;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=78-80/
296393dee034343d0b0c8688e67a630875e1bea5
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/SeekableInputStream.java
SeekableInputStream::toString()
function
@Override public String toString() { return this.in.toString(); }
2,662
01aaa689597507b7b12a5fdb1dae48d4
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=37-590/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat
type
/** A InputFormat implementation that splits a Wikimedia Dump File into page fragments, and emits them as input records. * The record reader embedded in this input format converts a page into a sequence of page-like elements, each of which contains two consecutive revisions. Output is given as keys with empty values....
2,663
340a579eebe993e3479d288dcd315536
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=584-586/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::WikiDumpCounters
type
private static enum WikiDumpCounters { FOUND_PAGES, WRITTEN_REVISIONS, WRITTEN_PAGES, SKIPPED_PAGES }
2,664
9329db8c6aef6701ba488a5329ae763d
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=285-488/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader
type
private class MyRecordReader implements RecordReader<Text,Text> { public MyRecordReader(FileSplit split, Reporter reporter, JobConf job, FileSystem fs, Pattern exclude, boolean prev) throws IOException { this.revisionBeginPattern = "<revision"; th...
2,665
27b9466e569404453a5c7bd1265a7a90
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=173-176/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::makeSplit(Path path, long start, long size, NetworkTopology clusterMap, BlockLocation[] blkLocations)
function
private FileSplit makeSplit(Path path, long start, long size, NetworkTopology clusterMap, BlockLocation[] blkLocations) throws IOException { return makeSplit(path, start, size, getSplitHosts(blkLocations, start, size, clusterMap)); }
2,666
a8eab9b38c92e5cdac6ea482f55288da
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=351-353/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::getReadBytes()
function
public synchronized long getReadBytes() throws IOException { return this.matcher.getReadBytes(); }
2,667
b206649ad4e75316a6bd1a36b53163f1
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=490-502/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::writeInSequence(DataOutputBuffer[] array)
function
private static byte[] writeInSequence(DataOutputBuffer[] array) { int size = 0; for (DataOutputBuffer buf: array) { size += buf.getLength(); } byte[] dest = new byte[size]; int n = 0; for (DataOutputBuffer buf: array) { System.arraycopy(buf.getData(), 0, dest, n, buf.getLength()); ...
2,668
a2041eb98a78460b1ad0e7900c97f364
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=454-466/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::prevPageEnd()
function
private long prevPageEnd() { if ( this.currentPageNum == 0 ) { if ( this.pageBytes.size() > 0 ) { return this.pageBytes.get(0); } else { return 0; } } else if ( this.currentPageNum * 2 - 1 <= this.pageBytes.size() - 1 ) { return this.pageBytes.get(this.cur...
2,669
16ac9b2a39967c5b0496cd3526505a4f
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=560-562/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::allWrite(DataOutputBuffer to, DataOutputBuffer from)
function
private static void allWrite(DataOutputBuffer to, DataOutputBuffer from) throws IOException { offsetWrite(to, 0, from); }
2,670
421de85746d2602a4ce222b18b221b4d
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=124-126/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::configure(JobConf conf)
function
public void configure(JobConf conf) { this.compressionCodecs = new CompressionCodecFactory(conf); }
2,671
e5aad3acc5913651700ff9d3879ca455
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=178-267/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::getSplits(JobConf job, FileStatus file, String pattern, long splitSize)
function
public List<InputSplit> getSplits(JobConf job, FileStatus file, String pattern, long splitSize) throws IOException { NetworkTopology clusterMap = new NetworkTopology(); List<InputSplit> splits = new ArrayList<InputSplit>(); Path path = file.getPath(); long length = file.getLen(); FileSystem fs = fil...
2,672
91da3dbffbb0de7cb5b8a1e342b0e7a7
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=355-427/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::next(Text key, Text value)
function
@Override synchronized public boolean next(Text key, Text value) throws IOException { //LOG.info("StreamWikiDumpInputFormat: split=" + split + " start=" + this.start + " end=" + this.end + " pos=" + this.getPos()); while (true) { if ( this.nextPageBegin() < 0 ) { return false; } ...
2,673
b06c5a0eedcb373395965ee62cd3abcb
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=504-508/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::getBuffer(byte[] bytes)
function
private static DataOutputBuffer getBuffer(byte[] bytes) throws IOException { DataOutputBuffer ret = new DataOutputBuffer(bytes.length); ret.write(bytes); return ret; }
2,674
cb019744e7d91048f97a9d5a274a7cbd
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=564-582/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::findIndex(byte[] match, DataOutputBuffer from_)
function
private static int findIndex(byte[] match, DataOutputBuffer from_) throws IOException { // TODO: faster string pattern match (KMP etc) int m = 0; int i; byte[] from = from_.getData(); for ( i = 0; i < from_.getLength(); ++i ) { if ( from[i] == match[m] ) { ++m; } else { m...
2,675
656180cef776cb7647227559b3eb63c9
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=269-283/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::getRecordReader(final InputSplit genericSplit, JobConf job, Reporter reporter)
function
public RecordReader<Text, Text> getRecordReader(final InputSplit genericSplit, JobConf job, Reporter reporter) throws IOException { // handling non-standard record reader (likely StreamXmlRecordReader) FileSplit split = (FileSplit) genericSplit; LOG.info("g...
2,676
ef4bf9b76635e1ce740af5177b4d67be
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=429-434/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::seekNextRecordBoundary()
function
public synchronized void seekNextRecordBoundary() throws IOException { if ( this.getReadBytes() < this.nextPageBegin() ) { long len = this.nextPageBegin() - this.getReadBytes(); this.matcher.skip(len); } }
2,677
b898b746b00513f5183adc145504916d
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=440-446/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::tailPageEnd()
function
private long tailPageEnd() { if ( this.pageBytes.size() > 0 ) { return this.pageBytes.get(this.pageBytes.size() - 1); } else { return 0; } }
2,678
8e09e10ec75b263e8ef05d12347e90f8
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=435-439/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::readUntilMatch(String textPat, DataOutputBuffer outBufOrNull)
function
private synchronized boolean readUntilMatch(String textPat, DataOutputBuffer outBufOrNull) throws IOException { if ( outBufOrNull != null ) outBufOrNull.reset(); return this.matcher.readUntilMatch(textPat, outBufOrNull, this.end); }
2,679
69100d1d22fb25c8d9932830e37385f5
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=447-453/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::nextPageBegin()
function
private long nextPageBegin() { if ( (this.currentPageNum + 1) * 2 < this.pageBytes.size() ) { return this.pageBytes.get((this.currentPageNum + 1) * 2); } else { return -1; } }
2,680
2327a28986cc9de702cff4f407e53501
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=136-170/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::getSplits(JobConf job, int numSplits)
function
/** * Generate the list of files and make them into FileSplits. * @param job the job context * @throws IOException */ @Override public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { LOG.info("StreamWikiDumpInputFormat.getSplits job=" + job + " n=" + numSplits); InputSplit...
2,681
dce06e0a331d331aceba26091d913218
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=128-134/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::isSplitable(FileSystem fs, Path file)
function
protected boolean isSplitable(FileSystem fs, Path file) { final CompressionCodec codec = compressionCodecs.getCodec(file); if (null == codec) { return true; } return codec instanceof SplittableCompressionCodec; }
2,682
d31f893bd13e43403c35244b5fa9ef0f
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=329-331/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::createValue()
function
@Override public Text createValue() { return new Text(); }
2,683
e1864297db5571141aab50ef7746e278
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=337-345/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::getProgress()
function
@Override public float getProgress() throws IOException { float rate = 0.0f; if (this.end == this.start) { rate = 1.0f; } else { rate = ((float)(this.getPos() - this.start)) / ((float)(this.end - this.start)); } return rate; }
2,684
4e096fe1f6abfde04db47e93cfd5ed29
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=325-327/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::createKey()
function
@Override public Text createKey() { return new Text(); }
2,685
332592e5570f6f92b6c3e2cf602a2e27
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=333-335/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::close()
function
@Override public void close() throws IOException { this.istream.close(); }
2,686
804024faf30f1eb6a7a95536821d02e2
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=347-349/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::MyRecordReader::getPos()
function
@Override public long getPos() throws IOException { return this.matcher.getPos(); }
2,687
8bade4a0955f6915499359e45a85a507
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=510-549/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::getPageBytes(FileSplit split, FileSystem fs, CompressionCodecFactory compressionCodecs, Reporter reporter)
function
private static List<Long> getPageBytes(FileSplit split, FileSystem fs, CompressionCodecFactory compressionCodecs, Reporter reporter) throws IOException { SeekableInputStream in = null; try { in = SeekableInputStream.getInstance(split, fs, compressionCodecs); long start = split.getStart(); long...
2,688
2aeaa6922612db1503226f281b7f54fb
swh:1:cnt:57c1be5c2c35377c9ab883dd13555ebd12274ddc;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=551-559/
ca9f25856f31d2b5edbf3df58cf58a4260efdbaa
wikihadoop
analytics
src/main/java/org/wikimedia/wikihadoop/oldapi/StreamWikiDumpInputFormat.java
StreamWikiDumpInputFormat::offsetWrite(DataOutputBuffer to, int fromOffset, DataOutputBuffer from)
function
private static void offsetWrite(DataOutputBuffer to, int fromOffset, DataOutputBuffer from) throws IOException { if ( from.getLength() <= fromOffset || fromOffset < 0 ) { throw new IllegalArgumentException(String.format("invalid offset: offset=%d length=%d", fromOffset, from.getLength())); } byte[] by...
2,689
43125194d81258756ae2da7127cde955
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=45-502/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat
type
public class TestStreamWikiDumpInputFormat { private static Configuration conf = new Configuration(); @Test public void testFormatWithNoPreviousRevision() throws IOException { JobConf job = new JobConf(conf); FileSystem fs = FileSystem.getLocal(conf); Path dir = new Path(System.getProperty("test.bui...
2,690
345a8c8032e791c5d8fedd6d565851b0
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=152-154/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::bzip2(byte[] bytes)
function
private static byte[] bzip2(byte[] bytes) throws IOException { return bzip2(bytes, 1); }
2,691
440a0de20b77c36801230147ca67d41e
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=346-379/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::testFormatWithCompressed()
function
@Test public void testFormatWithCompressed() throws IOException { JobConf job = new JobConf(conf); FileSystem fs = FileSystem.getLocal(conf); Path dir = new Path(System.getProperty("test.build.data", ".") + "/mapred"); Path txtFile = new Path(dir, "auto.bz2"); fs.delete(dir, true); StreamWik...
2,692
1595136680c01be1777ef2aef9eb02bf
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=411-413/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::getStderrReporter::getCounter(Enum<?> name)
function
@Override public Counters.Counter getCounter(Enum<?> name) { return null; }
2,693
cb99d032df2b86b6b7a8988fd29c7a9d
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=155-162/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::bzip2(byte[] bytes, int bsize)
function
private static byte[] bzip2(byte[] bytes, int bsize) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); CBZip2OutputStream c = new CBZip2OutputStream(os, bsize); c.write(bytes); c.finish(); c.flush(); return os.toByteArray(); }
2,694
38321fa37ed707f0f2bf1cbf11317716
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=381-383/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::collect(FileInputFormat<Text,Text> format, JobConf job, int n)
function
private static List<String> collect(FileInputFormat<Text,Text> format, JobConf job, int n) throws IOException { return collect(format, job, n, getStderrReporter()); }
2,695
4b0b525a9f5b4d06d9fd254963e5f3fb
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=414-416/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::getStderrReporter::getCounter(String group, String name)
function
@Override public Counters.Counter getCounter(String group, String name) { return null; }
2,696
e3607e668682a78a4e4a12989a69c9bb
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=87-117/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::testFormatIgnorePattern()
function
@Test public void testFormatIgnorePattern() throws IOException { JobConf job = new JobConf(conf); FileSystem fs = FileSystem.getLocal(conf); Path dir = new Path(System.getProperty("test.build.data", ".") + "/mapred"); Path txtFile = new Path(dir, "auto.txt"); fs.delete(dir, true); StreamWiki...
2,697
680e115c22e85b09e73a756c768a843b
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=258-270/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::count(String str, String patt)
function
private static int count(String str, String patt) { int lastIndex = 0; int count =0; while(lastIndex != -1){ lastIndex = str.indexOf(patt,lastIndex); if( lastIndex != -1){ lastIndex += patt.length(); ++count; } } return count; }
2,698
da864bebb22500e6a508bfa1eafcc218
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=417-419/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::getStderrReporter::incrCounter(Enum<?> key, long amount)
function
@Override public void incrCounter(Enum<?> key, long amount) { //System.err.println(key.toString() + " is incremented by " + amount); }
2,699
429980ef38e2aff0141a7b5c3e0ab1bf
swh:1:cnt:056524533fe2f7e65bb99654cecd456f2c796973;origin=https://gerrit.wikimedia.org/r/analytics/wikihadoop.git;lines=119-150/
92f86bf6bec3fd304432042854e3fcdc5b6a3a25
wikihadoop
analytics
src/test/java/org/wikimedia/wikihadoop/TestStreamWikiDumpInputFormat.java
TestStreamWikiDumpInputFormat::testFormatWithOneSplitUncompressedFragmentsAndSpaces()
function
@Test public void testFormatWithOneSplitUncompressedFragmentsAndSpaces() throws IOException { JobConf job = new JobConf(conf); FileSystem fs = FileSystem.getLocal(conf); Path dir = new Path(System.getProperty("test.build.data", ".") + "/mapred"); Path txtFile = new Path(dir, "auto.txt"); fs.del...