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 |
|---|---|---|---|---|---|---|
find_optimal_depth(x_train, x_test, y_train, y_test) | def find_optimal_depth(x_train, x_test, y_train, y_test):
# declare variables
max_depths = np.linspace(1, 15, 15, endpoint=True)
train_results = []
test_results = []
# iterate over the different depths
for depth in max_depths:
trees = DecisionTreeClassifier(criterion='entropy', max_depth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_random_forest_max_depth_parameter(params, X_train, X_test, y_train, y_test):",
"def finetune_depth():\n start_depth = 3\n tol = 10E-4\n best_depth = start_depth\n acc = [-1]\n for i in tqdm(range(20),desc='Progress(max_depth)',ncols=70,smoothing=0.5):\n XGBCla = get_XGBmodel(depth=... | [
"0.7656956",
"0.7329924",
"0.6974",
"0.6587317",
"0.6536124",
"0.63864803",
"0.6347309",
"0.62201035",
"0.614047",
"0.6111091",
"0.60877734",
"0.60062516",
"0.60024905",
"0.5923066",
"0.58769566",
"0.5857204",
"0.58429736",
"0.5834306",
"0.5822681",
"0.5794871",
"0.5751008",
... | 0.76725525 | 0 |
Check if script is running as effective root | def user_is_root():
return os.geteuid() == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isroot():\n\treturn (os.geteuid() == 0)",
"def check_root() -> None:\n if os.geteuid() != 0:\n print(\"Please run as root\")\n exit(1)",
"def check_root():\n if os.getuid():\n logging.critical(\"Please run as root.\")\n sys.exit(ExitCode.ROOT_REQUIRED)",
"def root_user_c... | [
"0.8319275",
"0.8270956",
"0.81579727",
"0.8092264",
"0.80667937",
"0.8033403",
"0.79400617",
"0.7456565",
"0.74412656",
"0.74209195",
"0.7404529",
"0.73950994",
"0.7363968",
"0.7312919",
"0.72660387",
"0.71903336",
"0.70513475",
"0.6781694",
"0.6724113",
"0.669094",
"0.65955... | 0.8444211 | 0 |
Runs GeomCA and visualizes the results | def run_GeomCA_and_visualize(R, E, subfolder, GeomCA_parameters):
GeomCA_graph = GeomCA(R, E, GeomCA_parameters, load_existing=False, subfolder=subfolder)
GeomCA_results = GeomCA_graph.get_connected_components()
# Plot results
GeomCA_graph.plot_connected_components()
GeomCA_graph.plot_RE_components... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize(vis, features, label):\n if vis == 'PCA':\n #n_components = st.sidebar.slider(\"n_components\", 2, 10)\n #alpha = st.sidebar.slider(\"alpha\", 0.8, 2.0)\n #pca = PCA(n_components)\n pca = PCA(2)\n\n X_projected = pca.fit_transform(features)\n \n x1 ... | [
"0.66368973",
"0.6600337",
"0.6420606",
"0.6296523",
"0.6137372",
"0.6067283",
"0.6050319",
"0.5947111",
"0.5925355",
"0.58860624",
"0.5873692",
"0.573909",
"0.57352245",
"0.5733286",
"0.56546277",
"0.56486404",
"0.56441635",
"0.561558",
"0.56095773",
"0.5607372",
"0.5607107"... | 0.70804155 | 0 |
Executes GeomCA on points from two circles with perfect overlap. | def example1_perfect_overlap(GeomCA_parameters):
num_pts = 100
GeomCA_parameters['experiment_filename_prefix'] = 'perfect_overlap_'
subfolder = 'perfect_overlap'
R = np.concatenate([circle(n=num_pts, r=1.5), circle(n=int(num_pts/5), r=0.3)])
E = np.concatenate([circle(n=num_pts, r=1.45), circle(n=in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersect_circles(a_pos, a_radius, b_pos, b_radius):\n # vector from A to B \n dp1p2 = b_pos - a_pos\n \n if a_radius + b_radius >= abs(dp1p2):\n return dp1p2.normalized()\n else:\n raise Exception(\"No intersection\")",
"def example2_concatenated_RE(GeomCA_parameters):\n num_... | [
"0.6160016",
"0.5997283",
"0.5967395",
"0.59362185",
"0.5907927",
"0.5898399",
"0.589609",
"0.5888932",
"0.5869198",
"0.5856677",
"0.58411443",
"0.5824634",
"0.5807267",
"0.5802321",
"0.5782535",
"0.57459486",
"0.5732824",
"0.5710771",
"0.57071686",
"0.57047516",
"0.56645477"... | 0.68280524 | 0 |
Executes GeomCA on points from two circles with concatenation. | def example2_concatenated_RE(GeomCA_parameters):
num_pts = 100
GeomCA_parameters['experiment_filename_prefix'] = 'problematic_overlap_'
subfolder = 'problematic_overlap'
GeomCA_parameters['comp_consistency_threshold'] = 0.0
GeomCA_parameters['comp_quality_threshold'] = 0.3
R = np.concatenate([ci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compose(self, point_a, point_b):\n raise NotImplementedError('The Lie group composition'\n ' is not implemented.')",
"def example1_perfect_overlap(GeomCA_parameters):\n num_pts = 100\n GeomCA_parameters['experiment_filename_prefix'] = 'perfect_overlap_'\n subf... | [
"0.627005",
"0.57314706",
"0.5711028",
"0.56879926",
"0.5650522",
"0.56444407",
"0.56033003",
"0.55876243",
"0.553645",
"0.5488664",
"0.54373515",
"0.5407517",
"0.53589904",
"0.53507185",
"0.53455526",
"0.5326827",
"0.5319551",
"0.5313508",
"0.5302542",
"0.5299276",
"0.528658... | 0.6133776 | 1 |
Executes GeomCA on points from two circles with many components. | def example4_many_components(GeomCA_parameters):
num_pts = 100
GeomCA_parameters['experiment_filename_prefix'] = 'many_components_'
subfolder = 'many_components'
GeomCA_parameters['Tdist_percentile'] = 1
R = np.concatenate([circle(n=num_pts, r=1.6, noise=0.7), circle(n=int(num_pts/5), r=0.3)])
E... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compose(self, point_a, point_b):\n raise NotImplementedError('The Lie group composition'\n ' is not implemented.')",
"def example1_perfect_overlap(GeomCA_parameters):\n num_pts = 100\n GeomCA_parameters['experiment_filename_prefix'] = 'perfect_overlap_'\n subf... | [
"0.6225994",
"0.60189563",
"0.58882356",
"0.55982643",
"0.55846024",
"0.55829835",
"0.55147946",
"0.54899234",
"0.5478852",
"0.5478088",
"0.54778796",
"0.54535514",
"0.5453344",
"0.5434801",
"0.5411744",
"0.53941363",
"0.53915924",
"0.53454024",
"0.5336274",
"0.53357804",
"0.... | 0.6165174 | 1 |
Matches template image in a target grayscaled image | def match_template(img, template, threshold=0.9):
#print(img)
#print(template)
res = cv2.matchTemplate(img, template, cv2.TM_CCOEFF_NORMED)
matches = np.where(res >= threshold)
return matches | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matchTemplate(image, template):\n match_hmap = cvCreateImage(\n cvSize(image.width-template.width+1, image.height-template.height+1),\n IPL_DEPTH_32F,\n 1\n )\n cvMatchTemplate(image, template, match_hmap, CV_TM_SQDIFF_NORMED)\n return match_hmap",
"def templateMatchSingle(im... | [
"0.712883",
"0.7049238",
"0.70092785",
"0.6867005",
"0.67496186",
"0.6725702",
"0.66088367",
"0.6605234",
"0.657183",
"0.6571071",
"0.6551701",
"0.6485265",
"0.633541",
"0.633479",
"0.623098",
"0.61834437",
"0.61593664",
"0.60942143",
"0.6080922",
"0.59499186",
"0.5948508",
... | 0.7413479 | 1 |
Goes into the new directory, yields, and changes back when done | def use_dir(new_dir):
owd = os.getcwd()
os.chdir(new_dir)
try:
yield
finally:
os.chdir(owd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pushd(cls, new_dir):\n previous_dir = os.getcwd()\n try:\n new_ab_dir = None\n if os.path.isabs(new_dir):\n new_ab_dir = new_dir\n else:\n new_ab_dir = os.path.join(previous_dir, new_dir)\n # Use absolute path to show it on... | [
"0.75783384",
"0.75708604",
"0.75708604",
"0.7489145",
"0.7388329",
"0.7385815",
"0.73431474",
"0.72926074",
"0.70859474",
"0.7015353",
"0.6922784",
"0.6878287",
"0.6853244",
"0.6851969",
"0.6747227",
"0.6730569",
"0.6711246",
"0.6667921",
"0.66210777",
"0.6619181",
"0.660185... | 0.7654648 | 0 |
Test if the Stc3xTemperatureConditionDegC() type works as expected for different values. | def test_temperature_condition_degc(value):
result = Stc3xTemperatureConditionDegC(value.get('degrees_celsius'))
assert type(result) is Stc3xTemperatureConditionDegC
assert type(result.ticks) is int
assert result.ticks == value.get('ticks')
assert type(result.degrees_celsius) is float
assert res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_c(self):\n self.failIf(cgs.speed_of_light/mks.speed_of_light!=100)",
"def test_temperature(self):\r\n self.assertEqual(Converter.TemperatureCtoF(50), 122)\r\n self.assertEqual(Converter.TemperatureCtoF(-50), -58)\r\n self.assertEqual(Converter.TemperatureFtoC(50), 10)\r\n ... | [
"0.59868485",
"0.583049",
"0.5594686",
"0.54924345",
"0.53916264",
"0.5387543",
"0.53805643",
"0.53593385",
"0.53535765",
"0.53426176",
"0.53332806",
"0.5326063",
"0.53122115",
"0.53121305",
"0.5307691",
"0.5266458",
"0.5253333",
"0.52499187",
"0.5244959",
"0.52378863",
"0.52... | 0.8035175 | 0 |
Test if the Stc3xRelativeHumidityConditionPercent() type works as expected for different values. | def test_relative_humidity_condition_percent(value):
result = Stc3xRelativeHumidityConditionPercent(value.get('percent_rh'))
assert type(result) is Stc3xRelativeHumidityConditionPercent
assert type(result.ticks) is int
assert result.ticks == value.get('ticks')
assert type(result.percent_rh) is float... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rh_specific_humidity():\n p = 1013.25 * units.mbar\n temperature = 20. * units.degC\n q = 0.012 * units.dimensionless\n rh = relative_humidity_from_specific_humidity(p, temperature, q)\n assert_almost_equal(rh, 82.71759 * units.percent, 3)",
"def test_str_percent(self):\n xknx = XK... | [
"0.6108147",
"0.60558736",
"0.5909511",
"0.5753489",
"0.57529473",
"0.5706647",
"0.5646214",
"0.5584023",
"0.5577272",
"0.5554479",
"0.54770046",
"0.5465542",
"0.5416829",
"0.5343803",
"0.5296619",
"0.5161798",
"0.5155328",
"0.515257",
"0.51523316",
"0.51366204",
"0.51230216"... | 0.8242922 | 0 |
Test if the Stc3xReferenceConcentration() type works as expected for different values. | def test_reference_concentration(value):
result = Stc3xReferenceConcentration(value.get('vol_percent'))
assert type(result) is Stc3xReferenceConcentration
assert type(result.ticks) is int
assert result.ticks == value.get('ticks')
assert type(result.vol_percent) is float
assert result.vol_percent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_conicType(self):\n self.assertEqual('circle', self.cs.conicType)",
"def test_temperature_condition_degc(value):\n result = Stc3xTemperatureConditionDegC(value.get('degrees_celsius'))\n assert type(result) is Stc3xTemperatureConditionDegC\n assert type(result.ticks) is int\n assert res... | [
"0.5962481",
"0.5826048",
"0.57340735",
"0.5712894",
"0.5660484",
"0.56059223",
"0.5572282",
"0.55218256",
"0.54756355",
"0.5350208",
"0.5325876",
"0.5322526",
"0.5319657",
"0.5259307",
"0.5255702",
"0.5252426",
"0.5224404",
"0.52167296",
"0.52112126",
"0.51864624",
"0.516695... | 0.7479767 | 0 |
wczytywanie pliku z ustawieniami (pliku defs.txt) do slownika | def wczytywanie_ustawien(plik_konfiguracyjny = "defs.txt"):
import re
import numpy as np
# wczytuje zawartosc pliku (bez pierwszej i ostatniej linijki, jeden wiersz
# wyjsciowej macierzy, zawiera nazwe parametru i jego wartosc, jako
# oddzielne elementy, zapisane jako stringi)
usta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_freq_dist(filename):\r\n pass",
"def fileCheckOriginal():\n\n print('[+] Populating File Hasing for later check')\n for url in check_files:\n try:\n data = query(url)\n file_name = url.split(\"/\")[-1]\n _,tmp_file = tempfile.mkstemp(prefix=\"exitmap_%s... | [
"0.5656537",
"0.54145676",
"0.5318742",
"0.5270076",
"0.5257282",
"0.52272415",
"0.52062726",
"0.51745343",
"0.51367974",
"0.51221204",
"0.51010156",
"0.5091663",
"0.50791836",
"0.50749356",
"0.5073961",
"0.50379795",
"0.50298905",
"0.50280356",
"0.5023214",
"0.50199276",
"0.... | 0.58079433 | 0 |
function that returns a list of files in a directory | def files_list(directory: str) -> list:
files = os.listdir(directory)
return files | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_in_dir(path):\n return os.listdir(path)",
"def list_files(path):\n ls_output = os.listdir(path)\n return ls_output",
"def get_list_of_files_in_dir(file_list_path=None):\n return os.listdir(file_list_path)",
"def get_files_in_dir(dir: str):\n\n file_list = [f\"{dir}/{file}\" for file ... | [
"0.8460311",
"0.81647474",
"0.81629026",
"0.81405336",
"0.8080091",
"0.80371094",
"0.80286586",
"0.80286014",
"0.8006353",
"0.7988925",
"0.7968691",
"0.7947784",
"0.79394555",
"0.7924374",
"0.7908869",
"0.78871995",
"0.78455186",
"0.7839567",
"0.78281265",
"0.77742404",
"0.77... | 0.8576045 | 0 |
Delete tickets if they are over 2 days old kwargs = ['raw', 'signal', 'instance', 'sender', 'created'] | def delete_old_tickets(**kwargs):
sender = kwargs.get('sender', None)
now = datetime.now()
expire = datetime(now.year, now.month, now.day - 2)
sender.objects.filter(created__lt=expire).delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ticket_deleted(self, ticket):",
"def delete(self, **kwargs):\n notifications = Notification.objects.filter(date=self.end_date).delete()\n super(Term, self).delete(**kwargs)",
"def delete_old():\n objs = (Snapshot\n .objects\n .filter(timestamp__lte=(datetime.now() - t... | [
"0.6487605",
"0.5947633",
"0.58759075",
"0.56667393",
"0.5586986",
"0.55381316",
"0.5509974",
"0.55087566",
"0.54718333",
"0.54480857",
"0.5440324",
"0.54234195",
"0.54153347",
"0.54026544",
"0.53935766",
"0.5377491",
"0.5373755",
"0.5359821",
"0.53291327",
"0.53145707",
"0.5... | 0.81078136 | 0 |
Checks if the auth backend is CASBackend | def _is_cas_backend(session):
if session:
backend = session.get(BACKEND_SESSION_KEY)
return backend == cas_backend
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_auth(username, password):\n return get_ct_object(username, password) is not None",
"def is_frozensand_auth_available(self):\n cvar = self.getCvar('auth')\n if cvar:\n auth = cvar.getInt()\n return auth != 0\n else:\n return False",
"def check_a... | [
"0.60728174",
"0.59774363",
"0.5951125",
"0.58950526",
"0.5744704",
"0.57350016",
"0.55626863",
"0.55281836",
"0.5507198",
"0.5506492",
"0.54436207",
"0.5431313",
"0.54300576",
"0.5392571",
"0.53865415",
"0.53832173",
"0.53710765",
"0.5368586",
"0.5332977",
"0.5318046",
"0.53... | 0.8009172 | 0 |
Creates the mapping between a session key and a service ticket after user logged in | def map_service_ticket(sender, **kwargs):
request = kwargs['request']
ticket = request.GET.get('ticket', '')
if ticket and _is_cas_backend(request.session):
session_key = request.session.session_key
SessionServiceTicket.objects.create(service_ticket=ticket,
session_key=session_ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_ticket(context: IdPContext, info: Mapping[str, str], binding: str, key: str) -> SSOLoginData:\n if not binding:\n raise eduid_idp.error.ServiceError(\"Can't create IdP ticket with unknown binding\", logger=context.logger)\n ticket = SSOLoginData(\n key, info.get('SAMLRequest', ''), ... | [
"0.5882023",
"0.5663405",
"0.5516222",
"0.5402445",
"0.5250479",
"0.51965714",
"0.51268196",
"0.5083042",
"0.5061434",
"0.5037347",
"0.50192714",
"0.50188154",
"0.50108856",
"0.49768835",
"0.4969029",
"0.49602732",
"0.49366304",
"0.49321392",
"0.49267116",
"0.4920668",
"0.491... | 0.72305685 | 0 |
Deletes the mapping between session key and service ticket after user logged out | def delete_service_ticket(sender, **kwargs):
request = kwargs['request']
session_key = request.session.session_key
SessionServiceTicket.objects.filter(session_key=session_key).delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session_entry(self,session_id,client_id):\n del self.sessions[session_id][\"USERS\"][client_id]",
"def do_logout():\n del session[CURRENT_USER_KEY]",
"def logout_user(session):\n del session['user']",
"def remove_session(self) -> None:\n pass",
"def reset_flask_session_on_log... | [
"0.69043785",
"0.6829573",
"0.6755733",
"0.633106",
"0.63225955",
"0.6281356",
"0.6243314",
"0.6217949",
"0.6207205",
"0.6196361",
"0.6177731",
"0.6151575",
"0.61404866",
"0.6126849",
"0.61116225",
"0.6099419",
"0.6049227",
"0.6046143",
"0.6018944",
"0.60189253",
"0.60093045"... | 0.7088026 | 0 |
create upper_layer_stub for exchanging data between grpc | def create_upper_stub(self):
if self.upper_layer_addr:
channel = grpc.insecure_channel(self.upper_layer_addr)
self.upper_layer_stub = nn_pb_grpc.LayerDataExchangeStub(channel)
else:
print("no upper layer has been specified") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_lower_stub(self):\n if self.lower_layer_addr:\n channel = grpc.insecure_channel(self.lower_layer_addr)\n self.lower_layer_stub = nn_pb_grpc.LayerDataExchangeStub(channel)\n else:\n print(\"no lower layer has been specified\")",
"def create_stub(cls, proto_py_module, stub_name):\n\... | [
"0.72886026",
"0.5811964",
"0.5788405",
"0.57524014",
"0.5697875",
"0.5649955",
"0.5535496",
"0.55295676",
"0.5520369",
"0.55164444",
"0.5472265",
"0.5450913",
"0.5418353",
"0.53895277",
"0.537693",
"0.53594345",
"0.53464794",
"0.53227174",
"0.5322105",
"0.52813405",
"0.52743... | 0.8060947 | 0 |
extract and transform data in forward message | def parse_forward_msg(self, req):
batch_id = req.batch_id
bytes_outputs_of_lower = req.output_matrix
bytes_labels = req.labels
is_train = req.is_train
outputs_of_lower = pkl.loads(bytes_outputs_of_lower)
labels = pkl.loads(bytes_labels)
return batch_id, outputs_of_lower, labels, is_train | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(self, data):",
"def process(self, data):\n return self.transformer.transform(data)",
"def forward(self, s):",
"def process_message(self, msg, src):",
"def _process_msg(self, data):\n\n # print(data)\n\n tilt = data.linear.x\n pan = data.angular.z\n\n #self.c... | [
"0.6754382",
"0.63280874",
"0.62509835",
"0.6213167",
"0.6211131",
"0.6187609",
"0.61491907",
"0.6090462",
"0.6069058",
"0.59846157",
"0.59835595",
"0.59835595",
"0.59835595",
"0.59835595",
"0.59835595",
"0.59835595",
"0.5949716",
"0.59038544",
"0.5901411",
"0.58053714",
"0.5... | 0.6772115 | 0 |
Collecting segments of customers from the reports index. | def get_customer_segments(self, date):
date = current_date_to_day().isoformat() if date is None else date
self.products = pd.merge(self.products,
self.cs.fetch(start_date=convert_dt_to_day_str(date))[['client', 'segments']],
on='client', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(self) -> CustomerSegmentsCohortIndex:\n\n cohort_index = list(self.cohorts.values())\n cohort_index.sort()\n\n self.customer_index = CustomerSegmentsCohortIndex(cohort_index, self.cohorts)\n return self.customer_index",
"def customerReport(self):\n self._setFormat()\n... | [
"0.5953117",
"0.58031774",
"0.565527",
"0.5546315",
"0.55349505",
"0.54906625",
"0.53167194",
"0.5230708",
"0.5215849",
"0.5213204",
"0.5206198",
"0.52050453",
"0.5201437",
"0.5199309",
"0.5198458",
"0.51928395",
"0.5178069",
"0.5167014",
"0.5131205",
"0.51248014",
"0.5055169... | 0.6957383 | 0 |
the products of orders are counted and sorted according to the order counts. So, the most ordered products are detected. | def get_most_ordered_products(self):
return self.products.groupby("products").agg(
{"id": lambda x: len(np.unique(x))}).reset_index().rename(
columns={"id": "order_count"}).sort_values(by='order_count', ascending=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_most_ordered_categories(self):\n return self.products.groupby(\"category\").agg({\"id\": lambda x: len(np.unique(x))}).reset_index().rename(\n columns={\"id\": \"order_count\"}).sort_values(by='order_count', ascending=False)",
"def product_counter_v1(products):\n counter_dict = creat... | [
"0.68081784",
"0.67476696",
"0.64146686",
"0.64145577",
"0.63793606",
"0.6214779",
"0.61632925",
"0.6137959",
"0.6122822",
"0.6062472",
"0.59905285",
"0.5925148",
"0.5895424",
"0.58504367",
"0.58478254",
"0.5834449",
"0.5833121",
"0.5819845",
"0.57922095",
"0.57499033",
"0.57... | 0.8015304 | 0 |
the product categories of orders are counted and sorted according to the order counts. So, the most ordered products are detected. | def get_most_ordered_categories(self):
return self.products.groupby("category").agg({"id": lambda x: len(np.unique(x))}).reset_index().rename(
columns={"id": "order_count"}).sort_values(by='order_count', ascending=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_most_ordered_products(self):\n return self.products.groupby(\"products\").agg(\n {\"id\": lambda x: len(np.unique(x))}).reset_index().rename(\n columns={\"id\": \"order_count\"}).sort_values(by='order_count', ascending=False)",
"def product_counter_v1(products):\n counter_... | [
"0.77588207",
"0.6414755",
"0.6342211",
"0.59683096",
"0.5899966",
"0.5684099",
"0.5663677",
"0.56113553",
"0.5610517",
"0.5597645",
"0.5584474",
"0.55764884",
"0.55601686",
"0.5540141",
"0.5536091",
"0.55304",
"0.5529468",
"0.55216795",
"0.5516557",
"0.55163044",
"0.55117685... | 0.7878613 | 0 |
Which category is preferred to purchase via purchased hour? | def get_hourly_categories_of_sales(self):
self.hourly_product_cat = self.products.groupby(["hours", "category"]).agg(
{"id": lambda x: len(np.unique(x))}).reset_index().rename(columns={"id": "order_count"})
self.hourly_product_cat['product_cat_order_count_rank'] = self.hourly_product_cat.sor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_price_category():\n\n return ( pl.when(pl.col('Purchase Price') < 25_000)\n .then('Small')\n .when(pl.col('Purchase Price') < 50_000)\n .then('Medium')\n .when(pl.col('Purchase Price') < 75_000)\n .then('Large')\n .... | [
"0.5989006",
"0.5673621",
"0.5407671",
"0.5396377",
"0.5281002",
"0.52450204",
"0.5204981",
"0.5165997",
"0.51532924",
"0.5078893",
"0.50686026",
"0.5047856",
"0.5021521",
"0.5004953",
"0.50009716",
"0.49986398",
"0.49608633",
"0.49548137",
"0.49391082",
"0.49102464",
"0.4901... | 0.6102891 | 0 |
This allows us to query the created Product Analytics. product_analytic_name is crucial for us to collect the correct filters. Example of queries; | def fetch(self, product_analytic_name, start_date=None):
boolean_queries, date_queries = [], []
boolean_queries = [{"term": {"report_types.type": product_analytic_name}},
{"term": {"index": get_index_group(self.order_index)}}]
if start_date is not None:
da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_search(obj, query):\n client = get_client(obj)\n\n pgs = client.product_list(q=query)\n\n print(json.dumps(pgs, indent=4))",
"def query_product_details(query_key, query_type):\n\n if query_type == \"search\":\n app.logconsole.info(\"Searching for products having topic: \" + str(que... | [
"0.5862031",
"0.5635878",
"0.5547713",
"0.548389",
"0.5324832",
"0.53052276",
"0.5302993",
"0.52691245",
"0.52461225",
"0.5201117",
"0.51546127",
"0.51137793",
"0.5100449",
"0.509068",
"0.50810194",
"0.5064964",
"0.50307375",
"0.5006918",
"0.50048625",
"0.49905846",
"0.498873... | 0.6532298 | 0 |
Check a Pipeline name is a managed format app_name [region]. | def check_managed_pipeline(name='', app_name=''):
*pipeline_name_prefix, bracket_region = name.split()
region = bracket_region.strip('[]')
not_managed_message = '"{0}" is not managed.'.format(name)
if 'onetime' in region:
LOG.info('"%s" is a onetime, marked for cleaning.', name)
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_name(name, allow_services=False):",
"def is_valid_platform(self):\n\n return 'APPLICATION_NAME' in self",
"def IsValidProjectName(s):\n return (RE_PROJECT_NAME.match(s) and\n len(s) <= framework_constants.MAX_PROJECT_NAME_LENGTH)",
"def validateName(name):\n return name in [cont... | [
"0.57372355",
"0.5639453",
"0.55728406",
"0.55565304",
"0.5487043",
"0.5452928",
"0.5440426",
"0.541211",
"0.53764194",
"0.53713036",
"0.53163034",
"0.5275092",
"0.52631265",
"0.5192111",
"0.51819855",
"0.5173692",
"0.51430035",
"0.51365286",
"0.51321214",
"0.5122247",
"0.511... | 0.83135873 | 0 |
Get a list of all the Pipelines in _app_. | def get_all_pipelines(app=''):
uri = '/applications/{app}/pipelineConfigs'.format(app=app)
response = gate_request(uri=uri)
assert response.ok, 'Could not retrieve Pipelines for {0}.'.format(app)
pipelines = response.json()
LOG.debug('Pipelines:\n%s', pipelines)
return pipelines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipelines(self):\r\n return pipelines.Pipelines(self)",
"def pipelines(self) -> list:\n if not self._pipelines:\n if \"pipelines\" not in self._pipeline_definition:\n raise ValueError(\"Pipeline is missing 'pipelines' field.\")\n elif len(self._pipeline_defi... | [
"0.69508195",
"0.6577712",
"0.65438247",
"0.6334431",
"0.61515737",
"0.6077736",
"0.6005368",
"0.59433365",
"0.5942044",
"0.592068",
"0.59098804",
"0.5907886",
"0.5898745",
"0.58876544",
"0.5832034",
"0.5805286",
"0.58038795",
"0.5740501",
"0.57273",
"0.5706596",
"0.5696769",... | 0.8190129 | 0 |
Get the ID for Pipeline _name_. | def get_pipeline_id(app='', name=''):
return_id = None
pipelines = get_all_pipelines(app=app)
for pipeline in pipelines:
LOG.debug('ID of %(name)s: %(id)s', pipeline)
if pipeline['name'] == name:
return_id = pipeline['id']
LOG.info('Pipeline %s found, ID: %s', name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pipeline_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"pipeline_id\")",
"def pipeline_id(self) -> PipelineId:\r\n return self._pipeline_id",
"def pipeline_id(self) -> PipelineId:\r\n return self._pipeline_id",
"def id(self) -> str:\n return self._pipelin... | [
"0.74407345",
"0.74068856",
"0.74068856",
"0.7357186",
"0.73000675",
"0.7239473",
"0.6968287",
"0.66966665",
"0.6689742",
"0.65646154",
"0.6414443",
"0.6359731",
"0.63242817",
"0.6232581",
"0.6160722",
"0.61328304",
"0.6095475",
"0.6028077",
"0.60260046",
"0.60039383",
"0.595... | 0.86246604 | 0 |
Create a predictable pipeline ID (UUID) using an application name and pipeline name. It will always produce the same UUID when given the same arguments | def generate_predictable_pipeline_id(application_name, pipeline_name):
seed = application_name + pipeline_name
pipeline_uuid = uuid.uuid5(_foremast_uuid_namespace, seed)
LOG.debug("Generating pipeline id '%s' using namespace '%s' and seed '%s'",
pipeline_name, _foremast_uuid_namespace, seed)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pipeline_id(app='', name=''):\n return_id = None\n\n pipelines = get_all_pipelines(app=app)\n\n for pipeline in pipelines:\n LOG.debug('ID of %(name)s: %(id)s', pipeline)\n\n if pipeline['name'] == name:\n return_id = pipeline['id']\n LOG.info('Pipeline %s found... | [
"0.71596885",
"0.63998425",
"0.6384486",
"0.63374835",
"0.6329011",
"0.6262631",
"0.6212251",
"0.6195894",
"0.6179726",
"0.61687744",
"0.6141783",
"0.6072093",
"0.6033113",
"0.6012087",
"0.5983259",
"0.5963666",
"0.59508884",
"0.5948116",
"0.59388566",
"0.5923647",
"0.5862761... | 0.86215436 | 0 |
Create a season, players, 2 teams, and a match, as mock data for many of the tests | def create_data():
a_season = create_season()
create_teams(a_season) # we know they are called Team A and Team B
create_play_positions() # we need these in place to test the score sheet creation
create_game_order() # these too ...
(week_one, week_two) = create_weeks(a_season, 2)
match_one = M... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_teams(a_season):\n\n team_a = Team(name=\"Team A\", season=a_season)\n team_a.save()\n for p in create_players(7, 0):\n team_a.players.add(p)\n team_a.save()\n team_b = Team(name=\"Team B\", season=a_season)\n team_b.save()\n for p in create_players(7, 16):\n team_b.pl... | [
"0.69421226",
"0.6844351",
"0.6783624",
"0.67119485",
"0.64144975",
"0.64050007",
"0.6352539",
"0.63016975",
"0.6297452",
"0.62618047",
"0.62387806",
"0.621845",
"0.6166793",
"0.6166793",
"0.61455023",
"0.61117446",
"0.6108021",
"0.60846454",
"0.60833246",
"0.60346794",
"0.60... | 0.763235 | 0 |
Create a score sheet, verify you get a redirect to the edit page, and that there are the correct number of games attached, and that trying to access it via a different session returns a redirect | def test_score_sheet_create(self):
response = self.client.get(reverse('score_sheet_create', kwargs={'match_id': self.sample_match_id}))
# since we have a fresh DB, assume this will be score sheet number 1 ...
self.assertRedirects(response, expected_url=reverse('score_sheet_edit', kwargs={'score... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_score_sheet_set_lineup_with_scored_games(self):\n test_score_sheet_id = 2\n response = self.client.get(reverse('score_sheet_create', kwargs={'match_id': self.sample_match_id}))\n # since we have a fresh DB, assume this will be score sheet number 1 ...\n self.assertRedirects(\n ... | [
"0.6162274",
"0.6128205",
"0.60482854",
"0.5939095",
"0.5927731",
"0.5912903",
"0.5898101",
"0.5850209",
"0.5803197",
"0.5692023",
"0.56905717",
"0.5690103",
"0.5662908",
"0.5640317",
"0.5635196",
"0.5622585",
"0.56059426",
"0.5533856",
"0.5524557",
"0.5507272",
"0.5497085",
... | 0.7376726 | 0 |
Create a score sheet, create the lineup, | def test_score_sheet_set_lineup_with_scored_games(self):
test_score_sheet_id = 2
response = self.client.get(reverse('score_sheet_create', kwargs={'match_id': self.sample_match_id}))
# since we have a fresh DB, assume this will be score sheet number 1 ...
self.assertRedirects(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_score_sheet(player_name):\n score_sheet = [player_name, EMPTY_BOX(), EMPTY_BOX(), EMPTY_BOX(), EMPTY_BOX(), EMPTY_BOX(),\n EMPTY_BOX(), EMPTY_BOX(), EMPTY_BOX(), EMPTY_BOX(), EMPTY_BOX(), EMPTY_BOX(),\n EMPTY_BOX(), EMPTY_BOX()]\n return score_sheet",
"def pri... | [
"0.6620156",
"0.6198418",
"0.59768164",
"0.5974245",
"0.5973713",
"0.5927228",
"0.5897084",
"0.5822827",
"0.5799057",
"0.57295734",
"0.56509584",
"0.5609771",
"0.5566049",
"0.55483043",
"0.55433905",
"0.54629046",
"0.5457988",
"0.54230905",
"0.539813",
"0.53767955",
"0.536774... | 0.6293038 | 1 |
Change status of docker container | def container_status_change(self, status=None, containerName=None, kwargs=None):
if status is None:
Console.info("No status specified")
return
try:
container = self.client.containers.get(containerName)
# need to check this ..
if status is "sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_status(self):\n with DockerHost('host', dind=False, start_calico=False) as host:\n host.calicoctl(\"status\")",
"def update_containers_status(func):\n def wrapper(self, **kwargs):\n database = self.database\n\n instance_documents = database.get_all_documents()\n\n ... | [
"0.70578295",
"0.6473376",
"0.6432304",
"0.6188087",
"0.6184203",
"0.6168694",
"0.6136805",
"0.60746354",
"0.6052587",
"0.5880161",
"0.58582824",
"0.58295405",
"0.5797547",
"0.57793546",
"0.57774156",
"0.5776194",
"0.57731754",
"0.575145",
"0.57329303",
"0.5729732",
"0.571360... | 0.79306495 | 0 |
List of docker containers | def container_list(self, kwargs=None):
try:
scode, containers = Rest.get('Container')
except docker.errors.APIError as e:
Console.error(e.explanation)
return
if len(containers) == 0:
print("No containers exist")
return
n = 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def containers():\n # TODO: can there be multiple names?\n cmd = [ 'docker', 'ps', '--format', '{{.Names}}' ]\n with popen_text(cmd) as docker:\n for ln in docker.stdout:\n yield ln[:-1]",
"def container_list(ctx, token, all):\n try:\n out = ctx.obj.container_list(token, all)... | [
"0.85202986",
"0.80538154",
"0.78957236",
"0.77715665",
"0.7725929",
"0.7600456",
"0.7591648",
"0.75867236",
"0.74875474",
"0.7300215",
"0.72156626",
"0.72083133",
"0.71550876",
"0.7048107",
"0.70339996",
"0.6929437",
"0.69009",
"0.68996185",
"0.6866489",
"0.68304443",
"0.678... | 0.82409215 | 1 |
List of docker images | def images_list(self, kwargs=None):
try:
scode, images = Rest.get('Image')
except docker.errors.APIError as e:
Console.error(e.explanation)
return
if len(images) == 0:
Console.info("No images exist")
return
n = 1
e = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_docker_images():\n raw_result = subprocess.getstatusoutput('docker images')\n return result_handler(raw_result)",
"def handle_api_list_images(self, http_context):\n\n command = self.docker + ['images', '--format', '\\'{{json .}}\\'', '--no-trunc', '-a']\n images = []\n for lin... | [
"0.8604281",
"0.75808614",
"0.756722",
"0.75019765",
"0.7479641",
"0.72172594",
"0.7202579",
"0.69728583",
"0.695355",
"0.6896723",
"0.6886749",
"0.6875574",
"0.6822901",
"0.6817309",
"0.6754934",
"0.6730269",
"0.6713355",
"0.67081296",
"0.6634928",
"0.66286904",
"0.65849423"... | 0.7891496 | 1 |
List of docker networks | def network_list(self, kwargs=None):
try:
scode, networks = Rest.get('Network')
except docker.errors.APIError as e:
Console.error(e.explanation)
return
if len(networks) == 0:
Console.info("No network exist")
return
n = 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_net(self):\n _url = \"http://\" + self.host_ip + \":9696/v2.0/networks\"\n _headers = {'Content-type': 'application/json',\n 'x-auth-token': self.project_info[\"token_project\"]}\n _body = None\n\n response = self.request(\"GET\", _url, _headers, _body)\n ... | [
"0.74788606",
"0.741444",
"0.7369265",
"0.7293231",
"0.72285724",
"0.71947175",
"0.71626604",
"0.71392614",
"0.71269166",
"0.70746624",
"0.7001955",
"0.6991505",
"0.697533",
"0.6962304",
"0.69008434",
"0.6889924",
"0.6856688",
"0.6847726",
"0.67088145",
"0.65913796",
"0.65702... | 0.80184656 | 0 |
Set ip with request_ip if it's blank then save. | def save(self, **kwargs):
# use request ip if it's not given
if not self.ip:
self.ip = self.request_ip
# map all ipv4 addresses to ipv6
# (for consistency with node who systematically does it)
if ip_address(self.ip).version == 4:
self.ip = "::ffff:" + self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setIpaddr(self):\n\t\tself.ipaddr = self.settings.getKeyValue('ipaddr')\n\t\tself.socket.send('setenv ipaddr ' + self.ipaddr+'\\r', 1)\t\t\n\t\treturn None",
"def ip(self, ip):\n self._ip = ip\n return self",
"def ip(self, ip):\n\n self._ip = ip",
"def ip(self, ip):\n\n self._... | [
"0.6861273",
"0.6716277",
"0.66815716",
"0.66815716",
"0.6680944",
"0.6588376",
"0.6429373",
"0.6411766",
"0.64041704",
"0.62527114",
"0.62386143",
"0.6212604",
"0.614712",
"0.61433023",
"0.6121039",
"0.6121039",
"0.611965",
"0.61175644",
"0.60962504",
"0.6094377",
"0.6063190... | 0.73337114 | 0 |
Validate that accomodates is a positive number. | def accommodates_must_be_positive(cls, value):
assert value > 0, f'accommodates == {value}, must be > 0'
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_nonpositive(self, a):\n return a <= 0",
"def validate_positive(value: float):\n if value < 0:\n err = f\"{value} n`est pas positif\"\n raise ValidationError(err)",
"def is_positive(self, a):\n return a > 0",
"def is_nonnegative(self, a):\n return a >= 0",
"def c... | [
"0.6728226",
"0.6556647",
"0.65237826",
"0.6508682",
"0.62888473",
"0.6283166",
"0.62722147",
"0.6248607",
"0.6218264",
"0.6161898",
"0.614257",
"0.6108476",
"0.6102464",
"0.6065611",
"0.59845144",
"0.5960475",
"0.5945291",
"0.5945291",
"0.5945291",
"0.5899618",
"0.58777004",... | 0.78905904 | 0 |
Update the application manifest based on the platform | def platform_mode_manifest_updates(self, dbapi, mode):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_manifest(builder):\r\n\r\n manifest_path = join(builder.Config.SourceRootPath, builder.Config.WMAppManifest)\r\n dom = parse(manifest_path)\r\n\r\n #import pdb;pdb.set_trace()\r\n #version = make_version_string(builder)\r\n version = builder.AppVersion\r\n\r\n update_manifest_with_valu... | [
"0.69886625",
"0.6529286",
"0.6371577",
"0.59272647",
"0.59117043",
"0.5799261",
"0.565634",
"0.5634012",
"0.56320804",
"0.55081713",
"0.548765",
"0.542139",
"0.54051614",
"0.54015857",
"0.53800035",
"0.53744155",
"0.536746",
"0.5348723",
"0.53109974",
"0.5263399",
"0.5246968... | 0.65653914 | 1 |
Prepare an instance of table widget. | def makeTableWidget(self):
from collective.table.browser.table import TableWidget
context = self.portal.table
widget = TableWidget(context, None)
widget.fieldName = 'table'
return widget | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ui_init_table(self):\n self._table = QtWidgets.QTableWidget()\n self._table.verticalHeader().setVisible(False)\n self._table.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)\n self._table.horizontalHeader().setFont(self._font)\n self._table.setFont(self._f... | [
"0.7345558",
"0.7051967",
"0.6947296",
"0.68899834",
"0.67531",
"0.66638064",
"0.6640212",
"0.65741915",
"0.65368724",
"0.6520382",
"0.6502412",
"0.6459547",
"0.63588107",
"0.6357468",
"0.6316014",
"0.63127935",
"0.63052183",
"0.62617445",
"0.62088734",
"0.6194616",
"0.619387... | 0.73048043 | 1 |
Test retrieving available table sources. | def test_available_sources(self, field, getAdapters):
# create some dummy adapters
foo = self.makeSource('foo')
bar = self.makeSource('bar')
# make zope.interface.getAdapters return our dummy adapters
getAdapters.return_value = [('foo', foo), ('bar', bar)]
# mock field... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_missing_data_sources(self):",
"def test_get_table_list(self):\n db_introspection = DatabaseIntrospection(self.connection)\n cursor = mock.MagicMock()\n\n def list_tables(*args, **kwargs):\n return [[\"Table_1\", \"t\"], [\"Table_2\", \"t\"]]\n\n cursor.run_sql_in_s... | [
"0.7090641",
"0.65698355",
"0.6527713",
"0.6390457",
"0.6368743",
"0.63451064",
"0.6319873",
"0.6279322",
"0.6151875",
"0.60985684",
"0.6057403",
"0.6030352",
"0.5952832",
"0.59413344",
"0.5912477",
"0.5907727",
"0.59063756",
"0.59048533",
"0.58825487",
"0.5863365",
"0.585604... | 0.6897864 | 1 |
Test the Javascript that is injected inline and initializes our table. | def test_tableinit(self, source, url):
# mock source.listColumns() to return some dummy columns
source.listColumns.return_value = [
self.makeColumn('foo', 'Foo'),
self.makeColumn('bar', 'Bar')
]
# mock source() properties to return True
source.editab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def js(self, script):\n self.page().mainFrame().evaluateJavaScript(script)",
"def standalone_html(self) -> str:\n SIMPLE_HTML = jinja2.Template(\"\"\"<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"UTF-8\">\n <style>\n {{ css }}\n ... | [
"0.61291397",
"0.60076034",
"0.5463307",
"0.5425365",
"0.5351347",
"0.5330451",
"0.5238139",
"0.52188236",
"0.5192878",
"0.5191892",
"0.518998",
"0.5189745",
"0.5127554",
"0.51107067",
"0.5101213",
"0.50945663",
"0.5088001",
"0.5069076",
"0.50545645",
"0.50176215",
"0.5006932... | 0.62368953 | 0 |
Test sEcho request parameter > table draw count that is used to prevent XSS attacks. | def test_get_sEcho(self):
widget = self.makeTableWidget()
widget.request = TestRequest(sEcho=1)
self.assertEquals(1, widget.get_sEcho()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_count(request):\n return request.param",
"def packet_count(request):\n return request.param",
"def n_head(request) -> int:\n return request.param",
"def no_of_lines():\n return render_template(\"no_of_lines.html\", no_of_lines=no_of_lines())",
"def count(ev):\n profData = getProfili... | [
"0.58527005",
"0.5707461",
"0.5597146",
"0.55704176",
"0.54937184",
"0.5407998",
"0.53467333",
"0.525843",
"0.5254741",
"0.52342147",
"0.51728785",
"0.51258564",
"0.51020443",
"0.50594413",
"0.5051207",
"0.5038133",
"0.50341755",
"0.5025666",
"0.5022215",
"0.50215113",
"0.499... | 0.63851625 | 0 |
Test adding a new row. | def test_add_row(self, source):
widget = self.makeTableWidget()
widget.request = mock.Mock()
widget.add_row()
# test that add_row in data source was called
source.add_row.assert_called_once_with()
# test that user is redirected back to table
widget.request.respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dummydb_add_data_to_table(self):\n db = DummyDB()\n columns = {\n \"one\": int,\n \"two\": str,\n \"three\": bool,\n }\n db.create_table(\"new_table\", columns)\n db.insert(\"new_table\", one=1, two=\"haunted\", three=True)\n resul... | [
"0.7370004",
"0.7358489",
"0.733366",
"0.7131383",
"0.702773",
"0.6942276",
"0.68960035",
"0.6838198",
"0.67742157",
"0.6722554",
"0.67109233",
"0.6703067",
"0.6649618",
"0.6648897",
"0.6632905",
"0.6624801",
"0.65642107",
"0.6548024",
"0.65289193",
"0.65140134",
"0.64874446"... | 0.75782865 | 0 |
Test updating a cell. | def test_update_cell(self, source):
# fill test request with values
form = dict(
row_id=1,
column_name='col01',
value='foo'
)
widget = self.makeTableWidget()
widget.request = TestRequest(form=form)
result = widget.update_cell()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n # this is tested graphically, as it is UI\n pass",
"def test_update_case(self):\n pass",
"def test_do_cell_update_calls_cell_manager_with_f... | [
"0.7193635",
"0.7193635",
"0.7193635",
"0.7172935",
"0.7146082",
"0.6913853",
"0.68971926",
"0.6794479",
"0.67881197",
"0.6656517",
"0.6639601",
"0.6634047",
"0.65909445",
"0.6540757",
"0.65176725",
"0.6460907",
"0.64587533",
"0.64382964",
"0.6419214",
"0.6321574",
"0.6317365... | 0.8107182 | 0 |
Parses input yaml file and substitutes {tokens} from context. Loads yaml into memory to do parsing, so be aware of big files. | def run_step(context):
logger.debug("started")
context.assert_keys_have_values(__name__,
'fileFormatYamlIn',
'fileFormatYamlOut')
in_path = context.get_formatted('fileFormatYamlIn')
out_path = context.get_formatted('fileFormatYamlO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_yaml(yfile):\n try:\n f0 = get_fileobj(yfile)\n context_items = [ConTextItem(literal=d[\"Lex\"],\n category=d[\"Type\"],\n re=r\"%s\"%d[\"Regex\"],\n rule=d[\"Direction\"],\n comments=d[\"Comments\"]) for d in ... | [
"0.58173066",
"0.564686",
"0.5559516",
"0.5474356",
"0.54730994",
"0.5451101",
"0.5435742",
"0.54168653",
"0.54006207",
"0.53755003",
"0.53265005",
"0.5319712",
"0.52482605",
"0.52397454",
"0.52121884",
"0.5190898",
"0.5177625",
"0.5175006",
"0.5173243",
"0.5164659",
"0.51057... | 0.65476483 | 0 |
Activates unit's defend flag, should always target self. | def defend(user: "PlayerCharacter or Monster"):
user.defend = True
user.wait = int(0.4 * (100 - user.stats["SPEED"])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_meassuring(self):\n self.enabler = 0\n #self.t.join()\n return 1",
"def just_died(self):\r\n self.dead = True",
"def god_mode(self, activated: bool) -> None:\n if activated:\n self.invul_timer = -1\n else:\n self.invul_timer = 0",
"def s... | [
"0.55138063",
"0.5440154",
"0.5347898",
"0.5276121",
"0.52669114",
"0.5222278",
"0.5205768",
"0.5163716",
"0.51504934",
"0.51490664",
"0.5147046",
"0.5105611",
"0.5103238",
"0.5100884",
"0.5092517",
"0.50741035",
"0.50555116",
"0.5054823",
"0.50486934",
"0.50460553",
"0.50460... | 0.55215514 | 0 |
Expecting a list of the effect, e.g. ['BUFFSTRENGTH', 1.2, 200]. | def buff(effect: list, target: "PlayerCharacter or Monster"):
buffs = target.conditions.keys()
direction, stat = effect[0].split("-")
opp = f"{'BUFF' if direction == 'DEB' else 'DEB'}-{stat}"
if effect[0] in buffs:
if direction == "BUFF" and target.conditions[effect[0]][0] * target.conditions[ef... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_effects(self) -> List[List[str]]:\n return [\n [\n str(item.sample() if isinstance(item, RandomValue) else item)\n for item in effect\n ]\n for effect in self.effects\n ]",
"def getCustomEffects(self):\n builder = Immu... | [
"0.65278226",
"0.60402983",
"0.5976818",
"0.5966562",
"0.59634554",
"0.5916524",
"0.59094167",
"0.58687687",
"0.5836856",
"0.5817585",
"0.5760142",
"0.5743106",
"0.56658536",
"0.5665402",
"0.56483",
"0.56430405",
"0.557875",
"0.55686677",
"0.55373055",
"0.5520537",
"0.5515882... | 0.62014854 | 1 |
Expecting a string of a condition, e.g. 'POISON', to remove from target. Some special strings, e.g. 'DISPEL' or 'PANACEA' can remove multiple of a set category. | def remove(effect: str, target: "PlayerCharacter or Monster"):
if effect == "KO":
target.ko = False
target.hp = int(target.stats["MAXHP"] / 2)
return
if not target.conditions:
return
conditions = target.conditions.keys()
if effect == "PANACEA":
# Panacea removes a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_condition(self) -> None:\n url = self.base_url + \"/condition\"\n self._session.delete(url)",
"async def _remove_heist(self, ctx, *, target: str):\r\n author = ctx.message.author\r\n guild = ctx.guild\r\n targets = await self.thief.get_guild_targets(guild)\r\n ... | [
"0.6153798",
"0.5482997",
"0.53150386",
"0.5214969",
"0.5188982",
"0.51886535",
"0.5161211",
"0.51569647",
"0.51559436",
"0.5146684",
"0.5107516",
"0.5082376",
"0.50620043",
"0.505796",
"0.5010877",
"0.5004955",
"0.49556446",
"0.49497035",
"0.49272943",
"0.49202034",
"0.48755... | 0.6364273 | 0 |
Expecting an ailment list, e.g. ['POISON', 0.05, 200]. Attempts to afflict the target with the status ailment. | def inflict(ailment: list, target: "PlayerCharacter or Monster"):
name = ailment[0]
if name in target.resist.keys():
if random.random() > target.resist[name]:
return
if name in target.conditions.keys():
oldCon = target.conditions[name]
if name in ["POISON", "BURN"]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_enhancement(self):\n # Arrange - add statuses here\n expected_statuses = [[2, \"prone\", 1],\n [2, \"disorient\", 1]]\n ability_combos = [[\"disrupt\", \"block\"],\n [\"area\", \"disrupt\"]]\n\n # Act\n for expected_st... | [
"0.5580718",
"0.53406084",
"0.5254368",
"0.52517486",
"0.5248534",
"0.5245894",
"0.52242124",
"0.5213232",
"0.5158083",
"0.5116788",
"0.5116313",
"0.510078",
"0.50863266",
"0.50800335",
"0.5048133",
"0.5043284",
"0.49641985",
"0.4928494",
"0.4901182",
"0.4895583",
"0.4869063"... | 0.62217975 | 0 |
Expecting the monster's self.stats list. Calculates and returns how much exp that monster is worth. | def killEXP(monster: list):
exp = monster["BASEHP"] // 10
exp += monster["BASEMP"] // 5
for i in range(2, 7):
exp += monster[units.baseStatKeys[i]]
return exp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_damage(self) -> float:\n sum = 0\n for operator in self.__operators:\n if operator.is_alive:\n operator.experience += 1\n sum += operator.experience / 100\n return 0.1 + sum",
"def do_damage(self) -> float:\n res = 0.05 + self.experience... | [
"0.6910552",
"0.6680881",
"0.6631424",
"0.6215696",
"0.621005",
"0.6207718",
"0.6114893",
"0.6111858",
"0.6079187",
"0.60378027",
"0.6014889",
"0.5988091",
"0.5958137",
"0.59191394",
"0.59163505",
"0.5907045",
"0.58731204",
"0.5860413",
"0.5859899",
"0.5855023",
"0.5854918",
... | 0.7319627 | 0 |
Expecting the monster's item drop dict. Returns an item ref if the monster drops an item. | def dropItem(item_drop: dict):
roll = random.randint(1, 100)
if roll > 20:
return False
if roll == 1 and "UR" in item_drop.keys():
return item_drop["UR"]
if roll < 6 and "MR" in item_drop.keys():
return item_drop["MR"]
if roll < 11 and "R" in item_drop.keys():
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop(self, item):\n for obj in self.handler.player.inv:\n if obj.name == item.name:\n dropped = self.remove_from_inv(obj)\n\n # If we popped the item from player's inventory, we \n # can drop it directly. Else we need to copy it and\n ... | [
"0.6974118",
"0.6948584",
"0.67423064",
"0.66555494",
"0.66181594",
"0.6337264",
"0.63229305",
"0.6311242",
"0.628874",
"0.6257787",
"0.6216311",
"0.6119323",
"0.60778767",
"0.6067426",
"0.5967606",
"0.5950264",
"0.5925239",
"0.59251976",
"0.58608365",
"0.58309567",
"0.582046... | 0.7155507 | 0 |
Expecting the weapon's self.spec dict. Rolls to determine which, if any, special attacks should be used | def trySpec(weapon: dict):
roll = random.randint(1, 100)
if roll > 20:
return False
if roll == 1 and "UR" in weapon.keys():
return weapon["UR"]
if roll < 6 and "MR" in weapon.keys():
return weapon["MR"]
if roll < 11 and "R" in weapon.keys():
return weapon["R"]
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weapon(self, weapon):\n if weapon: \n self.weapon = weapon(self)\n #self.weapon.activate() #TEMP",
"def _handlespecials(self, secondary, typeset, abilitiesset, \n secondaryweapon):\n\n # Guided weapons must be distance weapons.\n GU... | [
"0.64276123",
"0.6374505",
"0.63393295",
"0.6299336",
"0.6164764",
"0.6157501",
"0.61381423",
"0.6121039",
"0.60806566",
"0.6075059",
"0.6069979",
"0.6048629",
"0.6034346",
"0.5974193",
"0.59336925",
"0.59190655",
"0.58991545",
"0.58898664",
"0.588699",
"0.58589965",
"0.58532... | 0.7139693 | 0 |
Open a system dialog for choosing a colour. Return the selected colour as a QColor object, or None if the dialog is cancelled. | def colorPickerDialog(self, current_color=None):
color_dialog = QtWidgets.QColorDialog()
#color_dialog.setOption(QtWidgets.QColorDialog.DontUseNativeDialog)
# Set current colour
if current_color is not None:
color_dialog.setCurrentColor(current_color)
# Only return a color if valid / dialog accepted
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickColour(self):\n colour = QColorDialog.getColor()\n if colour.isValid():\n self.user[\"Colour\"] = colour.name()\n self.ui.l_colour.setText(self.user[\"Colour\"])",
"def pickAColor():\n color = _tkCall(tkColorChooser.askcolor)\n if color[0] != None:\n retur... | [
"0.7425831",
"0.6945017",
"0.62512505",
"0.6204622",
"0.61691195",
"0.6165164",
"0.61514515",
"0.6104133",
"0.6060204",
"0.6009728",
"0.59957",
"0.5967789",
"0.5776022",
"0.5678996",
"0.5649177",
"0.5638914",
"0.5557844",
"0.5531525",
"0.5525794",
"0.5447134",
"0.5408778",
... | 0.7582679 | 0 |
Center the window on the current screen. | def center_window(self):
frame_geo = self.frameGeometry()
cursor_pos = QtWidgets.QApplication.desktop().cursor().pos()
screen = QtWidgets.QApplication.desktop().screenNumber(cursor_pos)
center_point = QtWidgets.QApplication.desktop().screenGeometry(screen).center()
frame_geo.moveCenter(center_point)
self.m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_on_screen(self):\n window_frame = self.frameGeometry()\n screen_center = QtGui.QDesktopWidget().availableGeometry().center()\n window_frame.moveCenter(screen_center)\n self.move(window_frame.topLeft())",
"def center(self):\n self.root.update_idletasks()\n w = ... | [
"0.87258446",
"0.8671595",
"0.8603072",
"0.85805285",
"0.85805285",
"0.852286",
"0.8503118",
"0.8481428",
"0.82244277",
"0.8035165",
"0.79204714",
"0.7771031",
"0.7755583",
"0.7736697",
"0.77219146",
"0.77219146",
"0.77176976",
"0.7675996",
"0.7657655",
"0.7648361",
"0.764195... | 0.86998767 | 1 |
Set up all the child widgets of the specified parent object. If 'forceCategory' is specified, this will override the category of all child widgets. 'inherit' specifies an alternative data source for widgets values. If 'storeProperties' is True, the values will be stored in the data file as well as applied to the widget... | def setupWidgets(self, parentObject,
forceCategory=None,
inherit=None,
storeProperties=True,
updateOnly=False):
if forceCategory is not None:
category = forceCategory
if updateOnly:
storeProperties = False
for widget in parentObject.findChildren(QtWidgets.QWidget):
# Enable expansion of cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial_attributes(self, input_data, parent, as_widget):\n self._set_default_attributes()\n\n self._parent = parent\n self._as_widget = as_widget\n\n self._is_group = input_data.get(\"is_group\", False)\n # TODO not implemented yet\n self._is_nullable = input_data.get(... | [
"0.5594508",
"0.544129",
"0.53790873",
"0.53782505",
"0.53669125",
"0.5351286",
"0.53373325",
"0.53041697",
"0.528644",
"0.5273489",
"0.52506375",
"0.52453506",
"0.5234581",
"0.52311957",
"0.5189471",
"0.5189471",
"0.5173967",
"0.517111",
"0.5169587",
"0.5166299",
"0.5166009"... | 0.8466797 | 0 |
Recursively disconnect all signals from widgets that are children of parentObject. | def disconnectAll(self, parentObject):
for widget in parentObject.findChildren(QtWidgets.QWidget):
if widget.property('xmlTag'):
try:
widget.disconnect()
# verbose.debug("Disconnect signals from %s" % widget.objectName())
except TypeError:
pass
# verbose.debug("No signals to disconnect ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect_signals(self, *args):\n children = self.children()\n Pair.disconnect_signals(self, *args)\n for child in children:\n child.disconnect_signals(*args)",
"def _disconnect_parent(self, *args, **kw):\n raise NotImplementedError(\"Abstract superclass\")",
"def di... | [
"0.69642967",
"0.6353447",
"0.60959053",
"0.5924287",
"0.5785385",
"0.5684559",
"0.5577873",
"0.5516222",
"0.551215",
"0.5508434",
"0.5507747",
"0.5485032",
"0.53618574",
"0.5361646",
"0.5284074",
"0.51745",
"0.51068556",
"0.51046145",
"0.5097282",
"0.5059269",
"0.50472367",
... | 0.86389893 | 0 |
Recursively check the parents of the given widget until a custom property 'xmlCategory' is found. | def findCategory(self, widget):
# print("widget: " + widget.objectName())
if widget.property('xmlCategory'):
#verbose.detail("Category '%s' found for '%s'." %(widget.property('xmlCategory'), widget.objectName()))
return widget.property('xmlCategory')
else:
# # Stop iterating if the widget's parent is the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_parents(tag):\n if not tag:\n return not actions_by_tag or all(\n getattr(a['action'], 'auto_select', False) for a in actions_by_tag.values()\n )\n\n try:\n parent = actions_by_tag.pop(tag)\n except KeyError:... | [
"0.5953429",
"0.5867013",
"0.5814703",
"0.57214177",
"0.5666154",
"0.55191326",
"0.5452358",
"0.5436136",
"0.5366335",
"0.53543293",
"0.5279587",
"0.5217868",
"0.51929593",
"0.5181406",
"0.5179429",
"0.51752347",
"0.51746327",
"0.51600385",
"0.50795794",
"0.5037999",
"0.50293... | 0.70183843 | 0 |
Add context menu item to widget. 'widget' should be a Push Button or Tool Button. 'name' is the text to be displayed in the menu. 'command' is the function to run when the item is triggered. 'icon' is a pixmap to use for the item's icon (optional). | def addContextMenu(self, widget, name, command, icon=None, tintNormal=True):
widget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
# Remove illegal characters from name
actionName = "action%s" % re.sub(r"[^\w]", "_", name)
action = QtWidgets.QAction(name, None)
if icon:
action.setIcon(self.iconSet(ico... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_menu_item(menu_item_name, menu_item_command='', parent_menu=None, icon='', **kwargs):\n\n pass",
"def add_sub_menu_item(menu_item_name, menu_item_command='', parent_menu=None, icon='', **kwargs):\n\n pass",
"def create_film_entry(self, film):\n self.list_menu.add_command(\n labe... | [
"0.6967878",
"0.6257109",
"0.6036262",
"0.59094816",
"0.5904926",
"0.5862478",
"0.5862024",
"0.5825232",
"0.57832843",
"0.5780456",
"0.57499933",
"0.571747",
"0.57066464",
"0.5701359",
"0.5661691",
"0.56607026",
"0.56461227",
"0.5638217",
"0.5636152",
"0.5633067",
"0.5633067"... | 0.75530493 | 0 |
Return a QIcon using the specified image. Generate tinted pixmaps for normal/disabled/active/selected states. | def iconSet(self, icon_name, tintNormal=True):
icon = QtGui.QIcon()
if isinstance(tintNormal, QtGui.QColor):
icon.addPixmap(
self.iconTint(icon_name, tint=tintNormal),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
elif tintNormal is False:
icon.addPixmap(
self.iconTint(icon_name),
QtGui.QIcon.Norm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iconTint(self, icon_name, tint=None):\n\t\t# search_locations = [\n\t\t# \t'icons', \n\t\t# \t# os.path.join(os.environ['IC_BASEDIR'], 'shared', 'icons'), \n\t\t# \t# os_wrapper.absolute_path('./icons')\n\t\t# ]\n\n\t\t# icon_path = self.checkFilePath(icon_name, searchpath=search_locations)\n\t\ticon_path = se... | [
"0.6845046",
"0.6006847",
"0.5897784",
"0.5895143",
"0.5803082",
"0.579009",
"0.57018906",
"0.54840654",
"0.54636383",
"0.54579437",
"0.54508877",
"0.54222775",
"0.53786516",
"0.52922136",
"0.5292091",
"0.52782273",
"0.5254826",
"0.5206264",
"0.5201213",
"0.51855725",
"0.5185... | 0.6353237 | 1 |
Return a QPixmap using the specified PNG or SVG image. If tint (QColor) is given, tint the image with the given color. | def iconTint(self, icon_name, tint=None):
# search_locations = [
# 'icons',
# # os.path.join(os.environ['IC_BASEDIR'], 'shared', 'icons'),
# # os_wrapper.absolute_path('./icons')
# ]
# icon_path = self.checkFilePath(icon_name, searchpath=search_locations)
icon_path = self.checkFilePath(
icon_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pixmap(value, size = QSize(16, 16)):\r\n return QIcon(value)",
"def color(value, size = QSize(16, 16)):\r\n pixmap = QPixmap(size)\r\n pixmap.fill(value)\r\n return QIcon(pixmap)",
"def img_to_pixmap(img, scale=1.0, code=\"rgb\"):\n if code.lower() == \"rgb\":\n img_fo... | [
"0.58348525",
"0.56607014",
"0.5565133",
"0.5478463",
"0.52229816",
"0.52090514",
"0.5125711",
"0.49815214",
"0.49473637",
"0.49337244",
"0.49203178",
"0.4869198",
"0.48618168",
"0.4782446",
"0.4736452",
"0.4678201",
"0.46136552",
"0.4555608",
"0.45217723",
"0.45095852",
"0.4... | 0.68485314 | 0 |
Show/hide all child widgets of 'parent_object' with specified custom property. Used to hide expert mode or experimental UI elements. | def toggleWidgets(self, custom_property, visibility, parent_object):
types = (
QtWidgets.QAction,
QtWidgets.QCheckBox,
QtWidgets.QComboBox,
QtWidgets.QFrame,
QtWidgets.QLineEdit,
QtWidgets.QMenu,
QtWidgets.QMenuBar,
QtWidgets.QPushButton,
QtWidgets.QToolButton,
)
try:
for i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupWidgets(self, parentObject, \n\t\tforceCategory=None, \n\t\tinherit=None, \n\t\tstoreProperties=True, \n\t\tupdateOnly=False):\n\t\tif forceCategory is not None:\n\t\t\tcategory = forceCategory\n\n\t\tif updateOnly:\n\t\t\tstoreProperties = False\n\n\t\tfor widget in parentObject.findChildren(QtWidgets.QW... | [
"0.5967938",
"0.5421149",
"0.5365888",
"0.5063651",
"0.50371",
"0.4976267",
"0.48659635",
"0.4826195",
"0.4791133",
"0.4754812",
"0.4738836",
"0.47056928",
"0.4702539",
"0.47020254",
"0.47000954",
"0.46751878",
"0.4673127",
"0.46685588",
"0.46393448",
"0.46173576",
"0.4606221... | 0.7642574 | 0 |
Conform the widths of all labels in formLayouts under the specified parentObject for a more coherent appearance. 'padding' is an amount in pixels to add to the max width. | def conformFormLayoutLabels(self, parentObject, padding=8):
labels = []
labelWidths = []
# Find all labels in form layouts
for layout in parentObject.findChildren(QtWidgets.QFormLayout):
# print(layout.objectName())
items = (layout.itemAt(i) for i in range(layout.count()))
for item in items:
widge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_width(self):\n current_longest = 0\n\n for i in range(len(self.list_of_motif_objects)):\n current_object = self.list_of_motif_objects[i]\n if(len(current_object.sequence) > current_longest):\n current_longest = len(current_object.sequence)\n \n ... | [
"0.59803253",
"0.5770539",
"0.570559",
"0.56702816",
"0.5500932",
"0.54771763",
"0.542907",
"0.5418258",
"0.536105",
"0.52585846",
"0.5253409",
"0.5209071",
"0.51085824",
"0.50071883",
"0.5002347",
"0.49678448",
"0.49140644",
"0.48768783",
"0.48632807",
"0.4860563",
"0.482531... | 0.7816193 | 0 |
Enable/disable a field in a form layout including its label. | def toggleFormField(self, parentObject, field, enabled):
layout = parentObject.findChildren(QtWidgets.QFormLayout)[0]
label = layout.labelForField(field)
field.setEnabled(enabled)
label.setEnabled(enabled) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_varEnable(self, item):\n state = item.wdgEnabled.isChecked()\n item.wdgLabel.setEnabled(state)\n item.wdgType.setEnabled(state)\n item.wdgValue.setEnabled(state)\n item.wdgComment.setEnabled(state)",
"def set_enabled(self, enabled):\n self.widget.setEnabled(enable... | [
"0.5784215",
"0.5552554",
"0.5552554",
"0.53906685",
"0.5367584",
"0.5297594",
"0.52953064",
"0.5278534",
"0.52677625",
"0.5229474",
"0.521342",
"0.5205969",
"0.5205956",
"0.5166438",
"0.515508",
"0.515508",
"0.51396155",
"0.51117265",
"0.5106393",
"0.5103404",
"0.5096328",
... | 0.77332854 | 0 |
Hide a field in a form layout including its label, and close up the remaining empty space. | def hideFormField(self, parentObject, field):
layout = parentObject.findChildren(QtWidgets.QFormLayout)[0]
label = layout.labelForField(field)
field.hide()
label.hide()
layout.removeWidget(field)
layout.removeWidget(label)
parentObject.toggled.emit(True) # Force refresh | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide(self):\n self.row_box.grid_remove()\n self.field_name_box.grid_remove()\n self.field_name_label.grid_remove()\n self.value_box.grid_remove()\n self.active_value_widget.grid_remove()",
"def fl_hide_form(ptr_flform):\n _fl_hide_form = library.cfuncproto(\n libr... | [
"0.6773907",
"0.6559793",
"0.63991934",
"0.62088025",
"0.6111825",
"0.6109275",
"0.60713613",
"0.60117453",
"0.5940624",
"0.5915313",
"0.58339757",
"0.58190274",
"0.5812206",
"0.58109576",
"0.57996345",
"0.56632745",
"0.5635015",
"0.56205773",
"0.5590556",
"0.55619985",
"0.55... | 0.8228786 | 0 |
Get the value from a checkbox and return a Boolean value. | def getCheckBoxValue(self, checkBox):
if checkBox.checkState() == QtCore.Qt.Checked:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n return bool(self._chb_bool.isChecked())",
"def value(self):\n if self.isCheckable():\n return self.isChecked()\n else:\n return None",
"def bool_value(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"bool_value\")",
"d... | [
"0.8027936",
"0.7166625",
"0.71054965",
"0.7021149",
"0.69368804",
"0.67867684",
"0.6773672",
"0.6773071",
"0.6773071",
"0.6762885",
"0.6751687",
"0.67504865",
"0.6741686",
"0.6717421",
"0.6657894",
"0.66328704",
"0.66315466",
"0.6626259",
"0.6624485",
"0.6623616",
"0.6621799... | 0.8223485 | 0 |
Get custom attribute value and category from UI widget. | def getWidgetMeta(self, widget):
if widget.property('oldToolTip'): # Revert to old tooltip
widget.setToolTip(widget.property('oldToolTip'))
self.setDynamicProperty(widget, 'inheritedValue', False)
category = widget.property('xmlCategory')
attr = widget.property('xmlTag')
return category, attr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n attr = getattr(self.obj, self.attr)\n try:\n args = self.args\n kwargs = self.kwargs\n return attr(*args, **kwargs)\n except AttributeError:\n return attr",
"def getValue(self, *args):\n ret... | [
"0.60275024",
"0.59894997",
"0.5956576",
"0.5877106",
"0.57819265",
"0.57288766",
"0.56543636",
"0.56434387",
"0.5635125",
"0.5628441",
"0.56198794",
"0.5580907",
"0.55805373",
"0.55656874",
"0.55445874",
"0.54789126",
"0.5477597",
"0.5445614",
"0.5441389",
"0.5439698",
"0.54... | 0.61781096 | 0 |
Set a dymanic property for a widget, and redraw it. | def setDynamicProperty(self, widget, property_name, property_value):
widget.setProperty(property_name, property_value)
widget.style().unpolish(widget)
widget.style().polish(widget) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def XPSetWidgetProperty(inWidget, inProperty, inValue):\n pass",
"def setWidgetProperty(self, QWidget, p_str, Any): # real signature unknown; restored from __doc__\n pass",
"def visual_attr_changed(self):\n if self.component:\n self.component.invalidate_draw()\n self.comp... | [
"0.7408302",
"0.67223257",
"0.6156915",
"0.5712572",
"0.57029915",
"0.5430552",
"0.54269105",
"0.53976256",
"0.5369408",
"0.5319285",
"0.5303163",
"0.52930105",
"0.5255284",
"0.5238834",
"0.5225603",
"0.5225412",
"0.5198895",
"0.519858",
"0.5163439",
"0.5141784",
"0.51400787"... | 0.74651456 | 0 |
Get the value from a Slider and store in data. | def storeSliderValue(self):
category, attr = self.getWidgetMeta(self.sender())
value = self.sender().value()
self.storeValue(category, attr, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self):\n return self.slide.value",
"def value(self) -> Dict[str, int]:\n return {dim: self.controls[dim]['slider'].value for dim in self._slider_dims}",
"def get_value(self, data):\n value = data['value']\n return value",
"def _getValueForLevelSlider(self):\n item... | [
"0.7036385",
"0.66255456",
"0.64566255",
"0.6421301",
"0.6081605",
"0.5955591",
"0.5888643",
"0.5828732",
"0.57965595",
"0.5754196",
"0.57261604",
"0.56807625",
"0.56424755",
"0.5626784",
"0.56182015",
"0.56182015",
"0.56182015",
"0.55891883",
"0.5561355",
"0.55046266",
"0.54... | 0.7452505 | 0 |
Get the value from a Spin Box and store in data. | def storeSpinBoxValue(self):
category, attr = self.getWidgetMeta(self.sender())
value = self.sender().value()
self.storeValue(category, attr, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bufferValue(self):\n return self.bufferSpinBox.value()",
"def get_value(self, data):\n value = data['value']\n return value",
"def get_value(self):\n if self.notebook:\n return self.widget.value\n else:\n if hasattr(self.widget, \"value\"):\n ... | [
"0.64001393",
"0.6261679",
"0.6122907",
"0.6099712",
"0.6084269",
"0.59787565",
"0.5942433",
"0.593572",
"0.5924949",
"0.5924949",
"0.5886008",
"0.5883557",
"0.58621085",
"0.58573514",
"0.58302796",
"0.579446",
"0.57863635",
"0.5782116",
"0.57555753",
"0.5741194",
"0.5707088"... | 0.70970565 | 0 |
Get the value from a Line Edit and store in data. | def storeLineEditValue(self):
category, attr = self.getWidgetMeta(self.sender())
value = self.sender().text()
self.storeValue(category, attr, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_data(self, document, line):\n index = self.resolve_ref(document)\n return line[index]",
"def process_line(self, line, data):\n return data",
"def get(self):\n\t\t\n\t\treturn self.line",
"def __call__( self, line ):\n return self.__getitem__( line )",
"def __call__( se... | [
"0.6314708",
"0.6155624",
"0.6132941",
"0.58937776",
"0.58937776",
"0.58932805",
"0.5767757",
"0.5740816",
"0.5717864",
"0.5666226",
"0.5649833",
"0.5643059",
"0.56369096",
"0.56369096",
"0.56369096",
"0.56369096",
"0.5613946",
"0.5563627",
"0.5536441",
"0.5535885",
"0.547030... | 0.664491 | 0 |
Get the value from a Plain Text Edit and store in data. | def storeTextEditValue(self):
category, attr = self.getWidgetMeta(self.sender())
value = self.sender().toPlainText()
self.storeValue(category, attr, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_input():\r\n inputValue = simpleText.get(\"1.0\",\"end-1c\") #Our Variable\r\n #\"1.0\" = start from first character in the text widget\r\n #\"end-1c = delete the last character that Text creates every time\"\r\n return inputValue",
"def edit_text(self, _, val):\n t_edit = text_ed... | [
"0.6902486",
"0.6862514",
"0.68175834",
"0.6666223",
"0.65148956",
"0.65148956",
"0.65148956",
"0.65148956",
"0.65148956",
"0.6486302",
"0.6486302",
"0.6280115",
"0.62090766",
"0.6197498",
"0.61786073",
"0.6173476",
"0.6164617",
"0.61644745",
"0.6139015",
"0.612358",
"0.61155... | 0.7488133 | 0 |
Get the value from a Check Box and store in data. | def storeCheckBoxValue(self):
category, attr = self.getWidgetMeta(self.sender())
value = self.getCheckBoxValue(self.sender())
self.storeValue(category, attr, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCheckBoxValue(self, checkBox):\n\n\t\tif checkBox.checkState() == QtCore.Qt.Checked:\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def value(self):\n if self.isCheckable():\n return self.isChecked()\n else:\n return None",
"def value(self):\n if self._ch... | [
"0.709962",
"0.6728621",
"0.6683852",
"0.66117716",
"0.6521225",
"0.6446104",
"0.61112016",
"0.59719586",
"0.5961124",
"0.59272355",
"0.5750595",
"0.5719204",
"0.571828",
"0.5686253",
"0.5682758",
"0.5681296",
"0.5653924",
"0.55987996",
"0.55938613",
"0.5589241",
"0.55043656"... | 0.71863514 | 0 |
Get the value from a Radio Button group and store in data. | def storeRadioButtonValue(self):
if self.sender().isChecked():
category, attr = self.getWidgetMeta(self.sender())
value = self.sender().text()
self.storeValue(category, attr, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radiobutton_check(self):\n if self.radioButton_name.isChecked():\n return 1\n elif self.radioButton_desc.isChecked():\n return 2\n elif self.radioButton_cost.isChecked():\n return 3\n elif self.radioButton_cat.isChecked():\n return 4",
"... | [
"0.6036121",
"0.6011997",
"0.59453064",
"0.58702993",
"0.5860024",
"0.58521646",
"0.57526803",
"0.57359624",
"0.5671006",
"0.5646048",
"0.5612925",
"0.5532944",
"0.55297136",
"0.5521548",
"0.5502939",
"0.5465986",
"0.5451106",
"0.53919333",
"0.53703535",
"0.5317412",
"0.53058... | 0.73748386 | 0 |
Get the values from a List Widget as a list and store in data. | def storeListWidgetValues(self):
widget = self.sender()
category, attr = self.getWidgetMeta(widget)
items = []
for i in range(widget.count()):
items.append(widget.item(i).text())
self.storeValue(category, attr, items) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_list(self):\n return list(self.widget_dict.values())",
"def _datalist(self, r, widget, **attr):\n\n T = current.T\n\n widget_get = widget.get\n\n context = widget_get(\"context\")\n tablename = widget_get(\"tablename\")\n resource, context = self._resolve_contex... | [
"0.70881367",
"0.6405289",
"0.6354036",
"0.6308613",
"0.62124586",
"0.618186",
"0.6148241",
"0.61190087",
"0.61058956",
"0.6093558",
"0.6053504",
"0.6035397",
"0.5981706",
"0.5981706",
"0.5851534",
"0.5805536",
"0.580179",
"0.580179",
"0.57939804",
"0.57897204",
"0.57882303",... | 0.78809685 | 0 |
Toggle expansion of custom rollout group box control. | def toggleExpandGroup(self):
groupBox = self.sender()
state = groupBox.isChecked()
if state:
groupBox.setFixedHeight(groupBox.sizeHint().height())
else:
groupBox.setFixedHeight(20) # Slightly hacky - needs to match value defined in QSS
#self.setFixedHeight(self.sizeHint().height()) # Resize window | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setExpanded(self):",
"def expand_or_collapse(control_instance, resize_button):\n # Hide the control\n if control_instance.isVisible():\n state = False\n # Show the control\n else:\n state = True\n ControllerControlWidget.set_expanded(control_instance, ... | [
"0.68091094",
"0.6638006",
"0.64849424",
"0.6441845",
"0.6057127",
"0.6048421",
"0.5995649",
"0.59357995",
"0.5822293",
"0.57174206",
"0.56969154",
"0.5559707",
"0.5509485",
"0.5489128",
"0.54855984",
"0.54792",
"0.5452104",
"0.5446294",
"0.5403267",
"0.5399768",
"0.53916436"... | 0.78932035 | 0 |
Use a list (contents) to populate a combo box. If 'replace' is true, the existing items will be replaced, otherwise the contents will be appended to the existing items. | def populateComboBox(self, comboBox, contents,
replace=True,
addEmptyItems=False,
setSelected=None,
blockSignals=False):
if blockSignals:
comboBox.blockSignals(True)
# Store current value
if setSelected is None:
current = comboBox.currentText()
else:
current = setSelected
# Clear menu
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(items: [str], value: int, wrap: int = 0) -> 'ComboBox':\n model = Gtk.ListStore(str)\n for item in items:\n model.append([item])\n\n return ComboBox(\n model=model, value=value, wrap=wrap\n )",
"def set_model_from_list (self,cb, items):\n model = g... | [
"0.6191179",
"0.5846165",
"0.57101",
"0.564354",
"0.564354",
"0.56315106",
"0.5573239",
"0.55457836",
"0.5483648",
"0.52821875",
"0.5254418",
"0.5254059",
"0.524777",
"0.52382255",
"0.5198388",
"0.51359874",
"0.51331353",
"0.5094389",
"0.5073793",
"0.5072189",
"0.50651324",
... | 0.7730944 | 0 |
Check if 'filename' exists. If not, search through list of folders given in the optional searchpath, then check in the current dir. | def checkFilePath(self, filename, searchpath=[]):
if filename is None:
return None
elif os.path.isfile(filename):
return filename
else:
# Append current dir to searchpath and try each in turn
searchpath.append(os.path.dirname(__file__))
# print(searchpath)
for folder in searchpath:
filepath ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_file(filename, search_path):\n file_path = None\n for path in search_path:\n if exists(join(path, filename)):\n file_path = path\n break\n if file_path:\n return abspath(join(file_path, filename))\n return None",
"def search_file(filename, search_path, p... | [
"0.7304896",
"0.7091984",
"0.7091984",
"0.7041523",
"0.6649554",
"0.6563836",
"0.6501359",
"0.6491952",
"0.64215124",
"0.63543",
"0.6288994",
"0.62800467",
"0.6262143",
"0.62411946",
"0.6238788",
"0.62053066",
"0.6201028",
"0.61980885",
"0.61586714",
"0.6150957",
"0.60949785"... | 0.794087 | 0 |
Cycle through default Qt styles. | def cycleStyles(self):
print(QtWidgets.QStyleFactory.keys())
self.unloadStyleSheet()
try:
style = next(self.styles)
except (AttributeError, NameError, StopIteration):
self.styles = iter(QtWidgets.QStyleFactory.keys())
style = next(self.styles)
# self.setStyle(style)
QtWidgets.QApplication.setStyl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appstyle(whom, stylename = 'Plastique',stylecolor = 'Default'):\r\n\r\n## for iz in QtGui.QStyleFactory.keys():\r\n## print iz\r\n\r\n QtGui.QApplication.setStyle(QtGui.QStyleFactory.create(stylename))\r\n QtGui.QApplication.setPalette(QtGui.QApplication.style().standardPalette())\r\n ... | [
"0.6726351",
"0.6666133",
"0.6487041",
"0.64804965",
"0.64274204",
"0.64240915",
"0.6312172",
"0.62395924",
"0.6190676",
"0.6162593",
"0.6154836",
"0.6112971",
"0.60972816",
"0.60526013",
"0.60214776",
"0.5987104",
"0.5970696",
"0.59705544",
"0.59598625",
"0.594314",
"0.59412... | 0.82939917 | 0 |
Write stylesheet and bake tokens for compatibility. | def saveStyleSheet(self, output_name='style_out.qss'):
stylesheet = self.loadStyleSheet()
with open(output_name, 'w') as fh:
fh.write("/* Generated by uistyle */\n")
fh.write(stylesheet) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self):\n f=open(\"{}/{}.html\".format(self.path,self.name),\"w\")\n f.write(\"<html>\\n <head>\\n\")\n for c in self.css:\n f.write(\" <link rel=\\\"Stylesheet\\\" href=\\\"{}\\\" />\\n\".format(c))\n f.write(\" </head>\\n</body>\\n\")\n for line in self.te... | [
"0.63087773",
"0.57226884",
"0.5469194",
"0.5463879",
"0.5447704",
"0.5446116",
"0.53708696",
"0.5331819",
"0.5312938",
"0.53012496",
"0.52988684",
"0.5294888",
"0.5266226",
"0.5217447",
"0.5213593",
"0.521237",
"0.5200357",
"0.5200357",
"0.5193637",
"0.51331925",
"0.5118206"... | 0.5981505 | 1 |
Offset input_color by a given amount. Only works in greyscale. | def offsetColor(self, input_color, amount, clamp=None):
if amount == 0: # Do nothing
return input_color
elif amount > 0: # Lighten
if clamp is None:
min_clamp = 0
else:
min_clamp = clamp
max_clamp = 255
elif amount < 0: # Darken
min_clamp = 0
if clamp is None:
max_clamp = 255
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_pixels(self, image, color):\r\n\r\n image[self.ally, self.allx] = color\r\n return image",
"def intermediate_pixel(alpha, source_RGB, target_RGB):\n return int((1-alpha)*source_RGB+alpha*target_RGB)",
"def change_brightness(img,k=0):\n\n img_copy = np.copy(img)\n img_copy = img... | [
"0.591031",
"0.5626809",
"0.555436",
"0.5470534",
"0.5421418",
"0.54113615",
"0.5338897",
"0.5337743",
"0.5334994",
"0.5331781",
"0.5327686",
"0.5326694",
"0.53204226",
"0.5290276",
"0.5271699",
"0.52711916",
"0.525832",
"0.5237451",
"0.5225475",
"0.51933134",
"0.5192302",
... | 0.73172605 | 0 |
Compute complementary UI colours based on window colour. | def computeUIPalette(self):
# self.col['group-bg'] = QtGui.QColor(128, 128, 128)
self.col['line'] = self.col['window'].darker(110)
self.col['tooltip'] = QtGui.QColor(255, 255, 221)
self.col['mandatory'] = QtGui.QColor(252, 152, 103)
self.col['warning'] = QtGui.QColor(255, 216, 106)
self.col['inherited'] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complementary(R, G, B):\r\n RGB = [(R/255), (G/255), (B/255)]\r\n HLS = colorsys.rgb_to_hls(RGB[0], RGB[1], RGB[2])\r\n HLS = [((HLS[0] + 0.5) % 1), HLS[1], HLS[2]]\r\n RGB = colorsys.hls_to_rgb(HLS[0], HLS[1], HLS[2])\r\n return RGB255(RGB)",
"def conseguir_color(self):\n return self.p... | [
"0.61317915",
"0.60703456",
"0.6048891",
"0.58328366",
"0.5807412",
"0.5744642",
"0.5730595",
"0.56923336",
"0.5692175",
"0.5622295",
"0.55945915",
"0.55860996",
"0.55730146",
"0.5530362",
"0.5491008",
"0.54784244",
"0.54759985",
"0.5437265",
"0.54337126",
"0.54307526",
"0.54... | 0.65993977 | 0 |
Store window geometry and state. (Save state may cause issues with PyQt5) | def storeWindow(self):
if self.store_window_geometry:
try:
self.settings.setValue("geometry", self.saveGeometry())
# verbose.detail("Storing window geometry for '%s'." %self.objectName())
except:
# verbose.warning("Could not store window geometry for '%s'." % self.objectName())
print("Could not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self, _settings = None):\n settings = _settings or {}\n settings['window_type'] = 'ImageWindow'\n settings['actionPlotSettings'] = self.actionPlotSettings.isChecked()\n # Disabled QLineEdits are confusing to QSettings. Store a dummy _\n settings['x_label'] = \"_\" +... | [
"0.67792684",
"0.6288603",
"0.61958265",
"0.61796796",
"0.61766005",
"0.61167824",
"0.60285133",
"0.597872",
"0.5948835",
"0.59442574",
"0.5927695",
"0.5884485",
"0.5855856",
"0.5813393",
"0.5797729",
"0.5784905",
"0.5754482",
"0.57113075",
"0.56808996",
"0.5666135",
"0.56362... | 0.7542007 | 0 |
Restore and apply saved state of a widget. | def restoreWidgetState(self, widget, storage_attr):
try:
widget.restoreState(self.settings.value(storage_attr)) #.toByteArray())
except (AttributeError, TypeError):
# verbose.warning("Could not restore widget state for '%s'." % widget.objectName())
print("Could not restore widget state for '%s'." % widget... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, memento):\n self.state = memento.state",
"def restore_state(self, ckpt):\n raise NotImplemented()",
"def restoreGUI(self):\n\n global DATA_DIRECTORY\n\n try:\n self.settings = QtCore.QSettings(\"./settings.ini\", \n ... | [
"0.64873886",
"0.6274565",
"0.6251063",
"0.62070185",
"0.61743635",
"0.61163753",
"0.6070182",
"0.604041",
"0.6009758",
"0.6007531",
"0.5964222",
"0.59375113",
"0.5909593",
"0.5908604",
"0.5868397",
"0.58475214",
"0.5732369",
"0.5732364",
"0.57250905",
"0.5721234",
"0.5681505... | 0.76919544 | 0 |
Return specified app's main window instance. We need this in order for our Qt dialogs to be correctly parented as a subwindow. For apps that don't use Qt for their UI, various hacks may need to be deployed... | def _main_window(app=HOST):
if app in ['standalone', 'generic']:
return None
# Blender (not Qt)
# Requires bqt - see https://github.com/techartorg/bqt
elif app == 'blender':
obj = QtWidgets.QApplication.instance().blender_widget
if obj:
return obj
# Clarisse (not Qt)
# elif app == 'clarisse':
# for o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_window():\n # case: Maya\n if pkgutil.find_loader(\"maya\"):\n for obj in QtWidgets.QApplication.topLevelWidgets():\n if obj.objectName() == \"MayaWindow\":\n return obj\n\n # case: Houdini\n if pkgutil.find_loader(\"hou\"):\n module = importlib.import_m... | [
"0.81392723",
"0.8023601",
"0.8005372",
"0.7900502",
"0.770894",
"0.7697409",
"0.7697409",
"0.7697409",
"0.7661753",
"0.7656008",
"0.76174015",
"0.761251",
"0.7562426",
"0.7562426",
"0.7538503",
"0.74310714",
"0.73967475",
"0.73899364",
"0.7374749",
"0.72272354",
"0.7142622",... | 0.8647699 | 0 |
Delete existing UI in Maya. | def _maya_delete_ui(window_object, window_title):
if mc.window(window_object, query=True, exists=True):
mc.deleteUI(window_object) # Delete window
if mc.dockControl('MayaWindow|' + window_title, query=True, exists=True):
mc.deleteUI('MayaWindow|' + window_title) # Delete docked window | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_ui(clientData):\n try:\n try:\n mel.eval(\"\"\"deleteUI -layout('AzureBatch')\"\"\")\n except:\n print(\"Couldn't delete shelf\")\n melPath = get_usershelf_dir()\n if os.path.exists(\"{0}.deleted\".format(melPath)):\n os.remove(\"{0}.delete... | [
"0.70988345",
"0.68400383",
"0.6681265",
"0.6671666",
"0.63769054",
"0.63208055",
"0.63206506",
"0.6253862",
"0.6247045",
"0.6200277",
"0.61195236",
"0.60937876",
"0.6079136",
"0.60781026",
"0.60317856",
"0.60226667",
"0.6022441",
"0.5983663",
"0.5976753",
"0.59761107",
"0.59... | 0.7106565 | 0 |
Remove Nuke margins when docked UI. | def _nuke_set_zero_margins(widget_object):
parentApp = QtWidgets.QApplication.allWidgets()
parentWidgetList = []
for parent in parentApp:
for child in parent.children():
if widget_object.__class__.__name__ == child.__class__.__name__:
parentWidgetList.append(parent.parentWidget())
parentWidgetList.appen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OnPaneDocked(self, event):\r\n\r\n event.Skip()\r\n self.RemoveAutoNBCaption(event.GetPane())",
"def cleanWorkspace(self):\n self.window.labelMessage.setText(\"\")\n\n if self.inspectinoAnalyzer:\n del self.analyzerWidget\n self.inspectinoAnalyzer = False\n\n... | [
"0.6073839",
"0.5995123",
"0.59102553",
"0.5874626",
"0.5874626",
"0.5741936",
"0.57371193",
"0.57026803",
"0.56851685",
"0.5630102",
"0.5611886",
"0.5606407",
"0.5593676",
"0.55867904",
"0.5570858",
"0.55336446",
"0.5526815",
"0.5496645",
"0.54787254",
"0.54783994",
"0.54762... | 0.6459585 | 0 |
Average pooling of size p. Should be a power of 2. | def apool1(x, p):
if p > 1:
x = tf.expand_dims(x, 3) # N x M x F x 1
x = tf.nn.avg_pool(x, ksize=[1, p, 1, 1], strides=[1, p, 1, 1], padding='SAME')
return tf.squeeze(x, [3]) # N x M/p x F
else:
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avg_pool(x,\n k_h,\n k_w,\n s_h,\n s_w,\n name,\n padding=\"VALID\"):\n with tf.name_scope(name):\n outputs = tf.nn.avg_pool(x, [1, k_h, k_w, 1], [1, s_h, s_w, 1], padding)\n # Return la... | [
"0.69068843",
"0.687785",
"0.68682957",
"0.6866358",
"0.6779908",
"0.67445505",
"0.6714744",
"0.6678968",
"0.6664767",
"0.6639879",
"0.6603369",
"0.6600572",
"0.65850216",
"0.6563893",
"0.65428364",
"0.6467358",
"0.64582944",
"0.63845193",
"0.6337523",
"0.6307567",
"0.6306172... | 0.7230823 | 0 |
create a page instance from another | def from_page(cls, page_instance):
obj = cls()
obj._doc = page_instance._doc.copy()
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreatePage(url1: str) -> Page:\n page = Page(\n name=url1,\n queried=1,\n )\n db.session.add(page)\n db.session.commit()\n return page",
"def create_page(self):",
"def create_page_from_import(request, parent_page, page_class, parsed_doc):\n\n page = page_class.create_from_im... | [
"0.72341484",
"0.7163369",
"0.64551",
"0.6115802",
"0.6011382",
"0.5979805",
"0.5975562",
"0.59659153",
"0.59512264",
"0.5935508",
"0.5901582",
"0.58957",
"0.5895289",
"0.58872515",
"0.5825123",
"0.58114475",
"0.57941526",
"0.5783197",
"0.5772473",
"0.57405704",
"0.5710927",
... | 0.72146493 | 1 |
returns the number of seconds until limit reset | def until_reset(self) -> int:
return int((self.resets_at - datetime.now()).total_seconds()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remaining_ms():",
"def time_limit(self) -> float:\n return self._time_limit",
"def get_limit_per_second(self):\n pass",
"def reset_timeout(self) -> float:\n return self._reset_timeout",
"def get_timeout(self) -> int:",
"def seconds_remaining(self):\n pass",
"def timelimi... | [
"0.70629257",
"0.7007025",
"0.68762004",
"0.68710625",
"0.6867395",
"0.66794866",
"0.6666759",
"0.66243833",
"0.6611497",
"0.64646846",
"0.6442244",
"0.6429749",
"0.6390939",
"0.6371645",
"0.63413",
"0.6333298",
"0.63317204",
"0.62809944",
"0.6259266",
"0.6241424",
"0.6240039... | 0.74248374 | 0 |
returns the number of seconds until the cache expires, and we need an update | def until_cache_expire(self):
return int(
(self.collected_at + timedelta(minutes=5) - datetime.now()).total_seconds()
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scm_update_cache_timeout(self):\n return self._data.get('scm_update_cache_timeout')",
"def age(self, url):\r\n cached_object = self.translate_url(url)\r\n if not os.path.exists(cached_object):\r\n return None\r\n return self._clock.time() - os.path.getmtime(cached_object)",
"def get_ca... | [
"0.73253214",
"0.7247889",
"0.7196211",
"0.7107992",
"0.67938554",
"0.6652799",
"0.6588728",
"0.6559363",
"0.65300184",
"0.6512823",
"0.64457995",
"0.63671434",
"0.63650775",
"0.63548666",
"0.63540363",
"0.63508934",
"0.6347668",
"0.6314201",
"0.630472",
"0.6299231",
"0.62730... | 0.7551717 | 0 |
returns the number of calls remaining in your usage limits for the day | def calls_remaining(self) -> int:
return self.usage_limit - self.current_usage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calls_used(self) -> float:\n return self.current_usage / self.usage_limit",
"def remaining_requests(self):\n try:\n return self._get_limit('Remaining')\n except ValueError:\n logging.error(\n \"Unable to gather limit statistics until log() has been ca... | [
"0.73162764",
"0.70626616",
"0.6760203",
"0.6723958",
"0.6487013",
"0.64482045",
"0.637971",
"0.63587546",
"0.6310496",
"0.62909555",
"0.6280111",
"0.6266624",
"0.62492204",
"0.6224761",
"0.62165433",
"0.6212166",
"0.6194484",
"0.61340326",
"0.60821337",
"0.60524267",
"0.5946... | 0.8139248 | 0 |
returns the percentage of all calls used | def calls_used(self) -> float:
return self.current_usage / self.usage_limit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percentage(count, total):\n return count / total * 100",
"def usage_percent(used, total, _round=None):\r\n try:\r\n ret = (used / total) * 100\r\n except ZeroDivisionError:\r\n ret = 0\r\n if _round is not None:\r\n return round(ret, _round)\r\n else:\r\n return ret... | [
"0.7067829",
"0.7061272",
"0.68554735",
"0.68301016",
"0.66401154",
"0.6622746",
"0.6575144",
"0.6551467",
"0.6527051",
"0.652185",
"0.6516043",
"0.64715195",
"0.64539385",
"0.64149326",
"0.63872886",
"0.6380181",
"0.6373902",
"0.6372278",
"0.636119",
"0.636119",
"0.6359986",... | 0.7653098 | 0 |
returns a hubspot3 base client | def _base(self):
from hubspot3.base import BaseClient
return BaseClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client():\n return Client(__address, authkey='strumamor')",
"def base_client(self):\n return self._client",
"def client():\n\n client = Client()\n return client",
"def client():\n return IceCubedSyncClient(\"api_key\", \"secret\")",
"def get_client():\n return storage.Client(p... | [
"0.750117",
"0.71626765",
"0.689884",
"0.6896267",
"0.67154324",
"0.67111295",
"0.66781133",
"0.6635615",
"0.6603573",
"0.65694636",
"0.6548077",
"0.6544531",
"0.6541952",
"0.64524424",
"0.6441788",
"0.64416265",
"0.64416265",
"0.64347655",
"0.6420325",
"0.6419825",
"0.639358... | 0.8420264 | 0 |
returns a hubspot3 blog client | def blog(self):
from hubspot3.blog import BlogClient
return BlogClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blog_comments(self):\n from hubspot3.blog import BlogCommentsClient\n\n return BlogCommentsClient(**self.auth, **self.options)",
"def blog_topics(self):\n from hubspot3.blog import BlogTopicsClient\n\n return BlogTopicsClient(**self.auth, **self.options)",
"def get_blog(self, bl... | [
"0.7001584",
"0.6709397",
"0.62590456",
"0.6044197",
"0.5964617",
"0.58896035",
"0.5807066",
"0.570223",
"0.56922257",
"0.5691143",
"0.56436855",
"0.55845594",
"0.55680496",
"0.5520405",
"0.55018157",
"0.5481171",
"0.5476077",
"0.5459264",
"0.54452217",
"0.5440787",
"0.541579... | 0.8362834 | 0 |
returns a hubspot3 blog comments client | def blog_comments(self):
from hubspot3.blog import BlogCommentsClient
return BlogCommentsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blog(self):\n from hubspot3.blog import BlogClient\n\n return BlogClient(**self.auth, **self.options)",
"def blog_topics(self):\n from hubspot3.blog import BlogTopicsClient\n\n return BlogTopicsClient(**self.auth, **self.options)",
"def get_comments(self):\n\t\tself.comments = g... | [
"0.738285",
"0.60764277",
"0.6057724",
"0.60020655",
"0.60020655",
"0.60020655",
"0.5927379",
"0.5921807",
"0.5862062",
"0.57210535",
"0.57141197",
"0.56816345",
"0.5668008",
"0.5658672",
"0.5658672",
"0.5658672",
"0.5656611",
"0.56404436",
"0.563752",
"0.56279474",
"0.562285... | 0.85652447 | 0 |
returns a hubspot3 blog topics client | def blog_topics(self):
from hubspot3.blog import BlogTopicsClient
return BlogTopicsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blog(self):\n from hubspot3.blog import BlogClient\n\n return BlogClient(**self.auth, **self.options)",
"def topics(self):\r\n return Topics(self)",
"def blog_comments(self):\n from hubspot3.blog import BlogCommentsClient\n\n return BlogCommentsClient(**self.auth, **self.... | [
"0.69021344",
"0.5904265",
"0.5879149",
"0.557076",
"0.5548855",
"0.5543931",
"0.548383",
"0.54503465",
"0.54413784",
"0.5439498",
"0.53843045",
"0.53791183",
"0.5329011",
"0.53260875",
"0.53190464",
"0.52977943",
"0.5245079",
"0.52392626",
"0.52331084",
"0.5216267",
"0.52128... | 0.84644496 | 0 |
returns a hubspot3 broadcast client | def broadcast(self):
from hubspot3.broadcast import BroadcastClient
return BroadcastClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client():\n return IceCubedSyncClient(\"api_key\", \"secret\")",
"def uclient():\n return IceCubedSyncClient()",
"def get_client():\n client = soundcloud.Client(client_id=CLIENT_ID)\n return client",
"def get_websocket(host, port, route='/', ssl=False):\n client = MessageBusClient(host, po... | [
"0.613877",
"0.5948435",
"0.5947264",
"0.5915393",
"0.5894071",
"0.586934",
"0.56929386",
"0.5674536",
"0.5633091",
"0.55710053",
"0.5508454",
"0.5506904",
"0.54991937",
"0.54909045",
"0.54502475",
"0.5439712",
"0.54072493",
"0.5398332",
"0.5396158",
"0.53819543",
"0.5345917"... | 0.7807271 | 0 |
returns a hubspot3 layouts client | def cms_layouts(self):
from hubspot3.cms_layouts import CMSLayoutsClient
return CMSLayoutsClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_root_layout(self):\n layout = dbc.Container(\n fluid=True,\n children=[\n self.get_nav_bar_layout(),\n dbc.Row(\n [\n # Real time update database\n dcc.Interval(\n ... | [
"0.5478816",
"0.543493",
"0.54181683",
"0.5362686",
"0.5197793",
"0.51976466",
"0.5155344",
"0.5151179",
"0.5096335",
"0.509288",
"0.5051475",
"0.5030334",
"0.5008028",
"0.49811623",
"0.49290818",
"0.4926822",
"0.48975232",
"0.48767364",
"0.4872657",
"0.48724967",
"0.4831426"... | 0.680343 | 0 |
returns a hubspot3 files client | def cms_files(self):
from hubspot3.cms_files import CMSFilesClient
return CMSFilesClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_files_api():\n return get_api_client(cloudsmith_api.FilesApi)",
"def get_client():\n return storage.Client(project=project_id)",
"def getFileClient(self):\n config = self.getAWSConfiguration()\n client = AWSFileClient(config['aws_key_id'],\n config['aws... | [
"0.69184244",
"0.64720887",
"0.6380225",
"0.59793717",
"0.5950813",
"0.5873608",
"0.5872091",
"0.5771306",
"0.5758057",
"0.5743821",
"0.5729288",
"0.5728334",
"0.5601542",
"0.5537482",
"0.5523864",
"0.54815495",
"0.54574454",
"0.5435238",
"0.54278135",
"0.5410869",
"0.5364863... | 0.654887 | 1 |
returns a hubspot3 companies client | def companies(self):
from hubspot3.companies import CompaniesClient
return CompaniesClient(**self.auth, **self.options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def companies_properties(self):\n from hubspot3.companies_properties import CompaniesPropertiesClient\n\n return CompaniesPropertiesClient(**self.auth, **self.options)",
"def _base(self):\n from hubspot3.base import BaseClient\n\n return BaseClient(**self.auth, **self.options)",
"de... | [
"0.6254224",
"0.615158",
"0.5996912",
"0.596645",
"0.5868519",
"0.58633995",
"0.5862868",
"0.58476573",
"0.5836633",
"0.5809416",
"0.5809416",
"0.5806708",
"0.57984376",
"0.5747082",
"0.56933194",
"0.5681742",
"0.5669442",
"0.565575",
"0.56519705",
"0.56433856",
"0.5596705",
... | 0.75408334 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.