text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> # Pick channels to not include in epoch rejection
raw.info['bads'] += ['EXG3', 'EXG4', 'A1', 'A2', 'A30',
'A7', 'A6', 'A24', 'A28', 'A29',
'A3', 'A11', 'A15', 'A16', 'A17',
... | code_fim | hard | {
"lang": "python",
"repo": "haribharadwaj/codebasket",
"path": "/SNAPlabABR/ABR_32Channel_fileByFile.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for subj in subjlist:
for ear in earlist:
if ear == 'L':
conds = [[3, 9], [5, 10]]
names = ['_L_soft', '_L_moderate']
else:
conds = [[48, 144], [80, 160]]
names = ['_R_soft', '_R_moderate']
# if ear == 'L':
# ... | code_fim | hard | {
"lang": "python",
"repo": "haribharadwaj/codebasket",
"path": "/SNAPlabABR/ABR_32Channel_fileByFile.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haribharadwaj/codebasket path: /SNAPlabABR/ABR_32Channel_fileByFile.py
from anlffr.helper import biosemi2mne as bs
import mne
import numpy as np
import os
import fnmatch
from scipy.signal import savgol_filter as sg
from scipy.io import savemat
# Setup bayesian-weighted averaging
def bayesave(x,... | code_fim | hard | {
"lang": "python",
"repo": "haribharadwaj/codebasket",
"path": "/SNAPlabABR/ABR_32Channel_fileByFile.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> exclude = self.rob(root.left) + self.rob(root.right)
return max(include, exclude)<|fim_prefix|># repo: AravindVasudev/datastructures-and-algorithms path: /problems/leetcode/house-robber-iii.py
# https://leetcode.com/problems/house-robber-iii/
# Definition for a binary tree node.
... | code_fim | hard | {
"lang": "python",
"repo": "AravindVasudev/datastructures-and-algorithms",
"path": "/problems/leetcode/house-robber-iii.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AravindVasudev/datastructures-and-algorithms path: /problems/leetcode/house-robber-iii.py
# https://leetcode.com/problems/house-robber-iii/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left =... | code_fim | medium | {
"lang": "python",
"repo": "AravindVasudev/datastructures-and-algorithms",
"path": "/problems/leetcode/house-robber-iii.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if root.right:
include += self.rob(root.right.left)
include += self.rob(root.right.right)
exclude = self.rob(root.left) + self.rob(root.right)
return max(include, exclude)<|fim_prefix|># repo: AravindVasudev/datastructures-and-algorithm... | code_fim | hard | {
"lang": "python",
"repo": "AravindVasudev/datastructures-and-algorithms",
"path": "/problems/leetcode/house-robber-iii.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check against specifications
TestCase().assertEqual(resulting_optimization_iterations, 10)
TestCase().assertAlmostEqual(resulting_improvement, -8.79655E+00, 4)
TestCase().assertAlmostEqual(resulting_gradient_norm, 4.48563E+03, 4)
TestCase().assertAlmostEqual(resulting_step_size, 2.35... | code_fim | hard | {
"lang": "python",
"repo": "KratosMultiphysics/Kratos",
"path": "/applications/ShapeOptimizationApplication/tests/opt_process_step_adaption_test/run_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open(optimization_log_filename, 'r') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
last_line = None
for line in reader:
if not line:
continue
else:
last_line = line
resulting_optimization_iterations = int(last_line[0].strip())
res... | code_fim | hard | {
"lang": "python",
"repo": "KratosMultiphysics/Kratos",
"path": "/applications/ShapeOptimizationApplication/tests/opt_process_step_adaption_test/run_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KratosMultiphysics/Kratos path: /applications/ShapeOptimizationApplication/tests/opt_process_step_adaption_test/run_test.py
# Import Kratos core and apps
import KratosMultiphysics as KM
# Additional imports
from KratosMultiphysics.ShapeOptimizationApplication import optimizer_factory
from Kratos... | code_fim | hard | {
"lang": "python",
"repo": "KratosMultiphysics/Kratos",
"path": "/applications/ShapeOptimizationApplication/tests/opt_process_step_adaption_test/run_test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DisFox/redditwolframbot path: /wolframalpha.py
import urllib, requests, time, praw, xml.etree.ElementTree as ET, os, re
def redditescape(string):
escape = '\\`*_{}[]()#+-.!^~'
for char in escape:
string = string.replace(char, '\\' + char)
return string
de... | code_fim | hard | {
"lang": "python",
"repo": "DisFox/redditwolframbot",
"path": "/wolframalpha.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if os.path.exists("wolframids.txt") != True:
with open("wolframids.txt",'w') as w:
alreadyposted = [] #Creates database if it doesn't exist, reads if it does
else:
with open("wolframids.txt","a+") as w:
... | code_fim | hard | {
"lang": "python",
"repo": "DisFox/redditwolframbot",
"path": "/wolframalpha.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jbrinsfield/policosm path: /tests/geoNetworks/testLinkNewNodes.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created in February 2017 in ComplexCity Lab
@author: github.com/fpfaende
what it does
extract a graph from
o o o o
becomes | |
o——————————o o... | code_fim | hard | {
"lang": "python",
"repo": "jbrinsfield/policosm",
"path": "/tests/geoNetworks/testLinkNewNodes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # we got the nearest edge source and target
# if the projection of the new node z is inside the segment ([–o——] and not o [–———])
# we create a new node w on the edge and redistribute length
ucoo = (graph.node[u]['longitude'], graph.node[u]['latitude'])
vcoo = (graph.node[v]['longitude'], grap... | code_fim | hard | {
"lang": "python",
"repo": "jbrinsfield/policosm",
"path": "/tests/geoNetworks/testLinkNewNodes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return graph
if __name__ == "__main__":
testGraph = nx.Graph()
testGraph.add_node(1,longitude=1.0, latitude=1.0)
testGraph.add_node(2,longitude=2.0, latitude=1.0)
testGraph.add_node(3,longitude=3.0, latitude=3.0)
testGraph.add_edge(1, 2,osmid=3,highway='residential',level=3, lanes=1, oneway=Fals... | code_fim | hard | {
"lang": "python",
"repo": "jbrinsfield/policosm",
"path": "/tests/geoNetworks/testLinkNewNodes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def run_without_permissions():
cmd = """
do shell script "./freelan_cmd.py -l"
"""
return run_with_permissions_osx(cmd)
def run_with_permissions():
cmd = """
do shell script "./freelan_cmd.py -l -server -w" with administrator privileges
"""
return r... | code_fim | hard | {
"lang": "python",
"repo": "privacee/freelan-configurator",
"path": "/freelan_configurator/flc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: privacee/freelan-configurator path: /freelan_configurator/flc.py
#!/usr/bin/env python
from __future__ import print_function
try:
input = raw_input
except NameError:
pass
import os,sys
import subprocess
VERBOSE = False
def run_with_permissions_osx(apple_script, args=[]):
return os... | code_fim | medium | {
"lang": "python",
"repo": "privacee/freelan-configurator",
"path": "/freelan_configurator/flc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def IsWindows():
return sys.platform.startswith('win')
def IsLinux():
return sys.platform.startswith('linux')
def IsOsX():
return sys.platform.startswith('darwin')<|fim_prefix|># repo: facebookexperimental/r8 path: /tools/defines.py
# Copyright (c) 2019, the R8 project authors. Please see the AUT... | code_fim | hard | {
"lang": "python",
"repo": "facebookexperimental/r8",
"path": "/tools/defines.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookexperimental/r8 path: /tools/defines.py
# Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import sys
<|fim_suffix|>de... | code_fim | hard | {
"lang": "python",
"repo": "facebookexperimental/r8",
"path": "/tools/defines.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>car_listing_dict = {}
counter = 0
for file in car_file_list:
counter += 1
print(counter, file)
soup = BeautifulSoup(open(file, 'r+'),'lxml')
# vin is None if the page is empty
vin = soup.find('li', { 'data-qa' : 'VehicleDetails-vin' }).contents[-2] \
if soup.find('l... | code_fim | hard | {
"lang": "python",
"repo": "jinzh2011/predict-used-car-prices",
"path": "/code/scrape/combine_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jinzh2011/predict-used-car-prices path: /code/scrape/combine_data.py
# coding: utf-8
#combine data
from __future__ import print_function, division
import requests
from bs4 import BeautifulSoup
import re
import pprint
import json
import os
import pandas as pd
# combine master listing data
mast... | code_fim | hard | {
"lang": "python",
"repo": "jinzh2011/predict-used-car-prices",
"path": "/code/scrape/combine_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @commands.command()
@commands.check(permissions.admincheck)
async def birdrestart(self, astable):
cmd = subprocess.check_output(["birdc", "restart", str(astable)])
for page in chat_formatting.pagify(cmd.decode(), ['\n', ' '], shorten_by=12):
await self.bot.say(chat_... | code_fim | hard | {
"lang": "python",
"repo": "Electromaster232/discord-ix-bot",
"path": "/cogs/bird.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Electromaster232/discord-ix-bot path: /cogs/bird.py
from discord.ext import commands
from cogs.utils import permissions
from cogs.utils import chat_formatting
import subprocess
class Bird:
"""Do things with BIRD"""
def __init__(self, bot):
self.bot = bot
@commands.command()... | code_fim | hard | {
"lang": "python",
"repo": "Electromaster232/discord-ix-bot",
"path": "/cogs/bird.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pantsbuild/pants path: /src/python/pants/backend/python/goals/repl.py
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
from typing import Iterable
from pants.backend.p... | code_fim | hard | {
"lang": "python",
"repo": "pantsbuild/pants",
"path": "/src/python/pants/backend/python/goals/repl.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> complete_pex_env = pex_env.in_workspace()
args = complete_pex_env.create_argv(request.in_chroot(requirements_pex.name))
chrooted_source_roots = [request.in_chroot(sr) for sr in sources.source_roots]
extra_env = {
**complete_pex_env.environment_dict(python=requirements_pex.python),... | code_fim | hard | {
"lang": "python",
"repo": "pantsbuild/pants",
"path": "/src/python/pants/backend/python/goals/repl.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbornhau/python-opensdk path: /src/testproject/sdk/addons/actionproxy.py
# Copyright 2020 TestProject (https://testproject.io)
#
# 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 Lice... | code_fim | hard | {
"lang": "python",
"repo": "bbornhau/python-opensdk",
"path": "/src/testproject/sdk/addons/actionproxy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._proxydescriptor = None
@property
def proxydescriptor(self) -> ProxyDescriptor:
"""Getter for the proxydescriptor"""
return self._proxydescriptor
@proxydescriptor.setter
def proxydescriptor(self, value: ProxyDescriptor):
"""Setter for the proxydescrip... | code_fim | medium | {
"lang": "python",
"repo": "bbornhau/python-opensdk",
"path": "/src/testproject/sdk/addons/actionproxy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeepDubbed/malaya-speech path: /malaya_speech/train/model/fast_swave/loss.py
import tensorflow as tf
import numpy as np
from itertools import permutations
from tensorflow.python.ops import weights_broadcast_ops
EPS = 1e-8
def cal_abs_with_pit(source, estimate_source, source_lengths, C):
e... | code_fim | hard | {
"lang": "python",
"repo": "DeepDubbed/malaya-speech",
"path": "/malaya_speech/train/model/fast_swave/loss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> abs_set = tf.einsum('bij,pij->bp', pair_wise_abs, perms_one_hot)
min_abs = tf.reduce_min(abs_set, axis = 1, keepdims = True)
min_abs /= C
return min_abs
def calculate_loss(source, estimate_source, source_lengths, C):
min_abs = cal_abs_with_pit(source, estimate_source, source_lengths... | code_fim | hard | {
"lang": "python",
"repo": "DeepDubbed/malaya-speech",
"path": "/malaya_speech/train/model/fast_swave/loss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acbg/vdirsyncer path: /tests/storage/dav/__init__.py
# -*- coding: utf-8 -*-
import os
import requests
import requests.exceptions
from tests import assert_item_equals
import vdirsyncer.exceptions as exceptions
from vdirsyncer.storage.base import Item
from .. import StorageTests, get_server_m... | code_fim | hard | {
"lang": "python",
"repo": "acbg/vdirsyncer",
"path": "/tests/storage/dav/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_dav_empty_get_multi_performance(self, s, monkeypatch):
def breakdown(*a, **kw):
raise AssertionError('Expected not to be called.')
monkeypatch.setattr('requests.sessions.Session.request', breakdown)
try:
assert list(s.get_multi([])) == []
... | code_fim | hard | {
"lang": "python",
"repo": "acbg/vdirsyncer",
"path": "/tests/storage/dav/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if core.options.updaterelease != "3.4":
return
# bestman2 and jetty have been dropped from OSG 3.4. bestman2-server-dep-libs requires a version of jetty-http
# less than what's available in EPEL, which causes `yum update` fails. We no longer care about bestman2 so we
... | code_fim | hard | {
"lang": "python",
"repo": "sthapa/osg-test",
"path": "/osgtest/tests/special_install.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sthapa/osg-test path: /osgtest/tests/special_install.py
import re
from collections import OrderedDict
import osgtest.library.core as core
import osgtest.library.yum as yum
import osgtest.library.osgunittest as osgunittest
class TestInstall(osgunittest.OSGTestCase):
def test_01_yum_reposito... | code_fim | hard | {
"lang": "python",
"repo": "sthapa/osg-test",
"path": "/osgtest/tests/special_install.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dana-i2cat/felix path: /expedient/src/python/expedient/clearinghouse/aggregate/tests/models.py
'''
Created on Jun 11, 2010
@author: jnaous
'''
from django.db import models
from django.db.models.signals import pre_delete
from expedient.clearinghouse.resources.models import Resource
from expedient... | code_fim | hard | {
"lang": "python",
"repo": "dana-i2cat/felix",
"path": "/expedient/src/python/expedient/clearinghouse/aggregate/tests/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DummyResource(Resource):
pass
class DummySliceEvent(models.Model):
slice = models.TextField()
status = models.TextField()
aggregate = models.TextField()
def slice_deleted(sender, **kwargs):
slice = kwargs["instance"]
DummySliceEvent.objects.create(
slice="%s" % ... | code_fim | hard | {
"lang": "python",
"repo": "dana-i2cat/felix",
"path": "/expedient/src/python/expedient/clearinghouse/aggregate/tests/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(DummyAggregate, self).stop_slice(slice)
DummySliceEvent.objects.get_or_create(
slice="%s" % slice,
status="stopped",
aggregate="%s" % self,
)
class DummyResource(Resource):
pass
class DummySliceEvent(models.Model):
slice = models.... | code_fim | hard | {
"lang": "python",
"repo": "dana-i2cat/felix",
"path": "/expedient/src/python/expedient/clearinghouse/aggregate/tests/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> pdf_file_location = os.path.join(Const.FILE_LOCATION, enc_file)
with open(pdf_file_location, "wb") as file_obj:
source_blob.download_to_file(file_obj)
print("Files in /tmp after loading file from GCS Bucket: ", os.listdir(Const.FILE_LOCATION))
key = Const.KEY
iv = Const.IV
... | code_fim | medium | {
"lang": "python",
"repo": "Devendra274/PDF_To_Image_Converter",
"path": "/decryption.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Devendra274/PDF_To_Image_Converter path: /decryption.py
import os
from Crypto.Cipher import AES
from google.cloud import storage
import constants as Const
import get_bucket_connection as get_conn
def __decrypt(filepath):
# GCS Storage Object
source_bucket = get_conn.get_bucket_connectio... | code_fim | hard | {
"lang": "python",
"repo": "Devendra274/PDF_To_Image_Converter",
"path": "/decryption.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(chunk) == 0:
break
temp = outfile.write(aes.decrypt(chunk))
updated_filename = f"{filename}_{Const.FILE_EXTENSION}"
updated_filepath = os.path.join(Const.FILE_LOCATION, updated_filename)
"""
Solving EOF not Found Exception -... | code_fim | hard | {
"lang": "python",
"repo": "Devendra274/PDF_To_Image_Converter",
"path": "/decryption.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Otherwise, we have arguments and should return a decorator.
if file_format is None or file_format == "parquet":
kwargs = {}
if check_dtypes is not None:
kwargs["check_dtypes"] = check_dtypes
return protocols.ParquetDataFrameProtocol(**kwargs)
elif file_for... | code_fim | hard | {
"lang": "python",
"repo": "square/bionic",
"path": "/bionic/protocol.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
file_format: {'parquet', 'feather'} (default: 'parquet')
Which file format to use when saving values to disk.
check_dtypes: boolean (default: True)
Check for column types not supported by the file format. This
check is best-effort and not guar... | code_fim | hard | {
"lang": "python",
"repo": "square/bionic",
"path": "/bionic/protocol.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: square/bionic path: /bionic/protocol.py
from . import protocols
from .utils.misc import oneline
# These are callable with or without arguments. See BaseProtocol.__call__ for
# why we instantiate them here.
picklable = protocols.PicklableProtocol() # noqa: F401
dillable = protocols.DillableProt... | code_fim | hard | {
"lang": "python",
"repo": "square/bionic",
"path": "/bionic/protocol.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pasqoc/incubator-tvm path: /python/tvm/relay/backend/contrib/cmsisnn/codegen.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The... | code_fim | hard | {
"lang": "python",
"repo": "pasqoc/incubator-tvm",
"path": "/python/tvm/relay/backend/contrib/cmsisnn/codegen.py",
"mode": "psm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> trailing_dim = len(shape) - 1
num_rows = 1
for dim in range(trailing_dim):
num_rows *= shape[dim]
row_size = shape[trailing_dim]
ir_builder.emit(
tvm.tir.call_extern(
dtype,
"arm_softmax_s8",
in... | code_fim | hard | {
"lang": "python",
"repo": "pasqoc/incubator-tvm",
"path": "/python/tvm/relay/backend/contrib/cmsisnn/codegen.py",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not isinstance(call.op, tvm.ir.op.Op):
return False
if call.op.name != op_name:
return False
return True
def is_quantized_softmax(self, call):
"""Checks for the following relay sequence
a = qnn.dequantize(in, scale, zero_point)
... | code_fim | hard | {
"lang": "python",
"repo": "pasqoc/incubator-tvm",
"path": "/python/tvm/relay/backend/contrib/cmsisnn/codegen.py",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.click_action_happened = True
def try_move(self):
self.drag_stopped = True
def try_drag(self, label, dx, dy):
if dx == .1 and dy == .1:
self.drag_moved = True
if __name__ == "__main__":
test_vtk_ui_label_behaviors().test()<|fim_prefix|># repo: CDAT/vc... | code_fim | hard | {
"lang": "python",
"repo": "CDAT/vcs",
"path": "/tests/vtk_ui/test_vtk_ui_label_behaviors.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if label.top != 7 or label.left != 10:
print "Moved a wrong amount", label.left, label.top
return
# Make sure the text has been dragged appropriately
self.test_file = "test_vtk_ui_label_behaviors.png"
def try_action(self, point):
self.click_acti... | code_fim | hard | {
"lang": "python",
"repo": "CDAT/vcs",
"path": "/tests/vtk_ui/test_vtk_ui_label_behaviors.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CDAT/vcs path: /tests/vtk_ui/test_vtk_ui_label_behaviors.py
"""
Test label behavior callbacks
"""
import vcs.vtk_ui
import vtk
from vtk_ui_test import vtk_ui_test
class test_vtk_ui_label_behaviors(vtk_ui_test):
def setUp(self):
super(test_vtk_ui_label_behaviors, self).setUp()
... | code_fim | medium | {
"lang": "python",
"repo": "CDAT/vcs",
"path": "/tests/vtk_ui/test_vtk_ui_label_behaviors.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0xflotus/Metabigor path: /modules/sploitus.py
import json
from core import sender
from core import utils
class Sploitus():
"""docstring for Sploitus"""
def __init__(self, options):
self.options = options
self.base_url = 'https://sploitus.com/search'
self.query =... | code_fim | hard | {
"lang": "python",
"repo": "0xflotus/Metabigor",
"path": "/modules/sploitus.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> exploits = response.get('exploits')
utils.print_debug(self.options, len(exploits))
if len(exploits) == 0:
utils.print_info(
"No exploit found for {0}".format(self.query))
return False
# store raw json
raw_file_path = self.opt... | code_fim | hard | {
"lang": "python",
"repo": "0xflotus/Metabigor",
"path": "/modules/sploitus.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # keep doing if there have many pages
def pages(self, page_num):
more_output = []
for i in range(1, int(page_num) + 1):
utils.print_debug(self.options, "Sleep for couple seconds")
utils.random_sleep(1, 3)
utils.print_info("Get more result from pa... | code_fim | hard | {
"lang": "python",
"repo": "0xflotus/Metabigor",
"path": "/modules/sploitus.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dingjie-Wang/Manual-for-running-IDP-pipeline path: /Au-public-master/iron/utilities/bestannotation_into_rarefraction.py
#!/usr/bin/python
import argparse, sys, re, multiprocessing, json, zlib
from random import shuffle
def main():
parser = argparse.ArgumentParser(description='Convert a bestout... | code_fim | hard | {
"lang": "python",
"repo": "Dingjie-Wang/Manual-for-running-IDP-pipeline",
"path": "/Au-public-master/iron/utilities/bestannotation_into_rarefraction.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> read_names = reads.keys()
shuffle(read_names)
seen = {}
if size > len(reads): size = len(reads)
# get the annotations and how many times we've observed it
for read in read_names[0:size]:
if not reads[read]: continue # These are false entries
if reads[read]['annotation'] not in seen:
... | code_fim | hard | {
"lang": "python",
"repo": "Dingjie-Wang/Manual-for-running-IDP-pipeline",
"path": "/Au-public-master/iron/utilities/bestannotation_into_rarefraction.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ricardojover/hello-rest-api-aws path: /src/hello/views.py
from flask import Flask, jsonify, request, make_response, abort, Blueprint
from http import HTTPStatus
from datetime import datetime
from hello.models import User, UserSchema, db_session
from hello.config import LocalConst
from hello impor... | code_fim | hard | {
"lang": "python",
"repo": "ricardojover/hello-rest-api-aws",
"path": "/src/hello/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> user_schema = UserSchema()
db_user.dateOfBirth = datetime.strptime(date_of_birth, "%Y-%m-%d").date() #date_of_birth
db_session.merge(db_user)
db_session.commit()
data = user_schema.dump(db_user).data
return make_response(jsonify(data), HTTPStatus.N... | code_fim | hard | {
"lang": "python",
"repo": "ricardojover/hello-rest-api-aws",
"path": "/src/hello/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if db_user is not None:
days_to_bday = utils.get_days_to_bday(db_user.dateOfBirth)
if days_to_bday == 0:
message = "Hello, {0} Happy birthday!".format(username)
else:
message = "Hello, {0}! Your birthday is in {1} days(s)".format(username, days_to_bday)
... | code_fim | hard | {
"lang": "python",
"repo": "ricardojover/hello-rest-api-aws",
"path": "/src/hello/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AirbusAerial/raster-vision path: /rastervision/task/semantic_segmentation.py
import numpy as np
from typing import List
from .task import Task
from rastervision.core.box import Box
from rastervision.data.scene import Scene
def get_random_sample_train_windows(label_store, chip_size, class_map,... | code_fim | hard | {
"lang": "python",
"repo": "AirbusAerial/raster-vision",
"path": "/rastervision/task/semantic_segmentation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
scene: The scene over-which windows are to be generated.
Returns:
A list of windows, list(Box)
"""
def filter_windows(windows):
if scene.aoi_polygons:
windows = Box.filter_by_aoi(windows, scene.aoi_polygons)
... | code_fim | hard | {
"lang": "python",
"repo": "AirbusAerial/raster-vision",
"path": "/rastervision/task/semantic_segmentation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rocky4546/tvheadend-locast path: /lib/db/datamgmt/data_mgmt_html.py
"""
MIT License
Copyright (C) 2021 ROCKY4546
https://github.com/rocky4546
This file is part of Cabernet
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation... | code_fim | hard | {
"lang": "python",
"repo": "rocky4546/tvheadend-locast",
"path": "/lib/db/datamgmt/data_mgmt_html.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class DataMgmtHTML:
def __init__(self, _config_obj, _plugin_list):
self.config_obj = _config_obj
self.config = _config_obj.data
self.plugin_names = _plugin_list
self.logger = logging.getLogger(__name__)
def get(self):
return ''.join([self.header, self.bod... | code_fim | hard | {
"lang": "python",
"repo": "rocky4546/tvheadend-locast",
"path": "/lib/db/datamgmt/data_mgmt_html.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not s3FileName.startswith("/") :
s3FileName = "/"+s3FileName
setConfig(fileNameKey, s3FileName) # now speak in terms of S3 for node config
selectConfig(entryConfigNum) # restore entry state
debug( "S3 tests complete" )
def downloadFromS3( filename ) :
s3BucketID = S3CompatibleString(ge... | code_fim | hard | {
"lang": "python",
"repo": "baimingze/project1",
"path": "/mrtandam-ica-code/ensemble/src/eca_launch_helper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baimingze/project1 path: /mrtandam-ica-code/ensemble/src/eca_launch_helper.py
a new blank config onto the stack
for n in range(nConfigs) :
selectConfig(n)
load_commented_json(jsonstrings[n],False)
return nConfigs
else :
log("processing parameter file %s"%filename)
f = ... | code_fim | hard | {
"lang": "python",
"repo": "baimingze/project1",
"path": "/mrtandam-ica-code/ensemble/src/eca_launch_helper.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> info( "job started" )
# use job config filename as basename if none given
setCoreConfig("baseName",S3CompatibleString(getConfig("baseName",os.path.basename(sys.argv[2]))))
# possibly we already have a timestamp, if we're being called for X!!Tandem purposes
setCoreConfig("jobTimeStamp", getConfig("jo... | code_fim | hard | {
"lang": "python",
"repo": "baimingze/project1",
"path": "/mrtandam-ica-code/ensemble/src/eca_launch_helper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fhm097/sensor path: /sitch/tests/christmas_tree/device_samples.py
class DeviceSamples(object):
gps_device_loc_a = {"scan_program": "gpsd",
"type": "Feature",
"sat_time": "2017-03-25T00:30:48.000Z",
"time_drift": 2,
... | code_fim | hard | {
"lang": "python",
"repo": "fhm097/sensor",
"path": "/sitch/tests/christmas_tree/device_samples.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> kal_scan_1 = {'platform': 'PLATFORM-NAME',
'scan_finish': '2016-05-07 04:14:30',
'scan_location': 'SCAN_LOCATION',
"site_name": "SITE_NAME",
'scanner_public_ip': '0.0.0.0',
'scan_results': [
{... | code_fim | hard | {
"lang": "python",
"repo": "fhm097/sensor",
"path": "/sitch/tests/christmas_tree/device_samples.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomgjones/b58-py path: /bin/b58
#!/usr/bin/python3
import getopt
import sys
alph = {}
alph['bitcoin'] = b"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
alph['flickr'] = b"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
try:
opts, args = getopt.getopt(sys.argv[1:]... | code_fim | hard | {
"lang": "python",
"repo": "tomgjones/b58-py",
"path": "/bin/b58",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># We aren't able to fully implement b58(1) with the current python interface
# to argv. We can't take raw bytes from the argument list.
# See http://bugs.python.org/issue8776
if len(args) > 0 and bytes:
sys.stderr.write("python 3 implementation can't handle bytes given as "
+ "ar... | code_fim | hard | {
"lang": "python",
"repo": "tomgjones/b58-py",
"path": "/bin/b58",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if scheme == "bitcoin":
while True:
c = stdinbytes.read(1)
if len(c) == 0:
break
if ord(c) == 0:
leadingz_enc += b"1"
else:
break
allin = c + stdinbytes.read()
lastchar = allin[-1:len(allin... | code_fim | hard | {
"lang": "python",
"repo": "tomgjones/b58-py",
"path": "/bin/b58",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: claraj/web-autograder path: /api/serializers.py
from rest_framework import serializers
from rest_framework.serializers import PrimaryKeyRelatedField
from .models import Assignment, Student, ProgrammingClass, GradingBatch, Grade
class AssignmentSerializer(serializers.ModelSerializer):
program... | code_fim | medium | {
"lang": "python",
"repo": "claraj/web-autograder",
"path": "/api/serializers.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> programming_classes = PrimaryKeyRelatedField(many=True, required=False, queryset=ProgrammingClass.objects.all())
class Meta:
model = Student
fields = '__all__'
class GradingBatchSerializer(serializers.ModelSerializer):
class Meta:
model = GradingBatch
fields =... | code_fim | hard | {
"lang": "python",
"repo": "claraj/web-autograder",
"path": "/api/serializers.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = ProgrammingClass
fields = '__all__'
class GradeSerializer(serializers.ModelSerializer):
assignment = AssignmentSerializer()
student = StudentSerializer()
class Meta:
model = Grade
fields = '__all__'<|fim_prefix|># repo: claraj/web-auto... | code_fim | hard | {
"lang": "python",
"repo": "claraj/web-autograder",
"path": "/api/serializers.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ComFreek/suitesparse-conan-pkg path: /conanfile.py
from conans import ConanFile, CMake, tools, MSBuild
class SuitesparseConan(ConanFile):
name = "SuiteSparse"
version = "5.1.2"
license = "GNU GPL"
url = "https://github.com/ComFreek/suitesparse-conan-pkg"
description = "Suite ... | code_fim | hard | {
"lang": "python",
"repo": "ComFreek/suitesparse-conan-pkg",
"path": "/conanfile.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> def package(self):
# Somehow self.copy("lib/*.lib", dst="lib", keep_path=False) does not copy any file
# at all
self.copy("**/*.lib", dst="lib", keep_path=False)
self.copy("suitesparse/SuiteSparse/AMD/Include/*.h",
dst="include/amd", keep_path=False)
s... | code_fim | hard | {
"lang": "python",
"repo": "ComFreek/suitesparse-conan-pkg",
"path": "/conanfile.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> for name in dir(defaults):
if name.isupper() and not hasattr(settings, name):
setattr(settings, name, getattr(defaults, name))<|fim_prefix|># repo: moshthepitt/tiny-erp path: /tiny_erp/anza.py
"""module to handle things that are done to setup tiny_erp."""
def setup_settings():
<... | code_fim | medium | {
"lang": "python",
"repo": "moshthepitt/tiny-erp",
"path": "/tiny_erp/anza.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: moshthepitt/tiny-erp path: /tiny_erp/anza.py
"""module to handle things that are done to setup tiny_erp."""
<|fim_suffix|> for name in dir(defaults):
if name.isupper() and not hasattr(settings, name):
setattr(settings, name, getattr(defaults, name))<|fim_middle|>def setup... | code_fim | medium | {
"lang": "python",
"repo": "moshthepitt/tiny-erp",
"path": "/tiny_erp/anza.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print('Details of the training process were stored in ',os.path.join(result_path, 'models.json'))
best_model_index = np.argmax(val_accuracies)
best_model, best_params, best_model_types = models[best_model_index]
print('Model type and parameters of the best model:')
print(best_model_types)
print(best_... | code_fim | hard | {
"lang": "python",
"repo": "NLeSC/mcfly-tutorial",
"path": "/scripts/Actitracker_train.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NLeSC/mcfly-tutorial path: /scripts/Actitracker_train.py
# coding: utf-8
# In[1]:
import sys
import os
import numpy as np
import pandas as pd
import json
# mcfly
from mcfly import modelgen, find_architecture, storage
# In[2]:
data_path = '/media/sf_VBox_Shared/timeseries/actitiracker/WISDM_... | code_fim | hard | {
"lang": "python",
"repo": "NLeSC/mcfly-tutorial",
"path": "/scripts/Actitracker_train.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rararrr/tinkoff_invest path: /tinkoff_invest/models/portfolio.py
import logging
from typing import List, Optional
from prettytable import PrettyTable
from tinkoff_invest.models.money import MoneyAmount, build_money_amount
from tinkoff_invest.models.types import InstrumentType, Currency
class ... | code_fim | hard | {
"lang": "python",
"repo": "rararrr/tinkoff_invest",
"path": "/tinkoff_invest/models/portfolio.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, raw_data: dict):
self._data = raw_data
@property
def name(self) -> str:
return self._data["name"]
@property
def figi(self) -> str:
return self._data["figi"]
@property
def ticker(self) -> str:
return self._data["ticker"]
... | code_fim | hard | {
"lang": "python",
"repo": "rararrr/tinkoff_invest",
"path": "/tinkoff_invest/models/portfolio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._data["lots"]
@property
def blocked(self) -> float:
return float(self._data["blocked"])
@property
def expected_yield(self) -> MoneyAmount:
return MoneyAmount(self._data["expectedYield"] if "expectedYield" in self._data else None)
@property
def... | code_fim | hard | {
"lang": "python",
"repo": "rararrr/tinkoff_invest",
"path": "/tinkoff_invest/models/portfolio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jfoote/vulture path: /vlib/analyzers/tools.py
import os, logging
log = logging.getLogger()
def call_for_each_bug(bug_cache_dir, analyzer_func, limit=None, buglist=[]):
return call_for_each_item(bug_cache_dir, analyzer_func, limit, "vulture.json", buglist)
def call_for_each_analysis(bug_cach... | code_fim | hard | {
"lang": "python",
"repo": "jfoote/vulture",
"path": "/vlib/analyzers/tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># being lazy
status_by_category = {
'fresh': [
"New",
"Opinion",
"Confirmed", ],
'wip' : [
"Triaged",
"Incomplete (with response)",
"Incomplete (without response)",
"Incomplete",
"In Progr... | code_fim | hard | {
"lang": "python",
"repo": "jfoote/vulture",
"path": "/vlib/analyzers/tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assert200(response)
self.assertEqual(2, mock_path.join.call_count)
mock_path.getsize.assert_called_once_with(mock_path.join())<|fim_prefix|># repo: dukkee/sample-platform path: /tests/TestUtility.py
from unittest import mock
from tests.base import BaseTestCase
<|fim_middle... | code_fim | hard | {
"lang": "python",
"repo": "dukkee/sample-platform",
"path": "/tests/TestUtility.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> @mock.patch('utility.path')
def test_serve_file_download(self, mock_path):
"""
Test function serve_file_download.
"""
from utility import serve_file_download
response = serve_file_download('to_download', 'folder', 'accl_folder')
self.assert200(resp... | code_fim | medium | {
"lang": "python",
"repo": "dukkee/sample-platform",
"path": "/tests/TestUtility.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dukkee/sample-platform path: /tests/TestUtility.py
from unittest import mock
from tests.base import BaseTestCase
class TestUtility(BaseTestCase):
@mock.patch('utility.path')
def test_serve_file_download(self, mock_path):
<|fim_suffix|> response = serve_file_download('to_downloa... | code_fim | medium | {
"lang": "python",
"repo": "dukkee/sample-platform",
"path": "/tests/TestUtility.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kai-Bailey/WebSock path: /scripts/autobahn-test.py
import threading
from websock.WebSocketServer import WebSoc<|fim_suffix|>r_thread = threading.Thread(target=server.serve_forever(), args=(), daemon=True)
server_thread.start()
print('Started')<|fim_middle|>ketServer
server = WebSocketServer("12... | code_fim | medium | {
"lang": "python",
"repo": "Kai-Bailey/WebSock",
"path": "/scripts/autobahn-test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rgs=(), daemon=True)
server_thread.start()
print('Started')<|fim_prefix|># repo: Kai-Bailey/WebSock path: /scripts/autobahn-test.py
import threading
from websock.WebSocketServer import WebSoc<|fim_middle|>ketServer
server = WebSocketServer("127.0.0.1", 9010)
server_thread = threading.Thread(target=serv... | code_fim | medium | {
"lang": "python",
"repo": "Kai-Bailey/WebSock",
"path": "/scripts/autobahn-test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ahnaf-zamil/async-covid path: /tests/test_john_hopkings.py
# -*- coding: utf-8 -*-
""" tests module
"""
import pytest
from async_covid import Covid
from unittest.mock import patch
class MockRequestData:
@staticmethod
async def json():
return {"key": "value"}
async def test_all... | code_fim | hard | {
"lang": "python",
"repo": "ahnaf-zamil/async-covid",
"path": "/tests/test_john_hopkings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@patch("covid.john_hopkins.covid.requests.get", return_value=MockRequestData())
async def test_exception_rasied_on_get_total_recovered(mock):
covid = Covid()
with pytest.raises(Exception):
await covid.get_total_recovered()
@patch("covid.john_hopkins.covid.requests.get", return_value=Mock... | code_fim | hard | {
"lang": "python",
"repo": "ahnaf-zamil/async-covid",
"path": "/tests/test_john_hopkings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndreyTishenko/webium path: /tests/test_base_page.py
from unittest import TestCase
from nose.tools import assert_raises
from webium.base_page import BasePage
from webium.errors import WebiumException
class PageWithoutUrl(BasePage):
pass
<|fim_suffix|> def test_no_url_validation(self):
... | code_fim | easy | {
"lang": "python",
"repo": "AndreyTishenko/webium",
"path": "/tests/test_base_page.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_no_url_validation(self):
page = PageWithoutUrl()
assert_raises(WebiumException, page.open)<|fim_prefix|># repo: AndreyTishenko/webium path: /tests/test_base_page.py
from unittest import TestCase
from nose.tools import assert_raises
from webium.base_page import BasePage
from w... | code_fim | medium | {
"lang": "python",
"repo": "AndreyTishenko/webium",
"path": "/tests/test_base_page.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dineiar/PyBibTextTools path: /pybtex/docs/pybtex_doctools/man.py
# Copyright (c) 2006-2017 Andrey Golovigin
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without r... | code_fim | hard | {
"lang": "python",
"repo": "dineiar/PyBibTextTools",
"path": "/pybtex/docs/pybtex_doctools/man.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
man_head = r"""
.\"Man page for Pybtex (%(cmd)s)
.\"
.\" Generation time: %(timestamp)s
.\" Large parts of this file are autogenerated from the output of
.\" "%(cmd)s --help"
.\"
.TH %(cmd)s 1 "%(datestamp)s" "%(version)s" "Pybtex"
.SH "NAME"
%(cmd)s - %(description)s
""".strip()
def format_head(ma... | code_fim | hard | {
"lang": "python",
"repo": "dineiar/PyBibTextTools",
"path": "/pybtex/docs/pybtex_doctools/man.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mcfletch/webtoys path: /toys/toys/sightwords.py
WORD_LISTS = [
{"name": "wl-0", "words": ["the", "of", "and", "a", "to", "in", "is", "you", "that", "it", "he", "was", "for", "on", "are", "as", "with", "his", "they", "I", "at", "be", "this", "have", "from", "or", "one", "had", "by", "word", "b... | code_fim | hard | {
"lang": "python",
"repo": "mcfletch/webtoys",
"path": "/toys/toys/sightwords.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>been", "before", "best", "both", "buy", "call", "col d", "does", "don't", "fast", "first", "five", "found", "gave", "goes", "green", "its", "made", "many", "off", "or", "pull", "read", "right", "sing", "sit", "sleep", "tell", "their", "these", "those", "upon", "us", "use", "very", "wash", "which", ... | code_fim | hard | {
"lang": "python",
"repo": "mcfletch/webtoys",
"path": "/toys/toys/sightwords.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def as_code(self, indent, name):
s_indent = ' '*indent
return '%s%s %s.'%(s_indent, self.wandle_class.name, name)
class WandleSingle:
# This is effectively a container for a WandleObject. The thing that
# is odd about a single is that it has a one-off class.
def __init__... | code_fim | hard | {
"lang": "python",
"repo": "cratuki/wandle",
"path": "/wandle/wandle_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> lst_param = []
for param in self.lst_param:
wandle_class = param.wandle_class
name = param.name
if wandle_class.get_type() in d_tt:
cstring = d_tt[wandle_class.get_type()]
wandle_class = self.compile_container.get_class(
... | code_fim | hard | {
"lang": "python",
"repo": "cratuki/wandle",
"path": "/wandle/wandle_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cratuki/wandle path: /wandle/wandle_model.py
sorted(self.d_alias.items()):
sb.append('alias %s to %s.'%(dst, name))
if self.d_alias: sb.append('')
for (name, wandle_single) in sorted(self.d_single.items()):
sb.append(wandle_single.as_code())
sb.... | code_fim | hard | {
"lang": "python",
"repo": "cratuki/wandle",
"path": "/wandle/wandle_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>setuptools.setup(
name=flux.__title__,
version=flux.__version__,
author=flux.__author__,
description=flux.__description__,
license=flux.__license__,
url=flux.__url__,
packages=flux.__packages__,
package_dir={
'': 'source'
},
)<|fim_prefix|># repo: fr0stbite/flux path: /setup.py
impo... | code_fim | medium | {
"lang": "python",
"repo": "fr0stbite/flux",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fr0stbite/flux path: /setup.py
import importlib
import os
import sys
import setuptools
<|fim_suffix|>setuptools.setup(
name=flux.__title__,
version=flux.__version__,
author=flux.__author__,
description=flux.__description__,
license=flux.__license__,
url=flux.__url__,
packages=flux... | code_fim | medium | {
"lang": "python",
"repo": "fr0stbite/flux",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Hashes a plaintext. One can specify the salt (this is needed in check_hash())
#
def hash_password(password, salt=None):
# uuid is used to generate a random number for the salt
if salt == None:
salt = uuid.uuid4().hex
return hashlib.sha256(salt.encode() + password.encode()).hexdigest() + ':' + salt... | code_fim | hard | {
"lang": "python",
"repo": "mathybit/dash-login",
"path": "/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.