text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>@require_http_methods(['GET'])
def api_get_bullets(request):
try:
music_id = int(request.GET['musicid'])
position = float(request.GET['position'])
node_uuid = request.GET.get('uuid', '<unknown>')
bullets = Bullet.objects.filter(music_id=music_id, hidden=False, position_... | code_fim | hard | {
"lang": "python",
"repo": "allanwjm/GraingerFeedback",
"path": "/grainger/feedback/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allanwjm/GraingerFeedback path: /grainger/feedback/views.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from datetime import datetime
from datetime import timedelta
from django.contrib.auth.decorators import login_required
from django.contrib.staticfiles.template... | code_fim | hard | {
"lang": "python",
"repo": "allanwjm/GraingerFeedback",
"path": "/grainger/feedback/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jiang5ai/test_dev05 path: /backend/app_common/utils/response.py
from rest_framework.response import Response
class Error:
"""
子定义错误码与错误信息
"""
USER_OR_PAWD_NULL = {"10010": "用户名密码为空"}
USER_OR_PAWD_ERROR = {"10011": "用户名密码错误"}
ParamsTypeError = {"30020": "参数类型错误"}
JSO... | code_fim | hard | {
"lang": "python",
"repo": "Jiang5ai/test_dev05",
"path": "/backend/app_common/utils/response.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> resp = {
"success": success,
"error": {
"code": error_code,
"message": error_msg
},
"data": data
}
return Response(resp)<|fim_prefix|># repo: Jiang5ai/test_dev05 path: /backend/app_common/utils/response.py
from rest_framework.response im... | code_fim | hard | {
"lang": "python",
"repo": "Jiang5ai/test_dev05",
"path": "/backend/app_common/utils/response.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FreeworkEarth/yolo_streamer path: /processes/process_detector.py
import cv2
import time
import numpy as np
import tensorflow as tf
def process_detector(stop_process, pb_path, input_queue, input_queue_lock, output_queue, output_queue_lock):
tf_graph = tf.Graph()
tf_config = tf.ConfigProt... | code_fim | hard | {
"lang": "python",
"repo": "FreeworkEarth/yolo_streamer",
"path": "/processes/process_detector.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> out_scores, out_boxes = tf_sess.run([scores_tensor, boxes_tensor], feed_dict={input_tensor: resized_frames})
#forward data to next process
output_queue_lock.acquire()
output_queue.append((frames, out_scores, out_boxes))
output_queue_lock.release()
lat = ti... | code_fim | hard | {
"lang": "python",
"repo": "FreeworkEarth/yolo_streamer",
"path": "/processes/process_detector.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allisonlynnbasore14/ToolBox-WordFrequency path: /frequency.py
""" Analyzes the word frequencies in a book downloaded from
Project Gutenberg """
import string
import random
def skip_first_part(text):
"""
Takes the opened file to read as input and takes off the top part.
"""
for... | code_fim | hard | {
"lang": "python",
"repo": "allisonlynnbasore14/ToolBox-WordFrequency",
"path": "/frequency.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def write_resutls_file(name_for_write_file, filename, top_n_words, to_search_word_or_not = False, word_to_search = None, get_random = False):
"""
Makes a file in the same directory
Take parameters:
name_for_write is what you want to call the new file
filename is the text you ... | code_fim | hard | {
"lang": "python",
"repo": "allisonlynnbasore14/ToolBox-WordFrequency",
"path": "/frequency.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>t profile
from activate_views import activate<|fim_prefix|># repo: keunhong/oweapp path: /src/debitum/accounts/views.py
# -*- coding: utf-8 -*-
from login_views import loginajax
from register_views import reg<|fim_middle|>ister, registerajax
from profile_views impor | code_fim | easy | {
"lang": "python",
"repo": "keunhong/oweapp",
"path": "/src/debitum/accounts/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keunhong/oweapp path: /src/debitum/accounts/views.py
# -*- coding: utf-8 -*-
from login_views im<|fim_suffix|>ister, registerajax
from profile_views import profile
from activate_views import activate<|fim_middle|>port loginajax
from register_views import reg | code_fim | easy | {
"lang": "python",
"repo": "keunhong/oweapp",
"path": "/src/debitum/accounts/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>JVM_PATH = jpype.getDefaultJVMPath()
RIFCS_API_LOCATION = zope_config['rifcs-api-location']
RIFCS_KEY = "jcu.edu.au/tdh/%(type)s/%(id)s"
RIFCS_GROUP = "James Cook University"
RIFCS_ORIGINATING_SOURCE = "http://www.jcu.edu.au/tdh/"
RIFCS_ACTIVITY_RECORD_NOTE_TEMPLATE = """
Start Date: %(start_date)s
End ... | code_fim | hard | {
"lang": "python",
"repo": "jcu-eresearch/tdh.metadata",
"path": "/tdh/metadata/config.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>RIFCS_KEY = "jcu.edu.au/tdh/%(type)s/%(id)s"
RIFCS_GROUP = "James Cook University"
RIFCS_ORIGINATING_SOURCE = "http://www.jcu.edu.au/tdh/"
RIFCS_ACTIVITY_RECORD_NOTE_TEMPLATE = """
Start Date: %(start_date)s
End Date: %(end_date)s
Grant Year: %(grant_year)s
Funding Type: %(type)s
Funding Scheme: %(scheme... | code_fim | hard | {
"lang": "python",
"repo": "jcu-eresearch/tdh.metadata",
"path": "/tdh/metadata/config.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jcu-eresearch/tdh.metadata path: /tdh/metadata/config.py
"""Common configuration constants
"""
from App.config import getConfiguration
import jpype
from tdh.metadata import utils
PROJECTNAME = 'tdh.metadata'
PROFILE_ID = 'profile-%s:default' % PROJECTNAME
<|fim_suffix|>if hasattr(configuration... | code_fim | hard | {
"lang": "python",
"repo": "jcu-eresearch/tdh.metadata",
"path": "/tdh/metadata/config.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> except Exception as e:
print('\n[!] Error, Unable to write JS payload.')
print(' Yielded the following error %s' % e)<|fim_prefix|># repo: darrynza/Scriblur path: /Modules/WriteJSPayload.py
#!/usr/bin/python3
def payload_gen(_Name, _C2Payload):
vPAY = "./Payloads/" + _Name + ".tx... | code_fim | medium | {
"lang": "python",
"repo": "darrynza/Scriblur",
"path": "/Modules/WriteJSPayload.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darrynza/Scriblur path: /Modules/WriteJSPayload.py
#!/usr/bin/python3
def payload_gen(_Name, _C2Payload):
vPAY = "./Payloads/" + _Name + ".txt"
try:
payload = "var a='WSc' +"
payload += "'ript.Sh' +"
payload += "'ell';var b = 'ne' +"
payload += "'w Ac' + '... | code_fim | medium | {
"lang": "python",
"repo": "darrynza/Scriblur",
"path": "/Modules/WriteJSPayload.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return edges protruding (like a +) about a given vertex"""
return ((u,v,W), (u,v,S), (u,v-1,W), (u-1,v,S))
def adjacent((u,v)):
"""Return adjacent vertices to a given vertex"""
return ((u,v+1), (u+1,v), (u,v-1), (u-1,v))
class Grid(object):
def __init__(self, rows, cols):
... | code_fim | hard | {
"lang": "python",
"repo": "safetydank/astar-strategy",
"path": "/grid.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: safetydank/astar-strategy path: /grid.py
# Define a grid map
#
# A map is a square grid of faces.
#
# See http://www-cs-students.stanford.edu/~amitp/game-programming/grids/ for
# addressing scheme
class Face(object):
def __init__(self, (u, v)):
self.u = u
self.v =... | code_fim | hard | {
"lang": "python",
"repo": "safetydank/astar-strategy",
"path": "/grid.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif len(high_heap) > len(low_heap):
# Move the min element from the high heap to the low heap
transfer = hq.heappop(high_heap)
hm.heappush_max(low_heap, transfer)
# Reset the median. It should always be the maximum of the lower
... | code_fim | hard | {
"lang": "python",
"repo": "travisariggs/Algorithms",
"path": "/run_median_online.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Move the min element from the high heap to the low heap
transfer = hq.heappop(high_heap)
hm.heappush_max(low_heap, transfer)
# Reset the median. It should always be the maximum of the lower
# heap.
median = low_heap[0]... | code_fim | hard | {
"lang": "python",
"repo": "travisariggs/Algorithms",
"path": "/run_median_online.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: travisariggs/Algorithms path: /run_median_online.py
#!/usr/bin/python3
"""
Track the running median on a stream of integers
by Travis Riggs
"""
import heapq as hq
import heapq_max as hm
if __name__ == "__main__":
low_heap = []
high_heap = []
median = None
si... | code_fim | hard | {
"lang": "python",
"repo": "travisariggs/Algorithms",
"path": "/run_median_online.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fig = go.Figure(go.Scatter(x = test_score.groupby('level')['attempt'].mean() , y = ['level1','level2','level3','level4']),color = 'attempt')<|fim_prefix|># repo: Irarupa/C-107 path: /test.py
import pandas as pd
import plotly.graph_objects as go
import statistics
<|fim_middle|>test_read = pd.read_csv... | code_fim | medium | {
"lang": "python",
"repo": "Irarupa/C-107",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Irarupa/C-107 path: /test.py
import pandas as pd
import plotly.graph_objects as go
import statistics
<|fim_suffix|>fig = go.Figure(go.Scatter(x = test_score.groupby('level')['attempt'].mean() , y = ['level1','level2','level3','level4']),color = 'attempt')<|fim_middle|>test_read = pd.read_csv... | code_fim | medium | {
"lang": "python",
"repo": "Irarupa/C-107",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cyanlime/StudyPython path: /py/prime_num.py
def prime_number(min, max):
primenums = []
leap=1
<|fim_suffix|>if __name__ == "__main__":
min, max, primenums = prime_number(100, 200)
print 'prime number between %s and %s are %s' % (min, max, primenums)<|fim_middle|> for num in ra... | code_fim | hard | {
"lang": "python",
"repo": "cyanlime/StudyPython",
"path": "/py/prime_num.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
min, max, primenums = prime_number(100, 200)
print 'prime number between %s and %s are %s' % (min, max, primenums)<|fim_prefix|># repo: cyanlime/StudyPython path: /py/prime_num.py
def prime_number(min, max):
primenums = []
leap=1
<|fim_middle|> for num in ra... | code_fim | hard | {
"lang": "python",
"repo": "cyanlime/StudyPython",
"path": "/py/prime_num.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if node[1] != level:
level = node[1]
elif prev == node[0].val or ((node[0].val - prev > 0 and node[1] % 2 == 1) or
(node[0].val - prev < 0 and node[1] % 2 == 0)):
return False
prev = ... | code_fim | hard | {
"lang": "python",
"repo": "Infinidrix/competitive-programming",
"path": "/Take 2 Contests/Contest 4/q2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Infinidrix/competitive-programming path: /Take 2 Contests/Contest 4/q2.py
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "Infinidrix/competitive-programming",
"path": "/Take 2 Contests/Contest 4/q2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('movies/', views.MovieListView.as_view(), name='movieList'),
path('movies/create/', views.MovieCreateView.as_view(), name='movieDetails'),
path('movies/<int:pk>', views.MovieRetrieveUpdateDestroyView.as_view(), name='movieDetails')
]<|fim_prefix|># repo: rajdwivedi/fynd-im... | code_fim | easy | {
"lang": "python",
"repo": "rajdwivedi/fynd-imdb-task",
"path": "/movies/api/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rajdwivedi/fynd-imdb-task path: /movies/api/urls.py
from django.urls import include, path
<|fim_suffix|>urlpatterns = [
path('movies/', views.MovieListView.as_view(), name='movieList'),
path('movies/create/', views.MovieCreateView.as_view(), name='movieDetails'),
path('movies/<int:pk... | code_fim | easy | {
"lang": "python",
"repo": "rajdwivedi/fynd-imdb-task",
"path": "/movies/api/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == "POST":
form = UserCreationForm(request.POST)
if form.is_valid():
form.save()
else:
form = UserCreationForm
return render(request,"reg.html",{'form':form})<|fim_prefix|># repo: rakeshpati1722/django-registration_form path: /re... | code_fim | easy | {
"lang": "python",
"repo": "rakeshpati1722/django-registration_form",
"path": "/reg_form/app/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rakeshpati1722/django-registration_form path: /reg_form/app/views.py
from django.shortcuts import render,redirect
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.forms import User
from django.http import HttpResponse
# Create your views here.
<|fim_suffix|> ... | code_fim | easy | {
"lang": "python",
"repo": "rakeshpati1722/django-registration_form",
"path": "/reg_form/app/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># normal 과 abnormal 의 balance 을 맞춥니다
train_imgs = np.vstack([normal_train_imgs , abnormal_train_imgs ,abnormal_train_imgs,abnormal_train_imgs,\
abnormal_train_imgs,abnormal_train_imgs,abnormal_train_imgs])
train_labs = np.vstack([normal_train_labs , abnormal_train_labs ,abnormal_tr... | code_fim | hard | {
"lang": "python",
"repo": "SoulDuck/VGG",
"path": "/run_this_code_CACSSEOUL.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SoulDuck/VGG path: /run_this_code_CACSSEOUL.py
#-*- coding:utf-8 -*-
import model
import input
import os
import numpy as np
import argparse
import sys
import tensorflow as tf
import aug
import numpy as np
import random
from PIL import Image
import time
import pickle
parser =argparse.ArgumentPa... | code_fim | hard | {
"lang": "python",
"repo": "SoulDuck/VGG",
"path": "/run_this_code_CACSSEOUL.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>gp = gaussian_process.GaussianProcess(theta0=1e-2, regr="quadratic")
print "created model, now fitting"
gp.fit(X, y)
print "fitted model, now predicting"
tests = np.atleast_2d([
[1, 1, 1, 1, 1, 2, -1, -2, 1, 1, 0.25, 0],
[1, 1, 1, 1, 1, 2, -1, -2, 1, 1, 0.25, 1],
[1, 1, 1, 1, 1, 2, -1, -2, 1, ... | code_fim | hard | {
"lang": "python",
"repo": "benoit-girard/birdsong",
"path": "/architecture/tests/testGPs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benoit-girard/birdsong path: /architecture/tests/testGPs.py
import math
from architecture.components.hearing import Hearing
# cool, mfcc length = (time (in s) * 22050 / 512) + 1
def getMfccLen(audiolength):
out = math.floor((float(audiolength) * 22050 / 512) + 1)
return int(out)
# loa... | code_fim | hard | {
"lang": "python",
"repo": "benoit-girard/birdsong",
"path": "/architecture/tests/testGPs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pmercatoris/target-bigquery path: /target_bigquery/process.py
import json
import singer
from target_bigquery.processhandler import BaseProcessHandler
logger = singer.get_logger()
def process(
ProcessHandler,
tap_stream,
**kwargs
):
"""
For every line in tap_st... | code_fim | hard | {
"lang": "python",
"repo": "pmercatoris/target-bigquery",
"path": "/target_bigquery/process.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # determine whether this line is state, record or schema and handle it accordingly
if isinstance(msg, singer.RecordMessage):
for s in handler.handle_record_message(msg):
logger.info(f"Pushing state: {s}")
yield s
elif isinstance(msg, sin... | code_fim | hard | {
"lang": "python",
"repo": "pmercatoris/target-bigquery",
"path": "/target_bigquery/process.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chinawindofmay/multi-objective-optimization-NSGA2 path: /W_original_reference/004-python-spea2-nsga2-huadianzaza/non_dominated_sort_test.py
import random
import numpy as np
from matplotlib.ticker import MultipleLocator
import matplotlib.pyplot as plt
class Test_class():
def __init__(self,... | code_fim | hard | {
"lang": "python",
"repo": "chinawindofmay/multi-objective-optimization-NSGA2",
"path": "/W_original_reference/004-python-spea2-nsga2-huadianzaza/non_dominated_sort_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def output_fronts(self, fronts):
# test code
sum_coun = 0
for kk in range(len(fronts)):
sum_coun += len(fronts[kk])
print(sum_coun)
print(fronts)
def test_fast_non_dominated_sort_2(self, objectives_fitness):
#对Github Haris Ali Khan写的NSGA... | code_fim | hard | {
"lang": "python",
"repo": "chinawindofmay/multi-objective-optimization-NSGA2",
"path": "/W_original_reference/004-python-spea2-nsga2-huadianzaza/non_dominated_sort_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>i = 0
for item in itertools.count(start=0, step=60):
i += 1
if i > 10: break
print(item)<|fim_prefix|># repo: Ghongfei/python_script path: /test.py
# from urllib.request import HTTPHandler, build_opener
# from collections import namedtuple
#
#
# Respone = namedtuple('Respone',... | code_fim | medium | {
"lang": "python",
"repo": "Ghongfei/python_script",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ghongfei/python_script path: /test.py
# from urllib.request import HTTPHandler, build_opener
# from collections import namedtuple
#
#
# Respone = namedtuple('Respone',
# field_names = ['headers','code','text','body'])
#
#
# def get(url):
# opener = build_opener(H... | code_fim | medium | {
"lang": "python",
"repo": "Ghongfei/python_script",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for item in itertools.count(start=0, step=60):
i += 1
if i > 10: break
print(item)<|fim_prefix|># repo: Ghongfei/python_script path: /test.py
# from urllib.request import HTTPHandler, build_opener
# from collections import namedtuple
#
#
# Respone = namedtuple('Respone',
# ... | code_fim | medium | {
"lang": "python",
"repo": "Ghongfei/python_script",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: markurtz/sparsezoo path: /src/sparsezoo/nbutils/utils.py
# Copyright (c) 2021 - present / Neuralmagic, 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 the Li... | code_fim | hard | {
"lang": "python",
"repo": "markurtz/sparsezoo",
"path": "/src/sparsezoo/nbutils/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _repos_change(change):
self._selected_domain = change["new"]
_invoke_callback()
def _datasets_change(change):
self._selected_dataset = change["new"]
_invoke_callback()
self._recal_checkbox.observe(_recal_change, names="value")
... | code_fim | hard | {
"lang": "python",
"repo": "markurtz/sparsezoo",
"path": "/src/sparsezoo/nbutils/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _recal_change(change):
_invoke_callback()
def _repos_change(change):
self._selected_domain = change["new"]
_invoke_callback()
def _datasets_change(change):
self._selected_dataset = change["new"]
_invoke_callback()
... | code_fim | hard | {
"lang": "python",
"repo": "markurtz/sparsezoo",
"path": "/src/sparsezoo/nbutils/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vexxen/webDevProject path: /mySite/myApp/models.py
from django.db import models
# Create your models here.
class Suggestion_Model(models.Model):
suggestion = models.CharField(max_length=240)
#author = models.CharField(max_length=240, default="sean")
def __str__(self):
<|fim_suffix|>#... | code_fim | medium | {
"lang": "python",
"repo": "Vexxen/webDevProject",
"path": "/mySite/myApp/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># class Comment_Model(models.Model):
# comment = models.CharField(max_length=240)
# author = models.ForeignKey(User, on_delete=models.CASCADE)
# suggestion = models.ForeignKey(SuggestionModel, on_delete=models.CASCADE)
# published_on = models.DateTimeField(auto_now_add=True)
# def __s... | code_fim | medium | {
"lang": "python",
"repo": "Vexxen/webDevProject",
"path": "/mySite/myApp/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Asta2022/kuzaku path: /bot/cogs/moderation.py
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from discord_slash.utils.manage_commands import create_permission
from discord_slash.model import SlashCommandPermissionType
from discord_slash.utils.manage_compone... | code_fim | hard | {
"lang": "python",
"repo": "Asta2022/kuzaku",
"path": "/bot/cogs/moderation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> embed = discord.Embed(color=0x00ff00,
description=f'Пользователь {member.mention} забанен!\nПричина: {reason}.')
embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url)
embed.set_footer(text=f'{ctx.author} | kuzaku#2021')
await button_ctx.sen... | code_fim | hard | {
"lang": "python",
"repo": "Asta2022/kuzaku",
"path": "/bot/cogs/moderation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ankitshah009/Tacotron-2 path: /models/modules.py
if gru_impl == GRUImpl.GRUCell:
cell = tf.nn.rnn_cell.GRUCell(num_units)
return cell
elif gru_impl == GRUImpl.GRUBlockCellV2:
cell = tf.contrib.rnn.GRUBlockCellV2(num_units)
return cell
else:
raise Va... | code_fim | hard | {
"lang": "python",
"repo": "ankitshah009/Tacotron-2",
"path": "/models/modules.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Encoder convolutional layers used to find local dependencies in inputs characters.
"""
def __init__(self, is_training, kernel_size=(5,), channels=128, num_layers=3, drop_rate=0.5,
activation=tf.nn.relu,
name=None):
"""
Args:
is_... | code_fim | hard | {
"lang": "python",
"repo": "ankitshah009/Tacotron-2",
"path": "/models/modules.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ankitshah009/Tacotron-2 path: /models/modules.py
l.LSTMCell:
cell = tf.nn.rnn_cell.LSTMCell(num_units)
return cell
elif lstm_impl == LSTMImpl.LSTMBlockCell:
cell = tf.contrib.rnn.LSTMBlockCell(num_units)
return cell
else:
raise ValueError(f"Unknown ... | code_fim | hard | {
"lang": "python",
"repo": "ankitshah009/Tacotron-2",
"path": "/models/modules.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CategoryViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows Categories to be viewed and edited
"""
queryset = TouristSpotCategory.objects.all().order_by('name')
serializer_class = CategorySerializer
permission_classes = [permissions.IsAuthenticatedOrReadOnly]<|fim_pr... | code_fim | medium | {
"lang": "python",
"repo": "LuanComputacao/bomrole_api",
"path": "/api/views/category.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LuanComputacao/bomrole_api path: /api/views/category.py
from rest_framework import viewsets, permissions
from api.models import TouristSpotCategory
from api.serializers import CategorySerializer
<|fim_suffix|> """
API endpoint that allows Categories to be viewed and edited
"""
q... | code_fim | easy | {
"lang": "python",
"repo": "LuanComputacao/bomrole_api",
"path": "/api/views/category.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for daily_activity in user_data['activities']:
if daily_activity['type'] != 'daily':
continue
if not month_to_process in daily_activity['created_at']:
continue
total_tacos += daily_activity['total_tacos']
for entry in daily_activity['entries']... | code_fim | hard | {
"lang": "python",
"repo": "thewarpaint/tacokeeper.com",
"path": "/twitter-bot/process_monthly_activity.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not entry['category'] in categories:
categories[entry['category']] = 0
categories[entry['category']] += entry['amount']
return {
'summary': {
'month': get_readable_month(month_to_process),
'total_categories': len(categories),... | code_fim | hard | {
"lang": "python",
"repo": "thewarpaint/tacokeeper.com",
"path": "/twitter-bot/process_monthly_activity.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thewarpaint/tacokeeper.com path: /twitter-bot/process_monthly_activity.py
#!/usr/bin/env python
# encoding: utf-8
from datetime import date, datetime
import locale
import tweepy
import sys
from tweepy_helper import get_api
from yaml_helper import dump_user_data, load_user_data
tweet_content = ... | code_fim | hard | {
"lang": "python",
"repo": "thewarpaint/tacokeeper.com",
"path": "/twitter-bot/process_monthly_activity.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: forero/fiberassign_explore path: /global_density.py
import desimodel.footprint
from astropy.table import Table
import matplotlib.pyplot as plt
import numpy as np
def write_dens(filetype='std'):
files = {"targets": "/global/cscratch1/sd/forero/testfiber/dark_large/mtl_large.fits",
"... | code_fim | hard | {
"lang": "python",
"repo": "forero/fiberassign_explore",
"path": "/global_density.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # trim the data
ii = desimodel.footprint.is_point_in_desi(tiles, data['RA'], data['DEC'])
data = data[ii]
# write the data
n_tiles = len(tiles)
for i in range(n_tiles):
f = open(outfile, 'a')
f.write('{}\t{:.2f}\t{:.2f}\t'.format(tiles[i]['TILEID'], tiles[i]['... | code_fim | hard | {
"lang": "python",
"repo": "forero/fiberassign_explore",
"path": "/global_density.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MauroCominotti/ucse_ia path: /2021/criptoaritmetica.py
from itertools import combinations
from simpleai.search import CspProblem, backtrack
# F c2 c1
# T W O
# + T W O
# -------------
# F O U R
letters = [
"T",
"W",
"O",
"F",
"U",
"R",
]
carries = [
... | code_fim | hard | {
"lang": "python",
"repo": "MauroCominotti/ucse_ia",
"path": "/2021/criptoaritmetica.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
constraints = []
# restriction: all letters have different digits
def letters_are_different(variables, values):
# ej:
# variables = ("T", "W")
# values = (5, 8)
digit1, digit2 = values
return digit1 != digit2
for letter1, letter2 in combinations(letters, 2):
constraints.appen... | code_fim | hard | {
"lang": "python",
"repo": "MauroCominotti/ucse_ia",
"path": "/2021/criptoaritmetica.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> value_o, value_r, value_c1 = values
return value_o + value_o == value_c1 * 10 + value_r
constraints.append(
(("O", "R", "c1"), last_column_sum)
)
# restriction: middle column sum works
# restriction: first column sum works
def normal_column_sum(variables, values):
value_c_in, value_sum... | code_fim | hard | {
"lang": "python",
"repo": "MauroCominotti/ucse_ia",
"path": "/2021/criptoaritmetica.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># We import our methods
import key
def start_car (source=False, args=False, search=False) :
form = cgi.FieldStorage()
# If there are vars:
if source != False and args != False:
# We launch the fonction with present datas
return key.processRefresh(source,args)
elif source != False:
# We launch ... | code_fim | medium | {
"lang": "python",
"repo": "bopopescu/canopsis-edc",
"path": "/lib/edc_lib/motor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def start_car (source=False, args=False, search=False) :
form = cgi.FieldStorage()
# If there are vars:
if source != False and args != False:
# We launch the fonction with present datas
return key.processRefresh(source,args)
elif source != False:
# We launch the function
return key.processRef... | code_fim | medium | {
"lang": "python",
"repo": "bopopescu/canopsis-edc",
"path": "/lib/edc_lib/motor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bopopescu/canopsis-edc path: /lib/edc_lib/motor.py
#!/usr/bin/env python
# Init the treatment on the webservice call
"""
We get the source called by a webservice in a POST var
"""
# We import the CGI library for HTTP vars
import cgi
<|fim_suffix|> form = cgi.FieldStorage()
# If there are var... | code_fim | medium | {
"lang": "python",
"repo": "bopopescu/canopsis-edc",
"path": "/lib/edc_lib/motor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gongfranksh/bn_2dfire path: /odoofile/addons/bn_newplaza/models/Entity/Plan.py
# -*- coding: utf-8 -*-
from .BnEntity import BnEntity
class Plan(BnEntity):
def __init__(self):
BnEntity.__init__(self)
<|fim_suffix|>
sql = "select lngshopid, strplanid,strresourcename,lngreso... | code_fim | hard | {
"lang": "python",
"repo": "gongfranksh/bn_2dfire",
"path": "/odoofile/addons/bn_newplaza/models/Entity/Plan.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_ShopPlanHyMonth(self):
sql = """
select lngshopid,lngplantype,strHyYear,strHyMonths
from Pm_ShopPlanHyMonth
"""
# print(sql)
rst = self.get_remote_result_by_sql(sql)
return rst<|fim_prefix|># repo: gongfranksh/bn_2dfire path: /o... | code_fim | hard | {
"lang": "python",
"repo": "gongfranksh/bn_2dfire",
"path": "/odoofile/addons/bn_newplaza/models/Entity/Plan.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return np.exp(-x)-x
def gx(x):
return np.exp(-x)
tolerancia=0.0001
xi=0
error=np.abs(gx(xi)-xi)
i=0
while(error>tolerancia and i<=100):
print(i,' xi=',xi,' f(xi)=',fx(xi),' g(xi)=',gx(xi),' error V=',error)
if i >0:
error=np.abs(gx(xi)-xi)
... | code_fim | medium | {
"lang": "python",
"repo": "josedejesus01/metodo-de_aproximaciones_sucesivas",
"path": "/metodo de punto fijo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: josedejesus01/metodo-de_aproximaciones_sucesivas path: /metodo de punto fijo.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 10 17:16:38 2021
@author: JOSE
"""
import numpy as np
import matplotlib.pyplot as plt
def fx(x):
return np.exp(-x)-x
def gx(x):
<|fim_suffix|>x=np.lin... | code_fim | hard | {
"lang": "python",
"repo": "josedejesus01/metodo-de_aproximaciones_sucesivas",
"path": "/metodo de punto fijo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r'^date$', views.date_actuelle),
url(r'^addition/(?P<nombre1>\d+)/(?P<nombre2>\d+)/$', views.addition),
url(r'^articles$', views.article_liste),
url(r'^index$', views.index),
]<|fim_prefix|># repo: SekObs/First-project path: /blog/urls.py
from django.conf.urls import u... | code_fim | easy | {
"lang": "python",
"repo": "SekObs/First-project",
"path": "/blog/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SekObs/First-project path: /blog/urls.py
from django.conf.urls import url
<|fim_suffix|>urlpatterns = [
url(r'^date$', views.date_actuelle),
url(r'^addition/(?P<nombre1>\d+)/(?P<nombre2>\d+)/$', views.addition),
url(r'^articles$', views.article_liste),
url(r'^index$', views.index... | code_fim | easy | {
"lang": "python",
"repo": "SekObs/First-project",
"path": "/blog/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>admin.site.register(Cdr, CdrAdmin)
#admin.site.register(Conf, CdrConfAdmin)<|fim_prefix|># repo: mehulsbhatt/fsa path: /fsa/cdr/admin.py
# -*- mode: python; coding: utf-8; -*-
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from fsa.cdr.models import Cdr
admin.s... | code_fim | hard | {
"lang": "python",
"repo": "mehulsbhatt/fsa",
"path": "/fsa/cdr/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mehulsbhatt/fsa path: /fsa/cdr/admin.py
# -*- mode: python; coding: utf-8; -*-
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from fsa.cdr.models import Cdr
admin.site.disable_action('delete_selected')
<|fim_suffix|>
admin.site.register(Cdr, CdrAdmin)
... | code_fim | hard | {
"lang": "python",
"repo": "mehulsbhatt/fsa",
"path": "/fsa/cdr/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print("Recieved: ", data.playerBody)
print("Sending: ", reply.playerBody)
conn.sendall(pickle.dumps(reply))
except Exception as e:
print(e)
break
print("Lost connection")
conn.close()
currentPlayer = 0
while True:... | code_fim | hard | {
"lang": "python",
"repo": "MuhammadMahad/Multiplayer-Snake-Game-Scalable-To-Infinite-Players",
"path": "/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MuhammadMahad/Multiplayer-Snake-Game-Scalable-To-Infinite-Players path: /server.py
import socket
from _thread import *
import sys
import pickle
from Block import block
from Player import player
server = "192.168.100.8"#"192.168.100.23"192.168.100.10
port = 5555
s = socket.socket(socket.AF_INET,... | code_fim | hard | {
"lang": "python",
"repo": "MuhammadMahad/Multiplayer-Snake-Game-Scalable-To-Infinite-Players",
"path": "/server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
conn.sendall(pickle.dumps(reply))
except Exception as e:
print(e)
break
print("Lost connection")
conn.close()
currentPlayer = 0
while True:
conn, addr = s.accept() #accepts connection and stores the ip address of the connection
print("Connecte... | code_fim | hard | {
"lang": "python",
"repo": "MuhammadMahad/Multiplayer-Snake-Game-Scalable-To-Infinite-Players",
"path": "/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RaviAchanti/PySci path: /PySci/PythonTest1/vector.py
from collections import Counter
from elasticsearch import Elasticsearch
es = Elasticsearch(['http://ffqrdev_writer:Heechou1@esgen01deva04:9201'],verify=False)
#if not es.ping():
# res= es.search(index="logs" ,doc_type = "performance",body={"... | code_fim | hard | {
"lang": "python",
"repo": "RaviAchanti/PySci",
"path": "/PySci/PythonTest1/vector.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
port = 7001 #the custom port you want
app.run(host='127.0.0.1', port=port)
#Someone named TOM TAYLOR to play JAKE CHAMBERS in THE DARK TOWER.
#[
#0.06066217300000001,
#0.06825315824999999,
#0.07663112727272726,
#0.05768009730769231,
#0.06382067525,
#0.0637208,
#0.06448... | code_fim | hard | {
"lang": "python",
"repo": "RaviAchanti/PySci",
"path": "/PySci/PythonTest1/vector.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kassadinsw/MaliciousDomainDetection path: /Feature.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:Kcr1Mso
# datetime:2019-11-05 15:47
# software:PyCharm
import function,re,math
import HMM
# def alexa(domain):
# #alexa排名
# file = open('WhiteList.csv', mode='r', encoding='utf-8'... | code_fim | hard | {
"lang": "python",
"repo": "Kassadinsw/MaliciousDomainDetection",
"path": "/Feature.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(list) == 0:
list.append(i)
elif i == list[0]:
list.append(i)
else:
#print(list)
curmaxlen = len(list)
list = []
list.append(i)
if curmaxlen > maxlen:
maxlen = curmaxlen
... | code_fim | hard | {
"lang": "python",
"repo": "Kassadinsw/MaliciousDomainDetection",
"path": "/Feature.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(len(str)):
if str[i] in vowel:
index.append(i)
index.append(len(str))
#print(index)
for i in range(len(index) - 1):
length = index[i + 1] - index[i] - 1
if length > maxlen:
maxlen = length
return maxlen
def entro... | code_fim | hard | {
"lang": "python",
"repo": "Kassadinsw/MaliciousDomainDetection",
"path": "/Feature.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='boardlist',
name='id',
field=models.AutoField(db_column='NO', primary_key=True, serialize=False),
),
]<|fim_prefix|># repo: Rrojin11/Prography path: /DRF_Board/board/board_main/migrations/0006_au... | code_fim | medium | {
"lang": "python",
"repo": "Rrojin11/Prography",
"path": "/DRF_Board/board/board_main/migrations/0006_auto_20200303_1151.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rrojin11/Prography path: /DRF_Board/board/board_main/migrations/0006_auto_20200303_1151.py
# Generated by Django 2.1.2 on 2020-03-03 02:51
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='boardlist',
nam... | code_fim | medium | {
"lang": "python",
"repo": "Rrojin11/Prography",
"path": "/DRF_Board/board/board_main/migrations/0006_auto_20200303_1151.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('board_main', '0005_auto_20200303_1127'),
]
operations = [
migrations.AlterField(
model_name='boardlist',
name='id',
field=models.AutoField(db_column='NO', primary_key=True, serialize=False),
),
]<|fim_prefix|>#... | code_fim | easy | {
"lang": "python",
"repo": "Rrojin11/Prography",
"path": "/DRF_Board/board/board_main/migrations/0006_auto_20200303_1151.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for(x,y,w,h) in faces:
area = w*h
if area>10000:
cv2.rectangle(img2,(x,y),(x+w,y+h),color,2)
cv2.putText(img2,"Detected:"+str(int(faces.size/4)),(0,20),font,0.7,color,2)
imgRegOfInt = img[y:y+h,x:x+w]
cv2.imshow("Result",img2)
if cv2.waitKey(1) & 0xFF ==ord('s'):
try:
cv2.imwrite("O... | code_fim | medium | {
"lang": "python",
"repo": "kartikeysingh6/OpenCVProjects",
"path": "/NumPlateDetector/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> cv2.imshow("Result",img2)
if cv2.waitKey(1) & 0xFF ==ord('s'):
try:
cv2.imwrite("Output_"+str(count)+".jpg",imgRegOfInt)
cv2.rectangle(img2,(0,200),(640,300),(0,255,0),cv2.FILLED)
cv2.putText(img2,"Snapshot Saved!",(150,265),cv2.FONT_HERSHEY_DUPLEX,1,(255,255,255),2)
cv2.imshow("Result",i... | code_fim | hard | {
"lang": "python",
"repo": "kartikeysingh6/OpenCVProjects",
"path": "/NumPlateDetector/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kartikeysingh6/OpenCVProjects path: /NumPlateDetector/main.py
import cv2
import random
faceCascade = cv2.CascadeClassifier("haarcascade_russian_plate_number.xml")
vdo=cv2.VideoCapture(0, cv2.CAP_DSHOW)
vdo.set(4,480)
vdo.set(10,100)
color = (0,0,255)
font = cv2.FONT_HERSHEY_SIMPLEX
count = 0
<|... | code_fim | medium | {
"lang": "python",
"repo": "kartikeysingh6/OpenCVProjects",
"path": "/NumPlateDetector/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emotionrobots/sandbox path: /aurash/landmarking/dlibpython.py
#!/usr/bin/python
# The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
#
# This example program shows how to find frontal human faces in an image and
# estimate their pose. The pose takes the ... | code_fim | hard | {
"lang": "python",
"repo": "emotionrobots/sandbox",
"path": "/aurash/landmarking/dlibpython.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(predictor_path)
win = dlib.image_window()
video_capture = cv2.VideoCapture(0)
start=time.time()
count=0
while True:
# Capture frame-by-frame
ret, img = video_capture.read()
count=count+1
fps=count/(time.time()-... | code_fim | hard | {
"lang": "python",
"repo": "emotionrobots/sandbox",
"path": "/aurash/landmarking/dlibpython.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shreyagg2202/Python path: /Learning Python/system defined funtions.py
import datetime
print("Current date and time : ",datetime.datetime.now()
print("Current<|fim_suffix|>now())
print("Current date and time : ",datetime.datetime.now())
print("Current date and time : ",datetime.datetime.now(... | code_fim | medium | {
"lang": "python",
"repo": "shreyagg2202/Python",
"path": "/Learning Python/system defined funtions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>now())
print("Current date and time : ",datetime.datetime.now())
print("Current date and time : ",datetime.datetime.now())
print("Current date and time : ",datetime.datetime.now())<|fim_prefix|># repo: shreyagg2202/Python path: /Learning Python/system defined funtions.py
import datetime
print("Curr... | code_fim | medium | {
"lang": "python",
"repo": "shreyagg2202/Python",
"path": "/Learning Python/system defined funtions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.text = text
self.style = style
self.article_id = articleid
self.img_id = imageid
self.order_nr = ordernr
def __repr__(self):
return '<Paragraph %r>' % self.text<|fim_prefix|># repo: gilyazev94/MyCampusNewsAPI path: /app/model/paragraph.py
from .db ... | code_fim | medium | {
"lang": "python",
"repo": "gilyazev94/MyCampusNewsAPI",
"path": "/app/model/paragraph.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gilyazev94/MyCampusNewsAPI path: /app/model/paragraph.py
from .db import db
class Paragraph(db.Model):
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.String(2000), unique=False)
style = db.Column(db.String(120), unique=False)
article_id = db.Column(db.Integer, ... | code_fim | medium | {
"lang": "python",
"repo": "gilyazev94/MyCampusNewsAPI",
"path": "/app/model/paragraph.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> args, opt = parse(['s|srv|1', 'p|port|1'])
srvIp = opt['srv'] if 'srv' in opt else "3.3.3.3"
port = int(opt['port']) if 'port' in opt else 9000
sd = socket.socket(type=socket.SOCK_DGRAM)
addr = (srvIp, port)
packet = Packet(sd)
while True:
... | code_fim | hard | {
"lang": "python",
"repo": "Dituohgasirre/python",
"path": "/python-1025/python/a_socket/3_ssh/cli.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dituohgasirre/python path: /python-1025/python/a_socket/3_ssh/cli.py
#!/usr/bin/env python3
import socket
from pargs import parse
from net import Packet
<|fim_suffix|> while True:
cmd = input("<自己的网络SHELL>: ")
packet.send(cmd, addr, Packet.DATA)
if c... | code_fim | hard | {
"lang": "python",
"repo": "Dituohgasirre/python",
"path": "/python-1025/python/a_socket/3_ssh/cli.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>prev_viterbi=viterbi[-1]
best_previous=max(prev_viterbi,key=lambda prevtag:prev_viterbi[prevtag]*\
cpd_tags[prevtag].prob("END"))
prob_tagsequence=prev_viterbi[best_previous]*cpd_tags[best_previous].prob("END")
best_tagsequence = ["END", best_previous]
backpointer.reverse()
current_best... | code_fim | hard | {
"lang": "python",
"repo": "EvelynZhou/NLP",
"path": "/myHMM.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EvelynZhou/NLP path: /myHMM.py
import nltk
from nltk.corpus import brown
brown_tags_words=[]
for sent in brown.tagged_sents():
brown_tags_words.append(("START","START"))
brown_tags_words.extend([(tag[:2],word) for (word,tag) in sent])
brown_tags_words.append(("END","END"))
... | code_fim | hard | {
"lang": "python",
"repo": "EvelynZhou/NLP",
"path": "/myHMM.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>current_best_tag = best_previous
for bp in backpointer:
best_tagsequence.append(bp[current_best_tag])
current_best_tag = bp[current_best_tag]
best_tagsequence.reverse()
print("The sentence was:"),
for w in sentence: print(w)
print("\n")
print("The best tag sequence is:"),
for t in b... | code_fim | hard | {
"lang": "python",
"repo": "EvelynZhou/NLP",
"path": "/myHMM.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TonyKat/FindLightnings path: /find_in_instagram/urls.py
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import url
from . import views
<|fim_suffix|>urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_middle|>urlpatt... | code_fim | hard | {
"lang": "python",
"repo": "TonyKat/FindLightnings",
"path": "/find_in_instagram/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: TonyKat/FindLightnings path: /find_in_instagram/urls.py
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import url
from . import views
<|fim_middle|>urlpatt... | code_fim | hard | {
"lang": "python",
"repo": "TonyKat/FindLightnings",
"path": "/find_in_instagram/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>d_argument('product_id', required=True, type=int)
parser.add_argument('score', required=True, type=int)<|fim_prefix|># repo: PereverzevIvan/Project-PixelO path: /data/parsers/news_reqparse.py
# Парсер для ресурсов отзывов
from flask_restful import reqparse
parser = reqparse.RequestParser()
pa<|fim_middl... | code_fim | hard | {
"lang": "python",
"repo": "PereverzevIvan/Project-PixelO",
"path": "/data/parsers/news_reqparse.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.