text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: managedkaos/AWS-Python-Boto3 path: /rds/delete_db_instance.py #!/usr/bin/env python # a script to delete an rds instance <|fim_suffix|># create an rds client rds = boto3.client('rds') try: # delete the instance and catch the response response = rds.delete_db_instance( DBInstance...
code_fim
medium
{ "lang": "python", "repo": "managedkaos/AWS-Python-Boto3", "path": "/rds/delete_db_instance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># create an rds client rds = boto3.client('rds') try: # delete the instance and catch the response response = rds.delete_db_instance( DBInstanceIdentifier=db, SkipFinalSnapshot=True) # print the response if there are no exceptions print response # if there is an exceptio...
code_fim
medium
{ "lang": "python", "repo": "managedkaos/AWS-Python-Boto3", "path": "/rds/delete_db_instance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ebrahimebrahim/wordgen2 path: /phonological_embedding.py import numpy as np import pickle class PhonologicalEmbedding(object): """ Manages conversion of phoible ipa segments to points in euclidean space. Points tend to be close when those ipa segments tend to be allophones. T...
code_fim
hard
{ "lang": "python", "repo": "ebrahimebrahim/wordgen2", "path": "/phonological_embedding.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ipa_seg (string) : a single unicode ipa segment as would appear in phoible or as could be output by epitran segs (iterable of strings) : set of segments in which to search for nearest neighbor Returns string, the element of segs which is nearest to ipa_se...
code_fim
hard
{ "lang": "python", "repo": "ebrahimebrahim/wordgen2", "path": "/phonological_embedding.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def epitran_to_phoible(self,epitran_ipa): phoible_ipa = epitran_ipa for a,b in PhonologicalEmbedding.__epitran_phoible_replacements.items(): phoible_ipa = phoible_ipa.replace(a,b) return phoible_ipa def to_phoible_fts(self,ipa_seg): """ Convert a singl...
code_fim
hard
{ "lang": "python", "repo": "ebrahimebrahim/wordgen2", "path": "/phonological_embedding.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _attr_device_class = SensorDeviceClass.TEMPERATURE _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS def __init__(self, name, mon): """Initialize a sensor.""" self.mon = mon self._name = name @property def name(self): """Return the name of t...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/skybeacon/sensor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/skybeacon/sensor.py """Support for Skybeacon temperature/humidity Bluetooth LE sensors.""" from __future__ import annotations import logging import threading from uuid import UUID from pygatt import BLEAddressType from pygatt.backends import C...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/skybeacon/sensor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def extra_state_attributes(self): """Return the state attributes of the sensor.""" return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1} class Monitor(threading.Thread, SensorEntity): """Connection handling.""" def __init__(self, hass, mac, name): """Constru...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/skybeacon/sensor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return(self.arguments.get('--category_groups', None)) def _category_groups_slug(self): category_groups = 'all-categories' if self.category_groups: category_groups = self.category_groups.replace(',', '-') return(category_groups) @property def file(s...
code_fim
hard
{ "lang": "python", "repo": "otrenav/tabelog-scrapy", "path": "/helpers/arguments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: otrenav/tabelog-scrapy path: /helpers/arguments.py # -*- coding: utf-8 -*- import sys import datetime import constants class Arguments(object): SCRAPY_DIRECTORY = './scrapy/' SCRAPY_COMMAND = 'scrapy crawl restaurants -o ' DATE = datetime.datetime.now().strftime('%Y-%m-%d') d...
code_fim
hard
{ "lang": "python", "repo": "otrenav/tabelog-scrapy", "path": "/helpers/arguments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: topiaruss/django-kronos path: /kronos/settings.py import os import sys from django.conf import settings KRONOS_PYTHON = getattr(settings, 'KRONOS_PYTHON', sys.executable) KRONOS_MAN<|fim_suffix|>) PROJECT_MODULE = sys.modules['.'.join(settings.SETTINGS_MODULE.split('.')[:-1])] KRONOS_POSTFIX = ...
code_fim
medium
{ "lang": "python", "repo": "topiaruss/django-kronos", "path": "/kronos/settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>) PROJECT_MODULE = sys.modules['.'.join(settings.SETTINGS_MODULE.split('.')[:-1])] KRONOS_POSTFIX = getattr(settings, 'KRONOS_POSTFIX', '') KRONOS_PREFIX = getattr(settings, 'KRONOS_PREFIX', '') KRONOS_ENV = '\n'.join(getattr(settings, 'KRONOS_ENV', '').split('\\n'))<|fim_prefix|># repo: topiaruss/django-...
code_fim
medium
{ "lang": "python", "repo": "topiaruss/django-kronos", "path": "/kronos/settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shiroyuki/tama path: /tama/wsrpc.py import re import sys import time from tori.centre import settings as app_settings from tornado import gen from tama.service import NotFoundError class GhostCensor(object): def __init__(self, broadcaster): self.broadcaster = broadcaster def...
code_fim
hard
{ "lang": "python", "repo": "shiroyuki/tama", "path": "/tama/wsrpc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response.update({ 'error': False, 'name': fs_node.name, 'path': fs_node.referred_path, 'type': fs_node.mimetype, 'data': fs_node.content, 'is_dir': fs_node.is_dir, 'is_file': fs_node.is...
code_fim
hard
{ "lang": "python", "repo": "shiroyuki/tama", "path": "/tama/wsrpc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># all the commands to run print("Going to run following commands (%d):" % (len(commands))) for command in commands: print("-", command) # run all commands parallel.run(commands)<|fim_prefix|># repo: mvdwerve/price-representation-research path: /train_all.py import parallel loss = [ "InfoNCE", ...
code_fim
hard
{ "lang": "python", "repo": "mvdwerve/price-representation-research", "path": "/train_all.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mvdwerve/price-representation-research path: /train_all.py import parallel loss = [ "InfoNCE", "VAE", "BCE-Movement", "BCE-Up-Movement", "BCE-Anomaly", "BCE-Future-Anomaly", ] bars = ["time", "volume", "dollars"] commands = [] <|fim_suffix|># all the commands to run pri...
code_fim
hard
{ "lang": "python", "repo": "mvdwerve/price-representation-research", "path": "/train_all.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [path("metrics", exports.ExportToDjangoView, name="prometheus-django-metrics")]<|fim_prefix|># repo: korfuri/django-prometheus path: /django_prometheus/urls.py from django.urls import path <|fim_middle|>from django_prometheus import exports
code_fim
easy
{ "lang": "python", "repo": "korfuri/django-prometheus", "path": "/django_prometheus/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: korfuri/django-prometheus path: /django_prometheus/urls.py from django.urls import path <|fim_suffix|>urlpatterns = [path("metrics", exports.ExportToDjangoView, name="prometheus-django-metrics")]<|fim_middle|>from django_prometheus import exports
code_fim
easy
{ "lang": "python", "repo": "korfuri/django-prometheus", "path": "/django_prometheus/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ws1hope/self-supervised_change_detetction path: /train_DSFA.py from __future__ import print_function import os import time import torch import matplotlib.pyplot as plt import numpy as np import argparse from torch.utils.data import DataLoader from utils.util import adjust_learning_rate,...
code_fim
hard
{ "lang": "python", "repo": "ws1hope/self-supervised_change_detetction", "path": "/train_DSFA.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): # parse the args args = parse_option() # set flags for GPU processing if available if torch.cuda.is_available(): args.use_gpu = True args.device = 'cuda' else: args.use_gpu = False args.device = 'cpu' # set the data load...
code_fim
hard
{ "lang": "python", "repo": "ws1hope/self-supervised_change_detetction", "path": "/train_DSFA.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': parser = argparse.ArgumentParser() requiredNamed = parser.add_argument_group('required named arguments') requiredNamed.add_argument('--inputPath', dest='dataset', metavar='dataset.sparql', help='sparql dat...
code_fim
hard
{ "lang": "python", "repo": "DeNederlandscheBank/nqm", "path": "/src/splitter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dataset_file = os.path.splitext(args.dataset)[0] query_file = dataset_file + '-train_val' + ".ql" nl_file = dataset_file + '-train_val' + ".nl" out_dir = os.path.splitext(args.outdir)[0] train_split = int(args.split) try: assert 1 < train_split <= 100 except AssertionEr...
code_fim
hard
{ "lang": "python", "repo": "DeNederlandscheBank/nqm", "path": "/src/splitter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DeNederlandscheBank/nqm path: /src/splitter.py #!/usr/bin/env python """ Split data set intro training and validation part. Jan-Marc Glowienke, Intern at De Nederlandsche Bank 2021 """ import argparse import io import os from sklearn.model_selection import train_test_split def split_datasets(...
code_fim
hard
{ "lang": "python", "repo": "DeNederlandscheBank/nqm", "path": "/src/splitter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tokens = [token for token in nlp(text) if not token.is_stop] return [token.norm_ for token in tokens]<|fim_prefix|># repo: dbradf/disaster-tweets path: /src/disaster_tweets/tokenizer.py from typing import List import spacy nlp = spacy.load("en") <|fim_middle|> def tokenize(text: str) -> List[st...
code_fim
easy
{ "lang": "python", "repo": "dbradf/disaster-tweets", "path": "/src/disaster_tweets/tokenizer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dbradf/disaster-tweets path: /src/disaster_tweets/tokenizer.py from typing import List import spacy <|fim_suffix|>def tokenize(text: str) -> List[str]: tokens = [token for token in nlp(text) if not token.is_stop] return [token.norm_ for token in tokens]<|fim_middle|>nlp = spacy.load("en"...
code_fim
easy
{ "lang": "python", "repo": "dbradf/disaster-tweets", "path": "/src/disaster_tweets/tokenizer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> r = list_schedules(testclient, 20, "createdAt") assert r.outputs return r.raw_response def get_schedule_tester(testclient, schedule_id): from Opsgeniev2 import get_schedule r = get_schedule(testclient, schedule_id) assert r.outputs return r.raw_response def get_on_call_tes...
code_fim
hard
{ "lang": "python", "repo": "demisto/content", "path": "/Packs/Opsgeniev2/Integrations/Opsgeniev2/Opsgeniev2_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: demisto/content path: /Packs/Opsgeniev2/Integrations/Opsgeniev2/Opsgeniev2_test.py import pytest import os from Opsgeniev2 import Client import json from unittest.mock import call """ Test script for the OpsGenieV2 Integration Envvars: API_TOKEN: If configured, runs integration tests. G...
code_fim
hard
{ "lang": "python", "repo": "demisto/content", "path": "/Packs/Opsgeniev2/Integrations/Opsgeniev2/Opsgeniev2_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def list_schedule_tester(testclient): from Opsgeniev2 import list_schedules r = list_schedules(testclient, 20, "createdAt") assert r.outputs return r.raw_response def get_schedule_tester(testclient, schedule_id): from Opsgeniev2 import get_schedule r = get_schedule(testclient,...
code_fim
hard
{ "lang": "python", "repo": "demisto/content", "path": "/Packs/Opsgeniev2/Integrations/Opsgeniev2/Opsgeniev2_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bqmoreland/EASwift path: /algs2e_python/Chapter 05/python/circular_queue.py import random import tkinter as tk import tkinter.font as tk_font from tkinter import messagebox class DrawingCanvas(): """ A canvas drawing manager.""" def __init__(self, canvas, wxmin, wymin, wxmax, wy...
code_fim
hard
{ "lang": "python", "repo": "bqmoreland/EASwift", "path": "/algs2e_python/Chapter 05/python/circular_queue.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Make a font for drawing. self.label_font = tk_font.Font(family="Times New Roman", size=12) # Draw the initial queue. self.draw_queue() # Force focus so Alt+F4 closes this window and not the Python shell. self.item_entry.focus_force() self...
code_fim
hard
{ "lang": "python", "repo": "bqmoreland/EASwift", "path": "/algs2e_python/Chapter 05/python/circular_queue.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pemukl/german-bertabs path: /utils_nlp/models/xlnet/common.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # This script reuses some code from # https://github.com/huggingface/transformers/blob/master/examples/utils_glue.py from enum import Enum ...
code_fim
hard
{ "lang": "python", "repo": "pemukl/german-bertabs", "path": "/utils_nlp/models/xlnet/common.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tokens = tokens_a + [sep_token] segment_ids = [sequence_a_segment_id] * len(tokens) if cls_token_at_end: tokens = tokens + [cls_token] segment_ids = segment_ids + [cls_token_segment_id] else: tokens = [cls_tok...
code_fim
hard
{ "lang": "python", "repo": "pemukl/german-bertabs", "path": "/utils_nlp/models/xlnet/common.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dask/dask-image path: /dask_image/ndfilters/_smooth.py # -*- coding: utf-8 -*- import scipy.ndimage from ..dispatch._dispatch_ndfilters import dispatch_uniform_filter from . import _utils from ._gaussian import gaussian_filter __all__ = [ "uniform_filter", ] <|fim_suffix|>@_utils._update...
code_fim
medium
{ "lang": "python", "repo": "dask/dask-image", "path": "/dask_image/ndfilters/_smooth.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> result = image.map_overlap( dispatch_uniform_filter(image), depth=depth, boundary=boundary, dtype=image.dtype, meta=image._meta, size=size, mode=mode, cval=cval, origin=origin ) return result<|fim_prefix|># repo: dask/das...
code_fim
hard
{ "lang": "python", "repo": "dask/dask-image", "path": "/dask_image/ndfilters/_smooth.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def _test_partial_sum_to_broadcast( test_case, src_device_type, dst_device_type, src_device_num, dst_device_num ): flow.clear_default_session() flow.config.gpu_device_num(4) func_config = flow.FunctionConfig() func_config.default_data_type(flow.float) func_config.default_logical_vi...
code_fim
hard
{ "lang": "python", "repo": "ashing-zhang/oneflow", "path": "/oneflow/python/test/ops/test_boxing_v2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @flow.global_function(function_config=func_config) def multi_lbi_job(x: oft.Numpy.Placeholder((96, 96, 96))): with flow.scope.placement(src_device_type, "0:0-" + str(src_device_num - 1)): src_s0 = flow.identity(x.with_distribute(flow.distribute.split(0))) src_s1 = f...
code_fim
hard
{ "lang": "python", "repo": "ashing-zhang/oneflow", "path": "/oneflow/python/test/ops/test_boxing_v2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ashing-zhang/oneflow path: /oneflow/python/test/ops/test_boxing_v2.py """ Copyright 2020 The OneFlow Authors. All rights reserved. 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...
code_fim
hard
{ "lang": "python", "repo": "ashing-zhang/oneflow", "path": "/oneflow/python/test/ops/test_boxing_v2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: siqueiralex/topic-coherence path: /Topic_Evaluator/api/observed_coherence.py """ Author: Jey Han Lau Date: May 2013 """ import sys import operator import math import codecs import numpy as np from collections import defaultdict from .models import WordCount def topic_coherence...
code_fim
hard
{ "lang": "python", "repo": "siqueiralex/topic-coherence", "path": "/Topic_Evaluator/api/observed_coherence.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def model_coherence(topics, metric, topns): #read the topic file and compute the observed coherence top_coherence = defaultdict(list) # {topicid: [tc]} topic_tw = {} #{topicid: topN_topicwords} for topic_id, line in enumerate(topics): topic_list = line.split()[:max(topns)] ...
code_fim
hard
{ "lang": "python", "repo": "siqueiralex/topic-coherence", "path": "/Topic_Evaluator/api/observed_coherence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if urls is None or len(urls) == 0: return for url in urls: self.add_new_url(url) def get_new_url(self): new_url = self.new_urls.pop() self.old_urls.add(new_url) return new_url def new_url_size(self): return self.new_urls.__l...
code_fim
hard
{ "lang": "python", "repo": "mysodalife/spider_program", "path": "/chapter6/URLManager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self.new_urls = set() self.old_urls = set() def has_new_urls(self): return self.new_url_size() != 0 def add_new_url(self, url): if url is None: return if url not in self.new_urls and url not in self.old_urls: ...
code_fim
medium
{ "lang": "python", "repo": "mysodalife/spider_program", "path": "/chapter6/URLManager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mysodalife/spider_program path: /chapter6/URLManager.py # -*- coding: utf-8 -*- # @Time : 2018/10/13 10:00 # @Author : sodalife # @File : URLManager.py # @Description : URL调度器(负责存储已抓取和未抓取的URL) class URLManager(object): def __init__(self): self.new_urls = set(...
code_fim
hard
{ "lang": "python", "repo": "mysodalife/spider_program", "path": "/chapter6/URLManager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: project-star/h path: /h/migrations/versions/2494fea98d2d_add_the_token_table.py """Add the token table. Revision ID: 2494fea98d2d Revises: 4886d7a14074 Create Date: 2016-02-15 11:20:00.787358 """ <|fim_suffix|>def upgrade(): token_table = op.create_table( 'token', sa.Column...
code_fim
hard
{ "lang": "python", "repo": "project-star/h", "path": "/h/migrations/versions/2494fea98d2d_add_the_token_table.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> token_table = op.create_table( 'token', sa.Column('created', sa.DateTime, server_default=sa.func.now(), nullable=False), sa.Column('updated', sa.DateTime, server_default=sa.func.now(), ...
code_fim
hard
{ "lang": "python", "repo": "project-star/h", "path": "/h/migrations/versions/2494fea98d2d_add_the_token_table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "<Uninstall {} ({})>".format( self.package.pretty_name, self.format_version(self.package) )<|fim_prefix|># repo: wagnerluis1982/poetry path: /src/poetry/installation/operations/uninstall.py from typing import TYPE_CHECKING from typing import Optional from poetry.instal...
code_fim
hard
{ "lang": "python", "repo": "wagnerluis1982/poetry", "path": "/src/poetry/installation/operations/uninstall.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wagnerluis1982/poetry path: /src/poetry/installation/operations/uninstall.py from typing import TYPE_CHECKING from typing import Optional from poetry.installation.operations.operation import Operation if TYPE_CHECKING: from poetry.core.packages.package import Package class Uninstall(Oper...
code_fim
hard
{ "lang": "python", "repo": "wagnerluis1982/poetry", "path": "/src/poetry/installation/operations/uninstall.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, jid, password, nick): JoinTestMUCBot.__init__(self, jid, password, nick) def participant_offline(self, presence): if presence['muc'].getNick() == SECOND_BOT: self.disconnect() class SecondBot(JoinTestMUCBot): def __init__(self, jid, password, ...
code_fim
medium
{ "lang": "python", "repo": "allan-simon/xmpp-conformance-suite", "path": "/xep-0045/iq_admin_set_role_from_moderator_to_owner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: allan-simon/xmpp-conformance-suite path: /xep-0045/iq_admin_set_role_from_moderator_to_owner.py from sleekxmpp.exceptions import IqError from sleekxmpp.exceptions import IqTimeout from ConformanceUtils import init_test from ConformanceUtils import print_test_description from config import OWNER...
code_fim
hard
{ "lang": "python", "repo": "allan-simon/xmpp-conformance-suite", "path": "/xep-0045/iq_admin_set_role_from_moderator_to_owner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CenterForOpenScience/osf.io path: /osf/metadata/serializers/datacite/datacite_json.py import json from osf.metadata.serializers import _base from .datacite_tree_walker import DataciteTreeWalker def _visit_tree_branch_json(parent, child_name: str, *, is_list=False, text=None, attrib=None): ...
code_fim
hard
{ "lang": "python", "repo": "CenterForOpenScience/osf.io", "path": "/osf/metadata/serializers/datacite/datacite_json.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return json.dumps( self.metadata_as_dict(), indent=2, sort_keys=True, ) def metadata_as_dict(self) -> dict: root_dict = {} walker = DataciteTreeWalker(self.basket, root_dict, _visit_tree_branch_json) walker.walk(doi_override=...
code_fim
medium
{ "lang": "python", "repo": "CenterForOpenScience/osf.io", "path": "/osf/metadata/serializers/datacite/datacite_json.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: awslabs/aws-service-catalog-factory path: /servicecatalog_factory/workflow/portfolios/create_portfolio_task_test.py # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from unittest import skip from servicecatalog_factory.workflow imp...
code_fim
medium
{ "lang": "python", "repo": "awslabs/aws-service-catalog-factory", "path": "/servicecatalog_factory/workflow/portfolios/create_portfolio_task_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self) -> None: from servicecatalog_factory.workflow.portfolios import create_portfolio_task self.module = create_portfolio_task self.sut = self.module.CreatePortfolioTask( **self.minimal_common_params, region=self.region, portfoli...
code_fim
hard
{ "lang": "python", "repo": "awslabs/aws-service-catalog-factory", "path": "/servicecatalog_factory/workflow/portfolios/create_portfolio_task_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> initial = name[0:1] return initial first_name = input('Enter you first name: ') first_name_initial = get_initial(first_name) last_name = input('Enter your last name: ') last_name_initial = get_initial(last_name) print('Your initials are: ' + first_name_initial \ + last_name_initial) ...
code_fim
hard
{ "lang": "python", "repo": "Hollow667/Programing_Languages", "path": "/Python/Toturials/Yb/Microsoft Developer/PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6/0x29_0x30_Introducing Functions Python for Beginners [29 of 44]/code.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print('task completed') # Now I don't need the extra datetime prefix print(datetime.now()) print() print_time() ## What if I want a diiferent message displayed from datetime import datetime # print timestamps to see how long sections of code # take to run first_name = 'Susan' ...
code_fim
hard
{ "lang": "python", "repo": "Hollow667/Programing_Languages", "path": "/Python/Toturials/Yb/Microsoft Developer/PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6/0x29_0x30_Introducing Functions Python for Beginners [29 of 44]/code.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hollow667/Programing_Languages path: /Python/Toturials/Yb/Microsoft Developer/PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6/0x29_0x30_Introducing Functions Python for Beginners [29 of 44]/code.py ## Somtimes we copy and paste our code import datetime # print timestamps to see how long sections of code #...
code_fim
hard
{ "lang": "python", "repo": "Hollow667/Programing_Languages", "path": "/Python/Toturials/Yb/Microsoft Developer/PLlrxD0HtieHhS8VzuMCfQD4uJ9yne1mE6/0x29_0x30_Introducing Functions Python for Beginners [29 of 44]/code.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: getsentry/changes path: /tests/changes/api/serializer/models/test_logsource.py from datetime import datetime from uuid import UUID from changes.api.serializer import serialize from changes.models.job import Job from changes.models.jobstep import JobStep from changes.models.log import LogSource ...
code_fim
medium
{ "lang": "python", "repo": "getsentry/changes", "path": "/tests/changes/api/serializer/models/test_logsource.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> logsource = LogSource( id=UUID(hex='33846695b2774b29a71795a009e8168a'), job_id=UUID(hex='2e18a7cbc0c24316b2ef9d41fea191d6'), job=Job(id=UUID(hex='2e18a7cbc0c24316b2ef9d41fea191d6')), step=JobStep( id=UUID(hex='36c7af5e56aa4a7fbf076e13ac00a866'), ...
code_fim
medium
{ "lang": "python", "repo": "getsentry/changes", "path": "/tests/changes/api/serializer/models/test_logsource.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ber of isola: \t", len(nx.isolates(G)) #print " - Number of trian: \t", nx.triangles(G) #print " - Clusturing coef: \t", nx.average_clustering(G) #print " - Transitive rato: \t", nx.transitivity(G)<|fim_prefix|># repo: tchimih/NSD_project path: /engine/stat.py import networkx as nx def getSt...
code_fim
medium
{ "lang": "python", "repo": "tchimih/NSD_project", "path": "/engine/stat.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tchimih/NSD_project path: /engine/stat.py import networkx as nx def getStat(G): print " \t\t\t STATISTICS ABOUT THE GRAPH:\n" print " - Number of nodes: \t", len(G.nodes()) print " - Number of edges: \t", len(G.edges()) print " - Num<|fim_suffix|> - Clusturing coef: \t", nx.avera...
code_fim
medium
{ "lang": "python", "repo": "tchimih/NSD_project", "path": "/engine/stat.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> - Clusturing coef: \t", nx.average_clustering(G) #print " - Transitive rato: \t", nx.transitivity(G)<|fim_prefix|># repo: tchimih/NSD_project path: /engine/stat.py import networkx as nx def getStat(G): print " \t\t\t STATISTICS ABOUT THE GRAPH:\n" print " - N<|fim_middle|>umber of nodes: \t...
code_fim
hard
{ "lang": "python", "repo": "tchimih/NSD_project", "path": "/engine/stat.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sorgerlab/indra path: /indra/assemblers/tsv/assembler.py from __future__ import absolute_import, print_function, unicode_literals from builtins import dict, str import logging from copy import copy from indra.databases import get_identifiers_url from indra.statements import * from indra.util impo...
code_fim
hard
{ "lang": "python", "repo": "sorgerlab/indra", "path": "/indra/assemblers/tsv/assembler.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not statements: self.statements = [] else: self.statements = statements def add_statements(self, stmts): self.statements.extend(stmts) def make_model(self, output_file, add_curation_cols=False, up_only=False): """Export the statements in...
code_fim
hard
{ "lang": "python", "repo": "sorgerlab/indra", "path": "/indra/assemblers/tsv/assembler.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for directory in settings.STATICFILES_DIRS: directory = Path(abspath(directory)) if directory in path.parents: return path.relative_to(directory) def _get_bulma_css(self) -> List[str]: """Compiles the bulma css files for each theme and returns ...
code_fim
hard
{ "lang": "python", "repo": "max1666/django-simple-bulma", "path": "/django_simple_bulma/finders.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_bulma_css(self) -> List[str]: """Compiles the bulma css files for each theme and returns their relative paths.""" # If the user has the sass module installed in addition to libsass, # warn the user and fail hard. if not hasattr(sass, "libsass_version"): ...
code_fim
hard
{ "lang": "python", "repo": "max1666/django-simple-bulma", "path": "/django_simple_bulma/finders.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: max1666/django-simple-bulma path: /django_simple_bulma/finders.py """ Custom collectstatic finders. These finders that can be used together with StaticFileStorage objects to find files that should be collected by collectstatic. """ from os.path import abspath from pathlib import Path from typing...
code_fim
hard
{ "lang": "python", "repo": "max1666/django-simple-bulma", "path": "/django_simple_bulma/finders.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: imclab/tilde path: /apps/tilting/tests/tilt_reverse.py #!/usr/bin/env python # Euler tilting angles extraction reverse test # First, distort on the known angle, then extract tilting and check if it is the same import os import sys import math import random from numpy import array sys.path.inse...
code_fim
medium
{ "lang": "python", "repo": "imclab/tilde", "path": "/apps/tilting/tests/tilt_reverse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>a = round(random.uniform(3.5, Tilting.OCTAHEDRON_BOND_LENGTH_LIMIT*2), 3) phi = round(random.uniform(0, Tilting.MAX_TILTING_DEGREE), 3) theta = round(random.uniform(0, Tilting.MAX_TILTING_DEGREE), 3) psi = round(random.uniform(0, Tilting.MAX_TILTING_DEGREE), 3) perovskite = crystal( \ [rando...
code_fim
hard
{ "lang": "python", "repo": "imclab/tilde", "path": "/apps/tilting/tests/tilt_reverse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># NB: perovskite.rotate_euler(phi=math.radians(phi), theta=math.radians(theta), psi=math.radians(psi)) # does not suit because of spatial orientation! perovskite._masked_rotate(center=array([a*math.sqrt(2)/2, a, a*math.sqrt(2)/2]), axis='y', diff=math.radians(phi), mask=[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1...
code_fim
hard
{ "lang": "python", "repo": "imclab/tilde", "path": "/apps/tilting/tests/tilt_reverse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "%(unit)s (%(date)s): %(flag)s" % {"unit": row.cr_shelter_unit.name, "date": row.cr_shelter_inspection.date, "flag": row.cr_shelter_flag.name, ...
code_fim
hard
{ "lang": "python", "repo": "sahana/eden", "path": "/modules/s3db/cr.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sahana/eden path: /modules/s3db/cr.py egistered"), ) configure(tablename, deduplicate = S3Duplicate(), ) represent = S3Represent(lookup = tablename, translate = True, ...
code_fim
hard
{ "lang": "python", "repo": "sahana/eden", "path": "/modules/s3db/cr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sahana/eden path: /modules/s3db/cr.py e(tablename, Field("name", notnull=True, label = T("Name"), requires = [IS_NOT_EMPTY(), IS_NOT_ONE_OF(db, "%s.name" % tablename, ...
code_fim
hard
{ "lang": "python", "repo": "sahana/eden", "path": "/modules/s3db/cr.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> index = magnitudes[:, int(t)].argmax() pitch = pitches[index, int(t)] return index, pitch text_file = open("src/song/peak_times.txt", "w") for peak_time in peak_times: index, pitch = detect_pitch(y, sr, peak_time) text_file.write("%s %s %s\r\n" % (peak_time, index, pitch)) text_file.close() # C...
code_fim
hard
{ "lang": "python", "repo": "ShrikeGames/bsaber_generator", "path": "/peaks-detection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShrikeGames/bsaber_generator path: /peaks-detection.py # Detect audio peaks with Librosa (https://librosa.github.io/librosa/) # imports from __future__ import print_function import librosa import numpy as np import datetime # Load local audio file y, sr = librosa.load('src/song/song.ogg') # Ge...
code_fim
hard
{ "lang": "python", "repo": "ShrikeGames/bsaber_generator", "path": "/peaks-detection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: suminb/bnd path: /alembic/versions/3d0a468b38f_add_a_json_data_column_to_evaluation.py """Add a JSON data column to Evaluation Revision ID: 3d0a468b38f Revises: Create Date: 2015-07-10 01:31:20.578844 """ # revision identifiers, used by Alembic. revision = '3d0a468b38f' down_revision = None b...
code_fim
medium
{ "lang": "python", "repo": "suminb/bnd", "path": "/alembic/versions/3d0a468b38f_add_a_json_data_column_to_evaluation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def downgrade(): op.drop_column(table, column)<|fim_prefix|># repo: suminb/bnd path: /alembic/versions/3d0a468b38f_add_a_json_data_column_to_evaluation.py """Add a JSON data column to Evaluation Revision ID: 3d0a468b38f Revises: Create Date: 2015-07-10 01:31:20.578844 """ # revision identifiers,...
code_fim
medium
{ "lang": "python", "repo": "suminb/bnd", "path": "/alembic/versions/3d0a468b38f_add_a_json_data_column_to_evaluation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from alembic import op import sqlalchemy as sa from bnd.models import JsonType table = 'evaluation' column = 'data' def upgrade(): op.add_column(table, sa.Column(column, JsonType)) def downgrade(): op.drop_column(table, column)<|fim_prefix|># repo: suminb/bnd path: /alembic/versions/3d0a468...
code_fim
medium
{ "lang": "python", "repo": "suminb/bnd", "path": "/alembic/versions/3d0a468b38f_add_a_json_data_column_to_evaluation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with mock.patch.multiple('builtins', **mocks): runpy.run_module('freegames.guess')<|fim_prefix|># repo: wyuinche/2019-2-OSS-L8 path: /free-python-games-master/tests/test_guess.py import random import runpy import unittest.mock as mock def test_guess(): <|fim_middle|> random.seed(0) m...
code_fim
medium
{ "lang": "python", "repo": "wyuinche/2019-2-OSS-L8", "path": "/free-python-games-master/tests/test_guess.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wyuinche/2019-2-OSS-L8 path: /free-python-games-master/tests/test_guess.py import random import runpy import unittest.mock as mock <|fim_suffix|> random.seed(0) mock_input = mock.Mock() mock_input.side_effect = [20, 70, 50] mocks = {'print': lambda *args: None, 'input': mock_input...
code_fim
easy
{ "lang": "python", "repo": "wyuinche/2019-2-OSS-L8", "path": "/free-python-games-master/tests/test_guess.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_results(self): result = {} if not os.path.isdir(TMP_LOCATION + 'output/'): return result files = os.walk(TMP_LOCATION + 'output/').next()[1] for f in files: try: result[f] = open(TMP_LOCATION + 'output/' + ...
code_fim
hard
{ "lang": "python", "repo": "pradeepcsekar/cloudpulse", "path": "/cloudpulse/operator/ansible/ansible_runner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pradeepcsekar/cloudpulse path: /cloudpulse/operator/ansible/ansible_runner.py # Copyright 2010-2011 OpenStack Foundation # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in complia...
code_fim
hard
{ "lang": "python", "repo": "pradeepcsekar/cloudpulse", "path": "/cloudpulse/operator/ansible/ansible_runner.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> runner = ansible.runner.Runner( module_name='copy', module_args='src=%s dest=%s' % (src, dest), remote_user=self.remote_user, inventory=self.inventory, ) out = runner.run() return out def fetch(self, src, dest, flat='yes'...
code_fim
hard
{ "lang": "python", "repo": "pradeepcsekar/cloudpulse", "path": "/cloudpulse/operator/ansible/ansible_runner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Case: no fields given. """ old_channel_id = 202211130006 new_channel_id = 202211130007 metadata = AutoModerationActionMetadataSendAlertMessage(old_channel_id) copy = metadata.copy_with(channel_id = new_channel_id) _assert_fields_set(copy) vampytest.assert_eq(...
code_fim
hard
{ "lang": "python", "repo": "HuyaneMatsu/hata", "path": "/hata/discord/auto_moderation/action_metadata/tests/test__AutoModerationActionMetadataSendAlertMessage__utility.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> Case: no fields given. """ channel_id = 202211130005 metadata = AutoModerationActionMetadataSendAlertMessage(channel_id) copy = metadata.copy_with() _assert_fields_set(copy) vampytest.assert_eq(metadata, copy) vampytest.assert_is_not(metadata, copy) def test__Au...
code_fim
medium
{ "lang": "python", "repo": "HuyaneMatsu/hata", "path": "/hata/discord/auto_moderation/action_metadata/tests/test__AutoModerationActionMetadataSendAlertMessage__utility.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: HuyaneMatsu/hata path: /hata/discord/auto_moderation/action_metadata/tests/test__AutoModerationActionMetadataSendAlertMessage__utility.py import vampytest from ..alert_message import AutoModerationActionMetadataSendAlertMessage from .test__AutoModerationActionMetadataSendAlertMessage__construct...
code_fim
hard
{ "lang": "python", "repo": "HuyaneMatsu/hata", "path": "/hata/discord/auto_moderation/action_metadata/tests/test__AutoModerationActionMetadataSendAlertMessage__utility.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: mycyzs/fine path: /ziliao/lizhihui/home_application/common2.py # -*- coding: utf-8 -*- from conf.default import APP_ID, APP_TOKEN, BK_PAAS_HOST import datetime import time import base64 # datetime转换为字符串 def datetime_to_str(d_time): """ :param d_time: datetime 对象 :return: 字符串,格式如:2008...
code_fim
hard
{ "lang": "python", "repo": "mycyzs/fine", "path": "/ziliao/lizhihui/home_application/common2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 根据用户名查询业务 def search_business_by_user(client, username): kwargs = { "bk_app_code": APP_ID, "bk_app_secret": APP_TOKEN, "bk_username": username } res = client.cc.search_business(kwargs) return res # 根据业务和IP列表查询主机 def search_host_by_ip(client, biz_id, ip_list=[])...
code_fim
hard
{ "lang": "python", "repo": "mycyzs/fine", "path": "/ziliao/lizhihui/home_application/common2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> student_file = [] for i in listfile: aa = Student(str(i[0]), str(i[1]), float(i[2]), float(i[3]), str(i[4]), str(i[5])) student_file.append(aa) # print(student_file) # a.remove("FirstName") # print(a) stat_list = {} grade_list = [] # All of the students grade ...
code_fim
hard
{ "lang": "python", "repo": "applemorshed/PYTHON-Project-Student-Grade-Data-Statistics-Using-Class", "path": "/Main.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> grade_list = [] # All of the students grade for i in student_file: grade_list.append(i.StudentGrade) aveg_mean = np.mean(grade_list) # Male average and variance gender_list_M = [] gender_list_grade = [] for i in student_file: if i.Gender == 'M': ge...
code_fim
hard
{ "lang": "python", "repo": "applemorshed/PYTHON-Project-Student-Grade-Data-Statistics-Using-Class", "path": "/Main.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: applemorshed/PYTHON-Project-Student-Grade-Data-Statistics-Using-Class path: /Main.py import csv import json import operator import numpy as np #from operator import attrgetter src = open('studentFile.csv', "r+") dst_csv_json = open("csvToJson.json", "w+") dst_csv_json_gender_order = open("csvToJ...
code_fim
hard
{ "lang": "python", "repo": "applemorshed/PYTHON-Project-Student-Grade-Data-Statistics-Using-Class", "path": "/Main.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomorrowdata/iottly-sdk-python path: /tests/test_iottly_sdk.py if next_buf: # msg_buf[:] = next_buf, * msg_buf[i+1:] # Compatobility with Py 3.4 tmp = msg_buf[i+1:] msg_buf[0] = next_buf ms...
code_fim
hard
{ "lang": "python", "repo": "tomorrowdata/iottly-sdk-python", "path": "/tests/test_iottly_sdk.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomorrowdata/iottly-sdk-python path: /tests/test_iottly_sdk.py args) m.__name__ = name return m Mock = mock_wrapper import os import time import shutil import tempfile import multiprocessing from stubs.agent_server import UDSStubServer from iottly_sdk import iottly from iot...
code_fim
hard
{ "lang": "python", "repo": "tomorrowdata/iottly-sdk-python", "path": "/tests/test_iottly_sdk.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_call_agent_with_disconnected_sdk(self): sdk = iottly.IottlySDK('testapp', self.socket_path) sdk.start() sdk._agent_version = '1.8.6' with self.assertRaises(DisconnectedSDK): sdk.call_agent('echo') def test_call_agent(self): cb_called =...
code_fim
hard
{ "lang": "python", "repo": "tomorrowdata/iottly-sdk-python", "path": "/tests/test_iottly_sdk.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CofelyGTC/nyx_containers path: /sources/biac_mails.py """ BIAC_MAILS ==================================== Listens to: ------------------------------------- Collections: ------------------------------------- VERSION HISTORY =============== * 25 Mar 2020 1.0.0 **AMA** Escape a double back...
code_fim
hard
{ "lang": "python", "repo": "CofelyGTC/nyx_containers", "path": "/sources/biac_mails.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # logger.info(msg) send_attachment(msg) # DELETE MAILS M.store(num, '+FLAGS', '\\Deleted') logger.info("Closing mail box") M.expunge() M.close() M.logout() if __name__ == '__main__': logger.info("AMQC_URL :"+os.environ["AMQC_URL"]) nextload=datetime...
code_fim
hard
{ "lang": "python", "repo": "CofelyGTC/nyx_containers", "path": "/sources/biac_mails.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: awaisali88/creten path: /creten/orders/Order.py from orders.OrderSide import OrderSide from orders.OrderType import OrderType from db_managers.DbCodeMapper import OrderStateMapper, OrderSideMapper, OrderTypeMapper class Order(object): def __init__(self, orderSide = None, orderType = None, qty =...
code_fim
hard
{ "lang": "python", "repo": "awaisali88/creten", "path": "/creten/orders/Order.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def getTradeId(self): return self.tradeId def getIntOrderRef(self): return self.intOrderRef def getInitTmstmp(self): return self.initTmstmp def getOpenTmstmp(self): return self.openTmstmp def getFilledTmstmp(self): return self.filledTmstmp def __str__(self): return 'orderSide ' + (O...
code_fim
hard
{ "lang": "python", "repo": "awaisali88/creten", "path": "/creten/orders/Order.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def showOne(one): if 'lo' in one.x.__dict__.keys(): return [":klass",one.y.mode, ":id",one.id, ":lo",one.x.lo, ":hi",one.x.hi, ":n",one.y.n, ":errors", one.w ] else: return [":klass",one.y.mode, ":id",one.id, ...
code_fim
hard
{ "lang": "python", "repo": "timm/16", "path": "/power/divs.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> if not lst: return [] divs = recurse(sorted(lst,key=num), worker, id, num, []) wall = weighted(len(lst),divs) return wall, sorted(divs,key=lambda z:(z.w,z.n)) def recurse(this, divisor, id, x,cuts): cut,about = divisor(this) if cut: recurse(this[:cut], divisor...
code_fim
hard
{ "lang": "python", "repo": "timm/16", "path": "/power/divs.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: timm/16 path: /power/divs.py from __future__ import print_function, division import sys sys.dont_write_bytecode = True from table import * from counts import * @setting def CUT(): return o( crowded=4, cohen=0.1, fayyad=False ) def crowded(n): return n > the.CUT.crowded def smallEf...
code_fim
hard
{ "lang": "python", "repo": "timm/16", "path": "/power/divs.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> class EntryWay(models.IntegerChoices): """ 入园方式 """ BY_TICKET = 0, '短信换票入园' BY_CODE = 1, '凭借验证码入园'<|fim_prefix|># repo: wenxuefeng3930/trip-api path: /sight/choices.py from django.db import models class TicketTypes(models.IntegerChoices): """ 门票类型 """ ADULT = 11, '成人票' ...
code_fim
medium
{ "lang": "python", "repo": "wenxuefeng3930/trip-api", "path": "/sight/choices.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }