text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: CrisRodriguez/mushroom path: /mushroom/policy/__init__.py from .td_policy import EpsGreedy from .gauss<|fim_suffix|>aussianPolicy', 'MultivariateGaussianPolicy']<|fim_middle|>ian_policy import GaussianPolicy, MultivariateGaussianPolicy __all__ = ['EpsGreedy', 'G
code_fim
medium
{ "lang": "python", "repo": "CrisRodriguez/mushroom", "path": "/mushroom/policy/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>teGaussianPolicy __all__ = ['EpsGreedy', 'GaussianPolicy', 'MultivariateGaussianPolicy']<|fim_prefix|># repo: CrisRodriguez/mushroom path: /mushroom/policy/__init__.py from .td_policy import EpsGreedy from .gauss<|fim_middle|>ian_policy import GaussianPolicy, Multivaria
code_fim
easy
{ "lang": "python", "repo": "CrisRodriguez/mushroom", "path": "/mushroom/policy/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zengljnwpu/yaspc path: /backend/entity/scope.py from backend.entity.entity import DefinedVariable #Used to describe scope of variables class LocalScope (object): def __init__(self, local): super(LocalScope, self).__init__() self._variables = dict() for i in local: ...
code_fim
medium
{ "lang": "python", "repo": "zengljnwpu/yaspc", "path": "/backend/entity/scope.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = [] for s in self._all_local_scopes(): result.extend(s.local_variables()) return result # # Return local variables defined in this scope. # Does NOT includes children's local variables. # Does NOT include static local variables. # def lo...
code_fim
hard
{ "lang": "python", "repo": "zengljnwpu/yaspc", "path": "/backend/entity/scope.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/perl-number-format/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/perl-number-format/package.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> homepage = "https://metacpan.org/pod/Number::Format" url = "https://cpan.metacpan.org/authors/id/W/WR/WRW/Number-Format-1.75.tar.gz" version("1.75", sha256="82d659cb16461764fd44d11a9ce9e6a4f5e8767dc1069eb03467c6e55de257f3")<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/bu...
code_fim
medium
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/perl-number-format/package.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> snake_case += "_" + char.lower() else: snake_case += char print(snake_case)<|fim_prefix|># repo: gabrielizalo/jetbrains-academy-python-coffee-machine path: /Problems/snake_case/task.py lower_camel_case = input() snake_case = "" for <|fim_middle|>char in lower_camel_case: if char....
code_fim
easy
{ "lang": "python", "repo": "gabrielizalo/jetbrains-academy-python-coffee-machine", "path": "/Problems/snake_case/task.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gabrielizalo/jetbrains-academy-python-coffee-machine path: /Problems/snake_case/task.py lower_camel_case = input() snake_case = "" for <|fim_suffix|> snake_case += "_" + char.lower() else: snake_case += char print(snake_case)<|fim_middle|>char in lower_camel_case: if char....
code_fim
easy
{ "lang": "python", "repo": "gabrielizalo/jetbrains-academy-python-coffee-machine", "path": "/Problems/snake_case/task.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gugajung/guppe path: /fixação/Seção06/21-30/Sec06Ex23.py contador = 1 valor1 = int(input("Entre com o 1 nume<|fim_suffix|>r1} é divisivel por {contador}") contador += 1<|fim_middle|>ro :-> ")) while contador <= valor1: if valor1%contador == 0: print(f" E o numero {valo
code_fim
medium
{ "lang": "python", "repo": "gugajung/guppe", "path": "/fixação/Seção06/21-30/Sec06Ex23.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>r1} é divisivel por {contador}") contador += 1<|fim_prefix|># repo: gugajung/guppe path: /fixação/Seção06/21-30/Sec06Ex23.py contador = 1 valor1 = int(input("Entre com o 1 nume<|fim_middle|>ro :-> ")) while contador <= valor1: if valor1%contador == 0: print(f" E o numero {valo
code_fim
medium
{ "lang": "python", "repo": "gugajung/guppe", "path": "/fixação/Seção06/21-30/Sec06Ex23.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> account = '646180157046685645' transfer = Transfer.first(account_number=account) assert transfer is not None assert transfer.account_number == account transfer = Transfer.first(account_number='bad_account') assert transfer is None @pytest.mark.vcr def test_transfers_all(): tr...
code_fim
hard
{ "lang": "python", "repo": "cuenca-mx/cuenca-python", "path": "/tests/resources/test_transfers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.vcr def test_transfers_count(): # Count all items count = Transfer.count() assert count == 42 # Count with filters count = Transfer.count(status=TransactionStatus.succeeded) assert count == 4 @pytest.mark.vcr def test_transfers_count_vs_all(): assert Transfer.c...
code_fim
hard
{ "lang": "python", "repo": "cuenca-mx/cuenca-python", "path": "/tests/resources/test_transfers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cuenca-mx/cuenca-python path: /tests/resources/test_transfers.py import pytest from cuenca_validations.types import TransactionStatus, TransferNetwork from pydantic import ValidationError from cuenca import Transfer from cuenca.exc import MultipleResultsFound, NoResultFound from cuenca.resources...
code_fim
hard
{ "lang": "python", "repo": "cuenca-mx/cuenca-python", "path": "/tests/resources/test_transfers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kakwa/fradomus path: /fradomus/site/seloger.py import requests import datetime import json import time import uuid import jwt from fradomus.site import BaseAds # Some constants used to build the base local JWT token AUD_CONST = "SeLoger-Mobile-6.0" APP_CONST = "63ee714d-a62a-4a27-9fbe-40b7a2c31...
code_fim
hard
{ "lang": "python", "repo": "kakwa/fradomus", "path": "/fradomus/site/seloger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> COUNT_URL = "https://api-seloger.svc.groupe-seloger.com/api/v1/listings/count" r = requests.post(COUNT_URL, data=json.dumps(SEARCH_PAYLOAD), headers=self.headers) return r.json()[0] def search(self, cp, min_surf, max_price, ad_type, nb_room_min, raw=True): """...
code_fim
hard
{ "lang": "python", "repo": "kakwa/fradomus", "path": "/fradomus/site/seloger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def search(self, cp, min_surf, max_price, ad_type, nb_room_min, raw=True): """Recover the ads matching a given search arg 1: the postal code arg 2: the minimal surface arg 3: the maximum rent/price arg 4: type of the add (1 -> location, 2 -> sell) arg 5...
code_fim
hard
{ "lang": "python", "repo": "kakwa/fradomus", "path": "/fradomus/site/seloger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pypa/cibuildwheel path: /unit_test/options_test.py from __future__ import annotations import os import platform as platform_module import textwrap from pathlib import Path import pytest from cibuildwheel.__main__ import get_build_identifiers, get_platform_module from cibuildwheel.bashlex_eval ...
code_fim
hard
{ "lang": "python", "repo": "pypa/cibuildwheel", "path": "/unit_test/options_test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> tmp_path.joinpath("pyproject.toml").write_text( textwrap.dedent( f"""\ [tool.cibuildwheel.environment] {toml_assignment} """ ) ) options = Options(platform="linux", command_line_arguments=args, env={}) parsed_environment = op...
code_fim
hard
{ "lang": "python", "repo": "pypa/cibuildwheel", "path": "/unit_test/options_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> s = Solution() assert 3 == s.hIndex([3, 0, 6, 1, 5]) assert 3 == s.hIndex([4, 0, 6, 1, 5]) assert 4 == s.hIndex([4, 0, 6, 4, 5]) assert 0 == s.hIndex([]) assert 0 == s.hIndex([0]) assert 1 == s.hIndex([1]) assert 1 == s.hIndex([100]) assert 1 == s.hIndex([1, 2]) ass...
code_fim
medium
{ "lang": "python", "repo": "linshaoyong/leetcode", "path": "/python/array/0274_h_index.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linshaoyong/leetcode path: /python/array/0274_h_index.py class Solution(object): def hIndex(self, citations): """ :type citations: List[int] :rtype: int """ n = len(citations) sc = sorted(citations) v = 0 for i in range(n - 1, -1...
code_fim
medium
{ "lang": "python", "repo": "linshaoyong/leetcode", "path": "/python/array/0274_h_index.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wanyzh/sci-hub-scrapy path: /sci-hub.py import requests from bs4 import BeautifulSoup import os #from pyaria2 import Aria2RPC import time import sys def get_file_from_url(links): """使用aria2下载文件,经常下载不成功""" file_num = 0 for link in links: file_num += 1 if link[:5]=="Er...
code_fim
hard
{ "lang": "python", "repo": "wanyzh/sci-hub-scrapy", "path": "/sci-hub.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> html=response.content.decode('utf-8')#获取响应的内容 if html.replace('\n','')=='':#如果响应的内容为空,则说明找不到该doi print("Error: Search paper {}, doi: {} fail, please recheck".format(paper_no,doi)) paper_link="Error: Paper : {}, {} not found or the sci-hub is not aviable".format(paper_no,doi)#没有找到...
code_fim
hard
{ "lang": "python", "repo": "wanyzh/sci-hub-scrapy", "path": "/sci-hub.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print("There are {} iterms in doi.txt\n".format(len(dois))) print("Searching begins...") #使用sci-hub搜索时有三种情况出现: #1.doi号搜索成功,且找到了pdf地下载链接,此时地特征是返回地html的title值以Sci-Hub开头 #2.doi号搜索成功,但没有找到pdf下载链接,网页跳转到原始文件列表 #3.doi号搜索不成功,此时返回的html是空的 paper_no=0 paper_links=[] #paper_citation=[] for doi in dois: pape...
code_fim
hard
{ "lang": "python", "repo": "wanyzh/sci-hub-scrapy", "path": "/sci-hub.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> stdout = stdout_f.read() with open(f"/var/run/req_run/{iden}.stderr", "rb") as stderr_f: stderr = stderr_f.read() if exit_code: raise CalledProcessError(exit_code, args, stdout, stderr) return stdout<|fim_prefix|># repo: frankier/singslurm path: /singslurm/req_run.py impor...
code_fim
hard
{ "lang": "python", "repo": "frankier/singslurm", "path": "/singslurm/req_run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frankier/singslurm path: /singslurm/req_run.py import os import time import uuid SLEEP_TIME = 0.2 def check_output(args): from subprocess import CalledProcessError iden = uuid.uuid4().hex with open("/var/run/req_run/reqs", "a") as req_run: req_run.write<|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "frankier/singslurm", "path": "/singslurm/req_run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nocproject/noc path: /sa/profiles/Raisecom/ROS/get_mac_address_table.py # --------------------------------------------------------------------- # Raisecom.ROS.get_mac_address_table # --------------------------------------------------------------------- # Copyright (C) 2007-2017 The NOC Project # ...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/sa/profiles/Raisecom/ROS/get_mac_address_table.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> rx_line = re.compile( r"^(?P<mac>[0-9a-f]{4}\.[0-9a-f]{4}\.[0-9a-f]{4})\s+" r"(?P<interface>(?:P|PC|port|gigaethernet1/1/)?\d+)\s+" r"(?P<vlan_id>\d+)\s*(?P<type>Hit|Static|dynamic)", re.MULTILINE | re.IGNORECASE, ) def execute_cli(self, interface=None, vlan=No...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/sa/profiles/Raisecom/ROS/get_mac_address_table.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not self.is_iscom2624g: v = self.cli("show mac-address-table l2-address") else: v = self.cli("show mac-address all") r = [] for match in self.rx_line.finditer(v): r += [ { "vlan_id": match.group("vla...
code_fim
hard
{ "lang": "python", "repo": "nocproject/noc", "path": "/sa/profiles/Raisecom/ROS/get_mac_address_table.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zdenekmaxa/lg_ros_nodes path: /lg_cms_director/src/pulsar/utils/structures/skiplist.py # Modified version of skiplist # http://code.activestate.com/recipes/ # 576930-efficient-running-median-using-an-indexable-skipli/ import sys from random import random from math import log from collections i...
code_fim
hard
{ "lang": "python", "repo": "zdenekmaxa/lg_ros_nodes", "path": "/lg_cms_director/src/pulsar/utils/structures/skiplist.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> '''Remove a range by rank. This is equivalent to perform:: del l[start:end] on a python list. It returns the number of element removed. ''' N = len(self) if start < 0: start = max(N + start, 0) if start >= N: ...
code_fim
hard
{ "lang": "python", "repo": "zdenekmaxa/lg_ros_nodes", "path": "/lg_cms_director/src/pulsar/utils/structures/skiplist.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dvelasc5/swordfish path: /swordfish/__init__.py """`swordfish` is a Python tool to study the information yield of counting experiments. Motivation ---------- With `swordfish` you can quickly and accurately forecast experimental sensitivities without all the fuss with time-intensive Monte Carlos...
code_fim
hard
{ "lang": "python", "repo": "dvelasc5/swordfish", "path": "/swordfish/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Installation ------------ `swordfish` has been tested with Python 2.7.13 and the packages - `numpy 1.13.1` - `scipy 0.19.0` - `matplotlib 2.0.0` Let us know if you run into problems. `swordfish` can be installed by invoking git clone https://github.com/cweniger/swordfish cd swordfish pyt...
code_fim
hard
{ "lang": "python", "repo": "dvelasc5/swordfish", "path": "/swordfish/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/iosxe/tests/ShowInterfaces/cli/equal/golden_output_2_expected.py expected_output = { "TenGigabitEthernet0/1/0": { "arp_timeout": "04:00:00", "arp_type": "arpa", "auto_negotiate": False, "bandwidth": 1...
code_fim
hard
{ "lang": "python", "repo": "CiscoTestAutomation/genieparser", "path": "/src/genie/libs/parser/iosxe/tests/ShowInterfaces/cli/equal/golden_output_2_expected.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>xload": "1/255", "txload": "1/255", "type": "BUILT-IN-EPA-8x10G", }, "TenGigabitEthernet0/1/6": { "arp_timeout": "04:00:00", "arp_type": "arpa", "auto_negotiate": False, "bandwidth": 10000000, "counters": { "in_broadcast_pkts": 0,...
code_fim
hard
{ "lang": "python", "repo": "CiscoTestAutomation/genieparser", "path": "/src/genie/libs/parser/iosxe/tests/ShowInterfaces/cli/equal/golden_output_2_expected.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> status: fhirtypes.Code = Field( None, alias="status", title="draft | active | retired | unknown", description=( "The status of this evidence variable. Enables tracking the life-cycle " "of the content." ), # if property is element...
code_fim
hard
{ "lang": "python", "repo": "nazrulworld/fhir.resources", "path": "/fhir/resources/R4B/evidencevariable.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nazrulworld/fhir.resources path: /fhir/resources/R4B/evidencevariable.py t_property=True, ) shortTitle__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_shortTitle", title="Extension field for ``shortTitle``." ) status: fhirtypes.Code = Field( None...
code_fim
hard
{ "lang": "python", "repo": "nazrulworld/fhir.resources", "path": "/fhir/resources/R4B/evidencevariable.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @root_validator(pre=True, allow_reuse=True) def validate_one_of_many_2629( cls, values: typing.Dict[str, typing.Any] ) -> typing.Dict[str, typing.Any]: """https://www.hl7.org/fhir/formats.html#choice A few elements have a choice of more than one data type for their cont...
code_fim
hard
{ "lang": "python", "repo": "nazrulworld/fhir.resources", "path": "/fhir/resources/R4B/evidencevariable.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>nostic_msgs;/opt/ros/kinetic/share/diagnostic_msgs/cmake/../msg;actionlib_msgs;/opt/ros/kinetic/share/actionlib_msgs/cmake/../msg" PYTHON_EXECUTABLE = "/home/casch/anaconda2/bin/python" package_has_static_sources = '' == 'TRUE' genmsg_check_deps_script = "/opt/ros/kinetic/share/genmsg/cmake/../../../lib/g...
code_fim
hard
{ "lang": "python", "repo": "Sinchiguano/Robotic-Arm-Imitation-by-Human-Gesture", "path": "/catkin_ws/build/pr2_simulator/pr2_gazebo_plugins/cmake/pr2_gazebo_plugins-genmsg-context.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sinchiguano/Robotic-Arm-Imitation-by-Human-Gesture path: /catkin_ws/build/pr2_simulator/pr2_gazebo_plugins/cmake/pr2_gazebo_plugins-genmsg-context.py # generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/casch/Dropbox/humanoid_robot/catkin_ws/src/pr2_simulator/pr2_gazebo_plug...
code_fim
hard
{ "lang": "python", "repo": "Sinchiguano/Robotic-Arm-Imitation-by-Human-Gesture", "path": "/catkin_ws/build/pr2_simulator/pr2_gazebo_plugins/cmake/pr2_gazebo_plugins-genmsg-context.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> txt = ['autosplit_train.txt', 'autosplit_val.txt', 'autosplit_test.txt'] # 3 txt files _ = [(path.parent / x).unlink() for x in txt if Path(x).exists()] # remove existing print(f'Autosplitting images from {path}' + ', using *.txt labeled images only' * annotate...
code_fim
hard
{ "lang": "python", "repo": "Alyetama/label-studio-yolov5", "path": "/split_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path = Path(path) # images dir files = sorted(x for x in path.rglob('*.*') if x.suffix[1:].lower() in IMG_FORMATS) # image files only n = len(files) # number of files random.seed(0) # for reproducibility indices = random.choices([0, 1, 2], weights=weights, ...
code_fim
hard
{ "lang": "python", "repo": "Alyetama/label-studio-yolov5", "path": "/split_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Alyetama/label-studio-yolov5 path: /split_dataset.py #!/usr/bin/env python # coding: utf-8 """ Source: https://github.com/ultralytics/yolov5/blob/master/utils/dataloaders.py """ import os import random from pathlib import Path from tqdm import tqdm def img2label_paths(img_paths) -> list: ...
code_fim
hard
{ "lang": "python", "repo": "Alyetama/label-studio-yolov5", "path": "/split_dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def generate_input(p, to_find, to_avoid, byte_addresses): print('[*] Generating input ....') byte_map = {} for i in range(0,len(to_find)-1): f = to_find[i] t = to_find[i+1] #Set up the state for the function we want to solve e = p.factory.blank_state(addr=f) ...
code_fim
hard
{ "lang": "python", "repo": "angr/angr-doc", "path": "/examples/secuinside2016mbrainfuzz/solve.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #In essence, the magic consists of: # - static padding between input and the memcpy'ed buffer # - padding from start of this buffer up to the location of the saved return address # - the address of the shellcode # - customized shellcode for '/bin/sh -c "echo SUCCESS"' #For ...
code_fim
hard
{ "lang": "python", "repo": "angr/angr-doc", "path": "/examples/secuinside2016mbrainfuzz/solve.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: angr/angr-doc path: /examples/secuinside2016mbrainfuzz/solve.py # This example is for secuinsides mbrainfuzz challenge (2016) # The challenge gave you binaries which you automatically had # to exploit - since the service is not online anymore, 4 example # binaries, obtained during the ctf, are in...
code_fim
hard
{ "lang": "python", "repo": "angr/angr-doc", "path": "/examples/secuinside2016mbrainfuzz/solve.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>print(today) """ Points to ponder: 1. from keyword 2. import keyword 3. now() function 4. strftime() function """<|fim_prefix|># repo: pythonites/Every-Python-Code-Ever path: /codes inside/quick_date_time.py from datetime import datetime <|fim_middle|>today = datetime.now() today = today.strftime(...
code_fim
medium
{ "lang": "python", "repo": "pythonites/Every-Python-Code-Ever", "path": "/codes inside/quick_date_time.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pythonites/Every-Python-Code-Ever path: /codes inside/quick_date_time.py from datetime import datetime <|fim_suffix|>print(today) """ Points to ponder: 1. from keyword 2. import keyword 3. now() function 4. strftime() function """<|fim_middle|>today = datetime.now() today = today.strftime(...
code_fim
medium
{ "lang": "python", "repo": "pythonites/Every-Python-Code-Ever", "path": "/codes inside/quick_date_time.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: justinslee/Wai-Not-Makahiki path: /makahiki/apps/widgets/wallpost/views.py """Handles wall post widget request and rendering.""" from django.contrib.auth.decorators import login_required from django.http import Http404, HttpResponse from django.template.context import RequestContext from django....
code_fim
hard
{ "lang": "python", "repo": "justinslee/Wai-Not-Makahiki", "path": "/makahiki/apps/widgets/wallpost/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> raise Http404 @login_required def post(request): """handle the submission of the wall post""" if request.is_ajax() and request.method == "POST": form = WallForm(request.POST) if form.is_valid(): wall_post = Post( user=request.user, ...
code_fim
hard
{ "lang": "python", "repo": "justinslee/Wai-Not-Makahiki", "path": "/makahiki/apps/widgets/wallpost/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomaszn/wq.db path: /tests/patterns_app/rest.py from wq.db import rest from .models import ( Campaign, Attribute, Entity, Value, ) rest.router.register( Campaign, lookup="slug", nested_arrays=Attribute, fields="__all__", ) <|fim_suffix|>@rest.register(Entity, fie...
code_fim
hard
{ "lang": "python", "repo": "tomaszn/wq.db", "path": "/tests/patterns_app/rest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> values = ValueSerializer( many=True, wq_config={ "initial": { "type_field": "attribute", "filter": { "is_active": True, "campaign": "{{campaign_id}}", }, }, }, ) ...
code_fim
hard
{ "lang": "python", "repo": "tomaszn/wq.db", "path": "/tests/patterns_app/rest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rob93c/Exercism path: /python/allergies/allergies.py class Allergies(object): def __init__(self, score): <|fim_suffix|> return [allergy for allergy in self.allergies if self.is_allergic_to(allergy)]<|fim_middle|> self.score = score self.allergies = {"eggs": 1, "peanuts"...
code_fim
hard
{ "lang": "python", "repo": "rob93c/Exercism", "path": "/python/allergies/allergies.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return [allergy for allergy in self.allergies if self.is_allergic_to(allergy)]<|fim_prefix|># repo: rob93c/Exercism path: /python/allergies/allergies.py class Allergies(object): def __init__(self, score): self.score = score self.allergies = {"eggs": 1, "peanuts": 2, "shellfis...
code_fim
medium
{ "lang": "python", "repo": "rob93c/Exercism", "path": "/python/allergies/allergies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not ipc_socket: ipc_socket = os.environ["AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT"] if not authtoken: authtoken = os.environ["SVCUID"] if not lifecycle_handler: lifecycle_handler = LifecycleHandler() elg = EventLoopGroup(num_threads=1) resolver = ...
code_fim
hard
{ "lang": "python", "repo": "aws/aws-iot-device-sdk-python-v2", "path": "/awsiot/greengrasscoreipc/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aws/aws-iot-device-sdk-python-v2 path: /awsiot/greengrasscoreipc/__init__.py # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. import os from typing import Optional from awscrt.io import ( ClientBootstrap, DefaultHostResolver, ...
code_fim
hard
{ "lang": "python", "repo": "aws/aws-iot-device-sdk-python-v2", "path": "/awsiot/greengrasscoreipc/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: ipc_socket: Path to the Unix domain socket of Greengrass Nucleus, defaults to environment variable AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT authtoken: Authentication token, defaults to environment variable SVCUID lifecycle_handler: Handler for event...
code_fim
hard
{ "lang": "python", "repo": "aws/aws-iot-device-sdk-python-v2", "path": "/awsiot/greengrasscoreipc/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._pop_and_verify_dest_select_notification(server['id'], replacements={ 'image.container_format': 'ami', 'image.disk_format': 'ami', 'image.id': image_ref, 'image.properties': { 'nova_object.data': {...
code_fim
hard
{ "lang": "python", "repo": "openstack/nova", "path": "/nova/tests/functional/notification_sample_tests/test_instance.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.notifier.reset() self.api.post_server_action(server['id'], {'shelveOffload': {}}) # we need to wait for the instance.host to become None as well before # we can unshelve to make sure that the unshelve.start notification # payload is stable as the compute manage...
code_fim
hard
{ "lang": "python", "repo": "openstack/nova", "path": "/nova/tests/functional/notification_sample_tests/test_instance.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/nova path: /nova/tests/functional/notification_sample_tests/test_instance.py ance-power_on-end', replacements={ 'reservation_id': server['reservation_id'], 'uuid': server['id']}, actual=self.notifier.versioned_notifications[3]) ...
code_fim
hard
{ "lang": "python", "repo": "openstack/nova", "path": "/nova/tests/functional/notification_sample_tests/test_instance.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ImperialCollegeLondon/sharpy path: /sharpy/linear/dev/linsym_uc_dncdzeta.py ''' Analytical linearisation of uc*dnc/dzeta Sign convention: Scalar quantities are all lower case, e.g. zeta Arrays begin with upper case, e.g. Zeta_i 2 D Matrices are all upper case, e.g. AW, ZETA=[Zeta_i] 3 D arrays ...
code_fim
hard
{ "lang": "python", "repo": "ImperialCollegeLondon/sharpy", "path": "/sharpy/linear/dev/linsym_uc_dncdzeta.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ### shorten equations Der=dUnorm_dR eq_crR13Uc=linfunc.cross_product(R13,Uc) eq_crR02Uc=linfunc.cross_product(R02,Uc) eq_crR02R13=linfunc.cross_product(R02,R13) crR13Uc_x,crR13Uc_y,crR13Uc_z=sm.symbols('crR13Uc_x crR13Uc_y crR13Uc_z',real=True) crR02Uc_x,crR02Uc_y,crR02Uc_z=sm.symbols('crR02Uc_x crR02U...
code_fim
hard
{ "lang": "python", "repo": "ImperialCollegeLondon/sharpy", "path": "/sharpy/linear/dev/linsym_uc_dncdzeta.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>################################################################################ ### exploit combined derivatives ################################################################################ dR_dZeta=sm.derive_by_array([R02,R13],[Zeta00,Zeta01,Zeta02,Zeta03]) ### redefine R02,R13 r02_x,r02_y,r02_z=...
code_fim
hard
{ "lang": "python", "repo": "ImperialCollegeLondon/sharpy", "path": "/sharpy/linear/dev/linsym_uc_dncdzeta.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># any library files you need gb1 = glob.glob(ipath + "\\Lib\\*.py") gb2 = glob.glob(ipath + "\\Lib\\*\\*.py") gb3 = glob.glob(ipath + "\\Lib\\*\\*\\*.py") gb = list(set(gb1 + gb2 + gb3)) gb = [ipyc,"/main:bkt_install\\StdLib.py","/embed","/platform:x86","/target:dll"] + gb subprocess.call(gb) print("Mad...
code_fim
medium
{ "lang": "python", "repo": "pyro-team/bkt-toolbox", "path": "/installer/bkt_install/build_stdlib.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyro-team/bkt-toolbox path: /installer/bkt_install/build_stdlib.py # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function <|fim_suffix|>gb = [ipyc,"/main:bkt_install\\StdLib.py","/embed","/platform:x86","/target:dll"] + gb subprocess.call(gb) print("Made StdLib")<|fim_m...
code_fim
hard
{ "lang": "python", "repo": "pyro-team/bkt-toolbox", "path": "/installer/bkt_install/build_stdlib.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Luckykarter/filecreate path: /setup.py import setuptools from configparser import ConfigParser with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() <|fim_suffix|>setuptools.setup( name=metadata['name'], version=metadata['version'], author=metadata['a...
code_fim
medium
{ "lang": "python", "repo": "Luckykarter/filecreate", "path": "/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>setuptools.setup( name=metadata['name'], version=metadata['version'], author=metadata['author'], author_email=metadata['author_email'], description=metadata['description'], long_description=long_description, long_description_content_type=metadata['long_description_content_type'...
code_fim
medium
{ "lang": "python", "repo": "Luckykarter/filecreate", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>=True) writer = pd.ExcelWriter(output_file) all_data_concatenated.to_excel(writer,sheet_name='all_data_all_workbooks',index=False) writer.save()<|fim_prefix|># repo: wyqdgggfk/Python-Data-Analyze path: /第 3 章所需资料/pandas_concat_data_from_multiple_workbooks.py import pandas as pd import glob import os impo...
code_fim
hard
{ "lang": "python", "repo": "wyqdgggfk/Python-Data-Analyze", "path": "/第 3 章所需资料/pandas_concat_data_from_multiple_workbooks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wyqdgggfk/Python-Data-Analyze path: /第 3 章所需资料/pandas_concat_data_from_multiple_workbooks.py import pandas as pd import glob import os import sys input_path = sys.argv[1] output_file = sys.argv[2] all_workbooks = glob.glob(os.path.join(i<|fim_suffix|>=True) writer = pd.ExcelWriter(output_file) al...
code_fim
hard
{ "lang": "python", "repo": "wyqdgggfk/Python-Data-Analyze", "path": "/第 3 章所需资料/pandas_concat_data_from_multiple_workbooks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # When a single object is passed to the method, a list with the # object as single item will be returned return [obj]<|fim_prefix|># repo: bbhunter/pastepwn path: /pastepwn/util/listify.py # -*- coding: utf-8 -*- def listify(obj): """Make sure the given object is a list <|fim_middle|> ...
code_fim
hard
{ "lang": "python", "repo": "bbhunter/pastepwn", "path": "/pastepwn/util/listify.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bbhunter/pastepwn path: /pastepwn/util/listify.py # -*- coding: utf-8 -*- def listify(obj): """Make sure the given object is a list <|fim_suffix|> # When a single object is passed to the method, a list with the # object as single item will be returned return [obj]<|fim_middle|> ...
code_fim
hard
{ "lang": "python", "repo": "bbhunter/pastepwn", "path": "/pastepwn/util/listify.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/non_negative_integer/schema_instance/nistschema_sv_iv_list_non_negative_integer_pattern_2_xsd/__init__.py from output.models.nist_data.list_pkg.non_negative_integer.schema_instance.<|fim_suffix|>st_non_negative_integer_pattern_2 impor...
code_fim
medium
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/nist_data/list_pkg/non_negative_integer/schema_instance/nistschema_sv_iv_list_non_negative_integer_pattern_2_xsd/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rPattern2 __all__ = [ "NistschemaSvIvListNonNegativeIntegerPattern2", ]<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/non_negative_integer/schema_instance/nistschema_sv_iv_list_non_negative_integer_pattern_2_xsd/__init__.py from output.models.nist_data.list_pkg....
code_fim
medium
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/nist_data/list_pkg/non_negative_integer/schema_instance/nistschema_sv_iv_list_non_negative_integer_pattern_2_xsd/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ros-infrastructure/ros_buildfarm path: /ros_buildfarm/doc_job.py from rosdistro import get_distribution_cache from rosdistro import get_index def configure_doc_jobs( config_url, rosdistro_name, doc_build_name, groovy_script=None, dry_run=False, whitelist_repository_names=None): ...
code_fim
hard
{ "lang": "python", "repo": "ros-infrastructure/ros_buildfarm", "path": "/ros_buildfarm/doc_job.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> repo = dist_file.repositories[repo_name] if not repo.doc_repository: raise JobValidationError( "Repository '%s' has no doc section" % repo_name) if not repo.doc_repository.version: raise JobValidationError( "Repository '%s' ha...
code_fim
hard
{ "lang": "python", "repo": "ros-infrastructure/ros_buildfarm", "path": "/ros_buildfarm/doc_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def configure_doc_independent_job( config_url, doc_build_name, config=None, build_file=None, dry_run=False): if config is None: config = get_config_index(config_url) if build_file is None: build_files = get_global_doc_build_files(config) build_file = build_...
code_fim
hard
{ "lang": "python", "repo": "ros-infrastructure/ros_buildfarm", "path": "/ros_buildfarm/doc_job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MohanSha/PyTaskAutomation path: /cleverbot.py #!/usr/bin/python3 from cleverwrap import CleverWrap import pyttsx import os os.environ["HTTPS_PROXY"] = "http://usr_name:pass@proxy:port" <|fim_suffix|> a='y' engine = pyttsx.init() voices = engine.getProperty('voices') engine.setProperty('voice', v...
code_fim
medium
{ "lang": "python", "repo": "MohanSha/PyTaskAutomation", "path": "/cleverbot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ans=cw.say(raw_input('You: ')) print 'Kiara: '+ans engine.say(ans) engine.runAndWait() #a=raw_input('wanna chat more(y/n): ') cw.reset()<|fim_prefix|># repo: MohanSha/PyTaskAutomation path: /cleverbot.py #!/usr/bin/python3 from cleverwrap import CleverWrap import pyttsx import os os...
code_fim
hard
{ "lang": "python", "repo": "MohanSha/PyTaskAutomation", "path": "/cleverbot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: a-r-g-v/nata path: /nata/records.py # encoding: utf8 from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.sql.expression import extract from sqlalchemy.orm import backref, relationship, Query from sqlalchemy import Column, DateTime, Index, Integer, String, Text, Boolean, text, ...
code_fim
hard
{ "lang": "python", "repo": "a-r-g-v/nata", "path": "/nata/records.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ServiceRecord(Base): __tablename__ = "service" no = Column(Integer, primary_key=True) name = Column(String(160), unique=False, nullable=False) spec = Column(Text, nullable=False) created_date = Column( DateTime, default=datetime.datetime.now(), nullable=False) archive...
code_fim
medium
{ "lang": "python", "repo": "a-r-g-v/nata", "path": "/nata/records.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: firedrakeproject/petsc path: /config/BuildSystem/config/packages/tetgen.py import config.package structDecl = ''' #include <stdio.h> // Needed for FILE, NULL class tetgenio { public: enum {FILENAMESIZE = 1024}; enum {INPUTLINESIZE = 1024}; typedef struct { int *vertexlist; ...
code_fim
hard
{ "lang": "python", "repo": "firedrakeproject/petsc", "path": "/config/BuildSystem/config/packages/tetgen.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Configure(config.package.Package): def __init__(self, framework): config.package.Package.__init__(self, framework) self.download = ['http://www.tetgen.org/1.5/src/tetgen1.5.1.tar.gz', 'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/tetgen1.5.1.tar.gz'] s...
code_fim
hard
{ "lang": "python", "repo": "firedrakeproject/petsc", "path": "/config/BuildSystem/config/packages/tetgen.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for backend in ("cython", "numba", "pythran"): timeit_verbose( f"proj_{backend}(vx, vy, vz, kx, ky, kz, inv_k_square_nozero)", setup=setup, globals=loc, norm=norm, ) timeit_verbose( f"proj_loop_{backend}(vx, vy, vz, kx...
code_fim
hard
{ "lang": "python", "repo": "fluiddyn/transonic", "path": "/doc/examples/bench_proj_perp/bench.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> vx = np.ones(shape) vy = np.ones(shape) vz = np.ones(shape) """ ) print() norm = timeit_verbose( "proj(vx, vy, vz, kx, ky, kz, inv_k_square_nozero)", setup=setup, globals=loc, ) for backend in ("cython", "numba", "pythran"): ...
code_fim
hard
{ "lang": "python", "repo": "fluiddyn/transonic", "path": "/doc/examples/bench_proj_perp/bench.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fluiddyn/transonic path: /doc/examples/bench_proj_perp/bench.py import numpy as np from transonic import boost, Array, Type A = Array[Type(np.float64, np.complex128), "3d"] Af = "float[:,:,:]" A = Af # issue fused type with Cython def proj(vx: A, vy: A, vz: A, kx: Af, ky: Af, kz: Af, inv_k_sq...
code_fim
hard
{ "lang": "python", "repo": "fluiddyn/transonic", "path": "/doc/examples/bench_proj_perp/bench.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lopiola/integracja_wypadki path: /scripts/statistics/drunk_drivers_by_day_of_year.py #!/usr/bin/python # -*- coding: utf-8 -*- """ Time statistic for data. """ from scripts.db_api import accident def usa_query(day, month): <|fim_suffix|> if __name__ == '__main__': print('DOY\tALL\tDRUNK')...
code_fim
hard
{ "lang": "python", "repo": "lopiola/integracja_wypadki", "path": "/scripts/statistics/drunk_drivers_by_day_of_year.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': print('DOY\tALL\tDRUNK') month_lengths = { 1: 31, 2: 29, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31 } for month in xrange(1, 13): ...
code_fim
hard
{ "lang": "python", "repo": "lopiola/integracja_wypadki", "path": "/scripts/statistics/drunk_drivers_by_day_of_year.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_date_with_locale(): with temp_locale(*_dd_mm_yyyy_locales): frozen_date = datetime.date(year=2012, month=1, day=2) date_freezer = freeze_time(frozen_date) assert date_freezer.time_to_freeze.date() == frozen_date def test_invalid_type(): try: freeze_time(...
code_fim
hard
{ "lang": "python", "repo": "spulec/freezegun", "path": "/tests/test_datetimes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: spulec/freezegun path: /tests/test_datetimes.py ozen_datetime: assert frozen_datetime() == initial_datetime frozen_datetime.tick() initial_datetime += datetime.timedelta(seconds=1) assert frozen_datetime() == initial_datetime frozen_datetime.tick(10) ...
code_fim
hard
{ "lang": "python", "repo": "spulec/freezegun", "path": "/tests/test_datetimes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def setUpClass(cls): assert datetime.date(2013, 4, 9) == datetime.date.today() def setUp(self): self.assertEqual(datetime.date(2013, 4, 9), datetime.date.today()) def tearDown(self): self.assertEqual(datetime.date(2013, 4, 9), datetime.date.today()) ...
code_fim
hard
{ "lang": "python", "repo": "spulec/freezegun", "path": "/tests/test_datetimes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: IsaacjlWu/CUP path: /cup/thirdp/mysql.py #!/usr/bin/env python # -*- coding: utf-8 -* # ############################################################# # # Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved # # ############################################################# """ :authors: Gua...
code_fim
easy
{ "lang": "python", "repo": "IsaacjlWu/CUP", "path": "/cup/thirdp/mysql.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""" from . import pymysql pymysql.install_as_MySQLdb() # vi:set tw=0 ts=4 sw=4 nowrap fdm=indent<|fim_prefix|># repo: IsaacjlWu/CUP path: /cup/thirdp/mysql.py #!/usr/bin/env python # -*- coding: utf-8 -* # ############################################################# # # Copyright (c) 2014 Baidu.com, I...
code_fim
easy
{ "lang": "python", "repo": "IsaacjlWu/CUP", "path": "/cup/thirdp/mysql.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jsoetens/flask-oauth2-boilerplate path: /myapp/stores/views.py from flask import flash, redirect, render_template, request, url_for from flask_login import current_user, login_required from sqlalchemy.exc import IntegrityError from myapp.models.db_orm import db from . import stores from .forms ...
code_fim
hard
{ "lang": "python", "repo": "jsoetens/flask-oauth2-boilerplate", "path": "/myapp/stores/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ A store can be deleted when the user is signed in and created this store. """ # Verify if current_user created this store user_id = Store.get_user_id(country_code, number) # Conversion is required because current_user.get_id() returns unicode if int(current_user.get_id()) ...
code_fim
hard
{ "lang": "python", "repo": "jsoetens/flask-oauth2-boilerplate", "path": "/myapp/stores/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # np.random.seed(0) # feat1 = np.random.rand(1, 5, 15) # feat2 = np.random.rand(1, 5, 7) # desc = np.ones((1, 20, 15)) # pl = PermutohedralLattice.apply # feat1 = torch.cuda.FloatTensor(feat1) # feat2 = torch.cuda.FloatTensor(feat2) # desc = torch.cuda.FloatTensor(desc) ...
code_fim
hard
{ "lang": "python", "repo": "ml-edu/Permutohedral_attention_module", "path": "/PAM_cuda/pl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ml-edu/Permutohedral_attention_module path: /PAM_cuda/pl.py def _simple_hash(key, hash_vector, table_size): res = (key*hash_vector).sum(dim=1) return (res%table_size).type(torch.cuda.IntTensor) class PermutohedralLattice(torch.autograd.Function): @staticmethod def forward(...
code_fim
hard
{ "lang": "python", "repo": "ml-edu/Permutohedral_attention_module", "path": "/PAM_cuda/pl.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__=="__main__": # np.random.seed(0) # feat1 = np.random.rand(1, 5, 15) # feat2 = np.random.rand(1, 5, 7) # desc = np.ones((1, 20, 15)) # pl = PermutohedralLattice.apply # feat1 = torch.cuda.FloatTensor(feat1) # feat2 = torch.cuda.Flo...
code_fim
hard
{ "lang": "python", "repo": "ml-edu/Permutohedral_attention_module", "path": "/PAM_cuda/pl.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: antlr/grammars-v4 path: /python/python/examples/try_stmt.py # try_stmt: TRY COLON suite (except_clause+ else_clause? finaly_clause? | finaly_clause) <|fim_suffix|># TRY COLON suite except_clause finaly_clause try: pass except Exception: pass finally: pass # TRY COLON suite finaly_cl...
code_fim
hard
{ "lang": "python", "repo": "antlr/grammars-v4", "path": "/python/python/examples/try_stmt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># TRY COLON suite except_clause except_clause else_clause try: pass except Exception as ex: pass except: pass else: pass # TRY COLON suite except_clause finaly_clause try: pass except Exception: pass finally: pass # TRY COLON suite finaly_clause try: pass finally: pas...
code_fim
medium
{ "lang": "python", "repo": "antlr/grammars-v4", "path": "/python/python/examples/try_stmt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(path) as file: return reduce( lambda first, second: (first[0] + second[0], first[1] + second[1]), filter(lambda obj: obj, map(get_stats, file.readlines())) ) if __name__ == '__main__': if len(sys.argv) > 1: print('{stats[0]} {stats[1]}'.fo...
code_fim
hard
{ "lang": "python", "repo": "vit-vel/PCM-R-tree", "path": "/utils/parse_dhat_result.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vit-vel/PCM-R-tree path: /utils/parse_dhat_result.py #! /usr/bin/env python3 import re import sys from functools import reduce re_expr = re.compile('.*acc-ratios.*?([0-9,]*) b-read.*?([0-9,]*) b-written.*') def get_stats(str): <|fim_suffix|> with open(path) as file: return reduce( ...
code_fim
medium
{ "lang": "python", "repo": "vit-vel/PCM-R-tree", "path": "/utils/parse_dhat_result.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }