text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """ Testing lineage using randomly generated lineage data """ M, W = simulation.generate_poisson_lineage(3, 100, 50) sim_data = simulation.generate_state_data(M, W) sim_data = sim_data + 1e-8 m2 = M + np.random.random(M.shape) - 0.5 curves, f...
code_fim
medium
{ "lang": "python", "repo": "tmoerman/uncurl_python", "path": "/tests/test_lineage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tmoerman/uncurl_python path: /tests/test_lineage.py from unittest import TestCase from flaky import flaky import numpy as np from uncurl import simulation, lineage, pseudotime @flaky class LineageTest(TestCase): def setUp(self): pass def test_lineage(self): <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "tmoerman/uncurl_python", "path": "/tests/test_lineage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Test pseudotime calculations """ M, W = simulation.generate_poisson_lineage(3, 100, 50) sim_data = simulation.generate_state_data(M, W) sim_data = sim_data + 1e-8 m2 = M + np.random.random(M.shape) - 0.5 curves, fitted_vals, edges, assign...
code_fim
hard
{ "lang": "python", "repo": "tmoerman/uncurl_python", "path": "/tests/test_lineage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rmatam/vivotools path: /test_get_publication_venue.py """ test_get_publication_venue.py -- Given a URI of a publication_venue, return a python structure representing the attributes of the publication_venue <|fim_suffix|>import vivotools as vt from datetime import datetime print datetime...
code_fim
hard
{ "lang": "python", "repo": "rmatam/vivotools", "path": "/test_get_publication_venue.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>import vivotools as vt from datetime import datetime print datetime.now(),"Start" publication_venues = [ "http://vivo.ufl.edu/individual/n4766035388", "http://vivo.ufl.edu/individual/n3893423675", "http://vivo.ufl.edu/individual/n7233910538", "http://vivo.ufl.edu/individual/n1503430672", ...
code_fim
hard
{ "lang": "python", "repo": "rmatam/vivotools", "path": "/test_get_publication_venue.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.process.sendline(code + ' -P' + pid) def group_text_by_key(self, raw_list, key): hookMap = {} for item in raw_list: if item[key]: if item[key] not in hookMap: hookMap[item[key]] = item else: ...
code_fim
hard
{ "lang": "python", "repo": "agloo/Game2Text", "path": "/textractor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agloo/Game2Text path: /textractor.py from parse import parse from pathlib import Path import time import re import os, sys import threading from tools import path_to_wexpect from util import RepeatedTimer import platform is_windows = (platform.system() == 'Windows') if is_windows: ...
code_fim
hard
{ "lang": "python", "repo": "agloo/Game2Text", "path": "/textractor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcjefix/Pluton path: /Plugins/Pluton/Plugins/Welcome/Welcome.py import clr clr.AddReferenceByPartialName("Pluton") import Pluton from System import String <|fim_suffix|> Server.Broadcast(player.Name + " has joined the server!") player.Message(String.Format("This server is working with Plu...
code_fim
easy
{ "lang": "python", "repo": "mcjefix/Pluton", "path": "/Plugins/Pluton/Plugins/Welcome/Welcome.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Server.Broadcast(player.Name + " has joined the server!") player.Message(String.Format("This server is working with Pluton[{0}]", Pluton.Bootstrap.Version)) player.Message("Type /help for a list of commands") player.Inventory.Add(6604,40) player.Inventory.Add(11963, 1)<|fim_prefix|># r...
code_fim
easy
{ "lang": "python", "repo": "mcjefix/Pluton", "path": "/Plugins/Pluton/Plugins/Welcome/Welcome.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def On_PlayerConnected(self, player): Server.Broadcast(player.Name + " has joined the server!") player.Message(String.Format("This server is working with Pluton[{0}]", Pluton.Bootstrap.Version)) player.Message("Type /help for a list of commands") player.Inventory.Add(6604,40) player....
code_fim
easy
{ "lang": "python", "repo": "mcjefix/Pluton", "path": "/Plugins/Pluton/Plugins/Welcome/Welcome.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AccelByte/accelbyte-python-sdk path: /accelbyte_py_sdk/api/basic/wrappers/_misc.py ace=namespace, ) return run_request(request, additional_headers=x_additional_headers, **kwargs) @same_doc_as(DeleteCountryGroup) async def delete_country_group_async( country_group_code: str, name...
code_fim
hard
{ "lang": "python", "repo": "AccelByte/accelbyte-python-sdk", "path": "/accelbyte_py_sdk/api/basic/wrappers/_misc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> consumes: [] produces: ["application/json"] securities: [BEARER_AUTH] namespace: (namespace) REQUIRED str in path Responses: 200: OK - Dict[str, Any] (successful operation) 400: Bad Request - ValidationErrorEntity (20002: validation error) ...
code_fim
hard
{ "lang": "python", "repo": "AccelByte/accelbyte-python-sdk", "path": "/accelbyte_py_sdk/api/basic/wrappers/_misc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AccelByte/accelbyte-python-sdk path: /accelbyte_py_sdk/api/basic/wrappers/_misc.py if namespace is None: namespace, error = get_services_namespace() if error: return None, error request = AddCountryGroup.create( body=body, namespace=namespace, ...
code_fim
hard
{ "lang": "python", "repo": "AccelByte/accelbyte-python-sdk", "path": "/accelbyte_py_sdk/api/basic/wrappers/_misc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> html.H6('Over:', style={'marginLeft': '1.5em'}), dcc.RadioItems( id='tab-pred-incr-radio', options=[{'label': '{} day'.format(str(i)), 'value': i} for i in ['1', '25']], value='1', ), html.Button( id='tab-pred-pca', ...
code_fim
hard
{ "lang": "python", "repo": "Heringer-Epson/IR_forecaster", "path": "/tabs/tab_pred.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ], style={'display': 'flex', 'marginTop': '1.5em'}), html.Div([ html.H6('Model:', style={'marginLeft': '1.5em', }), dcc.Dropdown( id='tab-pred-model-dropdown', options=[{'label': i, 'value': i} for i in ['Vasicek', 'Brownian']], value='Vasi...
code_fim
hard
{ "lang": "python", "repo": "Heringer-Epson/IR_forecaster", "path": "/tabs/tab_pred.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Heringer-Epson/IR_forecaster path: /tabs/tab_pred.py import dash_html_components as html import dash_core_components as dcc tab_pred_layout = html.Div([ html.Div([ html.H6( 'Predict Term Structure', style={'marginLeft': '1.5em', 'font-weight':'bold'} )...
code_fim
hard
{ "lang": "python", "repo": "Heringer-Epson/IR_forecaster", "path": "/tabs/tab_pred.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: modichirag/galmodel path: /code/recon/checkrecongal.py import numpy as np import sys, os sys.path.append('../utils/') import tools import matplotlib.pyplot as plt bs, nc = 400, 128 seed = 100 numd = 1e-3 ofolder = './saved/L%04d_N%04d_S%04d_n%02d/anneal4/nc0norm-truth/'%(bs, nc, seed, numd*1e4...
code_fim
hard
{ "lang": "python", "repo": "modichirag/galmodel", "path": "/code/recon/checkrecongal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>######### truemesh = np.load(ofolder + 'truth.f4.npy') reconmesh = np.load(ofolder + reconfile) fig, ax = plt.subplots(1, 3, figsize = (9, 4), sharex=True) fig, ax = plt.subplots(1, 3, figsize = (13, 4)) im = ax[0].imshow(truemesh.sum(axis=0)) plt.colorbar(im, ax=ax[0]) ax[0].set_title('Truth') im = a...
code_fim
hard
{ "lang": "python", "repo": "modichirag/galmodel", "path": "/code/recon/checkrecongal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: red-hat-storage/ocs-ci path: /ocs_ci/ocs/resources/drpc.py """ DRPlacementControl related functionalities """ import logging from ocs_ci.framework import config from ocs_ci.ocs import constants from ocs_ci.ocs.ocp import OCP from ocs_ci.utility.utils import TimeoutSampler logger = logging.getLo...
code_fim
medium
{ "lang": "python", "repo": "red-hat-storage/ocs-ci", "path": "/ocs_ci/ocs/resources/drpc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_drpc_name(namespace): """ Get the DRPC resource name in the given namespace Args: namespace (str): Name of the namespace Returns: str: DRPC resource name """ config.switch_acm_ctx() drpc_obj = OCP(kind=constants.DRPC, namespace=namespace).get()["items...
code_fim
hard
{ "lang": "python", "repo": "red-hat-storage/ocs-ci", "path": "/ocs_ci/ocs/resources/drpc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_drpc_name(namespace): """ Get the DRPC resource name in the given namespace Args: namespace (str): Name of the namespace Returns: str: DRPC resource name """ config.switch_acm_ctx() drpc_obj = OCP(kind=constants.DRPC, namespace=namespace).get()["item...
code_fim
hard
{ "lang": "python", "repo": "red-hat-storage/ocs-ci", "path": "/ocs_ci/ocs/resources/drpc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_priming_embeddings(self, vec): self.priming_embeddings = torch.nn.Parameter(torch.tensor(vec).to(self.lm.device)) def get_priming_embeddings(self): return self.priming_embeddings.cpu().data.numpy() def predict(self, batch, get_loss=False): config = self.co...
code_fim
hard
{ "lang": "python", "repo": "SawanKumar28/pero", "path": "/src/lm_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SawanKumar28/pero path: /src/lm_utils.py import torch import torch.nn.functional as F from transformers import AutoConfig, AutoTokenizer, AutoModelForMaskedLM from src.task_utils import label_text_map class LMPredictor(torch.nn.Module): def get_default_config(): config = { ...
code_fim
hard
{ "lang": "python", "repo": "SawanKumar28/pero", "path": "/src/lm_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: digital-asset/dazl-client path: /python/dazl/_gen/com/daml/ledger/api/v1/ledger_offset_pb2.py # Copyright (c) 2017-2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # fmt: off # isort: skip_file # -*- coding: utf-8 -*- # Genera...
code_fim
hard
{ "lang": "python", "repo": "digital-asset/dazl-client", "path": "/python/dazl/_gen/com/daml/ledger/api/v1/ledger_offset_pb2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\026com.daml.ledger.api.v1B\026LedgerOffsetOuterClassZEgithub.com/digital-asset/dazl-client/v7/go/api/com/daml/ledger/api/v1\252\002\026Com.Daml.Ledger.Api.V1' _LEDGEROFFSET._serialized_start=71 _LEDGEROFFSET._serialized_end=259 _LE...
code_fim
hard
{ "lang": "python", "repo": "digital-asset/dazl-client", "path": "/python/dazl/_gen/com/daml/ledger/api/v1/ledger_offset_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rxl7906/ToolShare path: /Before R2/MostRecent/.svn/pristine/7c/7c4fb803ee35e72f6e677ff5dda06fdcb11c4103.svn-base from django.conf.urls import patterns, url from tools import views urlpatterns = patterns('', url(r'^add_tool/$', views.add_tool, name='add_tool'), url(r'^delete_tool/$', views.dele...
code_fim
medium
{ "lang": "python", "repo": "rxl7906/ToolShare", "path": "/Before R2/MostRecent/.svn/pristine/7c/7c4fb803ee35e72f6e677ff5dda06fdcb11c4103.svn-base", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_tool'), url(r'^make_available/$', views.make_available, name='make_available'), url(r'^make_unavailable/$', views.make_unavailable, name='make_unavailable'), )<|fim_prefix|># repo: rxl7906/ToolShare path: /Before R2/MostRecent/.svn/pristine/7c/7c4fb803ee35e72f6e677ff5dda06fdcb11c4103.svn-base from dja...
code_fim
hard
{ "lang": "python", "repo": "rxl7906/ToolShare", "path": "/Before R2/MostRecent/.svn/pristine/7c/7c4fb803ee35e72f6e677ff5dda06fdcb11c4103.svn-base", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shaxov/spy-eye path: /frame/filters.py import abc import cv2 class AbstractFilter: @abc.abstractmethod def __call__(self, frame): pass @abc.abstractmethod def __repr__(self): pass class FakeFilter(AbstractFilter): def __call__(self, frame): retur...
code_fim
hard
{ "lang": "python", "repo": "shaxov/spy-eye", "path": "/frame/filters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self): return "<GrayScaleFilter()>" def get(name, params=None): if name == 'fake_filter': return FakeFilter() elif name == 'gray_scale_filter': return GrayScaleFilter() else: raise ValueError(f"Frame filter with name '{name}' is not found.") ...
code_fim
hard
{ "lang": "python", "repo": "shaxov/spy-eye", "path": "/frame/filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = AppUser fields = ('id', 'username', 'email', 'first_name', 'last_name', 'email_verified')<|fim_prefix|># repo: ravidhotre/CloudEngine path: /cloudengine/users/serializers.py from cloudengine.users.models import AppUser from rest_framework import serializers class AppUserSerializ...
code_fim
easy
{ "lang": "python", "repo": "ravidhotre/CloudEngine", "path": "/cloudengine/users/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ravidhotre/CloudEngine path: /cloudengine/users/serializers.py from cloudengine.users.models import AppUser from rest_framework import serializers <|fim_suffix|> class Meta: model = AppUser fields = ('id', 'username', 'email', 'first_name', 'last_name', 'email_verified')<|fim...
code_fim
easy
{ "lang": "python", "repo": "ravidhotre/CloudEngine", "path": "/cloudengine/users/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/nix-derivation-tools path: /setup.py import os import setuptools import sys PACKAGE_NAME = "nix_derivation_tools" setuptools.setup( name=PAC<|fim_suffix|>_files = [], entry_points={"console_scripts": [ "derivtool=nix_derivation_tools.cli:main" ]} )<|fim_middle|>K...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/nix-derivation-tools", "path": "/setup.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> provides=setuptools.find_packages("src"), install_requires=open("requirements.txt").readlines(), data_files = [], entry_points={"console_scripts": [ "derivtool=nix_derivation_tools.cli:main" ]} )<|fim_prefix|># repo: pombredanne/nix-derivation-tools path: /setup.py import os impo...
code_fim
medium
{ "lang": "python", "repo": "pombredanne/nix-derivation-tools", "path": "/setup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: danielavarelat/svanno path: /svanno.py import pysam import importlib import sys # sys.path.append('./') import vcf2bedpe import pandas as pd import os import argparse parser = argparse.ArgumentParser() parser.add_argument("-i", "--input", type=str, required=True, help="input vcf") parser.add_arg...
code_fim
hard
{ "lang": "python", "repo": "danielavarelat/svanno", "path": "/svanno.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for feature, tab_file in zip(['gene', 'exon', 'utr', 'intron'], tab_files): tab = pysam.TabixFile(tab_file) bedpe['%s1' % feature] = bedpe.apply(lambda row: query_tab(tab, row['chr1'], row['start1'], row['end1']), axis = 1) bedpe['%s2' % feature] = bedpe.apply(lambda row: query...
code_fim
hard
{ "lang": "python", "repo": "danielavarelat/svanno", "path": "/svanno.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bedpe['annot'] = bedpe.apply(lambda row: '%s%s>>%s%s' % (row['gene1'] + row['gene_class1'] + ':' if row['gene1'] != 'Intergenic' and (row['exon1'] or row['intron1'] or row['utr1']) else row['gene1'], row['utr1'] if row['utr1'] else row['exon1...
code_fim
hard
{ "lang": "python", "repo": "danielavarelat/svanno", "path": "/svanno.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print "%s: %s matches (%s inversions)" % (sys.argv[1], matches, inversions) blast.close() output.close() def test_overlap(query, reference): """ Takes two tuples of coordinates (a query and a reference) and returns a boolean indicating whether the query overlaps any part of the ...
code_fim
hard
{ "lang": "python", "repo": "yuzhenpeng/WGAC", "path": "/blast_wgac_matcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuzhenpeng/WGAC path: /blast_wgac_matcher.py """ Find matches between a set of BLAST results and WGAC coordinates. Run tests: python -m doctest -v blast_wgac_matcher.py """ import csv import logging import pprint import sys logger = logging.getLogger() logging.basicConfig(level=logging.INFO) #...
code_fim
hard
{ "lang": "python", "repo": "yuzhenpeng/WGAC", "path": "/blast_wgac_matcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: szakeri/containenv path: /containenv/containenv/cli/__init__.py """ Usage: containenv [--verbose] [--debug <LEVEL>] ( init | help ) [<args>...] containenv (-V | --version) Options: -V, --version Display the version and exit. -v, --verbose Print logging information to the conso...
code_fim
hard
{ "lang": "python", "repo": "szakeri/containenv", "path": "/containenv/containenv/cli/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>{} See 'containenv help COMMAND' for more information on a specific COMMAND. NOTE: See also 'contain help' which is included in this package. """ _DEFAULT_DOC = __doc__.format("""Common containenv commands: init Prepare a contained environment Dockerfile help Print detailed usage informa...
code_fim
hard
{ "lang": "python", "repo": "szakeri/containenv", "path": "/containenv/containenv/cli/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(): CommandContext(commands, _DEFAULT_DOC, __doc__).execute() if __name__ == '__main__': main()<|fim_prefix|># repo: szakeri/containenv path: /containenv/containenv/cli/__init__.py """ Usage: containenv [--verbose] [--debug <LEVEL>] ( init | help ) [<args>...] containenv (-V | --v...
code_fim
medium
{ "lang": "python", "repo": "szakeri/containenv", "path": "/containenv/containenv/cli/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Check if this user is able to access the socket directory and print a warning if not """ if ( os.access(sock_dir, os.R_OK) and os.access(sock_dir, os.W_OK) and os.access(sock_dir, os.X_OK) ): return else: print( "WARNING: ...
code_fim
hard
{ "lang": "python", "repo": "saltstack/salt", "path": "/tests/eventlisten.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: saltstack/salt path: /tests/eventlisten.py """ Use this script to dump the event data out to the terminal. It needs to know what the sock_dir is. This script is a generic tool to test event output """ import optparse import os import pprint import time import salt.utils.event def parse(): ...
code_fim
hard
{ "lang": "python", "repo": "saltstack/salt", "path": "/tests/eventlisten.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chmlee/ream-python path: /ream/grammar.py """ REAM: Ream Ain't Markdown ~~~~~~~~~~~~~~~~~~~~~~~~~ this file is part of the ream package :copyright: Copyright 2020 by Chih-Ming Louis Lee :license: MIT, see LICENSE for details """ from lark import Lark REAM_RULE = Lark(r""" start: _NL? meta...
code_fim
medium
{ "lang": "python", "repo": "chmlee/ream-python", "path": "/ream/grammar.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> h1_wrapper: _HEADER_1 NAME _NL* variable* h2_wrapper* h2_wrapper: _HEADER_2 NAME _NL* variable* h3_wrapper* h3_wrapper: _HEADER_3 NAME _NL* variable* h4_wrapper* h4_wrapper: _HEADER_4 NAME _NL* variable* h5_wrapper* h5_wrapper: _HEADER_5 NAME _NL* variable* h6_wrapper* h6_wrapper:...
code_fim
hard
{ "lang": "python", "repo": "chmlee/ream-python", "path": "/ream/grammar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> variable: _DASH KEY value _NL* KEY: /.+:/ value: string_wrapper | star_list string_wrapper: STRING (COMMENT)* STRING: /[^\*].*/ COMMENT: / *>.+/ star_list: (_STAR element)+ _NL* element: STRING (COMMENT)* %import common.NEWLINE -> _NL %import common....
code_fim
hard
{ "lang": "python", "repo": "chmlee/ream-python", "path": "/ream/grammar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert out == """MSG: The message DETAIL: The detail HINT: The hint STRUCTURED: time=2012-01-01T00.1234-00 pid=1234 structured-data=yes""" # Try without structured data out = log_help.WalELogger.fmt_logline( 'The message', 'The detail', 'The hint') out = sanitize_log(out) ass...
code_fim
medium
{ "lang": "python", "repo": "Nextdoor/wal-e", "path": "/tests/test_log_help.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> out = log_help.WalELogger.fmt_logline( 'The message', 'The detail', 'The hint', {'structured-data': 'yes'}) out = sanitize_log(out) assert out == """MSG: The message DETAIL: The detail HINT: The hint STRUCTURED: time=2012-01-01T00.1234-00 pid=1234 structured-data=yes""" # Try wit...
code_fim
medium
{ "lang": "python", "repo": "Nextdoor/wal-e", "path": "/tests/test_log_help.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nextdoor/wal-e path: /tests/test_log_help.py import re import wal_e.log_help as log_help def sanitize_log(log): return re.sub(r'time=[0-9T:\-\.]+ pid=\d+', 'time=2012-01-01T00.1234-00 pid=1234', log) def test_nonexisting_socket(tmpdir): # Must not ...
code_fim
hard
{ "lang": "python", "repo": "Nextdoor/wal-e", "path": "/tests/test_log_help.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mindspore-ai/mindinsight path: /mindinsight/optimizer/cli.py # Copyright 2020 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 may obtain a copy of the License at # # http://ww...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/mindinsight", "path": "/mindinsight/optimizer/cli.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class IterAction(argparse.Action): """Summary base dir action class definition.""" def __call__(self, parser_in, namespace, values, option_string=None): """ Inherited __call__ method from argparse.Action. Args: parser_in (ArgumentParser): Passed-in argument p...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/mindinsight", "path": "/mindinsight/optimizer/cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shyam8898/dsmp-pre-work path: /Student-Managemnet-System/code.py # -------------- # Code starts here class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] class_2=['Hilary Mason','Carla Gentry','Corinna Cortes'] new_class=class_1 + class_2 new_class.append('Peter Warden') ne...
code_fim
hard
{ "lang": "python", "repo": "shyam8898/dsmp-pre-work", "path": "/Student-Managemnet-System/code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Code ends here # -------------- # Given string topper = 'andrew ng' # Code starts here first_name=topper.split()[0] last_name=topper.split()[1] full_name=last_name + " " + first_name certificate_name=full_name.upper() print(certificate_name) # Code ends here<|fim_prefix|># repo: shyam8898/dsmp-pre...
code_fim
hard
{ "lang": "python", "repo": "shyam8898/dsmp-pre-work", "path": "/Student-Managemnet-System/code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JennyHan2016/ProxyPool path: /flaskmodel/flasktest.py from flask import Flask,g # 2. 创建flask应用程序实例 # 需要传入__name__,作用是为了确定资源所在的路径 app = Flask(__name__) # 3. 定义路由及视图函数 # Flask中定义路由是通过装饰器实现的 # 路由默认只支持get,如果需要增加,需要自行指定 @app.route('/',methods=['GET','POST']) def index(): <|fim_suffix|> return '...
code_fim
medium
{ "lang": "python", "repo": "JennyHan2016/ProxyPool", "path": "/flaskmodel/flasktest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return 'order_id %s' % order_id # 参数类型默认是字符串unicode # 要对参数作优化,比如说指定参数类型为int类型:在视图函数的()内填入参数名,那么后面的代码才能去使用 #启动程序 if __name__ == '__main__': app.run()<|fim_prefix|># repo: JennyHan2016/ProxyPool path: /flaskmodel/flasktest.py from flask import Flask,g # 2. 创建flask应用程序实例 # 需要传入__name__,作用是为了确定...
code_fim
medium
{ "lang": "python", "repo": "JennyHan2016/ProxyPool", "path": "/flaskmodel/flasktest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # 使用同一个视图函数,来显示不同用户的订单信息 # <>定义路由的参数,<>内需要起个名字 @app.route('/order/<int:order_id>') def get_order(order_id): return 'order_id %s' % order_id # 参数类型默认是字符串unicode # 要对参数作优化,比如说指定参数类型为int类型:在视图函数的()内填入参数名,那么后面的代码才能去使用 #启动程序 if __name__ == '__main__': app.run()<|fim_prefix|># repo: JennyHan2016...
code_fim
medium
{ "lang": "python", "repo": "JennyHan2016/ProxyPool", "path": "/flaskmodel/flasktest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ridwanultanvir/BUET_Alumni_Portal path: /Events/views.py from django.shortcuts import render from django.http import HttpResponse from django.http import Http404 from django.shortcuts import render,redirect from django.core.exceptions import ValidationError from django import forms from django.ht...
code_fim
hard
{ "lang": "python", "repo": "ridwanultanvir/BUET_Alumni_Portal", "path": "/Events/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if sql.endswith('INTERSECT '): sql = sql[:-len('INTERSECT ')]+ ')' print(sql) else: msg = 'Please Type' return render(request,'Events/index.html',{'form':form, 'msg' : message}) c.execute(sq...
code_fim
hard
{ "lang": "python", "repo": "ridwanultanvir/BUET_Alumni_Portal", "path": "/Events/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_base(self, N4): """Calc bases of factors :math:`b_i`""" tensors = mechkit.tensors.Basic() I2 = tensors.I2 I4s = tensors.I4s N4 = self._con.to_tensor(N4) N2 = np.einsum("ijkl, kl->ij", N4, I2) def dyad(A, B): return np.einsum...
code_fim
hard
{ "lang": "python", "repo": "JulianKarlBauer/mechmean", "path": "/mechmean/orientation_averager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> base[1, :] = dyad(N2, I2) + dyad(I2, N2) base[2, :] = ( N2_box_I2 + np.einsum("ijkl->ijlk", N2_box_I2) + np.einsum("ijkl->klij", I2_box_N2) + np.einsum("ijkl->ijlk", I2_box_N2) ) base[3, :] = dyad(I2, I2) base[4, :] ...
code_fim
hard
{ "lang": "python", "repo": "JulianKarlBauer/mechmean", "path": "/mechmean/orientation_averager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JulianKarlBauer/mechmean path: /mechmean/orientation_averager.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Orientation averager """ import numpy as np import mechkit class AdvaniTucker: r"""Orientation averaging following [Advani1987]_ The orientation average of a fourth order...
code_fim
hard
{ "lang": "python", "repo": "JulianKarlBauer/mechmean", "path": "/mechmean/orientation_averager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>n_files = len(label_files) for i in range(n_files): lbl = np.load(join(path_to_labels, label_files[i])) savename = label_files[i].replace('_r.npy', '_dcrf_2.png') cv2.imwrite(join(path_to_masks, savename), lbl[:, :, 0]*255)<|fim_prefix|># repo: haqatak/soccerontable path: /soccer3d/soccerdep...
code_fim
medium
{ "lang": "python", "repo": "haqatak/soccerontable", "path": "/soccer3d/soccerdepth/data/get_masks_from_labels.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>label_files = listdir(path_to_labels) label_files = [i for i in label_files if '_r.npy' in i] label_files.sort() n_files = len(label_files) for i in range(n_files): lbl = np.load(join(path_to_labels, label_files[i])) savename = label_files[i].replace('_r.npy', '_dcrf_2.png') cv2.imwrite(join...
code_fim
hard
{ "lang": "python", "repo": "haqatak/soccerontable", "path": "/soccer3d/soccerdepth/data/get_masks_from_labels.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: haqatak/soccerontable path: /soccer3d/soccerdepth/data/get_masks_from_labels.py import numpy as np import os import utils.files as file_utils import cv2 import utils.io as io import argparse from os.path import join, exists from os import listdir np.set_printoptions(suppress=True) <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "haqatak/soccerontable", "path": "/soccer3d/soccerdepth/data/get_masks_from_labels.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: smarr/ReBench path: /rebench/tests/bugs/issue_54_extra_args_test.py from ..rebench_test_case import ReBenchTestCase from ...configurator import Configurator, load_config from ...persistence import DataStore <|fim_suffix|> def setUp(self): super(Issue54Test, self).setUp() se...
code_fim
medium
{ "lang": "python", "repo": "smarr/ReBench", "path": "/rebench/tests/bugs/issue_54_extra_args_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_expansion_of_extra_args(self): cnf = Configurator(load_config(self._path + '/issue_54.conf'), DataStore(self.ui), self.ui, None, 'Test') runs = cnf.get_runs() self.assertEqual(1, len(runs)) self.assertIn('INPUT_SIZE', list(runs)[0].c...
code_fim
medium
{ "lang": "python", "repo": "smarr/ReBench", "path": "/rebench/tests/bugs/issue_54_extra_args_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> runs = cnf.get_runs() self.assertEqual(1, len(runs)) self.assertIn('INPUT_SIZE', list(runs)[0].cmdline())<|fim_prefix|># repo: smarr/ReBench path: /rebench/tests/bugs/issue_54_extra_args_test.py from ..rebench_test_case import ReBenchTestCase from ...configurator import Configura...
code_fim
hard
{ "lang": "python", "repo": "smarr/ReBench", "path": "/rebench/tests/bugs/issue_54_extra_args_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if netstat > 0 : cros = 1 if self.T.chkCros(item[1]) else 0 data = { 'title' : str(info['id']) if info['id'] != '' else str(info['title']), 'url' : str(item[1]), 'quality': s...
code_fim
hard
{ "lang": "python", "repo": "flbooo/iptv-m3u-maker", "path": "/plugins/dotpy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: flbooo/iptv-m3u-maker path: /plugins/dotpy.py #!/usr/bin/env python # -*- coding: utf-8 -*- import tools import time import re class Source (object) : def __init__ (self): self.T = tools.Tools() self.now = int(time.time() * 1000) def getSource (self) : urlList ...
code_fim
hard
{ "lang": "python", "repo": "flbooo/iptv-m3u-maker", "path": "/plugins/dotpy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual((x + 0.5) + (y + 0.5), Nx + Ny) self.assertEqual((x + 0.5) - (y + 0.5), Nx - Ny) self.assertEqual((x + 0.5) * (y + 0.5), Nx * Ny) self.assertEqual((x + 0.5) / (y + 0.5), Nx / Ny) self.assertEqual((x + 0.5) % (...
code_fim
hard
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-Cocoa/PyObjCTest/test_nsnumber.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-Cocoa/PyObjCTest/test_nsnumber.py import operator import os import re import sys import objc import Foundation from PyObjCTools.TestSupport import TestCase, sdkForPython # flake8: noqa: B950 PLIST = b"""\ <?xml version="1.0" encoding="UTF-8"?> <!DOC...
code_fim
hard
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-Cocoa/PyObjCTest/test_nsnumber.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if objc.platform == "MACOSX": class TestPropList(TestCase): # Test if numbers are stored properly in property-list. The most # important part of the testcase are boolean values. # # NOTE: GNUstep uses the old NeXT property lists, and these tests # will fail. ...
code_fim
hard
{ "lang": "python", "repo": "ronaldoussoren/pyobjc", "path": "/pyobjc-framework-Cocoa/PyObjCTest/test_nsnumber.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hash3liZer/proxy.py path: /tests/test_set_open_file_limit.py # -*- coding: utf-8 -*- """ proxy.py ~~~~~~~~ ⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging. :copyright...
code_fim
hard
{ "lang": "python", "repo": "hash3liZer/proxy.py", "path": "/tests/test_set_open_file_limit.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self, mock_set_rlimit: mock.Mock, mock_get_rlimit: mock.Mock) -> None: Proxy.set_open_file_limit(256) mock_get_rlimit.assert_called_with(resource.RLIMIT_NOFILE) mock_set_rlimit.assert_called_with(resource.RLIMIT_NOFILE, (256, 1024)) @mock.pa...
code_fim
hard
{ "lang": "python", "repo": "hash3liZer/proxy.py", "path": "/tests/test_set_open_file_limit.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> data[m][0].append(max_i) data[m][2].append(action_value) actual_ax.plot(data[m][0], data[m][2], label=str(m)) # The two following lines of code are here only for graphic clarity purposes # if m == str((7, 3)) or m ==...
code_fim
hard
{ "lang": "python", "repo": "Scheggetta/aijunbai_analyzed", "path": "/plot.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Scheggetta/aijunbai_analyzed path: /plot.py from matplotlib import pyplot as plt import pandas as pd from collections import defaultdict def main(title, style="fivethirtyeight", end_line_extension=True): # plt.style.use(style) """ Table: 0: Iteration; 1: Move; 2: Q, 3: ...
code_fim
hard
{ "lang": "python", "repo": "Scheggetta/aijunbai_analyzed", "path": "/plot.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> tmp=div(contents) tmp.attrSetClass("span"+str(span)) if fluid and offset > 0 : tmp1=parentRow.insertContents(div("",'class=\"dummy-offset\"')) tmp1.attrAppendClass("span" +str(offset)) else: tmp.attrAppendClass("offset"+ str(offset)) ...
code_fim
hard
{ "lang": "python", "repo": "nickmilon/milonpy", "path": "/milonpy/html_gen/tags_ext.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nickmilon/milonpy path: /milonpy/html_gen/tags_ext.py #!/usr/bin/env python # -*- coding: UTF-8 -*- ####################################################### ''' module: html.gen_ext Created:Apr 10, 2012 author: milon Description: html tags extensions ''' ###############...
code_fim
hard
{ "lang": "python", "repo": "nickmilon/milonpy", "path": "/milonpy/html_gen/tags_ext.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: pos (ndarray (shape=(dim, n_pos))): Array containing the positions to be projected. ref_pos (ndarray (shape=(dim, n_pos))): Array containing the reference position. allow_reflection (bool): If True reflections are allowed beside rotatio...
code_fim
hard
{ "lang": "python", "repo": "zhaoforever/paderwasn", "path": "/paderwasn/geometry_calibration/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhaoforever/paderwasn path: /paderwasn/geometry_calibration/utils.py import numpy as np def est_rot_mat(pos, ref_pos, weights=None, allow_reflection=False): """Rotation matrix estimation for data set matching Estimate the rotation matrix needed to project the positions pos onto the...
code_fim
hard
{ "lang": "python", "repo": "zhaoforever/paderwasn", "path": "/paderwasn/geometry_calibration/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def map2ref(pos, ref_pos, allow_reflection=False): """Mapping of positions into the given reference coordinate system Project the positions pos into the cordinate system specified by the reference positions ref_pos using a data set matching. This corresponds to a projection of the positio...
code_fim
hard
{ "lang": "python", "repo": "zhaoforever/paderwasn", "path": "/paderwasn/geometry_calibration/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mjclawar/alexa-ask-github path: /github_scraper/__init__.py """ File: __init__.py Description: Primary Author(s): Michael Clawar Secondary Author(s): <|fim_suffix|>from .github_scraper import get_top_repositories<|fim_middle|>Notes: January 14, 2017 StratoDem Analytics, LLC """
code_fim
easy
{ "lang": "python", "repo": "mjclawar/alexa-ask-github", "path": "/github_scraper/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from .github_scraper import get_top_repositories<|fim_prefix|># repo: mjclawar/alexa-ask-github path: /github_scraper/__init__.py """ File: __init__.py Description: Primary Author(s): Michael Clawar Secondary Author(s): Notes: <|fim_middle|>January 14, 2017 StratoDem Analytics, LLC """
code_fim
easy
{ "lang": "python", "repo": "mjclawar/alexa-ask-github", "path": "/github_scraper/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mjclawar/alexa-ask-github path: /github_scraper/__init__.py """ File: __init__.py <|fim_suffix|>from .github_scraper import get_top_repositories<|fim_middle|>Description: Primary Author(s): Michael Clawar Secondary Author(s): Notes: January 14, 2017 StratoDem Analytics, LLC """
code_fim
medium
{ "lang": "python", "repo": "mjclawar/alexa-ask-github", "path": "/github_scraper/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> speedActive = 5 * speed speedInactive = 16 * speed letterSleep = 0.5 / speed tfm = coordinateTransform.CoordinateTransform(9.7, angle=math.pi*angle/180) lineDrawer = arm.Arm(tfm, speedActive, speedInactive, letterSleep, brightness) if test: lineDrawer.setStraight() ...
code_fim
medium
{ "lang": "python", "repo": "kongaskristjan/RoboticArm", "path": "/control.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tfm = coordinateTransform.CoordinateTransform(9.7, angle=math.pi*angle/180) lineDrawer = arm.Arm(tfm, speedActive, speedInactive, letterSleep, brightness) if test: lineDrawer.setStraight() time.sleep(2) else: lineDrawer.drawText(str(text)) if __name__ == "__main__...
code_fim
medium
{ "lang": "python", "repo": "kongaskristjan/RoboticArm", "path": "/control.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kongaskristjan/RoboticArm path: /control.py #!/usr/bin/python3 import arm, coordinateTransform import time, fire, math <|fim_suffix|>if __name__ == "__main__": try: fire.Fire(main) except KeyboardInterrupt: del arm<|fim_middle|>def main(speed=1, text="Hello world!", test...
code_fim
hard
{ "lang": "python", "repo": "kongaskristjan/RoboticArm", "path": "/control.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def tree2str(self, t): """ :type t: TreeNode :rtype: str """ if t i...
code_fim
hard
{ "lang": "python", "repo": "franklingu/leetcode-solutions", "path": "/questions/construct-string-from-binary-tree/Solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Output: "1(2()(4))(3)" Explanation: Almost the same as the first example, except we can't omit the first parenthesis pair to break the one-to-one mapping relationship between the input and the output. """ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # ...
code_fim
medium
{ "lang": "python", "repo": "franklingu/leetcode-solutions", "path": "/questions/construct-string-from-binary-tree/Solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: franklingu/leetcode-solutions path: /questions/construct-string-from-binary-tree/Solution.py """ You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be represented by empty parenthesis pair "()". And you ...
code_fim
hard
{ "lang": "python", "repo": "franklingu/leetcode-solutions", "path": "/questions/construct-string-from-binary-tree/Solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print('') # МЕТОД ОГРОМНОЕ МНОЖЕСТВО (часть уже рассмотрели выше - это keys() values() items() см выше # Словарь можно очищать копировать # МОжно удалять значение по ключу - метод pop() УДАЛЯЕТ КЛЮЧ И ВОЗРАЩАЕТ ЗНАЧЕНИЕ !!!!!!!!!!!!!11 print('ИТЕРИРОВАНИЕ ПО СЛОВАРЮ ') # МОЖНО ИТЕРИРОВАТЬСЯ ПО СЛОВАРЮ # ...
code_fim
hard
{ "lang": "python", "repo": "thebestday/python", "path": "/L3/dist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thebestday/python path: /L3/dist.py print('----3.4 Словари ---') # Инициализация словарей - print('----пустой словарь инициализируется фигурными скобками {} ---') dict_temp = {} print(type(dict_temp), dict_temp) print('---словарь наполненный некоторыми (объектами) парами ключ-значение где все зн...
code_fim
hard
{ "lang": "python", "repo": "thebestday/python", "path": "/L3/dist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print('ИТЕРИРОВАНИЕ ПО СЛОВАРЮ ') # МОЖНО ИТЕРИРОВАТЬСЯ ПО СЛОВАРЮ # ИТЕРИРОВАТЬСЯ МОЖНО ТАК ЖЕ КАК И ПО СПИСКАМ # ИТЕРИРОВАНИЕ ПО СЛОВАРЮ ПО КЛЮЧУ И ПО ЗНАЧЕНИЮ print('МЫ ПО ПАРАМ КЛЮЧ ЗНАЧЕНИЯ ИТЕРИРУЕМСЯ В СЛОВАРЕ dict_temp.items()') # МЫ ПО ПАРАМ КЛЮЧ ЗНАЧЕНИЯ ИТЕРИРУЕМСЯ В СЛОВАРЕ dict_temp.items() ...
code_fim
hard
{ "lang": "python", "repo": "thebestday/python", "path": "/L3/dist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndreaCeolin/Functionalism_Contrast_Change path: /Chapter3/Cantonese/cantonese_extractor.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' This is the script used to extract words from CHILDES. The script requires that the Cantonese CANCORP corpus is placed in the same folder of the script. ...
code_fim
hard
{ "lang": "python", "repo": "AndreaCeolin/Functionalism_Contrast_Change", "path": "/Chapter3/Cantonese/cantonese_extractor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>''' Every key of our dictionary currently contains each word and its translation separated by a space. In the process of saving the words and their frequency, we can remove the English translation, which served its purpose of keeping homophones separated. ''' f = open('cantonese_corpus.txt', 'w') i=0 for...
code_fim
hard
{ "lang": "python", "repo": "AndreaCeolin/Functionalism_Contrast_Change", "path": "/Chapter3/Cantonese/cantonese_extractor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>counter = Counter() for name in ['ccc', 'cgk', 'ckt', 'hhc', 'lly', 'ltf', 'mhz', 'wbh']: #these are the CANCORP folders for file in os.listdir(name): ''' A problem with Cantonese is that there are many homophones. By using the English translation, we can separate them, someth...
code_fim
hard
{ "lang": "python", "repo": "AndreaCeolin/Functionalism_Contrast_Change", "path": "/Chapter3/Cantonese/cantonese_extractor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for t in tasks: await t.join() except KeyboardInterrupt: for t in tasks: await t.cancel() await spammers.join() if __name__ == '__main__': addr = sys.argv[1] curio.run(spam, addr)<|fim_prefix|># repo: khaudio/aspammer path: /spa...
code_fim
hard
{ "lang": "python", "repo": "khaudio/aspammer", "path": "/spammer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: khaudio/aspammer path: /spammer.py import collections import sys import curio from curio import socket async def spammer(address, port): async with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.setsoc...
code_fim
hard
{ "lang": "python", "repo": "khaudio/aspammer", "path": "/spammer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from common.business import APIModel from common.local import get_request_username from common.log import sys_logger from datalab.constants import ( END_TIME, KEYWORD, RESULT_TABLE_ID, START_TIME, TIME_TAKEN, TOTAL, ) from datalab.es_query.models import DatalabEsQueryHistory try: ...
code_fim
hard
{ "lang": "python", "repo": "Tencent/bk-base", "path": "/src/api/datalab/es_query/result_table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tencent/bk-base path: /src/api/datalab/es_query/result_table.py # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under t...
code_fim
hard
{ "lang": "python", "repo": "Tencent/bk-base", "path": "/src/api/datalab/es_query/result_table.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }