text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>def subtree(n, m, depth=1): return ( [Leaf(next(ids)) for i in range(random.randint(0, n))] + [Folder(next(ids), subtree(n, m, depth-1)) for i in range(random.randint(0, m if depth > 1 else 0))] ) if depth > 0 else [] ids = Sequence() projects = {} for i in range(NUM_PROJECTS): ...
code_fim
medium
{ "lang": "python", "repo": "cbare/Etudes", "path": "/python/big_tree.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> own_profiles = Student.objects.filter(user=self.request.user, active=True) pupil_profiles = Student.objects.filter(section__mentor__user=self.request.user, active=True) coordinator_student_profiles = Student.objects.filter( section__course__coordinator__user=self.reques...
code_fim
hard
{ "lang": "python", "repo": "arinchang/csm_web", "path": "/csm_web/scheduler/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @action(detail=True, methods=['patch']) def drop(self, request, pk=None): student = get_object_or_error(self.get_queryset(), pk=pk) is_coordinator = student.section.course.coordinator_set.filter(user=request.user).exists() if student.user != request.user and not is_coordina...
code_fim
hard
{ "lang": "python", "repo": "arinchang/csm_web", "path": "/csm_web/scheduler/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arinchang/csm_web path: /csm_web/scheduler/views.py ols import groupby from rest_framework import mixins, status, viewsets from rest_framework.decorators import action from rest_framework.response import Response from rest_framework.exceptions import PermissionDenied from .models import Course, S...
code_fim
hard
{ "lang": "python", "repo": "arinchang/csm_web", "path": "/csm_web/scheduler/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for idx in range(2): yield {"inputs/x": idx} infer_input_fn = deepr.readers.GeneratorReader( _infer_gen, output_types={"inputs/x": tf.int32}, output_shapes={"inputs/x": ()} ) predict_proto = multiply.jobs.PredictProto( path_model=f"{path_model}/optimized_s...
code_fim
hard
{ "lang": "python", "repo": "yiLinMaster/deepr", "path": "/tests/unit/jobs/test_jobs_optimize_saved_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Convert SavedModel to one proto file optimize_saved_model = deepr.jobs.OptimizeSavedModel( path_saved_model=f"{path_model}/saved_model", path_optimized_model=f"{path_model}/optimized_saved_model", graph_name="_model.pb", feeds=["inputs/x"], fetch="y_pred",...
code_fim
hard
{ "lang": "python", "repo": "yiLinMaster/deepr", "path": "/tests/unit/jobs/test_jobs_optimize_saved_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yiLinMaster/deepr path: /tests/unit/jobs/test_jobs_optimize_saved_model.py # pylint: disable=no-value-for-parameter,unexpected-keyword-arg """Tests for optimize_saved_model""" import logging import tensorflow as tf import deepr import deepr.examples.multiply as multiply logging.basicConfig(l...
code_fim
hard
{ "lang": "python", "repo": "yiLinMaster/deepr", "path": "/tests/unit/jobs/test_jobs_optimize_saved_model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zkid18/pandas-profiling path: /src/pandas_profiling/report/presentation/flavours/widget/__init__.py from pandas_profiling.report.presentation.flavours.widget.frequency_table import ( WidgetFrequencyTable, ) from pandas_profiling.report.presentation.flavours.widget.frequency_table_small import...
code_fim
hard
{ "lang": "python", "repo": "zkid18/pandas-profiling", "path": "/src/pandas_profiling/report/presentation/flavours/widget/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from pandas_profiling.report.presentation.flavours.widget.toggle_button import ( WidgetToggleButton, ) from pandas_profiling.report.presentation.flavours.widget.warnings import WidgetWarnings from pandas_profiling.report.presentation.flavours.widget.collapse import WidgetCollapse<|fim_prefix|># repo: ...
code_fim
hard
{ "lang": "python", "repo": "zkid18/pandas-profiling", "path": "/src/pandas_profiling/report/presentation/flavours/widget/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test(): """ Prints each puzzle, with its number""" for i, line in enumerate(sudokus()): print(f"Puzzle number {i}") print(line) if __name__ == '__main__': test()<|fim_prefix|># repo: cadamswaite/sudoku path: /file_parser.py """ Program for getting grid,ans pairs from the ...
code_fim
hard
{ "lang": "python", "repo": "cadamswaite/sudoku", "path": "/file_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cadamswaite/sudoku path: /file_parser.py """ Program for getting grid,ans pairs from the tests dir """ <|fim_suffix|> """ Prints each puzzle, with its number""" for i, line in enumerate(sudokus()): print(f"Puzzle number {i}") print(line) if __name__ == '__main__': tes...
code_fim
hard
{ "lang": "python", "repo": "cadamswaite/sudoku", "path": "/file_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass @dispatch() def get_chat_tab(self): pass @dispatch() def get_state_viewer_tab(self): pass @dispatch() def get_editor_tab(self): pass @dispatch() def get_frame(self): pass @dispatch() def is_running(self): ret...
code_fim
hard
{ "lang": "python", "repo": "ppijbb/PyOpenDial", "path": "/gui/gui_frame.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ppijbb/PyOpenDial path: /gui/gui_frame.py import logging import sys from collections import Collection from PyQt5 import QtWidgets, QtGui from PyQt5.QtCore import Qt from multipledispatch import dispatch from bn.distribs.categorical_table import CategoricalTable from bn.values.none_val import N...
code_fim
hard
{ "lang": "python", "repo": "ppijbb/PyOpenDial", "path": "/gui/gui_frame.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @dispatch() def is_domain_saved(self): pass @dispatch() def get_menu(self): pass @dispatch() def new_domain(self): pass # TODO: 'File' type @dispatch(object) def new_domain(self, file_to_save): pass @dispatch() def open_domain...
code_fim
hard
{ "lang": "python", "repo": "ppijbb/PyOpenDial", "path": "/gui/gui_frame.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>app.blueprint(swagger_blueprint) app.blueprint(health) app.blueprint(user) setup_database_creation_listener(app, DATABASE) @app.route("/") async def default(request): return json({"message": "hello Sanic!"})<|fim_prefix|># repo: pmlynarek/weather-station path: /weather/weather.py from sanic impor...
code_fim
medium
{ "lang": "python", "repo": "pmlynarek/weather-station", "path": "/weather/weather.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmlynarek/weather-station path: /weather/weather.py from sanic import Sanic from sanic.response import json from sanic_openapi import swagger_blueprint, doc from weather.blueprint.health import health from weather.model import DATABASE from weather.blueprint.user import user from weather.util imp...
code_fim
medium
{ "lang": "python", "repo": "pmlynarek/weather-station", "path": "/weather/weather.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>app.blueprint(health) app.blueprint(user) setup_database_creation_listener(app, DATABASE) @app.route("/") async def default(request): return json({"message": "hello Sanic!"})<|fim_prefix|># repo: pmlynarek/weather-station path: /weather/weather.py from sanic import Sanic from sanic.response import...
code_fim
medium
{ "lang": "python", "repo": "pmlynarek/weather-station", "path": "/weather/weather.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ModelDependencyTreeTableWidget(DisplayWidget): template = Template(""" {% load mvc_utils %} <table id="{{path}}_table_" style="width:100%;"> <thead id="{{path}}_head_"> <tr> {% if tree.has_dependency %} <th > <span style="padding-right:10px;"> <i style='cursor...
code_fim
hard
{ "lang": "python", "repo": "rockychen-dpaw/django-mvc", "path": "/django_mvc/inspectmodel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rockychen-dpaw/django-mvc path: /django_mvc/inspectmodel.py is UNTOUCHED pass elif self.protect_status == self.DELETE: self.protect_status = status elif self.protect_status & self.DELETE_REL == self.DELETE_REL: #the upstream relationship is dele...
code_fim
hard
{ "lang": "python", "repo": "rockychen-dpaw/django-mvc", "path": "/django_mvc/inspectmodel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> output = self.render() return self.empty_line_re.sub("\n",output) def __str__(self): return "{}({})".format(self.modelname,self.pk) class ModelDependencyTreeTableWidget(DisplayWidget): template = Template(""" {% load mvc_utils %} <table id="{{path}}_table_" style="width:...
code_fim
hard
{ "lang": "python", "repo": "rockychen-dpaw/django-mvc", "path": "/django_mvc/inspectmodel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># TODO: processing scheme 1 - arbitrarily sample one of the replicas finalTrainIds = [] for obsId in uniqueObsId: if len(replicasIndex[obsId]) != 0: tempList = [obsId] for replicasId in replicasIndex[obsId]: tempList.append(replicasId) tempVal = resample(temp...
code_fim
hard
{ "lang": "python", "repo": "caifazhou/UJIndoorLoc_cleaning", "path": "/UJI_data_cleaning_preprocessing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: caifazhou/UJIndoorLoc_cleaning path: /UJI_data_cleaning_preprocessing.py from sklearn.model_selection import train_test_split import pandas as pd import numpy as np from sklearn.metrics.pairwise import euclidean_distances from sklearn.utils import resample import os def flattenList(l=No...
code_fim
hard
{ "lang": "python", "repo": "caifazhou/UJIndoorLoc_cleaning", "path": "/UJI_data_cleaning_preprocessing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self._user.get_access_level() == 3: return self._system.level_3_tasks() return self.__do_common_message(3) def __do_common_message(self, level: int): return f"ERROR: User '{self._user.get_name()}' is not authorized to do level-{level} tasks"<|fim_pr...
code_fim
hard
{ "lang": "python", "repo": "Jonathan-aguilar/DAS_Sistemas", "path": "/Ago-Dic-2020/Practicas/1er-Parcial/Examen/proxy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jonathan-aguilar/DAS_Sistemas path: /Ago-Dic-2020/Practicas/1er-Parcial/Examen/proxy.py import abc class User: def __init__(self, **kwargs): self._name = kwargs.get('name', 'Anonymous') self._access_level = kwargs.get('access_level', 1) def get_name(self): return...
code_fim
medium
{ "lang": "python", "repo": "Jonathan-aguilar/DAS_Sistemas", "path": "/Ago-Dic-2020/Practicas/1er-Parcial/Examen/proxy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._access_level def __str__(self): return f"Name: {self._name}, Level: {self._access_level}" class Subject: @abc.abstractmethod def level_1_tasks(self) -> str: pass @abc.abstractmethod def level_2_tasks(self) -> str: pass @a...
code_fim
medium
{ "lang": "python", "repo": "Jonathan-aguilar/DAS_Sistemas", "path": "/Ago-Dic-2020/Practicas/1er-Parcial/Examen/proxy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: The-Politico/politico-civic-stump path: /stump/viewsets/appearance_type.py from stump.models import AppearanceType from stump.serializers import AppearanceTypeSerializer <|fim_suffix|> class AppearanceTypeViewSet(BaseViewSet): queryset = AppearanceType.objects.all() serializer_class = Ap...
code_fim
easy
{ "lang": "python", "repo": "The-Politico/politico-civic-stump", "path": "/stump/viewsets/appearance_type.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> queryset = AppearanceType.objects.all() serializer_class = AppearanceTypeSerializer<|fim_prefix|># repo: The-Politico/politico-civic-stump path: /stump/viewsets/appearance_type.py from stump.models import AppearanceType from stump.serializers import AppearanceTypeSerializer <|fim_middle|>from .b...
code_fim
medium
{ "lang": "python", "repo": "The-Politico/politico-civic-stump", "path": "/stump/viewsets/appearance_type.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /tests/components/lacrosse_view/__init__.py """Tests for the LaCrosse View integration.""" from lacrosse_view import Location, Sensor MOCK_ENTRY_DATA = { "username": "test-username", "password": "test-password", "id": "1", "name": "Test", } TEST_SENSOR ...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/tests/components/lacrosse_view/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>, sensor_field_names=["WindSpeed"], location=Location(id="1", name="Test"), data={"WindSpeed": {"values": [{"s": 2}], "unit": "degrees_celsius"}}, permissions={"read": True}, model="Test", ) TEST_NO_FIELD_SENSOR = Sensor( name="Test", device_id="1", type="Test", sensor_...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/tests/components/lacrosse_view/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: maribedran/speakerfight path: /organization/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-04 02:51 from __future__ import unicode_literals from django.db import migrations, models import django_extensions.db.fields <|fim_suffix|> operations = [ ...
code_fim
medium
{ "lang": "python", "repo": "maribedran/speakerfight", "path": "/organization/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Organization', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=100, verbose_name='Name')), ...
code_fim
medium
{ "lang": "python", "repo": "maribedran/speakerfight", "path": "/organization/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # GSM training. Most of the params will be very close to zero. gsm_train(cfg=gsm_config, init_hdf5=gsm_init_weights, nonzero_ratio=nonzero_ratio) gsm_trained_weights = os.path.join(gsm_config.output_dir, 'finish.hdf5') # Set such params to zero. Now you get a sparse model pruned_we...
code_fim
hard
{ "lang": "python", "repo": "DingXiaoH/GSM-SGD", "path": "/gsm/gsm_prune_pipeline.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DingXiaoH/GSM-SGD path: /gsm/gsm_prune_pipeline.py from ding_train import ding_train from gsm.gsm_train import gsm_train import os from utils.misc import read_hdf5, save_hdf5 from collections import OrderedDict import numpy as np from ding_test import general_test def get_mask_by_magnitude(weigh...
code_fim
hard
{ "lang": "python", "repo": "DingXiaoH/GSM-SGD", "path": "/gsm/gsm_prune_pipeline.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: basic-bgnr/lox_interpreter path: /src/NativeCalls.py from parser import CallableExpression, LoxInstance class NativeTimer(CallableExpression): def __init__(self): import time self.func = time.time_ns self.name = '' def register(self, name, environmen...
code_fim
hard
{ "lang": "python", "repo": "basic-bgnr/lox_interpreter", "path": "/src/NativeCalls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.name = name environment.put(self.name, self) def arity(self): return 0 def call(self, *args, resolver=None): arg_one = args[0] # item to push # print(arg_one) self.internal_array.append(...
code_fim
hard
{ "lang": "python", "repo": "basic-bgnr/lox_interpreter", "path": "/src/NativeCalls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Insight-book/data-science-from-scratch path: /scratch/databases.py users = [[0, "Hero", 0], [1, "Dunn", 2], [2, "Sue", 3], [3, "Chi", 3]] from typing import Tuple, Sequence, List, Any, Callable, Dict, Iterator from collections import defaultdict # A few type aliases w...
code_fim
hard
{ "lang": "python", "repo": "Insight-book/data-science-from-scratch", "path": "/scratch/databases.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sql_users = ( users .join(user_interests) .where(lambda row: row["interest"] == "SQL") .select(keep_columns=["name"]) ) assert len(sql_users) == 2 sql_user_names = {row["name"] for row in sql_users} assert sql_user_names == {"Hero", "Sue"}...
code_fim
hard
{ "lang": "python", "repo": "Insight-book/data-science-from-scratch", "path": "/scratch/databases.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert len(stats_by_length) == 3 assert stats_by_length.columns == ["name_length", "min_user_id", "num_users"] def first_letter_of_name(row: Row) -> str: return row["name"][0] if row["name"] else "" def average_num_friends(rows: List[Row]) -> float: retu...
code_fim
hard
{ "lang": "python", "repo": "Insight-book/data-science-from-scratch", "path": "/scratch/databases.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: odys-z/hello path: /challenge/leet/easy/q401.py ''' 401. Binary Watch https://leetcode.com/problems/binary-watch/ A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents a zero or one, with the least s...
code_fim
hard
{ "lang": "python", "repo": "odys-z/hello", "path": "/challenge/leet/easy/q401.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> t.assertCountEqual(["0:00"], s.readBinaryWatch(0)) t.assertCountEqual(["1:00", "2:00", "4:00", "8:00", "0:01", "0:02", "0:04", "0:08", "0:16", "0:32"], s.readBinaryWatch(1)) t.assertCountEqual(["0:03","0:05","0:06","0:09","0:10","0:12","0:17","0:18","0:20","0:24","0:33",...
code_fim
hard
{ "lang": "python", "repo": "odys-z/hello", "path": "/challenge/leet/easy/q401.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rhysdg/tensorflow-onnx path: /tf2onnx/tflite_handlers/__init__.py # Copyright (c) Microsoft Corporation. All rights reserv<|fim_suffix|>andlers module""" from . import ( tfl_math, tfl_nn, tfl_controlflow, tfl_direct, tfl_tensor )<|fim_middle|>ed. # Licensed under the MIT lice...
code_fim
easy
{ "lang": "python", "repo": "rhysdg/tensorflow-onnx", "path": "/tf2onnx/tflite_handlers/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>nn, tfl_controlflow, tfl_direct, tfl_tensor )<|fim_prefix|># repo: rhysdg/tensorflow-onnx path: /tf2onnx/tflite_handlers/__init__.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. """tf2onnx.tflite_h<|fim_middle|>andlers module""" from . import ...
code_fim
easy
{ "lang": "python", "repo": "rhysdg/tensorflow-onnx", "path": "/tf2onnx/tflite_handlers/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: adadesions/chicken_farm path: /cal_avg_day.py if __name__ == '__main__': with open('avg_log.txt', 'r') as file: header = True data = [] for line in file.readlines(): if header: header = False <|fim_suffix|>for x in data]) ...
code_fim
hard
{ "lang": "python", "repo": "adadesions/chicken_farm", "path": "/cal_avg_day.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> continue data.append(line.split('\n')[0].split(',')) sum_ = sum([float(x[0]) for x in data]) avg_height = sum_/len(data) print('Avg height: {:.2f} cm'.format(avg_height))<|fim_prefix|># repo: adadesions/chicken_farm path: /cal_avg_day.py if __name__ == '__ma...
code_fim
hard
{ "lang": "python", "repo": "adadesions/chicken_farm", "path": "/cal_avg_day.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>BGRA) cv2.imshow("test", img) cv2.waitKey(0)<|fim_prefix|># repo: michelecos/py_imagecompose path: /opencv_sample.py import numpy as np import cv2 # Load a color image in grayscale img = cv2.imread('imag<|fim_middle|>es/bimbo_soldato/input.jpg', cv2.COLOR_BGR2
code_fim
easy
{ "lang": "python", "repo": "michelecos/py_imagecompose", "path": "/opencv_sample.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: michelecos/py_imagecompose path: /opencv_sample.py import numpy as np import cv2 # Load a col<|fim_suffix|>es/bimbo_soldato/input.jpg', cv2.COLOR_BGR2BGRA) cv2.imshow("test", img) cv2.waitKey(0)<|fim_middle|>or image in grayscale img = cv2.imread('imag
code_fim
easy
{ "lang": "python", "repo": "michelecos/py_imagecompose", "path": "/opencv_sample.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tikubonn/moff path: /moff/node/text_node.py from .template import Node from moff.util import sanitize <|fim_suffix|> def __init__(self, text): super().__init__() self.text = text # override def write(self, stream): stream.write( sanitize(str(self...
code_fim
easy
{ "lang": "python", "repo": "Tikubonn/moff", "path": "/moff/node/text_node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> stream.write( sanitize(str(self.text)))<|fim_prefix|># repo: Tikubonn/moff path: /moff/node/text_node.py from .template import Node from moff.util import sanitize class TextNode (Node): <|fim_middle|> def __init__(self, text): super().__init__() self.text = text...
code_fim
medium
{ "lang": "python", "repo": "Tikubonn/moff", "path": "/moff/node/text_node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acc-cosc-1336/cosc-1336-spring-2018-Carol-COSC1336 path: /src/assignments/assignment11/good_customer.py #create import statement for Customer class #from customer import Customer from src.assignments.assignment11.customer import Customer ''' Create a GoodCustomer class that inherits from Customer...
code_fim
medium
{ "lang": "python", "repo": "acc-cosc-1336/cosc-1336-spring-2018-Carol-COSC1336", "path": "/src/assignments/assignment11/good_customer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, first_name, last_name, phone_number): Customer.__init__(self, first_name, last_name, phone_number) self.discount = .10 def get_discount_rate (self): return self.discount<|fim_prefix|># repo: acc-cosc-1336/cosc-1336-spring-2018-Carol-COSC1336 path: /src...
code_fim
medium
{ "lang": "python", "repo": "acc-cosc-1336/cosc-1336-spring-2018-Carol-COSC1336", "path": "/src/assignments/assignment11/good_customer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thiagocaiubi/magic-modules path: /.ci/magic-modules/pyutils/strutils_test.py from strutils import * import unittest import os from github import Github class TestStringUtils(unittest.TestCase): def test_find_dependency_urls(self): test_urls = [ "https://github.com/repo-owner/repo-A/...
code_fim
hard
{ "lang": "python", "repo": "thiagocaiubi/magic-modules", "path": "/.ci/magic-modules/pyutils/strutils_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>More text ```releasenote ``` ```test ``` """ release_notes = [ ("release-note:foo", "new message foo"), ("release-note:bar", "new message bar"), ] replaced = set_release_notes(release_notes, downstream_body) # Existing non-code-block text should still be in body s...
code_fim
hard
{ "lang": "python", "repo": "thiagocaiubi/magic-modules", "path": "/.ci/magic-modules/pyutils/strutils_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # test som sjekker at __str__-funkjsonen funker riktig def test_post_str(self): self.assertEqual(self.testpost.__str__(), 'Testtittel44b171fe-37f3-45bd-9c27-242c75236a64') # test som sjekker at riktig url blir returnert for like def test_post_get_like_url(self): self.asser...
code_fim
hard
{ "lang": "python", "repo": "Eliassg/TDT4140", "path": "/afkforum/forumApp/tests/test_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Eliassg/TDT4140 path: /afkforum/forumApp/tests/test_models.py from django.test import TestCase from django.contrib.auth.models import User from forumApp.models import Post, UserProfile, Emne, ReportPost, get_post_by_id, get_posts_by_emne, Comment, \ ReportComment, get_comments_by_post, get_co...
code_fim
hard
{ "lang": "python", "repo": "Eliassg/TDT4140", "path": "/afkforum/forumApp/tests/test_models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #################### Other functions ######################## # her testes funksjoner som ikke er direkte knyttet opp mot noen klasser i models-filen # test som sjekker om man får riktig post når man har id def test_get_post_by_id(self): self.assertEquals(get_post_by_id(self.testp...
code_fim
hard
{ "lang": "python", "repo": "Eliassg/TDT4140", "path": "/afkforum/forumApp/tests/test_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MaryanneNjeri/Gallery path: /Gallery/urls.py from django.conf.urls import url from . import views from django.conf import settings from django.conf.urls.static import static <|fim_suffix|>] if settings.DEBUG: urlpatterns+= static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)<|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "MaryanneNjeri/Gallery", "path": "/Gallery/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>] if settings.DEBUG: urlpatterns+= static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: MaryanneNjeri/Gallery path: /Gallery/urls.py from django.conf.urls import url from . import views from django.conf import settings from django.conf.urls.static import static <|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "MaryanneNjeri/Gallery", "path": "/Gallery/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StorjOld/cloud-manager path: /settings.py DATABASE_PATH = "postgres://storj:so-secret@localhost/storj" TEST_DB_PATH = "postgres://postgres:<|fim_suffix|>al_settings import * except ImportError: pass<|fim_middle|>postgres@localhost/storj_test" try: from loc
code_fim
easy
{ "lang": "python", "repo": "StorjOld/cloud-manager", "path": "/settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StorjOld/cloud-manager path: /settings.py DATABASE_PATH = "postgres://storj:so-secret@local<|fim_suffix|>al_settings import * except ImportError: pass<|fim_middle|>host/storj" TEST_DB_PATH = "postgres://postgres:postgres@localhost/storj_test" try: from loc
code_fim
medium
{ "lang": "python", "repo": "StorjOld/cloud-manager", "path": "/settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>al_settings import * except ImportError: pass<|fim_prefix|># repo: StorjOld/cloud-manager path: /settings.py DATABASE_PATH = "postgres://storj:so-secret@local<|fim_middle|>host/storj" TEST_DB_PATH = "postgres://postgres:postgres@localhost/storj_test" try: from loc
code_fim
medium
{ "lang": "python", "repo": "StorjOld/cloud-manager", "path": "/settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jackkkkklee/Online-course-performance-analysis-system path: /attentiveness-detection-master/EmotionDetection/head_orientation.py import os import cv2 import numpy as np import dlib import time import math data_dir = r"E:\aut\RD\project\attentiveness-detection-master\test_datasets" save_d...
code_fim
hard
{ "lang": "python", "repo": "jackkkkklee/Online-course-performance-analysis-system", "path": "/attentiveness-detection-master/EmotionDetection/head_orientation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # cv2.putText(draw,output_pitch,(20,80),cv2.FONT_HERSHEY_SIMPLEX,.5,(0,255,0)) print(output_pitch) # Roll: if roll_degree < 0: output_roll = "face bends to the right:" + str(abs(roll_degree)) + " degrees" # cv2.putText(draw,output_roll,(20,120),cv2.FONT_HERSHEY_...
code_fim
hard
{ "lang": "python", "repo": "jackkkkklee/Online-course-performance-analysis-system", "path": "/attentiveness-detection-master/EmotionDetection/head_orientation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_pose_estimation(img_size, image_points): # 3D model points. model_points = np.array([ (6.825897, 6.760612, 4.402142), # 33 left brow left corner (1.330353, 7.122144, 6.903745), # 29 left brow right corner (-1.330353, 7.122144, 6.903745), # 34 right brow left ...
code_fim
hard
{ "lang": "python", "repo": "jackkkkklee/Online-course-performance-analysis-system", "path": "/attentiveness-detection-master/EmotionDetection/head_orientation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Trevol/ENet-Real-Time-Semantic-Segmentation path: /experiments/pytorch_tests.py import torch import torch.version import time def main(): devices = dict( cuda0=torch.device('cuda:0'), cpu=torch.device('cuda:0') ) <|fim_suffix|> # TODO: test argmax on cuda:0 devic...
code_fim
hard
{ "lang": "python", "repo": "Trevol/ENet-Real-Time-Semantic-Segmentation", "path": "/experiments/pytorch_tests.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> output = torch.randn([3, 4, 4], device=devices['cuda0']) # output[0, :, :] = 3 # output[1, :, :] = 5 # output[2, :, :] = 2 print(output.argmax(0)) print(output.max(0)) print('#################') for v in output.max(0): print('-------------------------') prin...
code_fim
medium
{ "lang": "python", "repo": "Trevol/ENet-Real-Time-Semantic-Segmentation", "path": "/experiments/pytorch_tests.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>.metrics import Metric from contest_app.models.votes import Vote from contest_app.models.points import Point from contest_app.models.hall_of_fame import HallOfFame<|fim_prefix|># repo: entpy/beauty-and-pics path: /beauty_and_pics/contest_app/models/__init__.py from django.contrib import admin from contes...
code_fim
medium
{ "lang": "python", "repo": "entpy/beauty-and-pics", "path": "/beauty_and_pics/contest_app/models/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: entpy/beauty-and-pics path: /beauty_and_pics/contest_app/models/__init__.py from django.contrib import admin from contest_app.models.contest_types import Contest_Type from contest_app.models.contests import Contest from contest_app.models<|fim_suffix|>.models.points import Point from contest_app....
code_fim
medium
{ "lang": "python", "repo": "entpy/beauty-and-pics", "path": "/beauty_and_pics/contest_app/models/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def failed_message(self): return ( "The command `%(command)s` failed with exit code %(exit_code) stdout %(stdout)s stderr %(stderr)s" ) % vars(self) def __str__(self): if self.is_not_installed(): return self.not_installed_message() else: ...
code_fim
medium
{ "lang": "python", "repo": "reclamador/document_clipper", "path": "/document_clipper/exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: reclamador/document_clipper path: /document_clipper/exceptions.py import os class ShellCommandError(Exception): """This error is raised when a shell.run returns a non-zero exit code (meaning the command failed). Based on textract, thxs :) """ def __init__(self, command, exit...
code_fim
hard
{ "lang": "python", "repo": "reclamador/document_clipper", "path": "/document_clipper/exceptions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return ( "The command `%(command)s` failed with exit code %(exit_code) stdout %(stdout)s stderr %(stderr)s" ) % vars(self) def __str__(self): if self.is_not_installed(): return self.not_installed_message() else: return self.failed_me...
code_fim
medium
{ "lang": "python", "repo": "reclamador/document_clipper", "path": "/document_clipper/exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qixinbo/imagepy path: /sciapp/demo/demo4_io_action.py import sys sys.path.append('../../') from sciapp import App, Manager from sciapp.action import SciAction import os.path as osp from skimage.io import imread, imsave from skimage.data import camera from pandas import read_csv import pandas as ...
code_fim
hard
{ "lang": "python", "repo": "qixinbo/imagepy", "path": "/sciapp/demo/demo4_io_action.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ReaderManager = Manager() ReaderManager.add('png', imread, tag='img') ReaderManager.add('csv', read_csv, tag='tab') #ReaderManager.add('dicom', 'xxx') def image_read_demo3(): app = App() FileReader().start(app) print('images:', app.img_names(), 'tables:', app.table_names()) WriterManager = ...
code_fim
hard
{ "lang": "python", "repo": "qixinbo/imagepy", "path": "/sciapp/demo/demo4_io_action.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class FileReader(SciAction): '''supporting different type, image/table or other...''' name = 'FileReader' def start(self, app): # input the file path, or just a.png/a.csv for test path = app.get_path() name, ext = osp.splitext(osp.split(path)[1]) readers = Read...
code_fim
hard
{ "lang": "python", "repo": "qixinbo/imagepy", "path": "/sciapp/demo/demo4_io_action.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jacklinquan/mp_modbus path: /test/HUAWEI-SUN-2000/main.py import network import time import mp_modbus_master as mmm import struct w = network.WLAN() w.active(True) w.connect("SUN2000-BT20C0141259", "changeme") <|fim_suffix|>m = mmm.modbus_tcp_client("192.168.200.1", 502) m.connect() for _ in r...
code_fim
medium
{ "lang": "python", "repo": "jacklinquan/mp_modbus", "path": "/test/HUAWEI-SUN-2000/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>while not w.isconnected(): time.sleep(1) print(".") m = mmm.modbus_tcp_client("192.168.200.1", 502) m.connect() for _ in range(10): time.sleep(1) f = m.read_holding_registers(32069, 1) v = struct.unpack(">h", f.data)[0]/10 print(v)<|fim_prefix|># repo: jacklinquan/mp_modbus path...
code_fim
medium
{ "lang": "python", "repo": "jacklinquan/mp_modbus", "path": "/test/HUAWEI-SUN-2000/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skyforcetw/smart-watt-hour-meter path: /lora_server/server_main.py # -*- coding: utf-8 -*- """ Created on Thu Oct 3 23:36:17 2019 @author: skyfo """ from __future__ import print_function import serial import time import struct baud = 9600 port = 'com9' ser = serial.Serial(port, baud) # open ...
code_fim
hard
{ "lang": "python", "repo": "skyforcetw/smart-watt-hour-meter", "path": "/lora_server/server_main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> binary_mode = False filename = 'store.jpg' binary_count = 0 while True: if binary_mode: line = ser.read() binary_count+=1 else: # 获得接收缓冲区字符 line = ser.readline() line = line.strip('\r\n') if l...
code_fim
medium
{ "lang": "python", "repo": "skyforcetw/smart-watt-hour-meter", "path": "/lora_server/server_main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> raise NotImplementedError('save_group') def save_file(self, lfile): raise NotImplementedError('save_file') def save_partition(self, partition): """ If a new partition, create site partitions with default parameters. """ raise NotImplementedErro...
code_fim
hard
{ "lang": "python", "repo": "SmartDataProjects/dynamo", "path": "/lib/core/components/persistency.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SmartDataProjects/dynamo path: /lib/core/components/persistency.py import time import logging from dynamo.dataformat import Block from dynamo.utils.classutil import get_instance LOG = logging.getLogger(__name__) class InventoryStore(object): """ Interface definition for local inventory...
code_fim
hard
{ "lang": "python", "repo": "SmartDataProjects/dynamo", "path": "/lib/core/components/persistency.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Stat exclude = ()<|fim_prefix|># repo: jfgp/xcero path: /stats/forms.py # -*- coding: utf-8 -*- """ Forms for the stats application. """ # standard library # django from django import forms <|fim_middle|># models from .models import Stat # views from base.forms import BaseModel...
code_fim
medium
{ "lang": "python", "repo": "jfgp/xcero", "path": "/stats/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jfgp/xcero path: /stats/forms.py # -*- coding: utf-8 -*- """ Forms for the stats application. """ # standard library # django from django import forms # models from .models import Stat # views from base.forms import BaseModelForm <|fim_suffix|> class Meta: model = Stat exc...
code_fim
medium
{ "lang": "python", "repo": "jfgp/xcero", "path": "/stats/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>This module contains most of the core abstractions and abstract classes used across all of ParlAI. This includes teachers, worlds, models, general utility functions, and much more. """<|fim_prefix|># repo: facebookresearch/ParlAI path: /parlai/core/__init__.py #!/usr/bin/env python3 # Copyright (c) Face...
code_fim
easy
{ "lang": "python", "repo": "facebookresearch/ParlAI", "path": "/parlai/core/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebookresearch/ParlAI path: /parlai/core/__init__.py #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. <|fim_suffix|>This module contains most of...
code_fim
easy
{ "lang": "python", "repo": "facebookresearch/ParlAI", "path": "/parlai/core/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> enabled = self.q(css='[name="_.allPipelines"]').attrs('checked')[0] return enabled.lower() == 'true' def get_elapsed_time_format(self): return self.value_of_first_element_named('_.elapsedTimeFormat')<|fim_prefix|># repo: 04n0/jenkins-configuration path: /e2e/pages/timestamper...
code_fim
hard
{ "lang": "python", "repo": "04n0/jenkins-configuration", "path": "/e2e/pages/timestamper_config_subpage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 04n0/jenkins-configuration path: /e2e/pages/timestamper_config_subpage.py from __future__ import absolute_import from . import JENKINS_HOST from bok_choy.page_object import PageObject from .configuration_page import ConfigurationSubPageMixIn class TimestamperConfigSubPage(ConfigurationSubPageMi...
code_fim
medium
{ "lang": "python", "repo": "04n0/jenkins-configuration", "path": "/e2e/pages/timestamper_config_subpage.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ncarrara/age-of-triggers path: /aot/model/controller/goals.py class Goals: """Represents examples goals Attributes: conquest (int): 1 conquest unknown1 (int): unknown relics (int): number of relics required unknown2 (int): unknown exploration (int...
code_fim
hard
{ "lang": "python", "repo": "ncarrara/age-of-triggers", "path": "/aot/model/controller/goals.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = "Goals: \n" part1 = "\tConquest: {}\n\tRelics: {}\n".format( self.conquest, self.relics) part2 = "\tExploration: {}\n\tAllModes: {}\n".format( self.exploration, self.all) part3 = "\tCustomMode: {}\n\tScore: {}\n".format(self.mode, self.time) ...
code_fim
hard
{ "lang": "python", "repo": "ncarrara/age-of-triggers", "path": "/aot/model/controller/goals.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: conquest (int): 1 conquest unknown1 (int): unknown relics (int): number of relics required unknown2 (int): unknown exploration (int): map exploratino required in % all (int): all conditions mode (int): ? ...
code_fim
hard
{ "lang": "python", "repo": "ncarrara/age-of-triggers", "path": "/aot/model/controller/goals.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@inline_async def test(): r = yield Async(add,(2,3)) print(r) r = yield Async(add, (2, 3)) print(r) test()<|fim_prefix|># repo: GuiltyD/PythonCookbook path: /Chapter 7/回调函数.py from functools import wraps from queue import Queue def async_func(func,args, *,callback): res = func(*args) callback(re...
code_fim
hard
{ "lang": "python", "repo": "GuiltyD/PythonCookbook", "path": "/Chapter 7/回调函数.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GuiltyD/PythonCookbook path: /Chapter 7/回调函数.py from functools import wraps from queue import Queue def async_func(func,args, *,callback): res = func(*args) callback(res) # return res class Async: def __init__(self,func,args): self.func = func self.args = args class Myqueue: def _...
code_fim
medium
{ "lang": "python", "repo": "GuiltyD/PythonCookbook", "path": "/Chapter 7/回调函数.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """New Thread Execution Starts a new thread to run the start_compilation method """ from threading import Thread from ..libraries.I18n import I18n _ = I18n().translate thread = Thread(target=self.start_compilation) thread.start() T...
code_fim
medium
{ "lang": "python", "repo": "gepd/Deviot", "path": "/platformio/compile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gepd/Deviot path: /platformio/compile.py #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals from sys import exit from .initialize import Initialize fr...
code_fim
medium
{ "lang": "python", "repo": "gepd/Deviot", "path": "/platformio/compile.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.add_option('lib_extra_dirs') # check if there is a new speed to overwrite self.add_option('upload_speed') # add src_dir option if it's neccesary self.override_src() cmd = ['run', '-e ', self.board_id] self.run_command(cmd) self.after...
code_fim
hard
{ "lang": "python", "repo": "gepd/Deviot", "path": "/platformio/compile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>sterServers __all__ = [Network, MasterServers, GameServers]<|fim_prefix|># repo: DaRealFreak/Teeworlds-ServerInfo path: /tw_serverinfo/__init__.py #!/usr/bin/python # -*- coding: utf-8 -*- from tw_serverinf<|fim_middle|>o.network import Network from tw_serverinfo.game_servers import GameServers from tw_...
code_fim
medium
{ "lang": "python", "repo": "DaRealFreak/Teeworlds-ServerInfo", "path": "/tw_serverinfo/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ort GameServers from tw_serverinfo.master_servers import MasterServers __all__ = [Network, MasterServers, GameServers]<|fim_prefix|># repo: DaRealFreak/Teeworlds-ServerInfo path: /tw_serverinfo/__init__.py #!/usr/bin/python # -*- coding: utf-8 -*- from tw_serverinf<|fim_middle|>o.network import Network ...
code_fim
medium
{ "lang": "python", "repo": "DaRealFreak/Teeworlds-ServerInfo", "path": "/tw_serverinfo/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DaRealFreak/Teeworlds-ServerInfo path: /tw_serverinfo/__init__.py #!/usr/bin/python # -*- coding: utf-8 -*- from tw_serverinf<|fim_suffix|>ort GameServers from tw_serverinfo.master_servers import MasterServers __all__ = [Network, MasterServers, GameServers]<|fim_middle|>o.network import Network ...
code_fim
medium
{ "lang": "python", "repo": "DaRealFreak/Teeworlds-ServerInfo", "path": "/tw_serverinfo/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/Deep-Learning-with-TensorFlow-2-and-Keras path: /Chapter 7/elmo_from_tfhub.py import tensorflow as tf import tensorflow_hub as hub # module_url = "https://tfhub.dev/google/tf2-preview/elmo/2" # embed = hub.KerasLayer(module_<|fim_suffix|> like green eggs and ham", "would ...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Deep-Learning-with-TensorFlow-2-and-Keras", "path": "/Chapter 7/elmo_from_tfhub.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> like green eggs and ham", "would you eat them in a box" ], signature="default", as_dict=True )["elmo"] print(embeddings.shape)<|fim_prefix|># repo: PacktPublishing/Deep-Learning-with-TensorFlow-2-and-Keras path: /Chapter 7/elmo_from_tfhub.py import tensorflow as tf import tensorflow...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Deep-Learning-with-TensorFlow-2-and-Keras", "path": "/Chapter 7/elmo_from_tfhub.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: loads/loads-broker path: /loadsbroker/client/base.py class BaseCommand(object): """Base Command Class""" arguments = {} def __init__(self, session, root): self.session = session self.root = root def __call__(self, args): return self.session.get(self.roo...
code_fim
medium
{ "lang": "python", "repo": "loads/loads-broker", "path": "/loadsbroker/client/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> normalized = option.replace('-', '_') if normalized in args: options[normalized] = getattr(args, normalized) return options<|fim_prefix|># repo: loads/loads-broker path: /loadsbroker/client/base.py class BaseCommand(object): """Base Command Class""" ...
code_fim
medium
{ "lang": "python", "repo": "loads/loads-broker", "path": "/loadsbroker/client/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }