text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> loop = asyncio.get_event_loop() loop.create_task( main() ) for signame in ('SIGINT', 'SIGTERM'): loop.add_signal_handler( getattr(signal, signame), lambda: asyncio.ensure_future(ask_exit(signame)) ) loop.run_forever()<|fim_prefix|># repo: lianraru/aiokraken path: /aiokraken/...
code_fim
hard
{ "lang": "python", "repo": "lianraru/aiokraken", "path": "/aiokraken/examples/wss_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lianraru/aiokraken path: /aiokraken/examples/wss_example.py import asyncio import signal from aiokraken import WssClient def process_message(message): print(f'processed message {message}') <|fim_suffix|>loop.create_task( main() ) for signame in ('SIGINT', 'SIGTERM'): loop.add_sign...
code_fim
hard
{ "lang": "python", "repo": "lianraru/aiokraken", "path": "/aiokraken/examples/wss_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gczarnocki/grovepi-logger path: /Logger/logger.py # Logowanie temperatury, poziomu swiatla, dzwieku, odleglosci za pomoca RPi # GrovePi + Sound Sensor + Light Sensor + # Temperature Sensor + Ultrasonic Ranger Sensor + LED # http://www.seeedstudio.com/wiki/Grove_-_Sound_Sensor # http://www.seeed...
code_fim
hard
{ "lang": "python", "repo": "gczarnocki/grovepi-logger", "path": "/Logger/logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>timestamp = time.strftime('%Y-%m-%d:%H:%M:%S') log_file = 'logs/' + timestamp + '.log' log = open(log_file, 'a') # Polaczenia light_sensor = 0 # port A0 sound_sensor = 1 # port A1 temperature_sensor = 2 # port D2 led = 3 # port D3 ranger = 4 # port D4 led2 = 5 # port D5 button ...
code_fim
hard
{ "lang": "python", "repo": "gczarnocki/grovepi-logger", "path": "/Logger/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('dashboard', '0004_profile_student_id'), ('student', '0002_auto_20181113_1920'), ] operations = [ migrations.AddField( model_name='student', name='toprofile', field=models.ForeignKey(default='', on_delete=django.db....
code_fim
medium
{ "lang": "python", "repo": "vasundhara7/College-EWallet", "path": "/student/migrations/0003_student_toprofile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vasundhara7/College-EWallet path: /student/migrations/0003_student_toprofile.py # Generated by Django 2.0.9 on 2018-12-10 17:59 from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> dependencies = [ ('dashboard', '0004_profile_student_id'), ...
code_fim
medium
{ "lang": "python", "repo": "vasundhara7/College-EWallet", "path": "/student/migrations/0003_student_toprofile.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __del__(self): #print(self.__class__.__name__, self.market, self.ktype, "__del__") pass @hku_catch(trace=True) def __call__(self): self.status = "no run" capture_multiprocess_all_logger(self.log_queue) use_hdf = False if self.config.getboole...
code_fim
hard
{ "lang": "python", "repo": "fasiondog/hikyuu", "path": "/hikyuu/gui/data/ImportTdxToH5Task.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> count = 0 try: progress = ProgressBar(self) if use_hdf: count = import_data( connect, self.market, self.ktype, self.quotations, self.src_dir, self.dest_dir, progress ) else: count = impo...
code_fim
hard
{ "lang": "python", "repo": "fasiondog/hikyuu", "path": "/hikyuu/gui/data/ImportTdxToH5Task.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fasiondog/hikyuu path: /hikyuu/gui/data/ImportTdxToH5Task.py # coding:utf-8 # # The MIT License (MIT) # # Copyright (c) 2010-2017 fasiondog/hikyuu # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"...
code_fim
hard
{ "lang": "python", "repo": "fasiondog/hikyuu", "path": "/hikyuu/gui/data/ImportTdxToH5Task.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># with open('test.txt', 'r') as f: # input = [int(i) for i in f.read().strip()] # solve(input) with open('input.txt', 'r') as f: input = [int(i) for i in f.read().strip()] solve(input)<|fim_prefix|># repo: amochtar/adventofcode path: /2019/day-16/part1.py #!/usr/bin/env pypy3 def gen_p...
code_fim
hard
{ "lang": "python", "repo": "amochtar/adventofcode", "path": "/2019/day-16/part1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amochtar/adventofcode path: /2019/day-16/part1.py #!/usr/bin/env pypy3 def gen_pattern(i): p = [0] * (i+1) p.extend([1]*(i+1)) p.extend([0]*(i+1)) p.extend([-1]*(i+1)) return p[1:]+p[:1] def phase(inp): output = [0] * len(inp) for i, x in enumerate(inp): pa...
code_fim
hard
{ "lang": "python", "repo": "amochtar/adventofcode", "path": "/2019/day-16/part1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JSJeong-me/2021-K-Digital-Training path: /Web_Crawling/python-crawler/chapter_6/run_crawl.py """scrapy의 quotes 크롤러 호출하기""" from scrapy.crawler import CrawlerProcess from scrapy.utils.project import get_project_settings <|fim_suffix|> """크롤링 실행""" process = CrawlerProcess(get_project_...
code_fim
easy
{ "lang": "python", "repo": "JSJeong-me/2021-K-Digital-Training", "path": "/Web_Crawling/python-crawler/chapter_6/run_crawl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': run_crawl()<|fim_prefix|># repo: JSJeong-me/2021-K-Digital-Training path: /Web_Crawling/python-crawler/chapter_6/run_crawl.py """scrapy의 quotes 크롤러 호출하기""" from scrapy.crawler import CrawlerProcess from scrapy.utils.project import get_project_settings def run_crawl():...
code_fim
medium
{ "lang": "python", "repo": "JSJeong-me/2021-K-Digital-Training", "path": "/Web_Crawling/python-crawler/chapter_6/run_crawl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datarail/msda path: /msda/kmeans.py from sklearn.cluster import KMeans from sklearn.metrics import silhouette_samples, silhouette_score import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec import numpy as np import matplotlib.cm as cm def cluster(dfi, samples, num_clusters=8...
code_fim
hard
{ "lang": "python", "repo": "datarail/msda", "path": "/msda/kmeans.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Initialize the clusterer with n_clusters value and a random generator # seed of 10 for reproducibility. clusterer = KMeans(n_clusters=n_clusters, random_state=10) cluster_labels = clusterer.fit_predict(X) # The silhouette_score gives the average value for all the...
code_fim
hard
{ "lang": "python", "repo": "datarail/msda", "path": "/msda/kmeans.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nikwl/mime-release path: /mime/scene/chain.py import numpy as np import pybullet as pb from .body import Body from .joint import JointArray class Chain(JointArray): def __init__(self, body_id, tip_link_name, client_id): <|fim_suffix|> joints = [i.info for i in body if not i.info.is_...
code_fim
medium
{ "lang": "python", "repo": "nikwl/mime-release", "path": "/mime/scene/chain.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(Chain, self).__init__(body_id, chain_indices, client_id) self._tip = tip self._lowers = lowers self._uppers = uppers self._ranges = np.subtract(uppers, lowers) self._chain_mask = chain_mask @property def tip(self): return self._tip ...
code_fim
medium
{ "lang": "python", "repo": "nikwl/mime-release", "path": "/mime/scene/chain.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mpab/SemanticSearch path: /app/api/context_execute.py # pylint: disable=missing-docstring from typing import Tuple from context_args_parse import Args, ContextArgs from context_types import ( ExecState, SearchContext, SearchContextExt, SearchRequest, ) from document_utilities im...
code_fim
hard
{ "lang": "python", "repo": "mpab/SemanticSearch", "path": "/app/api/context_execute.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while status > 0: status, info = context_execute_by_identifier_hash_step(identifier_hash) print(status, info) return status, info def context_execute_by_context_parameters( context_parameters: ContextArgs, ) -> Tuple[int, str]: request = SearchRequest(context_parameters.data...
code_fim
hard
{ "lang": "python", "repo": "mpab/SemanticSearch", "path": "/app/api/context_execute.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoelLigma/Image-Classification-with-PyTorch path: /train.py # Module Imports import numpy as np import pandas as pd import json import torchvision from torchvision import datasets, transforms, models import torch from torch import nn, optim import torch.nn.functional as F import time import PIL ...
code_fim
medium
{ "lang": "python", "repo": "JoelLigma/Image-Classification-with-PyTorch", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # user inputs from command line in_arg = get_input_args() # load and process data into training, validation and test data sets trainloader, validationloader, testloader, train_data = load_and_transform(in_arg.data_dir) # load pre-trained nn and build classifier with user inputs (loss c...
code_fim
medium
{ "lang": "python", "repo": "JoelLigma/Image-Classification-with-PyTorch", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def parse_args(): parser = ArgumentParser() parser.add_argument("--text", help="input string or path to a .txt file", default=None, type=str) parser.add_argument( "--input_case", help="input capitalization", choices=["lower_cased", "cased"], default="cased", type=str ) parser.a...
code_fim
hard
{ "lang": "python", "repo": "blisc/NeMo", "path": "/nemo_text_processing/text_normalization/normalize_with_audio.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> line = json.loads(line) audio = line['audio_filepath'] if 'transcript' in line: transcript = line['transcript'] else: transcript = asr_model.transcribe([audio])[0] normalized_texts = normalizer.normalize( text=line['text'], verbose=args.verbose, ...
code_fim
hard
{ "lang": "python", "repo": "blisc/NeMo", "path": "/nemo_text_processing/text_normalization/normalize_with_audio.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: blisc/NeMo path: /nemo_text_processing/text_normalization/normalize_with_audio.py # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain...
code_fim
hard
{ "lang": "python", "repo": "blisc/NeMo", "path": "/nemo_text_processing/text_normalization/normalize_with_audio.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>"-c", type=int, help="How many times to print the greeting") parser.add_argument('-f', '--foo', default=42) # we will parse the arguments now args = parser.parse_args() print(args.foo, type(args.foo)) for _ in range(args.c): print(f"Hello {args.name}")<|fim_prefix|># repo: ValR...
code_fim
medium
{ "lang": "python", "repo": "ValRCS/LU_PySem_2020_1", "path": "/src/argreet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ments now args = parser.parse_args() print(args.foo, type(args.foo)) for _ in range(args.c): print(f"Hello {args.name}")<|fim_prefix|># repo: ValRCS/LU_PySem_2020_1 path: /src/argreet.py import argparse if __name__ == "__main__": parser = argparse.ArgumentParser(description='Prin...
code_fim
hard
{ "lang": "python", "repo": "ValRCS/LU_PySem_2020_1", "path": "/src/argreet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ValRCS/LU_PySem_2020_1 path: /src/argreet.py import argparse if __name__ == "__main__": parser = argparse.ArgumentParser(description='Print a greeting') # we will define some a<|fim_suffix|>"-c", type=int, help="How many times to print the greeting") parser.add_argument('-f', '--foo'...
code_fim
medium
{ "lang": "python", "repo": "ValRCS/LU_PySem_2020_1", "path": "/src/argreet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # table_pat to erase all html tag and get only those data between those tags table_pat = re.compile('>([^<^&]+?)<') stock_list = [table_head] for i in tr_list: s = re.findall(table_pat, i) stock_list.append(s) return stock_list dji_list = retrieve_dji_list() for i in d...
code_fim
hard
{ "lang": "python", "repo": "HawkingLaugh/Data-Processing-Using-Python", "path": "/Week2/11. CNN NASDAQ.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HawkingLaugh/Data-Processing-Using-Python path: /Week2/11. CNN NASDAQ.py import re import requests def retrieve_dji_list(): r = requests.get('https://money.cnn.com/data/markets/nasdaq/') # the first row, with each col's title # re.findall(regular expression pattern, string(reque...
code_fim
hard
{ "lang": "python", "repo": "HawkingLaugh/Data-Processing-Using-Python", "path": "/Week2/11. CNN NASDAQ.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def check_local_raylet_liveness(self) -> bool: if self._local_node_address is None: return False liveness = await self._gcs_aio_client.check_alive( [self._local_node_address.encode()], 0.1 ) return liveness[0] async def check_gcs_live...
code_fim
hard
{ "lang": "python", "repo": "ray-project/ray", "path": "/dashboard/modules/healthz/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ray-project/ray path: /dashboard/modules/healthz/utils.py from typing import Optional from ray._private.gcs_utils import GcsAioClient class HealthChecker: def __init__( self, gcs_aio_client: GcsAioClient, local_node_address: Optional[str] = None ): self._gcs_aio_client =...
code_fim
medium
{ "lang": "python", "repo": "ray-project/ray", "path": "/dashboard/modules/healthz/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: devinmatte/packet path: /packet/ldap.py """ Helper functions for working with the csh_ldap library """ from functools import lru_cache from datetime import date from packet import _ldap def _ldap_get_group_members(group): """ :return: A list of CSHMember instances """ return _...
code_fim
hard
{ "lang": "python", "repo": "devinmatte/packet", "path": "/packet/ldap.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def ldap_get_drink_admins(): """ All drink admins :return: A list of CSHMember instances """ return [member.uid for member in _ldap_get_group_members('drink')] def ldap_get_eboard_role(member): """ :param member: A CSHMember instance :return: A String or None """ ...
code_fim
hard
{ "lang": "python", "repo": "devinmatte/packet", "path": "/packet/ldap.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: elibs/epython path: /src/epython/filters.py # -*- coding: utf-8 -*- """ Description: This module contains all types of filters useful for QA Author: Ray Gomez Date: 3/22/21 """ import os import re from epython import errors from epython.environment import _LOG def generic_log_fi...
code_fim
hard
{ "lang": "python", "repo": "elibs/epython", "path": "/src/epython/filters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Capture the log line if we are within the capturing state if capturing: processed_file += line # Find the end position if capturing and end in line: break else: _LOG.info(f"End of {logfile} not found, ca...
code_fim
hard
{ "lang": "python", "repo": "elibs/epython", "path": "/src/epython/filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Find the start position if start in line: capturing = True # Capture the log line if we are within the capturing state if capturing: processed_file += line # Find the end position if capturing and e...
code_fim
hard
{ "lang": "python", "repo": "elibs/epython", "path": "/src/epython/filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vishalbelsare/HyperStream path: /hyperstream/channels/channel_manager.py # The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"...
code_fim
hard
{ "lang": "python", "repo": "vishalbelsare/HyperStream", "path": "/hyperstream/channels/channel_manager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.update_channels() @property def tool_channels(self): """ The tool channels as a list """ return [c for c in self.values() if isinstance(c, ToolChannel)] @property def memory_channels(self): """ The memory channels as a list ...
code_fim
hard
{ "lang": "python", "repo": "vishalbelsare/HyperStream", "path": "/hyperstream/channels/channel_manager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tool_stream_view = None # Look in the main tool channel first if tool_id in self.tools: tool_stream_view = self.tools[tool_id].window((MIN_DATE, self.tools.up_to_timestamp)) else: # Otherwise look through all the channels in the order they were defi...
code_fim
hard
{ "lang": "python", "repo": "vishalbelsare/HyperStream", "path": "/hyperstream/channels/channel_manager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Create and start the RPC server server = ThreadedServer(SlaveService,port=server_port) t = threading.Thread(target=server.start) t.setDaemon(True) t.start() # Send heartbeats while True: heartbeat_sender.send(config.state) time.sleep(1)<|fim_prefix|># repo:...
code_fim
hard
{ "lang": "python", "repo": "cnwangfeng/integration-prototype", "path": "/slave/sip_slave/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cnwangfeng/integration-prototype path: /slave/sip_slave/main.py """ Skeleton slave controller A handler for SIGTERM is set up that just exits because that is what 'Docker stop' sends. """ import os from rpyc.utils.server import ThreadedServer import threading import time from sip_common impor...
code_fim
hard
{ "lang": "python", "repo": "cnwangfeng/integration-prototype", "path": "/slave/sip_slave/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> args = [ 'predictions', 'create', service.create_document_id(), service.create_model_id(), *preprocess_config, *postprocess_config, ] util.main_parser(parser, client, args)<|fim_prefix|># repo: LucidtechAI/las-cli path: /tests/test_predictions.p...
code_fim
hard
{ "lang": "python", "repo": "LucidtechAI/las-cli", "path": "/tests/test_predictions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LucidtechAI/las-cli path: /tests/test_predictions.py import json import pytest from tests import service, util @pytest.mark.parametrize('sort_by', [('--sort-by', 'createdTime')]) @pytest.mark.parametrize('order', [('--order', 'ascending'), ('--order', 'descending')]) def test_predictions_list(p...
code_fim
hard
{ "lang": "python", "repo": "LucidtechAI/las-cli", "path": "/tests/test_predictions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> path_to_directory = os.path.join(str(tmpdir), 'src') result = run_cli_rename(path_to_directory, file_with_the_imports_to_move) assert result.exit_code == 0 with open(file_path, mode='r') as file: assert file.read() == "from x.x import c\nfrom d.e import f\n" def test_run_rename...
code_fim
hard
{ "lang": "python", "repo": "ESSS/module-renamer", "path": "/tests/test_rename_imports.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ESSS/module-renamer path: /tests/test_rename_imports.py import os import pytest from module_renamer.cli import rename @pytest.fixture def run_cli_rename(): def _run_cli_rename(project_path, file_path): from click.testing import CliRunner runner = CliRunner() return ...
code_fim
hard
{ "lang": "python", "repo": "ESSS/module-renamer", "path": "/tests/test_rename_imports.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(file_path, 'w+') as file: file.writelines(['from a.b impot c\n']) # Create the file with the list of imports to move file_with_the_imports_to_move = os.path.join(str(tmpdir), "list_output.py") with open(file_with_the_imports_to_move, 'w+') as file: file.writelin...
code_fim
hard
{ "lang": "python", "repo": "ESSS/module-renamer", "path": "/tests/test_rename_imports.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def load_jupyter_server_extension(nb_server_app): """ Called when the extension is loaded. Args: nb_server_app (NotebookWebApplication): handle to the Notebook webserver instance. """ web_app = nb_server_app.web_app host_pattern = '.*$' route_pattern = url_path_join(we...
code_fim
medium
{ "lang": "python", "repo": "Carreau/remote_ikernel", "path": "/remote_ikernel/webui.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Args: nb_server_app (NotebookWebApplication): handle to the Notebook webserver instance. """ web_app = nb_server_app.web_app host_pattern = '.*$' route_pattern = url_path_join(web_app.settings['base_url'], '/hello') web_app.add_handlers(host_pattern, [(route_pattern, HelloW...
code_fim
medium
{ "lang": "python", "repo": "Carreau/remote_ikernel", "path": "/remote_ikernel/webui.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Carreau/remote_ikernel path: /remote_ikernel/webui.py from notebook.utils import url_path_join from notebook.base.handlers import IPythonHandler <|fim_suffix|> Args: nb_server_app (NotebookWebApplication): handle to the Notebook webserver instance. """ web_app = nb_server_app....
code_fim
medium
{ "lang": "python", "repo": "Carreau/remote_ikernel", "path": "/remote_ikernel/webui.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> with open(os.path.join(model_path, "svm-model.pkl"), "w") as out: pickle.dump(svm, out) print("Training has been completed.") except Exception as e: trc = traceback.format_exc() with open(os.path.join(output_path, "failure"), "w") as s: s.wr...
code_fim
hard
{ "lang": "python", "repo": "mauriciomani/Ecce-Homo", "path": "/sagemaker_examples/pure_genius/folder_all_data/train", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> train_data = pd.read_csv(input_files[0]) X = train_data.drop("DEATH_EVENT", axis = 1) y = train_data["DEATH_EVENT"] C = trainingParams.get("C", 1.0) if C is not 1.0: C = float(C) #train support vector machine svm = SVC(C = C) ...
code_fim
hard
{ "lang": "python", "repo": "mauriciomani/Ecce-Homo", "path": "/sagemaker_examples/pure_genius/folder_all_data/train", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mauriciomani/Ecce-Homo path: /sagemaker_examples/pure_genius/folder_all_data/train #!/usr/bin/env python import os import json import pickle import sys import traceback import pandas as pd from sklearn.svm import SVC prefix = "/opt/ml/" input_path = prefix + "input/data" output_path = os.pat...
code_fim
hard
{ "lang": "python", "repo": "mauriciomani/Ecce-Homo", "path": "/sagemaker_examples/pure_genius/folder_all_data/train", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fnyaoke/School-MS path: /migrations/versions/6661c5d6588c_add_student_id_column.py """Add student id column Revision ID: 6661c5d6588c Revises: 07b82f889002 Create Date: 2020-11-04 16:12:28.307073 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revis...
code_fim
medium
{ "lang": "python", "repo": "fnyaoke/School-MS", "path": "/migrations/versions/6661c5d6588c_add_student_id_column.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: D33pBlue/Apprendimento-Automatico path: /sms_spam/sms_evolutionaryNN_classification.py # -*- coding: utf-8 -*- from __future__ import division import csv,random,pickle import numpy as np from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPClassifier from skl...
code_fim
hard
{ "lang": "python", "repo": "D33pBlue/Apprendimento-Automatico", "path": "/sms_spam/sms_evolutionaryNN_classification.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>X,y = [],[] # with open('sms_spam.csv', 'rb') as csvfile: # recordfile = csv.reader(csvfile, delimiter=',', quotechar='"') # for row in recordfile: # X.append(row[1].decode('latin-1')) # if row[0]=='spam': # y.append(1) # else: # y.append(0) # # save...
code_fim
hard
{ "lang": "python", "repo": "D33pBlue/Apprendimento-Automatico", "path": "/sms_spam/sms_evolutionaryNN_classification.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>keras.utils.plot_model(model, "keras_LSTM_autoencoder.png", show_shapes=True) #%% model.summary() model.compile(optimizer=keras.optimizers.Adam(1e-3), loss='mse') #tf.keras.metrics.mean_squared_error history = model.fit(x_train, y_train, validation_data = (x_val, y_val), ...
code_fim
hard
{ "lang": "python", "repo": "MachineLearningJournalClub/SSVEP_IEEE_SMC_2021", "path": "/Code/ModelSelection/LSTM/LSTM_autoencoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MachineLearningJournalClub/SSVEP_IEEE_SMC_2021 path: /Code/ModelSelection/LSTM/LSTM_autoencoder.py #%% import numpy as np import pandas as pd import tensorflow as tf import scipy.io import random import xgboost as xgb import seaborn as sns from tensorflow import keras from tensorflow.keras import...
code_fim
hard
{ "lang": "python", "repo": "MachineLearningJournalClub/SSVEP_IEEE_SMC_2021", "path": "/Code/ModelSelection/LSTM/LSTM_autoencoder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> BaseCommand[WaitForTemperatureParams, WaitForTemperatureResult] ): """A command to wait for a Temperature Module's target temperature.""" commandType: WaitForTemperatureCommandType = "temperatureModule/waitForTemperature" params: WaitForTemperatureParams result: Optional[WaitForTemper...
code_fim
hard
{ "lang": "python", "repo": "Opentrons/opentrons", "path": "/api/src/opentrons/protocol_engine/commands/temperature_module/wait_for_temperature.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> _ImplementationCls: Type[WaitForTemperatureImpl] = WaitForTemperatureImpl class WaitForTemperatureCreate(BaseCommandCreate[WaitForTemperatureParams]): """A request to create a Temperature Module's wait for temperature command.""" commandType: WaitForTemperatureCommandType = "temperatureModu...
code_fim
hard
{ "lang": "python", "repo": "Opentrons/opentrons", "path": "/api/src/opentrons/protocol_engine/commands/temperature_module/wait_for_temperature.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Opentrons/opentrons path: /api/src/opentrons/protocol_engine/commands/temperature_module/wait_for_temperature.py """Command models to wait for target temperature of a Temperature Module.""" from __future__ import annotations from typing import Optional, TYPE_CHECKING from typing_extensions import...
code_fim
hard
{ "lang": "python", "repo": "Opentrons/opentrons", "path": "/api/src/opentrons/protocol_engine/commands/temperature_module/wait_for_temperature.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ruturaj123/SARKAR.AI path: /jack/io/embeddings/memory_map.py # -*- coding: utf-8 -*- import json import os import numpy as np from jack.io.embeddings import Embeddings def load_memory_map_dir(directory: str) -> Embeddings: """ Loads embeddings from a memory map directory to allow laz...
code_fim
hard
{ "lang": "python", "repo": "Ruturaj123/SARKAR.AI", "path": "/jack/io/embeddings/memory_map.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Saves the given embeddings as memory map file and corresponding meta data in a directory. Args: directory: the directory to store the memory map file in (called `memory_map`) and the meta file (called `meta.json` that stores the shape of the memory map and the actual vocabu...
code_fim
hard
{ "lang": "python", "repo": "Ruturaj123/SARKAR.AI", "path": "/jack/io/embeddings/memory_map.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def save_as_memory_map_dir(directory: str, emb: Embeddings): """ Saves the given embeddings as memory map file and corresponding meta data in a directory. Args: directory: the directory to store the memory map file in (called `memory_map`) and the meta file (called `meta.json` ...
code_fim
hard
{ "lang": "python", "repo": "Ruturaj123/SARKAR.AI", "path": "/jack/io/embeddings/memory_map.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kanaadp/actionflow path: /actionflow/scripts/config_generator.py import numpy as np import cv2 import matplotlib.pyplot as plt import numpy as np from sklearn.cluster import KMeans import json import argparse import sys import tty, termios import rospy from std_msgs.msg import String av_car = ...
code_fim
hard
{ "lang": "python", "repo": "kanaadp/actionflow", "path": "/actionflow/scripts/config_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dst = np.float32([(ts(0, scale), ts(0, scale)), (ts(800, scale), ts(0, scale)), (ts(800, scale), ts(800, scale)), (ts(0, scale), ts(800, scale))]) calibrate_im, _ = unwarp(im, src, dst) calibrate_im = cv2.GaussianBlur(calibrate_im, (...
code_fim
hard
{ "lang": "python", "repo": "kanaadp/actionflow", "path": "/actionflow/scripts/config_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_closest(point, list): find_min = lambda point_1: lambda point_2: similarity(point_1, point_2) closest_point = min(list, key=find_min(point)) return closest_point def unwarp(img, src, dst): h, w = img.shape[:2] # use cv2.getPerspectiveTransform() to get M, the transform matrix,...
code_fim
hard
{ "lang": "python", "repo": "kanaadp/actionflow", "path": "/actionflow/scripts/config_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: self.pnl.unbind() except AttributeError: pass if appType == "viewer": self.pnl = TraceViewerSubApp(toolbarName="Experiment", parent=self) if self.controller.expt is not None: self.controller.experimentLoaded.emit...
code_fim
hard
{ "lang": "python", "repo": "rpauszek/Scripps-smTIRF-GUI", "path": "/smtirf_viewer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rpauszek/Scripps-smTIRF-GUI path: /smtirf_viewer.py # -*- coding: utf-8 -*- """ @author: Raymond F. Pauszek III, Ph.D. (2020) Single-Molecule TIRF Viewer App """ from PyQt5.QtWidgets import QApplication, QSizePolicy from PyQt5 import QtWidgets, QtCore, QtGui import sys from collections import Ord...
code_fim
hard
{ "lang": "python", "repo": "rpauszek/Scripps-smTIRF-GUI", "path": "/smtirf_viewer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _BUST.__init__(self) self.name = "BUSTING" self.specie = 'nouns' self.basic = "bust" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_busting.py from xai.brain.wordbase.nouns._bust import _BUST #calss header class _BUSTING(_BUST, ): <|fim_middle|> def __i...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_busting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_busting.py from xai.brain.wordbase.nouns._bust import _BUST <|fim_suffix|> _BUST.__init__(self) self.name = "BUSTING" self.specie = 'nouns' self.basic = "bust" self.jsondata = {}<|fim_middle|>#calss header class _BUSTING(_BUST, ): def __i...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_busting.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pcmagic/stokes_flow path: /head_Force/diskVane_strain_rate.py import sys import petsc4py petsc4py.init(sys.argv) import numpy as np import pickle # from time import time # from scipy.io import loadmat # from src.stokes_flow import problem_dic, obj_dic from src.geo import * from petsc4py import...
code_fim
hard
{ "lang": "python", "repo": "pcmagic/stokes_flow", "path": "/head_Force/diskVane_strain_rate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': # pythonmpi ../diskVane_strain_rate.py -sm lg_rs -legendre_m 3 -legendre_k 2 -epsilon 3 -ffweight 2 -main_fun_E 1 -diskVane_r1 1 -diskVane_rz 1 -diskVane_r2 0.3 -diskVane_ds 0.05 -diskVane_ph_loc 0 -diskVane_nr 2 -diskVane_nz 2 -diskVane_th_loc 0.7853981633974483 # pytho...
code_fim
hard
{ "lang": "python", "repo": "pcmagic/stokes_flow", "path": "/head_Force/diskVane_strain_rate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lightfold/Nbdler path: /nbdler/url/response.py from nbdler.url.basic import BasicUrl from nbdler.struct.dump import UrlResponseDumpedData class UrlResponse(BasicUrl): def __init__(self, url, headers, code, length): <|fim_suffix|> return UrlResponseDumpedData(url=self.url, headers=di...
code_fim
medium
{ "lang": "python", "repo": "lightfold/Nbdler", "path": "/nbdler/url/response.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return UrlResponseDumpedData(url=self.url, headers=dict(self.headers), code=self.code, length=self.length)<|fim_prefix|># repo: lightfold/Nbdler path: /nbdler/url/response.py from nbdler.url.basic import BasicUrl from nbdler.struct.dump import UrlResponseDump...
code_fim
medium
{ "lang": "python", "repo": "lightfold/Nbdler", "path": "/nbdler/url/response.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return y #### Not finished class AdapterPooler(nn.Module): def __init__(self, input_dim, adapter_dim, init_scale = 1e-3, shared_weights = True): super().__init__() self.adapter_dim = adapter_dim if shared_weights: self.pooler_layer = TimeDistributed( ...
code_fim
hard
{ "lang": "python", "repo": "afogarty85/BERTVision", "path": "/code/tensorflow/utils/model_zoo_torch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: afogarty85/BERTVision path: /code/tensorflow/utils/model_zoo_torch.py import torch from torch import nn from scipy.stats import truncnorm class BertConcat(nn.Module): def __init__(self, seq_length, embeddings, ha, bias=True): super().__init__() #Will only work curren...
code_fim
hard
{ "lang": "python", "repo": "afogarty85/BERTVision", "path": "/code/tensorflow/utils/model_zoo_torch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_file_path_by_file_name(self, dependency_file_name: str): # Get dependency file path by file name result = "" for _, files in self.m_pe_dependency_files.items(): for file in files: file_dir, file_name = file if dependency_file_name.lower() == file_name.lower(): ...
code_fim
hard
{ "lang": "python", "repo": "vn-os/Dependency-Walker", "path": "/DependencyWalker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vn-os/Dependency-Walker path: /DependencyWalker.py import sys, os, pefile, ctypes, pprint, shutil, json, time from PyVutils import File class DependencyWalker: # Dependency Walker g_list_checked_files = set() def __init__(self, target: str, dirs: list, exts: list, verbose: bool): # C...
code_fim
hard
{ "lang": "python", "repo": "vn-os/Dependency-Walker", "path": "/DependencyWalker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Normalize all directories result = [] for dir in dirs: result.append(File.NormalizePath(dir, True)) return result def _get_relative_current_dir(self): # Get relative current directory result = "" if getattr(sys, "frozen", False): result = os.path.dirname(sys.executab...
code_fim
hard
{ "lang": "python", "repo": "vn-os/Dependency-Walker", "path": "/DependencyWalker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> facts = {} for item in object.keys(): facts['FACTER_{}'.format(item)] = object[item] return facts<|fim_prefix|># repo: digitalascension/fact-inject path: /fact_inject/parse/__init__.py import json # Read the JSON file file and convert to a dictionary. def parse_input(json_file): ...
code_fim
medium
{ "lang": "python", "repo": "digitalascension/fact-inject", "path": "/fact_inject/parse/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: digitalascension/fact-inject path: /fact_inject/parse/__init__.py import json # Read the JSON file file and convert to a dictionary. def parse_input(json_file): input_json = None input_obj = None # Read the json file into memory. try: input_json = open(json_file, 'r').rea...
code_fim
hard
{ "lang": "python", "repo": "digitalascension/fact-inject", "path": "/fact_inject/parse/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TTOFFLINE-LEAK/ttoffline path: /v2.5.7/toontown/safezone/DistributedFishingSpotAI.py from direct.directnotify import DirectNotifyGlobal from direct.distributed.DistributedObjectAI import DistributedObjectAI from toontown.fishing import FishGlobals from toontown.fishing.FishBase import FishBase fr...
code_fim
hard
{ "lang": "python", "repo": "TTOFFLINE-LEAK/ttoffline", "path": "/v2.5.7/toontown/safezone/DistributedFishingSpotAI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def d_setOccupied(self, avId): self.sendUpdate('setOccupied', [avId]) def b_setOccupied(self, avId): self.setOccupied(avId) self.d_setOccupied(avId) def doCast(self, p, h): avId = self.air.getAvatarIdFromSender() if self.avId != avId: self....
code_fim
hard
{ "lang": "python", "repo": "TTOFFLINE-LEAK/ttoffline", "path": "/v2.5.7/toontown/safezone/DistributedFishingSpotAI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def d_setMovie(self, mode, code, genus, species, weight, p, h): self.sendUpdate('setMovie', [mode, code, genus, species, weight, p, h]) def removeFromPier(self): taskMgr.remove('timeOut%d' % self.doId) self.cancelAnimation() self.d_setOccupied(0) ...
code_fim
hard
{ "lang": "python", "repo": "TTOFFLINE-LEAK/ttoffline", "path": "/v2.5.7/toontown/safezone/DistributedFishingSpotAI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("[{}-client_thread]({}): {}".format(self.name, self.port, msg)) pass def send(self, data): return self.sock.sendto(data, (self.host, self.port)) def onReceive(self, ip, message) -> None: file = open(ip, "a") file.write(message) file.close...
code_fim
hard
{ "lang": "python", "repo": "witjon/BACnet", "path": "/redez-sem-hs20/groups/07-decentTCP/src/TCPClient.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: witjon/BACnet path: /redez-sem-hs20/groups/07-decentTCP/src/TCPClient.py import socket import sys import struct import os from importlib import reload from threading import Thread import Parser as parser class ClientTCP(Thread): def __init__(self, host, port, name): super(ClientTCP...
code_fim
hard
{ "lang": "python", "repo": "witjon/BACnet", "path": "/redez-sem-hs20/groups/07-decentTCP/src/TCPClient.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def debug(self, msg): print("[{}-client_thread]({}): {}".format(self.name, self.port, msg)) pass def send(self, data): return self.sock.sendto(data, (self.host, self.port)) def onReceive(self, ip, message) -> None: file = open(ip, "a") file.write(m...
code_fim
hard
{ "lang": "python", "repo": "witjon/BACnet", "path": "/redez-sem-hs20/groups/07-decentTCP/src/TCPClient.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DeepLearnPhysics/larcv2 path: /larcv/app/arxiv/mac/dump_img.py from larcv import larcv larcv.IOManager import matplotlib.pyplot as plt from ROOT import TChain import sys <|fim_suffix|>img_tree_name='image2d_%s_tree' % IMAGE_PRODUCER img_br_name='image2d_%s_branch' % IMAGE_PRODUCER img_ch = TChai...
code_fim
medium
{ "lang": "python", "repo": "DeepLearnPhysics/larcv2", "path": "/larcv/app/arxiv/mac/dump_img.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>start=0 cutoff=0 if len(sys.argv) > 3: cutoff = int(sys.argv[3]) if len(sys.argv) > 4: start = int(sys.argv[3]) cutoff = int(sys.argv[4]) for entry in xrange(img_ch.GetEntries()): if entry<start: continue img_ch.GetEntry(entry) img_br=None exec('img_br=img_ch.%s' % img_br_name...
code_fim
medium
{ "lang": "python", "repo": "DeepLearnPhysics/larcv2", "path": "/larcv/app/arxiv/mac/dump_img.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YauHsien/pyetl path: /scripts/sqns_access/.unittest.py import unittest import helpers class TestHelperMethods(unittest.TestCase): def test_header_empty(self): r = helpers.header('', lambda d: {'size': 0}) self.assertEqual(('record', {'header': {'size': 0}, ...
code_fim
hard
{ "lang": "python", "repo": "YauHsien/pyetl", "path": "/scripts/sqns_access/.unittest.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_header(self): r = helpers.header('hello,world', lambda d: {0: 'hello', 1: 'world', 'size': 2}) self.assertEqual(('header', {0: 'hello', ...
code_fim
hard
{ "lang": "python", "repo": "YauHsien/pyetl", "path": "/scripts/sqns_access/.unittest.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> imgrefs = [] cursor = labelfiles.find({}) for rec in cursor: print(rec) imgrefs.append({"img": f"/thumbnail/{rec['unique_filename']}", "name": rec['userfilename']}) return jsonify({'imgrefs': imgrefs}) @app.route("/thumbnail/<uniquefilename>") def render_thumbnail(uniquef...
code_fim
hard
{ "lang": "python", "repo": "apurvasharan/labeltool", "path": "/labelserver/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apurvasharan/labeltool path: /labelserver/app.py from functools import reduce from flask import Flask, request, jsonify, send_from_directory, send_file from flask_cors import CORS import os, sys, random, string, traceback from pymongo import MongoClient import cv2 from werkzeug.utils import secu...
code_fim
hard
{ "lang": "python", "repo": "apurvasharan/labeltool", "path": "/labelserver/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: df_in: transactions dataframe categories: categories to use years: years to include in pie """ df = u.dfs.filter_data(u.uos.b64_to_df(df_in), categories) ...
code_fim
hard
{ "lang": "python", "repo": "villoro/expensor", "path": "/src/pages/page_pies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Updates the incomes pies plots Args: df_in: transactions dataframe categories: categories to use years: years to include in pie """ ...
code_fim
hard
{ "lang": "python", "repo": "villoro/expensor", "path": "/src/pages/page_pies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: villoro/expensor path: /src/pages/page_pies.py """ Dash app """ import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import utilities as u import constants as c import layout as lay from plots import plots_pies as plots class P...
code_fim
hard
{ "lang": "python", "repo": "villoro/expensor", "path": "/src/pages/page_pies.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ehmatthes/legs_of_steel path: /xml_grabber.py # Grab all the trackpoint data. # A trackpoint is a point on the track, not a waypoint? import xml.etree.ElementTree as ET import sys from datetime import datetime tree = ET.parse('tracks.gpx') root = tree.getroot() lats, lons, timestamps, elevati...
code_fim
hard
{ "lang": "python", "repo": "ehmatthes/legs_of_steel", "path": "/xml_grabber.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Find unique days that have tracks. mdy_prev = (0,0,0) for ts in timestamps: month = datetime.strftime(ts, '%B') day = datetime.strftime(ts, '%d') year = datetime.strftime(ts, '%Y') if (month, day, year) != mdy_prev: print month, day, year mdy_prev = (month, day, year)<|fim_pr...
code_fim
medium
{ "lang": "python", "repo": "ehmatthes/legs_of_steel", "path": "/xml_grabber.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Assert all lists same length. print(len(lats), len(lons), len(timestamps), len(elevations)) # Find unique days that have tracks. mdy_prev = (0,0,0) for ts in timestamps: month = datetime.strftime(ts, '%B') day = datetime.strftime(ts, '%d') year = datetime.strftime(ts, '%Y') if (month, d...
code_fim
hard
{ "lang": "python", "repo": "ehmatthes/legs_of_steel", "path": "/xml_grabber.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # elif horloge_monde.contient_l_element_passe_en_parametre_dans_le_tableau_passe_en_parametre("CONFIGURER",tableau_de_la_commande_vocale_de_l_uttilisateur) and horloge_monde.contient_l_element_passe_en_parametre_dans_le_tableau_passe_en_parametre("FAHRENHEIT",tableau_de_la_commande_vocale_de_l_uttil...
code_fim
hard
{ "lang": "python", "repo": "Vicken-Ghoubiguian/smart_connected_alarm_clock", "path": "/modules_python_du_projet/interface_graphique.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }