text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> if not cmd_list: return 'N/A (NOT FOUND)' test_list = cmd_list[0].split(' ') while len(test_list) > 0: test_entry = ' '.join(test_list) all_match = True for entry in cmd_list[1:]: if test_entry not in entry: all_match = False...
code_fim
hard
{ "lang": "python", "repo": "Azure/azure-cli", "path": "/scripts/dump_command_table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Azure/azure-cli path: /scripts/dump_command_table.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license informa...
code_fim
hard
{ "lang": "python", "repo": "Azure/azure-cli", "path": "/scripts/dump_command_table.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import demo import network import diff #import leap import world import dashboard<|fim_prefix|># repo: hrbrmstr/graphiti path: /Scripts/__init__.py print("[__INIT__]") import sys <|fim_middle|>import math as math import random as random import networkx as nx import graphiti as graphiti import standard...
code_fim
medium
{ "lang": "python", "repo": "hrbrmstr/graphiti", "path": "/Scripts/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hrbrmstr/graphiti path: /Scripts/__init__.py print("[__INIT__]") import sys import math as math import random as random import networkx as nx <|fim_suffix|>import demo import network import diff #import leap import world import dashboard<|fim_middle|>import graphiti as graphiti import standard...
code_fim
medium
{ "lang": "python", "repo": "hrbrmstr/graphiti", "path": "/Scripts/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: itineraries/scheduler-and-mapper path: /bing_maps.py #!/usr/bin/env python3 import json, keyring, urllib.parse, urllib.request from datetime import datetime, time _apikey = keyring.get_password("bing_maps", "default") TIME_TYPE_ARRIVE = 0 TIME_TYPE_DEPART = 1 TIME_TYPE_LAST_AVAIL = 2 _time_type_m...
code_fim
hard
{ "lang": "python", "repo": "itineraries/scheduler-and-mapper", "path": "/bing_maps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Arguments: waypoints: A list of places that the route will pass through time_type: Whether dt should indicate the arrival time or the departure time dt: A datetime travel_mode: Walking, transit, or driving metric_s...
code_fim
hard
{ "lang": "python", "repo": "itineraries/scheduler-and-mapper", "path": "/bing_maps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # number of bytes for encoded leads # in the same order as the leads are stored # lead order comes from section3 self.nr_bytes_for_leads = [] self.data = [] # rythm data class Section6(Section): def __init__(self, header, pointer): super().__init__(he...
code_fim
hard
{ "lang": "python", "repo": "ECGKit/scpinfo", "path": "/scp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ECGKit/scpinfo path: /scp.py #!/usr/bin/env python # -*- coding: utf-8 -*- # container for all SCP sections class ScpRecord: def __init__(self): self.crc = 0 self.len = 0 self.sections = [] def has_section(self, section_id): return self.section(section_...
code_fim
hard
{ "lang": "python", "repo": "ECGKit/scpinfo", "path": "/scp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class LeadIdentification: def __init__(self): self.startsample = 0 self.endsample = 0 self.leadid = 0 def __str__(self): return '{0} ({1})'.format(self.leadid, self.sample_count()) def sample_count(self): return self.endsample-self.startsample + 1 # l...
code_fim
hard
{ "lang": "python", "repo": "ECGKit/scpinfo", "path": "/scp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(json.dumps({'params': c._init_params_dict, 'unknowns': c._init_unknowns_dict}))<|fim_prefix|># repo: metamorph-inc/fmu_wrapper path: /fmu_wrapper/get_params_and_unknowns/__main__.py from __future__ import print_function import sys import json from fmu_wrapper.fmu_wrapper import FmuWrapper ...
code_fim
medium
{ "lang": "python", "repo": "metamorph-inc/fmu_wrapper", "path": "/fmu_wrapper/get_params_and_unknowns/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: metamorph-inc/fmu_wrapper path: /fmu_wrapper/get_params_and_unknowns/__main__.py from __future__ import print_function import sys import json from fmu_wrapper.fmu_wrapper import FmuWrapper <|fim_suffix|> print(json.dumps({'params': c._init_params_dict, 'unknowns': c._init_unknowns_dict})...
code_fim
medium
{ "lang": "python", "repo": "metamorph-inc/fmu_wrapper", "path": "/fmu_wrapper/get_params_and_unknowns/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Urbistondo/Shogi path: /src/Domain/Entities/Knight.py from Domain.Entities.Piece import Piece, Color class Knight(Piece): def __init__(self, color): Piece.__init__(self, color) self.description = 'Knight' self.representation = 'N' <|fim_suffix|> if abs(destin...
code_fim
medium
{ "lang": "python", "repo": "Urbistondo/Shogi", "path": "/src/Domain/Entities/Knight.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if origin_row == destination_row and origin_col == destination_col: return False if abs(destination_col - origin_col) != 1: return False if color == Color.WHITE: return destination_row - origin_row == 2 else: return origin_r...
code_fim
hard
{ "lang": "python", "repo": "Urbistondo/Shogi", "path": "/src/Domain/Entities/Knight.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Igor-ID/Image-Compression path: /Wavelets.py import pywt import matplotlib.pyplot as plt from matplotlib.image import imread import numpy as np """Discrete Wavelet transform.""" <|fim_suffix|># Wavelet decomposition (2 level) # 2 level wavelet n = 2 # show all discrete wavelets in pywavelet mod...
code_fim
medium
{ "lang": "python", "repo": "Igor-ID/Image-Compression", "path": "/Wavelets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># normalize each coefficient array coeffs[0] /= np.abs(coeffs[0]).max() for detail_level in range(n): coeffs[detail_level + 1] = [d/np.abs(d).max() for d in coeffs[detail_level + 1]] arr, coeff_slices = pywt.coeffs_to_array(coeffs) plt.imshow(arr, cmap='gray', vmin=-0.25, vmax=0.75) plt.show()<|fim_p...
code_fim
hard
{ "lang": "python", "repo": "Igor-ID/Image-Compression", "path": "/Wavelets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kallejre/OSM-Discord-bot path: /main.py st( map( lambda x: f'Command available in {round(x+config["rate_limit"]["time_period"]-tnow)} sec.', sorted(utils.command_history[ctx.author_id]), ) ) ) msg += f'\nYou can still send {c...
code_fim
hard
{ "lang": "python", "repo": "kallejre/OSM-Discord-bot", "path": "/main.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> elif btn_ctx.custom_id == "elm_embed": await action_msg.delete() return False, True elif btn_ctx.custom_id == "elm_image": await action_msg.delete() return True, False elif btn_ctx.custom_id == "elm_both": ...
code_fim
hard
{ "lang": "python", "repo": "kallejre/OSM-Discord-bot", "path": "/main.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: kallejre/OSM-Discord-bot path: /main.py g_url) # Easiest way to handle note rendering is to just draw on map. #### Fields #### if "info" in extras: embed.add_field(name="Comments", value=str(len(note["properties"]["comments"]))) embed.add_field( name="Crea...
code_fim
hard
{ "lang": "python", "repo": "kallejre/OSM-Discord-bot", "path": "/main.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> @visitor(structures.Copy) def copy(self, node): return build_element('copy', children=[build_element('source', text=node.source), build_element('target', text=node.target)]) @visitor(structures.Config) def config(self, node): res = etree.Element('config') res.attri...
code_fim
hard
{ "lang": "python", "repo": "herczy/codega", "path": "/codega/config/saver.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: herczy/codega path: /codega/config/saver.py from lxml import etree from codega.visitor import ClassVisitor, visitor import structures class SaveError(Exception): '''Errors with saving a configuration structure''' def build_element(tag, attributes={}, text=None, children=[]): res = e...
code_fim
hard
{ "lang": "python", "repo": "herczy/codega", "path": "/codega/config/saver.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return res @visitor(structures.PathList) def path_list(self, node): res = build_element('paths') res.append(build_element('target', text=node.destination)) for path in node.paths: res.append(build_element('path', text=path)) return res @vi...
code_fim
hard
{ "lang": "python", "repo": "herczy/codega", "path": "/codega/config/saver.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_TEST_T123_1(): assert True """ ) _, _, etss = adaptavist_mock pytester.runpytest("--adaptavist") etss.assert_called_once_with( test_run_key="TEST-C1", test_case_key="TEST-T123", step=1, ...
code_fim
hard
{ "lang": "python", "repo": "devolo/pytest-adaptavist", "path": "/tests/test_adaptavist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: devolo/pytest-adaptavist path: /tests/test_adaptavist.py """Test compatibility with Adaptavist.""" import getpass import logging from unittest.mock import patch import pytest from . import AdaptavistMock @pytest.mark.usefixtures("configure") class TestAdaptavistUnit: """Test compatibilit...
code_fim
hard
{ "lang": "python", "repo": "devolo/pytest-adaptavist", "path": "/tests/test_adaptavist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert True """ ) _, _, etss = adaptavist_mock pytester.runpytest("--adaptavist") etss.assert_called_once_with( test_run_key="TEST-C1", test_case_key="TEST-T123", step=1, status="Pass", comm...
code_fim
hard
{ "lang": "python", "repo": "devolo/pytest-adaptavist", "path": "/tests/test_adaptavist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Get the state of the motion sensor.""" data = await self.get_data(INFO) return data['motion'] @property def puck(self): """Get the state of the hardware.""" data = await self.get_data(PUCK) if self.data is not None: return {'firmware'...
code_fim
hard
{ "lang": "python", "repo": "naserpf/python-dingz", "path": "/dingz/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: naserpf/python-dingz path: /dingz/__init__.py """A Python Client to interact with Dingz devices.""" import asyncio import logging import aiohttp import async_timeout from . import exceptions from .constants import TEMPERATURE, MOTION, LIGHT, PUCK, INFO _LOGGER = logging.getLogger(__name__) c...
code_fim
medium
{ "lang": "python", "repo": "naserpf/python-dingz", "path": "/dingz/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return 'windows-1255' def resource_urls(self): return [{'category': 'All News', 'url': 'http://www.ynet.co.il/Integration/StoryRss3082.xml'}]<|fim_prefix|># repo: nathanIL/openews path: /scrappers/plugins/ynetnews/__init__.py import scrappers import scrappers.mixins class YnetNews(...
code_fim
easy
{ "lang": "python", "repo": "nathanIL/openews", "path": "/scrappers/plugins/ynetnews/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nathanIL/openews path: /scrappers/plugins/ynetnews/__init__.py import scrappers import scrappers.mixins class YnetNews(scrappers.mixins.RSSScrapper, scrappers.Scrapper): <|fim_suffix|> def should_translate(self): return False def encoding(self): return 'windows-1255' ...
code_fim
medium
{ "lang": "python", "repo": "nathanIL/openews", "path": "/scrappers/plugins/ynetnews/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>while fqr.eof(1) == False and fqr.eof(2) == False: r1_id = r1["id"].split(" ") r2_id = r2["id"].split(" ") if r1_id[0] == r2_id[0]: fqr.writeOutput(r1, 1) fqr.writeOutput(r2, 2) r1 = fqr.next(1) r2 = fqr.next(2) count_r1 += 1 ...
code_fim
hard
{ "lang": "python", "repo": "vreuter/mg-process-fastq", "path": "/split_paired_fastq.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if count_r3 % 1000000 == 0: print count_r1, r1_id[0], count_r2, r2_id[0], count_r3 fqr.incrementOutputFiles() fqr.closePairedFastQ() fqr.closeOutputFiles() print count_r1, r1_id[0], count_r2, r2_id[0], count_r3<|fim_prefix|># repo: vreuter/mg-process-fastq path: /split_paired_fastq....
code_fim
hard
{ "lang": "python", "repo": "vreuter/mg-process-fastq", "path": "/split_paired_fastq.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vreuter/mg-process-fastq path: /split_paired_fastq.py #!/usr/bin/env python """ Copyright 2017 EMBL-European Bioinformatics Institute 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 Lic...
code_fim
hard
{ "lang": "python", "repo": "vreuter/mg-process-fastq", "path": "/split_paired_fastq.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: iamdork/compose path: /dork_compose/plugins/hotcode.py import dork_compose.plugin import os from compose.config.config import VolumeSpec from docker.api.client import APIClient import logging log = logging.getLogger(__name__) import time from docker.errors import APIError class Plugin(dork_com...
code_fim
hard
{ "lang": "python", "repo": "iamdork/compose", "path": "/dork_compose/plugins/hotcode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: dork_source = self.env.get('DORK_SOURCE') src = '/'.join([root, source]) dst = '/'.join([dork_source, source]) log.info("Synching %s to %s." % (src, dst)) sync = client.create_container( image='iamdork/rsync', ...
code_fim
hard
{ "lang": "python", "repo": "iamdork/compose", "path": "/dork_compose/plugins/hotcode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aravindvenu7/Sarcasm-Generation path: /Generator.py # coding: utf-8 # In[19]: import nltk import numpy as np from nltk.corpus import wordnet as wn # In[20]: def indefinite_article(w): """Generate an indefinite article for the given phrase: a, an, or empty string""" if (len(w) ==...
code_fim
hard
{ "lang": "python", "repo": "aravindvenu7/Sarcasm-Generation", "path": "/Generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def N2AN_joke(d1, d2, w1, w2): return "When is " + indefinite_article(d1) + d1 + " like " + indefinite_article(d2) + d2 + "? " + "When it is " + indefinite_article(w1) + w1 + " " + w2 + "." # In[44]: w13 = "" w23 = "" for line in h1: if wn.synsets(line[0]) and get_part_of_speech(li...
code_fim
hard
{ "lang": "python", "repo": "aravindvenu7/Sarcasm-Generation", "path": "/Generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># In[29]: get_part_of_speech("airy") # In[ ]: # ' # # NA JOKE - DONE # In[30]: for line in h1: if wn.synsets(line[0]) and get_part_of_speech(line[0]) == 'noun': for i in range(len(line)) : if (wn.synsets(line[i])) and get_part_of_speech(line[i]) == 'adj': s1 = wn.s...
code_fim
hard
{ "lang": "python", "repo": "aravindvenu7/Sarcasm-Generation", "path": "/Generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lilinghell/devops path: /devops-console/apps/common/access.py class Access: # 小组管理员 TEAM_ADMIN = 50 # 小组成员 TEAM_MEMBER = 10 # 项目管理员 PROJECT_ADMIN = 50 # 项目<|fim_suffix|> # 项目开发 PROJECT_DEV = 20 # 项目访客 PROJECT_GUEST = 10<|fim_middle|>经理 PROJECT_MA...
code_fim
medium
{ "lang": "python", "repo": "lilinghell/devops", "path": "/devops-console/apps/common/access.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>经理 PROJECT_MANAGE = 40 # 项目组长 PROJECT_LEADER = 30 # 项目开发 PROJECT_DEV = 20 # 项目访客 PROJECT_GUEST = 10<|fim_prefix|># repo: lilinghell/devops path: /devops-console/apps/common/access.py class Access: # 小组管理员 TEAM_ADMIN = 50 # 小组成员 TE<|fim_middle|>AM_MEMBER = 10 ...
code_fim
medium
{ "lang": "python", "repo": "lilinghell/devops", "path": "/devops-console/apps/common/access.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /JetMETCorrections/Type1MET/python/multPhiCorr_phys14_cfi.py import FWCore.ParameterSet.Config as cms multPhiCorr_phys14 = cms.VPSet( cms.PSet( name=cms.string("h"), type=cms.int32(1), varType=cms.int32(0), etaMin=cms.double(-2.7), etaMax=cms.d...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/JetMETCorrections/Type1MET/python/multPhiCorr_phys14_cfi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>=cms.int32(0), etaMin=cms.double(-5.2), etaMax=cms.double(-2.901376), fx=cms.string("(x*[0])+(sq(x)*[1])"), px=cms.vdouble(-0.000797275948578,-1.05466329044e-05), fy=cms.string("(x*[0])+(sq(x)*[1])"), py=cms.vdouble(-0.000679522388353,-2.16586402923e-05), ), cms...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/JetMETCorrections/Type1MET/python/multPhiCorr_phys14_cfi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: deeso/python_scrirpts path: /ida/ida_pro_process_sym.py MN_FLAGS = SN_NOWARN|SN_AUTO PT_TYPES = { 0:"PT_NULL", 1:"PT_LOAD", 2:"PT_DYNAMIC", 3:"PT_INTERP", 4:"PT_NOTE", 5:"PT_SHLIB", 6:"PT_PHDR", 0x70000000:"PT_LOPROC", 0x7fffffff:"PT_HIPROC"} elf32_structs = {"Ehdr":"Elf32_Ehdr",...
code_fim
hard
{ "lang": "python", "repo": "deeso/python_scrirpts", "path": "/ida/ida_pro_process_sym.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>sym = AskAddr(0xFFFFFFFF, "Enter start address of the Symbols.") sym_end = AskAddr(0xFFFFFFFF, "Enter end address of the Symbols.") if sym == 0xFFFFFFFF: sym = symtab_addr if sym_end == 0xFFFFFFFF: sym_end = strtab_addr c_addr = sym while c_addr < sym_end: process_sym(c_addr, strtab_ad...
code_fim
hard
{ "lang": "python", "repo": "deeso/python_scrirpts", "path": "/ida/ida_pro_process_sym.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @inject def test_function(service: Service = Provide["service"]): return service<|fim_prefix|># repo: ets-labs/python-dependency-injector path: /tests/unit/samples/wiringstringids/package/subpackage/submodule.py from dependency_injector.wiring import inject, Provide <|fim_middle|>from ...service im...
code_fim
easy
{ "lang": "python", "repo": "ets-labs/python-dependency-injector", "path": "/tests/unit/samples/wiringstringids/package/subpackage/submodule.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ets-labs/python-dependency-injector path: /tests/unit/samples/wiringstringids/package/subpackage/submodule.py from dependency_injector.wiring import inject, Provide from ...service import Service <|fim_suffix|> return service<|fim_middle|>@inject def test_function(service: Service = Provide...
code_fim
medium
{ "lang": "python", "repo": "ets-labs/python-dependency-injector", "path": "/tests/unit/samples/wiringstringids/package/subpackage/submodule.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/neutron-lib path: /neutron_lib/utils/helpers.py # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
code_fim
hard
{ "lang": "python", "repo": "openstack/neutron-lib", "path": "/neutron_lib/utils/helpers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> weak_method = weakref.WeakMethod def make_weak_ref(f): """Make a weak reference to a function accounting for bound methods. :param f: The callable to make a weak ref for. :returns: A weak ref to f. """ return weak_method(f) if hasattr(f, '__self__') else weakref.ref(f) def resolv...
code_fim
hard
{ "lang": "python", "repo": "openstack/neutron-lib", "path": "/neutron_lib/utils/helpers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, amplitude, x_0, y_0, r_in, width=None, r_out=None, normed=True, **constraints): if r_out is not None: width = r_out - r_in if r_out is None and width is None: raise ModelDefinitionError("Either specify width or r_out.") ...
code_fim
hard
{ "lang": "python", "repo": "mirca/gammapy", "path": "/gammapy/image/models/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mirca/gammapy path: /gammapy/image/models/models.py # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Morphological models for astrophysical gamma-ray sources. """ from __future__ import absolute_import, division, print_function, unicode_literals from collections import OrderedD...
code_fim
hard
{ "lang": "python", "repo": "mirca/gammapy", "path": "/gammapy/image/models/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebook/buck path: /programs/buck_version.py # Copyright (c) Facebook, Inc. and its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apac...
code_fim
hard
{ "lang": "python", "repo": "facebook/buck", "path": "/programs/buck_version.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class EmptyTempFile(object): def __init__(self, prefix=None, dir=None, closed=True): self.file, self.name = tempfile.mkstemp(prefix=prefix, dir=dir) if closed: os.close(self.file) self.closed = closed def __enter__(self): return self def __exit__(...
code_fim
hard
{ "lang": "python", "repo": "facebook/buck", "path": "/programs/buck_version.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> output = check_output(["git", "status", "--porcelain"], cwd=dirpath).decode("utf-8") output = "\n".join( [line for line in output.splitlines() if not IGNORE_PATHS_RE.search(line)] ) return bool(output.strip()) def get_vcs_revision(dirpath): # type: (str) -> str output = chec...
code_fim
hard
{ "lang": "python", "repo": "facebook/buck", "path": "/programs/buck_version.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: reloadbrain/dbnd path: /modules/dbnd/src/dbnd/_core/errors/friendly_error/api.py from dbnd._core.errors.base import ( DatabandConnectionException, DatabandUnauthorizedApiError, ) def api_connection_refused(connection_details, ex): return DatabandConnectionException( "Could n...
code_fim
hard
{ "lang": "python", "repo": "reloadbrain/dbnd", "path": "/modules/dbnd/src/dbnd/_core/errors/friendly_error/api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return DatabandConnectionException( "Couldn't find the databand run '%s' in current database! Please validate that you are using the correct " "connection string" % name_or_uid, nested_exceptions=ex, ) def unauthorized_api_call(method, url, resp): return DatabandUnaut...
code_fim
hard
{ "lang": "python", "repo": "reloadbrain/dbnd", "path": "/modules/dbnd/src/dbnd/_core/errors/friendly_error/api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ktolstikhin/faceid path: /vision/predictor/factory.py from face.recognizer import FaceRecognizer from person.detector import PersonDetector <|fim_suffix|> if name == 'face': predictor = FaceRecognizer() elif name == 'person': predictor = PersonDetector() ...
code_fim
medium
{ "lang": "python", "repo": "ktolstikhin/faceid", "path": "/vision/predictor/factory.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def build(name): if name == 'face': predictor = FaceRecognizer() elif name == 'person': predictor = PersonDetector() else: raise ValueError(f'Unknown predictor: {name}') return predictor<|fim_prefix|># repo: ktols...
code_fim
easy
{ "lang": "python", "repo": "ktolstikhin/faceid", "path": "/vision/predictor/factory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rmartind/ctci path: /ctci/chapter1/strrotation.py """Solution to 1.9: String Rotation.""" def rotate(string_one, string_two): """Determines if one string is a rotation of the other. <|fim_suffix|> Returns: True: if string_one is a rotation of string_two False: if str...
code_fim
medium
{ "lang": "python", "repo": "rmartind/ctci", "path": "/ctci/chapter1/strrotation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: string_one: any string of characters. string_two: any string of characters. Returns: True: if string_one is a rotation of string_two False: if string_one is not a rotation of string_two """ if len(string_one) == len(string_two): string_two += ...
code_fim
medium
{ "lang": "python", "repo": "rmartind/ctci", "path": "/ctci/chapter1/strrotation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.rom.write_u16(self.exit_ptr + 0, self.transition_type) self.rom.write_u16(self.exit_ptr + 2, self.x_pos) self.rom.write_u16(self.exit_ptr + 4, self.y_pos) self.rom.write_u16(self.exit_ptr + 6, self.dest_x) self.rom.write_u16(self.exit_ptr + 8, self.dest_y) self.rom.write_u8(se...
code_fim
medium
{ "lang": "python", "repo": "LagoLunatic/mclib", "path": "/exit.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LagoLunatic/mclib path: /exit.py from mclib.param_entity import ParamEntity class Exit(ParamEntity): def __init__(self, exit_ptr, room, rom): super().__init__() self.exit_ptr = exit_ptr self.room = room self.rom = rom self.read() def read(self): <|fim_suffix...
code_fim
hard
{ "lang": "python", "repo": "LagoLunatic/mclib", "path": "/exit.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cassiersg/elec-2103 path: /game/opengl/interface.py import pygame import cubes import time import font import PIL t0 = time.time() grid = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [3, 3, 0, 0, 0, 3, 3, 0, 3, 3, 0, 0, 0, 3, 3], [3, 3, 0, 0, 0, 3, 3, 3, 3, 4, 0, 0, 0, 3, 3], [3, 3, 0, 0, 3...
code_fim
hard
{ "lang": "python", "repo": "cassiersg/elec-2103", "path": "/game/opengl/interface.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print("dt gen_grid", t1-t0) print("dt init_cubes", t2-t1) print("dt draw&recover buf", t3-t2) print("dt blit buf", t5-t4) time.sleep(10)<|fim_prefix|># repo: cassiersg/elec-2103 path: /game/opengl/interface.py import pygame import cubes import time import font import PIL t0 = time.time() grid = [[0, ...
code_fim
hard
{ "lang": "python", "repo": "cassiersg/elec-2103", "path": "/game/opengl/interface.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: highdxy/neural-fingerprint-theano path: /code/visualization/highlight_smiles_rnn.py import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib def gen_highlight_text(smiles, molecule_prediction, atom_predictions): min_pred = np.amin(atom_predictions) ...
code_fim
hard
{ "lang": "python", "repo": "highdxy/neural-fingerprint-theano", "path": "/code/visualization/highlight_smiles_rnn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#we can exploit html's native coloring for our purposes here OUTPUT = open('rnn_molecules/solubility_predictions_rnn.html', 'w') OUTPUT.write("<!DOCTYPE html>\n<html>\n<body>\n") INPUT = open('../../data/example_output/solubility_predictions_rnn.csv', 'r') for line in INPUT: line = line.rstrip() ...
code_fim
hard
{ "lang": "python", "repo": "highdxy/neural-fingerprint-theano", "path": "/code/visualization/highlight_smiles_rnn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(args): if args.results_dir is None: torch.manual_seed(42) np.random.seed(42) exp_dirnm = 'experiment_whole_data' os.makedirs(RES_FOLDER, exist_ok=True) exp_dir = os.path.join(RES_FOLDER, exp_dirnm) os.mkdir(exp_dir) train_on_the_whole_d...
code_fim
hard
{ "lang": "python", "repo": "v1docq/dataset-distillation", "path": "/experiment_whole_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def visualise(exp_dir): total_results = [] for pth in glob.glob(os.path.join(exp_dir, '*.pk')): with open(pth, 'rb') as f: total_results.append(pk.load(f)) losses = defaultdict(lambda: []) tst_accs, tr_accs = defaultdict(lambda: []), defaultdict(lambda: []) for res ...
code_fim
hard
{ "lang": "python", "repo": "v1docq/dataset-distillation", "path": "/experiment_whole_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: v1docq/dataset-distillation path: /experiment_whole_data.py import argparse import glob import logging import os import pickle as pk from collections import defaultdict, namedtuple import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import accuracy_score import torch import t...
code_fim
hard
{ "lang": "python", "repo": "v1docq/dataset-distillation", "path": "/experiment_whole_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pytestmark = pytest.mark.skipif( ak._util.py27, reason="No Python 2.7 support in Awkward 2.x" ) def test_iterator(): content = ak.layout.NumpyArray(np.array([1.1, 2.2, 3.3])) offsets = ak.layout.Index32(np.array([0, 2, 2, 3], "i4")) array = ak.layout.ListOffsetArray32(offsets, content) ...
code_fim
medium
{ "lang": "python", "repo": "emg110/awkward-1.0", "path": "/tests/test_0006_v2-deep-iteration.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> content = ak.layout.NumpyArray(np.array([1.1, 2.2, 3.3])) offsets = ak.layout.Index32(np.array([0, 2, 2, 3], "i4")) array = ak.layout.ListOffsetArray32(offsets, content) content = v1_to_v2(content) array = v1_to_v2(array) assert list(content) == [1.1, 2.2, 3.3] assert [np.asar...
code_fim
medium
{ "lang": "python", "repo": "emg110/awkward-1.0", "path": "/tests/test_0006_v2-deep-iteration.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: emg110/awkward-1.0 path: /tests/test_0006_v2-deep-iteration.py # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE from __future__ import absolute_import <|fim_suffix|> content = ak.layout.NumpyArray(np.array([1.1, 2.2, 3.3])) offsets = ak.layout.Index...
code_fim
hard
{ "lang": "python", "repo": "emg110/awkward-1.0", "path": "/tests/test_0006_v2-deep-iteration.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucassus/python-ddd-sandbox path: /app/modules/accounts/application/ports/abstract_unit_of_work.py import abc from contextlib import AbstractContextManager from typing import Self <|fim_suffix|> self.rollback() # It does nothing when the session has been committed before @abc.abstra...
code_fim
hard
{ "lang": "python", "repo": "lucassus/python-ddd-sandbox", "path": "/app/modules/accounts/application/ports/abstract_unit_of_work.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.rollback() # It does nothing when the session has been committed before @abc.abstractmethod def commit(self): raise NotImplementedError @abc.abstractmethod def rollback(self): raise NotImplementedError<|fim_prefix|># repo: lucassus/python-ddd-sandbox path: ...
code_fim
medium
{ "lang": "python", "repo": "lucassus/python-ddd-sandbox", "path": "/app/modules/accounts/application/ports/abstract_unit_of_work.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sforchu/Python-Microservices-Development-2nd-Edition path: /CodeSamples/Chapter2/error_handler.py # error_handler.py from quart import Quart app = Quart(__name__) @app.errorhandler(500) def error_handling(error): return {"Error": str(error)}, 500 <|fim_suffix|> if __name__ == "__main__": ...
code_fim
medium
{ "lang": "python", "repo": "sforchu/Python-Microservices-Development-2nd-Edition", "path": "/CodeSamples/Chapter2/error_handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route("/api") def my_microservice(): raise TypeError("Some Exception") if __name__ == "__main__": app.run()<|fim_prefix|># repo: sforchu/Python-Microservices-Development-2nd-Edition path: /CodeSamples/Chapter2/error_handler.py # error_handler.py from quart import Quart app = Quart(__name_...
code_fim
medium
{ "lang": "python", "repo": "sforchu/Python-Microservices-Development-2nd-Edition", "path": "/CodeSamples/Chapter2/error_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.errorhandler(500) def error_handling(error): return {"Error": str(error)}, 500 @app.route("/api") def my_microservice(): raise TypeError("Some Exception") if __name__ == "__main__": app.run()<|fim_prefix|># repo: sforchu/Python-Microservices-Development-2nd-Edition path: /CodeSamples...
code_fim
easy
{ "lang": "python", "repo": "sforchu/Python-Microservices-Development-2nd-Edition", "path": "/CodeSamples/Chapter2/error_handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # determine the awxkit method to call action = self.original_action = parsed.pop('action') page, action = handle_custom_actions( self.resource, action, page ) self.method = { 'list': 'get', 'modify': 'patch', }.get(action,...
code_fim
hard
{ "lang": "python", "repo": "Quarz8/awx", "path": "/awxkit/awxkit/cli/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Quarz8/awx path: /awxkit/awxkit/cli/client.py from __future__ import print_function import logging import os import pkg_resources import sys from requests.exceptions import RequestException from .custom import handle_custom_actions from .format import (add_authentication_arguments, ...
code_fim
hard
{ "lang": "python", "repo": "Quarz8/awx", "path": "/awxkit/awxkit/cli/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: anokata/pythonPetProjects path: /exercises/euler56.py def sumdigits(x): s = 0 for d in str(x): s += int(d) return s m = int() for a in range(1, 101):<|fim_suffix|>= sumdigits(c) if m < s: m = s print(m)<|fim_middle|> for b in range(1, 101): c =...
code_fim
easy
{ "lang": "python", "repo": "anokata/pythonPetProjects", "path": "/exercises/euler56.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>= sumdigits(c) if m < s: m = s print(m)<|fim_prefix|># repo: anokata/pythonPetProjects path: /exercises/euler56.py def sumdigits(x): s = 0 for d in str(x): s<|fim_middle|> += int(d) return s m = int() for a in range(1, 101): for b in range(1, 101): c =...
code_fim
medium
{ "lang": "python", "repo": "anokata/pythonPetProjects", "path": "/exercises/euler56.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class WorkflowAuthorSummarySerializer(serializers.ModelSerializer): """ Summary level serializer for WorkflowAuthor objects. """ detail = serializers.HyperlinkedIdentityField( view_name="workflow-author", lookup_field="id" ) user = UserTerseSerializer() class Meta: ...
code_fim
hard
{ "lang": "python", "repo": "kwang1971/django-workflow-system", "path": "/django_workflow_system/api/serializers/workflows/author.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kwang1971/django-workflow-system path: /django_workflow_system/api/serializers/workflows/author.py from django.contrib.auth import get_user_model from rest_framework import serializers from ....models import Workflow, WorkflowAuthor User = get_user_model() class UserTerseSerializer(serializ...
code_fim
medium
{ "lang": "python", "repo": "kwang1971/django-workflow-system", "path": "/django_workflow_system/api/serializers/workflows/author.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = WorkflowAuthor fields = ( "self_detail", "id", "user", "title", "image", "biography", "workflow_set", )<|fim_prefix|># repo: kwang1971/django-workflow-system path: /django_w...
code_fim
hard
{ "lang": "python", "repo": "kwang1971/django-workflow-system", "path": "/django_workflow_system/api/serializers/workflows/author.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hphilamore/merge_test path: /PhD_Code/py_prog/import.py import csv import pandas colnames = ['year', 'name', 'city', 'latitude', 'longitude'] data = pandas.read_csv('test.csv', names=colnames) names = list(data.name) latitude = list(data.latitude) longitude = list(data.longitude) <|fim_suff...
code_fim
easy
{ "lang": "python", "repo": "hphilamore/merge_test", "path": "/PhD_Code/py_prog/import.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print type(names) import matplotlib.pyplot as plt plt.plot(names, names) plt.show()<|fim_prefix|># repo: hphilamore/merge_test path: /PhD_Code/py_prog/import.py import csv import pandas colnames = ['year', 'name', 'city', 'latitude', 'longitude'] data = pandas.read_csv('test.csv', names=colnames) <|...
code_fim
medium
{ "lang": "python", "repo": "hphilamore/merge_test", "path": "/PhD_Code/py_prog/import.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nexus = { "address": "10.66.65.154", "ssh_port": 22, "username": "admin", "password": "admincisco", "device_type": "cisco_nxos" }<|fim_prefix|># repo: techiewarrior/Nexus path: /SSH_Check_Command/ssh_device_info.py #! /usr/bin/env python n...
code_fim
hard
{ "lang": "python", "repo": "techiewarrior/Nexus", "path": "/SSH_Check_Command/ssh_device_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: techiewarrior/Nexus path: /SSH_Check_Command/ssh_device_info.py #! /usr/bin/env python nxos1 = { "address": "10.66.80.31", "ssh_port": 22, "username": "admin", "password": "admincisco", "device_type": "cisco_nxos" } <|fi...
code_fim
hard
{ "lang": "python", "repo": "techiewarrior/Nexus", "path": "/SSH_Check_Command/ssh_device_info.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def start_tagged_instances(event, context): current_hour = dt.datetime.today().hour try: settings = Settings() except Exception as error: logs.info("Handler", "Error getting settings {}".format(error.args[0])) return Response.error(error.args[0]) for account_name ...
code_fim
hard
{ "lang": "python", "repo": "birkoff/cloud-instances", "path": "/handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: birkoff/cloud-instances path: /handler.py n("Error {} is set enabled: false".format(account_name)) account = Account(account_map, region) instances = Instances( Provider(account, settings), Dispatcher(settings.config.get("sns")) ) return (account, instances) def list_in...
code_fim
hard
{ "lang": "python", "repo": "birkoff/cloud-instances", "path": "/handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: birkoff/cloud-instances path: /handler.py epository import datetime as dt from datetime import datetime import modules.logs as logs import modules.response as Response def _build_instance_model(account_name, region, settings=None): if settings is None: try: settings = S...
code_fim
hard
{ "lang": "python", "repo": "birkoff/cloud-instances", "path": "/handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(len_word): index = self.get_index(word[i]) if not root: print("Word not found") return -1 root = root.children.get(index) if not root: print("Word not found") return -1 else...
code_fim
hard
{ "lang": "python", "repo": "AkshayPradeep6152/letshack", "path": "/Python Programs/Trie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AkshayPradeep6152/letshack path: /Python Programs/Trie.py from collections import defaultdict class TrieNode(): def __init__(self): self.children = defaultdict() self.terminating = False class Trie(): def __init__(self): self.root = self.get_node() def g...
code_fim
hard
{ "lang": "python", "repo": "AkshayPradeep6152/letshack", "path": "/Python Programs/Trie.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def delete(self, word): root = self.root len_word = len(word) for i in range(len_word): index = self.get_index(word[i]) if not root: print("Word not found") return -1 root = root.children.get(index) ...
code_fim
hard
{ "lang": "python", "repo": "AkshayPradeep6152/letshack", "path": "/Python Programs/Trie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _add_rule(self, objs, src, args): fname = os.path.basename(src) n, ext = os.path.splitext(fname) if self.unique_names: relpath = fix_path_regex.sub('_', os.path.relpath(emk.scope_dir, emk.proj_dir)) n = relpath + "_" + n name = n...
code_fim
hard
{ "lang": "python", "repo": "kmackay/emk", "path": "/modules/asm.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kmackay/emk path: /modules/asm.py import os import logging import shlex import re import sys import traceback log = logging.getLogger("emk.asm") utils = emk.module("utils") fix_path_regex = re.compile(r'[\W]+') class _GccAssembler(object): """ Assembler class for using gcc as an assem...
code_fim
hard
{ "lang": "python", "repo": "kmackay/emk", "path": "/modules/asm.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> project_line = r"I:\Projects\Darren\PPA_V2_GIS\scratch.gdb\testproj_causeway_fwy" # arcpy.GetParameterAsText(0) proj_type = "Freeway" # arcpy.GetParameterAsText(2) #"Freeway" # make feature layers of NPMRDS and project line output_dict = get_tmc_truck_data(project_line, proj_type) ...
code_fim
hard
{ "lang": "python", "repo": "djconly85/PPA2_0_code", "path": "/FromESRI/PPA2_20200210/PPA2Esri20200210/get_truck_data_fwy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: djconly85/PPA2_0_code path: /FromESRI/PPA2_20200210/PPA2Esri20200210/get_truck_data_fwy.py import arcpy import pandas as pd import ppa_input_params as p import npmrds_data_conflation as ndc def get_wtdavg_truckdata(in_df, col_name): len_cols = ['{}_calc_len'.format(dirn) for dirn in p.di...
code_fim
hard
{ "lang": "python", "repo": "djconly85/PPA2_0_code", "path": "/FromESRI/PPA2_20200210/PPA2Esri20200210/get_truck_data_fwy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for com in self.avail_commands: ad = 4 if t > 20 else 17 ## if taller than 20 characters use 4 spaces only else use 17 wsp = ((t - len(com) + ad)) ## number of white spaces for each command line = " " + com + (wsp * ' ') + self.avail_commands[com] + "\n" # f...
code_fim
hard
{ "lang": "python", "repo": "lotfio/pysol", "path": "/pysol/core/Command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lotfio/pysol path: /pysol/core/Command.py # -*- coding: utf-8 -*- #| This file is part of cony #| #| @package pysol python cli application #| @author <lotfio lakehal> #| @license MIT #| @version 0.1.0 #| @copyright 2019 lotfio lakehal import glob, os import pysol.conf.app a...
code_fim
hard
{ "lang": "python", "repo": "lotfio/pysol", "path": "/pysol/core/Command.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # available commands method # list and display all commands and there description def available_commands(self): print("\nAvailable commands :\n") os.chdir(cfg.root + "/commands/") for file in glob.glob("*.py"): f = file.split(".")[0] m = load_...
code_fim
hard
{ "lang": "python", "repo": "lotfio/pysol", "path": "/pysol/core/Command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Notes ----- This methods sets the ``PyOS_InputHook`` for wxPython, which allows the wxPython to integrate with terminal based applications like IPython. If ``app`` is True, we create an :class:`wx.App` as follows:: import wx app = w...
code_fim
hard
{ "lang": "python", "repo": "omazapa/ipython-zmq", "path": "/IPython/lib/inputhook.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: omazapa/ipython-zmq path: /IPython/lib/inputhook.py t4(app) except ImportError: app.exec_() """ from PyQt4 import QtCore, QtGui assert isinstance(app, QtCore.QCoreApplication) if app is not None: if current_gui() == GUI_QT4: pass else: ...
code_fim
hard
{ "lang": "python", "repo": "omazapa/ipython-zmq", "path": "/IPython/lib/inputhook.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }