query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns the total number of male, female and unknown sources for all articles written by male authors only, grouped by outlet. | def male_author_sources(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def female_author_sources(args: Dict[str, Any]) -> List[object]:\n query = [\n {\n \"$match\": {\n \"body\": {\"$ne\": \"\"},\n \"quotesUpdated\": {\"$exists\": True},\n \"outlet\": {\"$in\": args[\"outlets\"]},\n \"publishedAt\": {\n... | [
"0.65447915",
"0.6158866",
"0.6048317",
"0.6032611",
"0.5955391",
"0.59325594",
"0.584644",
"0.5783226",
"0.5729507",
"0.56834257",
"0.56163013",
"0.5553626",
"0.5549774",
"0.55377823",
"0.53980654",
"0.53967756",
"0.5341202",
"0.53187984",
"0.5308738",
"0.5274333",
"0.527414... | 0.6587021 | 0 |
Returns the total number of male, female and unknown sources for all articles written by male AND female authors, grouped by outlet. | def mixed_author_sources(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def female_author_sources(args: Dict[str, Any]) -> List[object]:\n query = [\n {\n \"$match\": {\n \"body\": {\"$ne\": \"\"},\n \"quotesUpdated\": {\"$exists\": True},\n \"outlet\": {\"$in\": args[\"outlets\"]},\n \"publishedAt\": {\n... | [
"0.65459263",
"0.6491109",
"0.59819865",
"0.59221965",
"0.5895664",
"0.58715785",
"0.58367777",
"0.580773",
"0.5773821",
"0.55955595",
"0.5594667",
"0.5584815",
"0.55476844",
"0.55464107",
"0.55293185",
"0.53093433",
"0.52897954",
"0.5288902",
"0.52645856",
"0.5249333",
"0.52... | 0.59614384 | 3 |
Returns the total number of male, female and unknown sources for all articles written by unknown gender authors, grouped by outlet. | def unknown_author_sources(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"body": {"$ne": ""},
"quotesUpdated": {"$exists": True},
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def female_author_sources(args: Dict[str, Any]) -> List[object]:\n query = [\n {\n \"$match\": {\n \"body\": {\"$ne\": \"\"},\n \"quotesUpdated\": {\"$exists\": True},\n \"outlet\": {\"$in\": args[\"outlets\"]},\n \"publishedAt\": {\n... | [
"0.6367438",
"0.6265892",
"0.6182334",
"0.5956801",
"0.5853242",
"0.5787757",
"0.57282037",
"0.5727695",
"0.5711283",
"0.5670984",
"0.5612335",
"0.5521832",
"0.5512647",
"0.54933816",
"0.53121495",
"0.52898085",
"0.5269086",
"0.52452624",
"0.5233323",
"0.5219929",
"0.520154",... | 0.60098696 | 3 |
Returns the daily counts for articles published by each outlet between two specified dates | def daily_article_counts(args: Dict[str, Any]) -> List[object]:
query = [
{
"$match": {
"outlet": {"$in": args["outlets"]},
"publishedAt": {
"$gte": args["begin_date"],
"$lt": args["end_date"] + timedelta(days=1),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outlet_stats(args: Dict[str, Any]) -> List[object]:\n query = [\n {\n \"$match\": {\n \"body\": {\"$ne\": \"\"},\n \"quotesUpdated\": {\"$exists\": True},\n \"outlet\": {\"$in\": args[\"outlets\"]},\n \"publishedAt\": {\n ... | [
"0.6289571",
"0.615072",
"0.6117011",
"0.603978",
"0.58786905",
"0.5747146",
"0.5680999",
"0.5617395",
"0.56029195",
"0.55829245",
"0.5579136",
"0.5559607",
"0.5551197",
"0.5544807",
"0.5519936",
"0.5508556",
"0.546817",
"0.54621863",
"0.53908515",
"0.5376911",
"0.53611594",
... | 0.8119425 | 0 |
Prints exception and details in human readable form. You can specify IO stream object in `output` parameter. By default text is printed to standard output. | def print_exception(self, output=None):
if not output:
output = sys.stderr
text = u"stream failed. reason: %s\n" % self.message
text += u"exception: %s: \n" % self.exception.__class__.__name__
text += u"node: %s\n" % self.node
try:
text += u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _print_exception(self, s, e):\n \n # Output exception message\n sys.stdout.write(\"\\n{0}: {1} \\n\\n\".format(s, e))\n \n if self.model.debug:\n with open(self.logfile,'a') as f:\n f.write(\"\\n{0}: {1} \\n\\n\".format(s, e))",
"def print_exceptio... | [
"0.62906975",
"0.6251691",
"0.62405336",
"0.6206749",
"0.6202872",
"0.6147127",
"0.61255515",
"0.60808784",
"0.60314536",
"0.59662056",
"0.5931189",
"0.59250456",
"0.5917284",
"0.59140176",
"0.59088075",
"0.5900321",
"0.5894885",
"0.58672184",
"0.5854904",
"0.5840295",
"0.581... | 0.7543073 | 0 |
Creates a probeset which acts as multiprobe. `probes` should be a list of probes. | def __init__(self, probes=None):
super(ProbeSet, self).__init__()
self.probes = probes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_probes(base_path: Path, config: SectionProxy) -> List[Probe]:\n probes = []\n probes_path = resolve_path(base_path, config['probes_file'])\n probes_config = ConfigParser()\n found_files = probes_config.read(probes_path)\n if len(found_files) == 0:\n raise ConfigFileNotFound(\n ... | [
"0.56823057",
"0.5577413",
"0.5493009",
"0.5411468",
"0.52715063",
"0.5165909",
"0.49353126",
"0.48462152",
"0.47813573",
"0.45911404",
"0.45671707",
"0.45637053",
"0.45545438",
"0.45459583",
"0.45090252",
"0.44826382",
"0.4462405",
"0.44391167",
"0.43170765",
"0.42972097",
"... | 0.6866162 | 0 |
Probe the value in all of the probes. | def probe(self, value):
for probe in self.probes:
probe.probe(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probe(self):",
"def probe(self):\n return",
"def probes(self):\r\n return probes.Probes(self)",
"def probe(self) -> dict:\n result = {}\n for name, func in self._probes.items():\n result[name] = func()\n return result",
"def set_probe(self, probe: float = 1... | [
"0.66325283",
"0.6366462",
"0.61691785",
"0.6069871",
"0.57456434",
"0.5673926",
"0.558257",
"0.5505177",
"0.52197695",
"0.52027285",
"0.52027285",
"0.52027285",
"0.51894253",
"0.513183",
"0.5115917",
"0.5115917",
"0.5115266",
"0.5011102",
"0.49694473",
"0.4906507",
"0.480552... | 0.8462102 | 0 |
Return storage type if there is only one. This should always return a type in relational databases, but does not have to in databases such as MongoDB. | def unique_storage_type(self):
if len(self.storage_types) == 1:
return list(self.storage_types)[0]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_storage_type(self):\r\n\r\n if len(self.storage_types) == 1:\r\n return list(self.storage_types)[0]\r\n else:\r\n return None",
"def unique_storage_type(self):\r\n\r\n if len(self.storage_types) == 1:\r\n return list(self.storage_types)[0]\r\n ... | [
"0.84290254",
"0.84290254",
"0.81773037",
"0.81211674",
"0.81211674",
"0.81211674",
"0.79246795",
"0.771355",
"0.7289832",
"0.7134607",
"0.7115287",
"0.7115287",
"0.71080095",
"0.70176816",
"0.69720024",
"0.69720024",
"0.6906267",
"0.6888628",
"0.6732944",
"0.6709205",
"0.665... | 0.8422047 | 2 |
Return dictionary representation of receiver. | def dict(self):
d = {
"key": self.field,
"value_count": self.value_count,
"record_count": self.record_count,
"value_ratio": self.value_ratio,
"storage_types": list(self.storage_types),
"null_count": self.null_count,
"nul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\r\n return self.__dict__",
"def to_dict(self):\n return dict(self.__data)",
"def serial(self) -> dict:\n return self.__dict__",
"def to_dict(self):\n serialized = self._serializer().dump(self)\n return serialized.data",
"def serialize(self):\n\t\treturn... | [
"0.7523903",
"0.7510527",
"0.7484027",
"0.74640864",
"0.7463317",
"0.7425223",
"0.7425223",
"0.7425223",
"0.7425223",
"0.7425223",
"0.7425223",
"0.7421042",
"0.741364",
"0.7401137",
"0.7385774",
"0.7381785",
"0.7379748",
"0.7379748",
"0.7379748",
"0.7379748",
"0.7379748",
"... | 0.0 | -1 |
Delayed stream initialisation code. Subclasses might override this method to implement file or handle opening, connecting to a database, doing web authentication, ... By default this method does nothing. The method does not take any arguments, it expects preconfigured object. | def initialize(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__( self, stream=None ):\n if stream is not None:\n self.stream = stream\n else:\n self.stream = StringIO()",
"def __init__(self, stream):\n self.stream = stream",
"def __init__(self, stream):\n self.stream = stream",
"def __init__(self, test_stream... | [
"0.67841727",
"0.6696134",
"0.6696134",
"0.6654645",
"0.66326344",
"0.6596378",
"0.6553238",
"0.65332645",
"0.6488925",
"0.6476609",
"0.6466119",
"0.64401424",
"0.6327882",
"0.63227934",
"0.6243863",
"0.6241288",
"0.6241288",
"0.6234473",
"0.6204324",
"0.61781514",
"0.6177609... | 0.0 | -1 |
Abstrac class for data sources. | def __init__(self):
super(DataSource, self).__init__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_source(self, data_source):\n\n self._data_source = data_source",
"def init_sources(self):\n\n columns = ['some', 'column', 'headers']\n self.columns = columns\n\n self.data_source = ColumnDataSource(data=dict(zip(columns, []*len(columns))))",
"def data_source(self, **kwargs):\n... | [
"0.701723",
"0.67206526",
"0.6619245",
"0.6619245",
"0.6619245",
"0.6513528",
"0.64356047",
"0.6419896",
"0.6349979",
"0.63332766",
"0.6320385",
"0.6317874",
"0.63037527",
"0.62717515",
"0.6267693",
"0.62227976",
"0.61938244",
"0.6177788",
"0.60715955",
"0.6035828",
"0.602544... | 0.7559021 | 0 |
Return iterable object with tuples. This is one of two methods for reading from data source. Subclasses should implement this method. | def rows(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for key, value in self.read():\n yield key, value",
"def __iter__(self):\n return self._data.__iter__()",
"def __iter__(self):\n return iter(self.data)",
"def __iter__(self):\n return iter(self.data)",
"def __iter__(self):\n return iter(self.data)",... | [
"0.6585199",
"0.6466146",
"0.6420254",
"0.6420254",
"0.6420254",
"0.6397893",
"0.63802433",
"0.6203292",
"0.6177341",
"0.6171505",
"0.6140427",
"0.61198723",
"0.61169416",
"0.610333",
"0.60874975",
"0.6043979",
"0.6043737",
"0.6039829",
"0.60372937",
"0.6033862",
"0.6031521",... | 0.0 | -1 |
Return iterable object with dict objects. This is one of two methods for reading from data source. Subclasses should implement this method. | def records(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for key, value in self.read():\n yield key, value",
"def DictData(self):\n reader = csv.DictReader( open( self.file, \"rU\" ), dialect = \"excel\" )\n return reader",
"def __iter__(self):\n return self._data_dict.__iter__()",
"def __iter__(self):\n # Retu... | [
"0.6880309",
"0.677055",
"0.6600097",
"0.65634584",
"0.6404612",
"0.63936543",
"0.6379098",
"0.6379098",
"0.63660324",
"0.6350291",
"0.6317236",
"0.63071173",
"0.62934655",
"0.62930065",
"0.6264002",
"0.62428486",
"0.62300456",
"0.62180007",
"0.61430043",
"0.61430043",
"0.614... | 0.0 | -1 |
Read field descriptions from data source. You should use this for datasets that do not provide metadata directly, such as CSV files, document bases databases or directories with structured files. Does nothing in relational databases, as fields are represented by table columns and table metadata can obtained from databa... | def read_fields(self, limit = 0, collapse = False):
keys = []
probes = {}
def probe_record(record, parent = None):
for key, value in record.items():
full_key = parent + "." + key if parent else key
if self.expand and type(value) == dict:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_fields_sources_list():\n from pandas import read_csv\n try:\n sources = read_csv(FIELDS_SOURCES_LIST)\n names = read_csv(SOURCES_NAMES_LIST)\n except FileNotFoundError:\n create_fields_sources_list()\n sources = read_csv(FIELDS_SOURCES_LIST)\n names = read_csv(S... | [
"0.574807",
"0.5591403",
"0.5533271",
"0.54910386",
"0.534256",
"0.5339238",
"0.53237236",
"0.53038514",
"0.52398056",
"0.5235906",
"0.52067125",
"0.5196019",
"0.51878726",
"0.5167189",
"0.51464045",
"0.5118895",
"0.51055586",
"0.51055384",
"0.5102298",
"0.5099592",
"0.507946... | 0.5652659 | 1 |
Abstrac class for data targets. | def __init__(self):
super(DataTarget, self).__init__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset: Dataset, targets_file: str = os.path.join('data', 'targets.pkl')):\n self.dataset = dataset\n with open(targets_file, 'rb') as f:\n target_data = pickle.load(f)\n self.targets = target_data",
"def __init__(self, datapath, fileType='TargetLynx', sop='Gen... | [
"0.6896411",
"0.6206037",
"0.61528915",
"0.6137634",
"0.6076541",
"0.6049195",
"0.60137206",
"0.59384775",
"0.5917785",
"0.5908812",
"0.5888908",
"0.58537924",
"0.58418393",
"0.5836145",
"0.5802555",
"0.57947993",
"0.5794262",
"0.57715225",
"0.5756541",
"0.57526934",
"0.57315... | 0.7761443 | 0 |
Append an object into dataset. Object can be a tuple, array or a dict object. If tuple or array is used, then value position should correspond to field position in the field list, if dict is used, the keys should be valid field names. | def append(self, object):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, obj):\r\n self.record_count += 1\r\n \r\n if type(obj) == dict:\r\n self._probe_record(obj)\r\n else:\r\n self._probe_row(obj)",
"def append(self, object):\n self.data['object'].append(object)\n self.data['id'].append(self.start_id)... | [
"0.69988394",
"0.6969525",
"0.68023",
"0.6649313",
"0.659979",
"0.6497349",
"0.64699113",
"0.64579475",
"0.63589805",
"0.62991136",
"0.61311084",
"0.61311084",
"0.604826",
"0.59644234",
"0.5929203",
"0.5884574",
"0.583253",
"0.58093834",
"0.5773434",
"0.5750419",
"0.5741903",... | 0.6412181 | 8 |
Return boolean value. Convert string to True when "true", "yes" or "on" | def to_bool(value):
return bool(value) or lower(value) in ["true", "yes", "on"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str2bool(self, v):\n \tprint('Entering conversion function')\n return v.lower() in (\"yes\", \"true\", \"t\", \"1\")",
"def _str2bool(self, v):\n return v.lower() in (\"yes\", \"true\", \"t\", \"1\")",
"def str2bool(v): # type: ignore\n return v.lower() in (\"yes\", \"true\", \"t\", \"1... | [
"0.8528765",
"0.852707",
"0.8439699",
"0.838252",
"0.83245945",
"0.82936025",
"0.8274675",
"0.8251561",
"0.82455873",
"0.82327247",
"0.82282436",
"0.82238644",
"0.81952035",
"0.81952035",
"0.81117845",
"0.8111636",
"0.81052196",
"0.8067298",
"0.8051582",
"0.8046564",
"0.80385... | 0.8086994 | 17 |
Creates a CSV data source stream. | def __init__(self, resource, read_header=True, dialect=None, encoding=None,
detect_header=False, sample_size=200, skip_rows=None,
empty_as_null=True,fields=None, **reader_args):
self.read_header = read_header
self.encoding = encoding
self.detect_header = de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_data():\r\n for row in data:\r\n writer.writerow(row)\r\n csv_data = read_and_flush()\r\n yield csv_data",
"def get_csv_data(self):\n encoding = self.options.get(\n 'encoding', self.state.document.settings.input_encoding)\n error_ha... | [
"0.6182623",
"0.6072587",
"0.5869385",
"0.5837486",
"0.57954437",
"0.57666075",
"0.5724816",
"0.5710784",
"0.57049793",
"0.5695802",
"0.5695424",
"0.56830716",
"0.5642233",
"0.5558009",
"0.5546467",
"0.55293876",
"0.5518187",
"0.5512742",
"0.54813147",
"0.5471491",
"0.5470175... | 0.0 | -1 |
Creates a CSV data target | def __init__(self, resource, write_headers=True, truncate=True, encoding="utf-8",
dialect=None,fields=None, **kwds):
self.resource = resource
self.write_headers = write_headers
self.truncate = truncate
self.encoding = encoding
self.dialect = dialect
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _export_data_to_csv(self, source, target):\n self.log.info(f\"Dumping data into {target}\")\n source.to_csv(target, index=False)",
"def setup_csv(self) -> None:\n csvData = ['Followers', 'Time']\n\n # Create our CSV file header\n with open(self.graphfile, 'w') as csvFile:\n... | [
"0.7060283",
"0.67348045",
"0.6724391",
"0.6716193",
"0.6702842",
"0.6580284",
"0.658009",
"0.65356535",
"0.65187895",
"0.65104866",
"0.6470778",
"0.6470778",
"0.6470778",
"0.6470778",
"0.6470778",
"0.6470778",
"0.64682484",
"0.64374757",
"0.63976496",
"0.6375076",
"0.632039"... | 0.0 | -1 |
Creates a ElasticSearch data source stream. | def __init__(self, document_type, database=None, host=None, port=None,
expand=False, **elasticsearch_args):
self.document_type = document_type
self.database_name = database
self.host = host
self.port = port
self.elasticsearch_args = elasticsearch_args
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def es_data_stream():\n\n client = Elasticsearch(ES_TEST_HOSTS)\n\n # Create statements index template with enabled data stream\n index_template = {\n \"index_patterns\": [ES_TEST_INDEX_PATTERN],\n \"data_stream\": {},\n \"template\": {\n \"mappings\": {\n \"... | [
"0.70138466",
"0.60782176",
"0.58527935",
"0.5771694",
"0.57625",
"0.5710375",
"0.5669715",
"0.5654097",
"0.55329275",
"0.551584",
"0.5448524",
"0.543236",
"0.5381884",
"0.534318",
"0.534318",
"0.534318",
"0.52636975",
"0.52534133",
"0.5176973",
"0.51609564",
"0.51474154",
... | 0.46508467 | 78 |
Creates a ElasticSearch data target stream. | def __init__(self, document_type, database="test", host="127.0.0.1", port="9200",
truncate=False, expand=False, **elasticsearch_args):
self.document_type = document_type
self.database_name = database
self.host = host
self.port = port
self.elasticsearch_args... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def es_data_stream():\n\n client = Elasticsearch(ES_TEST_HOSTS)\n\n # Create statements index template with enabled data stream\n index_template = {\n \"index_patterns\": [ES_TEST_INDEX_PATTERN],\n \"data_stream\": {},\n \"template\": {\n \"mappings\": {\n \"... | [
"0.6962674",
"0.58525044",
"0.5840133",
"0.57135177",
"0.56104565",
"0.5593979",
"0.5592004",
"0.5536315",
"0.5461275",
"0.5409268",
"0.5400624",
"0.5392091",
"0.53603244",
"0.5289941",
"0.52020454",
"0.51548064",
"0.51499224",
"0.5146187",
"0.5061675",
"0.5018243",
"0.498445... | 0.0 | -1 |
Creates a Google Spreadsheet data source stream. | def __init__(self, spreadsheet_key=None, spreadsheet_name=None,
worksheet_id=None, worksheet_name=None,
query_string="",
username=None, password=None):
self.spreadsheet_key = spreadsheet_key
self.spreadsheet_name = spreadsheet_name
self.wor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, email=None, password=None, source=None,\n server='spreadsheets.google.com', additional_headers=None,\n **kwargs):\n gdata.service.GDataService.__init__(\n self, email=email, password=password, service='wise', source=source,\n server=server, additional... | [
"0.5462198",
"0.5444137",
"0.54311484",
"0.5412224",
"0.53128636",
"0.52742976",
"0.51310533",
"0.5128335",
"0.5106505",
"0.51007295",
"0.50865",
"0.50758445",
"0.5041378",
"0.50251067",
"0.5011914",
"0.50080603",
"0.5004937",
"0.5002186",
"0.5000043",
"0.49760845",
"0.496233... | 0.0 | -1 |
Connect to the Google documents, authenticate. | def initialize(self):
self.client = gdata.spreadsheet.text_db.DatabaseClient(username=self.username, password=self.password)
dbs = self.client.GetDatabases(spreadsheet_key=self.spreadsheet_key,
name=self.spreadsheet_name)
if len(dbs) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def google_drive_authenticate(self):",
"def login(self):\n #create a client class which will make http requests with google docs server.\n print 'Logging in as '+ self.user + '\\n'\n self.client = gdata.sites.client.SitesClient(source=self.source, site=self.site, domain=self.domain)\n self.client.Cli... | [
"0.749852",
"0.68779325",
"0.6620293",
"0.6498643",
"0.6456426",
"0.6207657",
"0.6191611",
"0.61545885",
"0.6150691",
"0.612791",
"0.6081863",
"0.60257155",
"0.5941054",
"0.59345794",
"0.58993757",
"0.5897671",
"0.58962965",
"0.58705145",
"0.5870502",
"0.58425653",
"0.5802755... | 0.0 | -1 |
Creates a HTML data target with simple naive HTML generation. No package that generates document node tree is used, just plain string concatenation. | def __init__(self, resource, html_header = True, html_footer = None,
write_headers = True, table_attributes = None,
):
self.resource = resource
self.write_headers = write_headers
self.table_attributes = table_attributes
if html_header =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_html(self, data=None, **kwargs) -> str:\n html = self.create_container()\n return html",
"def render_html_with_data(self):\n self.logger.info('Builder {} prepares html data for {} file'.format(self.id, self.html_template_file()))\n return self \\\n .template_env.get_... | [
"0.657715",
"0.64484257",
"0.6175353",
"0.6129455",
"0.6124525",
"0.6055447",
"0.6032224",
"0.60000384",
"0.5991321",
"0.5947695",
"0.5896785",
"0.5853676",
"0.5844881",
"0.5800975",
"0.5785198",
"0.5715122",
"0.5697646",
"0.5638386",
"0.5571903",
"0.55523735",
"0.5527138",
... | 0.0 | -1 |
Creates a MongoDB data source stream. | def __init__(self, collection, database=None, host=None, port=None,
expand=False, **mongo_args):
self.collection_name = collection
self.database_name = database
self.host = host
self.port = port
self.mongo_args = mongo_args
self.expand = expand
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_mongodb(config):\n\n \n mongo_url = \"mongodb://\"\n mongo_url += \",\".join(map(lambda srv: srv['host'] + \":\" + str(srv['port']), config['data']['mongoServers']))\n \n if 'replica' in config['data']:\n mongo_url += \"/?replicaSet={0}\".format(config['data']['replica'])\n\n ... | [
"0.56590545",
"0.56219786",
"0.54781723",
"0.54363394",
"0.53651077",
"0.5326184",
"0.5315363",
"0.531384",
"0.5303892",
"0.5299195",
"0.5277519",
"0.52535254",
"0.52527994",
"0.5202902",
"0.5177731",
"0.51757574",
"0.5137695",
"0.5128969",
"0.5127984",
"0.5088916",
"0.507307... | 0.0 | -1 |
Creates a MongoDB data target stream. | def __init__(self, collection, database=None, host=None, port=None,
truncate=False, expand=False, **mongo_args):
self.collection_name = collection
self.database_name = database
self.host = host
self.port = port
self.mongo_args = mongo_args
self.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mongodb_destination(sdc_builder, sdc_executor, mongodb):\n pipeline_builder = sdc_builder.get_pipeline_builder()\n pipeline_builder.add_error_stage('Discard')\n\n dev_raw_data_source = pipeline_builder.add_stage('Dev Raw Data Source')\n dev_raw_data_source.set_attributes(data_format='TEXT', ra... | [
"0.56412226",
"0.56192297",
"0.54394597",
"0.54224133",
"0.53672254",
"0.5229576",
"0.5180179",
"0.513128",
"0.5109323",
"0.5100908",
"0.50844264",
"0.5080904",
"0.50639004",
"0.5028019",
"0.5022498",
"0.50218683",
"0.50070256",
"0.499303",
"0.49866432",
"0.4980131",
"0.49678... | 0.0 | -1 |
Get schema and table name from table reference. | def split_table_schema(table_name):
split = table_name.split('.')
if len(split) > 1:
return (split[0], split[1])
else:
return (None, split[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_ref(schema, table):\n return schema + '.' + table",
"def get_table_name(self):\n return self._table",
"def tablename(entity) -> str:\n return entity.__tablename__",
"def get_tablename(self):\n return self.ds_table",
"def schema(self):\n return self.table_info.s... | [
"0.82157475",
"0.71392214",
"0.6875782",
"0.6840905",
"0.6806907",
"0.6805798",
"0.68053275",
"0.6769551",
"0.67060775",
"0.66727",
"0.6661863",
"0.66354185",
"0.6570726",
"0.6502964",
"0.6442934",
"0.6428296",
"0.64205855",
"0.63899255",
"0.6389401",
"0.6389401",
"0.6389401"... | 0.60282505 | 34 |
Creates a SQL context | def __init__(self, url=None, connection=None, schema=None):
if not url and not connection:
raise AttributeError("Either url or connection should be provided" \
" for SQL data source")
super(SQLContext, self).__init__()
if connection:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_context():\n return {'app': app, 'db': db}",
"def sql_context(self):\n if not self._sql_context:\n import pyspark.sql\n self._sql_context = pyspark.sql.SQLContext(self.context())\n return self._sql_context",
"def create_context(cls):\n pass",
"def _make_con... | [
"0.68279225",
"0.6694832",
"0.667269",
"0.6592965",
"0.6579943",
"0.6545147",
"0.65256286",
"0.6358311",
"0.62872374",
"0.61972845",
"0.61969036",
"0.6186409",
"0.61260194",
"0.60089785",
"0.5995722",
"0.59844375",
"0.5969605",
"0.5920828",
"0.5920192",
"0.59160876",
"0.59066... | 0.6197181 | 10 |
Get table by name | def table(self, name, autoload=True):
return sqlalchemy.Table(name, self.metadata,
autoload=autoload, schema=self.schema) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_table(name):\n tables = Base.metadata.tables\n table = tables.get(name, None)\n if table is not None:\n return table\n else:\n raise NameError('Unable to locate table: %s' % name)",
"def getTable(self, name: str):\n query = f\"SELECT * FROM '{name}';\"\n result =... | [
"0.8420525",
"0.81078076",
"0.7964266",
"0.7959396",
"0.78215784",
"0.75618744",
"0.7548801",
"0.74095243",
"0.7381338",
"0.7372634",
"0.7220812",
"0.71445024",
"0.7136764",
"0.69273126",
"0.68795604",
"0.68227136",
"0.66592586",
"0.66404855",
"0.6638589",
"0.65804505",
"0.65... | 0.6615831 | 19 |
Get fields from a table. Field types are normalized to the Brewery data types. Analytical type is set according to a default conversion dictionary. | def fields_from_table(table):
fields = []
for column in table.columns:
field = brewery.metadata.Field(name=column.name)
field.concrete_storage_type = column.type
for conv in _sql_to_brewery_types:
if issubclass(column.type.__class__, conv[0]):
fie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fields(self, table):\n fields = list()\n for column in table.columns:\n fields.append({'id': column.name, 'type': str(column.type)})\n return fields",
"def _parse_dtypes(data, table_meta):\n for name, field in table_meta['fields'].items():\n field_type = field['... | [
"0.7448947",
"0.63859844",
"0.6380723",
"0.6318095",
"0.62467355",
"0.6087675",
"0.60488886",
"0.60342807",
"0.5896163",
"0.57827",
"0.5764722",
"0.5717361",
"0.5648926",
"0.5629947",
"0.5598005",
"0.5575235",
"0.555654",
"0.5524569",
"0.55119383",
"0.55036217",
"0.5495978",
... | 0.7548131 | 0 |
Derives a concrete storage type for the field based on field conversion dictionary | def concrete_storage_type(field, type_map={}):
concrete_type = field.concrete_storage_type
if not isinstance(concrete_type, sqlalchemy.types.TypeEngine):
if type_map:
concrete_type = type_map.get(field.storage_type)
if not concrete_type:
concrete_type = concre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_field(obj):\r\n\r\n\r\n if isinstance(obj, Field):\r\n field = obj\r\n else:\r\n d = { \"storage_type\": \"unknown\" }\r\n\r\n if isinstance(obj, basestring):\r\n d[\"name\"] = obj\r\n elif type(obj) == tuple or type(obj) == list:\r\n d[\"name\"] = obj... | [
"0.69869864",
"0.68262047",
"0.6369962",
"0.6199096",
"0.61867684",
"0.6157527",
"0.61219966",
"0.6100469",
"0.6078638",
"0.6066346",
"0.6054696",
"0.60377914",
"0.6002127",
"0.5978446",
"0.59775907",
"0.5968036",
"0.5954878",
"0.588861",
"0.5781072",
"0.5752546",
"0.5749853"... | 0.7401502 | 0 |
Creates a relational database data source stream. | def __init__(self, connection=None, url=None,
table=None, statement=None, schema=None, autoinit = True,
**options):
super(SQLDataSource, self).__init__()
if not table and not statement:
raise AttributeError("Either table or statement should be... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_data_connection():\n\n global _engine # pylint: disable=W0603\n\n db_url = 'postgres://{0}:{1}@{2}:{3}/{4}'.format(DataBase.USER,\n DataBase.PASSWORD,\n DataBase.HOST,\n ... | [
"0.61535007",
"0.5833205",
"0.57340676",
"0.5660694",
"0.5655691",
"0.56391597",
"0.5593158",
"0.5585287",
"0.55823845",
"0.5537287",
"0.5492666",
"0.5456125",
"0.5396619",
"0.53335637",
"0.531554",
"0.5299445",
"0.5295579",
"0.5288605",
"0.5281783",
"0.52590007",
"0.5249448"... | 0.53940403 | 13 |
Initialize source stream. If the fields are not initialized, then they are read from the table. | def initialize(self):
if not self.context:
self.context = SQLContext(self.url, self.connection, self.schema)
if self.table is None:
self.table = self.context.table(self.table_name)
if not self.fields:
self.read_fields()
self.field_names = self.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_table(self, table: \"Table\"):\n if not self.columns:\n self.columns = table.columns\n self._data = table.data",
"def __post_init__(self):\n # Only do this if source_data already exists (not during its own initialization)\n if \"SOURCE_DATA\" in globals():\n ... | [
"0.6567911",
"0.64584345",
"0.64303744",
"0.62981564",
"0.6155012",
"0.61321723",
"0.6029323",
"0.59548885",
"0.59049594",
"0.5894522",
"0.58836263",
"0.5859183",
"0.58539855",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"0.58505374",
"... | 0.6926253 | 0 |
Creates a relational database data target stream. | def __init__(self, connection=None, url=None,
table=None, schema=None, truncate=False,
create=False, replace=False,
add_id_key=False, id_key_name=None,
buffer_size=None, fields=None, concrete_type_map=None,
**option... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_data_connection():\n\n global _engine # pylint: disable=W0603\n\n db_url = 'postgres://{0}:{1}@{2}:{3}/{4}'.format(DataBase.USER,\n DataBase.PASSWORD,\n DataBase.HOST,\n ... | [
"0.5994281",
"0.56065726",
"0.5600531",
"0.5501057",
"0.5497481",
"0.5472541",
"0.54257184",
"0.5423582",
"0.5406588",
"0.54031324",
"0.54019284",
"0.53946316",
"0.5352484",
"0.533338",
"0.5331681",
"0.5328063",
"0.53228265",
"0.5322475",
"0.52986676",
"0.52868915",
"0.525988... | 0.0 | -1 |
Closes the stream, flushes buffered data | def finalize(self):
self._flush()
self.context.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _close_stream(self):\n if self.stream:\n try:\n if not self.stream.closed:\n self.stream.flush()\n self.stream.close()\n finally:\n self.stream = None",
"def close(self):\n self._raw_stream.close()",
"de... | [
"0.75813985",
"0.7407842",
"0.7323337",
"0.72394466",
"0.7208977",
"0.709302",
"0.7068744",
"0.7044298",
"0.6764371",
"0.6711095",
"0.6706376",
"0.6690403",
"0.6683759",
"0.6638493",
"0.6588233",
"0.656604",
"0.6554848",
"0.6550063",
"0.64809364",
"0.64007044",
"0.6383709",
... | 0.63295704 | 24 |
Probe row or record and update statistics. | def append(self, obj):
self.record_count += 1
if type(obj) == dict:
self._probe_record(obj)
else:
self._probe_row(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probe(self):\n index, perfdat = self.update_performance_data(indexes=INDEXES, perfdata=PERFDATA,\n force_update_perfdata_from_host=True) # Getting Monitoring Data\n perfdat['timestamp'] = time.time()\n\n diff_results = self.check_diff(... | [
"0.58649784",
"0.55845046",
"0.55845046",
"0.55845046",
"0.54506695",
"0.5341237",
"0.5208032",
"0.5186886",
"0.51326793",
"0.50300217",
"0.50125587",
"0.4967174",
"0.4960673",
"0.4957455",
"0.49550503",
"0.49503267",
"0.49454916",
"0.49230266",
"0.4913705",
"0.49114332",
"0.... | 0.47417077 | 33 |
Get single field statistics. Create if does not exist | def _field_stat(self, field):
if not field in self.stats:
stat = dq.FieldStatistics(field, distinct_threshold = self.distinct_threshold)
self.stats[field] = stat
else:
stat = self.stats[field]
return stat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_statistics(self, data, field):\n statistics = super(NumberField, self).get_statistics(data, field)\n numeric_statistics = NumericStatistics(data)\n statistics.update(numeric_statistics.getSerializedData())\n return statistics",
"def field():\n data = request.get_json()\n ... | [
"0.58849454",
"0.56622",
"0.5446068",
"0.53929067",
"0.5386856",
"0.5380485",
"0.53466165",
"0.5260551",
"0.5220686",
"0.52184",
"0.51879865",
"0.5187592",
"0.5151635",
"0.51212466",
"0.51178455",
"0.5096719",
"0.5086637",
"0.50830716",
"0.5081789",
"0.50643116",
"0.5033314",... | 0.77910864 | 0 |
Creates a XLS spreadsheet data source stream. | def __init__(self, resource, sheet=None, encoding=None, skip_rows=None, read_header=True):
self.resource = resource
self.sheet_reference = sheet
self.read_header = read_header
self.header_row = 0
self.skip_rows = skip_rows
self._fields = None
self.close_fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mono_sheet(self):\n xls = pandas.read_excel(str(self.source))\n xls.to_csv(str(self.dest), **self.kwargs)",
"def handle(self):\n return pandas.ExcelFile(str(self.source))",
"def create_workbook(self):\n try:\n if '.xlsm' in self.file_name or '.xltm' in self.file_name:... | [
"0.61916786",
"0.61374366",
"0.58292073",
"0.5790149",
"0.576596",
"0.5748632",
"0.57088256",
"0.5668557",
"0.5487792",
"0.548337",
"0.5449661",
"0.5415428",
"0.5354787",
"0.5354726",
"0.5352027",
"0.53162456",
"0.5251749",
"0.5190803",
"0.5173037",
"0.51700485",
"0.5158855",... | 0.0 | -1 |
Convert Excel cell into value of a python type (from Swiss XlsReader.cell_to_python) | def _cell_value(self, cell):
# annoying need book argument for datemode
# info on types: http://www.lexicon.net/sjmachin/xlrd.html#xlrd.Cell-class
if cell.ctype == xlrd.XL_CELL_NUMBER:
return float(cell.value)
elif cell.ctype == xlrd.XL_CELL_DATE:
# TODO: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell_value_converter(cell, *args, **kwds):\n return cell.value",
"def cell_to_value(cell: xlrd.sheet.Cell, datemode: int):\n if cell.ctype in (xlrd.XL_CELL_EMPTY, xlrd.XL_CELL_BLANK):\n return ''\n elif cell.ctype == xlrd.XL_CELL_TEXT:\n return cell.value.strip()\n ... | [
"0.7249213",
"0.6936346",
"0.65123373",
"0.60368603",
"0.6010351",
"0.59544545",
"0.5816567",
"0.5776723",
"0.56016874",
"0.5587784",
"0.5578082",
"0.5562387",
"0.5554144",
"0.55176824",
"0.5473793",
"0.5473606",
"0.54652697",
"0.54652697",
"0.5377445",
"0.5328113",
"0.532464... | 0.71617 | 1 |
Creates a YAML directory data source stream. The data source reads files from a directory and treats each file as single record. For example, | def __init__(self, path, extension="yml", expand=False, filename_field=None):
self.path = path
self.expand = expand
self.filename_field = filename_field
self.extension = extension | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_yaml_files(target_directory, data):\n import os\n import yaml\n\n for k, v in data.items():\n file = os.path.join(target_directory, '.'.join((k, \"yml\")))\n\n with open(file, 'w') as yaml_file:\n yaml.dump(v, yaml_file, default_flow_style=False)",
"def register_yaml_... | [
"0.6136685",
"0.6135388",
"0.60516435",
"0.5959366",
"0.5904288",
"0.58627367",
"0.5860281",
"0.5796019",
"0.5768576",
"0.568439",
"0.5674274",
"0.5647453",
"0.56184065",
"0.5603883",
"0.55990267",
"0.5551741",
"0.5507236",
"0.54976135",
"0.54909426",
"0.5466119",
"0.54516476... | 0.0 | -1 |
Creates a directory data target with YAML files as records. | def __init__(self, path, filename_template="record_${__index}.yml", expand=False,
filename_start_index=0, truncate=False):
self.filename_template = filename_template
self.filename_start_index = filename_start_index
self.path = path
self.expand = expand
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_yaml_files(target_directory, data):\n import os\n import yaml\n\n for k, v in data.items():\n file = os.path.join(target_directory, '.'.join((k, \"yml\")))\n\n with open(file, 'w') as yaml_file:\n yaml.dump(v, yaml_file, default_flow_style=False)",
"def _create_data_d... | [
"0.7558792",
"0.6395725",
"0.63311017",
"0.6283437",
"0.6148466",
"0.61067694",
"0.60899746",
"0.6042579",
"0.59929127",
"0.5991112",
"0.5970345",
"0.5969732",
"0.5968861",
"0.59343183",
"0.59082234",
"0.58969283",
"0.58619446",
"0.5841129",
"0.5825125",
"0.5822597",
"0.58207... | 0.0 | -1 |
Creates a node graph with connections. | def __init__(self, nodes=None, connections=None):
super(Graph, self).__init__()
self.nodes = OrderedDict()
self.connections = set()
self.logger = get_logger()
self._name_sequence = 1
if nodes:
try:
for name, node in nodes.items(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_graph_network(start_node, connections):\n graph = nx.Graph()\n graph.add_node(start_node)\n print(connections.index)\n graph.add_nodes_from(connections.index)\n edge_list = list(zip(itertools.repeat(start_node), connections.index))\n print(\"edge list is \", edge_list)\n graph.add_e... | [
"0.76026577",
"0.7282024",
"0.72050685",
"0.7046618",
"0.703282",
"0.69916797",
"0.69721353",
"0.69453543",
"0.69041705",
"0.6828552",
"0.6741299",
"0.6722903",
"0.66999096",
"0.66756904",
"0.6661574",
"0.6639874",
"0.6626409",
"0.66075146",
"0.6598853",
"0.656181",
"0.655148... | 0.66424567 | 15 |
Generates unique name for a node | def _generate_node_name(self):
while 1:
name = "node" + str(self._name_sequence)
if name not in self.nodes.keys():
break
self._name_sequence += 1
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _auto_name(self):\n return \"node_\"+str(self._id)",
"def _generate_node_name(labels: dict, node_suffix: str) -> str:\n name_label = labels[TAG_RAY_NODE_NAME]\n assert len(name_label) <= (INSTANCE_NAME_MAX_LEN - INSTANCE_NAME_UUID_LEN - 1), (\n name_label,\n len(name_label),\n )... | [
"0.8495822",
"0.79702437",
"0.78181773",
"0.78113025",
"0.7744661",
"0.7536287",
"0.73967725",
"0.7288656",
"0.72870237",
"0.7182658",
"0.71326786",
"0.7110013",
"0.7080412",
"0.7079248",
"0.7072927",
"0.7049974",
"0.7044005",
"0.7023917",
"0.7008675",
"0.6926937",
"0.6914010... | 0.87746894 | 0 |
Add a `node` into the stream. Does not allow to add named node if node with given name already exists. Generate node name if not provided. Node name is generated as ``node`` + sequence number. Uniqueness is tested. | def add(self, node, name=None):
name = name or self._generate_node_name()
if name in self.nodes:
raise KeyError("Node with name %s already exists" % name)
self.nodes[name] = node
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_node(self, node):\n \n if node in self.node_set:\n return \n \n self.num_node = self.num_node + 1\n self.node_set.add(node)\n self.prefix[node] = {}\n self.suffix[node] = {}",
"def add_node(self, name, node):\n self.nodes.setdefault(name,... | [
"0.7261664",
"0.69256246",
"0.67104006",
"0.670441",
"0.6656498",
"0.6646234",
"0.66098297",
"0.66058105",
"0.65808105",
"0.65784144",
"0.6569567",
"0.65557235",
"0.6535508",
"0.653294",
"0.6526756",
"0.65054995",
"0.64960676",
"0.64960676",
"0.6494902",
"0.6482181",
"0.64649... | 0.75492877 | 0 |
Returns name of `node`. | def node_name(self, node):
# There should not be more
if not node:
raise ValueError("No node provided")
names = [key for key,value in self.nodes.items() if value==node]
if len(names) == 1:
return names[0]
elif len(names) > 1:
raise ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node_name(self, node):\n return node.name",
"def get_node_name(self, node):\n raise NotImplementedError()",
"def get_name(node):\n if isinstance(node, ast.Name):\n return node.id",
"def name(node):\n\n return fst(node)",
"def node_name(self):\n return s... | [
"0.92860854",
"0.8965108",
"0.89074516",
"0.88128275",
"0.85684144",
"0.8514857",
"0.8416093",
"0.82993823",
"0.8280203",
"0.8178653",
"0.8178087",
"0.8057197",
"0.8057197",
"0.7897977",
"0.78669655",
"0.7861445",
"0.7861445",
"0.7861445",
"0.7861445",
"0.77823925",
"0.776897... | 0.834479 | 7 |
Return node with name `name`. | def node(self, name):
return self.nodes[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ex_get_node_by_name(self, name):\n domain = self._get_domain_for_name(name=name)\n node = self._to_node(domain=domain)\n return node",
"def get_node_by_name(self, name):\n\n for node in self.nodes:\n if node.name == name:\n return node\n\n return N... | [
"0.8660231",
"0.8572624",
"0.84944314",
"0.82802165",
"0.81629246",
"0.8069622",
"0.8033731",
"0.7934851",
"0.7885688",
"0.7860119",
"0.774692",
"0.7452808",
"0.74217314",
"0.7388659",
"0.7365851",
"0.72896737",
"0.72875696",
"0.7218619",
"0.71662074",
"0.71462476",
"0.702634... | 0.80327666 | 7 |
Sets a name for `node`. Raises an exception if the `node` is not part of the stream, if `name` is empty or there is already node with the same name. | def rename_node(self, node, name):
if not name:
raise ValueError("No node name provided for rename")
if name in self.nodes():
raise ValueError("Node with name '%s' already exists" % name)
old_name = self.node_name(node)
del self.nodes[old_name]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)",
"def setName(self, name):\n libxml2mod.xmlNodeSetName(self._o, name)",
"def node_name(self, value: str):\n self._properties[\"nodeName\"] = value",
"def set_name(self, name):\n self.name = name # overwrite... | [
"0.83490866",
"0.7088931",
"0.6897682",
"0.6853107",
"0.6853107",
"0.6769459",
"0.67315155",
"0.6702388",
"0.6701894",
"0.668318",
"0.6648065",
"0.6642689",
"0.6640702",
"0.6640702",
"0.6640702",
"0.6640702",
"0.6634831",
"0.6628643",
"0.66260713",
"0.6609876",
"0.65992534",
... | 0.7324265 | 1 |
Remove a `node` from the stream. Also all connections will be removed. | def remove(self, node):
# Allow node name, get the real node object
if isinstance(node, basestring):
name = node
node = self.nodes[name]
else:
name = self.node_name(node)
del self.nodes[name]
remove = [c for c in self.connections ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_node(self, node):\n\t\tnode.close()\n\t\taddress = (node.server_ip, node.server_port)\n\t\tself.nodes.pop(address)",
"def remove_node(self, node):\n self.nodes.remove(node)\n node.close()",
"def remove_peer_node(self, node):\n self.__peer_nodes.discard(node)\n self.save_d... | [
"0.808556",
"0.7803654",
"0.7568319",
"0.7568319",
"0.7491827",
"0.7406237",
"0.73462373",
"0.7286456",
"0.7268353",
"0.707854",
"0.70228726",
"0.6948249",
"0.6938343",
"0.6914852",
"0.6889878",
"0.6888139",
"0.68169695",
"0.6799412",
"0.6778486",
"0.6753452",
"0.67398894",
... | 0.7634206 | 2 |
Connects source node and target node. Nodes can be provided as objects or names. | def connect(self, source, target):
connection = (self.coalesce_node(source), self.coalesce_node(target))
self.connections.add(connection) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(src, target, reftype):",
"def connect(self, node1, node2):\n self.neighbour1 = node1\n self.neighbour2 = node2",
"def connect_nodes(self, src, tgt, locked=False):\n if not src.add_hook(tgt, 'inhook'):\n return False\n tgt.add_hook(src, 'outhook')\n tgt.... | [
"0.7269944",
"0.70790887",
"0.67458445",
"0.6719491",
"0.66222644",
"0.6585517",
"0.6552827",
"0.6541949",
"0.6534172",
"0.63189816",
"0.6278052",
"0.62138635",
"0.61803526",
"0.6146746",
"0.6121839",
"0.609566",
"0.60728294",
"0.6057733",
"0.60307",
"0.60224915",
"0.6019208"... | 0.8045065 | 0 |
Remove connection between source and target nodes, if exists. | def remove_connection(self, source, target):
connection = (self.coalesce_node(source), self.coalesce_node(target))
self.connections.discard(connection) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeConnection(tagA, tagB): #@NoSelf",
"def remove_nodes_connections(self, nodes):\n nodes = ensure_list(nodes)\n for nd in nodes:\n for nd_in in self.successors[nd.name]:\n self.predecessors[nd_in.name].remove(nd)\n self.edges.remove((nd, nd_in))\n ... | [
"0.6762276",
"0.67581093",
"0.6644162",
"0.66242313",
"0.6555694",
"0.6522651",
"0.6485569",
"0.64436626",
"0.64415437",
"0.63333553",
"0.6331394",
"0.63294",
"0.6292633",
"0.6252986",
"0.61544985",
"0.6116792",
"0.6114218",
"0.6095088",
"0.60817045",
"0.60571676",
"0.6050193... | 0.85355616 | 0 |
Return topologically sorted nodes. | def sorted_nodes(self):
def is_source(node, connections):
for connection in connections:
if node == connection[1]:
return False
return True
def source_connections(node, connections):
conns = set()
for connectio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes_in_topological_order(self):\n if not self.sorted:\n self._topological_sort()\n return self._topological_order",
"def topological_sort(self):\n \n visited = set()\n sorted_node = [] \n\n # sort all the node in the graph\n for i in self.node_set... | [
"0.8779629",
"0.8457878",
"0.79673606",
"0.7819014",
"0.77327615",
"0.766071",
"0.7612172",
"0.751349",
"0.7350661",
"0.7293602",
"0.7251269",
"0.72208524",
"0.71853274",
"0.7161302",
"0.71534646",
"0.7123039",
"0.70400393",
"0.7028084",
"0.6979365",
"0.6969769",
"0.6965376",... | 0.7793931 | 4 |
Return nodes that `node` passes data into. | def node_targets(self, node):
node = self.coalesce_node(node)
nodes =[conn[1] for conn in self.connections if conn[0] == node]
return nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node(self, node):\n nodes = [n for n in self.nodes if n.name == node]\n if nodes:\n return nodes\n else:\n raise Exception(\"Node {0} not available in {1}\".format(\n node, self.name))",
"def nodes( self, data = False ):\n return self._G.nodes(... | [
"0.71416855",
"0.6850091",
"0.673691",
"0.6710813",
"0.6704163",
"0.64915735",
"0.6337053",
"0.63245016",
"0.631959",
"0.62888527",
"0.6259219",
"0.6195904",
"0.61639047",
"0.6160371",
"0.6138305",
"0.6110838",
"0.6067836",
"0.60593975",
"0.60494983",
"0.60494983",
"0.6049379... | 0.61287695 | 15 |
Return nodes that provide data for `node`. | def node_sources(self, node):
node = self.coalesce_node(node)
nodes =[conn[0] for conn in self.connections if conn[1] == node]
return nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node(self, node):\n nodes = [n for n in self.nodes if n.name == node]\n if nodes:\n return nodes\n else:\n raise Exception(\"Node {0} not available in {1}\".format(\n node, self.name))",
"def nodes( self, data=False):\n return self.node.items()... | [
"0.7020924",
"0.6738474",
"0.64673835",
"0.6377364",
"0.63485485",
"0.62332755",
"0.619896",
"0.61275643",
"0.612252",
"0.60494274",
"0.60299015",
"0.6029028",
"0.60071915",
"0.59459925",
"0.5942672",
"0.59217066",
"0.5893864",
"0.5880629",
"0.5872045",
"0.58091235",
"0.57849... | 0.60277945 | 12 |
Expand record represented as dict object by treating keys as key paths separated by | def expand_record(record, separator = '.'):
result = {}
for key, value in record.items():
current = result
path = key.split(separator)
for part in path[:-1]:
if part not in current:
current[part] = {}
current = current[part]
curren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand_objects(record):\n new_record = copy.deepcopy(record)\n for key, value in record.items():\n parts = key.split(\".\")\n if len(parts) > 1:\n parts.reverse()\n current = {parts[0]: value}\n for part in parts[1:]:\n current = {part: curren... | [
"0.77235836",
"0.6214426",
"0.6204807",
"0.6192491",
"0.61800855",
"0.606586",
"0.6001238",
"0.5989735",
"0.5945751",
"0.5884399",
"0.58728135",
"0.5796908",
"0.5785131",
"0.57662815",
"0.5703317",
"0.56907934",
"0.5617995",
"0.56040907",
"0.5504228",
"0.54999644",
"0.54974",... | 0.8102187 | 0 |
Converts `obj` to a field object. `obj` can be ``str``, ``tuple`` | def to_field(obj):
if isinstance(obj, Field):
field = obj
else:
d = { "storage_type": "unknown" }
if isinstance(obj, basestring):
d["name"] = obj
elif type(obj) == tuple or type(obj) == list:
d["name"] = obj[0]
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_obj(cls, obj: any) -> Objdict:\n # CASE: list. Convert each item in the list.\n if isinstance(obj, list):\n value = [cls.from_obj(item) for item in obj]\n\n # CASE: dictionary. Convert each item in the dictionary.\n elif isinstance(obj, dict):\n d = {k: cl... | [
"0.6367572",
"0.62205976",
"0.6188497",
"0.61414284",
"0.60535365",
"0.59802586",
"0.59760207",
"0.59645313",
"0.59378475",
"0.58161896",
"0.58113116",
"0.5773553",
"0.57665277",
"0.5729413",
"0.57289016",
"0.5696793",
"0.5690984",
"0.5655159",
"0.56360304",
"0.56264126",
"0.... | 0.76156193 | 0 |
Return dictionary representation of the field. | def to_dict(self):
d = {
"name": self.name,
"label": self.label,
"storage_type": self.storage_type,
"analytical_type": self.analytical_type,
"concrete_storage_type": self.concrete_storage_type,
"missing_values... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n _dict = {}\n for f in self._meta.fields:\n if f.name == 'created':\n _dict[f.name] = str(f.value_from_object(self))\n else:\n _dict[f.name] = f.value_from_object(self)\n\n return _dict",
"def dictify(self):\n ret... | [
"0.7392628",
"0.738731",
"0.72834563",
"0.7272394",
"0.72522825",
"0.72284466",
"0.72047096",
"0.713855",
"0.70919913",
"0.70575505",
"0.7041807",
"0.70039463",
"0.69826317",
"0.69761455",
"0.69625425",
"0.69602543",
"0.69359726",
"0.6919989",
"0.6919989",
"0.691676",
"0.6912... | 0.6696163 | 85 |
Return field name as field string representation. | def __str__(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NAME(self) -> str:\n return self._field_name",
"def py_field_name(self, field):\n name = field.name\n name = as_identifier(name)\n if self.options(field).convert_case:\n name = from_camel_case(name)\n name = self._mangle_name(name)\n return name",
"def _... | [
"0.7857624",
"0.78311974",
"0.76416886",
"0.7597991",
"0.7528716",
"0.748733",
"0.7357914",
"0.7356117",
"0.7232144",
"0.72058624",
"0.71373785",
"0.70608956",
"0.70161134",
"0.6975634",
"0.6858445",
"0.6816973",
"0.6816973",
"0.6803938",
"0.6796402",
"0.67763567",
"0.6700877... | 0.0 | -1 |
Appends a field to the list. This method requires `field` to be instance of `Field` | def append(self, field):
field = to_field(field)
self._fields.append(field)
self._field_dict[field.name] = field
self._field_names.append(field.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_field(self, field):\n if field.name in self.fields:\n print(\"WARNING: Field {0} already in model {1}\"\n .format(field.name, self.table_name))\n return\n\n self.fields[field.name] = field\n self.sorted_fields.append(field)\n self.sorted_fi... | [
"0.73584527",
"0.73173344",
"0.73173344",
"0.72460747",
"0.7038897",
"0.69933426",
"0.67837954",
"0.660281",
"0.6547732",
"0.6257247",
"0.60159636",
"0.5994535",
"0.59549665",
"0.59549665",
"0.59549665",
"0.59048706",
"0.5901957",
"0.5901957",
"0.5894635",
"0.5832519",
"0.582... | 0.79776734 | 0 |
Return names of fields in the list. | def names(self, indexes = None):
if indexes:
names = [self._field_names[i] for i in indexes]
return names
else:
return self._field_names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fields_names(cls) -> List:\n return list(field.name for field in dataclasses.fields(cls))",
"def get_field_names(self):\n return {rv[0] for rv in self.iter_fields()}",
"def field_names(self):\r\n return self._names",
"def get_field_names() -> Sequence[str]:\n raise NotImpleme... | [
"0.80112517",
"0.79113954",
"0.78758657",
"0.7865001",
"0.7776147",
"0.76986957",
"0.7685229",
"0.761514",
"0.7509076",
"0.75014013",
"0.74575037",
"0.74347925",
"0.74139035",
"0.737738",
"0.7338132",
"0.7320028",
"0.7236667",
"0.72224",
"0.7190711",
"0.7180532",
"0.7128284",... | 0.70265675 | 23 |
Return a tuple with indexes of fields from ``fields`` in a data row. Fields should be a list of ``Field`` objects or strings. This method is useful when it is more desirable to process data as rows (arrays), not as dictionaries, for example for performance purposes. | def indexes(self, fields):
indexes = [self.index(field) for field in fields]
return tuple(indexes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extractFields(deerfootRDDRecord):\n fieldsList = deerfootRDDRecord.split(\",\")\n return (fieldsList[0], [fieldsList[1], fieldsList[15], fieldsList[46]])",
"def extract(self, *fields):\n if len(fields) == 0:\n raise ValueError(\"no field(s) given for extraction\")\n elif len(fi... | [
"0.61811095",
"0.6051826",
"0.60384977",
"0.6001089",
"0.59001076",
"0.5739948",
"0.56098425",
"0.5493705",
"0.5472491",
"0.54576796",
"0.54421836",
"0.54421836",
"0.54239964",
"0.5387598",
"0.53843665",
"0.5356989",
"0.5320126",
"0.5304942",
"0.5289367",
"0.52688307",
"0.524... | 0.71579444 | 0 |
Return a list representing field selector which fields are selected from a row. | def selectors(self, fields = None):
sel_names = [str(field) for field in fields]
selectors = [unicode(name) in sel_names for name in self.names()]
return selectors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _select_fields(self):\r\n return []",
"def _get_fields(self):\n table = self.ui.tableFields\n rows = table.rowCount()\n cols = table.columnCount()\n fields = []\n for i in range(rows):\n fields.append(\n tuple(map(lambda x: table.item(i, x).... | [
"0.7673547",
"0.67533666",
"0.65299696",
"0.6491336",
"0.64159906",
"0.62741077",
"0.6236396",
"0.6159341",
"0.60381097",
"0.60081404",
"0.59687746",
"0.5967494",
"0.59337884",
"0.5927561",
"0.59260964",
"0.58889085",
"0.5869368",
"0.5869368",
"0.5823076",
"0.57602054",
"0.57... | 0.67026454 | 2 |
Return index of a field | def index(self, field):
try:
index = self._field_names.index(unicode(field))
except ValueError:
raise KeyError("Field list has no field with name '%s'" % unicode(field))
return index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_index(self, field):\r\n idx = self.fields.index(field)\r\n if self.index:\r\n idx = self.index[idx]\r\n return idx",
"def convert_field_name_to_indexes(field_name):\n rows = '87654321'\n columns = 'abcdefgh'\n row_index = column_index = None\n\n row_name = fi... | [
"0.88422716",
"0.6718861",
"0.66167814",
"0.64797366",
"0.64267",
"0.6413878",
"0.631809",
"0.61919314",
"0.61846656",
"0.6132731",
"0.6104587",
"0.608516",
"0.6048858",
"0.6009871",
"0.59791565",
"0.5953976",
"0.59410733",
"0.59244543",
"0.5886749",
"0.5883558",
"0.5883102",... | 0.78399575 | 1 |
Return a tuple with fields. `names` specifies which fields are returned. When names is ``None`` all fields are returned. | def fields(self, names = None):
if not names:
return self._fields
fields = [self._field_dict[name] for name in names]
return fields | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_namedtuple(name, field_names, values=None):\n if values is None:\n values = range(len(field_names))\n field_names = [f.replace(' ', '_') for f in field_names]\n return _namedtuple(name, field_names)(*values)",
"def field_names(cls) -> tuple:\n return tuple((field.name for field in ... | [
"0.6950016",
"0.67159724",
"0.66012585",
"0.59431046",
"0.58848846",
"0.577644",
"0.5722483",
"0.57022977",
"0.5617106",
"0.56001776",
"0.55626434",
"0.55010647",
"0.55008906",
"0.54608077",
"0.5446141",
"0.54451907",
"0.54388106",
"0.5402777",
"0.53886825",
"0.53750217",
"0.... | 0.75947446 | 0 |
Return a field with name `name` | def field(self, name):
if name in self._field_dict:
return self._field_dict[name]
raise KeyError("Field list has no field with name '%s'" % name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_by_name(self, name):\r\n return self._by_name[name]",
"def field_by_name(cls, name):\n return cls.__by_name[name]",
"def get_field(self, name):\n for field_name, field in self._all_fields.iteritems():\n if name == self._sanitize_field_name(field_name):\n ... | [
"0.87100714",
"0.8523278",
"0.83696043",
"0.79551727",
"0.78642",
"0.775058",
"0.7637853",
"0.7501762",
"0.74567354",
"0.7449749",
"0.7312038",
"0.72911304",
"0.72672033",
"0.7263582",
"0.7176548",
"0.71667796",
"0.7098992",
"0.6945939",
"0.67814463",
"0.6770804",
"0.6729311"... | 0.7770061 | 5 |
Return a shallow copy of the list. | def copy(self, fields = None):
if fields is not None:
copy_fields = self.fields(fields)
return FieldList(copy_fields)
else:
return FieldList(self._fields) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return List(*self.__list)",
"def deepcopy_list(self, list):\n copy = list.copy()\n\n for i in range(len(list)):\n copy[i] = list[i].copy()\n\n return copy",
"def copy(self) -> 'List':\n return self.__class__(self)",
"def copy_list(self,list_):\r... | [
"0.8799866",
"0.82894164",
"0.8197072",
"0.8056283",
"0.75874656",
"0.75185114",
"0.7504239",
"0.7449385",
"0.74388397",
"0.7383191",
"0.7382782",
"0.73621583",
"0.7358862",
"0.7311908",
"0.7311908",
"0.7311908",
"0.7311908",
"0.7311908",
"0.7311908",
"0.7311908",
"0.7311908"... | 0.67652047 | 86 |
Retype fields according to the dictionary. Dictionary contains field names as keys and field attribute dictionary as values. | def retype(self, dictionary):
for name, retype in dictionary.items():
field = self._field_dict[name]
for key, value in retype.items():
if key in _valid_retype_attributes:
field.__setattr__(key, value)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_field_name_to_attribute() -> typing.Dict:\n return {\n \"tag\": \"tag\",\n \"contact\": \"contact\",\n }",
"def map_to_db_fields(field_attrs):\n attr_keys = field_attrs.keys()\n field_name = field_attrs[attr_keys.pop(attr_keys.index('name'))]\n field_type_raw ... | [
"0.6638699",
"0.6297308",
"0.62741715",
"0.61012524",
"0.60796726",
"0.6069095",
"0.6063906",
"0.60093445",
"0.5871374",
"0.5849077",
"0.58450663",
"0.5843713",
"0.5837479",
"0.58280677",
"0.58179206",
"0.5793641",
"0.5781531",
"0.5733772",
"0.5708058",
"0.57070625",
"0.57049... | 0.66592646 | 0 |
Creates a field map. `rename` is a dictionary where keys are input field names and values are output field names. `drop` is list of field names that will be dropped from the stream. If `keep` is used, then all fields are dropped except those specified in `keep` list. | def __init__(self, rename = None, drop = None, keep=None):
if drop and keep:
raise Exception('Configuration error in FieldMap: you cant specify both keep and drop options.')
super(FieldMap, self).__init__()
if rename:
self.rename = rename
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename_fields(r, rename_map):\n new_record = {}\n for f in r.keys():\n if f in rename_map.keys():\n new_record[rename_map[f]] = r[f]\n else:\n new_key = f.lower().replace(' ', '_')\n new_record[new_key] = r[f]\n return new_... | [
"0.5862681",
"0.55686843",
"0.5299097",
"0.52944267",
"0.524568",
"0.5228895",
"0.5196348",
"0.5167842",
"0.5154742",
"0.5143839",
"0.49291566",
"0.48727214",
"0.47858247",
"0.4741838",
"0.47405508",
"0.47203442",
"0.47053137",
"0.45981687",
"0.45894343",
"0.4580538",
"0.4570... | 0.6910661 | 0 |
Returns an object that will convert rows with structure specified in `fields`. You can use the object to filter fields from a row (list, array) according to this map. | def row_filter(self, fields):
return RowFieldFilter(self.field_selectors(fields)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _row_to_dict(row, fields):\n dict_row = {}\n for i, value in enumerate(row):\n key = fields[i]\n if value and str(value).lower() == 'nan':\n value = None\n dict_row[key] = value\n return dict_row",
"def get_records(rows, fields):\n records = []\n for n, row in e... | [
"0.6264399",
"0.6146675",
"0.59565455",
"0.5821438",
"0.5784335",
"0.57635254",
"0.5738294",
"0.56593627",
"0.56446123",
"0.56362826",
"0.5629593",
"0.5589193",
"0.55864084",
"0.55845135",
"0.5570206",
"0.5567612",
"0.55492896",
"0.55344754",
"0.55245084",
"0.550564",
"0.5470... | 0.598881 | 2 |
Returns selectors of fields to be used by `itertools.compress()`. This is the preferred way of field filtering. | def field_selectors(self, fields):
selectors = []
for field in fields:
flag = (self.drop and field.name not in self.drop) \
or (self.keep and field.name in self.keep) \
or not (self.keep or self.drop)
selectors.append(flag)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectors(self, fields = None):\r\n\r\n sel_names = [str(field) for field in fields]\r\n\r\n selectors = [unicode(name) in sel_names for name in self.names()]\r\n return selectors",
"def tableSelFieldsFilter(tdata, columns):\n\tif areAllFieldsIncluded(tdata[0], columns):\n\t\tntdata = td... | [
"0.71675444",
"0.6121632",
"0.6081692",
"0.59284747",
"0.568655",
"0.56459606",
"0.5645398",
"0.5632499",
"0.5608243",
"0.5601196",
"0.5568667",
"0.5538119",
"0.5488354",
"0.5479283",
"0.5446744",
"0.54406416",
"0.5429593",
"0.5420711",
"0.54198086",
"0.5416203",
"0.54044914"... | 0.73484904 | 0 |
Create an instance of RowFieldFilter. `indexes` is a list of indexes that are passed to output. | def __init__(self, selectors = None):
super(RowFieldFilter, self).__init__()
self.selectors = selectors or [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_filter(self, fields):\r\n return RowFieldFilter(self.field_selectors(fields))",
"def add_row_filter(source, args, index):\n queries = []\n for subindex in range(1, 6):\n query = args.get('select-query%02d-%02d' % (index, subindex))\n if query:\n queries.append(query)... | [
"0.6509213",
"0.567148",
"0.50715643",
"0.49137616",
"0.489272",
"0.4640355",
"0.46349645",
"0.4595673",
"0.45924833",
"0.45916086",
"0.45820606",
"0.45636806",
"0.45549023",
"0.45420763",
"0.45402503",
"0.4524151",
"0.44869232",
"0.44534838",
"0.44497275",
"0.44421154",
"0.4... | 0.55570024 | 2 |
Filter a `row` according to ``indexes``. | def filter(self, row):
return list(itertools.compress(row, self.selectors)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_indexes(self, indexes):\n # Create a set of the rows (as int) to delete\n selected_rows = set()\n for index in indexes:\n selected_rows.add(index.row())\n\n # Delete all of them one by one (easy but maybe not the best performance-wise)\n for index, row in en... | [
"0.633096",
"0.6153761",
"0.6127054",
"0.607492",
"0.5930583",
"0.59259397",
"0.5877189",
"0.5849355",
"0.58252066",
"0.581521",
"0.57172906",
"0.5711661",
"0.56371325",
"0.55101305",
"0.5451478",
"0.54393",
"0.5430845",
"0.52598566",
"0.52441585",
"0.5237078",
"0.5189027",
... | 0.53119826 | 17 |
Coalesces `value` to given storage `type`. `empty_values` is a dictionary where keys are storage type names and values are values to be used as empty value replacements. | def coalesce_value(value, storage_type, empty_values=None, strip=False):
if empty_values is None:
empty_values={}
if storage_type in ["string", "text"]:
if strip:
value = value.strip()
elif value:
value = unicode(value)
if value == "" or value is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_store(raw_val):\n if raw_val not in EMPTY_VALUES:\n return auto_type_convert(raw_val)\n else:\n return raw_val",
"def check_integrity(dict):\n if (dict['type'] == 'string') and (dict['value'] == None or dict['value'] == ''):\n dict['value'] = '\"\"'",
"def empty(cls, ke... | [
"0.58325046",
"0.521288",
"0.49877736",
"0.4948348",
"0.48418808",
"0.4832019",
"0.4825413",
"0.47597077",
"0.47303224",
"0.47151342",
"0.47076306",
"0.4702731",
"0.46962714",
"0.46962714",
"0.46882483",
"0.46549195",
"0.4623449",
"0.4623449",
"0.4623449",
"0.4623449",
"0.462... | 0.65644866 | 0 |
Creates a node of type specified by `identifier`. Options are passed to the node initializer | def create_node(identifier, *args, **kwargs):
d = node_dictionary()
node_class = d[identifier]
node = node_class(*args, **kwargs)
return node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_node(name, node_type):\n if node_type in NODE_REGISTRY:\n return Node(name, NODE_REGISTRY[node_type])\n raise TypeError('The specified node type \\'%s\\' could not be found within imagegen.' % node_type)",
"def _create_node(\n self,\n name,\n ):\n pass",
... | [
"0.6298921",
"0.5776966",
"0.5754006",
"0.5657194",
"0.56104183",
"0.5609372",
"0.55108285",
"0.53705436",
"0.5338448",
"0.53078574",
"0.5302105",
"0.52723897",
"0.52688146",
"0.52115166",
"0.52099746",
"0.5203637",
"0.5183259",
"0.5177779",
"0.51555586",
"0.50895774",
"0.505... | 0.8164702 | 0 |
Return a dictionary containing node name as key and node class as value. This will be depreciated soon in favour of | def node_dictionary():
classes = node_subclasses(Node)
dictionary = {}
for c in classes:
try:
name = c.identifier()
dictionary[name] = c
except AttributeError:
# If node does not provide identifier, we consider it to be
# private o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_catalogue():\r\n\r\n classes = node_subclasses(Node)\r\n\r\n catalogue = {}\r\n\r\n for node_class in classes:\r\n try:\r\n name = node_class.identifier()\r\n except AttributeError:\r\n # If node does not provide identifier, we consider it to be\r\n ... | [
"0.7518577",
"0.64790714",
"0.64441085",
"0.6396249",
"0.6357954",
"0.6273917",
"0.6252944",
"0.6094156",
"0.6071588",
"0.6064794",
"0.60554457",
"0.6027468",
"0.6006948",
"0.59741557",
"0.5917332",
"0.5897811",
"0.58968717",
"0.5875732",
"0.58470047",
"0.583958",
"0.58379084... | 0.8277194 | 0 |
Returns a dictionary of information about all available nodes. Keys are node identifiers, values are dictionaries. The information dictionary contains | def node_catalogue():
classes = node_subclasses(Node)
catalogue = {}
for node_class in classes:
try:
name = node_class.identifier()
except AttributeError:
# If node does not provide identifier, we consider it to be
# private or abstract class... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodes(self):\n return requests.get(self.__url + 'nodes').json()",
"def nodes_inventory(self):\n\n if not self.nodes:\n self.get_nodes()\n\n _nodes_inventory = {}\n _server = urlparse(self.connector.base_url).hostname\n\n for _n in self.nodes:\n\n _... | [
"0.7009908",
"0.6964984",
"0.685585",
"0.67959714",
"0.67905104",
"0.6787858",
"0.67514426",
"0.67025816",
"0.6682463",
"0.6652443",
"0.66498345",
"0.6552649",
"0.6550966",
"0.65372527",
"0.6535645",
"0.65217847",
"0.65168214",
"0.6486341",
"0.6466922",
"0.645274",
"0.6421616... | 0.6257733 | 30 |
Get all subclasses of node. | def node_subclasses(root, abstract = False):
classes = []
for c in utils.subclass_iterator(root):
try:
info = get_node_info(c)
node_type = info.get("type")
if node_type != "abstract":
classes.append(c)
except AttributeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descendants(cls):\n return cls.__subclasses__() + \\\n [g for s in cls.__subclasses__() for g in s.descendants()]",
"def get_subclasses(self, klass: TypeInfo) -> OrderedSet[TypeInfo]:\n if klass not in self._graph:\n return OrderedSet([klass])\n result: OrderedSet[T... | [
"0.7140406",
"0.6957714",
"0.6886573",
"0.6848165",
"0.68365824",
"0.6833044",
"0.6756908",
"0.67236257",
"0.66959816",
"0.66798323",
"0.6634815",
"0.6603208",
"0.65786904",
"0.65046304",
"0.64756143",
"0.64746326",
"0.6457086",
"0.6451578",
"0.6394505",
"0.6363579",
"0.63500... | 0.7421831 | 0 |
Get node info attribute of a node transient function during depreciation | def get_node_info(cls):
if hasattr(cls, "__node_info__") and cls not in _node_info_warnings:
utils.get_logger().warn("depreciated __node_info__ present in %s, rename to node_info" \
" (this warning will be shown only once)" % str(cls))
_node_info_warnings.add(cls)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_node_attr(self, node, attr):\n return self.metrics[attr].ix[node]",
"def get_data(node):\n return node['data']",
"def visit(self, node):\n super(_GetattrNodeVisitor, self).visit(node)",
"def infon_dict(self, node):\n raise NotImplementedError",
"def node_data(self):\n re... | [
"0.61425287",
"0.6103106",
"0.5819633",
"0.5816128",
"0.5654055",
"0.5496545",
"0.54790324",
"0.5471649",
"0.53601146",
"0.5303707",
"0.52628565",
"0.525545",
"0.525545",
"0.5253502",
"0.5248146",
"0.5246642",
"0.5161726",
"0.51577294",
"0.5147853",
"0.5145804",
"0.5145804",
... | 0.60245275 | 2 |
Push a `value` into rank `key` in the stack. If stack is full, remove the highestkey element. | def push(self, key, value):
if len(self.heap)<self.depth:
heapq.heappush(self.heap, key)
self.elements[key] = value
else:
oldkey = heapq.heappushpop(self.heap, key)
self.elements[key] = value
del self.elements[oldkey] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, priority, key):\n index = len(self.__heap)\n self.__position[key] = index\n self.__heap.append([priority, key])\n self.__bubble_up(index)",
"def push(value):\n _get_stack().append(value)\n return value",
"def stack_push(self, key, value):\n task = Task.cu... | [
"0.66849923",
"0.6634082",
"0.6583867",
"0.6583773",
"0.6389176",
"0.63875455",
"0.63447315",
"0.63144517",
"0.624918",
"0.6230208",
"0.6230208",
"0.6230208",
"0.62131965",
"0.6210933",
"0.6181782",
"0.61637515",
"0.6156839",
"0.61547214",
"0.61363983",
"0.61363983",
"0.61276... | 0.7211073 | 0 |
Pop an arbitrary element from the stack. | def pop(self):
try:
key = heapq.heappop(self.heap)
return self.elements[key]
except:
raise StopIteration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop():\n stack = _get_stack()\n return _pop(stack)",
"def stack_pop(self):\n value = self.stack.pop()\n\n return value",
"def pop(self):\n item = self.stack[-1]\n self.stack = self.stack[:-1]\n return item",
"def pop(stack):\n item = top(stack)\n stack.top =... | [
"0.842448",
"0.8151936",
"0.81031996",
"0.79872555",
"0.7983027",
"0.77852815",
"0.7755706",
"0.77315784",
"0.77249795",
"0.77175397",
"0.7693865",
"0.76882505",
"0.7672755",
"0.7662141",
"0.76499665",
"0.76170903",
"0.76136965",
"0.7605192",
"0.75713694",
"0.75686145",
"0.75... | 0.0 | -1 |
An iterator of all elements. | def items(self):
return self.elements.values() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter(self):\n\t\tfor element in self.elements:\n\t\t\tyield element",
"def iter(self):\n\t\tfor element in self.elements:\n\t\t\tyield element",
"def __iter__(self):\n return self.elements.__iter__()",
"def __iter__(self) -> Iterator:\n\n elements = []\n self.__get_sorted_elements(se... | [
"0.8624418",
"0.8624418",
"0.81103355",
"0.7893173",
"0.7865645",
"0.7846496",
"0.78017235",
"0.77851886",
"0.77203923",
"0.77036285",
"0.76814884",
"0.76814884",
"0.7669982",
"0.7666654",
"0.7609068",
"0.7587491",
"0.75801945",
"0.7558522",
"0.7558522",
"0.7531785",
"0.75317... | 0.0 | -1 |
Creates a new data processing node. | def __init__(self):
super(Node, self).__init__()
self.inputs = []
self.outputs = []
self._active_outputs = []
self.description = None
# Experimental: dictionary to be used to retype output fields
# Currently used only in CSV source node.
self._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_node(self, data):\n node = RealNode(data, layer=self)\n self.append_node(node)\n return node",
"def create_node(self, hx, data):\n return Node(hx, data)",
"def create(self, data):\n raise NotImplementedError",
"def create_node(self, **kwargs):\n size = kwa... | [
"0.6382126",
"0.6335219",
"0.6309514",
"0.6109113",
"0.60853076",
"0.5968062",
"0.5902115",
"0.5856709",
"0.5844344",
"0.5682231",
"0.56769216",
"0.5634179",
"0.5611931",
"0.558051",
"0.55736357",
"0.5567812",
"0.55676746",
"0.5544683",
"0.5538763",
"0.55377835",
"0.5526054",... | 0.5121294 | 79 |
Initializes the node. Initialization is separated from creation. Put any Node subclass initialization in this method. Default implementation does nothing. | def initialize(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = self.Node(None)",
"def __init__(self):\n self.root = Node(None)",
"def initialize(self, node: MComputeNode):\n raise Exception(\"Subclass responsibility\")",
"def __init__(self):\n self.__root = Node()",
"def __init__(self):\n self.root =... | [
"0.7394568",
"0.7317101",
"0.7298309",
"0.7248716",
"0.71772677",
"0.7159799",
"0.71550786",
"0.7080142",
"0.7070756",
"0.7070756",
"0.7045996",
"0.6988274",
"0.698752",
"0.698752",
"0.698752",
"0.69853956",
"0.6927686",
"0.6922692",
"0.6920655",
"0.68968785",
"0.68796796",
... | 0.62976766 | 65 |
Finalizes the node. Default implementation does nothing. | def finalize(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Finalize():\n pass",
"def destroy(self):\r\n self._namespace.unregisterNode(self)\r\n self._namespace = None\r\n\r\n super(Node, self).destroy()",
"def finalize(self) -> None:\n pass",
"def finalise(self):",
"def finalize(self):\n pass",
"def finalize(self):\n ... | [
"0.6666852",
"0.65631306",
"0.6469437",
"0.64073783",
"0.6394562",
"0.6394562",
"0.6394562",
"0.6394562",
"0.6394562",
"0.6394562",
"0.63694865",
"0.63694865",
"0.63588774",
"0.63588774",
"0.63588774",
"0.63412625",
"0.63276917",
"0.63268626",
"0.63165957",
"0.63050854",
"0.6... | 0.6386332 | 10 |
Main method for running the node code. Subclasses should implement this method. | def run(self):
raise NotImplementedError("Subclasses of Node should implement the run() method") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(self) -> None:\n pass",
"def run(self):\n self.node_id = CONFIG.node_id\n self.running = Event()\n if not CONFIG.master_pub or not CONFIG.master_repl:\n print colors.yellow(\"Master IP:port is not set in config file (%s)\"\n % CONFIG.... | [
"0.71127063",
"0.7055299",
"0.7004291",
"0.6951679",
"0.68885565",
"0.6849409",
"0.67891467",
"0.6762363",
"0.6762363",
"0.6762363",
"0.6762363",
"0.6761332",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
"0.6734421",
... | 0.73212767 | 0 |
Return single node imput if exists. Convenience property for nodes which process only one input. Raises exception if there are no inputs or are more than one imput. | def input(self):
if len(self.inputs) == 1:
return self.inputs[0]
else:
raise Exception("Single input requested. Node has none or more than one input (%d)."
% len(self.inputs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_node(model):\n iter = model.GetNodes()\n while iter.IsValid():\n node = iter.Get()\n if \"InputNode\" in node.GetRuntimeTypeName():\n return node\n iter.Next()\n return None",
"def single_input_node(self, port: int):\n input_nodes = self.input_nodes(p... | [
"0.6151729",
"0.5955724",
"0.5748265",
"0.5743951",
"0.53562725",
"0.5282334",
"0.52456343",
"0.51267284",
"0.5086693",
"0.49852207",
"0.4975962",
"0.49515104",
"0.49140608",
"0.49103492",
"0.49075767",
"0.48992518",
"0.48833162",
"0.48802078",
"0.4870505",
"0.48196357",
"0.4... | 0.6596412 | 0 |
Retype an output field `name` to field `field`. | def retype(self, name, **attributes):
self._retype_dictionary[name] = attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def give_field(self, name):\n return self.field(name).toPyObject()",
"def output_field(self):\n Field = self.original_field.__class__\n if isinstance(self.original_field, fields.CharField):\n return Field(max_length=self.original_field.max_length)\n\n return Field()",
"de... | [
"0.6752095",
"0.6315052",
"0.6160488",
"0.6054666",
"0.5919098",
"0.584958",
"0.57491964",
"0.57263315",
"0.57225895",
"0.5691854",
"0.5658548",
"0.56518394",
"0.5613815",
"0.55921423",
"0.55889755",
"0.5578654",
"0.557052",
"0.5529592",
"0.5525257",
"0.5491146",
"0.548618",
... | 0.0 | -1 |
Remove all retype information for field `name` | def reset_type(self, name):
del self._retype_dictionary[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_type(self, name):\n del self.types[name]",
"def del_typecheck(self, name: str):\n try:\n del self.__custom_types[name]\n except KeyError:\n pass",
"def removeType(self, name):\n delattr(self, name)\n try:\n del self._type_names[name... | [
"0.72864145",
"0.7192131",
"0.691836",
"0.687526",
"0.67571354",
"0.6357059",
"0.6221183",
"0.618953",
"0.61195374",
"0.60606825",
"0.59978074",
"0.594721",
"0.5918989",
"0.59160805",
"0.587979",
"0.5868728",
"0.5825539",
"0.58252525",
"0.57835454",
"0.57558835",
"0.57390386"... | 0.7932862 | 0 |
Put row into all output pipes. Raises `NodeFinished` exception when node's target nodes are not receiving data anymore. In most cases this exception might be ignored, as it is handled in the node thread wrapper. If you want to perform necessary cleanup in the `run()` method before exiting, you should handle this except... | def put(self, obj):
active_outputs = 0
for output in self.outputs:
if not output.closed():
output.put(obj)
active_outputs += 1
# This is not very safe, as run() might not expect it
if not active_outputs:
raise NodeFinished | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\r\n for pipe in self.inputs:\r\n for row in pipe.rows():\r\n self.put(row)",
"def run(self):\r\n\r\n label = node_label(self.node)\r\n self.logger.debug(\"%s: start\" % label)\r\n try:\r\n self.node.run()\r\n except NodeFinish... | [
"0.6481702",
"0.5708942",
"0.5306772",
"0.5198733",
"0.5191754",
"0.49823996",
"0.49682274",
"0.49448922",
"0.4925235",
"0.49159628",
"0.48515922",
"0.47902027",
"0.47844213",
"0.47796345",
"0.47772634",
"0.475717",
"0.46879926",
"0.4686693",
"0.4680408",
"0.46567523",
"0.464... | 0.5994392 | 1 |
Put record into all output pipes. Convenience method. Not recommended to be used. | def put_record(self, obj):
for output in self.outputs:
output.put_record(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\r\n for pipe in self.inputs:\r\n for row in pipe.rows():\r\n self.put(row)",
"def output_to_pipe(pipe_in):\n os.dup2(pipe_in, 1) # stdout\n # os.dup2(pipe_in, 2) # stderr",
"def _redirect_output(self, statement):\n if statement.parsed.pipeTo:\n ... | [
"0.61213005",
"0.57475716",
"0.5589168",
"0.55723286",
"0.55597144",
"0.55597144",
"0.5523319",
"0.54203606",
"0.5412293",
"0.54047567",
"0.53350186",
"0.53147745",
"0.5309683",
"0.53073287",
"0.5282204",
"0.5254947",
"0.5243214",
"0.5234403",
"0.5232203",
"0.51854795",
"0.51... | 0.6897131 | 0 |
Return fields from input pipe, if there is one and only one input pipe. | def input_fields(self):
return self.input.fields | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_fields(self):\r\n if not len(self.inputs) == 1:\r\n raise ValueError(\"Can not get default list of output fields: node has more than one input\"\r\n \" or no input is provided. Subclasses should override this method\")\r\n\r\n if not self.input.fields... | [
"0.63556445",
"0.55331165",
"0.55220664",
"0.55100864",
"0.53098017",
"0.5223637",
"0.5223637",
"0.5223637",
"0.5215609",
"0.5214126",
"0.5176225",
"0.5149865",
"0.5132685",
"0.51181376",
"0.51016253",
"0.5084988",
"0.50791216",
"0.50791216",
"0.5059624",
"0.5044385",
"0.5024... | 0.5838707 | 1 |
Return fields passed to the output by the node. Subclasses should override this method. Default implementation returns same fields as input has, raises exception when there are more inputs or if there is no input connected. | def output_fields(self):
if not len(self.inputs) == 1:
raise ValueError("Can not get default list of output fields: node has more than one input"
" or no input is provided. Subclasses should override this method")
if not self.input.fields:
rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_fields(self):\r\n return self.input.fields",
"def get_data(self):\n return self._fullInput, self._fullOutput",
"def inputs(self):\n return self._inputs",
"def get_inputs(self):\r\n raise NotImplementedError",
"def get_inputs(self):\r\n raise NotImplementedError",
... | [
"0.7205753",
"0.6450373",
"0.6430596",
"0.64131397",
"0.64131397",
"0.6407265",
"0.6407265",
"0.6407265",
"0.63933927",
"0.63620764",
"0.634084",
"0.6317568",
"0.6317568",
"0.6309495",
"0.629971",
"0.6276949",
"0.624751",
"0.62453175",
"0.6219483",
"0.6219483",
"0.6219483",
... | 0.8261576 | 0 |
Convenience method for gettin names of fields generated by the node. For more information | def output_field_names(self):
raise PendingDeprecationWarning
return self.output_fields.names() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_names(self):\n ...",
"def _fields_names(cls) -> List:\n return list(field.name for field in dataclasses.fields(cls))",
"def field_names(self):\r\n return self._names",
"def field_names(self):\n return self.base_field_names() + list(self.data.keys())",
"def get_field_na... | [
"0.8063679",
"0.7392094",
"0.7316079",
"0.72930527",
"0.72878563",
"0.7260172",
"0.71538097",
"0.71378547",
"0.7119306",
"0.7085976",
"0.7020888",
"0.6987065",
"0.69719976",
"0.6964675",
"0.6936302",
"0.6901368",
"0.686708",
"0.6851891",
"0.67818457",
"0.6762945",
"0.6728919"... | 0.6351803 | 44 |
Returns an identifier name of the node class. Identifier is used for construction of streams from dictionaries or for any other outofprogram constructions. Node identifier is specified in the `node_info` dictioanry as ``name``. If no explicit identifier is specified, then decamelized | def identifier(cls):
logger = utils.get_logger()
# FIXME: this is temporary warning
info = get_node_info(cls)
ident = None
if info:
ident = info.get("name")
if not ident:
ident = utils.to_identifier(utils.decamelize(cls.__name__))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_node_name(self):\r\n while 1:\r\n name = \"node\" + str(self._name_sequence)\r\n if name not in self.nodes.keys():\r\n break\r\n self._name_sequence += 1\r\n\r\n return name",
"def _auto_name(self):\n return \"node_\"+str(self._id... | [
"0.720475",
"0.7109115",
"0.69905436",
"0.6864503",
"0.67508626",
"0.66256005",
"0.65824854",
"0.6535852",
"0.6410217",
"0.6389824",
"0.6365405",
"0.6337286",
"0.6250073",
"0.6166268",
"0.6068963",
"0.6068963",
"0.6067767",
"0.60515636",
"0.60225874",
"0.6009654",
"0.59937155... | 0.82302177 | 0 |
Do not pass field from source to target | def drop_field(self, field):
self.dropped_fields.add(field) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hard_update(self,target, source):\n\t\tfor target_param, param in zip(target.parameters(), source.parameters()):\n\t\t\t\ttarget_param.data.copy_(param.data)",
"def keep_potential_source(self):\n self.source = self.potential_source",
"def untargeted(self):\n\t\tpass",
"def transform(self, source, ... | [
"0.588842",
"0.588415",
"0.5809065",
"0.5751016",
"0.5737551",
"0.57017756",
"0.5686874",
"0.5597173",
"0.55874956",
"0.5558963",
"0.5416493",
"0.53822756",
"0.5376385",
"0.534525",
"0.5336105",
"0.5321083",
"0.53012717",
"0.52631414",
"0.5261124",
"0.52504",
"0.524523",
"0... | 0.0 | -1 |
Creates a node for text replacement. | def __init__(self, field, derived_field = None):
super(TextSubstituteNode, self).__init__()
self.field = field
self.derived_field = derived_field
self.substitutions = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newText(content):\n ret = libxml2mod.xmlNewText(content)\n if ret is None:raise treeError('xmlNewText() failed')\n return xmlNode(_obj=ret)",
"def replace(self, oldtext, newtext):\r\n return self",
"def newTextChild(self, ns, name, content):\n if ns is None: ns__o = None\n els... | [
"0.7181351",
"0.6518357",
"0.64638305",
"0.6393571",
"0.6298565",
"0.6192408",
"0.6184668",
"0.6042636",
"0.5996041",
"0.5923028",
"0.5923028",
"0.5891717",
"0.58850646",
"0.5828334",
"0.58161676",
"0.57651085",
"0.5759715",
"0.5744617",
"0.5736814",
"0.5686337",
"0.56439406"... | 0.63470113 | 4 |
Add replacement rule for field. | def add_substitution(self, pattern, repl):
self.substitutions.append( (re.compile(pattern), repl) ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_retokenized_field(data_entry,\n src_field,\n dst_field,\n tokenizer):\n if tokenizer is not None:\n dst = ''\n if src_field in data_entry:\n dst = get_retokenized(tokenizer, data_entry[src_field])\n\n da... | [
"0.59361553",
"0.5924467",
"0.5752338",
"0.5663103",
"0.56613594",
"0.5637269",
"0.56322044",
"0.55279934",
"0.5493966",
"0.5459272",
"0.5423296",
"0.54161084",
"0.54083395",
"0.5287228",
"0.5245987",
"0.521199",
"0.5195269",
"0.5149046",
"0.51205754",
"0.5110027",
"0.5051493... | 0.5276464 | 14 |
Creates a node for string stripping. | def __init__(self, fields = None, chars = None):
super(StringStripNode, self).__init__()
self.fields = fields
self.chars = chars | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip(self) -> String:\n pass",
"def rstrip(self) -> String:\n pass",
"def strip(s):\n parser = StrippingParser( )\n parser.feed(s)\n parser.close( )\n parser.cleanup( )\n return ''.join(parser.result)",
"def lstrip(self) -> String:\n pass",
"def strip(value):\n return value.... | [
"0.6333236",
"0.61538136",
"0.6017034",
"0.59572077",
"0.5842414",
"0.5815026",
"0.58048934",
"0.5781299",
"0.56491125",
"0.55710804",
"0.55240613",
"0.5368304",
"0.536036",
"0.53468174",
"0.5315989",
"0.5271353",
"0.5270803",
"0.5199625",
"0.51990485",
"0.51944214",
"0.51918... | 0.64795625 | 0 |
Creates and initializes selection node | def __init__(self, formula = None, field_name = "new_field", analytical_type = "unknown",
storage_type = "unknown"):
super(DeriveNode, self).__init__()
self.formula = formula
self.field_name = field_name
self.analytical_type = analytical_type
self.st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_selection ( self ,\n tag , \n algotype ,\n inputs , \n *args ,\n **kwargs ) :\n sel_tag = '%s_Selection' % tag\n sel_name = 'Sel%sFor%s' % ( tag , se... | [
"0.6415432",
"0.63343894",
"0.6249176",
"0.6226033",
"0.62115824",
"0.60897166",
"0.60422593",
"0.5963724",
"0.594786",
"0.59226525",
"0.59112215",
"0.59006333",
"0.5898278",
"0.58813524",
"0.58723027",
"0.5850067",
"0.5836292",
"0.5806168",
"0.57722485",
"0.5756462",
"0.5751... | 0.0 | -1 |
Creates and initializes sample node | def __init__(self, size = 1000, discard_sample = False, method = 'first'):
super(SampleNode, self).__init__()
self.size = size
self.discard_sample = discard_sample
self.method = method
# random nodes need a stack to hold intermediate records
if method == "random":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_samples(self):\n self._samples = self.load_samples()\n self.modify_samples()",
"def sample(self):\n # This method is set in __init__.\n pass",
"def __init__(self, samples):\n self.samples = samples",
"def test_init_node():\n from dll import Node\n new_node ... | [
"0.66691697",
"0.63650256",
"0.6305994",
"0.6236223",
"0.61822116",
"0.6144689",
"0.60762167",
"0.6021695",
"0.6018056",
"0.60071146",
"0.5990444",
"0.5934135",
"0.5927976",
"0.5907521",
"0.58858216",
"0.5863495",
"0.5825628",
"0.5798176",
"0.57928085",
"0.5752973",
"0.574046... | 0.643904 | 1 |
Creates a node that concatenates records from inputs. Order of input pipes matter. | def __init__(self):
super(AppendNode, self).__init__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_helper_concat_node(inputs, output_name, axis=0):\n concat_node = onnx.helper.make_node(\n \"Concat\",\n inputs=inputs,\n outputs=[output_name],\n name=output_name,\n axis=axis,\n )\n return [concat_node]",
"def convert_concat(node, **kwargs):\n name, inpu... | [
"0.65958035",
"0.62402517",
"0.6230125",
"0.60295165",
"0.5975362",
"0.5867037",
"0.5622088",
"0.5397199",
"0.5308368",
"0.5212971",
"0.5208171",
"0.51931316",
"0.5192742",
"0.5126222",
"0.51228344",
"0.5092008",
"0.504928",
"0.50470215",
"0.5043097",
"0.5037961",
"0.5035529"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.