text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> return r1.headers == r2.headers
def requests_match(r1, r2, matchers):
return all(m(r1, r2) for m in matchers)<|fim_prefix|># repo: marusich/vcrpy path: /vcr/matchers.py
def method(r1, r2):
return r1.method == r2.method
def url(r1, r2):
return r1.url == r2.url
def host(r1, r2):
r... | code_fim | easy | {
"lang": "python",
"repo": "marusich/vcrpy",
"path": "/vcr/matchers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marusich/vcrpy path: /vcr/matchers.py
def method(r1, r2):
return r1.method == r2.method
<|fim_suffix|>
def path(r1, r2):
return r1.path == r2.path
def body(r1, r2):
return r1.body == r2.body
def headers(r1, r2):
return r1.headers == r2.headers
def requests_match(r1, r2, mat... | code_fim | medium | {
"lang": "python",
"repo": "marusich/vcrpy",
"path": "/vcr/matchers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marusich/vcrpy path: /vcr/matchers.py
def method(r1, r2):
return r1.method == r2.method
def url(r1, r2):
return r1.url == r2.url
def host(r1, r2):
return r1.host == r2.host
<|fim_suffix|> return all(m(r1, r2) for m in matchers)<|fim_middle|>def path(r1, r2):
return r1.pat... | code_fim | medium | {
"lang": "python",
"repo": "marusich/vcrpy",
"path": "/vcr/matchers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.customer_potential:
to_remove=[]
for row in self.customer_potential:
if not row.target and not row.potential:
to_remove.append(row)
[self.customer_potential.remove(d) for d in to_remove]
return self
@frappe.whitelist()
def creat... | code_fim | medium | {
"lang": "python",
"repo": "questerp/engr",
"path": "/engr/engineering/doc_events/customer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: questerp/engr path: /engr/engineering/doc_events/customer.py
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Finbyz Tech. Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.mapper... | code_fim | hard | {
"lang": "python",
"repo": "questerp/engr",
"path": "/engr/engineering/doc_events/customer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fields = {
"Customer": {
"doctype": "Task",
"field_map": {
'name':'customer'
}}}
doc = get_mapped_doc(
"Customer",
source_name,
fields,
target_doc,
ignore_permissions=ignore_permissions
)
re... | code_fim | medium | {
"lang": "python",
"repo": "questerp/engr",
"path": "/engr/engineering/doc_events/customer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #parses functions in command. Assumes functions to be already parsed
command = self.command
strings = self.strings
for string in strings:
command.replace(string, "|")
self.function = [command.split(" ")[0]] # first word is always a function.
return self.function
def parse(self):
self... | code_fim | hard | {
"lang": "python",
"repo": "baby1998/iBot-Framework",
"path": "/ibot/Cli/Lexer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baby1998/iBot-Framework path: /ibot/Cli/Lexer.py
class Lexer:
def __init__(self, command):
self.command = command
def parseStrings(self):
# parses strings in command
self.strings = [] # Todo: Replace with linked list
i = 0
start = -1
quote = ["'", '"']
# linear search. O(n)
... | code_fim | hard | {
"lang": "python",
"repo": "baby1998/iBot-Framework",
"path": "/ibot/Cli/Lexer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for batch in range(0, BATCH_NUMBER):
batch_upload >> ProcessManifestOperatorR3(
task_id=f"process_manifest_task_{batch + 1}",
previous_task_id=f"provide_manifest_integrity_task_{batch + 1}",
batch_number=batch + 1,
trigger_rule="none_failed_or_sk... | code_fim | hard | {
"lang": "python",
"repo": "pkowalchuk/self-managed-osdu",
"path": "/src/airflowdags/dags/osdu-ingest-r3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkowalchuk/self-managed-osdu path: /src/airflowdags/dags/osdu-ingest-r3.py
# Copyright 2020 Google LLC
# Copyright 2020 EPAM Systems
#
# 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 ... | code_fim | hard | {
"lang": "python",
"repo": "pkowalchuk/self-managed-osdu",
"path": "/src/airflowdags/dags/osdu-ingest-r3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> update_status_finished_op = UpdateStatusOperator(
task_id="update_status_finished_task",
dag=dag,
trigger_rule="all_done",
)
validate_schema_operator = ValidateManifestSchemaOperator(
task_id="validate_manifest_schema_task",
trigger_rule="none_failed_or... | code_fim | hard | {
"lang": "python",
"repo": "pkowalchuk/self-managed-osdu",
"path": "/src/airflowdags/dags/osdu-ingest-r3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seanwallawalla-forks/Pincer path: /pincer/middleware/voice_state_update.py
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""
sent when a user's voice state changes in a subscribed voice channel
(mute, volume, etc.)
"""
from __future__ import an... | code_fim | hard | {
"lang": "python",
"repo": "seanwallawalla-forks/Pincer",
"path": "/pincer/middleware/voice_state_update.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def voice_state_update_middleware(
self,
payload: GatewayDispatch
) -> Tuple[str, List[VoiceState]]:
"""|coro|
Middleware for ``on_voice_state_update`` event.
Parameters
----------
payload : :class:`GatewayDispatch`
The data received from the voice state update e... | code_fim | medium | {
"lang": "python",
"repo": "seanwallawalla-forks/Pincer",
"path": "/pincer/middleware/voice_state_update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ObjectRecognitionClient(ROSServiceClient):
def make_request(self, request=None):
"""
Makes request to server.
:return: Bool indicating offering object status
"""
server_response = super(ObjectRecognitionClient, self).make_request(request)
if ser... | code_fim | medium | {
"lang": "python",
"repo": "Hankfirst/de_niro",
"path": "/object_recognition/src/object_recognition_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hankfirst/de_niro path: /object_recognition/src/object_recognition_client.py
#!/usr/bin/env python
"""
Client code to interact with the server on the Object Recognition service.
This service is responsible for receiving the coordinates of the object.
Request:
Response: geometry_msgs/Point
Autho... | code_fim | hard | {
"lang": "python",
"repo": "Hankfirst/de_niro",
"path": "/object_recognition/src/object_recognition_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return: Bool indicating offering object status
"""
server_response = super(ObjectRecognitionClient, self).make_request(request)
if server_response is None:
rospy.loginfo("%s server response was none", self.service_name)
return None
return s... | code_fim | hard | {
"lang": "python",
"repo": "Hankfirst/de_niro",
"path": "/object_recognition/src/object_recognition_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
head = Node(1)
n2 = Node(2)
n3 = Node(3)
n4 = Node(4)
# n5 = Node(5)
# n6 = Node(6)
# n7 = Node(7)
head.right = n2
head.left = n3
n2.left = n4
# n3.right = n5
# n4.left = n6
# n4.right = n7
s = Solution(head)
print(s.... | code_fim | hard | {
"lang": "python",
"repo": "lwzzzzzzzz/Solution",
"path": "/BinaryTree/二叉树是否为满二叉树.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lwzzzzzzzz/Solution path: /BinaryTree/二叉树是否为满二叉树.py
# _*_ coding: utf-8 _*_
"""
@Date: 2022/4/18 0:21
@Author: wz
@File: 二叉树是否为满二叉树.py
@Decs:
"""
from BinaryTree import Node
class Solution:
"""
两种思路:1.层序遍历,数每一层是否都是 2^(层数-1) 个节点
2.前中后序遍历,看树总节点个数是否是 2^(层数)-1 个... | code_fim | hard | {
"lang": "python",
"repo": "lwzzzzzzzz/Solution",
"path": "/BinaryTree/二叉树是否为满二叉树.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for word in counts:
print("{}: {}".format(word, counts[word]))<|fim_prefix|># repo: shilpasayura/algohack path: /code-1mwtt/ex19_dictionary.py
#dictionaries
text = input("Please enter some text: ")
words = text.lower().split(" ")
counts = {}
<|fim_middle|>for word in words:
if word in counts:
... | code_fim | medium | {
"lang": "python",
"repo": "shilpasayura/algohack",
"path": "/code-1mwtt/ex19_dictionary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shilpasayura/algohack path: /code-1mwtt/ex19_dictionary.py
#dictionaries
text = input("Please enter some text: ")
words = text.lower().split(" ")
counts = {}
<|fim_suffix|>for word in counts:
print("{}: {}".format(word, counts[word]))<|fim_middle|>for word in words:
if word in counts:
... | code_fim | medium | {
"lang": "python",
"repo": "shilpasayura/algohack",
"path": "/code-1mwtt/ex19_dictionary.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: conversationai/conversationai-models path: /kaggle-classification/keras_trainer/base_model.py
"""Base model class used by the ModelRunner"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from abc import ABCMeta, abstractmethod
from ... | code_fim | medium | {
"lang": "python",
"repo": "conversationai/conversationai-models",
"path": "/kaggle-classification/keras_trainer/base_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class BaseModel(metaclass=ABCMeta):
"""Base class for model runner"""
@abstractmethod
def get_model(self) -> Model:
raise NotImplementedError('Method get_model needs to be implemented.')<|fim_prefix|># repo: conversationai/conversationai-models path: /kaggle-classification/keras_trainer/base_... | code_fim | medium | {
"lang": "python",
"repo": "conversationai/conversationai-models",
"path": "/kaggle-classification/keras_trainer/base_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akodd/gse-loan path: /sql/vertica/export/convert_to_numpy.py
#!/usr/bin/python
import pandas as pd
import numpy as np
import glob
import gc
import cudf
import time
def convertAcq(acq_fname, includeLoanID = False):
acq = pd.read_parquet(acq_fname)
acq = acq.sort_values('loan_id').reset_i... | code_fim | hard | {
"lang": "python",
"repo": "akodd/gse-loan",
"path": "/sql/vertica/export/convert_to_numpy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i, fname in enumerate(seq_files):
start = time.clock()
print('processing seq_numpy[{}]: {}'.format(i, fname))
seq = pd.read_parquet(fname)
seq_cudf = cudf.DataFrame.from_pandas(seq)
seq_cudf = seq_cudf[seq_cudf.default_dist <= 11]
seq_cudf = seq_cudf... | code_fim | hard | {
"lang": "python",
"repo": "akodd/gse-loan",
"path": "/sql/vertica/export/convert_to_numpy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: philxhuang/2048pseudoAI path: /ai.py
seNum):
#only for mergeing
for row in range(rows):
for col in range(cols-1, 0, -1): #avoid "out of index" error, so 3,2,1
shiftRight(board, row)
curNum = board[row][col]
nextNum = board[row][col-1]
... | code_fim | hard | {
"lang": "python",
"repo": "philxhuang/2048pseudoAI",
"path": "/ai.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> bias1 = 0
bias2 = 0
bias3 = 0
bias4 = 0
bias5 = 0
# be careful with the signs here
return wLocation*(xL + bias1) + wEmptySquare*(xES + bias2) + \
wMono*(xMono + bias3) + wSmooth*(xSmooth + bias4) + wGrad*(xGrad + bias5)
#############... | code_fim | hard | {
"lang": "python",
"repo": "philxhuang/2048pseudoAI",
"path": "/ai.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> score = 0
rows = len(board)
cols = len(board[0])
# recrate gradiantMatrix based on the current row and cols of the board, so the diagonal is not always all 0!
gradientMatrix = getMatrix(rows, cols)
# now compute the score
for row in range(rows):
for col in range(cols):
... | code_fim | hard | {
"lang": "python",
"repo": "philxhuang/2048pseudoAI",
"path": "/ai.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PersonalKilljoy/bravester path: /bot.py
#!/usr/bin/env python3
# -+- coding: utf-8 -*-
import irc3
from harvester.settings import BotSettings
# from harvester.utils import urlReg, harvest
<|fim_suffix|>"""
urls = [
'http://gyazo.com/fc12a9bb2a4b92d1debef49b8279371f',
'http://i.gyazo.co... | code_fim | hard | {
"lang": "python",
"repo": "PersonalKilljoy/bravester",
"path": "/bot.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
urls = [
'http://gyazo.com/fc12a9bb2a4b92d1debef49b8279371f',
'http://i.gyazo.com/fc12a9bb2a4b92d1debef49b8279371f.png',
'https://cache.gyazo.com/fc12a9bb2a4b92d1debef49b8279371f.png',
'http://i.imgur.com/aChgMdG.gif',
'http://hastebin.com/zebihupixo.hs',
'http://hastebin.com/r... | code_fim | hard | {
"lang": "python",
"repo": "PersonalKilljoy/bravester",
"path": "/bot.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>auth = HTTPBasicAuth()
@auth.verify_password
def verify_pw(username, password):
""" return password or None if there isn't one"""
credentials = HtpasswdFile(app.config["CREDENTIAL_FILE"])
if not credentials.check_password(username, password):
logging.warning("%s tried to login with w... | code_fim | medium | {
"lang": "python",
"repo": "hanshoi/kapsi-git-manager",
"path": "/kapsi_git_manager/authentication.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hanshoi/kapsi-git-manager path: /kapsi_git_manager/authentication.py
import logging
from passlib.apache import HtpasswdFile
<|fim_suffix|>@auth.verify_password
def verify_pw(username, password):
""" return password or None if there isn't one"""
credentials = HtpasswdFile(app.config["CRED... | code_fim | medium | {
"lang": "python",
"repo": "hanshoi/kapsi-git-manager",
"path": "/kapsi_git_manager/authentication.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@auth.verify_password
def verify_pw(username, password):
""" return password or None if there isn't one"""
credentials = HtpasswdFile(app.config["CREDENTIAL_FILE"])
if not credentials.check_password(username, password):
logging.warning("%s tried to login with wrong password", username)... | code_fim | medium | {
"lang": "python",
"repo": "hanshoi/kapsi-git-manager",
"path": "/kapsi_git_manager/authentication.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pgroth/ops.py path: /ops/api.py
import json
import urllib2
import urllib
from compound import *
from target import *
class API:
def __init__(self, app_id, app_key):
self.app_id = app_id
self.app_key = app_key
self.base_url = "https://beta.openphacts.org/1.4/"
def getCompoundI... | code_fim | hard | {
"lang": "python",
"repo": "pgroth/ops.py",
"path": "/ops/api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getTargetPharmacologyIter(self, url_str):
results = json.load(urllib2.urlopen(url_str))
items = results['result']['items']
for item in items:
yield item
if "next" in results['result']:
url_str_next = results['result']['next']
for x in self.getTargetPha... | code_fim | hard | {
"lang": "python",
"repo": "pgroth/ops.py",
"path": "/ops/api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> content_type = "Content-Type: image/" + response_format
HTTP_RESPONSE = b'\r\n'.join([
b"HTTP/1.1 200 OK",
b"Connection: close",
content_type.encode(),
bytes("Content-Length: %s" % len(data), 'utf-8'),
b'', data
])
connection.send(HTTP_RESPONSE)
... | code_fim | hard | {
"lang": "python",
"repo": "amqq/IEService",
"path": "/IEService.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
request_params[TOP] = int(parse_qs(request_parsed.query)['t'][0])
except KeyError:
try:
request_params[TOP] = int(parse_qs(request_parsed.query)["top"][0])
except KeyError:
return False
try:
reque... | code_fim | hard | {
"lang": "python",
"repo": "amqq/IEService",
"path": "/IEService.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amqq/IEService path: /IEService.py
fo : This script will be resize and edit images
Requirement : This script can be run on all os
be happy :)
"""
# Project imports
import atexit
import io
import os
import socket
import traceback
import ssl
from PIL import Image
from AmLogger import *
im... | code_fim | hard | {
"lang": "python",
"repo": "amqq/IEService",
"path": "/IEService.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ismail-ougamane/EyeD path: /app.py
#Usage: python app.py
import os
from flask import Flask, render_template, request, redirect, url_for
from werkzeug import secure_filename
from keras.preprocessing.image import ImageDataGenerator, load_img, img_to_array
from keras.models import Sequential, load... | code_fim | hard | {
"lang": "python",
"repo": "ismail-ougamane/EyeD",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/', methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
import time
start_time = time.time()
file = request.files['file']
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
file_p... | code_fim | hard | {
"lang": "python",
"repo": "ismail-ougamane/EyeD",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mause/pyalp path: /pyalp/cl_module/templatetags/display_all_modules.py
from common.generic_template_tag import GenericTemplateTag
from django.template.loader import render_to_string
from pyalp_page.templatetags.spacer import SpacerNode
<|fim_suffix|> # displays all the modules for a side... | code_fim | hard | {
"lang": "python",
"repo": "Mause/pyalp",
"path": "/pyalp/cl_module/templatetags/display_all_modules.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if side == 'right':
get_modules = modules.rightModules
width_modules = container['rightmodule']
elif side == 'left':
get_modules = modules.leftModules
width_modules = container['leftmodule']
elif side == 'main':
get_module... | code_fim | hard | {
"lang": "python",
"repo": "Mause/pyalp",
"path": "/pyalp/cl_module/templatetags/display_all_modules.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [{
'id': _id,
'command': self[_id].command,
} for _id in self.terminals.keys()]
def create(self, **kwargs):
_id = binascii.hexlify(os.urandom(32)).decode('utf-8')
t = Terminal(self, _id, **kwargs)
self.terminals[_id] = t
r... | code_fim | hard | {
"lang": "python",
"repo": "Dhekra-BenSghaier/ajenti-1",
"path": "/plugins/terminal/manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def kill(self, _id):
self.terminals[_id].kill()
self.remove(_id)
def remove(self, _id):
self.terminals.pop(_id)<|fim_prefix|># repo: Dhekra-BenSghaier/ajenti-1 path: /plugins/terminal/manager.py
import binascii
import os
from jadi import service
from .terminal import Te... | code_fim | hard | {
"lang": "python",
"repo": "Dhekra-BenSghaier/ajenti-1",
"path": "/plugins/terminal/manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dhekra-BenSghaier/ajenti-1 path: /plugins/terminal/manager.py
import binascii
import os
from jadi import service
from .terminal import Terminal
@service
class TerminalManager(object):
def __init__(self, context):
self.context = context
self.terminals = {}
def __getite... | code_fim | medium | {
"lang": "python",
"repo": "Dhekra-BenSghaier/ajenti-1",
"path": "/plugins/terminal/manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anhquannguyen21/Image-Processing path: /Source/hist.py
import numpy as np
def imhist(im):
# calculates normalized histogram of an image
m, n = im.shape
h = [0.0] * 256
for i in range(m):
for j in range(n):
h[im[i, j]]+=1
return np.array(h)/(m*n)
<|fim_suffix|> # finds cumu... | code_fim | medium | {
"lang": "python",
"repo": "anhquannguyen21/Image-Processing",
"path": "/Source/hist.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #calculate Histogram
h = imhist(im)
cdf = np.array(cumsum(h)) #cumulative distribution function
sk = np.uint8(255 * cdf) #finding transfer function values
s1, s2 = im.shape
Y = np.zeros_like(im)
# applying transfered values for each pixels
for i in range(0, s1):
for j in range(0, s2):
... | code_fim | medium | {
"lang": "python",
"repo": "anhquannguyen21/Image-Processing",
"path": "/Source/hist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sublime09/CrySmile path: /twitter-emotion-recognition/emotion_predictor.py
import html
import pickle
import re
import pandas as pd
from keras import backend as K
from keras.models import load_model
from keras.preprocessing import sequence
class EmotionPredictor:
def __init__(self, classifi... | code_fim | hard | {
"lang": "python",
"repo": "sublime09/CrySmile",
"path": "/twitter-emotion-recognition/emotion_predictor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _tweet_to_indices(self, tweets):
indices = []
for t in tweets:
t = html.unescape(t) # unescape HTML
t = re.sub(r"http\S+", "", t) # remove normal URLS
t = re.sub(r"pic\.twitter\.com/\S+", "", t) # ... | code_fim | hard | {
"lang": "python",
"repo": "sublime09/CrySmile",
"path": "/twitter-emotion-recognition/emotion_predictor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kjgaulton/epigenomics path: /CUTNRUN/cut_and_run_pipeline.py
#!/usr/bin/env python3
import argparse
import subprocess
import os
import sys
import reprlib
import logging
def detect_file_format(args):
if args.read1.endswith('.gz') and args.read2.endswith('.gz'):
return args.read1, args.read2
... | code_fim | hard | {
"lang": "python",
"repo": "kjgaulton/epigenomics",
"path": "/CUTNRUN/cut_and_run_pipeline.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> align_group = parser.add_argument_group('Alignment arguments')
align_group.add_argument('-t', '--threads', required=False, type=int, default=8, help='Number of threads to use [8]')
align_group.add_argument('-m', '--memory', required=False, type=int, default=4, help='Maximum memory (in Gb) per thread fo... | code_fim | hard | {
"lang": "python",
"repo": "kjgaulton/epigenomics",
"path": "/CUTNRUN/cut_and_run_pipeline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 22malvina/consumption path: /prediction/models.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from product_card.models import ProductCard
from cheque.models import FNSChequeElement
from datetime import datetime
class PredictionLinearFunction(mod... | code_fim | hard | {
"lang": "python",
"repo": "22malvina/consumption",
"path": "/prediction/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def delta_days(self):
delta_days = self.__last_date() - self.__first_date()
return delta_days.days
def __first_date(self):
return sorted(self.__resources, key = lambda x : x.get_date())[0].get_date()
def __init__(self, resources):
"""
проверить что все потребление идет впорядке убывания... | code_fim | hard | {
"lang": "python",
"repo": "22malvina/consumption",
"path": "/prediction/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # results�� columnNo������ �迭�Ѵ�.
# results�� �� element ����
# results[0][0] : colName of first object
# results[0][1] : columnNo of first object
# results[0][2] : colType of first object
# results[0][3] : complexType of first object
def resultColumnSortFunc(item1, item2):
# results�� co... | code_fim | hard | {
"lang": "python",
"repo": "odysseus-oosql/ODYSSEUS-OOSQL",
"path": "/source/OOSQL/Util/PyOOSQL/PyOOSQL.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: odysseus-oosql/ODYSSEUS-OOSQL path: /source/OOSQL/Util/PyOOSQL/PyOOSQL.py
FFER_SIZE = 16384
BINARY_MODE = 1
TEXT_MODE = 0
# IJKIM29DEC2008 Use ODYSSEUS memory manager ...
DEFAULT_BUFFER_SIZE = 4*1024*1024
# ... IJKIM29DEC2008 Use ODYSSEUS memory manager
# JSK15APR2009 NEW_API_FOR_WEB ...
MAXN... | code_fim | hard | {
"lang": "python",
"repo": "odysseus-oosql/ODYSSEUS-OOSQL",
"path": "/source/OOSQL/Util/PyOOSQL/PyOOSQL.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: odysseus-oosql/ODYSSEUS-OOSQL path: /source/OOSQL/Util/PyOOSQL/PyOOSQL.py
= ENDOFEVAL:
pass
else:
# IJKIM19JAN2009 util_convert debug ...
'''
# �о� ���� ����Ÿ�� python string���� conversion�Ѵ�.
header = util_convert_to_string_with_size(headerBuffer, headerBufferSize)
dat... | code_fim | hard | {
"lang": "python",
"repo": "odysseus-oosql/ODYSSEUS-OOSQL",
"path": "/source/OOSQL/Util/PyOOSQL/PyOOSQL.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
try:
val = hx.getWeight()
print("{0: 4.0f}".format(val))
except (KeyboardInterrupt, SystemExit):
GPIO.cleanup()
sys.exit()<|fim_prefix|># repo: pli1/Alfrd path: /scale/example.py
import sys
import time
import RPi.GPIO as GPIO
from hx711 import HX711
... | code_fim | medium | {
"lang": "python",
"repo": "pli1/Alfrd",
"path": "/scale/example.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pli1/Alfrd path: /scale/example.py
import sys
import time
import RPi.GPIO as GPIO
from hx711 import HX711
# choose pins on rpi (BCM5 and BCM6)
hx = HX711(dout=5, pd_sck=6)
# HOW TO CALCULATE THE REFFERENCE UNIT
#########################################
# To set the reference unit to 1.
# Call ... | code_fim | medium | {
"lang": "python",
"repo": "pli1/Alfrd",
"path": "/scale/example.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: computational-neuroimaging-lab/Clark2015_AWS path: /spot-model/spot_price_model.py
entries
return total_cost, instance_cost, storage_cost, xfer_cost, \
total_time, run_time, wait_time, \
xfer_up_time, xfer_down_time
# Calculate cost over interval
def calculate_cost(st... | code_fim | hard | {
"lang": "python",
"repo": "computational-neuroimaging-lab/Clark2015_AWS",
"path": "/spot-model/spot_price_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
start_time : pandas.tslib.Timestamp object
the time to start the simulation from
spot_history : pandas.core.series.Series object
timeseries of spot prices recorded from AWS
interp_history : pandas.core.series.Series object
interpolated spot... | code_fim | hard | {
"lang": "python",
"repo": "computational-neuroimaging-lab/Clark2015_AWS",
"path": "/spot-model/spot_price_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: computational-neuroimaging-lab/Clark2015_AWS path: /spot-model/spot_price_model.py
job submission to
complete
run_time : float
returns the input parameter run_time for convenience
wait_time : float
returns the input parameter wait_time for convenience
xfer_up_t... | code_fim | hard | {
"lang": "python",
"repo": "computational-neuroimaging-lab/Clark2015_AWS",
"path": "/spot-model/spot_price_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main(text, past=None):
p = bow(text, words, DEBUG)
responses = next((item['responses'] for item in intents['intents']
if item['tag'] == classes[int(np.argmax(model.predict([p])))]), False)
i = len(responses)
if DEBUG:
print(p)
print(classes)
... | code_fim | hard | {
"lang": "python",
"repo": "muhfajar/waypy",
"path": "/modules/classifier/worker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muhfajar/waypy path: /modules/classifier/worker.py
import os
import nltk
import numpy as np
import tflearn
import tensorflow as tf
import pickle
import random
import json
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
from waypy.settings.base import BASE_DIR, DEBUG
factory = Stemme... | code_fim | hard | {
"lang": "python",
"repo": "muhfajar/waypy",
"path": "/modules/classifier/worker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> p = bow(text, words, DEBUG)
responses = next((item['responses'] for item in intents['intents']
if item['tag'] == classes[int(np.argmax(model.predict([p])))]), False)
i = len(responses)
if DEBUG:
print(p)
print(classes)
print(model.predict([p]))... | code_fim | hard | {
"lang": "python",
"repo": "muhfajar/waypy",
"path": "/modules/classifier/worker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fetchai/ledger-api-py path: /fetchai/ledger/api/bootstrap.py
# ------------------------------------------------------------------------------
#
# Copyright 2018-2020 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | code_fim | hard | {
"lang": "python",
"repo": "fetchai/ledger-api-py",
"path": "/fetchai/ledger/api/bootstrap.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return protocol, address, int(port)
def server_from_name(network):
"""Queries bootstrap for the requested network and returns connection details"""
# Adding a "local" network to give the looks and feel of main and testnet
if network == "local":
return "http://127.0.0.1", 8000
... | code_fim | hard | {
"lang": "python",
"repo": "fetchai/ledger-api-py",
"path": "/fetchai/ledger/api/bootstrap.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Splits a url into a protocol, host name and port"""
if '://' in address:
protocol, address = address.split('://')
else:
protocol = 'http'
if ':' in address:
address, port = address.split(':')
else:
port = 443 if protocol == 'https' else 8000
ret... | code_fim | hard | {
"lang": "python",
"repo": "fetchai/ledger-api-py",
"path": "/fetchai/ledger/api/bootstrap.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameModel(
old_name='StaffingRequest',
new_name='StaffingRequestInquiry',
),
]<|fim_prefix|># repo: b12io/orchestra path: /orchestra/migrations/0060_auto_20160505_1349.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 201... | code_fim | medium | {
"lang": "python",
"repo": "b12io/orchestra",
"path": "/orchestra/migrations/0060_auto_20160505_1349.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('orchestra', '0059_step_description_function'),
]
operations = [
migrations.RenameModel(
old_name='StaffingRequest',
new_name='StaffingRequestInquiry',
),
]<|fim_prefix|># repo: b12io/orchestra path: /orchestra/migrations/... | code_fim | easy | {
"lang": "python",
"repo": "b12io/orchestra",
"path": "/orchestra/migrations/0060_auto_20160505_1349.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: b12io/orchestra path: /orchestra/migrations/0060_auto_20160505_1349.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-05 13:49
from __future__ import unicode_literals
from django.db import migrations
<|fim_suffix|> dependencies = [
('orchestra', '0059_step_descriptio... | code_fim | easy | {
"lang": "python",
"repo": "b12io/orchestra",
"path": "/orchestra/migrations/0060_auto_20160505_1349.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = l.pop(0)
print(x)
print(l)
print(l[1])
# print(l[99])
# IndexError: list index out of range
new_list = ['a','e','x','b','c']
# reversing a list
new_list.reverse()
print(new_list)
#shorting a list
new_list.sort()
print(new_list)
l_1 = [1,2,3]
l_2 = [4,5,6]
l_3 = [7,8,9]
# list in side of another li... | code_fim | medium | {
"lang": "python",
"repo": "raihan-uddin/Python-practice",
"path": "/PythonObjectandDataStructureBasics/lists.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>print([row[2] for row in matrix])
my_list = [1, 1, [1, 2]]
print(my_list)
print(my_list[2][0])
lst=[0,1,2]
lst.pop()
print(lst)
lst=['a','b','c']
print(lst[1:])<|fim_prefix|># repo: raihan-uddin/Python-practice path: /PythonObjectandDataStructureBasics/lists.py
my_list = [1, 2, 3]
print(my_list)
print... | code_fim | medium | {
"lang": "python",
"repo": "raihan-uddin/Python-practice",
"path": "/PythonObjectandDataStructureBasics/lists.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raihan-uddin/Python-practice path: /PythonObjectandDataStructureBasics/lists.py
my_list = [1, 2, 3]
print(my_list)
print(type(my_list))
my_list = ['string', 23, 1.2, 'o']
print(my_list)
print(len(my_list))
my_list = ['one', 'two', 'three', 4, 5]
print(my_list[0])
print(type(my_list[0]))
print(... | code_fim | hard | {
"lang": "python",
"repo": "raihan-uddin/Python-practice",
"path": "/PythonObjectandDataStructureBasics/lists.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> index=temp("{base}/{TIME}/{sample}/{sample}.star.lr.bai"),
version: config["GATK"]
params:
rulename = "gatk_R",
batch = config[config['host']]["job_gatk_RNA"]
shell: """
#######################
module load GATK/{version}
... | code_fim | hard | {
"lang": "python",
"repo": "wangpanqiao/ngs_pipeline",
"path": "/ruleBook/gatk_RNASeq.rules",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangpanqiao/ngs_pipeline path: /ruleBook/gatk_RNASeq.rules
# vim: syntax=python tabstop=4 expandtab
# coding: utf-8
############
# GATK_RNASeq
############
############
# GATK Best Practices
############
rule GATK_RNASeq_Trim:
input: bam="{base}/{TIME}/{sample}/{sample}.star.... | code_fim | hard | {
"lang": "python",
"repo": "wangpanqiao/ngs_pipeline",
"path": "/ruleBook/gatk_RNASeq.rules",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Installing ghidra_bridge server scripts...")
# write out the ghidra_bridge server files directly in the install dir
for f in server_files:
dest_path = os.path.join(install_dir, f)
with pkg_resources.resource_stream(
GHIDRA_BRIDGE, SERVER_DIR + "/" + f
... | code_fim | hard | {
"lang": "python",
"repo": "justfoxing/ghidra_bridge",
"path": "/ghidra_bridge/install_server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # write out the ghidra_bridge server files directly in the install dir
for f in server_files:
dest_path = os.path.join(install_dir, f)
with pkg_resources.resource_stream(
GHIDRA_BRIDGE, SERVER_DIR + "/" + f
) as resource:
with open(dest_path, "wb") a... | code_fim | hard | {
"lang": "python",
"repo": "justfoxing/ghidra_bridge",
"path": "/ghidra_bridge/install_server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: justfoxing/ghidra_bridge path: /ghidra_bridge/install_server.py
""" Handle installing the ghidra_bridge server scripts (and supporting jfx_bridge) to a specified directory """
import argparse
import os
import pkg_resources
JFX_BRIDGE = "jfx_bridge"
GHIDRA_BRIDGE = "ghidra_bridge"
SERVER_DIR = "s... | code_fim | hard | {
"lang": "python",
"repo": "justfoxing/ghidra_bridge",
"path": "/ghidra_bridge/install_server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: atraides/pumpmeup path: /lib/pmu/connection.py
from .MQTTClient import MQTTClient
class PMUConnection():
def __init__(self,config={}):
for key in config:
self.set_arguments(name=key,config=config)
def set_arguments(self,name=None,config=None):
if name in conf... | code_fim | hard | {
"lang": "python",
"repo": "atraides/pumpmeup",
"path": "/lib/pmu/connection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if topic and payload:
self.log.debug(f"Publishing {payload} to {topic}.")
self._client.publish(topic, payload=payload, qos=qos, retain=retain)
def on_message(self,callback):
if callable(callback):
self._client.on_message = callback
def disconne... | code_fim | hard | {
"lang": "python",
"repo": "atraides/pumpmeup",
"path": "/lib/pmu/connection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
For now we hardcode the MQTT connection, later down the line
this module should be responsible to load the appropriate connection
library before initiating the connection.
'''
if hasattr(self,'mqtt'):
if 'broker' in self.mqtt:
... | code_fim | hard | {
"lang": "python",
"repo": "atraides/pumpmeup",
"path": "/lib/pmu/connection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HilmiZul/epkl3 path: /master/views_instansi_delete.py
from django.shortcuts import redirect, render
from django.contrib.auth.decorators import login_required
from django.conf import settings
from .models import Instansi
from django.contrib import messages
<|fim_suffix|> Instansi.objects.filter(... | code_fim | hard | {
"lang": "python",
"repo": "HilmiZul/epkl3",
"path": "/master/views_instansi_delete.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@login_required(login_url=settings.LOGIN_URL)
def hapus_instansi_tkj(request, id_instansi):
Instansi.objects.filter(id=id_instansi).delete()
msg = "Data berhasil dihapus."
messages.success(request, msg)
return redirect('instansi_tkj')<|fim_prefix|># repo: HilmiZul/epkl3 path: /master/views_instan... | code_fim | hard | {
"lang": "python",
"repo": "HilmiZul/epkl3",
"path": "/master/views_instansi_delete.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # calc estimated size required with free space on USB
estimatedSize = self.EstimatedUSBDataSize()
estMB = estimatedSize/1024/1024
fs_info = self.GetDiskUsageStats(path)
freeUSB = fs_info["free"]
freeMB = freeUSB/1024/1024
if estimatedSize < freeUSB:... | code_fim | hard | {
"lang": "python",
"repo": "peter9teufel/usb-kiosk",
"path": "/Desktop/packages/rmgui/KioskMainPanel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if hasattr(os, 'statvfs'): # POSIX
st = os.statvfs(path)
free = st.f_bavail * st.f_frsize
total = st.f_blocks * st.f_frsize
used = (st.f_blocks - st.f_bfree) * st.f_frsize
return {"total":total, "used": used, "free": free}
elif o... | code_fim | hard | {
"lang": "python",
"repo": "peter9teufel/usb-kiosk",
"path": "/Desktop/packages/rmgui/KioskMainPanel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peter9teufel/usb-kiosk path: /Desktop/packages/rmgui/KioskMainPanel.py
MP3 files (*.mp3)|*.mp3", wx.FD_OPEN | wx.FD_MULTIPLE)
if songDialog.ShowModal() != wx.ID_CANCEL:
files = songDialog.GetFilenames()
dir = songDialog.GetDirectory()
for file in files:... | code_fim | hard | {
"lang": "python",
"repo": "peter9teufel/usb-kiosk",
"path": "/Desktop/packages/rmgui/KioskMainPanel.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Chrome 用の webdriver が返る
"""
return selenium.webdriver.Chrome(
executable_path=get_executable_path()
)<|fim_prefix|># repo: ysKuga/selenium-python-nue path: /app/modules/driver/chrome.py
import sys
import os
import time
import selenium
from selenium.webdriver.remote import ... | code_fim | medium | {
"lang": "python",
"repo": "ysKuga/selenium-python-nue",
"path": "/app/modules/driver/chrome.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def factory() -> webdriver:
"""
Chrome 用の webdriver が返る
"""
return selenium.webdriver.Chrome(
executable_path=get_executable_path()
)<|fim_prefix|># repo: ysKuga/selenium-python-nue path: /app/modules/driver/chrome.py
import sys
import os
import time
import selenium
from sele... | code_fim | hard | {
"lang": "python",
"repo": "ysKuga/selenium-python-nue",
"path": "/app/modules/driver/chrome.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ysKuga/selenium-python-nue path: /app/modules/driver/chrome.py
import sys
import os
import time
import selenium
from selenium.webdriver.remote import webdriver
import chromedriver_binary
def get_executable_path() -> str:
"""
selenium.webdriver.Chrome 用の executable path を返す
"""
... | code_fim | hard | {
"lang": "python",
"repo": "ysKuga/selenium-python-nue",
"path": "/app/modules/driver/chrome.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> global sample_rate
sample_rate = wavfile.getframerate()
global no_channels
no_channels = wavfile.getnchannels()
global chunk
chunk = 4096
output = aa.PCM(aa.PCM_PLAYBACK, aa.PCM_NORMAL,
channels = no_channels,
rate = sample_rate,
... | code_fim | hard | {
"lang": "python",
"repo": "bobycv06fpm/GrandPal",
"path": "/client/spectrum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bobycv06fpm/GrandPal path: /client/spectrum.py
import sys
import wave #open and read wave files
from struct import unpack #convert the audio data for numpy
import alsaaudio as aa #use to play the audio
import numpy as np #to do calculations as the fft
import scrollphathd as s
def power_index(va... | code_fim | hard | {
"lang": "python",
"repo": "bobycv06fpm/GrandPal",
"path": "/client/spectrum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OlafHaag/NeuroPsyResearchAnalysis path: /scripts/01-preprocessdata.py
# notebook: 00-oh-preprocess_data.ipynb
# %% [markdown]
# # Data Cleanup and Pre-processing
#
# Before we can analyze the data we need to clean the raw data and bring it to a format suited for the analyses.
# %%
# Basic impo... | code_fim | hard | {
"lang": "python",
"repo": "OlafHaag/NeuroPsyResearchAnalysis",
"path": "/scripts/01-preprocessdata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># %%
# If a subsequent block is completed within 2 seconds after the previous one, there was a malfunction in the app.
# A session must consist of 3 blocks.
blocks, n_errors, invalid_sessions = analysis.remove_erroneous_blocks(blocks, delta_time=2.0, n_blocks=3)
n_users_malfunction = n_users - blocks['us... | code_fim | hard | {
"lang": "python",
"repo": "OlafHaag/NeuroPsyResearchAnalysis",
"path": "/scripts/01-preprocessdata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
Test_Dict = {"geeksforgeeks": 3, "best": 3, "coding": 4, "practice": 3}
k = int(input("Enter K: "))
print(Resize_Dict(Test_Dict, k))<|fim_prefix|># repo: saubhagyav/100_Days_Code_Challenge path: /DAYS/Day26/Resize_Keys_in_Dictionary.py
def Resize_Dict(Test_Dict, K):
<|fim_middle|> return {key[:k]... | code_fim | medium | {
"lang": "python",
"repo": "saubhagyav/100_Days_Code_Challenge",
"path": "/DAYS/Day26/Resize_Keys_in_Dictionary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saubhagyav/100_Days_Code_Challenge path: /DAYS/Day26/Resize_Keys_in_Dictionary.py
def Resize_Dict(Test_Dict, K):
<|fim_suffix|>Test_Dict = {"geeksforgeeks": 3, "best": 3, "coding": 4, "practice": 3}
k = int(input("Enter K: "))
print(Resize_Dict(Test_Dict, k))<|fim_middle|> return {key[:k]: ... | code_fim | medium | {
"lang": "python",
"repo": "saubhagyav/100_Days_Code_Challenge",
"path": "/DAYS/Day26/Resize_Keys_in_Dictionary.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Test_Dict = {"geeksforgeeks": 3, "best": 3, "coding": 4, "practice": 3}
k = int(input("Enter K: "))
print(Resize_Dict(Test_Dict, k))<|fim_prefix|># repo: saubhagyav/100_Days_Code_Challenge path: /DAYS/Day26/Resize_Keys_in_Dictionary.py
def Resize_Dict(Test_Dict, K):
<|fim_middle|> return {key[:k]: ... | code_fim | medium | {
"lang": "python",
"repo": "saubhagyav/100_Days_Code_Challenge",
"path": "/DAYS/Day26/Resize_Keys_in_Dictionary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sergioruiz/problemsolvingpython path: /graph.py
import time
import matplotlib.pyplot as plt
###
def blue(n):
sum = 0
for k in range(1, n + 1):
sum += k
return sum
def orange(n):
<|fim_suffix|>for x in range(10, 100):
t1 = time.perf_counter()
orangeRe... | code_fim | hard | {
"lang": "python",
"repo": "sergioruiz/problemsolvingpython",
"path": "/graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sum = n * (n + 1) / 2
return sum
#####
values = list(range(10, 100)) # 10..99
orangeResults = list(range(90)) # 0..89
blueResults = list(range(90)) # 0..89
orangeTimes = list(range(90)) # 0..89
blueTimes = list(range(90)) # 0..89
for x in range(10, 100):
t1 = time.pe... | code_fim | medium | {
"lang": "python",
"repo": "sergioruiz/problemsolvingpython",
"path": "/graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abidnazirisami/02_034_104_Project path: /neweb/game/urls.py
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.views.generic.ba<|fim_suffix|> url(r'^delete/success/$', deleteSuccess),
url(r'^delete/(.{1,3... | code_fim | medium | {
"lang": "python",
"repo": "abidnazirisami/02_034_104_Project",
"path": "/neweb/game/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>30})/$', updateGamePage),
url(r'^details/(.{1,30})/$', getDetails),
url(r'^book/(.{1,30})/$', book),
url(r'^bookSuccess/(.{1,30})/$', bookTable),
]<|fim_prefix|># repo: abidnazirisami/02_034_104_Project path: /neweb/game/urls.py
from django.conf.urls import include, url
from django.contrib impor... | code_fim | medium | {
"lang": "python",
"repo": "abidnazirisami/02_034_104_Project",
"path": "/neweb/game/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinkepp/search-for-this path: /sft/sim/PathWorldGenerator.py
import cv2
import networkx as nx
import numpy as np
from sft import Rectangle, normalize, get_path_bbox, sample_int_normal_bounded
from sft.Scenario import Scenario
from sft.sim.PathGenerator import PathGenerator
from sft.sim.Scenari... | code_fim | hard | {
"lang": "python",
"repo": "kevinkepp/search-for-this",
"path": "/sft/sim/PathWorldGenerator.py",
"mode": "psm",
"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.