text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>pp.plot(x,y, label="Line Plot", color="r")
pp.xlabel('Year')
pp.ylabel('Rate')
pp.title("Rate Plot")
pp.legend()
pp.show()<|fim_prefix|># repo: kiranrraj/100Days_Of_Coding path: /Day_36/create_line_plot.py
# Title : Line graph
# Author : Kiran Raj R.
# Date : 19/11/2020
import matplotlib.pyplot as pp... | code_fim | easy | {
"lang": "python",
"repo": "kiranrraj/100Days_Of_Coding",
"path": "/Day_36/create_line_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kiranrraj/100Days_Of_Coding path: /Day_36/create_line_plot.py
# Title : Line graph
# Author : Kiran Raj R.
# Date : 19/11/2020
import matplotlib.pyplot as pp
<|fim_suffix|>pp.plot(x,y, label="Line Plot", color="r")
pp.xlabel('Year')
pp.ylabel('Rate')
pp.title("Rate Plot")
pp.legend()
pp.show... | code_fim | easy | {
"lang": "python",
"repo": "kiranrraj/100Days_Of_Coding",
"path": "/Day_36/create_line_plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._get_state_values(obj)['buttons']
def get_insurance(self, obj):
if obj.insurance:
return obj.insurance.insurer_name
return None
def get_listing_link(self, obj):
return app_routes_driver.car_details_url(obj)
def get_available_date_displ... | code_fim | hard | {
"lang": "python",
"repo": "JeremyParker/idlecars-backend",
"path": "/server/serializers/car_serializer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JeremyParker/idlecars-backend path: /server/serializers/car_serializer.py
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.utils import timezone
from django.conf import settings
from rest_framework.serializers import ModelSerializer, SerializerMethodF... | code_fim | hard | {
"lang": "python",
"repo": "JeremyParker/idlecars-backend",
"path": "/server/serializers/car_serializer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>cur_node = goal
print(f'\npath from {goal} to {start}: \n {goal} ', end='')
while cur_node != start:
cur_node = visited[cur_node]
print(f'---> {cur_node} ', end='')<|fim_prefix|># repo: boreesych/a_star path: /dijkstra.py
from heapq import *
graph = {'A': [(2, 'M'), (3, 'P')],
'M': [(2,... | code_fim | hard | {
"lang": "python",
"repo": "boreesych/a_star",
"path": "/dijkstra.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: boreesych/a_star path: /dijkstra.py
from heapq import *
graph = {'A': [(2, 'M'), (3, 'P')],
'M': [(2, 'A'), (2, 'N')],
'N': [(2, 'M'), (2, 'B')],
'P': [(3, 'A'), (4, 'B')],
'B': [(4, 'P'), (2, 'N')]}
def dijkstra(start, goal, graph):
queue = []
heappu... | code_fim | hard | {
"lang": "python",
"repo": "boreesych/a_star",
"path": "/dijkstra.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if neigh_node not in cost_visited or new_cost < cost_visited[neigh_node]:
heappush(queue, (new_cost, neigh_node))
cost_visited[neigh_node] = new_cost
visited[neigh_node] = cur_node
return visited
start = 'A'
goal = 'B'
visited = dijkstra(sta... | code_fim | hard | {
"lang": "python",
"repo": "boreesych/a_star",
"path": "/dijkstra.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_judgment.py
#calss header
class _JUDGMENT():
def __init__(self,):
<|fim_suffix|>
self.specie = 'nouns'
def run(self, obj1 = [], obj2 = []):
return self.jsondata<|fim_middle|> self.name = "JUDGMENT"
self.definitions = [u'the ability to fo... | code_fim | hard | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_judgment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rzr/iotivity path: /test/test_manager/defect_reporter.py
#!/usr/bin/python3
'''
/******************************************************************
*
* Copyright 2018 Samsung Electronics All Rights Reserved.
*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use... | code_fim | hard | {
"lang": "python",
"repo": "rzr/iotivity",
"path": "/test/test_manager/defect_reporter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>reporter = JiraDefectReporter()
reporter.generate_defect_report(TEST_JIRA_DEFECT_FILE_PATH)
timestring = strftime("%Y%m%d_%H%M%S", time.localtime(time.time()))
file_name = DEFECT_PREFIX + timestring + ".xlsx"
file_path = os.path.join(TEST_DEFECT_DIR, file_name)
reporter.report_to_xlsx(file_path)
p... | code_fim | hard | {
"lang": "python",
"repo": "rzr/iotivity",
"path": "/test/test_manager/defect_reporter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: orchestrated-io/autonomous-identification path: /client/crypto.py
import base64
import hashlib
from Crypto import Random
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Cipher import AES
from ast import literal_eval
class OAEP():
def generate_keys(self):
rand... | code_fim | hard | {
"lang": "python",
"repo": "orchestrated-io/autonomous-identification",
"path": "/client/crypto.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _pad(self, text: str) -> str:
if isinstance(text, int) or isinstance(text, float):
text = str(text)
return bytes(text+(self.block_size-len(text)%self.block_size)* \
chr(self.block_size-len(text)%self.block_size), encoding=('utf-8'))
def _unpad(self, text: str... | code_fim | hard | {
"lang": "python",
"repo": "orchestrated-io/autonomous-identification",
"path": "/client/crypto.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def encrypt(self, plaintext: str) -> str:
plaintext = self._pad(plaintext)
iv = Random.new().read(AES.block_size)
cipher = AES.new(self.key, AES.MODE_CBC, iv)
return base64.b64encode(iv + cipher.encrypt(plaintext))
def _pad(self, text: str) -> str:
if isins... | code_fim | hard | {
"lang": "python",
"repo": "orchestrated-io/autonomous-identification",
"path": "/client/crypto.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> global trace
logging.warn('SIGTERM received, calling modbus_trace_stop.')
modbus_trace_stop(trace)
# Need to exit since this overrides the framework handler
sys.exit(0)
#
# The following code runs when this is deployed as a 'long-running' Lambda function
#
# Set up logging
logging.ba... | code_fim | hard | {
"lang": "python",
"repo": "LairdCP/igsdk",
"path": "/aws/lambdas/modbus/ModbusTraceLambda.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LairdCP/igsdk path: /aws/lambdas/modbus/ModbusTraceLambda.py
#-------------------------------------------------------------------------------
# Name: ModbusTraceLambda.py
# Purpose: Captures Modbus traffic on the serial interface and publishes the
# Modbus packet to the AW... | code_fim | hard | {
"lang": "python",
"repo": "LairdCP/igsdk",
"path": "/aws/lambdas/modbus/ModbusTraceLambda.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#
# The following code runs when this is deployed as a 'long-running' Lambda function
#
# Set up logging
logging.basicConfig()
logging.getLogger().setLevel(log_level)
# Create a greengrass core sdk client
client = greengrasssdk.client('iot-data')
# Register termination handler
signal.signal(signal.SIGT... | code_fim | hard | {
"lang": "python",
"repo": "LairdCP/igsdk",
"path": "/aws/lambdas/modbus/ModbusTraceLambda.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jay1999ke/PureQPA path: /Home/migrations/0010_auto_20190207_0916.py
# Generated by Django 2.1.5 on 2019-02-07 03:46
from django.db import migrations
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='major',
name='deptbelong',
),
... | code_fim | medium | {
"lang": "python",
"repo": "jay1999ke/PureQPA",
"path": "/Home/migrations/0010_auto_20190207_0916.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('Home', '0009_student_faculty_access'),
]
operations = [
migrations.RemoveField(
model_name='major',
name='deptbelong',
),
migrations.DeleteModel(
name='major',
),
]<|fim_prefix|># repo: jay1999... | code_fim | easy | {
"lang": "python",
"repo": "jay1999ke/PureQPA",
"path": "/Home/migrations/0010_auto_20190207_0916.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='lazylet_term',
options={'ordering': ['id']},
),
migrations.AddField(
model_name='user',
name='state',
fi... | code_fim | medium | {
"lang": "python",
"repo": "swparkaust/sunwoobot",
"path": "/main/migrations/0002_auto_20190119_2337.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterModelOptions(
name='lazylet_term',
options={'ordering': ['id']},
),
migrations.AddField(
model_name='user',
name='state',
field=models.CharField(default='home', max_length=20),
),... | code_fim | medium | {
"lang": "python",
"repo": "swparkaust/sunwoobot",
"path": "/main/migrations/0002_auto_20190119_2337.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swparkaust/sunwoobot path: /main/migrations/0002_auto_20190119_2337.py
# Generated by Django 2.0.8 on 2019-01-19 14:37
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | code_fim | medium | {
"lang": "python",
"repo": "swparkaust/sunwoobot",
"path": "/main/migrations/0002_auto_20190119_2337.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x_values = np.arange(0, len(tracking_data[:,0]), 1)
x_values *= 5
plt.plot(x_values, tracking_data[:,0], color = 'lightgray', label = 'total' )
plt.plot(x_values, tracking_data[:,1], color = 'darkslategray', label = 'tracked' )
plt.legend(loc = "upper left" )
plt.setp(plt.gca().get... | code_fim | medium | {
"lang": "python",
"repo": "adamlmaclean/MCSTracker",
"path": "/paper/Figures/new_figures/make_paper_figure.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adamlmaclean/MCSTracker path: /paper/Figures/new_figures/make_paper_figure.py
import mesh
import tracking
import copy
import matplotlib as mpl
import matplotlib.pyplot as plt
from os import path
from os.path import dirname
import numpy as np
def make_paper_figure():
figuresize = (6... | code_fim | hard | {
"lang": "python",
"repo": "adamlmaclean/MCSTracker",
"path": "/paper/Figures/new_figures/make_paper_figure.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
"""
A basic commandline tool for generating tables from our saved data
"""
parser = argparse.ArgumentParser(
description="Generate table summary for our experiments from our saved small data."
)
parser.add_argument(
"--path",
type=str,
d... | code_fim | hard | {
"lang": "python",
"repo": "Grant-E-G/switching_opt",
"path": "/tables_cl.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Grant-E-G/switching_opt path: /tables_cl.py
import pickle
import argparse
from tabulate import tabulate
def construct_table_data(data, sigma_style=0, dim_list_override=None):
table_data = []
if dim_list_override is None:
dim_list = [
"5, 10, 15, 25 mixed",
... | code_fim | hard | {
"lang": "python",
"repo": "Grant-E-G/switching_opt",
"path": "/tables_cl.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>start = datetime.now()
for root, dirs, files in sorted(os.walk(fullpath)):
for name in sorted(files):
if name[-3:] == ".py" and not exclude_python_scripts:
fn = os.path.join(root, name)
os.chdir(root)
number += 1
if debug:
print(... | code_fim | hard | {
"lang": "python",
"repo": "Bachibouzouk/oemof-examples",
"path": "/oemof_examples/check_examples.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bachibouzouk/oemof-examples path: /oemof_examples/check_examples.py
import os
from termcolor import colored
import matplotlib
from matplotlib import pyplot as plt
import warnings
from datetime import datetime
import subprocess
import nbformat
import tempfile
warnings.filterwarnings("ignore", "",... | code_fim | hard | {
"lang": "python",
"repo": "Bachibouzouk/oemof-examples",
"path": "/oemof_examples/check_examples.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _ocr(self, pil_img: ModuleType) -> List[str]:
text = pytesseract.image_to_string(pil_img)
words = [sanitize_word(word) for word in text.split()]
words = [w for w in words if w]
return words
def analyze(self, pil_img: ModuleType) -> Tuple[List[str], ModuleType]:... | code_fim | medium | {
"lang": "python",
"repo": "sevagh/Scriptorium",
"path": "/scriptorium/ocr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sevagh/Scriptorium path: /scriptorium/ocr.py
import PIL.Image
from kraken.binarization import nlbin
import pytesseract
from typing import List, Tuple
from types import ModuleType
import unicodedata
def sanitize_word(word: str) -> str:
left_slice = 0
while left_slice < len(word) and unic... | code_fim | medium | {
"lang": "python",
"repo": "sevagh/Scriptorium",
"path": "/scriptorium/ocr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return len(self.stack)
def __repr__(self):
return "stack: " + str(self.stack)
class Queue:
def __init__(self):
self.stack1 = Stack()
self.stack2 = Stack()
def appendTail(self, item):
self.stack1.push(item)
def deleteHead(self):
if self.s... | code_fim | medium | {
"lang": "python",
"repo": "jpch89/sword2offer-python",
"path": "/09用两个栈实现队列.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jpch89/sword2offer-python path: /09用两个栈实现队列.py
"""
题目:
用两个栈实现一个队列。
队列的声明如下,请实现它的两个函数 appendTail 和 deleteHead,
分别完成在队列尾部插入节点和在队列头部删除节点的功能。
"""
class Stack:
def __init__(self, *args):
self.stack = list(args)
def push(self, item):
self.stack.append(item)
def pop(self... | code_fim | hard | {
"lang": "python",
"repo": "jpch89/sword2offer-python",
"path": "/09用两个栈实现队列.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pacogomez/pyvcloud path: /tests/vcd_vm.py
# VMware vCloud Director Python SDK
# Copyright (c) 2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of th... | code_fim | hard | {
"lang": "python",
"repo": "pacogomez/pyvcloud",
"path": "/tests/vcd_vm.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> logged_in_org = self.client.get_org()
org = Org(self.client, resource=logged_in_org)
vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
vdc = VDC(self.client, resource=vdc_resource)
assert self.config['vcd']['vdc'] == vdc.get_resource().get('name')
vapp_r... | code_fim | hard | {
"lang": "python",
"repo": "pacogomez/pyvcloud",
"path": "/tests/vcd_vm.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for value in hype:
hyper.append(str(value)[8:-3].split('.')[0])
all_hyper.append(word + ' : ' + ', '.join(v for v in hyper))
hyper = []
hypernym[i] = ', '.join(v for v in all_hyper)
all_hyper = []
colname = 'hyp'
... | code_fim | hard | {
"lang": "python",
"repo": "vigviswa/Named-Entity-Recognition-Using-Decision-Trees",
"path": "/nlp_project.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> hol = wn.synsets(word)[0].part_holonyms()
if hol:
for value in hol:
holo.append(str(value)[8:-3].split('.')[0])
all_holo.append(word + ' : ' + ', '.join(v for v in holo))
hol = []
holonym[i] = ', '.join(v... | code_fim | hard | {
"lang": "python",
"repo": "vigviswa/Named-Entity-Recognition-Using-Decision-Trees",
"path": "/nlp_project.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vigviswa/Named-Entity-Recognition-Using-Decision-Trees path: /nlp_project.py
# -*- coding: utf-8 -*-
"""NLP_Project.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1gNE2BdGURa12U1-2Ai8JZEyXkeAyUXG9
## WordNet Features
"""
... | code_fim | hard | {
"lang": "python",
"repo": "vigviswa/Named-Entity-Recognition-Using-Decision-Trees",
"path": "/nlp_project.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andreynovikov/imposm path: /imposm/db/config.py
# Copyright 2011 Omniscale (http://omniscale.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | code_fim | hard | {
"lang": "python",
"repo": "andreynovikov/imposm",
"path": "/imposm/db/config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def db_conf_from_string(conf, base_db_conf):
db_conf = _parse_rfc1738_args(conf)
if 'proj' not in db_conf:
db_conf.proj = base_db_conf.proj
if 'prefix' not in db_conf:
db_conf.prefix = base_db_conf.prefix
return db_conf
def _parse_rfc1738_args(name):
# from SQLAlchemy... | code_fim | hard | {
"lang": "python",
"repo": "andreynovikov/imposm",
"path": "/imposm/db/config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdmunden/mazeprogram path: /create maze v8.py
if a1 or a2 is a path (and c too for that matter) it shouldn't even let you enter here bc of lookahead
# i.e. it should make an "invisible wall" here insted of letting you go here
# if b1 or b2 is a path, the corresponding a s... | code_fim | hard | {
"lang": "python",
"repo": "rdmunden/mazeprogram",
"path": "/create maze v8.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dirs = preferred_dirs
for dir in dirs:
next_position = new_coords(current_position, dir)
# Since this is the second round we'll not worry about the solution path
# but still don't want to get go in loops
# also not worrying about blocked paths (for now)
# ... | code_fim | hard | {
"lang": "python",
"repo": "rdmunden/mazeprogram",
"path": "/create maze v8.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # c
# a1 ^ a2
# b1 | b2
#
# if a1 or a2 is a path (and c too for that matter) it shouldn't even let you enter here bc of lookahead
# i.e. it should make an "invisible wall" here insted of letting you go here
# if b1 or ... | code_fim | hard | {
"lang": "python",
"repo": "rdmunden/mazeprogram",
"path": "/create maze v8.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ErikNatanael/royal-chaos path: /phoebe/experiments/hedwig/do_experiments.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Filename: do_experiments.py
import os, datetime, time, json, re, argparse, subprocess, signal, random, socket
from difflib import Differ
import smtplib, imaplib, email
from ema... | code_fim | hard | {
"lang": "python",
"repo": "ErikNatanael/royal-chaos",
"path": "/phoebe/experiments/hedwig/do_experiments.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def format_addr(email):
name, addr = parseaddr(email)
return formataddr((Header(name, 'utf-8').encode(), addr))
def send_email(sender, receiver, message):
global SMTP_SERVER
global SMTP_SERVER_PORT
message['From'] = format_addr('%s <%s>' % (sender["name"], sender["address"]))
mes... | code_fim | hard | {
"lang": "python",
"repo": "ErikNatanael/royal-chaos",
"path": "/phoebe/experiments/hedwig/do_experiments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
# Path to a SOFIA ontology JSON file
sofia_ont_json_file = sys.argv[1]
with open(sofia_ont_json_file, 'r') as fh:
sofia_ont_json = json.load(fh)
sofia_rdf_path = join(dirname(abspath(sofia.__file__)),
'sofia_ontology.rdf')
G ... | code_fim | hard | {
"lang": "python",
"repo": "qiuhaoling/indra",
"path": "/indra/sources/sofia/make_sofia_ontology.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qiuhaoling/indra path: /indra/sources/sofia/make_sofia_ontology.py
import sys
import json
from os.path import join, dirname, abspath
from rdflib import Graph, Namespace, Literal
from indra.sources import sofia
# Note that this is just a placeholder, it doesn't resolve as a URL
sofia_ns = Namesp... | code_fim | hard | {
"lang": "python",
"repo": "qiuhaoling/indra",
"path": "/indra/sources/sofia/make_sofia_ontology.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> G = Graph()
for top_key, entries in ont_json.items():
for entry_key, examples in entries.items():
if '/' in entry_key:
parent, child = entry_key.split('/', maxsplit=1)
parent_term = sofia_ns.term(parent)
child_term = sofia_ns.term... | code_fim | medium | {
"lang": "python",
"repo": "qiuhaoling/indra",
"path": "/indra/sources/sofia/make_sofia_ontology.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marshmallow-code/flask-marshmallow path: /tests/test_sqla.py
import pytest
from flask import Flask, url_for
from flask_sqlalchemy import SQLAlchemy
from werkzeug.wrappers import Response
from flask_marshmallow import Marshmallow
from flask_marshmallow.sqla import HyperlinkRelated
from marshmallo... | code_fim | hard | {
"lang": "python",
"repo": "marshmallow-code/flask-marshmallow",
"path": "/tests/test_sqla.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> author = models.Author(name="Chuck Paluhniuk")
book = models.Book(title="Fight Club", author=author)
author_result = author_schema.dump(author)
assert "id" in author_result
assert "name" in author_result
assert author_result["id"] == author.id
asse... | code_fim | hard | {
"lang": "python",
"repo": "marshmallow-code/flask-marshmallow",
"path": "/tests/test_sqla.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = models.Book
author = HyperlinkRelated("author", external=True)
book_schema = BookSchema()
author = models.Author(name="Chuck Paluhniuk")
book = models.Book(title="Fight Club", author=author)
db.session.add(author)
db.session.ad... | code_fim | hard | {
"lang": "python",
"repo": "marshmallow-code/flask-marshmallow",
"path": "/tests/test_sqla.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MalyshevValery/Image_Analysis_DL path: /imagedl/nn/metrics/precision.py
"""Precision metric"""
from typing import Tuple
import torch
from imagedl.nn.metrics.metric import UpgradedMetric, sum_class_agg
from imagedl.utils.types import MetricTransform
class Precision(UpgradedMetric):
<|fim_suffi... | code_fim | hard | {
"lang": "python",
"repo": "MalyshevValery/Image_Analysis_DL",
"path": "/imagedl/nn/metrics/precision.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Resets the metric"""
self._tp = torch.zeros(self._n_classes)
self._p = torch.zeros(self._n_classes)
def _update(self, output: Tuple[torch.Tensor, torch.Tensor]) -> None:
"""Updates the metric"""
logits, targets = output
self._tp = self._tp.to(logits.... | code_fim | medium | {
"lang": "python",
"repo": "MalyshevValery/Image_Analysis_DL",
"path": "/imagedl/nn/metrics/precision.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not self._multi_label and self._n_classes > 1:
pred: torch.Tensor = logits.argmax(1)
tp: torch.Tensor = torch.eq(pred, targets)
values = torch.ones(int(tp.sum()), device=device)
self._tp += sum_class_agg(targets[tp], values, self._n_classes)
... | code_fim | hard | {
"lang": "python",
"repo": "MalyshevValery/Image_Analysis_DL",
"path": "/imagedl/nn/metrics/precision.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vsoch/docfish path: /docfish/apps/main/models.py
ied', auto_now=True)
metadata = JSONField(default={})
entity_set = models.ManyToManyField(Entity,
related_name="collection",
related_query_name="collection",
... | code_fim | hard | {
"lang": "python",
"repo": "vsoch/docfish",
"path": "/docfish/apps/main/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ImageDescription(models.Model):
'''An image description is an open text field to describe an image.
'''
image = models.ForeignKey(Image,blank=False,related_query_name="image_description")
team = models.ForeignKey('users.Team',blank=True,null=True)
collection = models.ForeignKey(C... | code_fim | hard | {
"lang": "python",
"repo": "vsoch/docfish",
"path": "/docfish/apps/main/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''A markup is like a transparent layer that fits to its matched image (see Image.image_markups).
By default of being a markup, it is intended to be used on a 2D image, which means that if
a markup is created for a 2D image, what is being created is a slice. To support this, each
... | code_fim | hard | {
"lang": "python",
"repo": "vsoch/docfish",
"path": "/docfish/apps/main/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # invoke the corresponding experiment based on the the (-name) flag
if args.name == "pod-delete":
pod_delete.PodDelete(clients)
else:
logging.error("Unsupported -name %s, please provide the correct value of -name args", args.name)
return
if __name__ == "__main__":
main()<|fim_prefix|># repo: oumk... | code_fim | hard | {
"lang": "python",
"repo": "oumkale/test-python",
"path": "/bin/experiment/experiment.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oumkale/test-python path: /bin/experiment/experiment.py
#!/usr/bin/env python3
import experiments.generic.pod_delete.pod_delete as pod_delete
import argparse
import logging
import pkg.utils.client.client as client
logging.basicConfig(format='time=%(asctime)s level=%(levelname)s msg=%(message)s'... | code_fim | hard | {
"lang": "python",
"repo": "oumkale/test-python",
"path": "/bin/experiment/experiment.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
async def execute(sql, args, autocommit=True):
log(sql, args)
__pool=datapool.__pool
async with __pool.get() as conn:
if not autocommit:
await conn.begin()
try:
async with conn.cursor() as cur:
await cur.execute(sql.replace(... | code_fim | hard | {
"lang": "python",
"repo": "cutedreamboy/awesome-python3-webapp",
"path": "/www/orm/dataopra.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cutedreamboy/awesome-python3-webapp path: /www/orm/dataopra.py
'''
Created on 2018年4月15日
@author: bomber
'''
import logging
import aiomysql
import orm.datapool as datapool
def log(sql, args=[]):
<|fim_suffix|>
async def select(sql, args, size=None):
log(sql, args)
__poo... | code_fim | medium | {
"lang": "python",
"repo": "cutedreamboy/awesome-python3-webapp",
"path": "/www/orm/dataopra.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>async def execute(sql, args, autocommit=True):
log(sql, args)
__pool=datapool.__pool
async with __pool.get() as conn:
if not autocommit:
await conn.begin()
try:
async with conn.cursor() as cur:
await cur.execute(sql.replace('?', '... | code_fim | hard | {
"lang": "python",
"repo": "cutedreamboy/awesome-python3-webapp",
"path": "/www/orm/dataopra.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rfrazier716/aoc_2020 path: /aoc2020/day3.py
from pathlib import Path
import numpy as np
def tree_in_path(map_line,map_x_coord):
"""
Checks if a tree is in the x-cord of the map line, looping if x is > len(map_line)
returns: True if a tree is in the path, False otherwise
rtype: ... | code_fim | hard | {
"lang": "python",
"repo": "rfrazier716/aoc_2020",
"path": "/aoc2020/day3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
# Load the puzzle import to a map
input_file = Path(__file__).resolve().parents[2] / "inputs" / "day3.txt"
with open(input_file) as fii:
map = [line.rstrip('\n') for line in fii] # Strip newline characters
# Part one of the puzzle, traverse the map wit... | code_fim | hard | {
"lang": "python",
"repo": "rfrazier716/aoc_2020",
"path": "/aoc2020/day3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexanu/python-trading path: /algotrader/trading/bar_aggregator.py
from rx import Observable
from algotrader import Startable, Context
from algotrader.model.market_data_pb2 import Bar, Trade, Quote, BarAggregationRequest
from algotrader.trading.data_series import DataSeries
from algotrader.tradi... | code_fim | hard | {
"lang": "python",
"repo": "alexanu/python-trading",
"path": "/algotrader/trading/bar_aggregator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## Tick Bar
elif self.__output_bar_type == Bar.Tick and self.__count >= self.__output_size:
self.publish()
## Vol Bar
elif self.__output_bar_type == Bar.Volume:
while self.__volume >= self.__output_size:
residual = self.__volume - se... | code_fim | hard | {
"lang": "python",
"repo": "alexanu/python-trading",
"path": "/algotrader/trading/bar_aggregator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Ensure the .ico file is in same dir
# as this source code is run from.
# Rename disk.ico to your own icon
root.iconbitmap('disk.ico')
root.mainloop()<|fim_prefix|># repo: ajaypg/Tk-Assistant path: /squirts/window/window-icon.py
"""Window icon.
Stand-alone example from Tk Assistant.
stev... | code_fim | medium | {
"lang": "python",
"repo": "ajaypg/Tk-Assistant",
"path": "/squirts/window/window-icon.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajaypg/Tk-Assistant path: /squirts/window/window-icon.py
"""Window icon.
Stand-alone example from Tk Assistant.
stevepython.wordpress.com"""
<|fim_suffix|># Ensure the .ico file is in same dir
# as this source code is run from.
# Rename disk.ico to your own icon
root.iconbitmap('d... | code_fim | medium | {
"lang": "python",
"repo": "ajaypg/Tk-Assistant",
"path": "/squirts/window/window-icon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>hello world").grid() # Label -> widget
root.mainloop()<|fim_prefix|># repo: ThebiggunSeeoil/tkinter path: /hello_tk.py
import tkinter as tk
root = tk.Tk()
root.option_add(<|fim_middle|>"*Font", "consolas 20")
root.title("I love tkinter very much")
for i in range(10):
tk.Label(root, text=" | code_fim | medium | {
"lang": "python",
"repo": "ThebiggunSeeoil/tkinter",
"path": "/hello_tk.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ThebiggunSeeoil/tkinter path: /hello_tk.py
import tkinter as tk
root = tk.Tk()
root.option_add("*Font", "consolas 20")
root.title("I love tkinter ver<|fim_suffix|>hello world").grid() # Label -> widget
root.mainloop()<|fim_middle|>y much")
for i in range(10):
tk.Label(root, text=" | code_fim | easy | {
"lang": "python",
"repo": "ThebiggunSeeoil/tkinter",
"path": "/hello_tk.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#url='https://raw.githubusercontent.com/abhishek374/dream11/master/Data/matchdata.csv'
#r = requests.get(url, allow_redirects=True)
#open('matchdata.csv', 'wb').write(r.content)
url='https://raw.githubusercontent.com/abhishek374/dream11/master/ipl20/name_mapping_clean.csv'
r = requests.get(url, allow_red... | code_fim | hard | {
"lang": "python",
"repo": "MananSoni42/fantasy-predictions",
"path": "/Extracting_files.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MananSoni42/fantasy-predictions path: /Extracting_files.py
import requests
#url='https://raw.githubusercontent.com/abhishek374/dream11/master/Data/ipl_scorecard_points_avg.csv'
#r = requests.get(url, allow_redirects=True)
#open('ipl_scorecard_points_avg.csv', 'wb').write(r.content)
#url='https:/... | code_fim | hard | {
"lang": "python",
"repo": "MananSoni42/fantasy-predictions",
"path": "/Extracting_files.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(SiteCaptor, self).__init__()
self.poco = poco
self.site_snapshot = None
def initialize(self, Case):
self.site_snapshot = Case.get_result_emitter('siteSnapshot')
self.site_snapshot.set_poco_instance(self.poco)
def snapshot(self, site_id):
retu... | code_fim | easy | {
"lang": "python",
"repo": "lijinhua163/PocoUnit",
"path": "/pocounit/addons/poco/capturing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lijinhua163/PocoUnit path: /pocounit/addons/poco/capturing.py
# coding=utf-8
from pocounit.addons import PocoUnitAddon
<|fim_suffix|> self.site_snapshot = Case.get_result_emitter('siteSnapshot')
self.site_snapshot.set_poco_instance(self.poco)
def snapshot(self, site_id):
... | code_fim | medium | {
"lang": "python",
"repo": "lijinhua163/PocoUnit",
"path": "/pocounit/addons/poco/capturing.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frank-stonybrook/meld path: /meld/remd/ladder.py
import random
import math
import logging
from meld.util import log_timing
logger = logging.getLogger(__name__)
class NearestNeighborLadder(object):
"""
Class to compute replica exchange swaps between neighboring replicas.
:param n_t... | code_fim | hard | {
"lang": "python",
"repo": "frank-stonybrook/meld",
"path": "/meld/remd/ladder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return permutation_vector
def _do_trial(self, i, j, permutation_vector, energies, adaptor):
"""Perform a replica exchange trial"""
delta = energies[i, i] - energies[j, i] + energies[j, j] - energies[i, j]
accepted = False
if delta >= 0:
accepted = ... | code_fim | hard | {
"lang": "python",
"repo": "frank-stonybrook/meld",
"path": "/meld/remd/ladder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LowieHuyghe/script-core path: /tests/config/testconfig.py
from scriptcore.testing.testcase import TestCase
from scriptcore.config.config import Config
class TestConfig(TestCase):
def test_get(self):
"""
Test get
:return: void
"""
# Make ini-file... | code_fim | hard | {
"lang": "python",
"repo": "LowieHuyghe/script-core",
"path": "/tests/config/testconfig.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Test section 1
self.assert_equal_deep(9, len(config('%ssection1' % namespace_prefix)))
self.assert_equal_deep(None, config('%ssection1.string1' % namespace_prefix))
self.assert_equal_deep('string2', config('%ssection1.string2' % namespace_prefix))
... | code_fim | hard | {
"lang": "python",
"repo": "LowieHuyghe/script-core",
"path": "/tests/config/testconfig.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swidtags/rpm2swidtag path: /lib/rpm2swidtag/payload.py
from rpm import files, RPMFILE_CONFIG, RPMFILE_DOC, RPMFILE_MISSINGOK, RPMFILE_GHOST, \
RPMFILE_LICENSE, RPMFILE_README, RPMVERIFY_FILEDIGEST, RPMVERIFY_FILESIZE
from lxml import etree
import re
from stat import S_ISDIR
from rpm2swidtag imp... | code_fim | hard | {
"lang": "python",
"repo": "swidtags/rpm2swidtag",
"path": "/lib/rpm2swidtag/payload.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if e is None:
return
for i in e:
if 'payload-generated-42' in i.nsmap:
etree.cleanup_namespaces(i, top_nsmap=i.getparent().nsmap)
else:
self.cleanup_namespaces(i)
@staticmethod
def _cleanup_fullname(l):
for i in l:
del i.attrib["fullname"]
#pylint: disable=protected-access,... | code_fim | hard | {
"lang": "python",
"repo": "swidtags/rpm2swidtag",
"path": "/lib/rpm2swidtag/payload.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bitmovin/bitmovin-api-sdk-python path: /bitmovin_api_sdk/models/default_dash_manifest_period.py
# coding: utf-8
from enum import Enum
from six import string_types, iteritems
from bitmovin_api_sdk.common.poscheck import poscheck_model
import pprint
import six
class DefaultDashManifestPeriod(obj... | code_fim | hard | {
"lang": "python",
"repo": "bitmovin/bitmovin-api-sdk-python",
"path": "/bitmovin_api_sdk/models/default_dash_manifest_period.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> List the encoding ids for which the conditions should apply
:return: The encoding_ids of this DefaultDashManifestPeriod.
:rtype: list[string_types]
"""
return self._encoding_ids
@encoding_ids.setter
def encoding_ids(self, encoding_ids):
# type: (li... | code_fim | hard | {
"lang": "python",
"repo": "bitmovin/bitmovin-api-sdk-python",
"path": "/bitmovin_api_sdk/models/default_dash_manifest_period.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeslieWongCV/stack-overflow-crawler path: /Scrapy_module/test.py
# -*- coding: utf-8 -*-
# @Time : 2020/3/11 9:48 AM
# @Author : Yushuo Wang
# @FileName: test.py
# @Software: PyCharm
# @Blog :https://lesliewongcv.github.io/
# -*- coding: utf-8 -*-
# @Time : 2020/3/11 3:14 AM
# @Author ... | code_fim | hard | {
"lang": "python",
"repo": "LeslieWongCV/stack-overflow-crawler",
"path": "/Scrapy_module/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>h = '<span class="vote-count-post "><strong>0</strong></span>'
h = h.split('strong>',2)[1].split('<')[0]
print(h)
import django
#print(django.get_version()) html = t.render(Context({'current_date': now}))
import datetime
time = datetime.datetime.now()
print(time)
#time_dict = {time}
#print=(tim... | code_fim | hard | {
"lang": "python",
"repo": "LeslieWongCV/stack-overflow-crawler",
"path": "/Scrapy_module/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#settings.configure()
#from django.db import connection
#cursor = connection.cursor()
import os
os.openpty()
dict_url = {}
list1 = [1,2,3,4,5,6,7,8,9,0]
for i in range(0,10):
dict_url['u%d'%(i+1)] = list1[i]
print(dict_url)<|fim_prefix|># repo: LeslieWongCV/stack-overflow-crawler path: /Scrapy_mo... | code_fim | hard | {
"lang": "python",
"repo": "LeslieWongCV/stack-overflow-crawler",
"path": "/Scrapy_module/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Javedgouri/django-q path: /django_q/apps.py
from django.apps import AppConfig
<|fim_suffix|> from django_q.signals import call_hook<|fim_middle|>from django_q.conf import Conf
class DjangoQConfig(AppConfig):
name = "django_q"
verbose_name = Conf.LABEL
default_auto_field = "d... | code_fim | medium | {
"lang": "python",
"repo": "Javedgouri/django-q",
"path": "/django_q/apps.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = "django_q"
verbose_name = Conf.LABEL
default_auto_field = "django.db.models.AutoField"
def ready(self):
from django_q.signals import call_hook<|fim_prefix|># repo: Javedgouri/django-q path: /django_q/apps.py
from django.apps import AppConfig
<|fim_middle|>from django_q.co... | code_fim | medium | {
"lang": "python",
"repo": "Javedgouri/django-q",
"path": "/django_q/apps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from django_q.signals import call_hook<|fim_prefix|># repo: Javedgouri/django-q path: /django_q/apps.py
from django.apps import AppConfig
<|fim_middle|>from django_q.conf import Conf
class DjangoQConfig(AppConfig):
name = "django_q"
verbose_name = Conf.LABEL
default_auto_field = "d... | code_fim | medium | {
"lang": "python",
"repo": "Javedgouri/django-q",
"path": "/django_q/apps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> X=df_features
#Encoding of target column
labelencoder = LabelEncoder()
y = labelencoder.fit_transform(df_target)
#Scaling
#Scaling of features by StandardScalar
if scaling=='standard-scalar':
print("Sc... | code_fim | hard | {
"lang": "python",
"repo": "kishore-s-gowda/fastreport",
"path": "/report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> threshold : int ,default=8
Maximum unique value a column can have
large_data : bool, default=False
If the dataset is large then the parameter large_data should be set to True,
make sure if your system has enough memory before s... | code_fim | hard | {
"lang": "python",
"repo": "kishore-s-gowda/fastreport",
"path": "/report.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kishore-s-gowda/fastreport path: /report.py
stClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from xgboost import XGBClassifier
from warnings import filterwarnings
... | code_fim | hard | {
"lang": "python",
"repo": "kishore-s-gowda/fastreport",
"path": "/report.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
a = ShareableRdd()
a.set('ak', 'Alaska')
a.set('ca', 'California')
a.get('ak')<|fim_prefix|># repo: helloxteen/MyResources path: /Hue/Resource/hadoop-tutorials-examples-master/notebook/shared_rdd/shareable_rdd.py
# Start a named RDD on a remote Livy PypSpark session that simulates a shared in memory... | code_fim | hard | {
"lang": "python",
"repo": "helloxteen/MyResources",
"path": "/Hue/Resource/hadoop-tutorials-examples-master/notebook/shared_rdd/shareable_rdd.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: helloxteen/MyResources path: /Hue/Resource/hadoop-tutorials-examples-master/notebook/shared_rdd/shareable_rdd.py
# Start a named RDD on a remote Livy PypSpark session that simulates a shared in memory key/value store.
# To start in a Livy PySpark session.
<|fim_suffix|> return self.data.filt... | code_fim | medium | {
"lang": "python",
"repo": "helloxteen/MyResources",
"path": "/Hue/Resource/hadoop-tutorials-examples-master/notebook/shared_rdd/shareable_rdd.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FormantIO/formant path: /examples/python/formant_module/agent/handle_mouse_clicks.py
import time
from formant.sdk.agent.v1 import Client as FormantClient
POINT_STREAM_NAME = "video.click"
<|fim_suffix|>if __name__ == "__main__":
fclient = FormantClient(ignore_throttled=True, ignore_unavai... | code_fim | medium | {
"lang": "python",
"repo": "FormantIO/formant",
"path": "/examples/python/formant_module/agent/handle_mouse_clicks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
fclient = FormantClient(ignore_throttled=True, ignore_unavailable=True)
fclient.register_teleop_callback(
handle_mouse_click, stream_filter=[POINT_STREAM_NAME]
)
while True:
time.sleep(10)<|fim_prefix|># repo: FormantIO/formant path: /examples/... | code_fim | medium | {
"lang": "python",
"repo": "FormantIO/formant",
"path": "/examples/python/formant_module/agent/handle_mouse_clicks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
fclient = FormantClient(ignore_throttled=True, ignore_unavailable=True)
fclient.register_teleop_callback(
handle_mouse_click, stream_filter=[POINT_STREAM_NAME]
)
while True:
time.sleep(10)<|fim_prefix|># repo: FormantIO/formant path: /examples/p... | code_fim | medium | {
"lang": "python",
"repo": "FormantIO/formant",
"path": "/examples/python/formant_module/agent/handle_mouse_clicks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: efishcn/cryptoquant path: /app/strategies/MaStrategy.py
# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# Name: MaStrategy
# Description: Binance strategy
# Author: Rudy
# U: project
# Date: 2020-04-20
#-... | code_fim | hard | {
"lang": "python",
"repo": "efishcn/cryptoquant",
"path": "/app/strategies/MaStrategy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def get_position(self,symbol = None):
"""调用获取持仓方法"""
return self.cta_engine.gateway.get_position(symbol)
def get_kline(self,symbol,minutes):
"""获取当前价格"""
return self.cta_engine.gateway.get_kline(symbol,minutes)
def get_ticker(self,symbol):
... | code_fim | hard | {
"lang": "python",
"repo": "efishcn/cryptoquant",
"path": "/app/strategies/MaStrategy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chris0203/pmes path: /pdms/urls.py
from jsonrpcclient.tornado_client import TornadoClient
from tornado_components.web import RobustTornadoClient, SignedTornadoClient
import tornado.web
import settings
from pdms import views
<|fim_suffix|>endpoints = [
(settings.ENDPOINTS["allcontent"],... | code_fim | hard | {
"lang": "python",
"repo": "chris0203/pmes",
"path": "/pdms/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>endpoints = [
(settings.ENDPOINTS["allcontent"], views.AllContentHandler, context),
(settings.ENDPOINTS["content"], views.ContentHandler, context),
(settings.ENDPOINTS["description"], views.DescriptionHandler, context),
(settings.ENDPOINTS["price"], ... | code_fim | hard | {
"lang": "python",
"repo": "chris0203/pmes",
"path": "/pdms/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linsalrob/EdwardsLab path: /bin/jsonl2tsv.py
"""
Convert a Google JSONL file to tsv.
This format of JSON that comes from big query has one dictionary per line, and is somewhat unique to Google. Note that
the file is not valid JSON format, because each line is an entry.
"""
import os
imp... | code_fim | hard | {
"lang": "python",
"repo": "linsalrob/EdwardsLab",
"path": "/bin/jsonl2tsv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ak = sorted(list(allkeys))
ak.insert(0, 'acc')
ak.append('jattr')
with open(args.output, 'w') as out:
# print the header
print("\t".join(ak), file=out)
for js in data:
for k in ak:
if k not in js:
js[k] = ""
... | code_fim | hard | {
"lang": "python",
"repo": "linsalrob/EdwardsLab",
"path": "/bin/jsonl2tsv.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.