query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
returns a hubspot3 companies properties client | def companies_properties(self):
from hubspot3.companies_properties import CompaniesPropertiesClient
return CompaniesPropertiesClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def companies(self):\n from hubspot3.companies import CompaniesClient\n\n return CompaniesClient(**self.auth, **self.options)",
"def properties(self):\n from hubspot3.properties import PropertiesClient\n\n return PropertiesClient(**self.auth, **self.options)",
"def test_get_all_comp... | [
"0.69698316",
"0.696087",
"0.6011539",
"0.5963819",
"0.59212357",
"0.59212357",
"0.5740776",
"0.57126844",
"0.5617414",
"0.55970114",
"0.55205953",
"0.54810315",
"0.54792887",
"0.5478122",
"0.5425279",
"0.5425279",
"0.5425279",
"0.5425279",
"0.5409907",
"0.5355077",
"0.535275... | 0.82029974 | 0 |
returns a hubspot3 contact_lists client | def contact_lists(self):
from hubspot3.contact_lists import ContactListsClient
return ContactListsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contacts(self):\n from hubspot3.contacts import ContactsClient\n\n return ContactsClient(**self.auth, **self.options)",
"def test_get_contact_lists(self):\n url, parsed = self.prepare_urls('v1:contact_list-list', subdomain=self.company.subdomain)\n \n response = self.client... | [
"0.704604",
"0.6421747",
"0.62730813",
"0.6198494",
"0.6078032",
"0.6062489",
"0.599703",
"0.59258866",
"0.5887457",
"0.58674943",
"0.5770238",
"0.5762849",
"0.5737699",
"0.5637677",
"0.5621611",
"0.5569004",
"0.5501729",
"0.5499212",
"0.5492903",
"0.5470965",
"0.54699755",
... | 0.86094034 | 0 |
returns a hubspot3 contacts client | def contacts(self):
from hubspot3.contacts import ContactsClient
return ContactsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact_lists(self):\n from hubspot3.contact_lists import ContactListsClient\n\n return ContactListsClient(**self.auth, **self.options)",
"def create_client(email, password):\n gd_client = gdata.contacts.service.ContactsService()\n gd_client.email = email\n gd_client.password = password\n g... | [
"0.69718164",
"0.6615639",
"0.6500447",
"0.62800145",
"0.61697626",
"0.6131812",
"0.6107015",
"0.61006546",
"0.60507894",
"0.60092515",
"0.5940466",
"0.5848664",
"0.583989",
"0.58214605",
"0.57957256",
"0.57394063",
"0.57081205",
"0.56960225",
"0.5692341",
"0.5685207",
"0.566... | 0.7637074 | 0 |
returns a hubspot3 crm_associations client | def crm_associations(self):
from hubspot3.crm_associations import CRMAssociationsClient
return CRMAssociationsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crm_association_labels(self):\n from hubspot3.crm_association_labels import CRMAssociationLabelsClient\n\n return CRMAssociationLabelsClient(**self.auth, **self.options)",
"def createAssociation(self):\n return _libsbml.GeneAssociation_createAssociation(self)",
"def get_all_association... | [
"0.6385811",
"0.5699839",
"0.5687796",
"0.5536202",
"0.5516986",
"0.54692876",
"0.54068315",
"0.5402888",
"0.5398616",
"0.5319376",
"0.5269799",
"0.515208",
"0.5123171",
"0.51175153",
"0.5094988",
"0.5089414",
"0.5048406",
"0.503546",
"0.50312126",
"0.49829647",
"0.4946517",
... | 0.8560642 | 0 |
returns a hubspot3 crm_association_labels client | def crm_association_labels(self):
from hubspot3.crm_association_labels import CRMAssociationLabelsClient
return CRMAssociationLabelsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crm_associations(self):\n from hubspot3.crm_associations import CRMAssociationsClient\n\n return CRMAssociationsClient(**self.auth, **self.options)",
"def build_resource_labels(self):\n response = [ \n {\n \"key\": \"instance_id\", \n \"value\": \... | [
"0.6071502",
"0.5322365",
"0.5304862",
"0.5284204",
"0.5188073",
"0.51244867",
"0.50488967",
"0.50180405",
"0.49787408",
"0.49610063",
"0.49515802",
"0.48883596",
"0.48674572",
"0.48561567",
"0.48498568",
"0.48187628",
"0.4791505",
"0.4775393",
"0.47647417",
"0.4753614",
"0.4... | 0.8701838 | 0 |
returns a hubspot3 crm_pipelines client | def crm_pipelines(self):
from hubspot3.crm_pipelines import PipelinesClient
return PipelinesClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipelines(self):\n return PipelineManager(session=self._session)",
"def pipeline(self, pipeline_id):\r\n return pipelines.Pipeline(self, pipeline_id)",
"def create(self, params):\n return self.make_client_call('create_pipeline', params)",
"def pipeline(\n self,\n name: ... | [
"0.60590196",
"0.59420896",
"0.57980007",
"0.5783509",
"0.5604271",
"0.55751723",
"0.5527596",
"0.5472684",
"0.54133207",
"0.53854656",
"0.53759104",
"0.5366769",
"0.53499746",
"0.53399444",
"0.5338974",
"0.5297997",
"0.52654237",
"0.5256316",
"0.5242897",
"0.5201011",
"0.516... | 0.86639446 | 0 |
returns a hubspot3 deals client | def deals(self):
from hubspot3.deals import DealsClient
return DealsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client(self):\n return self.client",
"def get_client():\n client = soundcloud.Client(client_id=CLIENT_ID)\n return client",
"def get_client():\n return Client(__address, authkey='strumamor')",
"def _base(self):\n from hubspot3.base import BaseClient\n\n return BaseClient... | [
"0.6252603",
"0.61939126",
"0.6150615",
"0.61449",
"0.6058313",
"0.5927786",
"0.59212744",
"0.58580124",
"0.5843256",
"0.5824967",
"0.5824967",
"0.57658595",
"0.5742891",
"0.5735264",
"0.57236224",
"0.57196844",
"0.5715774",
"0.57037723",
"0.5702824",
"0.56895584",
"0.5680095... | 0.7125292 | 0 |
returns a hubspot3 ecommerce bridge client | def ecommerce_bridge(self):
from hubspot3.ecommerce_bridge import EcommerceBridgeClient
return EcommerceBridgeClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _base(self):\n from hubspot3.base import BaseClient\n\n return BaseClient(**self.auth, **self.options)",
"def get_client(public_key: str, secret_key: str, **_):\n razorpay_client = razorpay.Client(auth=(public_key, secret_key))\n return razorpay_client",
"def get_client():\n return C... | [
"0.6353633",
"0.62716436",
"0.6105943",
"0.5840468",
"0.58241993",
"0.57731724",
"0.573589",
"0.56753105",
"0.56687224",
"0.56641436",
"0.56578296",
"0.5631255",
"0.56298184",
"0.56201476",
"0.5618798",
"0.5608762",
"0.5532115",
"0.5521776",
"0.551464",
"0.5513728",
"0.550873... | 0.79144055 | 0 |
returns a hubspot3 email events client | def email_events(self):
from hubspot3.email_events import EmailEventsClient
return EmailEventsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_subscription(self):\n from hubspot3.email_subscription import EmailSubscriptionClient\n\n return EmailSubscriptionClient(**self.auth, **self.options)",
"def init_eventhub_client(\n experiment_secrets: Secrets) -> EventHubManagementClient:\n return __azure_client_factory(\"EventH... | [
"0.6367837",
"0.5789799",
"0.5618336",
"0.5551444",
"0.54957366",
"0.54557705",
"0.5421596",
"0.54140735",
"0.538108",
"0.5344483",
"0.52856636",
"0.5266521",
"0.52233267",
"0.5203818",
"0.51996434",
"0.51891947",
"0.51643056",
"0.51474404",
"0.5137968",
"0.51285064",
"0.5126... | 0.8252525 | 0 |
returns a hubspot3 email subscription client | def email_subscription(self):
from hubspot3.email_subscription import EmailSubscriptionClient
return EmailSubscriptionClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_events(self):\n from hubspot3.email_events import EmailEventsClient\n\n return EmailEventsClient(**self.auth, **self.options)",
"def get(subject_name, user_email):\n return Subscription.get_by_key_name(subject_name + ':' + user_email)",
"def subscribe(self, request):\n ema... | [
"0.6182999",
"0.61074007",
"0.59008026",
"0.5831174",
"0.5761057",
"0.57119596",
"0.56577545",
"0.565422",
"0.56410825",
"0.5637752",
"0.55905",
"0.5579827",
"0.5553989",
"0.54857594",
"0.5470009",
"0.542864",
"0.5424603",
"0.54224163",
"0.5387989",
"0.53813833",
"0.53727",
... | 0.82150704 | 0 |
returns a hubspot3 engagements client | def engagements(self):
from hubspot3.engagements import EngagementsClient
return EngagementsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _base(self):\n from hubspot3.base import BaseClient\n\n return BaseClient(**self.auth, **self.options)",
"def get_client():\n return Client(__address, authkey='strumamor')",
"def get_client():\n client = soundcloud.Client(client_id=CLIENT_ID)\n return client",
"def _get_glance_clie... | [
"0.60267407",
"0.6023978",
"0.59784997",
"0.59232074",
"0.58615595",
"0.5790585",
"0.5708655",
"0.5706453",
"0.5706453",
"0.5705271",
"0.57035154",
"0.56841195",
"0.5651154",
"0.56461835",
"0.5541245",
"0.5516122",
"0.55018616",
"0.5478743",
"0.5420743",
"0.5380657",
"0.53797... | 0.7285637 | 0 |
returns a hubspot3 form submissions client | def form_submissions(self):
from hubspot3.forms import FormSubmissionClient
return FormSubmissionClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forms(self):\n from hubspot3.forms import FormsClient\n\n return FormsClient(**self.auth, **self.options)",
"def get_form(self):\n return self.form",
"def get_form(self):\n return self.form",
"def get_submission_display_form(self):\n return self.organization.get_display... | [
"0.71504986",
"0.5716183",
"0.5716183",
"0.5678006",
"0.56653833",
"0.55909383",
"0.5588526",
"0.55639315",
"0.5542722",
"0.55137026",
"0.5507221",
"0.54896057",
"0.54254794",
"0.5358737",
"0.53340167",
"0.5204283",
"0.52042687",
"0.5202235",
"0.51578796",
"0.5146645",
"0.513... | 0.81327933 | 0 |
returns a hubspot3 forms client | def forms(self):
from hubspot3.forms import FormsClient
return FormsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_submissions(self):\n from hubspot3.forms import FormSubmissionClient\n\n return FormSubmissionClient(**self.auth, **self.options)",
"def get_form(self, form_class=None):\n if form_class is None:\n form_class = self.get_form_class()\n return form_class(\n ... | [
"0.65395904",
"0.5988038",
"0.5970266",
"0.5946718",
"0.5934031",
"0.5934031",
"0.59302837",
"0.59302837",
"0.58807176",
"0.5842654",
"0.58077466",
"0.5764588",
"0.57633805",
"0.5688206",
"0.5682857",
"0.56553245",
"0.5616953",
"0.5604225",
"0.5600026",
"0.55964017",
"0.55937... | 0.8207574 | 0 |
returns a hubspot3 keywords client | def keywords(self):
from hubspot3.keywords import KeywordsClient
return KeywordsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_client(self):\n _client = KOPS(provider=self.provider, config=self.config)\n return _client",
"def get_client():\n client = soundcloud.Client(client_id=CLIENT_ID)\n return client",
"def get(self, request, format=None):\n user = request.user\n user.backend = 'django.co... | [
"0.60305077",
"0.5830813",
"0.5828398",
"0.58134973",
"0.5594215",
"0.54804134",
"0.546163",
"0.5396086",
"0.53635937",
"0.536062",
"0.536062",
"0.535805",
"0.53450435",
"0.53245497",
"0.5317796",
"0.53057516",
"0.5291663",
"0.5259781",
"0.52549416",
"0.525467",
"0.5241235",
... | 0.8264318 | 0 |
returns a hubspot3 leads client | def leads(self):
from hubspot3.leads import LeadsClient
return LeadsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client(self):\n return self.client",
"def getClient(self):\n authDict = Configuration().read_auth_data_from_config()\n client_key = authDict['client_key']\n client_secret = authDict['client_secret']\n token = authDict['token']\n token_secret = authDict['token_sec... | [
"0.61552864",
"0.59127754",
"0.5897535",
"0.5878011",
"0.5858979",
"0.57430226",
"0.57262874",
"0.5725329",
"0.5703237",
"0.56576616",
"0.5631702",
"0.5621449",
"0.56048435",
"0.55989164",
"0.55832195",
"0.5573215",
"0.55402434",
"0.5527298",
"0.5454359",
"0.5448554",
"0.5435... | 0.70704144 | 0 |
returns a hubspot3 lines client | def lines(self):
from hubspot3.lines import LinesClient
return LinesClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _base(self):\n from hubspot3.base import BaseClient\n\n return BaseClient(**self.auth, **self.options)",
"def client():\n\n client = Client()\n return client",
"def get_client():\n return Client(__address, authkey='strumamor')",
"def client():",
"def raw_client(self):\r\n ... | [
"0.6178066",
"0.59562576",
"0.591661",
"0.58400154",
"0.5801957",
"0.57216364",
"0.5663614",
"0.5609936",
"0.55859077",
"0.55755645",
"0.55726963",
"0.5505805",
"0.5474036",
"0.54360527",
"0.5412271",
"0.5405843",
"0.5379342",
"0.5367301",
"0.5335762",
"0.5335031",
"0.5332687... | 0.77718383 | 0 |
returns a hubspot3 OAuth2 client | def oauth2(self):
from hubspot3.oauth2 import OAuth2Client
return OAuth2Client(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_user_client(self):\n return api.OAuthClient(settings.CLIENT_ID, settings.CLIENT_SECRET, settings.USER, settings.PASSWORD)",
"def get_http_client():\n store = file.Storage(TOKEN_STORE_FILE)\n creds = store.get()\n if not creds or creds.invalid:\n flow = client.flow_from_clientsecre... | [
"0.6818645",
"0.66082937",
"0.6519634",
"0.6518255",
"0.6509858",
"0.64427716",
"0.62963766",
"0.6239472",
"0.61872387",
"0.6186533",
"0.6186434",
"0.6148667",
"0.61478",
"0.6144481",
"0.61226684",
"0.60560864",
"0.60414225",
"0.60333574",
"0.60012186",
"0.5952296",
"0.595086... | 0.8399952 | 0 |
returns a hubspot3 owners client | def owners(self):
from hubspot3.owners import OwnersClient
return OwnersClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client():\n return Client(__address, authkey='strumamor')",
"def get_client(self):\n return self.client",
"def get_contribs_client():\n from mpcontribs.client import Client\n\n headers = get_consumer()\n\n if is_localhost():\n return Client(apikey=get_user_api_key())\n else... | [
"0.642027",
"0.6321152",
"0.6277686",
"0.6234495",
"0.6125955",
"0.6105564",
"0.59868777",
"0.5915874",
"0.58269143",
"0.5819595",
"0.58133",
"0.58131087",
"0.58131087",
"0.5799837",
"0.5796643",
"0.5795796",
"0.5751736",
"0.574989",
"0.573055",
"0.57257473",
"0.57205164",
... | 0.750011 | 0 |
returns a hubspot3 products client | def products(self):
from hubspot3.products import ProductsClient
return ProductsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ecommerce_bridge(self):\n from hubspot3.ecommerce_bridge import EcommerceBridgeClient\n\n return EcommerceBridgeClient(**self.auth, **self.options)",
"def getProducts():\n return \"http://api.tcgplayer.com/catalog/products\"",
"def _base(self):\n from hubspot3.base import BaseClient... | [
"0.6638602",
"0.6370649",
"0.6266043",
"0.6079702",
"0.5941544",
"0.59005827",
"0.5822369",
"0.58213204",
"0.5801335",
"0.579243",
"0.57651037",
"0.57154477",
"0.57102543",
"0.57102543",
"0.5709735",
"0.5686267",
"0.5634477",
"0.5612543",
"0.5566559",
"0.5561518",
"0.5549502"... | 0.7860981 | 0 |
returns a hubspot3 deal properties client | def properties(self):
from hubspot3.properties import PropertiesClient
return PropertiesClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings(self):\n from hubspot3.settings import SettingsClient\n\n return SettingsClient(**self.auth, **self.options)",
"def companies_properties(self):\n from hubspot3.companies_properties import CompaniesPropertiesClient\n\n return CompaniesPropertiesClient(**self.auth, **self.o... | [
"0.57678705",
"0.57409227",
"0.5737253",
"0.56680626",
"0.56680626",
"0.5625537",
"0.5556885",
"0.5462457",
"0.5444374",
"0.542395",
"0.54206717",
"0.5410412",
"0.53933513",
"0.534706",
"0.5293555",
"0.5268462",
"0.5240711",
"0.5212865",
"0.5198082",
"0.51971966",
"0.517544",... | 0.7293561 | 0 |
returns a hubspot3 property_groups client | def property_groups(self):
from hubspot3.property_groups import PropertyGroupsClient
return PropertyGroupsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups(self):\n #return self.get('{}/groups'.format(ApiVersion.A1.value))\n return self.get('{}/groups'.format(ApiVersion.CM1.value))",
"def get_groups(self):\n return Client._get(self)",
"def create_group(self, properties: dict[str, Any | None]) -> dict:\n group = self.ms_client.http_r... | [
"0.6509584",
"0.6385209",
"0.6227709",
"0.61572313",
"0.6067818",
"0.5885252",
"0.5792656",
"0.5691836",
"0.5676695",
"0.56132865",
"0.5579041",
"0.5548496",
"0.5548496",
"0.5543798",
"0.550542",
"0.5496097",
"0.54740804",
"0.5470701",
"0.54537266",
"0.5415589",
"0.5410827",
... | 0.87084264 | 0 |
returns a hubspot3 prospects client | def prospects(self):
from hubspot3.prospects import ProspectsClient
return ProspectsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def properties(self):\n from hubspot3.properties import PropertiesClient\n\n return PropertiesClient(**self.auth, **self.options)",
"def get_client():\n client = soundcloud.Client(client_id=CLIENT_ID)\n return client",
"def get_client(httpx_settings: Optional[dict] = None) -> \"PrefectClien... | [
"0.6076795",
"0.6015214",
"0.59815",
"0.5950727",
"0.58112586",
"0.5794802",
"0.57118213",
"0.5671132",
"0.5656884",
"0.5649933",
"0.56174827",
"0.56108445",
"0.5585113",
"0.5570502",
"0.5549609",
"0.55432427",
"0.5505612",
"0.5494272",
"0.5480817",
"0.54793614",
"0.54560244"... | 0.7401481 | 0 |
returns a hubspot3 settings client | def settings(self):
from hubspot3.settings import SettingsClient
return SettingsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_settings():\n return CLIENT_SETTINGS",
"def settings() -> Settings:\n return Settings()",
"def settings():\n return SettingsMock.instance()",
"def get_settings():\n return SettingCollection.build()",
"def properties(self):\n from hubspot3.properties import PropertiesClient\n\n... | [
"0.7222081",
"0.6870044",
"0.6661073",
"0.6642579",
"0.66267145",
"0.6524955",
"0.63986564",
"0.63950354",
"0.63890433",
"0.6387874",
"0.63321626",
"0.6278677",
"0.61736095",
"0.61690205",
"0.6129049",
"0.6113728",
"0.60541964",
"0.602171",
"0.6016496",
"0.59656286",
"0.59586... | 0.8556558 | 0 |
returns a hubspot3 tickets client | def tickets(self):
from hubspot3.tickets import TicketsClient
return TicketsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ticket(self) -> \"Ticket\":\n return Ticket(connection=self)",
"def get_client():\n return Client(__address, authkey='strumamor')",
"def query_tickets(self):\n return self._call_txtrader_api('query_tickets', {})",
"def ticket(self, ticket_id):\r\n return tickets.Ticket(self, ticke... | [
"0.6037072",
"0.60039973",
"0.5836149",
"0.5765371",
"0.5740071",
"0.57372093",
"0.5702432",
"0.5690938",
"0.56210035",
"0.56201804",
"0.5616357",
"0.56156",
"0.5511444",
"0.5457296",
"0.5455517",
"0.54529905",
"0.54529905",
"0.5452588",
"0.5450771",
"0.5441061",
"0.54339916"... | 0.75255 | 0 |
returns a hubspot3 users client | def users(self):
from hubspot3.users import UsersClient
return UsersClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_user_client(self):\n return api.OAuthClient(settings.CLIENT_ID, settings.CLIENT_SECRET, settings.USER, settings.PASSWORD)",
"def user_client(user):\n client = Client()\n client.force_login(user)\n return client",
"def users(self):\n return self._sdk_dependencies.user_client",
... | [
"0.6719495",
"0.65504575",
"0.6405772",
"0.63795984",
"0.6273443",
"0.6147121",
"0.6142474",
"0.59391433",
"0.5937106",
"0.59205884",
"0.5899866",
"0.58998626",
"0.58959305",
"0.5890936",
"0.58880675",
"0.58743423",
"0.5826481",
"0.57926613",
"0.578161",
"0.5752077",
"0.57354... | 0.7828011 | 0 |
returns a hubspot3 workflows client | def workflows(self):
from hubspot3.workflows import WorkflowsClient
return WorkflowsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_client(self):\n return workflow_ctx.internal.handler.rest_client",
"def get_workflow_object(\n workflow_name, settings, logger, client, token, decision, maximum_page_size\n):\n module_name = \"workflow.\" + workflow_name\n module_object = importlib.import_module(module_name)\n workflo... | [
"0.64411646",
"0.6372315",
"0.61268055",
"0.57950073",
"0.5623727",
"0.5577613",
"0.5577192",
"0.55506825",
"0.5480159",
"0.5480159",
"0.54425",
"0.5391359",
"0.53900045",
"0.5352455",
"0.5352455",
"0.53495854",
"0.53254145",
"0.53099036",
"0.52997226",
"0.5293179",
"0.529108... | 0.7031461 | 0 |
Add shared or separable branch convs > avg pool (optional) > fcs | def _add_conv_fc_branch(self,
num_branch_convs,
num_branch_fcs,
in_channels,
is_shared=False):
last_layer_dim = in_channels
# add branch specific conv layers
branch_convs = nn.ModuleLi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_conv_fc_branch(\n self, num_branch_convs: int, num_branch_fcs: int,\n in_channels: int) -> Tuple[nn.ModuleList, nn.ModuleList, int]:\n last_layer_dim = in_channels\n # add branch specific conv layers\n branch_convs = nn.ModuleList()\n if num_branch_convs >... | [
"0.58826333",
"0.56676537",
"0.5280273",
"0.5261909",
"0.52468556",
"0.51978064",
"0.51913476",
"0.5176274",
"0.5174135",
"0.51380986",
"0.51193315",
"0.51178896",
"0.50254995",
"0.5006025",
"0.5003336",
"0.500286",
"0.49975458",
"0.49937192",
"0.4992245",
"0.49743164",
"0.49... | 0.6243795 | 0 |
Use this to directly pull local variables from locals() in the view to the template while strip unwanted variables (those that start with | def _filterls(locals):
for var in locals.keys():
if var.startswith("_"): del locals[var]
return locals | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_locals(self):\n self._locals = dict()",
"def _prepare_args(local_vars):\n return {k: v for k, v in local_vars.items() if k != 'self'}",
"def test_with_strip(self):\n t = Template('{% load djblets_utils %}'\n '{% definevar \"myvar\" strip %}\\n'\n ... | [
"0.5948064",
"0.5937258",
"0.55912334",
"0.5514813",
"0.5495749",
"0.53393745",
"0.52748865",
"0.5265433",
"0.525802",
"0.52491635",
"0.5187767",
"0.510757",
"0.51048976",
"0.5076702",
"0.50650036",
"0.506425",
"0.5052194",
"0.5049793",
"0.5024447",
"0.50177234",
"0.4976772",... | 0.68108374 | 0 |
This is a function that pastes two strings together. | def paste_strings(string_one,string_two):
return string_one + " " + string_two | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate_string(string1, stringy2):\n return string1 + \" \" + stringy2",
"def concatenate_string(stringy1, stringy2):\n\n return \"{} {}\".format(stringy1, stringy2)",
"def jointext(firststring, secondstring):\n\n # Return the joined strings\n return str(firststring) + str(secondstring)",
... | [
"0.6997765",
"0.69431186",
"0.6841833",
"0.6821281",
"0.6821281",
"0.6821281",
"0.67009646",
"0.65374",
"0.64167047",
"0.63320285",
"0.63019747",
"0.62386143",
"0.62326765",
"0.6164099",
"0.61591166",
"0.6037331",
"0.6029233",
"0.6008897",
"0.5949901",
"0.5914301",
"0.5855495... | 0.8231077 | 0 |
Return the image for the given animation frame number. | def get_image(self, frame):
msec = frame * config.MS_PER_FRAME
frame = msec // 250
return self.frames[frame % self.num_frames] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getImage(self):\n\n\t\t\t_frame = str(self._frame)\n\t\t\tself._counter += 1\n\t\t\tif self._counter >= 10/ANIMATION_SPEED:\n\t\t\t\tself._frame += 1\n\t\t\t\tself._counter = 0\n\n\t\t\tif self.images[self.getState()][self.getDirection()][str(self._frame)] == {}:\n\t\t\t\tself._frame = 0\n\n\t\t\treturn self.i... | [
"0.74070966",
"0.7209367",
"0.70871186",
"0.7005644",
"0.68427855",
"0.6743571",
"0.6614826",
"0.64422673",
"0.64266527",
"0.6382765",
"0.6280082",
"0.62779075",
"0.6245382",
"0.61652416",
"0.6007624",
"0.5988734",
"0.5977328",
"0.59592944",
"0.59515476",
"0.59482586",
"0.591... | 0.7643976 | 0 |
Displays the complete list of tokens. | def list_tokens(self) -> str:
return self._format_symbol_table_content("Tokens", self._symbols.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens():\n pass",
"def show_tokenization(tokenizer, dataset, i):\n\n print(f'\\n--- Tokenization of document {i} --------------------------------------------')\n print( dataset[i] )\n print()\n print( tokenizer.texts_to_sequences([dataset[i]])[0] )\n print()\n print( [tokenizer.index_... | [
"0.6715309",
"0.60501593",
"0.5986369",
"0.59752697",
"0.59585273",
"0.5934093",
"0.5932641",
"0.59248835",
"0.59206766",
"0.5907715",
"0.5903175",
"0.58706224",
"0.5813404",
"0.5799955",
"0.5785009",
"0.57788",
"0.5690448",
"0.56663",
"0.56370753",
"0.56366265",
"0.5636269",... | 0.6684944 | 1 |
Format the symbol table content. | def _format_symbol_table_content(self, title: str, symbols: Any) -> str:
header = f"\t\t:::: {title} ::::"
lines = ["\n", header, "__" * len(header)]
if type(symbols).__name__ == "odict_items":
lines.extend((f"| {key}: {value}") for key, value in self._symbols.items())
elif ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self) -> str:\n\n return self._format_symbol_table_content(\"Symbol table\", self._symbols.items())",
"def pretty(self):\n #table = [\"\".join([\"%8s \" % s for s in self.alpha.getSymbols()])]\n table = []\n for row in PWM.getFreq(self):\n table.append(\"\".join... | [
"0.65451115",
"0.6347843",
"0.63046366",
"0.6118789",
"0.60023355",
"0.59553057",
"0.5923173",
"0.5862241",
"0.58448404",
"0.58448404",
"0.58448404",
"0.5818825",
"0.5818825",
"0.58092445",
"0.57842445",
"0.5764142",
"0.57542443",
"0.5747495",
"0.57352525",
"0.5686349",
"0.56... | 0.7875833 | 0 |
Unwrap a CloudEvent (binary or structured) from an HTTP request. | def from_http(
headers: typing.Dict[str, str],
data: typing.Union[str, bytes, None],
data_unmarshaller: types.UnmarshallerType = None,
):
if data is None or data == b"":
# Empty string will cause data to be marshalled into None
data = ""
if not isinstance(data, (str, bytes, bytearra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialize_event(data):\n if data[\"event_class\"] == \"StructuredLogEvent\":\n return StructuredLogEvent.deserialize(data)\n if data[\"event_class\"] == \"StructuredErrorLogEvent\":\n return StructuredErrorLogEvent.deserialize(data)\n\n raise Exception(f\"unknown event class {data['eve... | [
"0.5753097",
"0.57426614",
"0.5716344",
"0.5544744",
"0.55350524",
"0.5498433",
"0.5425121",
"0.53347987",
"0.5258244",
"0.5252327",
"0.52222824",
"0.5167019",
"0.5162442",
"0.5128562",
"0.50948",
"0.5073586",
"0.50647134",
"0.5048078",
"0.50111675",
"0.4958646",
"0.49372533"... | 0.5944476 | 0 |
Creates valid data for search for sale | def get_data_sales(self):
return {
'search_type': SearchForm.SEARCH_TYPE_SALE,
'min_price': '40000',
'max_price': '50000',
'location':'Test, Test',
'min_bedrooms': '5',
'property_type': str(PropertyTypeFactory().slug)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_sale(self, data):\n if len(data.keys()) == 0 or len(data.keys()) > 3:\n return \"Invalid keys\"\n if 'product_name' and 'product_quantity' not in data.keys():\n return \"Add product name and quantity\"\n if data['product_name'] == \"\":\n return \"... | [
"0.5981393",
"0.5914526",
"0.57246405",
"0.5622769",
"0.55723983",
"0.5558214",
"0.55570054",
"0.5552473",
"0.5528546",
"0.55014",
"0.5464919",
"0.5371977",
"0.5365451",
"0.5357412",
"0.53486156",
"0.52894795",
"0.5285221",
"0.52782786",
"0.52769214",
"0.52681714",
"0.5266101... | 0.7057992 | 0 |
Create a request factory and then create 4 prices for validation of SearchForm | def setUp(self):
super(BaseSearchPageViewTestCase, self).setUp()
SearchPriceFactory(
type=SearchPrice.SEARCH_PRICE_LETTING,
label='100',
price=100
)
SearchPriceFactory(
type=SearchPrice.SEARCH_PRICE_LETTING,
label='200',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_builder(searchForm):\n \n assert searchForm['listingType'] in ['Sale', 'Rent', 'Share', 'Sold', 'NewHomes'], \\\n 'listingType must be one of [Sale, Rent, Share, Sold, NewHomes]'\n \n # Build the search parameters with the locations\n locations = searchForm['locations']\n Search... | [
"0.5514858",
"0.54906815",
"0.5362119",
"0.5319862",
"0.5299136",
"0.52538735",
"0.52390444",
"0.52238387",
"0.5217145",
"0.5103241",
"0.5076517",
"0.5070567",
"0.504083",
"0.50137013",
"0.5004632",
"0.50025827",
"0.49437153",
"0.49340943",
"0.49269733",
"0.49258238",
"0.4908... | 0.5712859 | 0 |
Test to check that if the request is GET and if the request.GET contains the key 'search_type' then the get_initial value on view returns a Dictionary containing the required keys from GET to populate SearchForm | def test_view_get_initial(self):
data = super(BaseSearchPageViewTestCase, self).get_data_sales()
request = self.factory.get(reverse('sales:search') + '?' + urlencode(data))
view = super(BaseSearchPageViewTestCase, self).initialize(BaseSearchPageView(), request)
response = view.get_ini... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form_kwargs(self) -> Dict[str, Any]:\n kwargs = super().get_form_kwargs()\n\n if self.request.GET:\n kwargs['data'] = deepcopy(self.request.GET)\n\n return kwargs",
"def get_form_kwargs(self):\n\n kwargs = super().get_form_kwargs()\n kwargs.update({\n ... | [
"0.6203817",
"0.6156758",
"0.61003345",
"0.5871314",
"0.5775577",
"0.5755485",
"0.56558347",
"0.56323826",
"0.5589823",
"0.5577721",
"0.556519",
"0.552979",
"0.5529593",
"0.5524157",
"0.5509298",
"0.54992074",
"0.5482883",
"0.5460702",
"0.5432394",
"0.5431865",
"0.54296786",
... | 0.66061205 | 0 |
Creates a form with required data, calls the form_valid method on this form then checks that the form_valid method on class when passed this valid form attempts to redirect to an expected sales search URL | def test_view_form_valid_sales_method(self, google):
google.return_value = GeocoderMock()
form_data = super(BaseSearchPageViewTestCase, self).get_data_sales()
view = super(BaseSearchPageViewTestCase, self).initialize(BaseSearchPageView(), None)
view.form_class = SearchForm
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_valid(self, form):\n create_dict={'creater':self.request.user}\n if self.hoster_model is not None:\n self.hoster = self.hoster_model._default_manager.get(pk=self.kwargs[self.hoster_pk_url_kwarg])\n create_dict.update(dict(\n hoster=self.hoster,\n ... | [
"0.65999097",
"0.6447904",
"0.6394753",
"0.63933057",
"0.63713235",
"0.63676554",
"0.6344434",
"0.62976456",
"0.6290051",
"0.62702036",
"0.62442935",
"0.61843276",
"0.61743385",
"0.61651516",
"0.6162264",
"0.61466116",
"0.61466116",
"0.61370236",
"0.61134756",
"0.61128855",
"... | 0.7040125 | 0 |
Creates a form with required data, calls the form_valid method on this form then checks that the form_valid method on class when passed this valid form attempts to redirect to an expected lettings search URL | def test_view_form_valid_lettings_method(self, google):
google.return_value = GeocoderMock()
form_data = super(BaseSearchPageViewTestCase, self).get_data_lettings()
view = super(BaseSearchPageViewTestCase, self).initialize(BaseSearchPageView(), None)
view.form_class = SearchForm
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_valid(self, form):\n create_dict={'creater':self.request.user}\n if self.hoster_model is not None:\n self.hoster = self.hoster_model._default_manager.get(pk=self.kwargs[self.hoster_pk_url_kwarg])\n create_dict.update(dict(\n hoster=self.hoster,\n ... | [
"0.6655724",
"0.64300436",
"0.6402363",
"0.638645",
"0.62556213",
"0.62403053",
"0.6231761",
"0.6231761",
"0.6180458",
"0.6178254",
"0.61634636",
"0.61391604",
"0.61358684",
"0.60828847",
"0.602825",
"0.602825",
"0.6003667",
"0.5976362",
"0.5960358",
"0.5951001",
"0.59502184"... | 0.70828277 | 0 |
Creates form data and validates. When form_valid called geocoder causes error and should redirect to search error page | def test_view_form_valid_error_method(self, google):
google.return_value = GeocoderErrorMock()
form_data = super(BaseSearchPageViewTestCase, self).get_data_lettings()
view = super(BaseSearchPageViewTestCase, self).initialize(BaseSearchPageView(), None)
view.form_class = SearchForm
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_valid(self, form):\n form.instance.auth_user = self.request.user\n form.instance.group = self.get_local_group()\n\n form.instance.locality = form.cleaned_data['locality']\n form.instance.status = 'submitted'\n\n super(CreateInitiativeView, self).form_valid(form)\n\n ... | [
"0.64768755",
"0.61399275",
"0.6121523",
"0.6067362",
"0.59510225",
"0.5944555",
"0.590567",
"0.5831166",
"0.5826135",
"0.5819473",
"0.5782756",
"0.57607114",
"0.5716757",
"0.5701199",
"0.5679278",
"0.56698346",
"0.5662617",
"0.56445974",
"0.56343764",
"0.56343764",
"0.562479... | 0.69765633 | 0 |
Fire a location against the Google geocoder and receive a false response | def test_view_geocoder_error(self, google):
google.return_value = GeocoderErrorMock()
view = super(BaseSearchPageViewTestCase, self).initialize(BaseSearchPageView(), None)
response = view.geocode_location('Test, Test')
# Check geocoder returns false
self.assertFalse(response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def validate_location(self, latitude: float, longitude: float) -> bool:\n params = {\n 'latlng': '{},{}'.format(latitude, longitude),\n 'key': self.api_key\n }\n async with aiohttp.ClientSession() as session:\n async with session.post('https://maps.google... | [
"0.62238276",
"0.6211368",
"0.61065245",
"0.607528",
"0.607307",
"0.60531807",
"0.6020743",
"0.5910916",
"0.58412796",
"0.58238196",
"0.58016837",
"0.57793945",
"0.5745892",
"0.5737919",
"0.5695071",
"0.56914806",
"0.5652352",
"0.5608295",
"0.5599845",
"0.5599845",
"0.5594565... | 0.62926835 | 0 |
Returns the correct DNSPattern from a certificate. | def test_dns(self):
rv = extract_ids(X509_DNS_ONLY)
assert [
DNSPattern(b"www.twistedmatrix.com"),
DNSPattern(b"twistedmatrix.com")
] == rv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findPattern(self,s):\n# pat = re.compile('^'+s+'$')\n pat = re.compile(s)\n results = {}\n for k in self.__clidRep.keys():\n if pat.match(str(k)) or pat.match(self.__clidRep[k]):\n results[k] = self.__clidRep[k]\n return results",
"def lookup_patte... | [
"0.4891122",
"0.48647267",
"0.47989175",
"0.4752317",
"0.47328696",
"0.47310355",
"0.4715459",
"0.46904224",
"0.46649987",
"0.46477568",
"0.46469158",
"0.46469158",
"0.46440428",
"0.45491266",
"0.45385844",
"0.4537356",
"0.4536945",
"0.45274872",
"0.45249093",
"0.44942376",
"... | 0.5014297 | 0 |
CNs are returned as DNSPattern if no other IDs are present and a warning is raised. | def test_cn_ids_are_used_as_fallback(self):
with pytest.warns(SubjectAltNameWarning):
rv = extract_ids(X509_CN_ONLY)
assert [
DNSPattern(b"www.microsoft.com")
] == rv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dns(self):\n rv = extract_ids(X509_DNS_ONLY)\n assert [\n DNSPattern(b\"www.twistedmatrix.com\"),\n DNSPattern(b\"twistedmatrix.com\")\n ] == rv",
"def ndc_matcher_fragment (self) :\n sk = lambda ndc : (- len (ndc), ndc)\n ccs = sorted (sel... | [
"0.5767702",
"0.5275893",
"0.49988404",
"0.49931186",
"0.4993069",
"0.49207655",
"0.48891604",
"0.48844486",
"0.47951",
"0.47459784",
"0.47050315",
"0.46901804",
"0.4662867",
"0.45189834",
"0.44893697",
"0.4467063",
"0.44548598",
"0.44510627",
"0.44430748",
"0.44379944",
"0.4... | 0.71181196 | 0 |
Returns the correct URIPattern from a certificate. | def test_uri(self):
rv = extract_ids(X509_OTHER_NAME)
assert [
URIPattern(b"http://example.com/")
] == [id for id in rv if isinstance(id, URIPattern)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def certificate_url(self, certificate):\r\n course = get_course_by_id(certificate.course_id)\r\n tracking_code = '-'.join([\r\n 'eml',\r\n 'prof', # the 'product'--no idea what that's supposed to mean\r\n 'edX', # Partner's name\r\n course.number, # Cert... | [
"0.54757416",
"0.53687376",
"0.5136743",
"0.5014743",
"0.49437982",
"0.49042603",
"0.4842828",
"0.4768561",
"0.47459695",
"0.4741662",
"0.4734038",
"0.4706175",
"0.46995947",
"0.4684276",
"0.4672363",
"0.4663118",
"0.4660227",
"0.4660227",
"0.4660227",
"0.4660227",
"0.4660227... | 0.57466674 | 0 |
Creates a single regex string from all given tokens. | def __create_regex(self):
self.lexer_regex = "|".join(self.tokens)
logger.debug(f"Generated tokenizer regex {self.lexer_regex}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_regex(*args:List[str], flags:int=0, compile:bool=True) -> Union[str, re.compile]:\n pattern = \"\".join(args)\n\n if compile:\n return re.compile(pattern, flags=flags)\n else:\n flagstring = re_flags_to_string(flags)\n pattern = f\"{flagstring}{pattern}\"\n return patter... | [
"0.6349706",
"0.6186846",
"0.6112121",
"0.5864288",
"0.5856288",
"0.5826601",
"0.5824817",
"0.5730348",
"0.571487",
"0.5706486",
"0.5705638",
"0.56913674",
"0.56743085",
"0.5670788",
"0.56319416",
"0.55914134",
"0.55876046",
"0.55763376",
"0.5552342",
"0.55433416",
"0.5521065... | 0.65006757 | 0 |
Accepts given list of tokens to build a tokenizer regex. | def insert_tokens(self, token_list):
assert type(token_list) == list, "Token list should be a list of tuples of the format (token_name, regex)."
self.tokens += token_list
self.__create_regex() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_regex(self):\n self.lexer_regex = \"|\".join(self.tokens)\n logger.debug(f\"Generated tokenizer regex {self.lexer_regex}\")",
"def build_tokenizer(self):\n def tokenizer(doc):\n token_pattern = re.compile(self.token_pattern)\n return token_pattern.findall(d... | [
"0.6696508",
"0.65214366",
"0.6178606",
"0.61416554",
"0.60779035",
"0.6028045",
"0.60136133",
"0.6003141",
"0.5973272",
"0.59646404",
"0.5918638",
"0.5894518",
"0.5884221",
"0.58580345",
"0.5815968",
"0.5801132",
"0.5791723",
"0.57835305",
"0.5769586",
"0.5757287",
"0.574155... | 0.6547721 | 1 |
Example where the toy transcript database contains matches for all vertices. | def test_all_known_edges(self):
conn, cursor = get_db_cursor()
build = "toy_build"
database = "scratch/toy.db"
talon.get_counters(database)
edge_dict = init_refs.make_edge_dict(cursor)
run_info = talon.init_run_info(database, build)
conn.close()
chrom = "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_antisense(self):\n \n conn, cursor = get_db_cursor()\n build = \"toy_build\"\n database = \"scratch/toy.db\"\n talon.get_counters(database)\n edge_dict = init_refs.make_edge_dict(cursor)\n run_info = talon.init_run_info(database, build)\n orig_n_edge... | [
"0.61221105",
"0.59619105",
"0.5688864",
"0.5395307",
"0.5288261",
"0.5280846",
"0.5256774",
"0.5245531",
"0.5241736",
"0.5154437",
"0.51041216",
"0.5069358",
"0.50656587",
"0.50611335",
"0.5045895",
"0.50273186",
"0.5012168",
"0.5002151",
"0.49818695",
"0.49808437",
"0.49779... | 0.63399905 | 0 |
Calculate the displacement of the drum membrane at (r, theta; t=0) in the normal mode described by integers n >= 0, 0 < m <= mmax. | def displacement(n, m, r, theta):
# Pick off the mth zero of Bessel function Jn
k = jn_zeros(n, mmax+1)[m]
return np.sin(n*theta) * jn(n, r*k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self,m,n):\n if type(m) == np.ndarray:\n return np.linalg.norm( self.positions[m] - self.positions[n] , axis = 1)\n \n return np.linalg.norm(self.positions[m]-self.positions[n])",
"def dndM(self,M,z):\n G = self.Growth(z)\n _,_,mf = self.mass_func(M,G)\n... | [
"0.6075226",
"0.6041109",
"0.57896566",
"0.56838506",
"0.5599244",
"0.54943377",
"0.5451262",
"0.5439258",
"0.54380393",
"0.53374076",
"0.52609605",
"0.5253247",
"0.52352977",
"0.51895535",
"0.51871014",
"0.518576",
"0.5160184",
"0.5132035",
"0.5123905",
"0.5113467",
"0.50971... | 0.6501188 | 0 |
Convert a given (restricted) Python code string to a SKAST. So far we only need this functionality for debugging purposes, hence instead of implementing a fullfledged parser, we rely on Python's ast.parse. This means that if the expression contains nonPython code or Python code which we cannot translate, you will get c... | def translate(expr):
return from_python(ast.parse(expr)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_01():\n text = \"a = 2 + 3 * (4 + 5)\"\n\n c = _ast.parse(text)\n print(_ast.dump(c))",
"def source_to_ast(source):\n try:\n ast = parse(source)\n except ParseError, e:\n print e.nice_error_message(source=source)\n raise\n transformer = Transformer()\n return tr... | [
"0.66745406",
"0.6166847",
"0.61342865",
"0.6008781",
"0.6006583",
"0.59302306",
"0.59276277",
"0.5780078",
"0.57422704",
"0.5724974",
"0.57160956",
"0.56809527",
"0.5662038",
"0.5623366",
"0.56073964",
"0.5533656",
"0.55079174",
"0.5470995",
"0.5436269",
"0.54159254",
"0.540... | 0.7769156 | 0 |
Concat words from context and set span for formula itself | def render_formula_context(context, words):
result = []
started, ended = False, False
for word in words:
is_formula = (
word.sentence_unique == context.sentence_unique and
context.start <= word.idx <= context.end
)
if is_formula and not started:
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(self, text):",
"def newInternal(word, deflike):\n\n avedeflike = 0\n denom = len(word)\n for indices, f in fqs(word, 0.5):\n context, numer = internalContext(indices, word)\n if deflike[context]:\n avedeflike += numer/denom * f * deflike[context]\n return avedeflike... | [
"0.57824075",
"0.5597011",
"0.55959463",
"0.5344671",
"0.53328043",
"0.52661127",
"0.5256551",
"0.5225923",
"0.52222425",
"0.52069443",
"0.51944226",
"0.51627743",
"0.5151386",
"0.5140506",
"0.5140114",
"0.51175517",
"0.5093536",
"0.50902873",
"0.50733906",
"0.5071765",
"0.50... | 0.69713837 | 0 |
Get formula contexts for formula page | def get_formula_contexts(cluster_id):
contexts = Ne.query.filter(
Ne.cluster_id == cluster_id
).order_by(Ne.text, Ne.chapter, Ne.paragraph, Ne.sentence).all()
return [
{
"text_name": c.text_obj.text_name,
"chapter_id": c.chapter,
"paragraph_idx": c.paragra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_formula_context(context, words):\n result = []\n started, ended = False, False\n for word in words:\n is_formula = (\n word.sentence_unique == context.sentence_unique and\n context.start <= word.idx <= context.end\n )\n if is_formula and not started:\n... | [
"0.6382244",
"0.60402364",
"0.5791659",
"0.5440351",
"0.5389518",
"0.5320706",
"0.5297203",
"0.52941316",
"0.5278769",
"0.5271109",
"0.5260856",
"0.5175312",
"0.5137558",
"0.5081077",
"0.5078723",
"0.5065743",
"0.5064095",
"0.50563544",
"0.50456893",
"0.50352824",
"0.50253004... | 0.64287287 | 0 |
Make a grayscale color table with the specified bit depth. | def grayscaleColorTable(bits=8):
conversion = 255./(2**bits-1)
return ''.join([3*chr(int(conversion*i)) for i in range(2**bits)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeReducedColorTable(levels):\n assert len(levels)==3\n assert levels[0]*levels[1]*levels[2]<256\n conversions = [255./(l-1) for l in levels]\n colorTable = [(int(conversions[0]*r),int(conversions[1]*g),int(conversions[2]*b))\n for r in range(levels[0]) for g in range(levels[1]) for b in ra... | [
"0.6044128",
"0.5823107",
"0.5635321",
"0.5456832",
"0.5453675",
"0.5450638",
"0.54488796",
"0.54407305",
"0.54268736",
"0.54213303",
"0.5420697",
"0.5403138",
"0.53998595",
"0.53905946",
"0.5381059",
"0.5355727",
"0.53536797",
"0.5327542",
"0.53266877",
"0.5317582",
"0.53129... | 0.7322485 | 0 |
Make a color table corresponding to a posterization defined in levels. | def makeReducedColorTable(levels):
assert len(levels)==3
assert levels[0]*levels[1]*levels[2]<256
conversions = [255./(l-1) for l in levels]
colorTable = [(int(conversions[0]*r),int(conversions[1]*g),int(conversions[2]*b))
for r in range(levels[0]) for g in range(levels[1]) for b in range(levels... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cmap_levels(colormap,levels):\n \n #Matplotlib colormap name\n if isinstance(colormap,str):\n cmap = mlib.cm.get_cmap(colormap)\n \n #User defined list of colors\n elif isinstance(colormap,list):\n cmap = mcolors.ListedColormap(colormap)\n \n #Dictionary\n elif ... | [
"0.58809286",
"0.5804952",
"0.5686818",
"0.55820525",
"0.5550162",
"0.54383504",
"0.5425929",
"0.53026843",
"0.5288163",
"0.5280174",
"0.52793026",
"0.5243493",
"0.52416456",
"0.5222996",
"0.5222996",
"0.5218795",
"0.5218795",
"0.5205222",
"0.51818705",
"0.51764864",
"0.51743... | 0.7525747 | 0 |
Load a CHARMM .prm file containing force field parameters. | def load_charmm_ff_params(fname):
with open(fname) as f:
lines = f.readlines()
comment_stripper = re.compile(r'[!\*].*')
ffp = ForceFieldParams(fname)
current_section = None
for i in range(len(lines)):
# Ignore comments and blank lines
line = comment_stripper.sub('', lines[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_forcefield_from_file(self, force_field):\n assert len(force_field._parameter_handlers[\"Bonds\"]._parameters) == 87\n assert len(force_field._parameter_handlers[\"Angles\"]._parameters) == 38\n assert len(force_field._parameter_handlers[\"ProperTorsions\"]._parameters) == 158\n... | [
"0.61064047",
"0.578289",
"0.5628",
"0.5603535",
"0.5593818",
"0.55547667",
"0.5510397",
"0.53960454",
"0.53217894",
"0.5291527",
"0.5273563",
"0.52202827",
"0.5124412",
"0.51143116",
"0.5099562",
"0.5058935",
"0.5054018",
"0.5014469",
"0.49991286",
"0.49872866",
"0.4980277",... | 0.72424287 | 0 |
Make a humanreadable label for an AtomGroup. | def get_group_label(group):
indices = [a.index for a in group.atoms]
names = [a.name for a in group.atoms]
label = []
for i in range(len(indices)):
label.append('%d/%s' % (indices[i], names[i]))
return(' '.join(label)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_label(i):\n if i//4 == 0:\n return \"buildUpPlay\"\n elif i//4 == 1:\n return \"chanceCreation\"\n elif i//4 == 2:\n return \"defence\"",
"def name(self):\n return f\"{self._group.friendly_name} {GROUP_SUFFIX}\"",
"def group(self):\n return self.tr(self... | [
"0.7080324",
"0.7041764",
"0.68480146",
"0.68480146",
"0.68480146",
"0.68480146",
"0.6676381",
"0.6667151",
"0.6663234",
"0.6592425",
"0.65758735",
"0.6573803",
"0.6564383",
"0.6483193",
"0.63474876",
"0.6339361",
"0.6284642",
"0.6240854",
"0.6207264",
"0.6202732",
"0.620128"... | 0.80113363 | 0 |
Try to parse the Turtle at a given path. | def parse_turtle(path):
logger.info("Parsing Turtle at path %s", path)
graph = rdflib.Graph()
try:
graph.parse(path, format='ttl')
except Exception as exc:
# Get the name of the exception class
# e.g. rdflib.plugins.parsers.notation3.BadSyntax
exc_name = f'{exc.__class__.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_path(path): # -> Path | UnparsedPath | ParsedPath:\n ...",
"def _parse_synth(path):\n files, coords, angles = [], '', ''\n with open(f'{path}paths.txt') as f:\n while True:\n line = f.readline()\n if not line:\n break\n ... | [
"0.61862606",
"0.58883476",
"0.5622269",
"0.5529077",
"0.55040145",
"0.54082674",
"0.52422124",
"0.5227218",
"0.5193157",
"0.51868063",
"0.5182145",
"0.5181031",
"0.5167053",
"0.5080874",
"0.5064504",
"0.5055721",
"0.5046513",
"0.50380254",
"0.5035688",
"0.50279015",
"0.50218... | 0.77908367 | 0 |
POST creates a mobile | def post(self, request):
try:
data = json.loads(request.body)
except ValueError:
return HttpResponseBadRequest('Not valid JSON!')
form = MobileForm(data)
if form.is_valid():
mobile = form.save()
response = HttpResponse(status=201)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self, request):\n request_data = request.data\n if 'mobile' not in request_data or not request_data['mobile']:\n return StandardHttpResponse.bad_rsp([], 'Invalid Data.')\n email = None\n mobile = None\n if '@' in request_data['mobile']:\n email = re... | [
"0.6624783",
"0.63869023",
"0.62255484",
"0.6119153",
"0.6097398",
"0.6096307",
"0.6087637",
"0.60802364",
"0.60324806",
"0.6022181",
"0.5978272",
"0.5965557",
"0.59631485",
"0.5954771",
"0.5885775",
"0.58745736",
"0.586694",
"0.58488065",
"0.5811284",
"0.579442",
"0.57861924... | 0.79867387 | 0 |
PUT updates a mobile | def put(self, request):
try:
data = json.loads(request.body)
except ValueError:
return HttpResponseBadRequest('Not valid JSON!')
get_id = Mobile.objects.get(id=data.get('id'))
form = MobileForm(data, instance=get_id)
if form.is_valid():
form.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def put(self):\r\n data = await self.request.json()\r\n agent_uuid = data[\"agent_uuid\"]\r\n ip_address = data[\"ip_address\"]\r\n agent_obj = Agent.filter(Agent.uuid == agent_uuid).first()\r\n if not agent_obj:\r\n response_obj = {\"status\": \"failed\"}\r\n ... | [
"0.6293689",
"0.6287416",
"0.6173875",
"0.6157409",
"0.6062729",
"0.6044882",
"0.60224956",
"0.60146147",
"0.60123736",
"0.6002191",
"0.599225",
"0.59694976",
"0.59547615",
"0.5941081",
"0.5938875",
"0.5931505",
"0.5924774",
"0.59193265",
"0.58935016",
"0.58917975",
"0.588146... | 0.7428156 | 0 |
DELETE deletes a mobile | def delete(self, request):
try:
data = json.loads(request.body)
except ValueError:
return HttpResponseBadRequest('Not valid JSON!')
Mobile.objects.filter(id=data.get('id')).delete()
response = HttpResponse(status=200)
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete():",
"def delete(self):\n key = f'https://plex.tv/devices/{self.id}.xml'\n self._server.query(key, self._server._session.delete)",
"def delete(device):\n delete_subject(device)\n return redirect_back('index')",
"def delete(self, application_id):",
"def delete(self, request, p... | [
"0.7140591",
"0.68436795",
"0.68124235",
"0.66821903",
"0.66753364",
"0.66347593",
"0.6586772",
"0.65435857",
"0.6541555",
"0.65176755",
"0.6510242",
"0.6482546",
"0.64701384",
"0.64701384",
"0.6458607",
"0.64197034",
"0.63992894",
"0.6385915",
"0.63811034",
"0.6376907",
"0.6... | 0.73417145 | 0 |
Return a list of all valid moves given his rack of tiles, the current board state and a list of all possible words in the language | def all_valid_moves(self, cur_board, all_english_words):
rack_to_str = self.convert_rack_to_str()
if len(rack_to_str) == 0:
return []
moves_made = cur_board.find_words_on_board()
actual_words = []
if cur_board.board_empty: #no one has played... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_move(self, move_data, all_english_words):\r\n \r\n #first, make copy of board and try to apply move there.\r\n board_cpy = copy.deepcopy(self.myboard)\r\n \r\n rack_cpy = copy.deepcopy(self.rack) #***need to remove appropriate words from rack after we've made a move. \... | [
"0.72723985",
"0.7034861",
"0.68683386",
"0.6790378",
"0.6789619",
"0.6673302",
"0.66575986",
"0.6646399",
"0.6610836",
"0.6489171",
"0.64683926",
"0.64489985",
"0.6438148",
"0.64320993",
"0.6405575",
"0.6397455",
"0.6395743",
"0.639259",
"0.63526917",
"0.63470167",
"0.633566... | 0.8294158 | 0 |
Pick a specified number of tiles from a tile bag | def get_tiles(self, numTiles, gameBag):
tiles_picked = gameBag.pick_tiles(numTiles)
for givenTile in tiles_picked:
self.rack.append(givenTile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def example7(n):\n return mvmt.randomize(tile, n)",
"def remove_tiles(self, num):\r\n drawntiles = [self.db.tilestring.pop(random.randrange(len(self.db.tilestring))) for _ in xrange(num)]\r\n return drawntiles",
"def new_tile(self):\r\n count = 0\r\n tot_count = self.get_grid_wid... | [
"0.6135085",
"0.5934184",
"0.5918164",
"0.59091866",
"0.5873924",
"0.58245903",
"0.58188415",
"0.5818315",
"0.58176893",
"0.5748833",
"0.5735606",
"0.5735606",
"0.5732034",
"0.5732034",
"0.57314026",
"0.57068145",
"0.57019085",
"0.56802267",
"0.56653893",
"0.564707",
"0.56391... | 0.74829394 | 0 |
This method should not be called directly. Use play_turn instead. Handles all aspects of playing. Play a move if it's legal. To be legal, move must be a valid word; also, no invalid word can be formed on board after move A move comes in the form [new word, starting row location, starting column location, orientation (i... | def play_move(self, move_data, all_english_words):
#first, make copy of board and try to apply move there.
board_cpy = copy.deepcopy(self.myboard)
rack_cpy = copy.deepcopy(self.rack) #***need to remove appropriate words from rack after we've made a move.
i = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def human_move(board,player):\r\n \r\n s = input(\"Please input a legal move in a format of \\\"current_position-landing_position\\\", if the move is cantering or plain. In case of a capturing move, follow \\\"current_position-landing_position-enemy piece\\\": \")\r\n move = s.split('-')\r\n legal... | [
"0.68949723",
"0.68481404",
"0.67060524",
"0.66176564",
"0.64978665",
"0.64816445",
"0.647932",
"0.6468799",
"0.64683616",
"0.64597887",
"0.64477646",
"0.6437509",
"0.64048713",
"0.6403009",
"0.6396423",
"0.63884306",
"0.6382179",
"0.63774353",
"0.63710576",
"0.6368658",
"0.6... | 0.74699354 | 0 |
Compile regular expressions for object searching. | def _compile_object_search():
class_or = b'(' + b'|'.join(CLASSES) + b')'
for i in range(9):
expr = class_or + struct.pack('b', i) + b'(?!\xff\xff)(?!\x00\x00)[\x00-\xff]{4}\xff\xff\xff\xff[^\xff]'
REGEXES[i] = re.compile(expr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compile_regex(self):\n self.raw = self._compile('rawLevel')\n self.run = self._compile('runLevel')\n self.sample = self._compile('sampleLevel')\n self.agg = self._compile('aggLevel')",
"def _compileRegex(self):\n\t\tself.__punctuationRegex = re.compile(\"|\".join(self._punctuatio... | [
"0.7556635",
"0.7269571",
"0.72307914",
"0.71868604",
"0.67893624",
"0.6714389",
"0.671041",
"0.6648657",
"0.6638212",
"0.6625035",
"0.6617111",
"0.6540375",
"0.648378",
"0.64636004",
"0.6438471",
"0.6400132",
"0.63626385",
"0.63212454",
"0.63142705",
"0.6266772",
"0.6257061"... | 0.81797075 | 0 |
Parse a block of objects. | def object_block(data, pos, player_number, index):
objects = []
offset = None
while True:
if not offset:
match = REGEXES[player_number].search(data, pos)
end = data.find(BLOCK_END, pos) - pos + len(BLOCK_END)
if match is None:
break
off... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blockParser(block):\n struct = []\n first = True\n record = False\n for line in block:\n if line.startswith('Structure #'):\n record = True\n if not first:\n yield struct\n struct = []\n first = False\n if record:\n ... | [
"0.6970123",
"0.63190037",
"0.6197193",
"0.60761464",
"0.59490764",
"0.5921542",
"0.5893702",
"0.5842068",
"0.57968247",
"0.57739604",
"0.57538676",
"0.57240695",
"0.57240695",
"0.57240695",
"0.57240695",
"0.5713648",
"0.568718",
"0.5687159",
"0.5678653",
"0.56540465",
"0.564... | 0.64189327 | 1 |
Parse a player (and objects). | def parse_player(header, player_number, num_players, save):
type_, *diplomacy, name_length = unpack(f'<bx{num_players}x9i5xh', header)
name, resources = unpack(f'<{name_length - 1}s2xIx', header)
header.read(resources * 4)
start_x, start_y, civilization_id, color_id = unpack('<xff9xb3xbx', header)
o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(self,data):\n PLAYER_CONNECTION = \"CO\"\n PLAYER_DISCONNECTION = \"DC\"\n PLAYER_MOOVE = \"MV\"\n\n stringdata = data.decode(\"utf-8\")\n #print(\"From server: \"+stringdata)\n listdata = stringdata.split(\"@\")\n head = listdata[0]\n\n if listdata... | [
"0.67972684",
"0.66746765",
"0.66013366",
"0.64661247",
"0.62741977",
"0.6165817",
"0.60878104",
"0.6017388",
"0.587652",
"0.5726178",
"0.5721552",
"0.5681432",
"0.56119436",
"0.5557372",
"0.5542272",
"0.5516666",
"0.5516128",
"0.54968584",
"0.54799217",
"0.54685944",
"0.5458... | 0.68122387 | 0 |
Parse and compute game version. | def parse_version(header, data):
log = unpack('<I', data)
game, save = unpack('<7sxf', header)
if save == -1:
save = unpack('<I', header)
if save == 37:
save = 37.0
else:
save /= (1<<16)
version = get_version(game.decode('ascii'), round(save, 2), log)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_version():\n version = ''\n directory = os.path.dirname(__file__)\n filename = os.path.join(directory, 'cube_helper', '__init__.py')\n\n with open(filename) as fd:\n for line in fd:\n line = line.strip()\n if line.startswith('__version__'):\n try:... | [
"0.6453886",
"0.6440879",
"0.64193743",
"0.64002734",
"0.6371123",
"0.6332457",
"0.63297683",
"0.6303909",
"0.6300447",
"0.62641525",
"0.6193105",
"0.61742544",
"0.6168254",
"0.6160823",
"0.6148075",
"0.61408055",
"0.60565215",
"0.6035525",
"0.60153735",
"0.6004636",
"0.60011... | 0.73968315 | 0 |
Detect handler from the environment. | def detect_handler(flags_dict: Dict[Text, Any]) -> base_handler.BaseHandler:
# TODO(b/132286477):Autodetect engine from environment
raise NotImplementedError('Orchestrator '+flags_dict['engine']+
' missing in the environment.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_handler(url):\n for handler in __all__:\n # Get the symbol for handler\n mod = globals()[handler]\n # Ask handler if it can handle the url\n if getattr(mod, \"can_handle\")(url):\n return mod\n return None",
"def getHandler(self):\n raise NotImplemente... | [
"0.5812973",
"0.56083685",
"0.5582238",
"0.5581816",
"0.55798864",
"0.5543678",
"0.54791665",
"0.5418429",
"0.5372082",
"0.5338981",
"0.52936167",
"0.529168",
"0.5287365",
"0.5266103",
"0.5264601",
"0.52603334",
"0.5246127",
"0.5246077",
"0.5234481",
"0.523271",
"0.5232331",
... | 0.7340137 | 0 |
Retrieve handler from the environment using the engine flag. | def create_handler(flags_dict: Dict[Text, Any]) -> base_handler.BaseHandler:
engine = flags_dict[labels.ENGINE_FLAG]
if engine == 'airflow':
return airflow_handler.AirflowHandler(flags_dict)
elif engine == 'kubeflow':
return kubeflow_handler.KubeflowHandler(flags_dict)
elif engine == 'auto':
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_handler(flags_dict: Dict[Text, Any]) -> base_handler.BaseHandler:\n # TODO(b/132286477):Autodetect engine from environment\n raise NotImplementedError('Orchestrator '+flags_dict['engine']+\n ' missing in the environment.')",
"def getHandler(self):\n raise NotImpleme... | [
"0.7302877",
"0.612874",
"0.6019349",
"0.58339286",
"0.57234454",
"0.5716344",
"0.5636719",
"0.5613317",
"0.5596016",
"0.5565054",
"0.5529367",
"0.5506704",
"0.5496261",
"0.5488245",
"0.54766804",
"0.5426617",
"0.5381626",
"0.536946",
"0.53463507",
"0.5320874",
"0.53177094",
... | 0.6313449 | 1 |
Read a state of bins, boxes in the bins and unused boxes from some file | def read_state(path: str):
state = State(0, (0, 0), [])
n = 0
with open(path, "r") as file:
first_line = True
line_counter = 0
bin_width = 0
bin_height = 0
lines = file.readlines()
for line in lines:
line_cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_binned(run, bin_scheme):\n\n fname=get_binned_file(run,bin_scheme)\n print(\"reading:\",fname)\n return fitsio.read(fname)",
"def read_binning_file(file_name, lmax):\n\n bin_lo,bin_hi,bin_c = plt.loadtxt(file_name,unpack=True)\n id = np.where(bin_hi <lmax)\n bin_lo,bin_hi,bin_c=bin_lo[... | [
"0.6326734",
"0.61473787",
"0.61439645",
"0.5981071",
"0.5979758",
"0.5733727",
"0.57119894",
"0.5685416",
"0.56229204",
"0.5590154",
"0.55350846",
"0.5488982",
"0.548799",
"0.54753387",
"0.54731745",
"0.5449776",
"0.54424906",
"0.54195434",
"0.5406183",
"0.53961694",
"0.5369... | 0.76363426 | 0 |
Write some state of bins, boxes in the bins and unused boxes to some file | def write_state(path: str, state: State, comments: dict = None):
with open(path, "w") as file:
# Write some comments about state and bins
if type(comments) == dict:
pass
else:
comments = default_comments(state)
file.write(f'% State ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file(self):\r\n # -open file for writing\r\n f_fbob = open(self.fn_path, 'w')\r\n\r\n # -write header\r\n f_fbob.write('%s\\n' % (self.heading))\r\n\r\n # -write sections 1 & 2 : NOTE- what about NOPRINT?\r\n f_fbob.write('%10i%10i%10i%10i\\n' % (self.nqfb, self.... | [
"0.58774626",
"0.5781146",
"0.5470767",
"0.5433325",
"0.54245394",
"0.54147035",
"0.538443",
"0.538443",
"0.5379706",
"0.52988774",
"0.52815664",
"0.52805585",
"0.5269064",
"0.52637774",
"0.5238718",
"0.5224032",
"0.52133703",
"0.52080107",
"0.5189476",
"0.5186888",
"0.517707... | 0.60879755 | 0 |
Validate uri content type | def validate_content_type(uri: str) -> None:
try:
response = requests.head(uri)
response.raise_for_status()
except RequestException as e:
raise ValidationError(f"groundtruth content type ({uri}) validation failed") from e
content_type = response.headers.get("Content-Type", "")
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_content_type(cls, content_type: str) -> bool:\n return content_type in cls.CONTENT_TYPES.value",
"def validate_uri(value: Any) -> str:\n uri_value = str(value)\n\n if urlparse(uri_value).scheme == \"tcp\":\n # pylint: disable-next=no-value-for-parameter\n return cast(str, ... | [
"0.6640949",
"0.6477024",
"0.6392149",
"0.6390477",
"0.6359428",
"0.6315267",
"0.62223816",
"0.6119843",
"0.60984206",
"0.60925287",
"0.6090892",
"0.6085953",
"0.60491556",
"0.6046516",
"0.6039983",
"0.60321796",
"0.6013974",
"0.59716636",
"0.59470594",
"0.5918401",
"0.591231... | 0.8022039 | 0 |
Validate key & value of groundtruth entry based on request_type | def validate_groundtruth_entry(
key: str,
value: Union[dict, list],
request_type: str,
validate_image_content_type: bool,
):
GroundtruthEntryValueModel = groundtruth_entry_models_map.get(request_type)
if GroundtruthEntryValueModel is None:
return
validate_wrapper_model(GroundtruthE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_input_dict(self, input):\n if isinstance(input, dict):\n required = {\"type\", \"value\"}\n not_found = required - set(input.keys())\n if not_found:\n raise SpecificationError(\n \"Required key(s) not found in input dictionary:... | [
"0.6257758",
"0.61257935",
"0.60649484",
"0.6062839",
"0.6062839",
"0.6058923",
"0.60554695",
"0.60445964",
"0.5912144",
"0.59094596",
"0.5904417",
"0.5852848",
"0.58368737",
"0.5779386",
"0.5768365",
"0.57572466",
"0.57555914",
"0.5729201",
"0.57264805",
"0.5719943",
"0.5687... | 0.749015 | 0 |
Prettyprint the square, including when the square is empty. | def __str__(self) -> str:
if self.is_unoccupied():
return str("[%s,%s] EMPTY SQUARE" % (",".join(map(str, self.x_y)), self.square_id))
return str(
"[%s,%s] %s %s"
% (
",".join(map(str, self.x_y)),
self.square_id,
self.pi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return ('[Square] (' + str(self.id) + ') ' + str(self.x) + '/' +\n str(self.y) + ' - ' + str(self.width))",
"def __str__(self):\n return \"[Square] {:d}/{:d}\".format(self.__size, self.__size)",
"def __str__(self):\n return \"[Square] {}/{}\".format(self... | [
"0.695246",
"0.6884435",
"0.687322",
"0.68530965",
"0.685142",
"0.6835961",
"0.6835878",
"0.67399865",
"0.6713277",
"0.669169",
"0.6688401",
"0.6683079",
"0.66779405",
"0.66744053",
"0.6669496",
"0.6654589",
"0.6638448",
"0.6631464",
"0.6623772",
"0.6603186",
"0.6602408",
"... | 0.69556934 | 0 |
Less verbose print of piece currently on this square. | def print(self) -> str:
if self.is_unoccupied():
return ""
return str("%s-%s" % (self.piece.color.name, self.piece.name.name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self) -> str:\n if self.is_unoccupied():\n return str(\"[%s,%s] EMPTY SQUARE\" % (\",\".join(map(str, self.x_y)), self.square_id))\n return str(\n \"[%s,%s] %s %s\"\n % (\n \",\".join(map(str, self.x_y)),\n self.square_id,\n ... | [
"0.6952023",
"0.68218154",
"0.67436385",
"0.66208",
"0.6607361",
"0.66022545",
"0.6583177",
"0.6540293",
"0.65367144",
"0.65273446",
"0.6524203",
"0.64906454",
"0.644893",
"0.6443345",
"0.641567",
"0.6384085",
"0.6373292",
"0.6366485",
"0.6361591",
"0.6348075",
"0.6333034",
... | 0.7189796 | 0 |
convert path between WINDOWS and LINUX | def convertString(path):
if ("win" in sys.platform):
return path.replace("/","\\")
elif ("linux" in sys.platform):
return path.replace("\\","/") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def system_path(path):\n if is_windows(): return path.replace('/', '\\\\')\n else: return path.replace('\\\\', '/')",
"def win2unix(a_path, use_abs=1):\r\n if use_abs:\r\n a_path = os.path.abspath(a_path)\r\n return re.sub(r\"\\\\\", \"/\", a_path)",
"def win2unix(a_path, use_abs=1):\r\n ... | [
"0.77815235",
"0.7764449",
"0.7764449",
"0.7494936",
"0.7466374",
"0.73002845",
"0.7139526",
"0.70433867",
"0.69053483",
"0.68342245",
"0.67935634",
"0.67593694",
"0.67519224",
"0.6722578",
"0.66779125",
"0.66665524",
"0.65539014",
"0.6533785",
"0.65299505",
"0.6493039",
"0.6... | 0.82932854 | 0 |
Initialize the logging subsystem and create a logger for this class, using passed in optparse options. | def init_logging(self, options):
if options.quiet:
loglevel = logging.ERROR
elif options.debug:
loglevel = logging.DEBUG
else:
loglevel = logging.INFO
init_logging(loglevel=loglevel, color=options.color)
self.logger = logging.getLogger(self.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLogger(options):\n loglevel = 'WARNING'\n if options.verbose:\n loglevel = logging.getLevelName(loglevel) - 10 * options.verbose\n if loglevel < 10:\n loglevel = 10\n\n logger = logging.getLogger('main')\n logger.setLevel(loglevel)\n formatter = logging.Formatter('%(a... | [
"0.70834184",
"0.6790409",
"0.67571676",
"0.6616192",
"0.65583605",
"0.651887",
"0.6426337",
"0.64010483",
"0.63087934",
"0.63044226",
"0.6271749",
"0.6262801",
"0.6250793",
"0.62343144",
"0.62326485",
"0.62282",
"0.62146544",
"0.6203505",
"0.6194306",
"0.61923784",
"0.618329... | 0.76326764 | 0 |
Apply move from origin to destination in model. May raise an IllegalMoveError. | def move(model, origin, dest):
model.move(origin, dest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(model, origin, dest):\n try:\n if not 0 <= origin < model.get_number_of_stools() \\\n or not 0 <= dest < model.get_number_of_stools():\n raise IllegalMoveError(\"Out of Range !!! 0 <= stool < {0}\".\\\n format(model.get_number_of_stools... | [
"0.6805756",
"0.66699094",
"0.6543003",
"0.6466354",
"0.6391308",
"0.6273734",
"0.62574756",
"0.6234898",
"0.61920196",
"0.6161312",
"0.6129254",
"0.6123301",
"0.6091432",
"0.60604906",
"0.6026477",
"0.6005703",
"0.59865564",
"0.5965998",
"0.5918807",
"0.5916877",
"0.5837639"... | 0.794608 | 1 |
Return if we run in a virtual environment. | def is_virtual_env() -> bool:
# Check supports venv && virtualenv
return getattr(sys, "base_prefix", sys.prefix) != sys.prefix or hasattr(
sys, "real_prefix"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running_under_virtualenv():\n return _running_under_venv() or _running_under_regular_virtualenv()",
"def is_venv():\n return (hasattr(sys, 'real_prefix') or\n (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))",
"def is_venv(dir):\n if ope(opj(dir, 'bin', 'activate_this.py... | [
"0.85965174",
"0.8115918",
"0.7586321",
"0.755885",
"0.7552282",
"0.7531204",
"0.7406356",
"0.7298636",
"0.7076863",
"0.6927398",
"0.6909625",
"0.6903202",
"0.68940043",
"0.6773939",
"0.67350376",
"0.67119735",
"0.66572356",
"0.66436213",
"0.66427195",
"0.66427195",
"0.653803... | 0.82991767 | 1 |
Return True if we run in a docker env. | def is_docker_env() -> bool:
return Path("/.dockerenv").exists() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_docker(self) -> bool:\n from hubble.executor.helper import is_valid_docker_uri\n\n uses = getattr(self.args, 'uses', '')\n return is_valid_docker_uri(uses)",
"def in_host():\n return not in_docker()",
"def in_docker():\n rc, out, _ = j.sals.process.execute(\"cat /proc/1/cgrou... | [
"0.7690895",
"0.75053656",
"0.74212354",
"0.72715694",
"0.7219365",
"0.7176761",
"0.69327426",
"0.6807269",
"0.67205393",
"0.6665761",
"0.64918387",
"0.64650524",
"0.6395858",
"0.6273821",
"0.6243213",
"0.62042356",
"0.61950165",
"0.6155058",
"0.612125",
"0.6108407",
"0.60973... | 0.84884226 | 0 |
Checks the manifest of a specific module and check installation of dependencies | def check_dependencies(module):
try:
from fhempy import lib
initfile = inspect.getfile(lib)
fhempy_root = os.path.dirname(initfile)
with open(fhempy_root + "/" + module + "/manifest.json", "r") as f:
manifest = json.load(f)
if "requirements" in manifest:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkRequiredDependencies(self):\n \n # skip dependency check for downloading only\n if( self.downloadOnly ):\n return\n\n # hard dependencies\n for req in self.reqmodules:\n if( self.parent.module(req) == None ):\n # check if there is an auto... | [
"0.72632784",
"0.7173046",
"0.71084386",
"0.7016042",
"0.6738634",
"0.67207026",
"0.6639972",
"0.6624844",
"0.6623437",
"0.65483165",
"0.653217",
"0.64299655",
"0.63897425",
"0.63792425",
"0.6378826",
"0.6368279",
"0.6289636",
"0.6255779",
"0.62530184",
"0.6251664",
"0.623318... | 0.8042798 | 0 |
Check if a package is installed and will be loaded when we import it. Returns True when the requirement is met. Returns False when the package is not installed or doesn't meet req. | def is_installed(package: str) -> bool:
try:
req = pkg_resources.Requirement.parse(package)
except ValueError:
raise
try:
ret = version(req.project_name) in req
return ret
except PackageNotFoundError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _require_package(name):\n try:\n import pkg_resources\n\n pkg_resources.working_set.require(name)\n return True\n\n except:\n return False",
"def _package_available(package_name: str) -> bool:\n try:\n return find_spec(package_name) is not None\n except ModuleNo... | [
"0.766059",
"0.737884",
"0.72728014",
"0.7246466",
"0.7151832",
"0.71283084",
"0.70687413",
"0.70337015",
"0.7008875",
"0.6999683",
"0.6999127",
"0.69112825",
"0.6900119",
"0.6846632",
"0.6842773",
"0.6824555",
"0.68243164",
"0.6805703",
"0.6764077",
"0.6722375",
"0.67197645"... | 0.7484318 | 1 |
Returns a dictionary recording each error and its frequency in the document. Uses the FreqDist function from NLTK. | def get_error_stats(errors, tokens):
freq_distribution = FreqDist(tokens)
error_report = {}
for error in list(errors):
error_count = freq_distribution[error]
error_report.update({error:error_count})
return error_report | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_frequency_dict(tokens):\n\n\tfdist = FreqDist(tokens) \t\t\t\t\t\t# fdist.keys() fdist.values()\n\treturn dict(fdist)",
"def calcTFdict(doc):\n\n TFDict = {}\n\n #counts number of appearances of term in document\n for term in doc:\n if term in TFDict.keys():\n TFDict[term] +=1... | [
"0.69594854",
"0.6646476",
"0.65573156",
"0.6459079",
"0.634892",
"0.6252509",
"0.62375146",
"0.6236218",
"0.6200854",
"0.6195876",
"0.6188842",
"0.6186134",
"0.61374384",
"0.611222",
"0.6066592",
"0.6053745",
"0.605373",
"0.6044344",
"0.6040832",
"0.60261387",
"0.6023282",
... | 0.7356778 | 0 |
Calculates the error rate of the document to 3 decimal places. | def error_rate(error_total, tokens):
if len(tokens) > 0:
return(float("{0:.3f}".format(error_total/len(tokens))))
else:
return(np.nan) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateErrorRate(numCorrect, numWrong):\n return np.round((numWrong)/(numCorrect+numWrong),3)",
"def error_rate():\n query = \"\"\"select to_char(date, 'FMMonth DD, YYYY') as date,\n round(error_req::numeric/total_req*100, 2) as error_rate\n from daily_errorreq_to... | [
"0.72092706",
"0.6786825",
"0.61434615",
"0.61235356",
"0.59907144",
"0.59856856",
"0.5956821",
"0.5952778",
"0.5952061",
"0.5944157",
"0.59095645",
"0.5888747",
"0.5860079",
"0.5845549",
"0.5817529",
"0.57601583",
"0.57407326",
"0.5733349",
"0.5696608",
"0.5676787",
"0.56696... | 0.6806693 | 1 |
Composit function for processing an entire directory of files. Returns the statistics on the whole directory as a list of dictionaries. | def process_directory(directory, spelling_dictionary):
corpus = (f for f in listdir(directory) if not f.startswith('.') and isfile(join(directory, f)))
statistics = []
for document in corpus:
content = utilities.readfile(directory, document)
stats = generate_doc_report(content, spel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyze_files(self):\n num_file = 0\n results = dict()\n try:\n list_files = os.listdir(self.directory)\n except FileNotFoundError:\n raise FileNotFoundError(\"Can't find any file\")\n else:\n for file in list_files: #looping the files in the... | [
"0.6949265",
"0.6729033",
"0.6713918",
"0.6681591",
"0.65156645",
"0.651384",
"0.6465302",
"0.6449418",
"0.63460374",
"0.63298154",
"0.6306296",
"0.63047427",
"0.62808126",
"0.6273158",
"0.6265396",
"0.6221628",
"0.62120473",
"0.6204147",
"0.6199926",
"0.61744905",
"0.6170273... | 0.73036736 | 0 |
Get statistics on the errors for the whole directory. Creates a dictionary (errors_summary) from all the reported errors/frequencies that records the error (as key) and the total count for that error (as value). | def get_errors_summary(statistics):
all_errors = (report['errors'] for report in statistics)
errors_summary = defaultdict(int)
for doc in all_errors:
for key, value in doc.items():
errors_summary[key] += value
return errors_summary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_error_stats(errors, tokens):\n freq_distribution = FreqDist(tokens) \n \n error_report = {}\n for error in list(errors):\n error_count = freq_distribution[error]\n error_report.update({error:error_count})\n \n return error_report",
"def total_errors(error_report):\n ... | [
"0.6966332",
"0.6165539",
"0.58132946",
"0.5779672",
"0.57771915",
"0.57196003",
"0.5710842",
"0.56959623",
"0.5689699",
"0.5631499",
"0.56283355",
"0.5624413",
"0.56094533",
"0.5603053",
"0.5600347",
"0.5600347",
"0.55933964",
"0.5562825",
"0.5557146",
"0.55042505",
"0.54988... | 0.6781323 | 1 |
Use the errors_summary to report the top errors. | def top_errors(errors_summary, min_count):
# Subset errors_summary using the min_count
frequent_errors = {key: value for key, value in errors_summary.items() if value > min_count}
# return sorted list of all errors with a count higher than the min_count
return sorted(frequent_errors.items(), key=opera... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errors_summary(self, errors_summary):\n\n self._errors_summary = errors_summary",
"def initialize_error_summary() -> str:\n error_summary = '\\nSummary of <span class=\"tex-fatal\">Critical Errors:</span>\\n\\n<ul>\\n'\n return error_summary",
"def test_top_errors_at_top_html(self):\n o... | [
"0.77018166",
"0.61300117",
"0.60792595",
"0.6046913",
"0.58470404",
"0.57309794",
"0.56899136",
"0.56745005",
"0.5650199",
"0.5645777",
"0.56414056",
"0.5640822",
"0.56061906",
"0.557755",
"0.5572485",
"0.55635816",
"0.55619234",
"0.5507232",
"0.54958695",
"0.5482836",
"0.54... | 0.7106696 | 1 |
Use the error_summary to isolate tokens that are longer thatn the min_length. Used to identify strings of words that have been run together due to the failure of the OCR engine to recognize whitespace. | def long_errors(errors_summary, min_length=10):
errors = list(errors_summary.keys())
return ([x for x in errors if len(x) > min_length], min_length) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ensure_error_message_restriction_compliance(full_message):\n message_size_limit = Constants.STATUS_ERROR_MSG_SIZE_LIMIT_IN_CHARACTERS\n formatted_message = re.sub(r\"\\s+\", \" \", str(full_message))\n return formatted_message[:message_size_limit-3] + '...' if len(formatted_message) > me... | [
"0.5669633",
"0.5657745",
"0.56259066",
"0.5605031",
"0.5588463",
"0.54917055",
"0.545624",
"0.5426909",
"0.5423445",
"0.5281851",
"0.5249895",
"0.5236895",
"0.5236647",
"0.52098686",
"0.51702845",
"0.5108288",
"0.50737756",
"0.5073636",
"0.5054684",
"0.50536263",
"0.5044439"... | 0.7421746 | 0 |
To compute average error rate, add up the total number of tokens and the total number of errors | def average_verified_rate(df):
total_tokens = token_count(df)
total_errors = df['num_errors'].sum()
if total_tokens > 0:
return (total_tokens - total_errors)/total_tokens
else:
return np.nan | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_rate(error_total, tokens):\n if len(tokens) > 0:\n return(float(\"{0:.3f}\".format(error_total/len(tokens))))\n else:\n return(np.nan)",
"def error(self):\n self.mean_error = tf.reduce_mean(self.errors, name=\"mean_error\")\n return(self.mean_error)",
"def per_token_... | [
"0.8164238",
"0.6730966",
"0.65714717",
"0.65377086",
"0.65328777",
"0.6523141",
"0.65052086",
"0.6403177",
"0.6322869",
"0.6304413",
"0.6262828",
"0.62513727",
"0.62391037",
"0.6238329",
"0.6237799",
"0.62050146",
"0.61972064",
"0.6162589",
"0.6139363",
"0.61190206",
"0.6118... | 0.7474237 | 1 |
Get the tensor by name considering the 'import' scope when model may be imported more then once | def get_tensor_by_name_with_import(self, graph, name, try_cnt=3):
for _ in range(try_cnt):
try:
return graph.get_tensor_by_name(name)
except BaseException:
name = 'import/' + name
raise ValueError('can not find tensor by name') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tensor(name):\n if name.rfind(':') == -1:\n name += ':0'\n return tf.get_default_graph().get_tensor_by_name(name)",
"def T(layer):\n return graph.get_tensor_by_name(\"import/%s:0\" % layer)",
"def named_tensor(self, name):\n return self._tensor_name_to_result[name]",
"def fetch_ten... | [
"0.7495172",
"0.7443095",
"0.71453536",
"0.65619296",
"0.6239828",
"0.6069169",
"0.60022587",
"0.59327424",
"0.59075475",
"0.5878073",
"0.58551484",
"0.5770114",
"0.57310426",
"0.5691124",
"0.5686155",
"0.56700826",
"0.56401634",
"0.5637019",
"0.5583453",
"0.55570865",
"0.554... | 0.76674443 | 0 |
An element of edges_list is an edge | def edges_list(self, edges_list):
for e in edges_list:
exceptions.check_pertinent_edge(self, e)
self._edges_list = edges_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edges_list(self):\n return self._edges_list",
"def addEdgeList(self, edges):\n for e in edges:\n self.addEdge(e[0], e[1], e[2] if len(e) > 2 else None)",
"def __init__(self, edgelist):\n self.edge = edgelist\n if edgelist:\n self.update_node2edge()",
"def... | [
"0.652061",
"0.647205",
"0.6430851",
"0.6344271",
"0.6302244",
"0.6286091",
"0.62082815",
"0.618034",
"0.61459816",
"0.61072606",
"0.60843843",
"0.6074278",
"0.60645586",
"0.6010524",
"0.59969884",
"0.59603214",
"0.5930378",
"0.59021205",
"0.5893332",
"0.5836366",
"0.5822762"... | 0.70423895 | 0 |
2 edges are equal iff same cordinates and same id | def __eq__(self,other):
boul0 = self.linked[0].coordinates[0]==other.linked[0].coordinates[0] and self.linked[0].coordinates[1]==other.linked[0].coordinates[1]
boul1 = self.linked[1].coordinates[0]==other.linked[1].coordinates[0] and self.linked[1].coordinates[1]==other.linked[1].coordinates[1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other: Vertex) -> bool:\n if isinstance(other, self.__class__):\n return self.id == other.id and self.edges == other.edges\n return False",
"def test_graphid_operator_eq_and_neq():\n\n for xstr, ystr in itertools.product([\"g1\", \"g2\", \"y7\", \"z123\"], repeat=2):\... | [
"0.7005593",
"0.6888093",
"0.68814456",
"0.67372805",
"0.669054",
"0.6679017",
"0.6603304",
"0.6564395",
"0.6532165",
"0.6501918",
"0.6495436",
"0.64894855",
"0.6471989",
"0.63639295",
"0.63564414",
"0.629231",
"0.6289114",
"0.6284407",
"0.62523353",
"0.62386227",
"0.62386227... | 0.69819385 | 1 |
Returns the laplace matrix. | def laplace_matrix(self):
n = self.number_of_vertices
laplace_matrix = np.zeros((n, n))
for i in range(n):
laplace_matrix[i][i] = 1
vertice = self.list_of_vertices[i]
for edge in vertice.edges_list:
laplace_matrix[i][edge.linked[1].index] = 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lap_mat(self):",
"def lap(self):\n\n gr = self.grid\n phi = gr.phi\n\n lapphi = gr.scratch_array()\n\n ib = gr.ilo\n ie = gr.ihi\n\n lapphi[ib:ie+1] = \\\n (phi[ib-1:ie] - 2.0*phi[ib:ie+1] + phi[ib+1:ie+2])/gr.dx**2\n\n return lapphi",
"def _get_L... | [
"0.78510773",
"0.6651335",
"0.6617579",
"0.6576125",
"0.6519465",
"0.6417381",
"0.6331843",
"0.6320635",
"0.6283067",
"0.62396234",
"0.6238676",
"0.62165576",
"0.618944",
"0.6101353",
"0.6051646",
"0.59920275",
"0.5991712",
"0.59717363",
"0.59618723",
"0.59554654",
"0.5930131... | 0.74450994 | 1 |
Returns the pairs of connected vertices. Beware ! There might be nonconnected vertices in the graph. | def pairs_of_vertices(self):
pairs_of_vertices = []
for vertice in self.list_of_vertices:
for edge in vertice.edges_list:
if non_oriented:
if (vertice, edge.linked[1]) and (edge.linked[1], vertice) not in pairs_of_vertices:
pairs_of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\r\n return self.adjacent.keys()",
"def vertices(self):\n s = set([x for x in self.edges.keys()])\n t = set([y for v in self.edges.values() for (y,d) in v.items()])\n v = s.union(t)\n return list(v)",
"def vertices(self):\r\n return list(self.__graph... | [
"0.75566196",
"0.6929476",
"0.69189465",
"0.68819237",
"0.6878861",
"0.6878861",
"0.6878861",
"0.6876629",
"0.6873968",
"0.6850235",
"0.68404484",
"0.6838328",
"0.68335825",
"0.6795832",
"0.6788172",
"0.6706184",
"0.6690003",
"0.66820353",
"0.66657573",
"0.6658202",
"0.658479... | 0.8280839 | 0 |
Dismisses the alert available. | def dismiss_alert(self):
self.driver.switch_to.alert.dismiss() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dismiss(self):\n with self.handle_alert():\n self.q(css='button#alert').first.click()",
"def dismiss(self):\n self._get_backend().dismiss_alarm()",
"def cancel(self):\n with self.handle_alert(confirm=False):\n self.q(css='button#confirm').first.click()",
"def al... | [
"0.79045784",
"0.6988759",
"0.66228867",
"0.6511189",
"0.6180062",
"0.6150818",
"0.6150818",
"0.603357",
"0.6018905",
"0.600597",
"0.600597",
"0.59543747",
"0.59443",
"0.5897738",
"0.5856717",
"0.5840261",
"0.5752515",
"0.57306916",
"0.5729604",
"0.57012135",
"0.5605924",
"... | 0.76880103 | 1 |
Performs a contextclick (right click) on an element. | def context_click(self, elem):
ActionChains(self.driver).context_click(elem).perform() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_click(self, selector):\n el = self.locate_element(selector)\n ActionChains(self.base_driver).context_click(el).perform()",
"def right_click(self):\n self.scroll_to()\n ActionChains(self.driver).context_click(self._element).perform()",
"def right_click(self, *args):\n ... | [
"0.7629893",
"0.72982866",
"0.71740115",
"0.68193716",
"0.66940546",
"0.65705466",
"0.6492889",
"0.6298301",
"0.62368494",
"0.61049014",
"0.6050035",
"0.6034844",
"0.59825927",
"0.5932183",
"0.5920205",
"0.5917087",
"0.58481556",
"0.58481556",
"0.5835984",
"0.5817764",
"0.581... | 0.8223277 | 0 |
Yield sublist of A of length N. | def chunks(A, N):
for i in range(0, len(A)):
r = A[i:i+N]
if len(r) == N:
yield r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(alist, n):\n for i in range(0, len(alist), n):\n yield alist[i:i + n]",
"def iter_n(sequence: Sequence[T], n: int) -> List[T]:\n\t\n\tfor i in range(len(sequence) - (n-1)):\n\t\tyield sequence[i:i+n]",
"def take(iterable, n):\n return list(itertools.islice(iterable, n))",
"def split_b... | [
"0.6799771",
"0.6774828",
"0.6718393",
"0.6640993",
"0.6631424",
"0.6631424",
"0.6621859",
"0.6621859",
"0.65864396",
"0.6580277",
"0.6580277",
"0.6549579",
"0.65188205",
"0.64952624",
"0.6450778",
"0.64263916",
"0.64197636",
"0.641796",
"0.6413278",
"0.6404067",
"0.63961005"... | 0.73276186 | 0 |
Classify a phrase based on the model. (See corresponding function in PhraseClassifier). Provided here mostly to help verify that a created model is worth saving. Technically, the results of the training should be enough for that, but it is good to be able to run it on concrete examples. | def classify(self, phrase, cut_to_len=True):
if (len(phrase) > self.max_phrase_len):
if not cut_to_len:
raise Exception("Phrase too long.")
phrase = phrase[0:self.max_phrase_len]
if (self.trainer == None):
raise Exception("Must train the classifier at least once b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identify_phrases(sentence, path_to_gensim_phrase_model):\n phrase_model = Phrases.load(path_to_gensim_phrase_model)\n phraser_model = Phraser(phrase_model)\n new_sentence = phraser_model[sentence]\n return new_sentence",
"def classify(text):\n # TODO Wonder if there's a better way of doing thi... | [
"0.6247522",
"0.6247057",
"0.61850315",
"0.61548096",
"0.61548096",
"0.6153401",
"0.5880714",
"0.58773357",
"0.58483094",
"0.5844506",
"0.58206975",
"0.5819344",
"0.5806203",
"0.57751316",
"0.5755337",
"0.575179",
"0.5708069",
"0.56963086",
"0.5681999",
"0.5670166",
"0.566842... | 0.64008564 | 0 |
Classify a phrase based on the loaded model. If cut_to_len is True, cut to desired length. | def classify(self, phrase, cut_to_len=True):
if (len(phrase) > self.max_phrase_len):
if not cut_to_len:
raise Exception("Phrase too long.")
phrase = phrase[0:self.max_phrase_len]
numbers = self.classifier.classify(stringToVector(phrase, self.vocab, self.max_vector_len))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classify(self, phrase, cut_to_len=True):\n if (len(phrase) > self.max_phrase_len):\n if not cut_to_len:\n raise Exception(\"Phrase too long.\")\n phrase = phrase[0:self.max_phrase_len]\n if (self.trainer == None):\n raise Exception(\"Must train the classifier a... | [
"0.71820074",
"0.54465985",
"0.5229613",
"0.5214949",
"0.5082984",
"0.5074488",
"0.50371414",
"0.49775094",
"0.49117133",
"0.48496318",
"0.48493317",
"0.48347488",
"0.48321518",
"0.48093894",
"0.47972676",
"0.47718933",
"0.4731398",
"0.472724",
"0.47234383",
"0.47020316",
"0.... | 0.6958503 | 1 |
Trims video. Trims video as per the requirements. | def trim_video(file: str,
output: str,
start: Union[float, int, str] = 0,
end: Union[float, int, str] = 30) -> None:
video = vfc(file, audio=False, verbose=True).subclip(start, end)
video.write_videofile(output, logger=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_video(self, video=None):\r\n if video is None:\r\n video = self.video_buffer\r\n start = 0\r\n end = self.length-1\r\n window = 'Click \"f\" for next frame, \"b\" for back frame, \"s & e\" for trimmes video start and end' \r\n idx = 0\r\n while True:\r\... | [
"0.6901616",
"0.6207075",
"0.5786656",
"0.577973",
"0.57660544",
"0.5547047",
"0.5486522",
"0.5476816",
"0.54572594",
"0.54082835",
"0.5400393",
"0.53815466",
"0.53790164",
"0.5373036",
"0.53557736",
"0.53394014",
"0.5269351",
"0.5252035",
"0.5221841",
"0.5221841",
"0.5196281... | 0.6436215 | 1 |
Trim a sample portion of the video as per the sampling rate. Trims a random sample portion of the video as per the sampling rate. | def trim_sample_section(file: str,
sampling_rate: Union[float, int, str]) -> str:
sampling_rate = float(sampling_rate)
temp = temporary_copy(file)
clip_length = int((duration(file) * sampling_rate * 0.01))
start = random.randint(1, int(duration(file) - clip_length))
end = start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_audio(data, rate=44100, start_trim=0, end_trim=0, log=False):\n chop = np.copy(data[start_trim*rate : len(data)-end_trim*rate])\n if log:\n m, s = divmod(float(len(data))/rate, 60)\n h, m = divmod(m, 60)\n logging.info(\"Original recording length: %d h %d m %d s\" % (h, m, s))\n... | [
"0.6510332",
"0.6324911",
"0.623793",
"0.6023263",
"0.6006621",
"0.60014075",
"0.59632427",
"0.59456605",
"0.58375376",
"0.5696114",
"0.5691306",
"0.5674433",
"0.5615699",
"0.55965847",
"0.5563671",
"0.55182785",
"0.55081767",
"0.5499144",
"0.5495868",
"0.5483414",
"0.5479279... | 0.77830344 | 0 |
Trims the video by deciding factor. Trims the video as per the deciding factor i.e. trim by mins OR trim by secs. | def trim_by_factor(file: str,
factor: str = 's',
clip_length: Union[float, int, str] = 30,
last_clip: bool = True) -> List:
clip_length = int(clip_length)
total_length = duration(file)
video_list = []
idx = 1
if factor == 'm':
start, end, c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_by_points(file: str,\r\n start_time: int,\r\n end_time: int,\r\n factor: str = 's') -> str:\r\n idx = 1\r\n start_time = int(start_time)\r\n end_time = int(end_time)\r\n\r\n _factor = 1 if factor == 's' else 60\r\n total_limit = int(duration(file)... | [
"0.65303284",
"0.62059456",
"0.6144587",
"0.59813577",
"0.5902283",
"0.5843663",
"0.5735374",
"0.5710623",
"0.5593169",
"0.5518785",
"0.5515573",
"0.54729366",
"0.5459376",
"0.5430312",
"0.5430181",
"0.54054594",
"0.5400737",
"0.5391245",
"0.53834134",
"0.5368598",
"0.5286725... | 0.65047145 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.