prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | if arch == ARCH_32:
d = x86.i386Disasm()
elif arch == ARCH_64:
d = x64.Amd64Disasm()
else:
raise RuntimeError('unknown arch: ' + str(arch))
offset = 0
while True:
if offset >= len(buf):
break
o = d.disasm(buf, offset, base)
yield "0x%x: %s... |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | def __init__(self, C):
vstruct.VArray.__init__(self)
self._C = C
def vsParse(self, bytez, offset=0, fast=False):
soffset = offset
while offset < len(bytez):
c = self._C()
try:
offset = c.vsParse(bytez, offset=offset, fast=False)
... |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | vstruct.VArray.__init__(self)
self._C = C |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | soffset = offset
while offset < len(bytez):
c = self._C()
try:
offset = c.vsParse(bytez, offset=offset, fast=False)
except:
break
self.vsAddElement(c)
return offset |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | raise NotImplementedError() |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | ps = GreedyVArray(sdb.PATCHBITS)
ps.vsParse(bits.value.value)
for i, _ in ps:
p = ps[int(i)]
print(" opcode: %s" % str(p["opcode"]))
print(" module name: %s" % p.module_name)
print(" rva: 0x%08x" % p.rva)
print(" unk: 0x%08x" % p.unknown)
print(" paylo... |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | from sdb import SDB
with open(sdb_path, "rb") as f:
buf = f.read()
g_logger.debug("loading database")
s = SDB()
s.vsParse(bytearray(buf))
g_logger.debug("done loading database")
index = SdbIndex()
g_logger.debug("indexing strings")
index.index_sdb(s)
g_logger.debug("don... |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | import sys
return sys.exit(_main(*sys.argv[1:])) |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | d = x86.i386Disasm() |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | d = x64.Amd64Disasm() |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | raise RuntimeError('unknown arch: ' + str(arch)) |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | break |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | for shim_ref in item_get_children(library, SDB_TAGS.TAG_SHIM_REF):
patch = item_get_child(shim_ref, SDB_TAGS.TAG_PATCH)
name_ref = item_get_child(patch, SDB_TAGS.TAG_NAME)
name = index.get_string(name_ref.value.reference)
if name != patch_name:
con... |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | continue |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | name_ref = item_get_child(patch, SDB_TAGS.TAG_NAME)
name = index.get_string(name_ref.value.reference)
if name == patch_name:
bits = item_get_child(patch, SDB_TAGS.TAG_PATCH_BITS)
dump_patch(bits, arch=ARCH_32) |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | bits = item_get_child(patch, SDB_TAGS.TAG_PATCH_BITS)
dump_patch(bits, arch=ARCH_32) |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | main() |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | disassemble |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | __init__ |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | vsParse |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | vsParseFd |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | dump_patch |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | _main |
<|file_name|>sdb_dump_patch.py<|end_file_name|><|fim▁begin|>import sys
import logging
import hexdump
import vstruct
import vivisect
import envi
import envi.archs.i386 as x86
import envi.archs.amd64 as x64
import sdb
from sdb import SDB_TAGS
from sdb_dump_common import SdbIndex
from sdb_dump_common import item_get_chi... | main |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|># lint-amnesty, pylint: disable=missing-module-docstring
from unittest.mock import patch
from django.test import TestCase
from common.djangoapps.track.backends.mongodb import MongoBackend
<|fim▁hole|>class TestMongoBackend(TestCase): # lint-amnesty, pylint: ... | |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|># lint-amnesty, pylint: disable=missing-module-docstring
from unittest.mock import patch
from django.test import TestCase
from common.djangoapps.track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=mis... | def setUp(self):
super().setUp()
self.mongo_patcher = patch('common.djangoapps.track.backends.mongodb.MongoClient')
self.mongo_patcher.start()
self.addCleanup(self.mongo_patcher.stop)
self.backend = MongoBackend()
def test_mongo_backend(self):
events = [{'test':... |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|># lint-amnesty, pylint: disable=missing-module-docstring
from unittest.mock import patch
from django.test import TestCase
from common.djangoapps.track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=mis... | super().setUp()
self.mongo_patcher = patch('common.djangoapps.track.backends.mongodb.MongoClient')
self.mongo_patcher.start()
self.addCleanup(self.mongo_patcher.stop)
self.backend = MongoBackend() |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|># lint-amnesty, pylint: disable=missing-module-docstring
from unittest.mock import patch
from django.test import TestCase
from common.djangoapps.track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=mis... | events = [{'test': 1}, {'test': 2}]
self.backend.send(events[0])
self.backend.send(events[1])
# Check if we inserted events into the database
calls = self.backend.collection.insert.mock_calls
assert len(calls) == 2
# Unpack the arguments and check if the even... |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|># lint-amnesty, pylint: disable=missing-module-docstring
from unittest.mock import patch
from django.test import TestCase
from common.djangoapps.track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=mis... | _, args, _ = call
return args[0] |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|># lint-amnesty, pylint: disable=missing-module-docstring
from unittest.mock import patch
from django.test import TestCase
from common.djangoapps.track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=mis... | setUp |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|># lint-amnesty, pylint: disable=missing-module-docstring
from unittest.mock import patch
from django.test import TestCase
from common.djangoapps.track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=mis... | test_mongo_backend |
<|file_name|>test_mongodb.py<|end_file_name|><|fim▁begin|># lint-amnesty, pylint: disable=missing-module-docstring
from unittest.mock import patch
from django.test import TestCase
from common.djangoapps.track.backends.mongodb import MongoBackend
class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=mis... | first_argument |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | def tearDown(self):
crypto._fernet = None
@conf_vars({('core', 'fernet_key'): ''}) |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | def setUp(self):
crypto._fernet = None
def tearDown(self):
crypto._fernet = None
@conf_vars({('core', 'fernet_key'): ''})
def test_variable_no_encryption(self):
"""
Test variables without encryption
"""
Variable.set('key', 'value')
session = sett... |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | crypto._fernet = None |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | crypto._fernet = None |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | """
Test variables without encryption
"""
Variable.set('key', 'value')
session = settings.Session()
test_var = session.query(Variable).filter(Variable.key == 'key').one()
self.assertFalse(test_var.is_encrypted)
self.assertEqual(test_var.val, 'value') |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | """
Test variables with encryption
"""
Variable.set('key', 'value')
session = settings.Session()
test_var = session.query(Variable).filter(Variable.key == 'key').one()
self.assertTrue(test_var.is_encrypted)
self.assertEqual(test_var.val, 'value') |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | """
Tests rotating encrypted variables.
"""
key1 = Fernet.generate_key()
key2 = Fernet.generate_key()
with conf_vars({('core', 'fernet_key'): key1.decode()}):
Variable.set('key', 'value')
session = settings.Session()
test_var = session... |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | setUp |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | tearDown |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | test_variable_no_encryption |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | test_variable_with_encryption |
<|file_name|>test_variable.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | test_var_with_encryption_rotate_fernet_key |
<|file_name|>cpg_gene.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Purpose:
This script, using default values, determines and plots the CpG islands in
relation to a given feature "type" (e.g. "gene" or "mRNA") from a GFF file
which corresponds to the user-provided fasta file.<|fim▁hole|>
Note:
CpG Islan... | |
<|file_name|>cpg_gene.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Purpose:
This script, using default values, determines and plots the CpG islands in
relation to a given feature "type" (e.g. "gene" or "mRNA") from a GFF file
which corresponds to the user-provided fasta file.
Note:
CpG Islands are dete... | LineArgs = cpgmod.parseArguments() |
<|file_name|>cpg_gene.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Purpose:
This script, using default values, determines and plots the CpG islands in
relation to a given feature "type" (e.g. "gene" or "mRNA") from a GFF file
which corresponds to the user-provided fasta file.
Note:
CpG Islands are dete... | ObEx = (Rec.observ() / Rec.expect())
Cond2 = ObEx > ObExthresh
Cond3 = Rec.gc_cont() > GCthresh
if Cond2 and Cond3:
# Query GFF DB for closest gene feature *or provided feature*
Arr = cpgmod.get_closest(Rec, GffDb, StartRange, FeatGFF, ID_Feat)
if Arr... |
<|file_name|>cpg_gene.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Purpose:
This script, using default values, determines and plots the CpG islands in
relation to a given feature "type" (e.g. "gene" or "mRNA") from a GFF file
which corresponds to the user-provided fasta file.
Note:
CpG Islands are dete... | Arr = cpgmod.get_closest(Rec, GffDb, StartRange, FeatGFF, ID_Feat)
if Arr <> False:
Arr.append(ObEx)
DistArr.append(Arr) |
<|file_name|>cpg_gene.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Purpose:
This script, using default values, determines and plots the CpG islands in
relation to a given feature "type" (e.g. "gene" or "mRNA") from a GFF file
which corresponds to the user-provided fasta file.
Note:
CpG Islands are dete... | Arr.append(ObEx)
DistArr.append(Arr) |
<|file_name|>cpg_gene.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Purpose:
This script, using default values, determines and plots the CpG islands in
relation to a given feature "type" (e.g. "gene" or "mRNA") from a GFF file
which corresponds to the user-provided fasta file.
Note:
CpG Islands are dete... | print "WARNING, "+ str(len(DistArr)) + " sites were found."
print "Consider changing parameters.\n" |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependency p... | |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
<|fim_middle|>
SYNTAX_ITERATORS = {"noun_chunks":... | """
Detect base noun phrases from a dependency parse. Works on both Doc and Span.
"""
# fmt: off
labels = ["nsubj", "nsubj:pass", "obj", "iobj", "ROOT", "appos", "nmod", "nmod:poss"]
# fmt: on
doc = doclike.doc # Ensure works on both Doc and Span.
if not doc.has_annotation("DEP"):
... |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependency p... | raise ValueError(Errors.E029) |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependency p... | continue |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependency p... | continue |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependency p... | prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependency p... | head = word.head
while head.dep == conj and head.head.i < head.i:
head = head.head
# If the head is an NP, and we're coordinated to it, we're an NP
if head.dep in np_deps:
prev_end = word.right_edge.i
yield word.left_edge.i,... |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependency p... | prev_end = word.right_edge.i
yield word.left_edge.i, word.right_edge.i + 1, np_label |
<|file_name|>syntax_iterators.py<|end_file_name|><|fim▁begin|>from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def <|fim_middle|>(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""
Detect base noun phrases from a dependenc... | noun_chunks |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | the middle point of the window is moved to the value of median of the points in the window. The median filter is
most usefull for removal of spikes from the signal (single point, large amplitude errors). |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | can_be_applied = True
_steps = [
{
'class': Confirmation,
'title': 'Apply median filter',
'desc': 'Press Forward to apply Median Filter.',
},
]
description = """
Median filter is smoothing algorithm similar to the Savitzky-Golay, however instead of... |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | return "Median Filter" |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | if self.model.completed is not True:
raise VoltPyNotAllowed('Incomplete procedure.')
self.__perform(dataset) |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | for cd in dataset.curves_data.all():
yvec = cd.yVector
newyvec = medfilt(yvec)
dataset.updateCurve(self.model, cd, newyvec)
dataset.save() |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | self.__perform(self.model.dataset)
self.model.step = None
self.model.completed = True
self.model.save()
return True |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | raise VoltPyNotAllowed('Incomplete procedure.') |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | __str__ |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | apply |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | __perform |
<|file_name|>MedianFilter.py<|end_file_name|><|fim▁begin|>import numpy as np
from scipy.signal import medfilt
import manager.operations.method as method
from manager.operations.methodsteps.confirmation import Confirmation
from manager.exceptions import VoltPyNotAllowed
class MedianFilter(method.ProcessingMethod):
... | finalize |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | _name = 'afip.incoterm'
_description = 'Afip Incoterm'
afip_code = fields.Char(
'Code', required=True)
name = fields.Char(
'Name', required=True) |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | _name = 'afip.point_of_sale'
_description = 'Afip Point Of Sale'
prefix = fields.Char(
'Prefix'
)
sufix = fields.Char(
'Sufix'
)
type = fields.Selection([
('manual', 'Manual'),
('preprinted', 'Preprinted'),
('online', 'Online'),
# Agre... |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | if self.type == 'manual':
name = 'Manual'
elif self.type == 'preprinted':
name = 'Preimpresa'
elif self.type == 'online':
name = 'Online'
elif self.type == 'electronic':
name = 'Electronica'
if self.prefix:
name = '%s %s... |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | journal_document_class_ids = self.env[
'account.journal.afip_document_class'].search([
('journal_id.point_of_sale_id', '=', self.id)])
self.journal_document_class_ids = journal_document_class_ids |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | _name = 'afip.document_class'
_description = 'Afip Document Class'
name = fields.Char(
'Name', size=120)
doc_code_prefix = fields.Char(
'Document Code Prefix', help="Prefix for Documents Codes on Invoices \
and Account Moves. For eg. 'FA ' will build 'FA 0001-0000001' Document N... |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | _name = 'afip.document_letter'
_description = 'Afip Document letter'
name = fields.Char(
'Name', size=64, required=True)
afip_document_class_ids = fields.One2many(
'afip.document_class', 'document_letter_id', 'Afip Document Classes')
issuer_ids = fields.Many2many(
'afip.resp... |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | _name = 'afip.responsability'
_description = 'AFIP VAT Responsability'
name = fields.Char(
'Name', size=64, required=True)
code = fields.Char(
'Code', size=8, required=True)
active = fields.Boolean(
'Active', default=True)
issued_letter_ids = fields.Many2many(
'a... |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | _name = 'afip.document_type'
_description = 'AFIP document types'
name = fields.Char(
'Name', size=120, required=True)
code = fields.Char(
'Code', size=16, required=True)
afip_code = fields.Integer(
'AFIP Code', required=True)
active = fields.Boolean(
'Active', d... |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | name = 'Manual' |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | name = 'Preimpresa' |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | name = 'Online' |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | name = 'Electronica' |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | name = '%s %s' % (self.prefix, name) |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | name = '%s %s' % (name, self.sufix) |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | get_name |
<|file_name|>afip.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
... | get_journal_document_class_ids |
<|file_name|>io.py<|end_file_name|><|fim▁begin|>from karld.loadump import dump_dicts_to_json_file
from karld.loadump import ensure_dir
from karld.loadump import ensure_file_path_dir<|fim▁hole|>from karld.loadump import i_get_csv_data
from karld.loadump import is_file_csv
from karld.loadump import i_get_json_data
from... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... | "WeeklySchedule",
"AptSettings",
"CancelPatchJobRequest", |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
<|fim_middle|>
def make_post(with_comments=True, with_author=True, with_keywords=True):
comments = [make_comment() for _ in range(2)] if with_comments else []
... | return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | comments = [make_comment() for _ in range(2)] if with_comments else []
keywords = [make_keyword() for _ in range(3)] if with_keywords else []
author = make_author() if with_author else None
return Post(
id=fake.random_int(),
title=fake.catch_phrase(),
author=author,
autho... |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | author = make_author() if with_author else None
return Comment(id=fake.random_int(), body=fake.bs(), author=author) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | return Keyword(keyword=fake.domain_word()) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | return make_author() |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | return [make_author() for _ in range(3)] |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | return [make_comment() for _ in range(3)] |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | return make_post() |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | return make_post(with_comments=False) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|>import pytest
from tests.base import Author, Post, Comment, Keyword, fake
def make_author():
return Author(
id=fake.random_int(),
first_name=fake.first_name(),
last_name=fake.last_name(),
twitter=fake.domain_word(),
)
def... | return make_post(with_author=False) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.