text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: BigData-Tools/everest path: /everest/querying/interfaces.py """ Interfaces for specifications and related classes. This file is part of the everest project. See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information. Created on Dec 2, 2011. """ from zope.interface import Attr...
code_fim
hard
{ "lang": "python", "repo": "BigData-Tools/everest", "path": "/everest/querying/interfaces.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Visiting operation for value less than or equal to specifications. """ def _greater_than_op(spec): """ Visiting operation for value greater than specifications. """ def _greater_than_or_equal_to_op(spec): """ Visiting operation ...
code_fim
hard
{ "lang": "python", "repo": "BigData-Tools/everest", "path": "/everest/querying/interfaces.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _greater_than_or_equal_to_op(spec): """ Visiting operation for value greater than or equal to specifications. """ def _in_range_op(spec): """ Visiting operation for value in range specifications. """ class IOrderSpecificationVisitor(ISpecifica...
code_fim
hard
{ "lang": "python", "repo": "BigData-Tools/everest", "path": "/everest/querying/interfaces.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_requires(self): """Test to ensure requirements can be added on the fly""" assert self.route.requires(("values",)).route["requires"] == ("values",) def test_map_params(self): """Test to ensure it is possible to set param mappings on the routing object""" as...
code_fim
hard
{ "lang": "python", "repo": "timothycrosley/hug_core", "path": "/tests/test_routing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> route = LocalRouter(name="cli", doc="Hi there!", transform="transform", output="output") def test_validate(self): """Test to ensure changing wether a local route should validate or not works as expected""" assert "skip_validation" not in self.route.route route = self.rout...
code_fim
hard
{ "lang": "python", "repo": "timothycrosley/hug_core", "path": "/tests/test_routing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: timothycrosley/hug_core path: /tests/test_routing.py """tests/test_output_format.py Tests that the hug_core routing functionality works as expected Copyright (C) 2016 Timothy Edmund Crosley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associ...
code_fim
hard
{ "lang": "python", "repo": "timothycrosley/hug_core", "path": "/tests/test_routing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: confluentinc/kafka path: /tests/kafkatest/services/trogdor/network_partition_fault_spec.py # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright owners...
code_fim
hard
{ "lang": "python", "repo": "confluentinc/kafka", "path": "/tests/kafkatest/services/trogdor/network_partition_fault_spec.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class NetworkPartitionFaultSpec(TaskSpec): """ The specification for a network partition fault. Network partition faults fracture the network into different partitions that cannot communicate with each other. """ def __init__(self, start_ms, duration_ms, partitions): """ ...
code_fim
medium
{ "lang": "python", "repo": "confluentinc/kafka", "path": "/tests/kafkatest/services/trogdor/network_partition_fault_spec.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcvenkat/Python-Programs path: /S5-Select-Widgets-Drawing-Spans-Dynamically.py from bokeh.plotting import figure from bokeh.io import curdoc from bokeh.sampledata.periodic_table import elements from bokeh.models import Range1d, PanTool, ResetTool, HoverTool, ColumnDataSource, LabelSet, Select ...
code_fim
hard
{ "lang": "python", "repo": "mcvenkat/Python-Programs", "path": "/S5-Select-Widgets-Drawing-Spans-Dynamically.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Create a function that updates the location attribute value for span_solid_boil span #Also note that select.value returns values as strings so we need to convert the returned value to float def update_span(attr, old, new): span_solid_boil.location=float(select.value) #Select widgets expect a li...
code_fim
hard
{ "lang": "python", "repo": "mcvenkat/Python-Programs", "path": "/S5-Select-Widgets-Drawing-Spans-Dynamically.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Select widgets expect a list of tuples of strings, so List[Tuple(String, String)], that's why you should convert average, max, and min to strings options=[(str(solid_average_boil),"Solid Average Boiling Point"),(str(solid_min_boil),"Solid Minimum Boiling Point"),(str(solid_max_boil),"Solid Maximum Boili...
code_fim
hard
{ "lang": "python", "repo": "mcvenkat/Python-Programs", "path": "/S5-Select-Widgets-Drawing-Spans-Dynamically.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ## Collect the range of the words that is within the target word by using text.tokens[start;end]. ## The map function is use so that when the offset position - the target range < 0, it will be default to zero concordance_txt = ([text.tokens[list(map(lambda x: x-5 if (x-left_margin)>0 else 0,[o...
code_fim
medium
{ "lang": "python", "repo": "makergabriel/gearmood", "path": "/src/shake/nlp_scratchpad.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: makergabriel/gearmood path: /src/shake/nlp_scratchpad.py import nltk from nltk.tokenize import sent_tokenize from nltk.tokenize import word_tokenize from nltk.corpus import wordnet # synonyms = [] # antonyms = [] # for synset_name in cut_words: # for synset in wordnet.synsets(synset_name): # ...
code_fim
hard
{ "lang": "python", "repo": "makergabriel/gearmood", "path": "/src/shake/nlp_scratchpad.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: makinacorpus/makina-states path: /doc/sphinx/mc_states/modules/mc_screen.py #!/usr/bin/env python # -*- coding: utf-8 -*- ''' .. _module_mc_screen: mc_screen / screen registry ============================================ If you alter this module and want to test it, do not forget to deploy i...
code_fim
hard
{ "lang": "python", "repo": "makinacorpus/makina-states", "path": "/doc/sphinx/mc_states/modules/mc_screen.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def settings(): ''' screen registry ''' @mc_states.api.lazy_subregistry_get(__salt__, __name) def _settings(): saltmods = __salt__ grains = __grains__ locations = __salt__['mc_locations.settings']() data = saltmods['mc_utils.defaults']( 'mak...
code_fim
hard
{ "lang": "python", "repo": "makinacorpus/makina-states", "path": "/doc/sphinx/mc_states/modules/mc_screen.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def settings(): ''' screen registry ''' @mc_states.api.lazy_subregistry_get(__salt__, __name) def _settings(): saltmods = __salt__ grains = __grains__ locations = __salt__['mc_locations.settings']() data = saltmods['mc_utils.defaults']( 'ma...
code_fim
medium
{ "lang": "python", "repo": "makinacorpus/makina-states", "path": "/doc/sphinx/mc_states/modules/mc_screen.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jina-ai/jina path: /tests/unit/orchestrate/flow/flow-construct/test_flow_monitoring.py import pytest from jina import Executor, Flow, requests @pytest.fixture() def get_executor(): class DummyExecutor(Executor): @requests(on='/foo') def foo(self, docs, **kwargs): ...
code_fim
hard
{ "lang": "python", "repo": "jina-ai/jina", "path": "/tests/unit/orchestrate/flow/flow-construct/test_flow_monitoring.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert f._deployment_nodes['gateway'].pod_args['pods'][0][0].monitoring assert not f._deployment_nodes['executor0'].pod_args['pods'][0][0].monitoring def test_disable_monitoring_on_gatway_only(port_generator, get_executor): port0 = port_generator() port1 = port_generator() f = Flow(...
code_fim
hard
{ "lang": "python", "repo": "jina-ai/jina", "path": "/tests/unit/orchestrate/flow/flow-construct/test_flow_monitoring.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def write_log(self, msg, level = "DEBUG"): """ log the message to the console """ if len(self.parent)> 13: spacer = "\t" elif len(self.parent) < 8: spacer = "\t\t\t" else: spacer = "\t\t" lo...
code_fim
medium
{ "lang": "python", "repo": "9h03n1x/AD_project", "path": "/src/logger/logger.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 9h03n1x/AD_project path: /src/logger/logger.py ''' Created on 10.03.2019 @author: Nicco ''' class logger(): ''' classdocs ''' <|fim_suffix|> log = level + "\t" + self.parent +spacer +str(msg) print(log)<|fim_middle|> def __init__(self, parent): ...
code_fim
hard
{ "lang": "python", "repo": "9h03n1x/AD_project", "path": "/src/logger/logger.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ''' Constructor ''' self.parent = parent def write_log(self, msg, level = "DEBUG"): """ log the message to the console """ if len(self.parent)> 13: spacer = "\t" elif len(self.parent) < 8: ...
code_fim
medium
{ "lang": "python", "repo": "9h03n1x/AD_project", "path": "/src/logger/logger.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> send(IP_Packet / TCP_Packet, verbose=0) total += 1 stdout.write("\nTotal packets sent: %i\n" % total) def main(): parser = ArgumentParser() parser.add_argument("--target", "-t", help="target IP address") parser.add_argument("--port", "-p", help="target port number") ...
code_fim
hard
{ "lang": "python", "repo": "ryuichi1208/tcp-syn-flood", "path": "/tcp_syn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryuichi1208/tcp-syn-flood path: /tcp_syn.py #!/usr/bin/python3 from sys import stdout from scapy.all import * from random import randint from argparse import ArgumentParser """ FIN = 0x01 SYN = 0x02 RST = 0x04 PSH = 0x08 ACK = 0x10 URG = 0x20 ECE = 0x40 CWR = 0x80 """ def randomIP(): ip = ...
code_fim
hard
{ "lang": "python", "repo": "ryuichi1208/tcp-syn-flood", "path": "/tcp_syn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> TCP_Packet = TCP() TCP_Packet.sport = s_port TCP_Packet.dport = int(dstPort) TCP_Packet.flags = flags TCP_Packet.seq = s_eq TCP_Packet.window = w_indow send(IP_Packet / TCP_Packet, verbose=0) total += 1 stdout.write("\nTotal packets sen...
code_fim
hard
{ "lang": "python", "repo": "ryuichi1208/tcp-syn-flood", "path": "/tcp_syn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/built-in/others/WDL_for_PyTorch/pthtar2onnx.py # -*- coding: utf-8 -*- # Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/built-in/others/WDL_for_PyTorch/pthtar2onnx.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> sparse_features = ['C' + str(i) for i in range(1, 27)] dense_features = ['I' + str(i) for i in range(1, 14)] sparse_nunique = [1460, 583, 10131227, 2202608, 305, 24, 12517, 633, 3, 93145, 5683, 8351593, 3194, 27, 14992, 5461306, 10, 5652, 2173, 4, 7046547, 18, 15, 286181...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/built-in/others/WDL_for_PyTorch/pthtar2onnx.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Returns a string with base 64 encoded concatenation of diffferentiae. If `differentia_bit_width` is not an even byte multiple, the first encoded byte tells how many empty padding bits, if any, were placed at the end of the concatenation in order to align the bitstring end to byte boundarie...
code_fim
hard
{ "lang": "python", "repo": "mmore500/hstrat", "path": "/hstrat/serialization/_pack_differentiae_str.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mmore500/hstrat path: /hstrat/serialization/_pack_differentiae_str.py import typing from ..genome_instrumentation import HereditaryStratum from ._impl import stringify_packed_differentia_bytes from ._pack_differentiae_bytes import pack_differentiae_bytes <|fim_suffix|> Returns a string with...
code_fim
hard
{ "lang": "python", "repo": "mmore500/hstrat", "path": "/hstrat/serialization/_pack_differentiae_str.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>STATUS_CHOICES = [ ("1", "Put Under Review"), ("2", "Scheduled For Interview"), ("3", "Selected"), ("4", "Rejected"), ]<|fim_prefix|># repo: SakshiUppoor/placement-portal-web path: /placementApp/choices.py DEPARTMENT_CHOICES = [ ("COMPS", "Computer"), ("IT", "Information Technolog...
code_fim
medium
{ "lang": "python", "repo": "SakshiUppoor/placement-portal-web", "path": "/placementApp/choices.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>CATEGORY_CHOICES = [("S", "Super Dream"), ("D", "Dream"), ("R", "Regular")] STATUS_CHOICES = [ ("1", "Put Under Review"), ("2", "Scheduled For Interview"), ("3", "Selected"), ("4", "Rejected"), ]<|fim_prefix|># repo: SakshiUppoor/placement-portal-web path: /placementApp/choices.py DEPART...
code_fim
medium
{ "lang": "python", "repo": "SakshiUppoor/placement-portal-web", "path": "/placementApp/choices.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SakshiUppoor/placement-portal-web path: /placementApp/choices.py DEPARTMENT_CHOICES = [ ("COMPS", "Computer"), ("IT", "Information Technology"), ("EXTC", "Electronics & Telecommunication"), ("PROD", "Production"), ("MECH", "Mechanical"), ("BIO", "Biomedical"), ("ELEX",...
code_fim
medium
{ "lang": "python", "repo": "SakshiUppoor/placement-portal-web", "path": "/placementApp/choices.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): con = pymongo.MongoClient( settings['MONGODB_SERVER'], settings['MONGODB_POST'] ) db = con['lagou_test'] db.lagou.create_index( [('positionId', pymongo.ASCENDING)], unique = True ) sel...
code_fim
hard
{ "lang": "python", "repo": "LAsbun/scrapy_practice", "path": "/scrapy_practice/pipelines.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LAsbun/scrapy_practice path: /scrapy_practice/pipelines.py # -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import json from scrapy.exceptions import Dr...
code_fim
hard
{ "lang": "python", "repo": "LAsbun/scrapy_practice", "path": "/scrapy_practice/pipelines.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Phidelux/Ezrael path: /core/msghandler.py #!/usr/bin/env python # -*- coding: utf-8 -*- class MessageHandler(object): @staticmethod def norm_channel(channel): if channel[0] == "#": return channel return "#" + channel def send(self, data): pass ...
code_fim
hard
{ "lang": "python", "repo": "Phidelux/Ezrael", "path": "/core/msghandler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def quit_channel(self, channel): channel = self.norm_channel(channel) self.send("PART {0} \r\n".format(channel).encode()) # This needs to modify the list of active channels<|fim_prefix|># repo: Phidelux/Ezrael path: /core/msghandler.py #!/usr/bin/env python # -*- coding: utf-8...
code_fim
hard
{ "lang": "python", "repo": "Phidelux/Ezrael", "path": "/core/msghandler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>n_rows = 128 n_cols = 8 seats = [] for line in lines: seat_id = get_id(line) seats.append(seat_id) print(max(seats))<|fim_prefix|># repo: JoshW-7/AdventOfCode path: /2020/Day 5/part1.py def get_id(seat_encoding): seat_id = None row_data = seat_encoding[0:7] col_data = seat_encoding...
code_fim
medium
{ "lang": "python", "repo": "JoshW-7/AdventOfCode", "path": "/2020/Day 5/part1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoshW-7/AdventOfCode path: /2020/Day 5/part1.py def get_id(seat_encoding): seat_id = None row_data = seat_encoding[0:7] col_data = seat_encoding[7:] # Get row low,high = (0, n_rows) for c in row_data: width = high - low if c == "F": high = lo...
code_fim
hard
{ "lang": "python", "repo": "JoshW-7/AdventOfCode", "path": "/2020/Day 5/part1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ENCODE-DCC/encoded path: /src/encoded/audit/ontology_data.py biosampleType_ontologyPrefix = { 'tissue': ['UBERON'], 'whole organisms': ['UBERON'], 'primary cell': ['CL'], 'cell line': ['EFO', 'C<|fim_suffix|>000763': 'siRNA knockdown followed by RNA-seq', 'NTR:0003660': 'micro...
code_fim
medium
{ "lang": "python", "repo": "ENCODE-DCC/encoded", "path": "/src/encoded/audit/ontology_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>000763': 'siRNA knockdown followed by RNA-seq', 'NTR:0003660': 'microRNA counts', 'NTR:0003814': 'CRISPR genome editing followed by RNA-seq', 'NTR:0000612': 'Switchgear', 'NTR:0004774': 'genetic modification followed by DNase-seq', 'NTR:0004619': 'CRISPRi followed by RNA-seq' }<|fim_pr...
code_fim
medium
{ "lang": "python", "repo": "ENCODE-DCC/encoded", "path": "/src/encoded/audit/ontology_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 'NTR:0000612': 'Switchgear', 'NTR:0004774': 'genetic modification followed by DNase-seq', 'NTR:0004619': 'CRISPRi followed by RNA-seq' }<|fim_prefix|># repo: ENCODE-DCC/encoded path: /src/encoded/audit/ontology_data.py biosampleType_ontologyPrefix = { 'tissue': ['UBERON'], 'whole org...
code_fim
hard
{ "lang": "python", "repo": "ENCODE-DCC/encoded", "path": "/src/encoded/audit/ontology_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @patch("samcli.commands.deploy.guided_context.prompt") @patch("samcli.commands.deploy.guided_context.confirm") @patch("samcli.commands.deploy.guided_context.manage_stack") def test_guided_prompts_check_defaults(self, patched_manage_stack, patched_confirm, patched_prompt): # Series ...
code_fim
hard
{ "lang": "python", "repo": "pyk/aws-sam-cli", "path": "/tests/unit/commands/deploy/test_guided_context.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyk/aws-sam-cli path: /tests/unit/commands/deploy/test_guided_context.py from unittest import TestCase from unittest.mock import patch, call, ANY import click from samcli.commands.deploy.guided_context import GuidedContext class TestGuidedContext(TestCase): def setUp(self): <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "pyk/aws-sam-cli", "path": "/tests/unit/commands/deploy/test_guided_context.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jleung51/resttest path: /example.py #!/usr/bin/env python3 from resttest import ApiTest import logging import unittest import requests SERVER_URL = "http://localhost:8080" URLS = dict( HEALTH_CHECK=SERVER_URL, ABOUT=SERVER_URL + '/api/about', DUMP_MODEL=SERVER_URL + '/api/dump-mod...
code_fim
hard
{ "lang": "python", "repo": "jleung51/resttest", "path": "/example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # When resp = self.send_request(url, headers=self.headers) # Then self.assert_resp_code(resp, requests.codes.OK) sections = self.get_resp_body_list(resp) self.assertTrue(len(sections), 'Response body is empty, but must contain a list of sections.') ...
code_fim
hard
{ "lang": "python", "repo": "jleung51/resttest", "path": "/example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = request( url, headers=self.http_headers(), data=payload, verify=True) if response.status_code == 404: msg = "The object request cannot be found" if response.json().get('message'): body = response.json() return respo...
code_fim
hard
{ "lang": "python", "repo": "aminubakori/pypayant", "path": "/pypayant/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aminubakori/pypayant path: /pypayant/base.py import os import requests import json from pypayant import __version__ from pypayant.errors import AuthKeyError, HttpMethodError class BasePayantAPI(object): """ """ _content_type = "application/json" _base_url = { "demo": "...
code_fim
hard
{ "lang": "python", "repo": "aminubakori/pypayant", "path": "/pypayant/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 77ph/tgnews path: /news.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 2 21:01:59 2019 @author: innerm """ import json import pandas as pd <|fim_suffix|>df=pd.DataFrame() df1=pd.read_csv(file_en) df2=pd.read_csv(file_ru) df=df.append(df1) df=df.append(df1) del df1,df...
code_fim
easy
{ "lang": "python", "repo": "77ph/tgnews", "path": "/news.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>file_en='stage41.csv' file_ru='stage42.csv' df=pd.DataFrame() df1=pd.read_csv(file_en) df2=pd.read_csv(file_ru) df=df.append(df1) df=df.append(df1) del df1,df2 df1=df[df.real_news==1] del df files=df1.files.tolist() del df1 keyList=['news'] edict={'articles':files} exp=keyList[0] n={exp:edict} print(jso...
code_fim
easy
{ "lang": "python", "repo": "77ph/tgnews", "path": "/news.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apanov/casumper path: /casumper.py import sys,struct PYTHONUNBUFFERED = "true" PY3K = sys.version_info >= (3, 0) def readUtf(bytes, offset): length = struct.unpack(">h", bytes[offset + 0: offset + 2])[0] name = bytes[offset + 2:offset + length+2] return name if PY3K: print "P...
code_fim
medium
{ "lang": "python", "repo": "apanov/casumper", "path": "/casumper.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # print "Key length:", length if length < 10 or length > 1000000000: print 'Wrong length' continue data = source.read(length) # TODO check CRC crc = struct.unpack_from('>LL', source.read(8))[1] table = readUtf(data, 0) key = readUtf(data, len(table) + 2) ...
code_fim
medium
{ "lang": "python", "repo": "apanov/casumper", "path": "/casumper.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DataONEorg/d1_python path: /gmn/src/d1_gmn/app/management/commands/whitelist-remove.py # This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. ...
code_fim
medium
{ "lang": "python", "repo": "DataONEorg/d1_python", "path": "/gmn/src/d1_gmn/app/management/commands/whitelist-remove.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>""" import d1_gmn.app import d1_gmn.app.mgmt_base import d1_gmn.app.models class Command(d1_gmn.app.mgmt_base.GMNCommandBase): def __init__(self, *args, **kwargs): super().__init__(__doc__, __name__, *args, **kwargs) def add_arguments(self, parser): parser.add_argument("subject...
code_fim
hard
{ "lang": "python", "repo": "DataONEorg/d1_python", "path": "/gmn/src/d1_gmn/app/management/commands/whitelist-remove.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>446,7227,6151,503,1367,5396,9645,-361,9317,2667,2735,1224,6687,8485,2565,1055,8723,4965,8675,2611,9534,3661,511,6929,4668,2734,6503,1325,7322,3390,9864,2976,2158,5116,5864,2719,3720,2555,8877,8625,2232,3942,1084,6029,3555,1374,616,533,7791,7466,1212,9619,9073,280,6521,713,494,5435,3423,6602,9608,-12,3012,...
code_fim
hard
{ "lang": "python", "repo": "HearyShen/leetcode-cn", "path": "/problems/count-of-smaller-numbers-after-self/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HearyShen/leetcode-cn path: /problems/count-of-smaller-numbers-after-self/solution.py 357,5650,2942,8299,9903,6113,6863,5918,5566,88,1656,577,353,6898,-140,355,9077,2086,3444,1394,8028,6087,6945,7727,6227,9045,6251,199,1786,1386,261,5729,3632,273,7530,4201,-113,2496,7881,6985,6048,6924,2946,7578,...
code_fim
hard
{ "lang": "python", "repo": "HearyShen/leetcode-cn", "path": "/problems/count-of-smaller-numbers-after-self/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HearyShen/leetcode-cn path: /problems/count-of-smaller-numbers-after-self/solution.py ,2687,7013,9229,9719,8389,3788,413,3134,9912,-130,3942,9385,8005,382,7591,5967,8599,1488,8135,46,7545,7559,1141,2087,8309,7401,3785,3922,8976,-329,7591,3620,3660,7550,9652,3206,5868,967,6967,4054,5065,7769,-403,...
code_fim
hard
{ "lang": "python", "repo": "HearyShen/leetcode-cn", "path": "/problems/count-of-smaller-numbers-after-self/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cmake = shutil.which("cmake") if not cmake: # try to help if Homebrew or Ports is not on PATH if sys.platform == "darwin": paths = ["/opt/homebrew/bin", "/usr/local/bin", "/opt/local/bin"] for path in paths: cmake = shutil.which("cmake", path...
code_fim
medium
{ "lang": "python", "repo": "scivision/cmakeutils", "path": "/example/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scivision/cmakeutils path: /example/__init__.py from __future__ import annotations import subprocess import shutil import sys __all__ = ["cmake_exe"] def cmake_exe() -> str: <|fim_suffix|> cmake_version = ( subprocess.check_output([cmake, "--version"], text=True) .split("\n"...
code_fim
hard
{ "lang": "python", "repo": "scivision/cmakeutils", "path": "/example/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not cmake: raise FileNotFoundError("CMake not found. Try:\n pip install cmake") cmake_version = ( subprocess.check_output([cmake, "--version"], text=True) .split("\n")[0] .split(" ")[2] ) print("Using CMake", cmake_version) return cmake<|fim_pr...
code_fim
hard
{ "lang": "python", "repo": "scivision/cmakeutils", "path": "/example/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: piapiaQ/Highmark path: /Claim/Preprocessing/reorder_tma_for_each_file.py # -*- coding: utf-8 -*- """ Created on Sun Sep 13 18:02:39 2020 @author: qiaoz """ import pandas as pd import numpy as np import os os.chdir(r'D:\CMU\HIghmark Project\data\raw_claim_data') # ===============================...
code_fim
hard
{ "lang": "python", "repo": "piapiaQ/Highmark", "path": "/Claim/Preprocessing/reorder_tma_for_each_file.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># ============================================================================= #create my anomaly mapping # ============================================================================= split_into_multiple_file(data,16,'data_sorted','D://CMU//HIghmark Project//data//sorted_data//') #find claims number t...
code_fim
hard
{ "lang": "python", "repo": "piapiaQ/Highmark", "path": "/Claim/Preprocessing/reorder_tma_for_each_file.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: esp10mm/pywal path: /pywal/theme.py """ Theme file handling. """ import logging import os import random import sys from .settings import CONF_DIR, MODULE_DIR from . import util def list_themes(): """List all installed theme files.""" themes = [*os.scandir(os.path.join(CONF_DIR, "colors...
code_fim
hard
{ "lang": "python", "repo": "esp10mm/pywal", "path": "/pywal/theme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def parse(theme_file): """Parse the theme file.""" data = util.read_file_json(theme_file) if "wallpaper" not in data: data["wallpaper"] = "None" if "alpha" not in data: data["alpha"] = "100" # Terminal.sexy format. if "color" in data: data = terminal_sexy...
code_fim
hard
{ "lang": "python", "repo": "esp10mm/pywal", "path": "/pywal/theme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> util.create_dir(os.path.dirname(user_theme_file)) # Find the theme file. if os.path.isfile(input_file): theme_file = input_file elif os.path.isfile(user_theme_file): theme_file = user_theme_file elif input_file == "random": themes = [theme.path for theme in l...
code_fim
hard
{ "lang": "python", "repo": "esp10mm/pywal", "path": "/pywal/theme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>CONTOH KELUARAN 2 2 0 CONTOH MASUKAN 7 1 6 5 0 9 3 4 CONTOH KELUARAN 0 1 3 4 5 6 9 6 ''' import sys # Ignore the first input input() list_to_be_sorted = list(map(int, input().split())) # Selection sort list_length = len(list_to_be_sorted) converts_count = 0 for i in range(list_length): smal...
code_fim
hard
{ "lang": "python", "repo": "refeed/PAlgoritmaTRPLA", "path": "/DES_1_2020/quizA.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: refeed/PAlgoritmaTRPLA path: /DES_1_2020/quizA.py ''' DESKRIPSI SOAL Terdapat byk skl cara / algoritma untuk mengurutkan suatu data didalam suatu Array. Pada kasus ini disiapkan suatu algoritma. Terapkan Algoritma ini sehingga dapat diketahui, berapa kali pertukaran dilakukan. Algoritma: 1. C...
code_fim
medium
{ "lang": "python", "repo": "refeed/PAlgoritmaTRPLA", "path": "/DES_1_2020/quizA.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> endpoint = API_URI + '/tests/1' r = client.get(endpoint) assert r.status_code == 200 endpoint = API_URI + '/tests/2' r = client.get(endpoint) assert r.status_code == 200 assert self.get_content(r) == "1"<|fim_prefix|># repo: rapydo/tests path: /p...
code_fim
medium
{ "lang": "python", "repo": "rapydo/tests", "path": "/projects/celerybeat/backend/tests/test_celery.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rapydo/tests path: /projects/celerybeat/backend/tests/test_celery.py # -*- coding: utf-8 -*- # import time from restapi.tests import BaseTests, API_URI # from restapi.utilities.logs import log <|fim_suffix|> endpoint = API_URI + '/tests/1' r = client.get(endpoint) assert...
code_fim
medium
{ "lang": "python", "repo": "rapydo/tests", "path": "/projects/celerybeat/backend/tests/test_celery.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: suddi/tweetindex-streamer path: /store/dynamodb.py # -*- coding: utf-8 -*- import json import requests import uuid from settings import TWEETINDEX def create_id(document): if not 'id' in document: document['id'] = str(uuid.uuid4()) return document <|fim_suffix|> for documen...
code_fim
easy
{ "lang": "python", "repo": "suddi/tweetindex-streamer", "path": "/store/dynamodb.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for document in documents: document = create_id(document) print json.dumps(document) requests.post(TWEETINDEX['endpoint'], headers=TWEETINDEX['headers'], data=json.dumps(document)) return True<|fim_prefix|># repo: suddi/tweetindex-streamer path: /store/dynamodb.py # -*- co...
code_fim
medium
{ "lang": "python", "repo": "suddi/tweetindex-streamer", "path": "/store/dynamodb.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bergercookie/hashcode-server path: /algo.py #!/usr/bin/env python3 from export_results import export_results import os from parse_input import parse_input import sys import custom_types import time # Main body of the hashcode algorithm <|fim_suffix|> if len(sys.argv) != 2: print("Us...
code_fim
medium
{ "lang": "python", "repo": "bergercookie/hashcode-server", "path": "/algo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Process # Export results outfile = "{}_{}".format(int(time.time()), input_f) export_results(problem, outfile) if __name__ == "__main__": main()<|fim_prefix|># repo: bergercookie/hashcode-server path: /algo.py #!/usr/bin/env python3 from export_results import export_results impor...
code_fim
hard
{ "lang": "python", "repo": "bergercookie/hashcode-server", "path": "/algo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sevlin/cryptopotato-bot path: /devpotato_bot/runner.py import datetime import logging import os import sys from typing import Set, Dict, Optional import pytz import telegram from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from telegram import Bot from telegram.ext im...
code_fim
hard
{ "lang": "python", "repo": "Sevlin/cryptopotato-bot", "path": "/devpotato_bot/runner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def add_command_description(self, command, description): """Add command to the list of commands to be shown to Telegram clients""" self._command_list[command] = description def run(self): self.updater.start_polling() # Run the bot until you press Ctrl-C or the pro...
code_fim
hard
{ "lang": "python", "repo": "Sevlin/cryptopotato-bot", "path": "/devpotato_bot/runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: point-source/WhatManager2 path: /userscript/urls.py from django.conf.urls import patterns, url urlpatterns = patterns( '', ur<|fim_suffix|>$', 'userscript.views.whatcd'), url(r'^overdrive.user.js$', 'userscript.views.overdrive'), url(r'^myanonamouse.user.js$', 'userscript.views.m...
code_fim
medium
{ "lang": "python", "repo": "point-source/WhatManager2", "path": "/userscript/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>overdrive'), url(r'^myanonamouse.user.js$', 'userscript.views.myanonamouse'), )<|fim_prefix|># repo: point-source/WhatManager2 path: /userscript/urls.py from django.conf.urls import patterns, url urlpatterns = patterns( '', ur<|fim_middle|>l(r'^bibliotik.user.js$', 'userscript.views.biblioti...
code_fim
medium
{ "lang": "python", "repo": "point-source/WhatManager2", "path": "/userscript/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: prodrigues07/paulo-victor-sor1-p7-info path: /client.py import threading import socket apelido = input('Escolha seu apelido: ') client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(('127.0.0.1', 5555)) def receive_client(): <|fim_suffix|> while True: data = f'{a...
code_fim
hard
{ "lang": "python", "repo": "prodrigues07/paulo-victor-sor1-p7-info", "path": "/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def write_msg(): while True: data = f'{apelido}: {input("")}' client.send(data.encode('utf-8')) receive_thread = threading.Thread(target=receive_client) receive_thread.start() write_thread = threading.Thread(target=write_msg) write_thread.start()<|fim_prefix|># repo: prodrigues07/paul...
code_fim
hard
{ "lang": "python", "repo": "prodrigues07/paulo-victor-sor1-p7-info", "path": "/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: data = client.recv(1024).decode('utf-8') if data == 'NICK': client.send(apelido.encode('utf-8')) else: print(data) except: print('Um erro ocorreu. Tente novamente!') client.clos...
code_fim
medium
{ "lang": "python", "repo": "prodrigues07/paulo-victor-sor1-p7-info", "path": "/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wolfgangB33r/blogPostMaterial path: /dynatrace-tensorflow-callback/example.py # Example Keras model training with TensorFlow and evaluation use along with a Dynatrace TensorFlow # callback receiver for AI Observability. import tensorflow as tf print("TensorFlow version:", tf.__version__) import ...
code_fim
medium
{ "lang": "python", "repo": "wolfgangB33r/blogPostMaterial", "path": "/dynatrace-tensorflow-callback/example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># train the model model.fit(x_train, y_train, epochs=5, callbacks=[dt_callback]) # use the model in production while True: model.evaluate(x_test, y_test, verbose=2, callbacks=[dt_callback]) time.sleep(60)<|fim_prefix|># repo: wolfgangB33r/blogPostMaterial path: /dynatrace-tensorflow-callback/ex...
code_fim
hard
{ "lang": "python", "repo": "wolfgangB33r/blogPostMaterial", "path": "/dynatrace-tensorflow-callback/example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, handler, data): self.handler = handler self.data = data def dumps(self): raise NotImplementedError()<|fim_prefix|># repo: snower/watoee path: /watoee/serializes/serialize.py # -*- coding: utf-8 -*- # 16/12/26 # create by: snower <|fim_middle|>class Ser...
code_fim
easy
{ "lang": "python", "repo": "snower/watoee", "path": "/watoee/serializes/serialize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: snower/watoee path: /watoee/serializes/serialize.py # -*- coding: utf-8 -*- # 16/12/26 # create by: snower class Serialize(object): def __init__(self, handler, data): <|fim_suffix|> def dumps(self): raise NotImplementedError()<|fim_middle|> self.handler = handler se...
code_fim
easy
{ "lang": "python", "repo": "snower/watoee", "path": "/watoee/serializes/serialize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ecmwf/kronos path: /kronos_modeller/kronos_modeller/post_process/exporter_base.py # (C) Copyright 1996-2018 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, E...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/kronos", "path": "/kronos_modeller/kronos_modeller/post_process/exporter_base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # check that export type is consistent with the class type if export_config["type"] != self.export_type: raise ConfigurationError("Export type {}, does not match class: {}".format(export_config["type"], ...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/kronos", "path": "/kronos_modeller/kronos_modeller/post_process/exporter_base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> export_type = "BaseExporter" default_export_format = None optional_configs = [] def __init__(self, sim_set=None): self.sim_set = sim_set self.export_config = None def export(self, export_config, output_path, job_classes, **kwargs): self.export_config = export...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/kronos", "path": "/kronos_modeller/kronos_modeller/post_process/exporter_base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vektorelpython24proje/Sqlsamples path: /IBRAHIM/dbinsert.py import sqlite3 as sql try: db = sql.connect(r"chinook\chinook.db") cur = db.cursor() # insert sorgusunu yazarak işlemi gerçekleştireceğiz. isim = inpu<|fim_suffix|>VALUES ('{isim}','{soyisim}','{email}')""" cur.exe...
code_fim
medium
{ "lang": "python", "repo": "vektorelpython24proje/Sqlsamples", "path": "/IBRAHIM/dbinsert.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(f"Kayıt Id {cur.execute(sorgu).fetchone()[0]}") except Exception as hata: db.rollback() print("Hata Mesajı :",hata) finally: cur.close() db.close()<|fim_prefix|># repo: vektorelpython24proje/Sqlsamples path: /IBRAHIM/dbinsert.py import sqlite3 as sql try: db = sql.connect(r"chi...
code_fim
medium
{ "lang": "python", "repo": "vektorelpython24proje/Sqlsamples", "path": "/IBRAHIM/dbinsert.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: catchin91/hide-and-seek path: /evaluation.py import tensorflow as tf from pathlib import Path import numpy as np import os import pickle as pkl import matplotlib.pyplot as plt from sklearn.metrics import accuracy_score import utils from utils.options import config import networks class HNSEval...
code_fim
hard
{ "lang": "python", "repo": "catchin91/hide-and-seek", "path": "/evaluation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i, (x, y) in enumerate(data): preds = self.model(x)['seeker_output'] y_pred = [np.argmax(p) for p in preds] y_true = [np.argmax(p) for p in y] accuracy(accuracy_score(y_true, y_pred)) if i == steps: break r...
code_fim
hard
{ "lang": "python", "repo": "catchin91/hide-and-seek", "path": "/evaluation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> context = super(ThemePackageView, self).get_context_data(**kwargs) broker = get_broker() context.update({ 'notifications': { 'card_updated': { 'title': _("Card updated"), 'descr': _("This notification is sent when ...
code_fim
hard
{ "lang": "python", "repo": "jpoechill/djaoapp", "path": "/djaoapp/views/custom_themes.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpoechill/djaoapp path: /djaoapp/views/custom_themes.py # Copyright (c) 2019, DjaoDjin inc. # see LICENSE from django.utils.translation import ugettext_lazy as _ from multitier.mixins import build_absolute_uri from multitier.thread_locals import get_current_site from saas.models import get_broke...
code_fim
hard
{ "lang": "python", "repo": "jpoechill/djaoapp", "path": "/djaoapp/views/custom_themes.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> sim = load_simul(sim_data / f"session_{session_id:02d}") assert sim.params.output.session_id == session_id @pytest.mark.parametrize("session_id", (0, 1)) def test_load_simul_session(sim_data, session_id): sim = load_simul(sim_data, session_id=session_id) assert sim.params.output.session_...
code_fim
medium
{ "lang": "python", "repo": "snek5000/snek5000", "path": "/tests/test_load_simul.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: snek5000/snek5000 path: /tests/test_load_simul.py import pytest from snek5000 import load_simul <|fim_suffix|> sim = load_simul(sim_data, session_id=session_id) assert sim.params.output.session_id == session_id<|fim_middle|>@pytest.mark.parametrize("session_id", (0, 1)) def test_load_si...
code_fim
hard
{ "lang": "python", "repo": "snek5000/snek5000", "path": "/tests/test_load_simul.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: matthijsbrouwer/elabjournal-python path: /elabjournal/elabjournal/SampleMeta.py from .eLABJournalObject import * import urllib.parse class SampleMeta(eLABJournalObject): def __init__(self, api, sample_id, data): if ((data is not None) & (sample_id is not None) & (type(data...
code_fim
hard
{ "lang": "python", "repo": "matthijsbrouwer/elabjournal-python", "path": "/elabjournal/elabjournal/SampleMeta.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ kwargs["sampleID"] = self.__sampleID kwargs["sampleMetaID"] = self.id() self._eLABJournalObject__api.update_sample_meta(*list(args), **dict(kwargs)) rp = self._eLABJournalObject__api._request("/api/v1/samples/"+urllib.parse.quote(str(kwargs["sampleID"]))+"/m...
code_fim
hard
{ "lang": "python", "repo": "matthijsbrouwer/elabjournal-python", "path": "/elabjournal/elabjournal/SampleMeta.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Get value. """ return(self.__value) def update(self, *args, **kwargs): """ Update the meta. See update_sample_meta on the api for the available/allowed parameters """ kwargs["sampleID"] =...
code_fim
hard
{ "lang": "python", "repo": "matthijsbrouwer/elabjournal-python", "path": "/elabjournal/elabjournal/SampleMeta.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: roma-guru/ricksay path: /scripts/imdb_parser.py #!/usr/bin/env python3 import os from requests_html import HTMLSession print("Starting") session = HTMLSession() r = session.get("https://www.imdb.com/title/tt2861424/quotes") # characters to save q<|fim_suffix|>(fname, "w") print("Parsing main p...
code_fim
hard
{ "lang": "python", "repo": "roma-guru/ricksay", "path": "/scripts/imdb_parser.py", "mode": "psm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_suffix|>text if len(span) else None if char and char in characters: file = char_files[char] file.write(f"{q.text}\n%\n") # be nice, close at end for f in char_files.values(): f.close()<|fim_prefix|># repo: roma-guru/ricksay path: /scripts/imdb_parser.py #!/usr/bin/env python3 import os ...
code_fim
hard
{ "lang": "python", "repo": "roma-guru/ricksay", "path": "/scripts/imdb_parser.py", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_suffix|> def _combine(self): # 组合资源方法 try: print("开始组合资源...") identification = str(floor(time.time())) exec_str = r'copy /b "' + self._path + r'*.ts" "' + self._path + 'video' + identification + '.mp4"' os.system(exec_str) # 使用cmd命令将资源整合 exec_str = r'del "' + self._pa...
code_fim
hard
{ "lang": "python", "repo": "zunzhuowei/python-study", "path": "/demo09/M3U8Download.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @retry() def _download(self, path, url): # 同步下载方法 with requests.get(url, headers=self._headers) as r: if r.status_code == 200: with open(self._path + path, "wb")as file: file.write(r.content) self._ml.append(0) # 每成功一个就往进程通信列表增加...
code_fim
hard
{ "lang": "python", "repo": "zunzhuowei/python-study", "path": "/demo09/M3U8Download.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }