text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: rsimari/secure_import path: /src/secure_build.py """ Securely wraps a module so it can be securely imported """ from crypto_utils import * # TODO: to make this many functions or one with many options? <|fim_suffix|> # check if key exists, if not generate a key pair private_key, public_key = l...
code_fim
hard
{ "lang": "python", "repo": "rsimari/secure_import", "path": "/src/secure_build.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for s in sentences: n = nlp(s) print('Sentence:', s) if n._.has_coref: print('The sentence has coref.') print('The coref clusters:') print(n._.coref_clusters, '\n') else: print('The sentence has no coref.\n')<|fim_prefix|># repo: Krazymud/NLP-class ...
code_fim
hard
{ "lang": "python", "repo": "Krazymud/NLP-class", "path": "/semantic/nlp_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Krazymud/NLP-class path: /semantic/nlp_test.py import spacy nlp = spacy.load('en') # Add neural coref to SpaCy's pipe import neuralcoref neuralcoref.add_to_pipe(nlp) <|fim_suffix|>for s in sentences: n = nlp(s) print('Sentence:', s) if n._.has_coref: print('The se...
code_fim
hard
{ "lang": "python", "repo": "Krazymud/NLP-class", "path": "/semantic/nlp_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gianacuratemedia/acurate_sistemas2 path: /knowtured/Selecciona_k/serializers.py from rest_framework import serializers from .models import Selecciona class SeleccionaSerializer(serializers.ModelSerializer): <|fim_suffix|> model = Selecciona fields = ('pk','categoria')<|fim_...
code_fim
easy
{ "lang": "python", "repo": "gianacuratemedia/acurate_sistemas2", "path": "/knowtured/Selecciona_k/serializers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model = Selecciona fields = ('pk','categoria')<|fim_prefix|># repo: gianacuratemedia/acurate_sistemas2 path: /knowtured/Selecciona_k/serializers.py from rest_framework import serializers from .models import Selecciona class SeleccionaSerializer(serializers.ModelSerializer): <|fim_mi...
code_fim
easy
{ "lang": "python", "repo": "gianacuratemedia/acurate_sistemas2", "path": "/knowtured/Selecciona_k/serializers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def validate_only_country_drop_down_visible(self): assert (not self.browser.find_by_id('id_organization').visible) assert (not self.browser.find_by_id('id_region').visible) assert (self.browser.is_element_present_by_id('id_country'))<|fim_prefix|># repo: eJRF/ejrf path: /quest...
code_fim
hard
{ "lang": "python", "repo": "eJRF/ejrf", "path": "/questionnaire/features/pages/users.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: eJRF/ejrf path: /questionnaire/features/pages/users.py from lettuce import world from questionnaire.features.pages.base import PageObject from questionnaire.features.pages.home import HomePage class LoginPage(PageObject): url = "/accounts/login/" def login(self, user, password): ...
code_fim
medium
{ "lang": "python", "repo": "eJRF/ejrf", "path": "/questionnaire/features/pages/users.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> details = {'username': user.username, 'password': password,} self.browser.fill_form(details) self.submit() def links_present_by_text(self, links_text): for text in links_text: assert self.browser.find_link_by_text(text) class UserListin...
code_fim
medium
{ "lang": "python", "repo": "eJRF/ejrf", "path": "/questionnaire/features/pages/users.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class StudentAdmin(admin.ModelAdmin): list_display = ('user',) search_fields = ('id', 'user__username') ordering = ['user'] admin.site.register(Student, StudentAdmin) class AnswerInline(admin.StackedInline): model = Answer @admin.register(Question) class QuestionAdmin(admin.ModelAdm...
code_fim
hard
{ "lang": "python", "repo": "FormedFlow/eer", "path": "/main/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FormedFlow/eer path: /main/admin.py from django.contrib import admin # Register your models here. from .models import * class ProgressAdmin(admin.ModelAdmin): list_display = ('student', 'question', 'right') search_fields = ('student__user__username', 'question__text') admin.site.reg...
code_fim
medium
{ "lang": "python", "repo": "FormedFlow/eer", "path": "/main/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model = Answer @admin.register(Question) class QuestionAdmin(admin.ModelAdmin): inlines = [ AnswerInline, ] list_display = ('text', 'type', 'lesson') search_fields = ('text', 'lesson__title', 'type') # ordering = ['text', 'type']<|fim_prefix|># repo: FormedFlow/eer path...
code_fim
hard
{ "lang": "python", "repo": "FormedFlow/eer", "path": "/main/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hhwxxx/mask_regression path: /dataset_tools/set_order.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import shutil import ast import pandas as pd import numpy as np CSV_PATH = '/data/mask/mask_data/quadrilateral_2' SAVE...
code_fim
hard
{ "lang": "python", "repo": "hhwxxx/mask_regression", "path": "/dataset_tools/set_order.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # set the order of quadrilaterals. if len(top_left_height) > 1: height_list = list(zip(top_left_height, top_right_height)) width_list = list(zip(top_left_width, bottom_left_width)) threshold = 20 """ if min(height_list[0]) > min(...
code_fim
hard
{ "lang": "python", "repo": "hhwxxx/mask_regression", "path": "/dataset_tools/set_order.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#myecube = pi3d.EnvironmentCube(900.0,"HALFCROSS") ectex=pi3d.loadECfiles("textures/ecubes","sbox") myecube = pi3d.EnvironmentCube(size=900.0, maptype="FACES", name="cube") myecube.set_draw_details(flatsh, ectex) # Create elevation map mapsize = 1000.0 mapheight = 60.0 mountimg1 = pi3d.Texture("t...
code_fim
hard
{ "lang": "python", "repo": "talhaibnaziz/projects", "path": "/pi3ddemos/ForestStereo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Display scene and rotate cuboid while DISPLAY.loop_running(): l_or_k_pressed = False # to stop routine camera movement for cases where l or k pressed #Press ESCAPE to terminate k = mykeys.read() if k >-1: # or buttons > mymouse.BUTTON_UP: dx, dy, dz = CAMERA.get_direction() if k =...
code_fim
hard
{ "lang": "python", "repo": "talhaibnaziz/projects", "path": "/pi3ddemos/ForestStereo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zlyuzhi/C2B path: /Buybuybuy/Buybuybuy/apps/users/views.py from django.shortcuts import render # Create your views here. from rest_framework.generics import GenericAPIView from rest_framework.views import APIView class SMSCodeView(APIView): <|fim_suffix|> pass class SMSCodeView(GenericA...
code_fim
easy
{ "lang": "python", "repo": "zlyuzhi/C2B", "path": "/Buybuybuy/Buybuybuy/apps/users/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get(self,request,mobile): pass class SMSCodeView(GenericAPIView): pass<|fim_prefix|># repo: zlyuzhi/C2B path: /Buybuybuy/Buybuybuy/apps/users/views.py from django.shortcuts import render <|fim_middle|># Create your views here. from rest_framework.generics import GenericAPIView from r...
code_fim
medium
{ "lang": "python", "repo": "zlyuzhi/C2B", "path": "/Buybuybuy/Buybuybuy/apps/users/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pershint/ANNIEGridControl path: /lib/TextSweeper.py import json import glob import os import ArgParser as ap class TextSweeper(object): ''' Class for replacing text in text files in different ways. Input: scandict (dictionary) Dictionary used to inform what text to replace i...
code_fim
hard
{ "lang": "python", "repo": "pershint/ANNIEGridControl", "path": "/lib/TextSweeper.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def OpenJSON(self,loc): with open(loc,"r") as f: self.scandict = json.load(loc) print("SCANDICT IS: " + str(self.scandict)) def ReplaceInFile(self,infile,outfile): '''Given an input file, open the file and replace any keys in the scandict object wit...
code_fim
hard
{ "lang": "python", "repo": "pershint/ANNIEGridControl", "path": "/lib/TextSweeper.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>try: GameLoop() except KeyboardInterrupt: # If CTRL+C is pressed, exit cleanly: print ("\t\tGoodbye\n")<|fim_prefix|># repo: TakezoCan/rpgGame path: /Takezo_RPG/battle_test.py import random import time from utilities import util from Characters import get_name from Characters import weapons f...
code_fim
hard
{ "lang": "python", "repo": "TakezoCan/rpgGame", "path": "/Takezo_RPG/battle_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TakezoCan/rpgGame path: /Takezo_RPG/battle_test.py import random import time from utilities import util from Characters import get_name from Characters import weapons from Characters import player from Story import battle1 from Story import battle2 def GameLoop(): <|fim_suffix|>try: GameLo...
code_fim
hard
{ "lang": "python", "repo": "TakezoCan/rpgGame", "path": "/Takezo_RPG/battle_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: toufiqur-rahman/strativ_task path: /core/migrations/0003_alter_language_iso639_1.py from django.db import migrations, models <|fim_suffix|> dependencies = [ ('core', '0002_remove_country_neighbouring'), ] operations = [ migrations.AlterField( model_name='l...
code_fim
easy
{ "lang": "python", "repo": "toufiqur-rahman/strativ_task", "path": "/core/migrations/0003_alter_language_iso639_1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('core', '0002_remove_country_neighbouring'), ] operations = [ migrations.AlterField( model_name='language', name='iso639_1', field=models.CharField(max_length=2, null=True), ), ]<|fim_prefix|># repo: toufiqur-ra...
code_fim
easy
{ "lang": "python", "repo": "toufiqur-rahman/strativ_task", "path": "/core/migrations/0003_alter_language_iso639_1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='language', name='iso639_1', field=models.CharField(max_length=2, null=True), ), ]<|fim_prefix|># repo: toufiqur-rahman/strativ_task path: /core/migrations/0003_alter_language_iso639_1.py from dja...
code_fim
medium
{ "lang": "python", "repo": "toufiqur-rahman/strativ_task", "path": "/core/migrations/0003_alter_language_iso639_1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TAJD/workout_app path: /utils.py import numpy as np import pandas as pd import datetime as dt def excel_to_csv_tables() -> None: # handle the absence of the excel file when uploaded to server try: workout_excel = pd.ExcelFile("workout.xlsx") df_reps = workout_excel.parse...
code_fim
hard
{ "lang": "python", "repo": "TAJD/workout_app", "path": "/utils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def weekly_total_table() -> pd.DataFrame: df = prep_spreadsheet_data() weekly_totals = quantity_per_week(df) reshaped_weekly_totals = weekly_totals.pivot( index="WeekStartDate", columns="Movement type", values="value" ) return reshaped_weekly_totals if __name__ == "__main__"...
code_fim
hard
{ "lang": "python", "repo": "TAJD/workout_app", "path": "/utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vasantteja/dummy-python-scripts path: /test3.py #2.Find all such numbers divisible by 7, but not a multiple of 5, between 2000 and 3200 (inclusive). The numbers obtained should be printed on a single line in a comma-separated sequence. """ ipadress = input() nodes = ipadress.split(".") nodes.pop(...
code_fim
medium
{ "lang": "python", "repo": "vasantteja/dummy-python-scripts", "path": "/test3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>""" words = input("Enter sequence of words separated by whitespace: ").split(' ') words_set = set(words) print(' '.join(sorted(words_set))) #print(words_set) """<|fim_prefix|># repo: vasantteja/dummy-python-scripts path: /test3.py #2.Find all such numbers divisible by 7, but not a multiple of 5, between ...
code_fim
hard
{ "lang": "python", "repo": "vasantteja/dummy-python-scripts", "path": "/test3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@views.route('/locations', methods=['POST']) def handle_locations(): locs = request.json['locations'] num_clusters = request.json.get('clusters', None) if not num_clusters: num_clusters = 20 cluster_handler = ClusterCreator( locs, num_clusters, current_app.config['MAPZEN_K...
code_fim
medium
{ "lang": "python", "repo": "pjsier/canvass_cluster", "path": "/canvass_cluster/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pjsier/canvass_cluster path: /canvass_cluster/views.py from __future__ import absolute_import, print_function, unicode_literals <|fim_suffix|> return render_template('index.html') @views.route('/locations', methods=['POST']) def handle_locations(): locs = request.json['locations'] n...
code_fim
hard
{ "lang": "python", "repo": "pjsier/canvass_cluster", "path": "/canvass_cluster/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> locs = request.json['locations'] num_clusters = request.json.get('clusters', None) if not num_clusters: num_clusters = 20 cluster_handler = ClusterCreator( locs, num_clusters, current_app.config['MAPZEN_KEY'] ) return json.dumps({'locations': cluster_handler()})<|...
code_fim
medium
{ "lang": "python", "repo": "pjsier/canvass_cluster", "path": "/canvass_cluster/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_middlewares(self): return [import_string(middleware)() for middleware in settings.MIDDLEWARE] def __init__(self): super(App, self).__init__( middleware=self.get_middlewares() ) self.add_routes()<|fim_prefix|># repo: ezdookie/mashina path: /mash...
code_fim
medium
{ "lang": "python", "repo": "ezdookie/mashina", "path": "/mashina/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ezdookie/mashina path: /mashina/app.py import falcon from mashina.config import settings from mashina.routing import root_routes from mashina.utils.misc import import_string <|fim_suffix|> def __init__(self): super(App, self).__init__( middleware=self.get_middlewares() ...
code_fim
hard
{ "lang": "python", "repo": "ezdookie/mashina", "path": "/mashina/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return [import_string(middleware)() for middleware in settings.MIDDLEWARE] def __init__(self): super(App, self).__init__( middleware=self.get_middlewares() ) self.add_routes()<|fim_prefix|># repo: ezdookie/mashina path: /mashina/app.py import falcon from ...
code_fim
medium
{ "lang": "python", "repo": "ezdookie/mashina", "path": "/mashina/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def convert_to_list(num_list_str): # Modify the code below return []<|fim_prefix|># repo: alphatrl/IS111 path: /Lab Tests/2018.2 Lab Test/Original/q5.py # If needed, you can define your own additional functions here. # Start of your additional functions. <|fim_middle|> # End of your additi...
code_fim
easy
{ "lang": "python", "repo": "alphatrl/IS111", "path": "/Lab Tests/2018.2 Lab Test/Original/q5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alphatrl/IS111 path: /Lab Tests/2018.2 Lab Test/Original/q5.py # If needed, you can define your own additional functions here. # Start of your additional functions. <|fim_suffix|> # Modify the code below return []<|fim_middle|> # End of your additional functions. def convert_to_li...
code_fim
medium
{ "lang": "python", "repo": "alphatrl/IS111", "path": "/Lab Tests/2018.2 Lab Test/Original/q5.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.rect.x += self.vx self.vy += self.dy if self.vy>3 or self.vy <-3 : self.dy *= -1 center = self.rect.center if self.dy < 0: self.image = self.image_up else: self.image = self.image_down self.rect = self.imag...
code_fim
hard
{ "lang": "python", "repo": "jonaslindemann/coderdojo_pygame", "path": "/jumpy_game/sprites.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jonaslindemann/coderdojo_pygame path: /jumpy_game/sprites.py import pygame as pg from random import choice, randrange from settings import * from game import * class Player(GameSprite): def __init__(self, game): GameSprite.__init__(self, game, [game.all_sprites], layer=PLAYER_LAYER)...
code_fim
hard
{ "lang": "python", "repo": "jonaslindemann/coderdojo_pygame", "path": "/jumpy_game/sprites.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.rect.y += 2 hits = pg.sprite.spritecollide(self, self.game.platforms, False) self.rect.y -= 2 if hits and not self.jumping: print("play sound") self.game.jump_sound.play() self.jumping = True self.vel.y = -PLAYER_JUMP_VE...
code_fim
hard
{ "lang": "python", "repo": "jonaslindemann/coderdojo_pygame", "path": "/jumpy_game/sprites.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yjchess/InterpretedLanguage path: /Week 2/Token.py """ Token class Tokens each have a type, a lexeme and line. The type tells us what type this token is. This is a TokenType object. The lexeme is the set of characters that make up this token. This will typically be a string or character. The line...
code_fim
hard
{ "lang": "python", "repo": "yjchess/InterpretedLanguage", "path": "/Week 2/Token.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Overriding __str__ to allow nicer printing of tokens for debugging # __str__ is called whenever you print this object : print(Token) def __str__(self): return "<'{}', {}>".format(self.__lexeme, self.__type)<|fim_prefix|># repo: yjchess/InterpretedLanguage path: /Week 2/Token.py """ ...
code_fim
medium
{ "lang": "python", "repo": "yjchess/InterpretedLanguage", "path": "/Week 2/Token.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rodrigocaus/acoustic_modem path: /src/modulation.py ''' Script for FSK modulation Frequency modulation based on digital or binary information ''' import numpy as np import matplotlib.pyplot as plt import sounddevice as sd from scipy.io import wavfile def stringToBits(string: str) ...
code_fim
hard
{ "lang": "python", "repo": "rodrigocaus/acoustic_modem", "path": "/src/modulation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> time_end = len(bitwave)/Fs t = np.linspace(0.0, time_end, len(bitwave)) fsk = np.sin(2.0*np.pi*(f0 + df*bitwave)*t) return [t, fsk] def playSound(t, Fs=44100): sd.play(t, Fs) def sincronizeMessage(s: str, INIT_STREAM='2wLQTcNgiXyP<{', END_STREAM='}>ggIVZMbi09VM') -> str: # colo...
code_fim
hard
{ "lang": "python", "repo": "rodrigocaus/acoustic_modem", "path": "/src/modulation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>with open('hello.py', 'rb+') as f: content = f.read() f.seek(0) f.write(content.replace(b'\r', b'')) f.truncate()<|fim_prefix|># repo: YuhangMing/FCP-solutions path: /worksheet1/remove-cr.py ''' The script contains CR (carriage return) characters. The shell interprets these CR character...
code_fim
hard
{ "lang": "python", "repo": "YuhangMing/FCP-solutions", "path": "/worksheet1/remove-cr.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: YuhangMing/FCP-solutions path: /worksheet1/remove-cr.py ''' The script contains CR (carriage return) characters. The shell interprets these CR characters as arguments. Solution: Remove the CR characters from the script using the following script. Why this happened: Windows use CR, LF for line e...
code_fim
medium
{ "lang": "python", "repo": "YuhangMing/FCP-solutions", "path": "/worksheet1/remove-cr.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FellowCode/SmartHome path: /Account/migrations/0008_auto_20190520_2046.py # Generated by Django 2.2 on 2019-05-20 10:46 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( model_name='extend...
code_fim
hard
{ "lang": "python", "repo": "FellowCode/SmartHome", "path": "/Account/migrations/0008_auto_20190520_2046.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='extendeduser', name='api_key', field=models.CharField(default='SjyL2w6z7z', max_length=32, unique=True), ), migrations.AlterField( model_name='extendeduser', name='rest...
code_fim
hard
{ "lang": "python", "repo": "FellowCode/SmartHome", "path": "/Account/migrations/0008_auto_20190520_2046.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># # # Writes artifactory results to temp directory # # with open(local_path, "wb") as f: # # for chunk in r.iter_content(chunk_size=512): # # if chunk: # # f.write(chunk) # service_path = os.path.join(tmpdir, "yaml") # # print(service_path) # local_...
code_fim
hard
{ "lang": "python", "repo": "abhishekvaranasi/bq-project", "path": "/directory_search.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhishekvaranasi/bq-project path: /directory_search.py import os import tempfile import shutil import os import zipfile import tarfile from contextlib import contextmanager import requests ARTIFACTORY_BASE_URL = "https://104.196.181.115/artifactory/libs-snapshot-local/com/globalpayments/business...
code_fim
hard
{ "lang": "python", "repo": "abhishekvaranasi/bq-project", "path": "/directory_search.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># service_path = os.path.join(tmpdir, "yaml") # # print(service_path) # local_path = os.path.join(os.getcwd(), "BQTableYamlFile_94.tar") # # print(local_path) # tar = tarfile.open(local_path) # tar.extractall(service_path) # # print(os.listdir(service_path)) # # service_archiv...
code_fim
hard
{ "lang": "python", "repo": "abhishekvaranasi/bq-project", "path": "/directory_search.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jinurajan/Datastructures path: /LeetCode/mock_interviews/fraction_to_recurring_decimal.py """ Fraction to Recurring Decimal Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeati...
code_fim
hard
{ "lang": "python", "repo": "jinurajan/Datastructures", "path": "/LeetCode/mock_interviews/fraction_to_recurring_decimal.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Constraints: -231 <= numerator, denominator <= 231 - 1 denominator != 0 """ class Solution: def fractionToDecimal(self, numerator: int, denominator: int) -> str: import pdb; pdb.set_trace() sign = '+' if (numerator < 0 and denominator > 0) or (numerator > 0 and denominator <...
code_fim
hard
{ "lang": "python", "repo": "jinurajan/Datastructures", "path": "/LeetCode/mock_interviews/fraction_to_recurring_decimal.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> inputs=tf.keras.layers.Input(shape=(224, 224, 3)) augmented_layer=data_augmentetion(inputs) x=base_model(augmented_layer, training=False) pool_layer_1=tf.keras.layers.GlobalMaxPooling2D()(x) pool_layer_2=tf.keras.layers.Glo...
code_fim
hard
{ "lang": "python", "repo": "rohitkumar9989/ToolBox-MachineLearning", "path": "/learning_curve.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> history=model.fit(data, epochs=1, steps_per_epoch=len(data), callbacks=[tf.keras.callbacks.LearningRateScheduler(lambda epochs: 1e-4*10**(epochs/200)), tf.keras.callbacks.ModelCh...
code_fim
hard
{ "lang": "python", "repo": "rohitkumar9989/ToolBox-MachineLearning", "path": "/learning_curve.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rohitkumar9989/ToolBox-MachineLearning path: /learning_curve.py """Explore learning curves for classification of handwritten digits""" import matplotlib.pyplot as plt import numpy from sklearn.datasets import * from sklearn.model_selection import train_test_split from sklearn.linear_model import...
code_fim
hard
{ "lang": "python", "repo": "rohitkumar9989/ToolBox-MachineLearning", "path": "/learning_curve.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> my_world_coordinates = np.matmul(R, cam_world_coordinates[0]) + d round_my_world_coor = [int(round(my_world_coordinates[0])), int(round(my_world_coordinates[1])), int(round(my_world_coordinates[2]))] print("Fire Location: ", colored(round_my_world_coor, 'red'), "\n") ...
code_fim
hard
{ "lang": "python", "repo": "jhaojay/Fire-Tracking-Extinguisher", "path": "/AILocateFire.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># pre-loading fire_net detector = CustomObjectDetection() detector.setModelTypeAsYOLOv3() detector.setModelPath(detection_model_path=os.path.join(execution_path, "detection_model-ex-33--loss-4.97.h5")) detector.setJsonPath(configuration_json=os.path.join(execution_path, "detection_config.json")) dete...
code_fim
hard
{ "lang": "python", "repo": "jhaojay/Fire-Tracking-Extinguisher", "path": "/AILocateFire.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jhaojay/Fire-Tracking-Extinguisher path: /AILocateFire.py import serial import cv2 import time import os import shutil import numpy as np import matlab.engine from termcolor import colored # define the countdown func. def countdown(t): while t: mins, secs = divmod(t, ...
code_fim
hard
{ "lang": "python", "repo": "jhaojay/Fire-Tracking-Extinguisher", "path": "/AILocateFire.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fangchuan/PAM path: /PASMnet/finetune.py from models.PASMnet import * from datasets.kitti_dataset import KITTIDataset from torch.utils.data import DataLoader import torch.backends.cudnn as cudnn from utils import * import argparse from loss import * def parse_args(): parser = argparse.Argum...
code_fim
hard
{ "lang": "python", "repo": "fangchuan/PAM", "path": "/PASMnet/finetune.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> loss_epoch = [] EPE_epoch = [] D3_epoch = [] def main(cfg): if cfg.dataset == 'KITTI2012': train_set = KITTIDataset(datapath=cfg.datapath, list_filename='filenames/kitti12_train.txt', training=True) if cfg.dataset == 'KITTI2015': train_set = KI...
code_fim
hard
{ "lang": "python", "repo": "fangchuan/PAM", "path": "/PASMnet/finetune.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # m365py also stores a cached state of received values client.publish("ScooterM365", json.dumps(scooter.cached_state, indent=4, sort_keys=True), retain=True) # Delay time.sleep(10) except: print('Scooter not found or disconnected')<|fim_prefix|># repo: JaviElio/M3...
code_fim
hard
{ "lang": "python", "repo": "JaviElio/M365toMQTT", "path": "/M365toMQTT.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JaviElio/M365toMQTT path: /M365toMQTT.py import json import time from m365py import m365py from m365py import m365message from paho.mqtt import client as mqtt_client # MQTT client = mqtt_client.Client('Raspi') client.connect('192.168.xxx.xxx') # M365 scooter_mac_address = 'XX:XX:XX:XX:XX:XX' sc...
code_fim
hard
{ "lang": "python", "repo": "JaviElio/M365toMQTT", "path": "/M365toMQTT.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> total_btn = Button(btn_F, command=self.total, text="Total", bg="cadetblue", fg="white", pady=15, bd=2, width=10, font="arial 15 bold").grid(row=0, column=0, padx=5, pady=5) GBill_btn = Button(btn_F, command=self.bill_area, text="Generate Bill", bg="cadetblue", ...
code_fim
hard
{ "lang": "python", "repo": "habibulbasherpy/Billing-Software", "path": "/Billing Software/bill.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.welcome_bill() def total(self): self.c_s_p = self.soap.get() * 40.5 self.c_fc_p = self.face_cream.get() * 120 self.c_fw_p = self.face_wash.get() * 60 self.c_hs_p = self.spray.get() * 180 self.c_hg_p = self.gell.get() * 140 self.c_bl...
code_fim
hard
{ "lang": "python", "repo": "habibulbasherpy/Billing-Software", "path": "/Billing Software/bill.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: habibulbasherpy/Billing-Software path: /Billing Software/bill.py F2 = LabelFrame(self.root, bd=10, relief=GROOVE, text="Baby Care ", font=("times new roman", 15, "bold"), fg="gold", bg=bd_color) F2.place(x=5, y=180, width=320, height=380) bath_lbl...
code_fim
hard
{ "lang": "python", "repo": "habibulbasherpy/Billing-Software", "path": "/Billing Software/bill.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeffery75/moto path: /tests/test_ec2/test_key_pairs.py from __future__ import unicode_literals # Ensure 'assert_raises' context manager support for Python 2.6 import tests.backport_assert_raises from nose.tools import assert_raises import boto import six import sure # noqa from boto.exception ...
code_fim
hard
{ "lang": "python", "repo": "jeffery75/moto", "path": "/tests/test_ec2/test_key_pairs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> conn = boto.connect_ec2('the_key', 'the_secret') _ = conn.create_key_pair('kpfltr1') kp2 = conn.create_key_pair('kpfltr2') kp3 = conn.create_key_pair('kpfltr3') kp_by_name = conn.get_all_key_pairs( filters={'key-name': 'kpfltr2'}) set([kp.name for kp in kp_by_name] ...
code_fim
hard
{ "lang": "python", "repo": "jeffery75/moto", "path": "/tests/test_ec2/test_key_pairs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> conn = boto.connect_ec2('the_key', 'the_secret') assert len(conn.get_all_key_pairs()) == 0 r = conn.delete_key_pair('foo') r.should.be.ok @mock_ec2_deprecated def test_key_pairs_delete_exist(): conn = boto.connect_ec2('the_key', 'the_secret') conn.create_key_pair('foo') with...
code_fim
hard
{ "lang": "python", "repo": "jeffery75/moto", "path": "/tests/test_ec2/test_key_pairs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>bc.entropy(1), bc.get_prob([1])) for k in range(bid.N + 1): print(k, bid.num_strings({1: k})) # %%<|fim_prefix|># repo: hithisisdhara/statistical_ML- path: /ch4/unit_tests.py #%% from scipy.special import comb from utils import * #%% bid = binary_iid([1, 0], bern(0.2), 10) print(bid.num_strings({0: ...
code_fim
medium
{ "lang": "python", "repo": "hithisisdhara/statistical_ML-", "path": "/ch4/unit_tests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hithisisdhara/statistical_ML- path: /ch4/unit_tests.py #%% from scipy.special import comb from utils import * #%% bid = binary_iid([1, 0], bern(0.2), 10) pri<|fim_suffix|>bc.entropy(1), bc.get_prob([1])) for k in range(bid.N + 1): print(k, bid.num_strings({1: k})) # %%<|fim_middle|>nt(bid.nu...
code_fim
hard
{ "lang": "python", "repo": "hithisisdhara/statistical_ML-", "path": "/ch4/unit_tests.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): super().__init__(name="Giant Spider",hp =10, damage =2) class Ogre(Enemy): def __init__(self): super().__init__(name="Ogre",hp=30,damage=15)<|fim_prefix|># repo: smkmth/exampletextadv path: /enemies.py class Enemy(object): def__init__(self,name,hp,damag...
code_fim
easy
{ "lang": "python", "repo": "smkmth/exampletextadv", "path": "/enemies.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: smkmth/exampletextadv path: /enemies.py class Enemy(object): def__init__(self,name,hp,damage): self.name = name self.hp = hp self.damage= damage <|fim_suffix|> return self.hp > 0 class GiantSpider(Enemy): def __init__(self): super().__init__(nam...
code_fim
easy
{ "lang": "python", "repo": "smkmth/exampletextadv", "path": "/enemies.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__(name="Giant Spider",hp =10, damage =2) class Ogre(Enemy): def __init__(self): super().__init__(name="Ogre",hp=30,damage=15)<|fim_prefix|># repo: smkmth/exampletextadv path: /enemies.py class Enemy(object): def__init__(self,name,hp,damage): self.name = n...
code_fim
easy
{ "lang": "python", "repo": "smkmth/exampletextadv", "path": "/enemies.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for category in ip.iterdir(): print("Copying category: {}".format(category.as_posix()).ljust(50), end='') train_imgs = 0 validation_imgs = 0 for img in category.iterdir(): if random.random() < percent: output_img = op / 'train' / category.nam...
code_fim
hard
{ "lang": "python", "repo": "MindReadersTeam/ImageAnalysisProject", "path": "/backend/img_spliting.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> shutil.copy(img.as_posix(), output_img.as_posix()) print("=> train({}), validation({})".format(train_imgs, validation_imgs)) if __name__ == '__main__': process_dir('imgs/processed', 'imgs/splitted')<|fim_prefix|># repo: MindReadersTeam/ImageAnalysisProject path: /backend/img_spli...
code_fim
hard
{ "lang": "python", "repo": "MindReadersTeam/ImageAnalysisProject", "path": "/backend/img_spliting.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MindReadersTeam/ImageAnalysisProject path: /backend/img_spliting.py # /usr/bin/env python3 from pathlib import Path import random import shutil def process_dir(input_dir, output_dir, percent = 0.7): ip = Path(input_dir) op = Path(output_dir) <|fim_suffix|> for category in ip.iterdi...
code_fim
hard
{ "lang": "python", "repo": "MindReadersTeam/ImageAnalysisProject", "path": "/backend/img_spliting.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#POST requests.post("http://localhost:5000",json={"name":"Bob"})<|fim_prefix|># repo: hrvwnd/flask-get-post path: /request1.py from flask import Flask import requests <|fim_middle|>#GET response = requests.get("http://localhost:5000") print (response.text)
code_fim
medium
{ "lang": "python", "repo": "hrvwnd/flask-get-post", "path": "/request1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hrvwnd/flask-get-post path: /request1.py from flask import Flask import requests <|fim_suffix|>#POST requests.post("http://localhost:5000",json={"name":"Bob"})<|fim_middle|>#GET response = requests.get("http://localhost:5000") print (response.text)
code_fim
medium
{ "lang": "python", "repo": "hrvwnd/flask-get-post", "path": "/request1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='user', name='sex', field=models.TextField(default='', max_length=4), ), ]<|fim_prefix|># repo: RoderickShen/AR-Guide path: /Scripts_Django/myProject/myApp/migrations/0012_auto_20180410_0751.py # ...
code_fim
medium
{ "lang": "python", "repo": "RoderickShen/AR-Guide", "path": "/Scripts_Django/myProject/myApp/migrations/0012_auto_20180410_0751.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: RoderickShen/AR-Guide path: /Scripts_Django/myProject/myApp/migrations/0012_auto_20180410_0751.py # Generated by Django 2.0.3 on 2018-04-10 07:51 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('myApp', '0011_auto_20180410_0741'), ] operations = [ ...
code_fim
easy
{ "lang": "python", "repo": "RoderickShen/AR-Guide", "path": "/Scripts_Django/myProject/myApp/migrations/0012_auto_20180410_0751.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('accounts', '0005_auto_20200523_2248'), ] operations = [ migrations.CreateModel( name='Logins', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
code_fim
hard
{ "lang": "python", "repo": "leorrose/B7Fun", "path": "/B7FunDjango/accounts/migrations/0006_logins.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: leorrose/B7Fun path: /B7FunDjango/accounts/migrations/0006_logins.py # Generated by Django 2.2.11 on 2020-05-25 16:24 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('accounts', '0005_auto_20200523_2248'), ] operations = [ migrations.Creat...
code_fim
hard
{ "lang": "python", "repo": "leorrose/B7Fun", "path": "/B7FunDjango/accounts/migrations/0006_logins.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('accounts', '0005_auto_20200523_2248'), ] operations = [ migrations.CreateModel( name='Logins', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
code_fim
hard
{ "lang": "python", "repo": "leorrose/B7Fun", "path": "/B7FunDjango/accounts/migrations/0006_logins.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> with pkunit.save_chdir_work() as d: for f in files: actual = SDDSUtil(str(pkunit.data_dir().join(f))).lineplot( PKDict( model=PKDict( x="s", y1="LinearDensity", y2="LinearDen...
code_fim
hard
{ "lang": "python", "repo": "radiasoft/sirepo", "path": "/tests/template/sdds_util_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: radiasoft/sirepo path: /tests/template/sdds_util_test.py # -*- coding: utf-8 -*- """Test for :mod:`sirepo.template.sdds_util` :copyright: Copyright (c) 2023 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ <|fim_suffix|> from pykern.pkcollec...
code_fim
hard
{ "lang": "python", "repo": "radiasoft/sirepo", "path": "/tests/template/sdds_util_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return RssInput(f"http://www.obsrv.com/General/ImageFeed.aspx?{self.query}", lambda x: FileData(None, x["media_content"][0]["url"], False)) @property def pipeline(self) -> List[Union[Pipe, Callable[[APData], Union[APData, Pipe]]]]: return [Output(DownloaderPipe())]<|fim_prefix|># ...
code_fim
medium
{ "lang": "python", "repo": "mfkiwl/Autopipe", "path": "/autopipe/coordinators/download_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "DownloadExample" @property def input(self): return RssInput(f"http://www.obsrv.com/General/ImageFeed.aspx?{self.query}", lambda x: FileData(None, x["media_content"][0]["url"], False)) @property def pipeline(self) -> List[Union[Pipe, Callable[[APData], Union[APData, Pipe...
code_fim
medium
{ "lang": "python", "repo": "mfkiwl/Autopipe", "path": "/autopipe/coordinators/download_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mfkiwl/Autopipe path: /autopipe/coordinators/download_example.py from typing import List, Union, Callable from autopipe import Coordinator, Pipe, APData, Output from autopipe.input import RssInput from autopipe.pipe import FileData, DownloaderPipe <|fim_suffix|> def __init__(self, query: str = "...
code_fim
medium
{ "lang": "python", "repo": "mfkiwl/Autopipe", "path": "/autopipe/coordinators/download_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ This fixture is for Ios Data Collection set up : - Get driver instance - Get FlowContainer instance - Install latest Ios Data Collection app """ driver = session_setup fc = FlowContainer(driver) return driver, fc<|fim_prefix|># repo: Amal548/QAMA path: ...
code_fim
medium
{ "lang": "python", "repo": "Amal548/QAMA", "path": "/tests/ios/jweb_data_collection/conftest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Amal548/QAMA path: /tests/ios/jweb_data_collection/conftest.py import pytest from MobileApps.libs.flows.ios.jweb_data_collection.flow_container import FlowContainer <|fim_suffix|> """ This fixture is for Ios Data Collection set up : - Get driver instance - Get FlowContaine...
code_fim
medium
{ "lang": "python", "repo": "Amal548/QAMA", "path": "/tests/ios/jweb_data_collection/conftest.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>""" page.locator("#mat-select-value-9").click() page.get_by_text("中国").click() page.locator("#mat-select-value-7").click() if data.sex == 1: page.get_by_text("男性").click() else: page.get_by_text("女性").click() page.locator("app-ngb-datepicker").filter(has_text="出生...
code_fim
hard
{ "lang": "python", "repo": "Awaken0406/test_project", "path": "/V3/auto_fill.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Awaken0406/test_project path: /V3/auto_fill.py from playwright.sync_api import Page import time class CAccountClass: def __init__(self): self.sexual = '' self.name = '' self.sex = '' self.phone = '' self.mail = '' self.passport = '' self.start = '' self.en...
code_fim
hard
{ "lang": "python", "repo": "Awaken0406/test_project", "path": "/V3/auto_fill.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MinhBuiQuang/Face-Recognition-with-Transfer-Learning-Simple- path: /create_dateset.py import cv2 import numpy as np import os import pickle #import matplotlib.pyplot as plt from mtcnn.mtcnn import MTCNN from sklearn.preprocessing import LabelEncoder #from keras.utils import to_categorical import ...
code_fim
hard
{ "lang": "python", "repo": "MinhBuiQuang/Face-Recognition-with-Transfer-Learning-Simple-", "path": "/create_dateset.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print('Extracting faces from dataset') count = 0 labels_dic = {} image_path = 'FaceData/' people = [person for person in os.listdir(image_path)] count = 0 for i, person in enumerate(people): labels_dic[i] = person dir = 'faceimg/{}'.format(person) if ...
code_fim
hard
{ "lang": "python", "repo": "MinhBuiQuang/Face-Recognition-with-Transfer-Learning-Simple-", "path": "/create_dateset.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #Comment this line if you've already got cutted face images. gen_dataset(args.image_path) face_images, labels, labels_dic = collect_dataset(args.output_face) encoder = LabelEncoder() encoder.fit(labels) encoded_labels = encoder.transform(labels) #encoded_labels = to_catego...
code_fim
hard
{ "lang": "python", "repo": "MinhBuiQuang/Face-Recognition-with-Transfer-Learning-Simple-", "path": "/create_dateset.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: recuraki/PythonJunkTest path: /atcoder/lib/field2D/radian.py # 0,0 を中心とするあるx, y があたえられたときの角度を求める # <|fim_suffix|>cosだけを使うと、180度を超えるものが求められないので注意 # あるn角形があったとき、ある点と点の角度の差は360/n import math<|fim_middle|>★y,xの順番に注意 # math.atan2(y, x) # asin, a
code_fim
easy
{ "lang": "python", "repo": "recuraki/PythonJunkTest", "path": "/atcoder/lib/field2D/radian.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>形があったとき、ある点と点の角度の差は360/n import math<|fim_prefix|># repo: recuraki/PythonJunkTest path: /atcoder/lib/field2D/radian.py # 0,0 を中心とするあるx, y があたえられたときの角度を求める # ★y,xの順番に注意 # math.atan2(y, x) # asin, a<|fim_middle|>cosだけを使うと、180度を超えるものが求められないので注意 # あるn角
code_fim
easy
{ "lang": "python", "repo": "recuraki/PythonJunkTest", "path": "/atcoder/lib/field2D/radian.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DB1929/scik-learn-learn-Chinese-text-classider path: /navibayers.py #encoding:utf-8 import os import sys import pickle import numpy as np from sklearn.naive_bayes import MultinomialNB import textprocess from sklearn import metrics reload(sys) sys.setdefaultencoding('utf-8') tp = textprocess.Textp...
code_fim
hard
{ "lang": "python", "repo": "DB1929/scik-learn-learn-Chinese-text-classider", "path": "/navibayers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#预测分类结果 predict_test = clf.predict(test_matrix) for file_name,exp in zip(test_dir,predict_test): print "测试文件名:",file_name,"实际类别:",category[category_index],"预测类别:",tp.word_weight_bag.target_name[exp] actual = np.array(actual) m_precision = metrics.accuracy_score(actual,predict_test) print "准确率:",m_pre...
code_fim
hard
{ "lang": "python", "repo": "DB1929/scik-learn-learn-Chinese-text-classider", "path": "/navibayers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shaolinjr/machineLearning path: /classifica_buscas.py import pandas as pd from sklearn.naive_bayes import MultinomialNB from collections import Counter # usando pandas para facilitar organizacao dos dados df = pd.read_csv('buscas.csv') # nosso DataFrame, nossa 'tabela' de dados # Pegando e sep...
code_fim
hard
{ "lang": "python", "repo": "shaolinjr/machineLearning", "path": "/classifica_buscas.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }