text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: chrismits/COMP50Project path: /visionsam/scripts/test.py
#!/usr/bin/env python
f = open("/home/turtlebot/catkin_ws/src/visionsam/waypoints.txt", "r")
if f.mode == 'r':
contents = f.read()
print contents
<|fim_suffix|>print(coords_raw)
coords_raw = [elt.strip() for elt in coords_raw]
#elts_st... | code_fim | easy | {
"lang": "python",
"repo": "chrismits/COMP50Project",
"path": "/visionsam/scripts/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print( 'receive msg:', data)
except BaseException as e:
print ( "exception:", e)
break
finally:
try:
win32pipe.DisconnectNamedPipe(named_pipe)
except:
pass<|fim_prefix|># repo: hooloong/hooGnoolTools p... | code_fim | hard | {
"lang": "python",
"repo": "hooloong/hooGnoolTools",
"path": "/examples/testPyside2_06/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hooloong/hooGnoolTools path: /examples/testPyside2_06/server.py
import win32file
import win32pipe
import os
PIPE_NAME = r'\\.\pipe\test_pipe'
PIPE_BUFFER_SIZE = 65535
stop = False
while True:
named_pipe = win32pipe.CreateNamedPipe(PIPE_NAME,
win32pip... | code_fim | hard | {
"lang": "python",
"repo": "hooloong/hooGnoolTools",
"path": "/examples/testPyside2_06/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return len(self.daily_users) > 0
def next_user(self) -> (Tuple[int, ...], int):
"""
Removes the current users from the list of the sampled users for the current day and
returns its features and its class
:return: current user features, and the class of the use... | code_fim | hard | {
"lang": "python",
"repo": "riccardopoiani/pricing-and-advertising-machine-learning",
"path": "/environments/GeneralEnvironment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: riccardopoiani/pricing-and-advertising-machine-learning path: /environments/GeneralEnvironment.py
import numpy as np
from typing import List, Tuple
from environments.Environment import Environment
from environments.Settings.Scenario import Scenario
class PricingAdvertisingJointEnvironment(Env... | code_fim | hard | {
"lang": "python",
"repo": "riccardopoiani/pricing-and-advertising-machine-learning",
"path": "/environments/GeneralEnvironment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.daily_users = np.array([self.scenario.get_min_context_to_subcampaign_dict().get(context)
for context in self.sampled_users])
self.day_t += 1
self.day_breakpoints.append(self.user_count)
return len(self.daily_users) > 0
def ne... | code_fim | hard | {
"lang": "python",
"repo": "riccardopoiani/pricing-and-advertising-machine-learning",
"path": "/environments/GeneralEnvironment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dev-techmoe/python-dcdownloader path: /dcdownloader/utils.py
import re, os, traceback
from dcdownloader import config, title
def decode_packed_codes(code):
def encode_base_n(num, n, table=None):
FULL_TABLE = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
if ... | code_fim | hard | {
"lang": "python",
"repo": "dev-techmoe/python-dcdownloader",
"path": "/dcdownloader/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not msg == None:
window_title = window_title + ' - %s' % msg
title.update(window_title)
def mkdir(path):
path_ = path.split('/')
for i in range(0, len(path_)):
p = '/'.join(path_[0:i+1])
if p and not os.path.exists(p):
os.mkdir(p)
def retry(m... | code_fim | hard | {
"lang": "python",
"repo": "dev-techmoe/python-dcdownloader",
"path": "/dcdownloader/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
async def run(self):
msg = Message(Robot(), HasHeading(), Bearing())
while True:
raise NotImplemented
# get the data
current_heading = self.__get_compass_reading()
await self.queue.put(msg)
@staticmethod
def __g... | code_fim | medium | {
"lang": "python",
"repo": "gadgetlabs/reinforcementlearningrobot",
"path": "/sensors/Compass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def run(self):
msg = Message(Robot(), HasHeading(), Bearing())
while True:
raise NotImplemented
# get the data
current_heading = self.__get_compass_reading()
await self.queue.put(msg)
@staticmethod
def __get_compass_rea... | code_fim | medium | {
"lang": "python",
"repo": "gadgetlabs/reinforcementlearningrobot",
"path": "/sensors/Compass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gadgetlabs/reinforcementlearningrobot path: /sensors/Compass.py
from sensors.Sensor import Sensor
from messages.Message import Message
from messages.object import Bearing
from messages.subject import Robot
from messages.predicate import HasHeading
class Compass(Sensor):
def __init__(self, ... | code_fim | medium | {
"lang": "python",
"repo": "gadgetlabs/reinforcementlearningrobot",
"path": "/sensors/Compass.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> schema.on_app_start()
# Find components or instantiate the default ones.
ua = self.user_artifacts
for c_name, schema_attr, _ in [c for c in self.components if
c[0] != 'schemas']:
# Get component specified by user or defa... | code_fim | hard | {
"lang": "python",
"repo": "lucasdavid/grapher",
"path": "/grapher/grapher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lucasdavid/grapher path: /grapher/grapher.py
from . import commons
from .commons import Debug
from .environment import Environment
from .managers import Manager
from .repositories import Repository
from .schemas import Schema
from .resources import Resource
class Grapher(Environment):
insta... | code_fim | hard | {
"lang": "python",
"repo": "lucasdavid/grapher",
"path": "/grapher/grapher.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if r.__class__ in user_resources:
user_resources.remove(r.__class__)
view_func = r.as_view('%s_schema_api' % name, schema=schema)
self.app.add_url_rule(end_point, view_func=view_func)
Debug.message('Done.')
if user_resources:
... | code_fim | hard | {
"lang": "python",
"repo": "lucasdavid/grapher",
"path": "/grapher/grapher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 1 decision variables, 1 objectives, 2 constraints
problem = Problem(1, 1, 2)
problem.types[:] = Binary(len(self.requirements))
problem.directions[:] = Problem.MAXIMIZE
problem.constraints[0] = "!=0"
problem.constraints[1] = "<=0"
problem.function =... | code_fim | hard | {
"lang": "python",
"repo": "mandriv/next-release-problem",
"path": "/next_release_problem/problems.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mandriv/next-release-problem path: /next_release_problem/problems.py
from abc import ABCMeta, abstractmethod
from platypus import Problem, Binary, Real, RandomGenerator
class NRP_Problem():
__metaclass__ = ABCMeta
def __init__(self, requirements, clients, budget_constraint):
s... | code_fim | hard | {
"lang": "python",
"repo": "mandriv/next-release-problem",
"path": "/next_release_problem/problems.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kipngetich33/Viwasco-Washmis path: /washmis_erp/washmis_erp/doctype/reading_code/test_reading_code.py
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Paul Karugu and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
import frappe.defaults
from rea... | code_fim | hard | {
"lang": "python",
"repo": "Kipngetich33/Viwasco-Washmis",
"path": "/washmis_erp/washmis_erp/doctype/reading_code/test_reading_code.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_validate_reading_quality(self):
'''
Function that tests the validate reading quality
function
'''
self.test_code_1 = frappe.get_doc({
"doctype": "Reading Code",
"name1":"test_reading_code",
"good":1,
"bad":0
})
self.test_code_2 = frappe.get_doc({
"doctype": "... | code_fim | hard | {
"lang": "python",
"repo": "Kipngetich33/Viwasco-Washmis",
"path": "/washmis_erp/washmis_erp/doctype/reading_code/test_reading_code.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ppijbb/PyOpenDial path: /modules/simulation/reward_learner.py
from copy import copy
from math import *
from dialogue_state import DialogueState
from inference.approximate.sampling_algorithm import *
from modules.module import Module
class RewardLearner(Module):
"""
Module employed duri... | code_fim | hard | {
"lang": "python",
"repo": "ppijbb/PyOpenDial",
"path": "/modules/simulation/reward_learner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if actual_action.get_variables() in self.previous_states.keys():
previous_state = self.previous_states[actual_action.get_variables()]
self.learn_from_feedback(previous_state, actual_action, actual_utility)
state.clear_evidence(eviden... | code_fim | hard | {
"lang": "python",
"repo": "ppijbb/PyOpenDial",
"path": "/modules/simulation/reward_learner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> size = 0x1000
lpcbNeeded = DWORD(size)
unit = sizeof(HMODULE)
while 1:
lphModule = (HMODULE * (size // unit))()
_EnumProcessModules(hProcess, byref(lphModule), lpcbNeeded, byref(lpcbNeeded))
needed = lpcbNeeded.value
if needed <= size:
break
... | code_fim | hard | {
"lang": "python",
"repo": "skelsec/minidump",
"path": "/minidump/utils/winapi/psapi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skelsec/minidump path: /minidump/utils/winapi/psapi.py
from minidump.utils.winapi.defines import *
# typedef struct _MODULEINFO {
# LPVOID lpBaseOfDll;
# DWORD SizeOfImage;
# LPVOID EntryPoint;
# } MODULEINFO, *LPMODULEINFO;
class MODULEINFO(Structure):
_fields_ = [
("lpBase... | code_fim | hard | {
"lang": "python",
"repo": "skelsec/minidump",
"path": "/minidump/utils/winapi/psapi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _GetModuleInformation = windll.psapi.GetModuleInformation
_GetModuleInformation.argtypes = [HANDLE, HMODULE, LPMODULEINFO, DWORD]
_GetModuleInformation.restype = bool
_GetModuleInformation.errcheck = RaiseIfZero
if lpmodinfo is None:
lpmodinfo = MODULEINFO()
_GetModuleInfo... | code_fim | hard | {
"lang": "python",
"repo": "skelsec/minidump",
"path": "/minidump/utils/winapi/psapi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anakinanakin/neural-network-on-finance-data path: /midprice_profit_label/profit_evaluate/profit_evaluate_2010/viz.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
total_return = np.load('total_return.npy')
trade_time = np.load('tra... | code_fim | hard | {
"lang": "python",
"repo": "anakinanakin/neural-network-on-finance-data",
"path": "/midprice_profit_label/profit_evaluate/profit_evaluate_2010/viz.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.subplot(236)
plt.title('Profit with Cost bp3')
plt.xlabel('K')
plt.ylabel('Day')
plt.xticks(np.arange(0, 11, step=5), ('10', '50', '100'))
plt.yticks(np.arange(0, 30, step=6))
plt.imshow(total_return[:,:,th]-trade_time[:,:,th]*3,cmap='coolwarm')
plt.colorbar()
# plt.show()
plt.sav... | code_fim | hard | {
"lang": "python",
"repo": "anakinanakin/neural-network-on-finance-data",
"path": "/midprice_profit_label/profit_evaluate/profit_evaluate_2010/viz.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.subplot(235)
plt.title('Profit with Cost bp2')
plt.xlabel('K')
plt.ylabel('Day')
plt.xticks(np.arange(0, 11, step=5), ('10', '50', '100'))
plt.yticks(np.arange(0, 30, step=6))
plt.imshow(total_return[:,:,th]-trade_time[:,:,th]*2,cmap='coolwarm')
plt.colorbar()
plt.subplot(236)
plt... | code_fim | hard | {
"lang": "python",
"repo": "anakinanakin/neural-network-on-finance-data",
"path": "/midprice_profit_label/profit_evaluate/profit_evaluate_2010/viz.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.task_end:
break
if message.get('type') == 'websocket.disconnect':
for room in self.rooms:
await self.left_room(room)
self.task_end = True
raise Exception("task end")
if message... | code_fim | hard | {
"lang": "python",
"repo": "zilohumberto/movie_score_python",
"path": "/app/handlers/handler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zilohumberto/movie_score_python path: /app/handlers/handler.py
from uuid import uuid4
from asyncio import sleep, get_running_loop
from json import dumps, loads
from app.cache import CacheGateway
class Handler(object):
uuid = None
cache = None
send = None
task_end = False
roo... | code_fim | hard | {
"lang": "python",
"repo": "zilohumberto/movie_score_python",
"path": "/app/handlers/handler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kanarinka/WTFCSV path: /server.py
import os, sys, time, json, logging, csv, string, tempfile, codecs, re, urllib, codecs
from operator import itemgetter
from flask import Flask, Response, render_template, jsonify, request, redirect, url_for, abort, g
from flask.ext.uploads import UploadSet, confi... | code_fim | hard | {
"lang": "python",
"repo": "kanarinka/WTFCSV",
"path": "/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_template("home.html", error=None, csv_info=None, tab='paste')
@app.route("/<lang_code>/from-text",methods=['POST'])
def from_text():
error = None
results = None
try:
filename = time.strftime("%Y%m%d-%H%M%S")
filepath = os.path.join(TEMP_DIR,filename)
# grab content
text = unicod... | code_fim | hard | {
"lang": "python",
"repo": "kanarinka/WTFCSV",
"path": "/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: m2dsupsdlclass/lectures-labs path: /labs/07_seq2seq/solutions/make_input_output.py
def make_input_output(source_tokens, target_tokens, reverse_source=True<|fim_suffix|>ut_tokens = target_tokens + [EOS]
return input_tokens, output_tokens<|fim_middle|>):
if reverse_source:
source_to... | code_fim | medium | {
"lang": "python",
"repo": "m2dsupsdlclass/lectures-labs",
"path": "/labs/07_seq2seq/solutions/make_input_output.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>okens))
input_tokens = source_tokens + [GO] + target_tokens
output_tokens = target_tokens + [EOS]
return input_tokens, output_tokens<|fim_prefix|># repo: m2dsupsdlclass/lectures-labs path: /labs/07_seq2seq/solutions/make_input_output.py
def make_input_output(source_tokens, target_tokens, reve... | code_fim | medium | {
"lang": "python",
"repo": "m2dsupsdlclass/lectures-labs",
"path": "/labs/07_seq2seq/solutions/make_input_output.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eisenstatdavid/felt-tip-pens path: /local_search.py
import random
import assignment
import data
import metrics
vertices = [(i, j) for i in range(data.height) for j in range(data.width)]
def neighbors(u):
i, j = u
if i >= 1:
yield i - 1, j
if i < data.height - 1:
yi... | code_fim | hard | {
"lang": "python",
"repo": "eisenstatdavid/felt-tip-pens",
"path": "/local_search.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def random_maximal_independent_set():
mis = set()
ranking = vertices[:]
random.shuffle(ranking)
for u in ranking:
if all(v not in mis for v in neighbors(u)):
mis.add(u)
return mis
def improve_large_neighborhood_once(matrix):
moving = random_maximal_independen... | code_fim | hard | {
"lang": "python",
"repo": "eisenstatdavid/felt-tip-pens",
"path": "/local_search.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pairs = [(u, v) for u in vertices for v in vertices if u < v]
random.shuffle(pairs)
for u, v in pairs:
if cost_of_swap(matrix, u, v) < 0:
swap(matrix, u, v)
def random_maximal_independent_set():
mis = set()
ranking = vertices[:]
random.shuffle(ranking)
for... | code_fim | hard | {
"lang": "python",
"repo": "eisenstatdavid/felt-tip-pens",
"path": "/local_search.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nadane1708/dcinside-cleaner path: /src/delete.py
import requests
import json
import hashlib
from bs4 import BeautifulSoup
from time import sleep
from datetime import datetime
def getUserid(user_id,user_pw):
_url = "https://dcid.dcinside.com/join/mobile_app_login.php"
_hd = {
"User-a... | code_fim | hard | {
"lang": "python",
"repo": "nadane1708/dcinside-cleaner",
"path": "/src/delete.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main(id,pw,c,cmtlist="",pstlist=""):
print("수집이 완료되었습니다")
print("갯수가 맞지않는다면 작업진행후 한번더다시 반복해주세요")
if(pstlist==""):
print("총 댓글 갯수 : %d" % returnlistcnt(cmtlist))
askstart()
print("댓글삭제시작")
deletelist(id,pw,cmtlist,c,0,0)
endtalk()
elif(cmtlist==""... | code_fim | hard | {
"lang": "python",
"repo": "nadane1708/dcinside-cleaner",
"path": "/src/delete.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ranks = response.css('.ico_ranking::text').extract()
# css 선택자를 이용햐서 클래스가 ico_ranking 인
# 모든 항목을 추출해서 ranks 변수에 저장
titles = response.css('.link_g::text').extract()
# css 선택자를 이용해서 클래스가 link_g 인
# 모든 항목을 추출해서 titles 변수에 저장
with codecs.open('movieran... | code_fim | hard | {
"lang": "python",
"repo": "claw0ed/HelloScrap",
"path": "/movieSpider.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: claw0ed/HelloScrap path: /movieSpider.py
#-*- coding: utf-8 -*-
import scrapy # 스크랩파이 설치
import codecs
import sys
# 리눅스상에서 파이썬2 를 이용해서 utf-8 로 파일에 내용을 기록하려면 시스템 기본 인코딩을 utf-8 로 설정해야 함
reload(sys)
sys.setdefaultencoding('utf8')
<|fim_suffix|> with codecs.open('movierank.csv', 'w', 'utf-8... | code_fim | hard | {
"lang": "python",
"repo": "claw0ed/HelloScrap",
"path": "/movieSpider.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def build_payload(self, **kwargs):
return {
'name': kwargs.get('name'),
'members': kwargs.get('members', []),
'readOnly': kwargs.get('read_only', False)
}
def post_response(self, result):
return result<|fim_prefix|># repo: Ju... | code_fim | medium | {
"lang": "python",
"repo": "JuergenBS/rocket-python",
"path": "/rocketchat/calls/channels/create_public_room.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JuergenBS/rocket-python path: /rocketchat/calls/channels/create_public_room.py
import logging
from rocketchat.calls.base import PostMixin, RocketChatBase
logger = logging.getLogger(__name__)
<|fim_suffix|> def post_response(self, result):
return result<|fim_middle|>
class CreatePubl... | code_fim | hard | {
"lang": "python",
"repo": "JuergenBS/rocket-python",
"path": "/rocketchat/calls/channels/create_public_room.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ErtanOz/gslides path: /tests/test_utils.py
from decimal import Decimal
import numpy as np
import pandas as pd
import pytest
import gslides.utils as utils
json = {
"chartId": 1234567,
"spec": {
"title": "pytest",
"basicChart": {
"chartType": "COMBO",
... | code_fim | hard | {
"lang": "python",
"repo": "ErtanOz/gslides",
"path": "/tests/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.xfail(reason=ValueError)
def test_validate_params_list():
utils.validate_params_list({"legend_position": "outside"})
@pytest.mark.xfail(reason=ValueError)
def test_validate_params_int():
utils.validate_params_int({"line_width": -1})
@pytest.mark.xfail(reason=ValueError)
def test_... | code_fim | hard | {
"lang": "python",
"repo": "ErtanOz/gslides",
"path": "/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vgrem/Office365-REST-Python-Client path: /office365/sharepoint/userprofiles/personal_cache.py
from office365.runtime.paths.resource_path import ResourcePath
from office365.runtime.queries.service_operation import ServiceOperationQuery
from office365.sharepoint.base_entity import BaseEntity
clas... | code_fim | hard | {
"lang": "python",
"repo": "vgrem/Office365-REST-Python-Client",
"path": "/office365/sharepoint/userprofiles/personal_cache.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def cache_name(self):
"""
:rtype: str or None
"""
return self.properties.get("CacheName", None)
@property
def entity_type_name(self):
return "SP.UserProfiles.PersonalCache"<|fim_prefix|># repo: vgrem/Office365-REST-Python-Client path: /of... | code_fim | hard | {
"lang": "python",
"repo": "vgrem/Office365-REST-Python-Client",
"path": "/office365/sharepoint/userprofiles/personal_cache.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, context):
super(PersonalCache, self).__init__(context, ResourcePath("SP.UserProfiles.PersonalCache"))
def dispose(self):
"""
"""
qry = ServiceOperationQuery(self, "Dispose")
self.context.add_query(qry)
return self
@property
... | code_fim | hard | {
"lang": "python",
"repo": "vgrem/Office365-REST-Python-Client",
"path": "/office365/sharepoint/userprofiles/personal_cache.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> title: str,
scheduled_time: datetime,
include_news: bool = False,
include_weather: bool = False,
) -> Dict[str, Any]:
"""
Creates a dictionary holding alarm information in the shape of:
{
"title": "Title of the alarm",
"content": the time when the alarm fires
... | code_fim | hard | {
"lang": "python",
"repo": "kennethnym/covid19-alarm",
"path": "/server/routes/alarms/alarm_scheduler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kennethnym/covid19-alarm path: /server/routes/alarms/alarm_scheduler.py
"""
This module handles alarm scheduling
"""
import logging
import sched
import time
from flask import Markup
from datetime import datetime
from threading import Thread
from typing import List, Dict, Any
from .daily_brief i... | code_fim | hard | {
"lang": "python",
"repo": "kennethnym/covid19-alarm",
"path": "/server/routes/alarms/alarm_scheduler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mehrdadbakhtiari/adVNTR path: /advntr/utils.py
import logging
from Bio import SeqIO
from advntr.settings import *
def get_min_number_of_copies_to_span_read(pattern, read_length=150):
return int(round(float(read_length) / len(pattern) + 0.499))
<|fim_suffix|>def get_chromosome_reference_... | code_fim | hard | {
"lang": "python",
"repo": "mehrdadbakhtiari/adVNTR",
"path": "/advntr/utils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if read.mapq <= MAPQ_CUTOFF:
logging.debug('Rejecting read for poor mapping quality')
return True
low_quality_base_pairs = [i for i, q in enumerate(read.query_qualities) if q < QUALITY_SCORE_CUTOFF]
if len(low_quality_base_pairs) >= LOW_QUALITY_BP_TO_DISCARD_READ * len(read.que... | code_fim | medium | {
"lang": "python",
"repo": "mehrdadbakhtiari/adVNTR",
"path": "/advntr/utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_chromosome_reference_sequence(chromosome):
ref_file_name = HG19_DIR + chromosome + '.fa'
ref_file_name = 'hg38_chromosomes/hg38.fa'
# ref_file_name = '/tmp/hg38.fa'
fasta_sequences = SeqIO.parse(open(ref_file_name), 'fasta')
ref_sequence = ''
for fasta in fasta_sequences:
... | code_fim | hard | {
"lang": "python",
"repo": "mehrdadbakhtiari/adVNTR",
"path": "/advntr/utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>All commands are documented by describing the format for executing the command. All supported
options are presented, along with their default values. If an option is required, it will be
shown with the value `<REQUIRED>`.
"""
from __future__ import absolute_import
from pkgutil import extend_path
__path... | code_fim | medium | {
"lang": "python",
"repo": "ghetzel/webfriend",
"path": "/webfriend/scripting/commands/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ghetzel/webfriend path: /webfriend/scripting/commands/__init__.py
"""
This module contains documentation on all of the commands supported by the WebFriend core
distribution. Additional commands may be included via plugins.
## Documentation
<|fim_suffix|>from __future__ import absolute_import
f... | code_fim | hard | {
"lang": "python",
"repo": "ghetzel/webfriend",
"path": "/webfriend/scripting/commands/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>from __future__ import absolute_import
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) # noqa<|fim_prefix|># repo: ghetzel/webfriend path: /webfriend/scripting/commands/__init__.py
"""
This module contains documentation on all of the commands supported by the WebFriend core
di... | code_fim | hard | {
"lang": "python",
"repo": "ghetzel/webfriend",
"path": "/webfriend/scripting/commands/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_simple(self):
self.client.query('select 1')
r = self.client.use_result()
assert r.fetch_row() == ((1,), )<|fim_prefix|># repo: isabella232/pytest-call-tracer path: /tests/test_mysql.py
from __future__ import absolute_import
import MySQLdb
from unittest import TestCa... | code_fim | medium | {
"lang": "python",
"repo": "isabella232/pytest-call-tracer",
"path": "/tests/test_mysql.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: isabella232/pytest-call-tracer path: /tests/test_mysql.py
from __future__ import absolute_import
import MySQLdb
<|fim_suffix|> self.client = MySQLdb.connect()
def test_simple(self):
self.client.query('select 1')
r = self.client.use_result()
assert r.fetch_row... | code_fim | medium | {
"lang": "python",
"repo": "isabella232/pytest-call-tracer",
"path": "/tests/test_mysql.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: creare-com/podpac path: /podpac/datalib/__init__.py
"""
Datalib Public API
This module gets imported in the root __init__.py
and exposed its contents to podpac.datalib
"""
<|fim_suffix|># intake requires python >= 3.6
if sys.version >= "3.6":
from podpac.datalib.intake_catalog import Intake... | code_fim | hard | {
"lang": "python",
"repo": "creare-com/podpac",
"path": "/podpac/datalib/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># intake requires python >= 3.6
if sys.version >= "3.6":
from podpac.datalib.intake_catalog import IntakeCatalog<|fim_prefix|># repo: creare-com/podpac path: /podpac/datalib/__init__.py
"""
Datalib Public API
This module gets imported in the root __init__.py
and exposed its contents to podpac.datali... | code_fim | hard | {
"lang": "python",
"repo": "creare-com/podpac",
"path": "/podpac/datalib/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chciw/Adversary-about-RGBD-SOD path: /PDnet/preprocess.py
import cv2
import numpy as np
from PIL import Image
import h5py
import operator
import random
# PIC_PATH2 = 'D:/hh/deeplearning/Database/IRFF_dataset/RGBD_for_train/RGB/'
# SALDEEP_PATH2 = 'D:/hh/deeplearning/Database/IRFF_dataset... | code_fim | hard | {
"lang": "python",
"repo": "chciw/Adversary-about-RGBD-SOD",
"path": "/PDnet/preprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> deep = cv2.imread(SALDEEP_PATH2 + deplist[i], cv2.IMREAD_GRAYSCALE)
deep = cv2.resize(deep, (output_w, output_h), interpolation=cv2.INTER_CUBIC)
deep = deep.astype(np.float32)
deep /= 255
# deep=deep*score1[i]
deep = deep.astype(np.float32)
Z1[i] = deep.reshape(output_h, ... | code_fim | hard | {
"lang": "python",
"repo": "chciw/Adversary-about-RGBD-SOD",
"path": "/PDnet/preprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheMoksej/Wavelink path: /wavelink/__init__.py
__title__ = 'WaveLink'
__author__ = 'EvieePy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019-2021 (c) PythonistaGuild'
__version__ = '0.9.10'
from .client import Clien<|fim_suffix|>from .node import Node
from .meta import WavelinkMixin
from .we... | code_fim | medium | {
"lang": "python",
"repo": "TheMoksej/Wavelink",
"path": "/wavelink/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .node import Node
from .meta import WavelinkMixin
from .websocket import WebSocket<|fim_prefix|># repo: TheMoksej/Wavelink path: /wavelink/__init__.py
__title__ = 'WaveLink'
__author__ = 'EvieePy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019-2021 (c) PythonistaGuild'
__version__ = '0.9.10'
f... | code_fim | medium | {
"lang": "python",
"repo": "TheMoksej/Wavelink",
"path": "/wavelink/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if use_display4:
if display4_index >= -1 and display4_index < len(images):
display4.set_image(images[display4_index])
display4.write_display()
else:
display4.set_image(empty_image)
display4.write_display()
display1_index += 1
dis... | code_fim | hard | {
"lang": "python",
"repo": "mstumpf585/RaspDroid-SeverSide",
"path": "/Adafruit_Python_LED_Backpack/Matrix16x8LedDisplay/multi_scroll_display_image_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mstumpf585/RaspDroid-SeverSide path: /Adafruit_Python_LED_Backpack/Matrix16x8LedDisplay/multi_scroll_display_image_test.py
__author__ = 'youngsoul'
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
from Adafruit_LED_Backpack import Matrix8x8
import time
message = "The qu... | code_fim | hard | {
"lang": "python",
"repo": "mstumpf585/RaspDroid-SeverSide",
"path": "/Adafruit_Python_LED_Backpack/Matrix16x8LedDisplay/multi_scroll_display_image_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lawsoncr/Side_Projects path: /firstWebScrape.py
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 21 13:24:36 2021
@author: claws
"""
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
html = 'https://www.newegg.com/p/pl?d=amd+cpu'
#opens connection grab... | code_fim | hard | {
"lang": "python",
"repo": "lawsoncr/Side_Projects",
"path": "/firstWebScrape.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #stock = contain.findAll("li",{"class":"item-stock"})
#stock[0].text
#print("Brand: " + brand)
print("Info: " + product_info)
#print("Stock: " + stock)
f.write(product_info.replace(",", "|") + "\n")
f.close()<|fim_prefix|># repo: lawsoncr/Side_Projects path: /firs... | code_fim | hard | {
"lang": "python",
"repo": "lawsoncr/Side_Projects",
"path": "/firstWebScrape.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> url = base_url + str(school_id)
html = urllib.request.urlopen(url).read()
if not_found.encode() in html:
invalid_links += 1
else:
path = os.path.join(save_dir, "%06d.html" % school_id)
with open(path, 'wb') as f:
f.write(... | code_fim | hard | {
"lang": "python",
"repo": "Healthy-Coding/data_scraper",
"path": "/CollegeData/college_data_crawler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Healthy-Coding/data_scraper path: /CollegeData/college_data_crawler.py
#
# This script opens a given url, checks if a string indicated a non-existant
# page is present, and saves the html to the disk if not.
# The main loop cuts out when there are X number of non-existant pages in a
# row (indica... | code_fim | hard | {
"lang": "python",
"repo": "Healthy-Coding/data_scraper",
"path": "/CollegeData/college_data_crawler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jayd-1234/awkward-array path: /awkward/array/indexed.py
/bin/env python
# Copyright (c) 2018, DIANA-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributi... | code_fim | hard | {
"lang": "python",
"repo": "Jayd-1234/awkward-array",
"path": "/awkward/array/indexed.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jayd-1234/awkward-array path: /awkward/array/indexed.py
python
# Copyright (c) 2018, DIANA-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of s... | code_fim | hard | {
"lang": "python",
"repo": "Jayd-1234/awkward-array",
"path": "/awkward/array/indexed.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> value = self._toarray(value, self.INDEXTYPE, (numpy.ndarray, awkward.array.base.AwkwardArray))
if len(value.shape) != 1:
raise TypeError("index must have 1-dimensional shape")
if value.shape[0] == 0:
value = value.view(self.INDEXTYPE)
if not issubcl... | code_fim | hard | {
"lang": "python",
"repo": "Jayd-1234/awkward-array",
"path": "/awkward/array/indexed.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Download the files 'sample_submission.csv', 'testset.zip', 'trainset.zip'
webbrowser.open('https://www.kaggle.com/c/ift6135h19/data', new=2)
# Unzip if the files are already downloaded
for file_name in ['testset.zip', 'trainset.zip']:
with zipfile.ZipFile('../data/dogs_vs_cats/' + file_name, 'r') as... | code_fim | medium | {
"lang": "python",
"repo": "rcassani/learning-deep",
"path": "/utils/download_dogs_vs_cats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rcassani/learning-deep path: /utils/download_dogs_vs_cats.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Downloads data for the Dogs vs Cats InclassKaggle challenge
for image classification. The challege was part of the assignment #1 for the
course IFT 6135 Representation Learning Winter... | code_fim | medium | {
"lang": "python",
"repo": "rcassani/learning-deep",
"path": "/utils/download_dogs_vs_cats.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Unzip if the files are already downloaded
for file_name in ['testset.zip', 'trainset.zip']:
with zipfile.ZipFile('../data/dogs_vs_cats/' + file_name, 'r') as zip_ref:
zip_ref.extractall('../data/dogs_vs_cats/')<|fim_prefix|># repo: rcassani/learning-deep path: /utils/download_dogs_vs_cats.py
#!/u... | code_fim | hard | {
"lang": "python",
"repo": "rcassani/learning-deep",
"path": "/utils/download_dogs_vs_cats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: target/strelka path: /src/python/strelka/tests/test_scan_vhd.py
from pathlib import Path
from unittest import TestCase, mock
from strelka.scanners.scan_vhd import ScanVhd as ScanUnderTest
from strelka.tests import run_test_scan
def test_scan_vhd(mocker):
"""
Pass: Sample event matches ... | code_fim | hard | {
"lang": "python",
"repo": "target/strelka",
"path": "/src/python/strelka/tests/test_scan_vhd.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_scan_vhdx(mocker):
"""
Pass: Sample event matches output of scanner.
Failure: Unable to load file or sample event fails to match.
"""
test_scan_event = {
"elapsed": mock.ANY,
"flags": [],
"total": {"files": 3, "extracted": 3},
"files": [
... | code_fim | hard | {
"lang": "python",
"repo": "target/strelka",
"path": "/src/python/strelka/tests/test_scan_vhd.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KennethSoelberg/AOS-SW-API path: /aos_sw_api/syslog/_syslog.py
from typing import Union
import httpx
from aos_sw_api.validate import validate_200
from ._model import SyslogModel
class Syslog:
def __new__(cls, session: Union[httpx.Client, httpx.AsyncClient], **kwargs):
<|fim_suffix|> d... | code_fim | hard | {
"lang": "python",
"repo": "KennethSoelberg/AOS-SW-API",
"path": "/aos_sw_api/syslog/_syslog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(session=session)
def get_syslog(self) -> SyslogModel:
r = self._session.get(url=self._syslog_base_url)
validate_200(r)
return SyslogModel(**r.json())
class SyslogAsync(SyslogBase):
def __init__(self, session: httpx.AsyncClient):
super()._... | code_fim | hard | {
"lang": "python",
"repo": "KennethSoelberg/AOS-SW-API",
"path": "/aos_sw_api/syslog/_syslog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _get_nodes(output_json: Dict) -> Tuple[Dict, Dict, Dict]:
source_nodes = solcast.from_standard_output(output_json)
stmt_nodes = _get_statement_nodes(source_nodes)
branch_nodes = _get_branch_nodes(source_nodes)
return source_nodes, stmt_nodes, branch_nodes
def _get_statement_nodes(so... | code_fim | hard | {
"lang": "python",
"repo": "eth-brownie/brownie",
"path": "/brownie/project/compiler/solidity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eth-brownie/brownie path: /brownie/project/compiler/solidity.py
tionary in the form of {'path': "source code"}
install_needed: if True, will install when no installed version matches
the contract pragma
install_latest: if True, will install when a newer ver... | code_fim | hard | {
"lang": "python",
"repo": "eth-brownie/brownie",
"path": "/brownie/project/compiler/solidity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # set branch index markers and build final branch map
branch_map: Dict = {i: {} for i in source_nodes}
for path, offset, idx in [(k, x, y) for k, v in branch_set.items() for x, y in v.items()]:
# for branch to be hit, need an op relating to the source and the next JUMPI
# this ... | code_fim | hard | {
"lang": "python",
"repo": "eth-brownie/brownie",
"path": "/brownie/project/compiler/solidity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CiscoTestAutomation/genielibs path: /pkgs/ops-pkg/src/genie/libs/ops/ospf/iosxr/tests/ospf_output.py
{'metric': 111,
'mt_id... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genielibs",
"path": "/pkgs/ops-pkg/src/genie/libs/ops/ospf/iosxr/tests/ospf_output.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>: False},
'cost': 1,
'dead_interval': 40,
'demand_circuit': False,
'dr_ip_addr': '10.3.4.4',
... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genielibs",
"path": "/pkgs/ops-pkg/src/genie/libs/ops/ospf/iosxr/tests/ospf_output.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> event = {
"protoPayload": {
"resourceName": "coordination.test.io/v1/namespaces/test-test/leases/test-test",
"requestMetadata": {
"callerIp": "10.128.0.6",
"callerSuppliedUserAgent": "test-test/v1.23.17 (linux/amd64) kubernetes/f26d814/te... | code_fim | hard | {
"lang": "python",
"repo": "demisto/content",
"path": "/Packs/CloudIncidentResponse/Scripts/ExtractIndicatorsCloudLogging/ExtractIndicatorsCloudLogging_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: demisto/content path: /Packs/CloudIncidentResponse/Scripts/ExtractIndicatorsCloudLogging/ExtractIndicatorsCloudLogging_test.py
from ExtractIndicatorsCloudLogging import extract_aws_info, extract_gcp_info, extract_event_info
def test_extract_event_info():
aws_event = {
"userIdentity"... | code_fim | hard | {
"lang": "python",
"repo": "demisto/content",
"path": "/Packs/CloudIncidentResponse/Scripts/ExtractIndicatorsCloudLogging/ExtractIndicatorsCloudLogging_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slgero/talk_with_me path: /talk_with_me/data4ml.py
"""
Module for preparing and clearing text data from VK messages.
"""
import json
import os
import re
from abc import ABC, abstractmethod
from typing import List
from bs4 import BeautifulSoup
from typeguard import typechecked
from tqdm import tqd... | code_fim | hard | {
"lang": "python",
"repo": "slgero/talk_with_me",
"path": "/talk_with_me/data4ml.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = []
for folder in tqdm(self.get_list_of_folders(self.home_folder)):
parent_folder = os.path.join(self.home_folder, folder)
files = self.get_list_of_files_in_folder(parent_folder, limit=limit)
if files:
messages = self.parse_html(p... | code_fim | hard | {
"lang": "python",
"repo": "slgero/talk_with_me",
"path": "/talk_with_me/data4ml.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: entertainment-match/likees path: /src/entertainmentmatch/likees/forms/profile_forms.py
from django import forms
<|fim_suffix|> #password_old = forms.CharField(required=True)
password_new = forms.CharField(required=True)
password_confirm = forms.CharField(required=True)<|fim_middle|>cl... | code_fim | easy | {
"lang": "python",
"repo": "entertainment-match/likees",
"path": "/src/entertainmentmatch/likees/forms/profile_forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #password_old = forms.CharField(required=True)
password_new = forms.CharField(required=True)
password_confirm = forms.CharField(required=True)<|fim_prefix|># repo: entertainment-match/likees path: /src/entertainmentmatch/likees/forms/profile_forms.py
from django import forms
<|fim_middle|>cl... | code_fim | easy | {
"lang": "python",
"repo": "entertainment-match/likees",
"path": "/src/entertainmentmatch/likees/forms/profile_forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mikexu007/AS-CAL path: /linEval.py
emi_model_path)
args.learning_rate = 1
# args.epochs = 100
args.lr_decay_epochs = '15,35,60,75'
iterations = args.lr_decay_epochs.split(',')
args.lr_decay_epochs = list([])
for it in iterations:
args.lr... | code_fim | hard | {
"lang": "python",
"repo": "Mikexu007/AS-CAL",
"path": "/linEval.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if opt.dataset == 'uwa3d':
uwa3d_data_folder = '/data5/xushihao/data/UWA3d_feeder_data'
# opt.uwa3d_train = ['12', '13', '14', '23', '24', '34', ]
# opt.uwa3d_test1 = ['3','2','2','1','1','1']
# opt.uwa3d_test2 = ['4','4','3','4','3','2']
# opt.fold = 1
... | code_fim | hard | {
"lang": "python",
"repo": "Mikexu007/AS-CAL",
"path": "/linEval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> state = {
'opt': args,
'epoch': epoch,
'model': model.state_dict(),
'best_acc': best_acc,
'optimizer': optimizer.state_dict(),
}
save_file = os.path.join(args.save_folder, 'semi_ft_current.pth')
torch.save(state, s... | code_fim | hard | {
"lang": "python",
"repo": "Mikexu007/AS-CAL",
"path": "/linEval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MTES-MCT/aides-territoires path: /src/organizations/templatetags/organizations.py
"""Organization rendering helpers."""
from django import template
from organizations.models import Organization
register = template.Library()
<|fim_suffix|> if choice is not None:
organization_type = ... | code_fim | medium | {
"lang": "python",
"repo": "MTES-MCT/aides-territoires",
"path": "/src/organizations/templatetags/organizations.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> if choice is not None:
organization_type = Organization._meta.get_field("organization_type").base_field
organization_type = organization_type.choices
return organization_type[choice]
else:
return "Aucun"<|fim_prefix|># repo: MTES-MCT/aides-territoires path: /src/or... | code_fim | medium | {
"lang": "python",
"repo": "MTES-MCT/aides-territoires",
"path": "/src/organizations/templatetags/organizations.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>day = datetime.datetime(2009,month,dayy).weekday()
print(day_name[day])<|fim_prefix|># repo: arkanalexei/kattis-solutions path: /datum.py
import datetime
day_name= ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday']
<|fim_middle|>userinput = input().split()
month = int(use... | code_fim | medium | {
"lang": "python",
"repo": "arkanalexei/kattis-solutions",
"path": "/datum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arkanalexei/kattis-solutions path: /datum.py
import datetime
day_name= ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday']
<|fim_suffix|>day = datetime.datetime(2009,month,dayy).weekday()
print(day_name[day])<|fim_middle|>userinput = input().split()
month = int(use... | code_fim | medium | {
"lang": "python",
"repo": "arkanalexei/kattis-solutions",
"path": "/datum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def request_headers(args):
headers = {}
if args.ip:
headers.update({'Host': args.ip})
return headers if headers else None<|fim_prefix|># repo: bantonsson/typesafe-conductr-cli path: /conductr_cli/conduct_url.py
# build url from ConductR base url and given path
def url(path, args):
... | code_fim | medium | {
"lang": "python",
"repo": "bantonsson/typesafe-conductr-cli",
"path": "/conductr_cli/conduct_url.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def request_headers(args):
headers = {}
if args.ip:
headers.update({'Host': args.ip})
return headers if headers else None<|fim_prefix|># repo: bantonsson/typesafe-conductr-cli path: /conductr_cli/conduct_url.py
# build url from ConductR base url and given path
def url(path, args):
<... | code_fim | hard | {
"lang": "python",
"repo": "bantonsson/typesafe-conductr-cli",
"path": "/conductr_cli/conduct_url.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bantonsson/typesafe-conductr-cli path: /conductr_cli/conduct_url.py
# build url from ConductR base url and given path
def url(path, args):
base_url = 'http://{}:{}{}'.format(args.ip, args.port, api_version_path(args.api_version))
return '{}/{}'.format(base_url, path)
<|fim_suffix|>
def r... | code_fim | medium | {
"lang": "python",
"repo": "bantonsson/typesafe-conductr-cli",
"path": "/conductr_cli/conduct_url.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class StreamHexahedralHiearchy(BaseModel):
# dataset calls streamhandler, how to type annotation that?
stream_handler: Dataset
io: Any
field_list: List[Set]
meshes: List[StreamHexahedralMesh]
class StreamHexahedralDataset(BaseModel):
index_class: StreamHexahedralHiearchy
fie... | code_fim | hard | {
"lang": "python",
"repo": "data-exp-lab/analysis_schema",
"path": "/analysis_schema/Previous_Analysis_Schema/stream_frontend.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.