text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: vaniisgh/PyDentity path: /libs/aries-basic-controller/aries_basic_controller/controllers/action_menu.py from .base import BaseController from ..models.connection import Connection from aiohttp import ( ClientSession, ) import logging import asyncio class ActionMenuController(BaseController)...
code_fim
medium
{ "lang": "python", "repo": "vaniisgh/PyDentity", "path": "/libs/aries-basic-controller/aries_basic_controller/controllers/action_menu.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async def close_menu(self, connection_id: str): return await self.admin_POST(f"/action-menu/{connection_id}/close") async def get_menu(self, connection_id: str): return await self.admin_POST(f"/action-menu/{connection_id}/fetch") async def request_menu(self, connection_id: st...
code_fim
medium
{ "lang": "python", "repo": "vaniisgh/PyDentity", "path": "/libs/aries-basic-controller/aries_basic_controller/controllers/action_menu.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # return the image return image<|fim_prefix|># repo: KleinYuan/tf-segmentation path: /helper.py import cv2 import urllib import numpy as np <|fim_middle|>def url_to_image(url): # download the image, convert it to a NumPy array, and then read # it into OpenCV format resp = urllib.url...
code_fim
hard
{ "lang": "python", "repo": "KleinYuan/tf-segmentation", "path": "/helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KleinYuan/tf-segmentation path: /helper.py import cv2 import urllib import numpy as np <|fim_suffix|> # return the image return image<|fim_middle|> def url_to_image(url): # download the image, convert it to a NumPy array, and then read # it into OpenCV format resp = urllib.url...
code_fim
hard
{ "lang": "python", "repo": "KleinYuan/tf-segmentation", "path": "/helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KleinYuan/tf-segmentation path: /helper.py import cv2 import urllib import numpy as np <|fim_suffix|> # download the image, convert it to a NumPy array, and then read # it into OpenCV format resp = urllib.urlopen(url) image = np.asarray(bytearray(resp.read()), dtype=np.uint8) ...
code_fim
easy
{ "lang": "python", "repo": "KleinYuan/tf-segmentation", "path": "/helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hilam/python-framework path: /app/http/providers/view.py from jinja2 import Template from jinja2 import Environment, PackageLoader, select_autoescape <|fim_suffix|> # Blade Template Engine # file = file.read() # file = re.sub(r'(\s*)@if(\s*\(.*\))', r'{% if \2 %}', file) # file =...
code_fim
hard
{ "lang": "python", "repo": "hilam/python-framework", "path": "/app/http/providers/view.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return env.get_template(template + '.html').render(dictionary) # Blade Template Engine # file = file.read() # file = re.sub(r'(\s*)@if(\s*\(.*\))', r'{% if \2 %}', file) # file = re.sub(r'@endif', r'{% endif %}', file) # file = re.sub(r'@else', r'{% else %}', file) # tem...
code_fim
medium
{ "lang": "python", "repo": "hilam/python-framework", "path": "/app/http/providers/view.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Scarygami/aoc2020 path: /08/day8.py import os from collections import defaultdict currentdir = os.path.dirname(os.path.abspath(__file__)) def parse_input(filename): code = [] with open(filename) as f: lines = f.read().splitlines() for line in lines: ...
code_fim
medium
{ "lang": "python", "repo": "Scarygami/aoc2020", "path": "/08/day8.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> code = parse_input(filename) (_, acc, _) = execute(code) return acc def part2(filename): code = parse_input(filename) # Run once so we only need to check the jmps/nops that are actually visited (_, _, visited) = execute(code) for ip in visited: if code[i...
code_fim
hard
{ "lang": "python", "repo": "Scarygami/aoc2020", "path": "/08/day8.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ip = 0 acc = 0 visited = defaultdict(int) while visited[ip] == 0: visited[ip] = visited[ip] + 1 if code[ip][0] == "acc": acc = acc + code[ip][1] ip = ip + 1 elif code[ip][0] == "nop": ip = ip + 1 elif code[ip...
code_fim
hard
{ "lang": "python", "repo": "Scarygami/aoc2020", "path": "/08/day8.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if i < len(l[code]) - 1: if (l[code][i]+l[code][i+1]) not in check: check.append(l[code][i]+l[code][i+1]) print(len(check))<|fim_prefix|># repo: srijan-singh/CodeChef path: /Easy/Distinct Codes (DISTCODE)/distinct.py t = int(input()) l = [] for i in range(t): ...
code_fim
medium
{ "lang": "python", "repo": "srijan-singh/CodeChef", "path": "/Easy/Distinct Codes (DISTCODE)/distinct.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: srijan-singh/CodeChef path: /Easy/Distinct Codes (DISTCODE)/distinct.py t = int(input()) l = [] for i in range(t): a = input() l.append(a) f<|fim_suffix|> if i < len(l[code]) - 1: if (l[code][i]+l[code][i+1]) not in check: check.append(l[code][i]+l[c...
code_fim
medium
{ "lang": "python", "repo": "srijan-singh/CodeChef", "path": "/Easy/Distinct Codes (DISTCODE)/distinct.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: natestedman/Observatory path: /observatory/dashboard/fetch.py #! /usr/bin/env python # Copyright (c) 2010, individual contributors (see AUTHORS file) # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the ab...
code_fim
hard
{ "lang": "python", "repo": "natestedman/Observatory", "path": "/observatory/dashboard/fetch.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>this_dir = os.path.abspath(os.path.dirname(__file__)) blogs_script = os.path.join(this_dir, "fetch", "fetch_blogs.py") repos_script = os.path.join(this_dir, "fetch", "fetch_repositories.py") blogs = subprocess.Popen([python, blogs_script]) repos = subprocess.Popen([python, repos_script]) blogs.wait() re...
code_fim
medium
{ "lang": "python", "repo": "natestedman/Observatory", "path": "/observatory/dashboard/fetch.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> if self.botfront_test_regex.match(sender_id): return self.test_trackers.get(sender_id) last_index = self._get_last_index(sender_id) # retreive all new info since the last sync (given by last index) new_tracker_info = self._fetch_tracker(sender_id, last_index) ...
code_fim
hard
{ "lang": "python", "repo": "guilherme1guy/rasa-for-botfront", "path": "/rasa_addons/core/tracker_stores/botfront.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: guilherme1guy/rasa-for-botfront path: /rasa_addons/core/tracker_stores/botfront.py import logging import jsonpickle import requests import time import os import re from threading import Thread from rasa.core.tracker_store import TrackerStore from rasa.shared.core.trackers import DialogueStateTra...
code_fim
hard
{ "lang": "python", "repo": "guilherme1guy/rasa-for-botfront", "path": "/rasa_addons/core/tracker_stores/botfront.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> serialized_tracker = self._serialize_tracker_to_dict(canonical_tracker) sender_id = canonical_tracker.sender_id if self.botfront_test_regex.match(sender_id): self.test_trackers[sender_id] = canonical_tracker return serialized_tracker["events"] # call...
code_fim
hard
{ "lang": "python", "repo": "guilherme1guy/rasa-for-botfront", "path": "/rasa_addons/core/tracker_stores/botfront.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aiaudit-org/health-aiaudit-public path: /scripts/workers/code_upload_submission_worker.py import json import logging import os import signal import urllib.request import yaml from worker_utils import EvalAI_Interface from kubernetes import client # TODO: Add exception in all the commands from...
code_fim
hard
{ "lang": "python", "repo": "aiaudit-org/health-aiaudit-public", "path": "/scripts/workers/code_upload_submission_worker.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def install_gpu_drivers(api_instance): """Function to get the status of a running job on AWS EKS cluster Arguments: api_instance {[AWS EKS API object]} -- API object for creating deamonset """ logging.info("Installing Nvidia-GPU Drivers ...") link = "https://raw.githubuserconte...
code_fim
hard
{ "lang": "python", "repo": "aiaudit-org/health-aiaudit-public", "path": "/scripts/workers/code_upload_submission_worker.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": rospy.init_node("led_sub") sub = rospy.Subscriber('led_flash_str', String, string_check) rospy.spin()<|fim_prefix|># repo: koseking/robo_kadai path: /robo_kadai-master/scripts/flash_sub.py #!/usr/bin/env python import rospy from std_msgs.msg import String <|fim_m...
code_fim
medium
{ "lang": "python", "repo": "koseking/robo_kadai", "path": "/robo_kadai-master/scripts/flash_sub.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: koseking/robo_kadai path: /robo_kadai-master/scripts/flash_sub.py #!/usr/bin/env python import rospy from std_msgs.msg import String <|fim_suffix|> if __name__ == "__main__": rospy.init_node("led_sub") sub = rospy.Subscriber('led_flash_str', String, string_check) rospy.spin()<|fim_m...
code_fim
medium
{ "lang": "python", "repo": "koseking/robo_kadai", "path": "/robo_kadai-master/scripts/flash_sub.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ should be able to search for hashtags by their name and return 200 """ user = make_user() headers = make_authentication_headers_for_user(user) amount_of_hashtags_to_search_for = 5 for i in range(0, amount_of_hashtags_to_search_for): ...
code_fim
hard
{ "lang": "python", "repo": "OkunaOrg/okuna-api", "path": "/openbook_hashtags/tests/test_hashtags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ should not be able to search for a reported hashtag and return 200 """ user = make_user() headers = make_authentication_headers_for_user(user) hashtag_name = make_hashtag_name() hashtag = make_hashtag(name=hashtag_name) report_category ...
code_fim
hard
{ "lang": "python", "repo": "OkunaOrg/okuna-api", "path": "/openbook_hashtags/tests/test_hashtags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OkunaOrg/okuna-api path: /openbook_hashtags/tests/test_hashtags.py # Create your tests here. import random from django.urls import reverse from faker import Faker from rest_framework import status from openbook_common.tests.helpers import make_user, make_authentication_headers_for_user, make_ha...
code_fim
hard
{ "lang": "python", "repo": "OkunaOrg/okuna-api", "path": "/openbook_hashtags/tests/test_hashtags.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from alembic import op import sqlalchemy as sa def upgrade(): op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False, primary_key=True), sa.Column('name', sa.String(length=128), nullable=False), sa.Column('permissions_json', sa.Text(), nullable=False), sa.Column('descript...
code_fim
medium
{ "lang": "python", "repo": "xferra/ggrc-core", "path": "/src/ggrc_basic_permissions/migrations/versions/20130627032526_3bf5430a8c6f_add_roles_and_permis.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xferra/ggrc-core path: /src/ggrc_basic_permissions/migrations/versions/20130627032526_3bf5430a8c6f_add_roles_and_permis.py # Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Add roles and permissions tables Revision ID: 3bf5430a8c6...
code_fim
medium
{ "lang": "python", "repo": "xferra/ggrc-core", "path": "/src/ggrc_basic_permissions/migrations/versions/20130627032526_3bf5430a8c6f_add_roles_and_permis.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def upgrade(): op.create_table('roles', sa.Column('id', sa.Integer(), nullable=False, primary_key=True), sa.Column('name', sa.String(length=128), nullable=False), sa.Column('permissions_json', sa.Text(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('...
code_fim
medium
{ "lang": "python", "repo": "xferra/ggrc-core", "path": "/src/ggrc_basic_permissions/migrations/versions/20130627032526_3bf5430a8c6f_add_roles_and_permis.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(lng): numbers.append(int(input("Enter a number"))) print("validating...\n") validate(numbers) fill_list(int(input("Enter the list lenght...\n")))<|fim_prefix|># repo: antoniotorresz/python path: /py/Logical/validate_list.py #validate if all numbers are > n in a list n...
code_fim
hard
{ "lang": "python", "repo": "antoniotorresz/python", "path": "/py/Logical/validate_list.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antoniotorresz/python path: /py/Logical/validate_list.py #validate if all numbers are > n in a list numbers = [] is_valid = True <|fim_suffix|>def fill_list(lng): for i in range(lng): numbers.append(int(input("Enter a number"))) print("validating...\n") validate(numbers) f...
code_fim
hard
{ "lang": "python", "repo": "antoniotorresz/python", "path": "/py/Logical/validate_list.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cohesity/management-sdk-python path: /cohesity_management_sdk/models/create_remote_vault_search_job_parameters.py # -*- coding: utf-8 -*- # Copyright 2023 Cohesity Inc. import cohesity_management_sdk.models.vault_encryption_key class CreateRemoteVaultSearchJobParameters(object): """Implem...
code_fim
hard
{ "lang": "python", "repo": "cohesity/management-sdk-python", "path": "/cohesity_management_sdk/models/create_remote_vault_search_job_parameters.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> job_uids=None, cluster_id=None, cluster_match_string=None, encryption_keys=None, end_time_usecs=None, job_match_string=None, search_job_name=None, start_time_usecs=None, ...
code_fim
hard
{ "lang": "python", "repo": "cohesity/management-sdk-python", "path": "/cohesity_management_sdk/models/create_remote_vault_search_job_parameters.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def from_dictionary(cls, dictionary): """Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtained from the deserialization of the server's r...
code_fim
hard
{ "lang": "python", "repo": "cohesity/management-sdk-python", "path": "/cohesity_management_sdk/models/create_remote_vault_search_job_parameters.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: renovate-tests/pipelines path: /sdk/python/kfp/containers/entrypoint.py # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www....
code_fim
hard
{ "lang": "python", "repo": "renovate-tests/pipelines", "path": "/sdk/python/kfp/containers/entrypoint.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: uri: The uri holds the input artifact. metadata_file: The location of the metadata JSON file output by the producer step. output_name: The output name of the artifact in producer step. Raises: ValueError: when neither of the following is true: 1) uri ...
code_fim
hard
{ "lang": "python", "repo": "renovate-tests/pipelines", "path": "/sdk/python/kfp/containers/entrypoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_artifact(self) -> artifact.Artifact: """Gets an artifact object by parsing metadata or creating one from uri.""" if self.metadata_file and self.output_name: return entrypoint_utils.get_artifact_from_output( self.metadata_file, self.output_name) else: # Provide a...
code_fim
hard
{ "lang": "python", "repo": "renovate-tests/pipelines", "path": "/sdk/python/kfp/containers/entrypoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> cache_path = 'largecache/' feat_name = 'feat.dat' lbl_name = 'lbl.dat' feat_len = 4224 #1088 now = datetime.now() lbl_memmap = np.memmap(path.join(cache_path, lbl_name), dtype='uint8', mode='r') feat_memmap = np.memmap(path.join(cache_path, feat_name), dtype='float32', mode='r'...
code_fim
medium
{ "lang": "python", "repo": "erfannoury/SuperEdge", "path": "/Codes/SuperEdge/SuperEdge/train_classifier.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: erfannoury/SuperEdge path: /Codes/SuperEdge/SuperEdge/train_classifier.py import numpy as np from extract_feature import VGG16Extractor from poisson_disc import PoissonDiskSampler from datetime import datetime from bsds500 import BSDS from sklearn.externals import joblib import xgboost as xgb im...
code_fim
medium
{ "lang": "python", "repo": "erfannoury/SuperEdge", "path": "/Codes/SuperEdge/SuperEdge/train_classifier.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jphaser/encryptfinance path: /encryptfinance/flatpages_main/models.py from __future__ import absolute_import import os import random from django.utils.translation import gettext_lazy as _ from django.db.models import ( BooleanField, CharField, TextField, ImageField, ) <|fim_suf...
code_fim
medium
{ "lang": "python", "repo": "jphaser/encryptfinance", "path": "/encryptfinance/flatpages_main/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: verbose_name = "FAQ" verbose_name_plural = "FAQs" ordering = ["created"] def __str__(self): return self.question<|fim_prefix|># repo: jphaser/encryptfinance path: /encryptfinance/flatpages_main/models.py from __future__ import absolute_import import o...
code_fim
hard
{ "lang": "python", "repo": "jphaser/encryptfinance", "path": "/encryptfinance/flatpages_main/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: konradkonrad/raiden-service-bundle path: /build/synapse/render_config_template.py import json import os import random import string from pathlib import Path from urllib.error import URLError from urllib.request import urlopen PATH_CONFIG = Path("/config/synapse.yaml") PATH_CONFIG_TEMPLATE = Path...
code_fim
hard
{ "lang": "python", "repo": "konradkonrad/raiden-service-bundle", "path": "/build/synapse/render_config_template.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> content = {"m.server": f"{server_name}:443"} PATH_WELL_KNOWN_FILE.write_text(json.dumps(content, indent=2)) def main() -> None: url_known_federation_servers = os.environ.get( "URL_KNOWN_FEDERATION_SERVERS", URL_KNOWN_FEDERATION_SERVERS_DEFAULT ) server_name = os.environ["SERV...
code_fim
hard
{ "lang": "python", "repo": "konradkonrad/raiden-service-bundle", "path": "/build/synapse/render_config_template.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def render_well_known_file(server_name: str) -> None: content = {"m.server": f"{server_name}:443"} PATH_WELL_KNOWN_FILE.write_text(json.dumps(content, indent=2)) def main() -> None: url_known_federation_servers = os.environ.get( "URL_KNOWN_FEDERATION_SERVERS", URL_KNOWN_FEDERATION_S...
code_fim
hard
{ "lang": "python", "repo": "konradkonrad/raiden-service-bundle", "path": "/build/synapse/render_config_template.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paul-ollis/cleversheep3 path: /Prog/LazyImport.py """Paul's paten lazy import mechanism. TODO: """ import sys class Proxy: def __init__(self, name): object.__setattr__(self, "_name", name) object.__setattr__(self, "__getattribute__", Proxy._getattribute__) def __getat...
code_fim
medium
{ "lang": "python", "repo": "paul-ollis/cleversheep3", "path": "/Prog/LazyImport.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if name in sys.modules: return sys.modules[name] proxy = Proxy(name) sys.modules[name] = proxy lazy("zlib") import zlib print(zlib) print(dir(zlib)) print(zlib.compress)<|fim_prefix|># repo: paul-ollis/cleversheep3 path: /Prog/LazyImport.py """Paul's paten lazy import mechanism. ...
code_fim
medium
{ "lang": "python", "repo": "paul-ollis/cleversheep3", "path": "/Prog/LazyImport.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class Post(mixins.ReducedDateStartAndEndMixin, mixins.TimeTrackingMixin, mixins.OptionalLabelAndRoleMixin, models.Model): """ Information about a given Post that a Person hold within an Organization See: http://popoloproject.com/schemas/post.json """ organization = models.Fore...
code_fim
hard
{ "lang": "python", "repo": "texas/tx_people", "path": "/tx_people/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: texas/tx_people path: /tx_people/models.py from django.db import models from model_utils.managers import InheritanceManager from . import fields from . import mixins from .conf import settings class Race(models.Model): """ Custom ManyToMany field to handle race. Currently does no...
code_fim
hard
{ "lang": "python", "repo": "texas/tx_people", "path": "/tx_people/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RENCI/pdspi-fhir-example path: /ingest.py import argparse import os import json import requests import logging from tx.fhir.utils import bundle, unbundle from tx.logging.utils import getLogger from convert import mapping_pcornet_to_fhir from joblib import Parallel, delayed import contextlib impor...
code_fim
hard
{ "lang": "python", "repo": "RENCI/pdspi-fhir-example", "path": "/ingest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rescs = unbundle(obj).value nrescs = len(rescs) logger.debug(f"{nrescs} resources loaded") maxlen = 1024 for i in range(0, nrescs, maxlen): subrescs = rescs[i: min(i+maxlen, nrescs)] subobj = bundle(subrescs) logger.debug(f"ingest...
code_fim
hard
{ "lang": "python", "repo": "RENCI/pdspi-fhir-example", "path": "/ingest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>logger = getLogger(f"{__name__}{os.getpid()}", logging.INFO) def timeit(method): def timed(*args, **kwargs): logger = getLogger(f"{__name__}{os.getpid()}", logging.INFO) ts = time.time() result = method(*args, **kwargs) te = time.time() logger.info(f"{method.__...
code_fim
hard
{ "lang": "python", "repo": "RENCI/pdspi-fhir-example", "path": "/ingest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "{} {}".format(self.first_name, self.last_name) def __str__(self): return self.full_name<|fim_prefix|># repo: rattboi/musicbot path: /models/user.py from database import BaseModel from peewee import CharField, BooleanField class User(BaseModel): <|fim_middle|> id = CharFi...
code_fim
hard
{ "lang": "python", "repo": "rattboi/musicbot", "path": "/models/user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def username(self): return "{}{}".format(self.first_name.lower(), self.last_name.lower()).replace(" ", "") @property def full_name(self): return "{} {}".format(self.first_name, self.last_name) def __str__(self): return self.full_name<|fim_prefix|># r...
code_fim
medium
{ "lang": "python", "repo": "rattboi/musicbot", "path": "/models/user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rattboi/musicbot path: /models/user.py from database import BaseModel from peewee import CharField, BooleanField <|fim_suffix|> return "{} {}".format(self.first_name, self.last_name) def __str__(self): return self.full_name<|fim_middle|>class User(BaseModel): id = CharFi...
code_fim
hard
{ "lang": "python", "repo": "rattboi/musicbot", "path": "/models/user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: babusekaran/BDD-Step-Document-Generator path: /scripts/Step_Doc_Generator.py ''' Author : Babu Sekaran Description : This script collects all the steps added in your python step files inside the pointed directory. Note : BDD step implementation of lettuce, Behave, Squish ''' from os import li...
code_fim
hard
{ "lang": "python", "repo": "babusekaran/BDD-Step-Document-Generator", "path": "/scripts/Step_Doc_Generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): steps_dir = "D:\steps" if isdir(steps_dir) : pass else : raise LookupError("Add a valid step dirctory to proceed") a = BDD_step_collector(steps_dir) a.find_steps() step_json = [] for index , file , step in a.steps: #sj = {} #sj["step_file"] = str(file) #sj["step_index"] = str(ind...
code_fim
hard
{ "lang": "python", "repo": "babusekaran/BDD-Step-Document-Generator", "path": "/scripts/Step_Doc_Generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: colinmegill/web_learning_arduino_demo path: /io.py def parseLine(line): try: ID,led0,led1,led2,led3,relDistance = line.rstrip().split(' ') except: raise Exception('Incorrectly formatted input line: ' + line +'.\n' + 'Are you sure it has enough fi...
code_fim
medium
{ "lang": "python", "repo": "colinmegill/web_learning_arduino_demo", "path": "/io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: relDistance = float(relDistance) except: raise Exception('Relative distance ' + relDistance + ' cannot be interpreted as a float') return ID,currState,relDistance<|fim_prefix|># repo: colinmegill/web_learning_arduino_demo path: /io.py def parseLine(line): try: ...
code_fim
medium
{ "lang": "python", "repo": "colinmegill/web_learning_arduino_demo", "path": "/io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Charting(self,portfolio_coins,fixed_balance,allocation) #Update piechart with new values def update(val): def autopct_format(values): def my_format(pct): y= list(map(float, values)) total = sum(y) ...
code_fim
hard
{ "lang": "python", "repo": "thes3cr3t1/BinanceBalance", "path": "/binance-balance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def display_error(self, title, error, quit_on_exit=False): self.quit_on_exit = quit_on_exit self.top = tk.Toplevel() self.top.title('Login Error') msg = tk.Message(self.top, text=error) msg.grid(row=0, column=0) button = tk.Button(self.top, text="Dismiss...
code_fim
hard
{ "lang": "python", "repo": "thes3cr3t1/BinanceBalance", "path": "/binance-balance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thes3cr3t1/BinanceBalance path: /binance-balance.py up the new dialog window self.window = tk.Toplevel(self.master) self.window.geometry("1000x600") #Width x Height #Read the current portfolio allocations from allocation.csv #Do allocation.csv error checking ...
code_fim
hard
{ "lang": "python", "repo": "thes3cr3t1/BinanceBalance", "path": "/binance-balance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> trainer.step(opt.batch_size) # epoch finish logger.info('[Epoch {} finish]: total {} batches, use {} seconds, speed: {:.1f} s/batch'.format(epoch+1, i+1, time.time()-start_time, float((time....
code_fim
hard
{ "lang": "python", "repo": "helloholmes/dog_detection_gluoncv", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # --------------------rpn loss------------------------ rpn_score = rpn_score.squeeze(axis=-1) num_rpn_pos = (rpn_cls_targets >= 0).sum() rpn_loss1 = rpn_cls_loss(rpn_score, rpn_cls_targets, rpn_cls_targets>=0) * rpn_cls_targets.size / num_rpn...
code_fim
hard
{ "lang": "python", "repo": "helloholmes/dog_detection_gluoncv", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: helloholmes/dog_detection_gluoncv path: /main.py # coding:utf-8 ''' python 3.5 mxnet 1.3.0 gluoncv 0.3.0 visdom 0.1.7 gluonbook 0.6.9 auther: helloholmes ''' import mxnet as mx import numpy as np import os os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' import logging import time import pickle i...
code_fim
hard
{ "lang": "python", "repo": "helloholmes/dog_detection_gluoncv", "path": "/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gitter-badger/HWToolkit path: /hdl_toolkit/synthesizer/codeOps.py from operator import and_, or_ import types from hdl_toolkit.hdlObjects.operatorDefs import concatFn from hdl_toolkit.hdlObjects.specialValues import DIRECTION from hdl_toolkit.hdlObjects.typeShortcuts import hInt, vec from hdl_to...
code_fim
hard
{ "lang": "python", "repo": "gitter-badger/HWToolkit", "path": "/hdl_toolkit/synthesizer/codeOps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Connect src (signals/interfaces/values) to all destinations @param exclude: interfaces on any level on src or destinations which should be excluded from connection process @param fit: auto fit source width to destination width """ assignemnts = [] for dst ...
code_fim
hard
{ "lang": "python", "repo": "gitter-badger/HWToolkit", "path": "/hdl_toolkit/synthesizer/codeOps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: X5GON/lamapi path: /services/ordonize/continuouswikification2order/reordonize/core.py from components.dataconnection.index import get_experimental_features from x5gonwp3tools.tools.continuouswikification2order.continuouswikification2order import reordonize from SETTINGS import EXP_IDS <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "X5GON/lamapi", "path": "/services/ordonize/continuouswikification2order/reordonize/core.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> cands_cwk = get_experimental_features(candidate_ids, [__DEFAULT_EXPID_SETTING["SIMPLE"]]) res_cwk = get_experimental_features([resource_id], [__DEFAULT_EXPID_SETTING["SIMPLE"]]) res_cwk = [s['result']['value'] for s in res_cwk] res_cwk = res_cwk[0] try: res = {} for c i...
code_fim
medium
{ "lang": "python", "repo": "X5GON/lamapi", "path": "/services/ordonize/continuouswikification2order/reordonize/core.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> id_ = "foo" message = job_pb2.Job(id=id_) j = Job._from_proto(message) job_state = job_pb2.Job.State( stage=job_pb2.Job.Stage.FAILED, error=job_pb2.Job.Error(code=errors_pb2.ERROR_UNKNOWN), ) stub.return_value.WatchJob.return_value ...
code_fim
hard
{ "lang": "python", "repo": "huesos85/descarteslabs-python", "path": "/descarteslabs/workflows/models/tests/test_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_unmarshal_primitive(self, stub): marshalled = (1, 2, True, None) job = Job._from_proto( job_pb2.Job( id="foo", state=job_pb2.Job.State(stage=job_pb2.Job.Stage.SUCCEEDED), type=types_pb2.List, ) ) ...
code_fim
hard
{ "lang": "python", "repo": "huesos85/descarteslabs-python", "path": "/descarteslabs/workflows/models/tests/test_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: huesos85/descarteslabs-python path: /descarteslabs/workflows/models/tests/test_job.py import json import pytest import mock import pyarrow as pa import responses from descarteslabs.workflows.client import Client from descarteslabs.common.proto.errors import errors_pb2 from descarteslabs.common...
code_fim
hard
{ "lang": "python", "repo": "huesos85/descarteslabs-python", "path": "/descarteslabs/workflows/models/tests/test_job.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sureddy/scheduler-api path: /scheduler/__init__.py from flask import Flask, jsonify from .job import blueprint as job from .resources.cwl import CWLLibrary from logging import log_request, log_response_code from errors import APIError from models.driver import SQLAlchemyDriver app = Flask(__name...
code_fim
medium
{ "lang": "python", "repo": "sureddy/scheduler-api", "path": "/scheduler/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @app.route('/') def root(): return jsonify({'job endpoint': '/jobs'}) @app.errorhandler(APIError) def user_error(e): if hasattr(e, 'json') and e.json: return jsonify(**e.json), e.code else: return jsonify(message=e.message), e.code<|fim_prefix|># repo: sureddy/scheduler-api ...
code_fim
medium
{ "lang": "python", "repo": "sureddy/scheduler-api", "path": "/scheduler/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Save raw data section inside the result file save_raw_data='yes' # Analyze all logs, another option for this parameter is: osp_logs_only log_type='all_logs' # Directories on Undercloud host that are going to be analyzed undercloud_logs = ['/var/log','/home/stack','/usr/share/','/var/lib/']<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "zahlabut/LogTool", "path": "/Plugin_For_Infrared_Python3/Params.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Path to OSP logs on Undercloud undercloud_logs_dir = ['/var/log/containers','/home/stack'] # SSH credentials used for connection to Overcloud nodes overcloud_ssh_user = 'heat-admin' overcloud_ssh_key = '/home/stack/.ssh/id_rsa' overcloud_home_dir = '/home/' + overcloud_ssh_user + '/' # Path to source ...
code_fim
medium
{ "lang": "python", "repo": "zahlabut/LogTool", "path": "/Plugin_For_Infrared_Python3/Params.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zahlabut/LogTool path: /Plugin_For_Infrared_Python3/Params.py # Copyright 2018 Arkady Shtempler. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apac...
code_fim
hard
{ "lang": "python", "repo": "zahlabut/LogTool", "path": "/Plugin_For_Infrared_Python3/Params.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: freyes/hotsos path: /plugins/openstack/parts/agent_exceptions.py #!/usr/bin/python3 import os import re from common import ( constants, plugin_yaml, ) from common.searchtools import ( FilterDef, SearchDef, FileSearcher, ) from openstack_common import ( AgentChecksBase, ...
code_fim
hard
{ "lang": "python", "repo": "freyes/hotsos", "path": "/plugins/openstack/parts/agent_exceptions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @param include_time_in_key: (bool) whether to include time of exception in output. Default is to only show date. """ agent_exceptions = {} for result in results: exc_tag = result.get(3) if exc_tag not in agent_exce...
code_fim
hard
{ "lang": "python", "repo": "freyes/hotsos", "path": "/plugins/openstack/parts/agent_exceptions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._exception_exprs[svc] = [] self._exception_exprs[svc] += svc_info["exceptions_base"] self._exception_exprs[svc] += a_excs # Add service dependecy/lib/client exceptions if svc == "cinder" or svc == "barbican": # This is a cli...
code_fim
hard
{ "lang": "python", "repo": "freyes/hotsos", "path": "/plugins/openstack/parts/agent_exceptions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: peaceiris/emoji-ime-dictionary path: /main.py import json from janome.tokenizer import Tokenizer from pykakasi import kakasi import re t = Tokenizer() kakasi = kakasi() kakasi.setMode("J","H") conv_j2h = kakasi.getConverter() kakasi.setMode("K","H") conv_k2h = kakasi.getConverter() <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "peaceiris/emoji-ime-dictionary", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": EMOJI_JSON_PATH = '/root/emoji_ja.json' EMOJI_DICT_PATH = 'tsv/emoji.tsv' emoji_dict = EmojiDict(EMOJI_JSON_PATH, EMOJI_DICT_PATH) emoji_dict.get_emoji_json() emoji_dict.create_emoji_dict() emoji_dict.save_emoji_dict()<|fim_prefix|># repo: peaceiris/emoj...
code_fim
hard
{ "lang": "python", "repo": "peaceiris/emoji-ime-dictionary", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: automl/NASLib path: /tutorial/zc_intro.py ##################################################### ################# START NEW CELL #################### from naslib.predictors import ZeroCost from naslib.search_spaces import NasBench201SearchSpace from naslib.utils import get_train_val_loaders, get...
code_fim
hard
{ "lang": "python", "repo": "automl/NASLib", "path": "/tutorial/zc_intro.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>##################################################### ################# START NEW CELL #################### from naslib.utils import get_zc_benchmark_api zc_api = get_zc_benchmark_api('nasbench201', 'cifar10') graph = models[0] # Use the Zero Cost Benchmark to get the score for the model for a particul...
code_fim
hard
{ "lang": "python", "repo": "automl/NASLib", "path": "/tutorial/zc_intro.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> models.append(graph) print('Querying validation performance for all models') for graph in tqdm(models): acc = graph.query(metric=Metric.VAL_ACCURACY, dataset='cifar10', dataset_api=api) val_accs.append(acc) zc_predictor = ZeroCost(method_type='jacov') print('Scoring the models using Zero Co...
code_fim
hard
{ "lang": "python", "repo": "automl/NASLib", "path": "/tutorial/zc_intro.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if data.data == 'open': self.gripper.open() elif data.data == 'close': self.gripper.close() elif data.data == 'softGrip': self.gripper.set_soft_grip() elif data.data == 'strongGrip': self.gripper.set_strong_grip() if __name_...
code_fim
hard
{ "lang": "python", "repo": "kolaszko/ur_rg2_gripper", "path": "/scripts/gripper_node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kolaszko/ur_rg2_gripper path: /scripts/gripper_node.py #!/usr/bin/env python import rospy from gripper import Gripper from std_msgs.msg import String <|fim_suffix|> def callback(self, data): if data.data == 'open': self.gripper.open() elif data.data == 'close': ...
code_fim
hard
{ "lang": "python", "repo": "kolaszko/ur_rg2_gripper", "path": "/scripts/gripper_node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: python-monero/monero-python path: /monero/transaction.py import re import sys import warnings from decimal import Decimal from .address import address from .numbers import PaymentID, from_atomic class Payment(object): """ A payment base class, representing payment not associated with any...
code_fim
hard
{ "lang": "python", "repo": "python-monero/monero-python", "path": "/monero/transaction.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.account_idx = account_idx self.backend = backend self.direction = direction def __call__(self, **filterparams): fetch = self.backend.transfers_in if self.direction == 'in' else self.backend.transfers_out return fetch(self.account_idx, PaymentFilter(**filte...
code_fim
hard
{ "lang": "python", "repo": "python-monero/monero-python", "path": "/monero/transaction.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pass def init_model(self, module_str): model = resolve_model_dynamically(module_str) assert model is not None self.model = model<|fim_prefix|># repo: hacktoolkit/django-htk path: /services.py # HTK Imports from htk.utils import resolve_model_dynamically <|fim_middl...
code_fim
medium
{ "lang": "python", "repo": "hacktoolkit/django-htk", "path": "/services.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = resolve_model_dynamically(module_str) assert model is not None self.model = model<|fim_prefix|># repo: hacktoolkit/django-htk path: /services.py # HTK Imports from htk.utils import resolve_model_dynamically <|fim_middle|>class HtkBaseService(object): def __init__(s...
code_fim
medium
{ "lang": "python", "repo": "hacktoolkit/django-htk", "path": "/services.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hacktoolkit/django-htk path: /services.py # HTK Imports from htk.utils import resolve_model_dynamically class HtkBaseService(object): def __init__(self, *args, **kwargs): <|fim_suffix|> assert model is not None self.model = model<|fim_middle|> pass def init_model...
code_fim
medium
{ "lang": "python", "repo": "hacktoolkit/django-htk", "path": "/services.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Continuous-Delivery-Machines/raqcrawl path: /src/main/python/sqs_queue_capsuling.py """Encapsulate SQS.Queue calls.""" import json import boto3 def dict_for_message(message): body_d = json.loads(message.body) message.body_dict = body_d message.body_raw = message.body return me...
code_fim
hard
{ "lang": "python", "repo": "Continuous-Delivery-Machines/raqcrawl", "path": "/src/main/python/sqs_queue_capsuling.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def write_message(self, message_dict: dict, message_attributes_dict: dict = {}): """Writes the provided dict JSON-encoded into the Msg Queue.""" msg_body = json.dumps(message_dict) response = self._msq_queue.send_message( MessageBody=msg_body, DelaySecon...
code_fim
hard
{ "lang": "python", "repo": "Continuous-Delivery-Machines/raqcrawl", "path": "/src/main/python/sqs_queue_capsuling.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- knowledge_length : int the length of the background knowledge that we want to simulate. The length of the background knowledge specifies the amount of knowledge that the adversary will use for her attack. For each individual all the combinations of...
code_fim
hard
{ "lang": "python", "repo": "scikit-mobility/scikit-mobility", "path": "/skmob/privacy/attacks.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: scikit-mobility/scikit-mobility path: /skmob/privacy/attacks.py or each individual all the combinations of points of length k will be evaluated. Attributes ---------- knowledge_length : int the length of the background knowledge that we want to simulate. Examples...
code_fim
hard
{ "lang": "python", "repo": "scikit-mobility/scikit-mobility", "path": "/skmob/privacy/attacks.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: scikit-mobility/scikit-mobility path: /skmob/privacy/attacks.py st. Technol. 9, 3, Article 31 (December 2017), 27 pages. DOI: https://doi.org/10.1145/3106774 .. [MOB2018] Roberto Pellungrini, Luca Pappalardo, Francesca Pratesi, Anna Monreale: Analyzing Privacy Risk in Human Mobility Data. STA...
code_fim
hard
{ "lang": "python", "repo": "scikit-mobility/scikit-mobility", "path": "/skmob/privacy/attacks.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cossio/ProteoPy path: /bin/uniprot.prot.py #!/usr/bin/env python import sys import argparse import ProteoPy PARSER = argparse.ArgumentParser(description='Get basic information from Uniprot from a list of Uniprot IDs') PARSER.add_argument('--prots', type=str, help='list of proteins') PARSER.ad...
code_fim
hard
{ "lang": "python", "repo": "cossio/ProteoPy", "path": "/bin/uniprot.prot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for pid in names.split(';'): pid = pid.rstrip() if ARGS.mass or ARGS.length: try: mass, length = SERV.uniprot_data(pid) except KeyboardInterrupt: raise except: Proteo...
code_fim
medium
{ "lang": "python", "repo": "cossio/ProteoPy", "path": "/bin/uniprot.prot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lvfuqing/EDSR-tensorflow-1 path: /data_prepare.py import cv2 import os import random IMAGE_WIDTH = 320 IMAGE_HEIGHT = 480 CUT_IMAGE_NUM = 5 FACTOR = 1 / 2 class DataProcessor(object): def cut_for_train(self, from_path, dest_path): if not os.path.exists(from_path): retur...
code_fim
hard
{ "lang": "python", "repo": "Lvfuqing/EDSR-tensorflow-1", "path": "/data_prepare.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> image = cv2.resize( image, (int(height * FACTOR), int(width * FACTOR)), interpolation=cv2.INTER_CUBIC, ) cv2.imwrite(os.path.join(dest_path, file), image) if __name__ == "__main__": data_processor = DataProcessor() ...
code_fim
hard
{ "lang": "python", "repo": "Lvfuqing/EDSR-tensorflow-1", "path": "/data_prepare.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> populate_db(model.TableBase.metadata, model.session) alembic_cfg = Config(alembic_ini_path) command.stamp(alembic_cfg, 'head') generate_ca(conf) # XXX: This may be bad juju transaction.commit()<|fim_prefix|># repo: setheus/floof path: /bin/setup-floof.py """Setup the floof applic...
code_fim
hard
{ "lang": "python", "repo": "setheus/floof", "path": "/bin/setup-floof.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: setheus/floof path: /bin/setup-floof.py """Setup the floof application""" import logging import os import transaction import sys from alembic import command from alembic.config import Config from paste.deploy import appconfig from sqlalchemy import engine_from_config from zope.sqlalchemy import ...
code_fim
hard
{ "lang": "python", "repo": "setheus/floof", "path": "/bin/setup-floof.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }