text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: factumproject/simplerviews path: /photos/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.years, name='years'),
url(r'^album/(?P<album_id>[0-9a-f-]+)',views.album, name='album'),
url(r'^albums/',views.albums, name='albums'),
url(r'^ph... | code_fim | medium | {
"lang": "python",
"repo": "factumproject/simplerviews",
"path": "/photos/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>month>\d{2})/$', views.month, name='month'),
url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', views.day, name='day'),
]<|fim_prefix|># repo: factumproject/simplerviews path: /photos/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.years, na... | code_fim | medium | {
"lang": "python",
"repo": "factumproject/simplerviews",
"path": "/photos/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nicole-dwenger/cdslanguage-network path: /src/1_network_analysis.py
#!/usr/bin/env python
"""
Script to take weighted edgelist (.csv with nodeA, nodeB, weight) to
generate network graph with spring layout and save csv of centrality measures.
Steps:
- Read weighted edgelist and filter by mini... | code_fim | hard | {
"lang": "python",
"repo": "nicole-dwenger/cdslanguage-network",
"path": "/src/1_network_analysis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, edges_df):
# Dataframe with weighted edgelist
self.edges_df = edges_df
# Generate graph from edgelist when initialising
self.graph = nx.from_pandas_edgelist(self.edges_df, "nodeA", "nodeB", ["weight"])
def draw_graph(self, out_path)... | code_fim | hard | {
"lang": "python",
"repo": "nicole-dwenger/cdslanguage-network",
"path": "/src/1_network_analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sam-Martin/graph-notebook path: /test/integration/without_iam/opencypher/test_opencypher_status_without_iam.py
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
"""
import threading
import logging
import time
import requests
from test.int... | code_fim | hard | {
"lang": "python",
"repo": "Sam-Martin/graph-notebook",
"path": "/test/integration/without_iam/opencypher/test_opencypher_status_without_iam.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> query_id = ''
for q in status_res['queries']:
if query in q['queryString']:
query_id = q['queryId']
assert query_id != ''
self.assertNotEqual(query_id, '')
cancel = self.client.opencypher_cancel(query_id)
cancel_res = cancel.jso... | code_fim | hard | {
"lang": "python",
"repo": "Sam-Martin/graph-notebook",
"path": "/test/integration/without_iam/opencypher/test_opencypher_status_without_iam.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> sys.exit(args)
def return_int_raise_value_error_otherwise(x):
if isinstance(x, int):
return x
else:
raise ValueError(x)<|fim_prefix|># repo: app-sre/sretoolbox path: /tests/fixture_function.py
import sys
def identity(x):
return x
<|fim_middle|>def raiser(*args, **kwargs... | code_fim | medium | {
"lang": "python",
"repo": "app-sre/sretoolbox",
"path": "/tests/fixture_function.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: app-sre/sretoolbox path: /tests/fixture_function.py
import sys
def identity(x):
<|fim_suffix|> if isinstance(x, int):
return x
else:
raise ValueError(x)<|fim_middle|> return x
def raiser(*args, **kwargs):
raise Exception("Oh noes!")
def sys_exit_func(*args, **kwar... | code_fim | medium | {
"lang": "python",
"repo": "app-sre/sretoolbox",
"path": "/tests/fixture_function.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: app-sre/sretoolbox path: /tests/fixture_function.py
import sys
def identity(x):
return x
def raiser(*args, **kwargs):
raise Exception("Oh noes!")
<|fim_suffix|> sys.exit(args)
def return_int_raise_value_error_otherwise(x):
if isinstance(x, int):
return x
else:
... | code_fim | easy | {
"lang": "python",
"repo": "app-sre/sretoolbox",
"path": "/tests/fixture_function.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> _attribute_map = {
'additional_properties': {'key': '', 'type': '{object}'},
'activity': {'key': 'activity', 'type': 'str'},
'dependency_conditions': {'key': 'dependencyConditions', 'type': '[str]'},
}
def __init__(self, activity, dependency_conditions, additional_prop... | code_fim | hard | {
"lang": "python",
"repo": "AutorestCI/azure-sdk-for-python",
"path": "/azure-mgmt-datafactory/azure/mgmt/datafactory/models/activity_dependency.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AutorestCI/azure-sdk-for-python path: /azure-mgmt-datafactory/azure/mgmt/datafactory/models/activity_dependency.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT Licen... | code_fim | medium | {
"lang": "python",
"repo": "AutorestCI/azure-sdk-for-python",
"path": "/azure-mgmt-datafactory/azure/mgmt/datafactory/models/activity_dependency.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _validation = {
'activity': {'required': True},
'dependency_conditions': {'required': True},
}
_attribute_map = {
'additional_properties': {'key': '', 'type': '{object}'},
'activity': {'key': 'activity', 'type': 'str'},
'dependency_conditions': {'key': ... | code_fim | hard | {
"lang": "python",
"repo": "AutorestCI/azure-sdk-for-python",
"path": "/azure-mgmt-datafactory/azure/mgmt/datafactory/models/activity_dependency.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> key: Optional[str] = None,
type: Optional[str] = None,
value: Optional[str] = None):
if key is not None:
pulumi.set(__self__, "key", key)
if type is not None:
pulumi.set(__self__, "type", type)
if value is n... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws-native",
"path": "/sdk/python/pulumi_aws_native/codedeploy/outputs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
@pulumi.getter
def key(self) -> str:
return pulumi.get(self, "key")
@property
@pulumi.getter
def value(self) -> str:
return pulumi.get(self, "value")
@pulumi.output_type
class DeploymentGroupTagFilter(dict):
def __init__(__self__, *,
... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws-native",
"path": "/sdk/python/pulumi_aws_native/codedeploy/outputs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi-aws-native path: /sdk/python/pulumi_aws_native/codedeploy/outputs.py
_self__, "enabled", enabled)
if events is not None:
pulumi.set(__self__, "events", events)
@property
@pulumi.getter
def enabled(self) -> Optional[bool]:
return pulumi.get(se... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws-native",
"path": "/sdk/python/pulumi_aws_native/codedeploy/outputs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>for _ in range(int(line)):
line = sys.stdin.readline()
assert re.match(integer + " " + integer + "\n", line), \
"Expected a pair of integers, got {}.".format(line)
L, R = map(int, line.split())
assert 0 <= L <= 10**9, "D = {} must be in [0, 10^9]".format(D)
assert 0 <= R <= 10*... | code_fim | hard | {
"lang": "python",
"repo": "csecutsc/utscode2",
"path": "/limbo1/input_format_validators/validate.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: csecutsc/utscode2 path: /limbo1/input_format_validators/validate.py
#!/usr/bin/env python3
import re
import sys
integer = "(0|-?[1-9]\\d*)"
<|fim_suffix|>assert len(sys.stdin.readline()) == 0, "Extra lines detected after input."
sys.exit(42)<|fim_middle|>line = sys.stdin.readline()
assert re.m... | code_fim | hard | {
"lang": "python",
"repo": "csecutsc/utscode2",
"path": "/limbo1/input_format_validators/validate.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vacaly/Alink path: /python/src/main/python/pyalink/alink/tests/examples/from_docs/test_evalclusterbatchop.py
import unittest
from pyalink.alink import *
import numpy as np
import pandas as pd
class TestEvalClusterBatchOp(unittest.TestCase):
def test_evalclusterbatchop(self):
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "vacaly/Alink",
"path": "/python/src/main/python/pyalink/alink/tests/examples/from_docs/test_evalclusterbatchop.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> metrics = EvalClusterBatchOp().setVectorCol("vec").setPredictionCol("id").linkFrom(inOp).collectMetrics()
print("Total Samples Number:", metrics.getCount())
print("Cluster Number:", metrics.getK())
print("Cluster Array:", metrics.getClusterArray())
print("C... | code_fim | hard | {
"lang": "python",
"repo": "vacaly/Alink",
"path": "/python/src/main/python/pyalink/alink/tests/examples/from_docs/test_evalclusterbatchop.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class UserListView(LoginRequiredMixin, ListView):
model = User
# These next two lines tell the view to index lookups by username
slug_field = 'username'
slug_url_kwarg = 'username'
class UserApiView(APIView):
def get(self, request, pk):
try:
user = User.objects.g... | code_fim | hard | {
"lang": "python",
"repo": "crobytech/Recruitment-test",
"path": "/tuteria_application_test/users/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crobytech/Recruitment-test path: /tuteria_application_test/users/views.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView, View... | code_fim | hard | {
"lang": "python",
"repo": "crobytech/Recruitment-test",
"path": "/tuteria_application_test/users/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AzeezBello/raodoh path: /members_area/views.py
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from .models import Course, Lesson
<|fim_suffix|>def course(request, pk):
courses = Course.objects.get(pk=pk)
context = {
"courses": cour... | code_fim | hard | {
"lang": "python",
"repo": "AzeezBello/raodoh",
"path": "/members_area/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> courses = Course.objects.all().order_by('create_time')
context = {
"courses": courses,
}
return render(request, 'members_area/index.html', context)
def dashboard(request):
return render(request, 'members_area/dashboard.html', {})
def course(request, pk):
courses = Co... | code_fim | medium | {
"lang": "python",
"repo": "AzeezBello/raodoh",
"path": "/members_area/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
return (value - min_value)/(max_value - min_value)
except ZeroDivisionError:
return 0<|fim_prefix|># repo: duncanbackr/jit_analytics path: /Analytics/scaler.py
def min_max_scaler(value, min_value, max_value):
<|fim_middle|> '''
takes value, calculated max value (pulle... | code_fim | medium | {
"lang": "python",
"repo": "duncanbackr/jit_analytics",
"path": "/Analytics/scaler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duncanbackr/jit_analytics path: /Analytics/scaler.py
def min_max_scaler(value, min_value, max_value):
<|fim_suffix|> try:
return (value - min_value)/(max_value - min_value)
except ZeroDivisionError:
return 0<|fim_middle|> '''
takes value, calculated max value (pulle... | code_fim | medium | {
"lang": "python",
"repo": "duncanbackr/jit_analytics",
"path": "/Analytics/scaler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wenk-silvan/pren-robo-cube-ipcv path: /src/common/camera/fake_camera.py
import cv2
class FakeCamera:
def __init__(self):
pass
def __exit__(self):
<|fim_suffix|> """
Read the current frame and resize to 1280x980
:return:
"""
return cv2.resi... | code_fim | easy | {
"lang": "python",
"repo": "wenk-silvan/pren-robo-cube-ipcv",
"path": "/src/common/camera/fake_camera.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Read the current frame and resize to 1280x980
:return:
"""
return cv2.resize(cv2.imread("../../../images/obstacles_sample.jpeg"), (1280, 980))<|fim_prefix|># repo: wenk-silvan/pren-robo-cube-ipcv path: /src/common/camera/fake_camera.py
import cv2
class FakeCa... | code_fim | medium | {
"lang": "python",
"repo": "wenk-silvan/pren-robo-cube-ipcv",
"path": "/src/common/camera/fake_camera.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arquolo/transcoder path: /train_utils.py
__all__ = ['DuplicatesPruner', 'optimize_v2']
import sys
from pathlib import Path
from typing import Callable, List, Optional, Tuple, Type
import optuna
from optuna import Study
from optuna.pruners import BasePruner
from optuna.trial import Froz... | code_fim | hard | {
"lang": "python",
"repo": "arquolo/transcoder",
"path": "/train_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def prune(self, study: Study, trial: FrozenTrial) -> bool:
key = self.__key_fn(trial)
return any(key == self.__key_fn(t)
for t in study.get_trials(deepcopy=False)
if t.state == TrialState.COMPLETE)
def _dump_logs(study: Study):
print(... | code_fim | medium | {
"lang": "python",
"repo": "arquolo/transcoder",
"path": "/train_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Parse arguments
Args:
parser (argparse.ArgumentParser)
"""
parser.add_argument('-dt', "--datatype", action="store", type=str, dest="datatype", help="Datatype of the input file, e.g., tsv or csv.", default="tsv")
parser.add_argument( "-c", "--column", action="store", typ... | code_fim | medium | {
"lang": "python",
"repo": "wyfunique/kgtk",
"path": "/kgtk/cli/sort_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wyfunique/kgtk path: /kgtk/cli/sort_file.py
"""
Sort file based on a column.
"""
import sys
def parser():
return {
'help': 'Sort file based on a column.'
}
<|fim_suffix|>def run(datatype, column, input):
# import modules locally
import socket
import sh
sh.mlr... | code_fim | hard | {
"lang": "python",
"repo": "wyfunique/kgtk",
"path": "/kgtk/cli/sort_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> c, N * (c + 1)):
X[ix] = t[index] * torch.FloatTensor((
math.sin(inner_var[index]), math.cos(inner_var[index])
))
y[ix] = c
index += 1
return (X, y)<|fim_prefix|># repo: mikisvaz/rbbt-dm path: /python/rbbt_dm/atcold/spiral.py
import to... | code_fim | hard | {
"lang": "python",
"repo": "mikisvaz/rbbt-dm",
"path": "/python/rbbt_dm/atcold/spiral.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mikisvaz/rbbt-dm path: /python/rbbt_dm/atcold/spiral.py
import torch
import math
def spiral_data(N=1000, D=2, C=3):
X = torch.zeros(N * C, D)
y = torch.zeros(N * C, dtype=torch.long)
for c in range(C):
index = 0
t = torch.linspace(0, 1, N)
# When c = 0 and t = ... | code_fim | hard | {
"lang": "python",
"repo": "mikisvaz/rbbt-dm",
"path": "/python/rbbt_dm/atcold/spiral.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: visenger/aggregation path: /experimental/algorithms/blanks/serengeti5.py
#!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import os
import pymongo
import urllib
import matplotlib.pyplot as plt
import cv2
from skimage.measure import structural_similarity as ssim
import image_slice... | code_fim | hard | {
"lang": "python",
"repo": "visenger/aggregation",
"path": "/experimental/algorithms/blanks/serengeti5.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for fname1 in all_files[subject_index]:
image_slicer.slice(image_directory+fname1, 4)
base_fname1 = fname1[:-4]
for fname2 in all_files[subject_index2]:
image_slicer.slice(image_directory+fname2, 4)
base_fname2 = fname2[:-4]
... | code_fim | hard | {
"lang": "python",
"repo": "visenger/aggregation",
"path": "/experimental/algorithms/blanks/serengeti5.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if reasons[subject_index] == reasons[subject_index2]:
# similarity.append(max(differences))
# else:
# non_similarity.append(max(differences))
# print min(similarity),max(similarity),np.mean(similarity)
# print min(non_similarity),max(non_similarity),np... | code_fim | hard | {
"lang": "python",
"repo": "visenger/aggregation",
"path": "/experimental/algorithms/blanks/serengeti5.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yelp/environment_tools path: /environment_tools/type_utils.py
# -*- coding: utf-8 -*-
from collections import namedtuple
import os
import networkx as nx
from environment_tools.config import _read_data_json
from environment_tools.config import _convert_mapping_to_graph
# See https://github.com/... | code_fim | hard | {
"lang": "python",
"repo": "Yelp/environment_tools",
"path": "/environment_tools/type_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Converts the provided location into the desired location_type
This will perform a DFS on the location graph to find connected components
to the supplied node and then filter by the desired location_type.
Basically if we consider our datacenter layout a DAG, then this method will
s... | code_fim | hard | {
"lang": "python",
"repo": "Yelp/environment_tools",
"path": "/environment_tools/type_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aayn/huxley path: /huxley/logging/management/commands/erase_logs.py
# Copyright (c) 2011-2015 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
from datetime import datetime, timedelta
from django.core.management.base import... | code_fim | medium | {
"lang": "python",
"repo": "aayn/huxley",
"path": "/huxley/logging/management/commands/erase_logs.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> cutoff = datetime.now() - timedelta(days=days)
records = LogEntry.objects.filter(timestamp__lt=cutoff)
records.delete()
return<|fim_prefix|># repo: aayn/huxley path: /huxley/logging/management/commands/erase_logs.py
# Copyright (c) 2011-2015 Berkeley Model United Nations.... | code_fim | medium | {
"lang": "python",
"repo": "aayn/huxley",
"path": "/huxley/logging/management/commands/erase_logs.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> days = int(args[0]) if args else 30
cutoff = datetime.now() - timedelta(days=days)
records = LogEntry.objects.filter(timestamp__lt=cutoff)
records.delete()
return<|fim_prefix|># repo: aayn/huxley path: /huxley/logging/management/commands/erase_logs.py
# Copyright... | code_fim | medium | {
"lang": "python",
"repo": "aayn/huxley",
"path": "/huxley/logging/management/commands/erase_logs.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> sample_job):
job_id = str(sample_job.id)
service_id = sample_job.service.id
with notify_api.test_request_context():
with notify_api.test_client() as client:
path = url_for('job.get_job_for_service', job_id=job_id, service_id=service_id)
au... | code_fim | hard | {
"lang": "python",
"repo": "easternbloc/notifications-api",
"path": "/tests/app/job/test_job_rest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> job_id = uuid.uuid4()
template_id = sample_template.id
service_id = sample_template.service.id
original_file_name = 'thisisatest.csv'
bucket_name = 'service-{}-notify'.format(service_id)
file_name = '{}.csv'.format(job_id)
data = {
'id': str(job_id),
'service': ... | code_fim | hard | {
"lang": "python",
"repo": "easternbloc/notifications-api",
"path": "/tests/app/job/test_job_rest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: easternbloc/notifications-api path: /tests/app/job/test_job_rest.py
import json
import uuid
from flask import url_for
from tests import create_authorization_header
from tests.app.conftest import sample_job as create_job
def test_get_jobs(notify_api, notify_db, notify_db_session, sample_templat... | code_fim | hard | {
"lang": "python",
"repo": "easternbloc/notifications-api",
"path": "/tests/app/job/test_job_rest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ucgmsim/slurm_gm_workflow path: /workflow/automation/tests/conftest.py
import pytest
from workflow.automation.lib.schedulers.scheduler_factory import Scheduler
<|fim_suffix|> print("Initialising scheduler")
Scheduler.initialise_scheduler("test_user")<|fim_middle|>@pytest.fixture(scope="... | code_fim | easy | {
"lang": "python",
"repo": "ucgmsim/slurm_gm_workflow",
"path": "/workflow/automation/tests/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Initialising scheduler")
Scheduler.initialise_scheduler("test_user")<|fim_prefix|># repo: ucgmsim/slurm_gm_workflow path: /workflow/automation/tests/conftest.py
import pytest
from workflow.automation.lib.schedulers.scheduler_factory import Scheduler
<|fim_middle|>@pytest.fixture(scope="... | code_fim | easy | {
"lang": "python",
"repo": "ucgmsim/slurm_gm_workflow",
"path": "/workflow/automation/tests/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xauen21/series path: /resources/series/plugins/subtitle/subdivx.py
import requests
import re
from resources.series.common.utils import Utils
from resources.series.common.code import Code
<|fim_suffix|> details = re.findall('.*"buscador_detalle_sub".*', content)
details = [(lambda detail: de... | code_fim | hard | {
"lang": "python",
"repo": "xauen21/series",
"path": "/resources/series/plugins/subtitle/subdivx.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def searchCandidates(name, episode):
candidates = []
parameters = (('buscar', name + " s" + str(episode.season).zfill(2) + "e" + str(episode.episode).zfill(2)), ('accion', 5), ('oxdown', 1))
# SEARCH EPISODES
content, code = Utils.getContent(url = Subdivx.url, parameters = param... | code_fim | hard | {
"lang": "python",
"repo": "xauen21/series",
"path": "/resources/series/plugins/subtitle/subdivx.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Super-Tree/MV3D_TF path: /lib/rpn_msr/proposal_layer_tf.py
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# -------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "Super-Tree/MV3D_TF",
"path": "/lib/rpn_msr/proposal_layer_tf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 2. clip predicted boxes to image
proposals_bv = clip_boxes(proposals_bv, im_info[:2])
# 3. remove predicted boxes with either height or width < threshold
# (NOTE: convert min_size to input image scale stored in im_info[2])
keep = _filter_boxes(proposals_bv, min_size * im_info[2])
... | code_fim | hard | {
"lang": "python",
"repo": "Super-Tree/MV3D_TF",
"path": "/lib/rpn_msr/proposal_layer_tf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert rpn_cls_prob_reshape.shape[0] == 1, \
'Only single item batches are supported'
# cfg_key = str(self.phase) # either 'TRAIN' or 'TEST'
#cfg_key = 'TEST'
pre_nms_topN = cfg[cfg_key].RPN_PRE_NMS_TOP_N
post_nms_topN = cfg[cfg_key].RPN_POST_NMS_TOP_N
nms_thresh = cfg[... | code_fim | hard | {
"lang": "python",
"repo": "Super-Tree/MV3D_TF",
"path": "/lib/rpn_msr/proposal_layer_tf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>dylink_portability.run_unrestricted_repy_code("one_hop_forwarder.repy", [TCP_PORT, UDP_PORT])<|fim_prefix|># repo: SeattleTestbed/attic path: /branches/repy_v2/shims/one_hop_forwarder/run_unrestricted_onehopdetour_forwarder.py
import sys
import dylink_portability
if len(sys.argv) < 3:
print "Usage: ... | code_fim | easy | {
"lang": "python",
"repo": "SeattleTestbed/attic",
"path": "/branches/repy_v2/shims/one_hop_forwarder/run_unrestricted_onehopdetour_forwarder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeattleTestbed/attic path: /branches/repy_v2/shims/one_hop_forwarder/run_unrestricted_onehopdetour_forwarder.py
import sys
import dylink_portability
<|fim_suffix|>dylink_portability.run_unrestricted_repy_code("one_hop_forwarder.repy", [TCP_PORT, UDP_PORT])<|fim_middle|>if len(sys.argv) < 3:
... | code_fim | medium | {
"lang": "python",
"repo": "SeattleTestbed/attic",
"path": "/branches/repy_v2/shims/one_hop_forwarder/run_unrestricted_onehopdetour_forwarder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>TCP_PORT = sys.argv[1]
UDP_PORT = sys.argv[2]
dylink_portability.run_unrestricted_repy_code("one_hop_forwarder.repy", [TCP_PORT, UDP_PORT])<|fim_prefix|># repo: SeattleTestbed/attic path: /branches/repy_v2/shims/one_hop_forwarder/run_unrestricted_onehopdetour_forwarder.py
import sys
import dylink_portab... | code_fim | medium | {
"lang": "python",
"repo": "SeattleTestbed/attic",
"path": "/branches/repy_v2/shims/one_hop_forwarder/run_unrestricted_onehopdetour_forwarder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('accounts', '0005_auto_20200703_1546'),
]
operations = [
migrations.AlterField(
model_name='user',
name='contact',
field=phone_field.models.PhoneField(blank=True, default='8610125217', help_text='Contact phone number', max_... | code_fim | medium | {
"lang": "python",
"repo": "subhailams/pycharm_django_ecommerce_app",
"path": "/accounts/migrations/0006_auto_20200703_1550.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='user',
name='contact',
field=phone_field.models.PhoneField(blank=True, default='8610125217', help_text='Contact phone number', max_length=31),
),
]<|fim_prefix|># repo: subhailams/pycharm_django_e... | code_fim | medium | {
"lang": "python",
"repo": "subhailams/pycharm_django_ecommerce_app",
"path": "/accounts/migrations/0006_auto_20200703_1550.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: subhailams/pycharm_django_ecommerce_app path: /accounts/migrations/0006_auto_20200703_1550.py
# Generated by Django 2.2.8 on 2020-07-03 10:20
<|fim_suffix|>
dependencies = [
('accounts', '0005_auto_20200703_1546'),
]
operations = [
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "subhailams/pycharm_django_ecommerce_app",
"path": "/accounts/migrations/0006_auto_20200703_1550.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for neighbour in adj_list[cur_node]:
if color[neighbour] == -1:
color[neighbour] = cur_color ^ 1
stack.append(neighbour)
elif color[neighbour] == cur_color:
... | code_fim | hard | {
"lang": "python",
"repo": "rpm1995/LeetCode",
"path": "/886_Possible_Bipartition.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rpm1995/LeetCode path: /886_Possible_Bipartition.py
class Solution:
def possibleBipartition(self, N: int, dislikes: List[List[int]]) -> bool:
if not dislikes:
return True
adj_list = {}
color = [-1 for _ in range(N + 1)]
for node1, node2 in dislik... | code_fim | hard | {
"lang": "python",
"repo": "rpm1995/LeetCode",
"path": "/886_Possible_Bipartition.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__forward__tensorrt', 'single_stage_text_detector__simple_test'
]<|fim_prefix|># repo: fengbingchun/PyTorch_Test path: /src/mmdeploy/mmdeploy/codebase/mmocr/models/text_detection/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from .fpn_cat import fpnc__forward__tensorrt
from .single_stage_te... | code_fim | medium | {
"lang": "python",
"repo": "fengbingchun/PyTorch_Test",
"path": "/src/mmdeploy/mmdeploy/codebase/mmocr/models/text_detection/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fengbingchun/PyTorch_Test path: /src/mmdeploy/mmdeploy/codebase/mmocr/models/text_detection/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from .fpn_cat imp<|fim_suffix|>__forward__tensorrt', 'single_stage_text_detector__simple_test'
]<|fim_middle|>ort fpnc__forward__tensorrt
from .s... | code_fim | medium | {
"lang": "python",
"repo": "fengbingchun/PyTorch_Test",
"path": "/src/mmdeploy/mmdeploy/codebase/mmocr/models/text_detection/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rick0514/VPR_SMCN path: /experiments/cp3_4/ex3_4_Delta_AP.py
import numpy as np
from tqdm import tqdm
import yaml
from os.path import join
import main.utils as utils
# --------------info-------------------
# we refer to https://github.com/oravus/DeltaDescriptors and
# modify its code to apply t... | code_fim | hard | {
"lang": "python",
"repo": "Rick0514/VPR_SMCN",
"path": "/experiments/cp3_4/ex3_4_Delta_AP.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># load global config yaml
yaml_path = './config.yaml' # (*)
with open(yaml_path, 'r', encoding='utf-8') as f:
cont = f.read()
arg = yaml.load(cont)
arg_dataset = arg['dataset']
arg_net = arg['net']
arg_eval = arg['evaluate']
imgdir = join(arg_dataset['root'], arg_dataset['name'])
desc_dir = join(ar... | code_fim | hard | {
"lang": "python",
"repo": "Rick0514/VPR_SMCN",
"path": "/experiments/cp3_4/ex3_4_Delta_AP.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._cleantweet
def toks(self):
return self._toks
def __str__(self):
return self._cleantweet
infilename = sys.argv[1]
outfilename = sys.argv[2]
tweets = []
stopwords = []
with open(stopword_file, 'rb') as fs:
for word in fs:
stopwords.append(word.... | code_fim | hard | {
"lang": "python",
"repo": "fmacias64/big-data-system",
"path": "/assignment3/partB/parsetweet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>infilename = sys.argv[1]
outfilename = sys.argv[2]
tweets = []
stopwords = []
with open(stopword_file, 'rb') as fs:
for word in fs:
stopwords.append(word.strip())
fs.close()
with open(infilename, 'rb') as fi, open(outfilename, 'wb') as fo:
infile = fi.read()
start = '['
stop ... | code_fim | hard | {
"lang": "python",
"repo": "fmacias64/big-data-system",
"path": "/assignment3/partB/parsetweet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fmacias64/big-data-system path: /assignment3/partB/parsetweet.py
#!/usr/bin/env python
import os,sys
import string
import re
import pickle
stopword_file = './stopwords'
class CleanTweet(object):
"""
case-sensitive, removed url, hashtag#, special term like 'RT', and reply@
"""
... | code_fim | hard | {
"lang": "python",
"repo": "fmacias64/big-data-system",
"path": "/assignment3/partB/parsetweet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ['get_compiler_version', 'get_compiling_cuda_version']<|fim_prefix|># repo: i-pan/mmdetection path: /mmdet/ops/utils/__init__.py
# from . import compiling_info
try:
from .compiling_info import get_compiler_version, get_compiling_cuda_version
except ModuleNotFoundError:
print('Unable to ... | code_fim | medium | {
"lang": "python",
"repo": "i-pan/mmdetection",
"path": "/mmdet/ops/utils/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: i-pan/mmdetection path: /mmdet/ops/utils/__init__.py
# from . import compiling_info
try:
from .compiling_info import get_compiler_version, get_compiling_cuda_version
except ModuleNotFoundError:
print('Unable to import from `compiling_info`')
<|fim_suffix|>__all__ = ['get_compiler_version... | code_fim | medium | {
"lang": "python",
"repo": "i-pan/mmdetection",
"path": "/mmdet/ops/utils/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kdschlosser/pyatv path: /pyatv/__init__.py
"""Main routines for interacting with an Apple TV."""
import os
import asyncio
import logging
import datetime # noqa
from abc import ABC, abstractmethod
from ipaddress import IPv4Address, ip_address
from typing import List, Dict
import aiohttp
from ai... | code_fim | hard | {
"lang": "python",
"repo": "kdschlosser/pyatv",
"path": "/pyatv/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def _get_port(response, qname):
for resource in response.resources:
if resource.qtype != udns.QTYPE_SRV:
continue
if resource.qname == qname:
return resource.rd.get("port")
return None
async def scan(
loo... | code_fim | hard | {
"lang": "python",
"repo": "kdschlosser/pyatv",
"path": "/pyatv/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cdchapman/openseadragon path: /bin/dzi.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import deepzoom
import urllib
import re
MAX_PAGES = 10
PAGE_COUNT = {}
def ensure_dir( filename ):
<|fim_suffix|># Create Deep Zoom Image creator with weird parameters
creator = deepzoom.ImageC... | code_fim | medium | {
"lang": "python",
"repo": "cdchapman/openseadragon",
"path": "/bin/dzi.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> parts = re.match(
r'http://lcweb2\.loc\.gov/master/pnp/ppmsca/(\d*)/(\d*)/(\d*)u\.tif',
tiff_url
).groups()
id = parts[ 1 ]
fileid = parts[ 2 ]
if id not in PAGE_COUNT:
PAGE_COUNT[ id ] = 0
path = tiff_url.replace( 'http://lcweb2.loc.gov/master... | code_fim | hard | {
"lang": "python",
"repo": "cdchapman/openseadragon",
"path": "/bin/dzi.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print 'downloading master tiff: %s' % tiff_url
tiff_file = open( path, 'wb' )
tiff_file.write( urllib.urlopen( tiff_url ).read() )
tiff_file.close()
print 'creating dzi: %s' % path
# Create Deep Zoom image pyramid from source
creator.create( path, p... | code_fim | hard | {
"lang": "python",
"repo": "cdchapman/openseadragon",
"path": "/bin/dzi.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sawyerwatts/cs488 path: /query_setup.py
from pymongo import MongoClient
import sys
<|fim_suffix|>if len(sys.argv) == 1:
collection = db.allData
else:
collection = db.oneHour<|fim_middle|>client = MongoClient(port=27017)
db = client.freewaydata
collection = None
| code_fim | medium | {
"lang": "python",
"repo": "sawyerwatts/cs488",
"path": "/query_setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if len(sys.argv) == 1:
collection = db.allData
else:
collection = db.oneHour<|fim_prefix|># repo: sawyerwatts/cs488 path: /query_setup.py
from pymongo import MongoClient
import sys
<|fim_middle|>client = MongoClient(port=27017)
db = client.freewaydata
collection = None
| code_fim | medium | {
"lang": "python",
"repo": "sawyerwatts/cs488",
"path": "/query_setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anselmobd/tuzle path: /insumo_codigos.py
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import sys
import re
from pprint import pprint
import csv
verbose = False
<|fim_suffix|>for row in reader:
codini = row[0][:2]
if (not breakVal) or breakVal != codini:
breakVal = codini
... | code_fim | hard | {
"lang": "python",
"repo": "anselmobd/tuzle",
"path": "/insumo_codigos.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>writer = csv.writer(
open(refFile, 'w', newline=''),
delimiter=';',
quoting=csv.QUOTE_NONNUMERIC)
cab = ['NIVEL_ESTRUTURA', 'REFERENCIA', 'VERSAOORDER', 'CODITEMPROD']
writer.writerow(cab)
valIni = 1
step = 1
breakVal = None
for row in reader:
codini = row[0][:2]
if (not breakVal) o... | code_fim | hard | {
"lang": "python",
"repo": "anselmobd/tuzle",
"path": "/insumo_codigos.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if verbose:
pprint(sys.argv)
print(csvFile)
reader = csv.reader(open(csvFile), delimiter=';')
cab = next(reader)
writer = csv.writer(
open(refFile, 'w', newline=''),
delimiter=';',
quoting=csv.QUOTE_NONNUMERIC)
cab = ['NIVEL_ESTRUTURA', 'REFERENCIA', 'VERSAOORDER', 'CODITEMPROD']
wri... | code_fim | hard | {
"lang": "python",
"repo": "anselmobd/tuzle",
"path": "/insumo_codigos.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aaron1011/hooks path: /pre-push
#!/usr/bin/python
import sys
import subprocess
import re
import os
import glob
DIRECTORY = os.path.join(".", "build", "libs")
FILENAME_RE = r"spongeapi-{}(-SNAPSHOT)?.jar"
VERSION = "1.1" # TODO: I'm lazy
#VERSION = subprocess.check_output("git describe --abbrev=... | code_fim | medium | {
"lang": "python",
"repo": "Aaron1011/hooks",
"path": "/pre-push",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>files = re_glob(DIRECTORY, re.compile(FILENAME_RE.format(VERSION)))
if len(files) > 0:
t = os.path.getmtime(os.path.join(DIRECTORY, files[0]))
if t < GIT_COMMIT_DATE:
fail()
else:
fail()
print("Congrations! You tested locally!")
sys.exit(0)<|fim_prefix|># repo: Aaron1011/hooks path: ... | code_fim | medium | {
"lang": "python",
"repo": "Aaron1011/hooks",
"path": "/pre-push",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kiranvad/polyphase path: /polyphase/_phase.py
import pdb
import numpy as np
import time
import pandas as pd
import os
from collections import Counter
from scipy.spatial import ConvexHull, Delaunay
from scipy.spatial.distance import pdist, euclidean, squareform
from scipy.sparse import csr_ma... | code_fim | hard | {
"lang": "python",
"repo": "kiranvad/polyphase",
"path": "/polyphase/_phase.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> lap = time.time()
if verbose:
print('Simplices are refined at {:.2f}s'.format(lap-since))
# 4. for each simplex in the hull compute number of connected components (parallel)
num_comps_ray = [ray_label_simplex.remote(grid_ray, simplex, thresh) for simplex in simplices]
num_comps... | code_fim | hard | {
"lang": "python",
"repo": "kiranvad/polyphase",
"path": "/polyphase/_phase.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> xbmc.log(msg='Handover: %s' % message, level=xbmc.LOGERROR);
if fatal:
sys.exit(0)<|fim_prefix|># repo: RomanSmolka/script.handover path: /resources/lib/helpers.py
import xbmc
import xbmcgui
import sys
def display_message(message, type='INFO'):
# Possible types: INFO, WARNING, ERROR
dialog = xbmcgu... | code_fim | easy | {
"lang": "python",
"repo": "RomanSmolka/script.handover",
"path": "/resources/lib/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Possible types: INFO, WARNING, ERROR
dialog = xbmcgui.Dialog()
dialog.notification('Handover', message, getattr(xbmcgui, 'NOTIFICATION_'+type), 5000)
def log_error(message, fatal=False):
xbmc.log(msg='Handover: %s' % message, level=xbmc.LOGERROR);
if fatal:
sys.exit(0)<|fim_prefix|># repo: RomanS... | code_fim | easy | {
"lang": "python",
"repo": "RomanSmolka/script.handover",
"path": "/resources/lib/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RomanSmolka/script.handover path: /resources/lib/helpers.py
import xbmc
import xbmcgui
import sys
<|fim_suffix|>def log_error(message, fatal=False):
xbmc.log(msg='Handover: %s' % message, level=xbmc.LOGERROR);
if fatal:
sys.exit(0)<|fim_middle|>def display_message(message, type='INFO'):
# Po... | code_fim | medium | {
"lang": "python",
"repo": "RomanSmolka/script.handover",
"path": "/resources/lib/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def func(*args, **kwargs):
kw = kwargs.items()
kw.sort()
key = (args, tuple(kw))
try:
v = self.cache[key]
if (time.time() - v[1]) > self.timeout:
# remove from cache
self.cache.p... | code_fim | hard | {
"lang": "python",
"repo": "alexanderad/raspi-car",
"path": "/utils/decorators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexanderad/raspi-car path: /utils/decorators.py
# -*- coding: utf-8 -*-
import time
# inspired by http://code.activestate.com/recipes/325905-memoize-decorator-with-timeout/
# TODO: refactor to be more pythonic style :-)
<|fim_suffix|> def __call__(self, f):
self.cache = self._cache... | code_fim | hard | {
"lang": "python",
"repo": "alexanderad/raspi-car",
"path": "/utils/decorators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def parameters(self):
return [
[["Detector trigger count", self.rayonix_detector, "last_image_number", "int"], {"read_only": True}],
[["Timing system trigger count", self.rayonix_detector, "xdet_trig_count", "int"], {}],
[["Trigger count offset... | code_fim | hard | {
"lang": "python",
"repo": "friedrich-schotte/Lauecollect",
"path": "/Rayonix_Detector_Diagnostics_Panel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: friedrich-schotte/Lauecollect path: /Rayonix_Detector_Diagnostics_Panel.py
#!/usr/bin/env python
"""
Author: Friedrich Schotte
Date created: 2022-02-07
Date last modified: 2022-05-13
Revision comment: Trigger count offset (median): Changed format
"""
from Panel_3 import BasePanel
__version__ = "... | code_fim | hard | {
"lang": "python",
"repo": "friedrich-schotte/Lauecollect",
"path": "/Rayonix_Detector_Diagnostics_Panel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> icon = "Rayonix Detector"
@property
def name(self): return f"{self.domain_name}/Rayonix_Detector_Diagnostics_Panel"
@property
def parameters(self):
return [
[["Detector trigger count", self.rayonix_detector, "last_image_number", "int"], {"read_only": True}],
... | code_fim | hard | {
"lang": "python",
"repo": "friedrich-schotte/Lauecollect",
"path": "/Rayonix_Detector_Diagnostics_Panel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_add_one() -> None:
assert add_one(10) == 11
assert add_one(-10) == -9<|fim_prefix|># repo: AndrewSpittlemeister/Wrapped-WASM path: /mylib-py/tests/test_package.py
import pytest
from mylib import add_one, __version__
<|fim_middle|>def test_version() -> None:
assert __version__ == ... | code_fim | medium | {
"lang": "python",
"repo": "AndrewSpittlemeister/Wrapped-WASM",
"path": "/mylib-py/tests/test_package.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndrewSpittlemeister/Wrapped-WASM path: /mylib-py/tests/test_package.py
import pytest
from mylib import add_one, __version__
def test_version() -> None:
assert __version__ == "0.1.0"
<|fim_suffix|> assert add_one(10) == 11
assert add_one(-10) == -9<|fim_middle|>
def test_add_one() ... | code_fim | easy | {
"lang": "python",
"repo": "AndrewSpittlemeister/Wrapped-WASM",
"path": "/mylib-py/tests/test_package.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> choice = 1
while choice!=7:
print("Enter Your Choice")
choice = int(input())
if choice==1:
user_value = int(input("Enter the value you want to APPEND\n"))
l.append(Node(user_value))
elif choice==2:
user_value = int(input("Enter th... | code_fim | hard | {
"lang": "python",
"repo": "UG-SEP/NeoAlgo",
"path": "/Python/ds/Circular_LinkedList.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Remove node at position passed in argument
def remove(self,data):
'''Remove node at position passed in argument
usage : remove(value)
'''
node = self.head
while node:
if node.next.value == data:
nextNode = node.next.next
... | code_fim | hard | {
"lang": "python",
"repo": "UG-SEP/NeoAlgo",
"path": "/Python/ds/Circular_LinkedList.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UG-SEP/NeoAlgo path: /Python/ds/Circular_LinkedList.py
class circular_llist:
# constructor function called during object creation
def __init__(self,node):
self.head = node
self.tail = self.head
self.size = 1
# creates the list by values entered by user a... | code_fim | hard | {
"lang": "python",
"repo": "UG-SEP/NeoAlgo",
"path": "/Python/ds/Circular_LinkedList.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robionica/les path: /src/main/python/les/solution_tables/sqlite_solution_table.py
# Copyright (c) 2012-2013 Oleksandr Sviridenko
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Li... | code_fim | hard | {
"lang": "python",
"repo": "robionica/les",
"path": "/src/main/python/les/solution_tables/sqlite_solution_table.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> db_solution_table_base.DBSolutionTableBase.__init__(
self, SQLiteDataStore(db_name, verbose=verbose))
self._decomposition_tree = None
def __del__(self):
conn = self.get_data_store().get_connection()
conn.commit()
conn.close()
def get_solution(self):
if not self._decompo... | code_fim | hard | {
"lang": "python",
"repo": "robionica/les",
"path": "/src/main/python/les/solution_tables/sqlite_solution_table.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Returns :class:`Connection` instance to SQLite database.'''
self.__connection_lock.acquire()
return self._connection
def release_connection(self, conn):
'''Releases a connection for use by other operations.
If a transaction is supplied, no action is taken.
'''
conn.commi... | code_fim | hard | {
"lang": "python",
"repo": "robionica/les",
"path": "/src/main/python/les/solution_tables/sqlite_solution_table.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> mocker: pytest_mock.MockerFixture, mock_client_session: MagicMock
) -> None:
ClientSession = mocker.Mock()
ClientSession.return_value = mock_client_session
mocker.patch('aiohttp.ClientSession', return_value=ClientSession)<|fim_prefix|># repo: vaelen/Erasmus path: /tests/conftest.py
from _... | code_fim | hard | {
"lang": "python",
"repo": "vaelen/Erasmus",
"path": "/tests/conftest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.fixture
def mock_aiohttp(
mocker: pytest_mock.MockerFixture, mock_client_session: MagicMock
) -> None:
ClientSession = mocker.Mock()
ClientSession.return_value = mock_client_session
mocker.patch('aiohttp.ClientSession', return_value=ClientSession)<|fim_prefix|># repo: vaelen/Erasmu... | code_fim | hard | {
"lang": "python",
"repo": "vaelen/Erasmus",
"path": "/tests/conftest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.