text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> annotations = pd.read_csv(FLAGS.annotations_file) annotations['LabelName'] = annotations['LabelName'].map(lambda n: class_descriptions[n]) annotations = annotations.groupby('ImageID') images = tf.io.gfile.glob(FLAGS.images_dir + '/*/*.jpg') images = map(lambda i: (os.path.basename(i)....
code_fim
medium
{ "lang": "python", "repo": "suneric/object_detection", "path": "/oid_tfrecord/generate-tfrecord.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: suneric/object_detection path: /oid_tfrecord/generate-tfrecord.py import pandas as pd import tensorflow as tf from PIL import Image import os tf.compat.v1.flags.DEFINE_string('classes_file', None, 'Path to the text file containing downloaded classes, name per line') tf.compat.v1.flags.DEFINE_str...
code_fim
hard
{ "lang": "python", "repo": "suneric/object_detection", "path": "/oid_tfrecord/generate-tfrecord.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> image_annotations = annotations.get_group(image_id) for _, row in image_annotations.loc[image_annotations['LabelName'].isin(classes.keys())].iterrows(): print(_) xmins.append(row['XMin']) xmaxs.append(row['XMax']) ymins.append(row['YMin']) ...
code_fim
hard
{ "lang": "python", "repo": "suneric/object_detection", "path": "/oid_tfrecord/generate-tfrecord.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nathan939/DeepCodeur path: /_Scraping/another_scrap.py import youtube_dl from youtube_transcript_api import YouTubeTranscriptApi from pydub import AudioSegment from pydub.silence import split_on_silence import os import json import pprint hotwords = [x[0].split("\\")[-1] for x in os.walk('_I.A\D...
code_fim
hard
{ "lang": "python", "repo": "Nathan939/DeepCodeur", "path": "/_Scraping/another_scrap.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ydl_opts = { 'format': 'bestaudio/best', 'outtmpl': AudioPath + '/' + nom + '.%(ext)s', 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'wav', 'preferredquality': '192', }], } """ with youtube_dl.YoutubeDL(ydl_opts) as ydl: ...
code_fim
hard
{ "lang": "python", "repo": "Nathan939/DeepCodeur", "path": "/_Scraping/another_scrap.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: debit = float(input("Enter the amount to be withdrawn: ")) if debit < 0: print("Invalid Amount Entered...Amount cannot be less than 0.00") continue else: break except ValueError: ...
code_fim
hard
{ "lang": "python", "repo": "maneeshd/PyTutorial", "path": "/Banking/Banking.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maneeshd/PyTutorial path: /Banking/Banking.py """ Author: Maneesh Divana Python: 3.5.2 Python-201 VILT Course Assignment: Bank Transactions using only text files. Date: 8 Dec, 2016 """ from math import fabs, pow, e from re import compile from sys import exit from threading import Thread def get...
code_fim
hard
{ "lang": "python", "repo": "maneeshd/PyTutorial", "path": "/Banking/Banking.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> f = None fw = None pattern = compile(".*(999999).*") try: f = open("customers_old.txt", "r", encoding="UTF-8") fw = open("customer_new.txt", "w", encoding="UTF-8") for customer in f.readlines(): if pattern.search(customer): print("End of ...
code_fim
hard
{ "lang": "python", "repo": "maneeshd/PyTutorial", "path": "/Banking/Banking.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>TO_MENU_KEYBOARD = Keyboard().add(Text("В меню", {"cmd": "menu"})).get_json() VOID_KEYBOARD = Keyboard().get_json()<|fim_prefix|># repo: homus32/vk_music_api_bot_vkbottle path: /src/keyboards/__init__.py from vkbottle import Keyboard, KeyboardButtonColor, Callback, Text <|fim_middle|>from .menu import ...
code_fim
hard
{ "lang": "python", "repo": "homus32/vk_music_api_bot_vkbottle", "path": "/src/keyboards/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: homus32/vk_music_api_bot_vkbottle path: /src/keyboards/__init__.py from vkbottle import Keyboard, KeyboardButtonColor, Callback, Text from .menu import Menu from .purchase import * from .key_control import * from .admin import * <|fim_suffix|>TO_MENU_KEYBOARD = Keyboard().add(Text("В меню", {"c...
code_fim
hard
{ "lang": "python", "repo": "homus32/vk_music_api_bot_vkbottle", "path": "/src/keyboards/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RevSquare/django-facebook-canvas-auth path: /facebook_canvas_auth/urls.py from django.conf.urls import patterns, url urlpattern<|fim_suffix|>r_loggedin', name='add_check_user_loggedin'), )<|fim_middle|>s = patterns( '', url(r'^add-check-user-loggedin$', 'facebook_canvas_a...
code_fim
medium
{ "lang": "python", "repo": "RevSquare/django-facebook-canvas-auth", "path": "/facebook_canvas_auth/urls.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>r_loggedin', name='add_check_user_loggedin'), )<|fim_prefix|># repo: RevSquare/django-facebook-canvas-auth path: /facebook_canvas_auth/urls.py from django.conf.urls import patterns, url urlpattern<|fim_middle|>s = patterns( '', url(r'^add-check-user-loggedin$', 'facebook_canvas_a...
code_fim
medium
{ "lang": "python", "repo": "RevSquare/django-facebook-canvas-auth", "path": "/facebook_canvas_auth/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>n$', 'facebook_canvas_auth.views.add_check_user_loggedin', name='add_check_user_loggedin'), )<|fim_prefix|># repo: RevSquare/django-facebook-canvas-auth path: /facebook_canvas_auth/urls.py from django.conf.urls import patterns, url urlpattern<|fim_middle|>s = patterns( '', url(r'...
code_fim
easy
{ "lang": "python", "repo": "RevSquare/django-facebook-canvas-auth", "path": "/facebook_canvas_auth/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ominatechnologies/opyprint path: /tests/utils/test_lt.py # test_lt from frozendict import NoCopyFrozenDict as FrozenDict from pytest import raises from opyprint import dict_lt, lt def test_basics(): assert {'a': 1} == {'a': 1} assert {'a': 1} != {'a': 2} assert {'a': 1} != {'b': 1...
code_fim
hard
{ "lang": "python", "repo": "ominatechnologies/opyprint", "path": "/tests/utils/test_lt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def assert_dict_lt(obj_1, obj_2): assert dict_lt(obj_1, obj_2) assert not dict_lt(obj_2, obj_1) assert not dict_lt(obj_1, obj_1) assert not dict_lt(obj_2, obj_2) assert lt(obj_1, obj_2) assert not lt(obj_2, obj_1) assert not lt(obj_1, obj_1) assert not lt(obj_2, obj_2)<|f...
code_fim
medium
{ "lang": "python", "repo": "ominatechnologies/opyprint", "path": "/tests/utils/test_lt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Magnetic inducing field parameter (A,I,D) B = [50000, 90, 0] # Create a MAGsurvey rx = PF.BaseMag.RxObs( np.vstack([[0.25, 0.25, 0.25], [-0.25, -0.25, 0.25]]) ) srcField = PF.BaseMag.SrcField([rx], param=(B[0], B[1], B[2])) survey = PF...
code_fim
hard
{ "lang": "python", "repo": "fperez/simpeg", "path": "/tests/base/test_directives.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): mesh = Mesh.TensorMesh([4, 4, 4]) # Magnetic inducing field parameter (A,I,D) B = [50000, 90, 0] # Create a MAGsurvey rx = PF.BaseMag.RxObs( np.vstack([[0.25, 0.25, 0.25], [-0.25, -0.25, 0.25]]) ) srcField = PF.Base...
code_fim
hard
{ "lang": "python", "repo": "fperez/simpeg", "path": "/tests/base/test_directives.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fperez/simpeg path: /tests/base/test_directives.py import unittest import warnings import pytest import numpy as np from SimPEG import ( Mesh, Maps, Directives, Regularization, DataMisfit, Optimization, Inversion, InvProblem ) from SimPEG import PF class DirectivesValidation(unittest.T...
code_fim
hard
{ "lang": "python", "repo": "fperez/simpeg", "path": "/tests/base/test_directives.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hgamboa/novainstrumentation path: /novainstrumentation/waves/computemeanwave.py from numpy import * def computemeanwave(signal, events, fdist, lmin=0,lmax=0): <|fim_suffix|> if (lmin==0) & (lmax==0): lmax=mean(diff(events))/2 lmin=-lmax w=waves(signal, events, lmin...
code_fim
medium
{ "lang": "python", "repo": "hgamboa/novainstrumentation", "path": "/novainstrumentation/waves/computemeanwave.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if (lmin==0) & (lmax==0): lmax=mean(diff(events))/2 lmin=-lmax w=waves(signal, events, lmin, lmax) w_=meanwave(w) d=wavedistance(w_,w,fdist) ws=stdwave(w) return (w_, ws, d)<|fim_prefix|># repo: hgamboa/novainstrumentation path: /novainstrumentation/wa...
code_fim
medium
{ "lang": "python", "repo": "hgamboa/novainstrumentation", "path": "/novainstrumentation/waves/computemeanwave.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not hours and not minutes: raise Exception('Time pattern not matched') if not self.parse_only: self.assert_ticket_exists(ticket) time = (hours, minutes) return (ticket, time, description) def assert_ticket_exists(self, ticket): if ...
code_fim
hard
{ "lang": "python", "repo": "jeffkenney/logjammin", "path": "/logjammin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeffkenney/logjammin path: /logjammin.py #!/usr/bin/env python3 import re import json import argparse import math from os.path import expanduser, realpath from datetime import datetime from pytz import timezone from jira import JIRA from collections import OrderedDict class LogJammin: mode...
code_fim
hard
{ "lang": "python", "repo": "jeffkenney/logjammin", "path": "/logjammin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parts = line.split(',', 2) ticket_str = parts[0].strip() if len(parts) else '' time_str = parts[1].strip() if len(parts) > 1 else '' description = parts[2].strip() if len(parts) > 2 else '' ticket_match_re = r'^[A-Z][A-Z0-9]+-\d+$' ticket_match = re.match(t...
code_fim
hard
{ "lang": "python", "repo": "jeffkenney/logjammin", "path": "/logjammin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arunpatala/hybrid_bootstrap path: /sampling_visualization_data_generator.py import numpy as np np.random.seed(42) import pandas as pd from keras.datasets import mnist from keras.models import Sequential, Model from keras.layers import Dense, Dropout, Activation, Flatten, Input...
code_fim
hard
{ "lang": "python", "repo": "arunpatala/hybrid_bootstrap", "path": "/sampling_visualization_data_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> preds = model.predict(X_test) preds = np.argmax(preds, axis = 1) np.sum(preds == y_test) for i in range(11): model.pop() model.compile(loss ='mse', optimizer = sgd) image_maps_0 = model.predict(X_train)[0] image_maps_0 = [image_maps_0[ :, :, channel...
code_fim
hard
{ "lang": "python", "repo": "arunpatala/hybrid_bootstrap", "path": "/sampling_visualization_data_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "%s" % self.value class WebHookTransaction(models.Model): STATUS = TransactionStatus # request body & meta body = JSONField() meta = JSONField() # app app = models.ForeignKey(WebHookClientApp, on_delete=models.CASCADE) # status of transactio...
code_fim
hard
{ "lang": "python", "repo": "bellyfat/django-hooked", "path": "/hooked/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bellyfat/django-hooked path: /hooked/models.py # -*- coding: utf-8 -*- import uuid from enum import IntEnum from django.db import models from django.template.defaultfilters import slugify from django.utils import timezone from jsonfield import JSONField from .tokens import generate_random_secr...
code_fim
hard
{ "lang": "python", "repo": "bellyfat/django-hooked", "path": "/hooked/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = 'engage.UserMessage' publish_fields = ('text', 'direction') update_fields = ('text', )<|fim_prefix|># repo: Praseetha-KR/django-engage path: /engage/serializers.py from swampdragon.serializers.model_serializer import ModelSerializer class UserMessageSerializer(ModelSeria...
code_fim
easy
{ "lang": "python", "repo": "Praseetha-KR/django-engage", "path": "/engage/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Praseetha-KR/django-engage path: /engage/serializers.py from swampdragon.serializers.model_serializer import ModelSerializer <|fim_suffix|> model = 'engage.UserMessage' publish_fields = ('text', 'direction') update_fields = ('text', )<|fim_middle|> class UserMessageSeriali...
code_fim
medium
{ "lang": "python", "repo": "Praseetha-KR/django-engage", "path": "/engage/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>of rows are: ",len(list(content))-1) ''' for each in content: print(each) ''' fo.close()<|fim_prefix|># repo: PacktPublishing/Complete-Python-Scripting-for-Automation path: /Section 15/2.Document-read-a-header-and-finding-no-of-rows.py import csv req_file="C:\\Users\\Automation\\Desktop\\hi\\new_...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Complete-Python-Scripting-for-Automation", "path": "/Section 15/2.Document-read-a-header-and-finding-no-of-rows.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/Complete-Python-Scripting-for-Automation path: /Section 15/2.Document-read-a-header-and-finding-no-of-rows.py import csv req_file="C:\\Users\\Automation\\Desktop\\hi\\new_info.csv" fo=open(req_file,<|fim_suffix|>of rows are: ",len(list(content))-1) ''' for each in content: ...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Complete-Python-Scripting-for-Automation", "path": "/Section 15/2.Document-read-a-header-and-finding-no-of-rows.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dana-i2cat/felix path: /expedient/src/python/expedient/clearinghouse/users/models.py ''' Created on Dec 3, 2009 @author: jnaous ''' from django.db import models from django.contrib.auth.models import User class UserProfile(models.Model): ''' Additional information about a user. <|...
code_fim
hard
{ "lang": "python", "repo": "dana-i2cat/felix", "path": "/expedient/src/python/expedient/clearinghouse/users/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @return: user's profile @rtype: L{UserProfile} ''' try: profile = user.get_profile() except UserProfile.DoesNotExist: profile = cls.objects.create( user=user, ) return ...
code_fim
medium
{ "lang": "python", "repo": "dana-i2cat/felix", "path": "/expedient/src/python/expedient/clearinghouse/users/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> model = Sequential() model.add(Dense(10, input_shape=(segment_size, 5), activation='relu')) model.add(LSTM(segment_size * 8, activation='relu')) model.add(Dense(segment_size * 6, activation='relu')) model.add(Dropout(0.2)) model.add(Dense(segment_size * 2, activation='relu')) ...
code_fim
medium
{ "lang": "python", "repo": "rawatraghav/DoHlyzer", "path": "/analyzer/models/v4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rawatraghav/DoHlyzer path: /analyzer/models/v4.py from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense, Dropout, LSTM <|fim_suffix|> model = Sequential() model.add(Dense(10, input_shape=(segment_size, 5), activation='relu')) model.add(LSTM(segment_s...
code_fim
medium
{ "lang": "python", "repo": "rawatraghav/DoHlyzer", "path": "/analyzer/models/v4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uyamazak/oceanus path: /revelation/app/hook/hooks/bizocean.py from hook.base import BaseHook from task.gspread.tasks import send2ws class BizoceanHook(BaseHook): def main(self) -> int: channel = self.item.get("channel") if channel != "bizocean": return 0 <|fim...
code_fim
hard
{ "lang": "python", "repo": "uyamazak/oceanus", "path": "/revelation/app/hook/hooks/bizocean.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # エラー if "error" in data["evt"]: count += 1 values = (dt, data.get("evt", ""), data.get("url", ""), data.get("ref", ""), ("sid", data.get("sid")), ("uid", d...
code_fim
hard
{ "lang": "python", "repo": "uyamazak/oceanus", "path": "/revelation/app/hook/hooks/bizocean.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> idx = np.random.choice(X.shape[0], self.Nb) Xb = X[idx] Tb = T[idx] model = DecisionTreeRegressor() model.fit(Xb, Tb) self.models.append(model) def predict(self, X): ...
code_fim
hard
{ "lang": "python", "repo": "AVJdataminer/Machine-Learning-from-Scratch", "path": "/bagged_tree_regressor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AVJdataminer/Machine-Learning-from-Scratch path: /bagged_tree_regressor.py import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeRegressor from sklearn.metrics import mean_squared_error as mse from sklearn.met...
code_fim
hard
{ "lang": "python", "repo": "AVJdataminer/Machine-Learning-from-Scratch", "path": "/bagged_tree_regressor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 0--key/lib path: /portfolio/Python/scrapy/seapets/aquariumsdelivered.py import re import os import json from scrapy.spider import BaseSpider from scrapy.selector import HtmlXPathSelector from scrapy.http import Request, HtmlResponse from scrapy.utils.response import get_base_url from scrapy.util...
code_fim
hard
{ "lang": "python", "repo": "0--key/lib", "path": "/portfolio/Python/scrapy/seapets/aquariumsdelivered.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> exclude = set() for mandatory_option in mandatory_options: option = mandatory_option.select(u'./@name').re('bundle_option\[(.*)\]')[0] selection = mandatory_option.select(u'./@value').extract()[0] option = options['options'][option]['...
code_fim
hard
{ "lang": "python", "repo": "0--key/lib", "path": "/portfolio/Python/scrapy/seapets/aquariumsdelivered.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print "Back End: %s" % backendPerformance print "Front End: %s" % frontendPerformance driver.quit()<|fim_prefix|># repo: Coopertown75/cdnlyzer path: /scripts/load.py from selenium import webdriver from selenium.webdriver.common.proxy import Proxy, ProxyType source = "https://amazon.com" prox = Proxy()...
code_fim
hard
{ "lang": "python", "repo": "Coopertown75/cdnlyzer", "path": "/scripts/load.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Coopertown75/cdnlyzer path: /scripts/load.py from selenium import webdriver from selenium.webdriver.common.proxy import Proxy, ProxyType source = "https://amazon.com" prox = Proxy() prox.proxy_type = ProxyType.MANUAL prox.http_proxy = "127.0.0.1:9090" prox.socks_proxy = "127.0.0.1:9090" prox.ss...
code_fim
medium
{ "lang": "python", "repo": "Coopertown75/cdnlyzer", "path": "/scripts/load.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dtdi/Simod path: /support_modules/log_repairing/log_replayer.py # -*- coding: utf-8 -*- import networkx as nx import pandas as pd from support_modules import support as sup from collections import OrderedDict # TODO: Transform this into a class def replay(process_graph, traces): start_tasks...
code_fim
hard
{ "lang": "python", "repo": "dtdi/Simod", "path": "/support_modules/log_repairing/log_replayer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def find_next_tasks(process_graph, num): tasks_list=list() for node in process_graph.neighbors(num): if process_graph.node[node]['type']=='task' or process_graph.node[node]['type']=='start' or process_graph.node[node]['type']=='end': tasks_list.append([node]) else: ...
code_fim
hard
{ "lang": "python", "repo": "dtdi/Simod", "path": "/support_modules/log_repairing/log_replayer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> resp = list(filter(lambda x: process_graph.node[x]['name'] == task_name ,process_graph.nodes)) if len(resp)>0: resp = resp[0] else: raise Exception('Task not found on bpmn structure...') return resp def find_start_finish_tasks(process_graph): process_graph_data = pd.Da...
code_fim
hard
{ "lang": "python", "repo": "dtdi/Simod", "path": "/support_modules/log_repairing/log_replayer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> planner = Hyperopt(show_progressbar=show_progressbar) planner.set_param_space(param_space=two_param_space) param = planner.ask() value = ParameterVector().from_dict({'objective': 0.}) obs = Observations() obs.add_observation(param, value) planner.tell(observations=obs)<|fim_prefix|># repo: priyansh...
code_fim
medium
{ "lang": "python", "repo": "priyansh-1902/olympus", "path": "/tests/test_planners/test_planner_hyperopt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: priyansh-1902/olympus path: /tests/test_planners/test_planner_hyperopt.py #!/usr/bin/env python import pytest from olympus import Observations, ParameterVector from olympus.planners import Hyperopt <|fim_suffix|> planner = Hyperopt(show_progressbar=show_progressbar) planner.set_param_space(pa...
code_fim
medium
{ "lang": "python", "repo": "priyansh-1902/olympus", "path": "/tests/test_planners/test_planner_hyperopt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zkn1163691192/DAPPLE path: /bert/utils/hooks/hooks_utils.py import tensorflow as tf class LoggingTensorHook(tf.train.SessionRunHook): """Self-defined Hook for logging.""" def __init__(self, tensors, samples_per_step=1, every_n_iters=100): self._tensors = tensors self._samples_per_s...
code_fim
medium
{ "lang": "python", "repo": "zkn1163691192/DAPPLE", "path": "/bert/utils/hooks/hooks_utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return tf.train.SessionRunArgs(self._tensors) def after_run(self, run_context, run_values): _ = run_context tensor_values = run_values.results stale_global_step = tensor_values['global_step'] if self._timer.should_trigger_for_step(stale_global_step + 1): global_step = run_cont...
code_fim
medium
{ "lang": "python", "repo": "zkn1163691192/DAPPLE", "path": "/bert/utils/hooks/hooks_utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> result_docs = {} index_result = self._search_tokens(tokens_list) for token in index_result.keys(): for doc in index_result[token]: # search if exists: if doc in result_docs.keys(): result_docs[doc][token] = index_resu...
code_fim
hard
{ "lang": "python", "repo": "MagnunAVF/Python-Based-Search-Engine", "path": "/buscasrc/core/database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MagnunAVF/Python-Based-Search-Engine path: /buscasrc/core/database.py # coding: utf-8 import os class Database: """ Entity that is responsable for store the app data """ def __init__(self): self.documents = {} self.inverted_index = {} def search(self, token...
code_fim
hard
{ "lang": "python", "repo": "MagnunAVF/Python-Based-Search-Engine", "path": "/buscasrc/core/database.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": wf = Workflow() sys.exit(wf.run(main))<|fim_prefix|># repo: lewiszlw/website path: /search.py # coding: utf-8 import website import sys, json from workflow import Workflow <|fim_middle|>def main(wf): website_obj = website.Website() if wf.args == None or wf.arg...
code_fim
hard
{ "lang": "python", "repo": "lewiszlw/website", "path": "/search.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lewiszlw/website path: /search.py # coding: utf-8 import website import sys, json from workflow import Workflow def main(wf): <|fim_suffix|>if __name__ == "__main__": wf = Workflow() sys.exit(wf.run(main))<|fim_middle|> website_obj = website.Website() if wf.args == None or wf.arg...
code_fim
hard
{ "lang": "python", "repo": "lewiszlw/website", "path": "/search.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> website_obj = website.Website() if wf.args == None or wf.args == []: query = "" else: query = wf.args[0].strip().replace("\\", "") sites = website_obj.query(query) for site in sites: wf.add_item(title=site["name"], subtitle=site["url"], arg=site["url"], valid=Tr...
code_fim
medium
{ "lang": "python", "repo": "lewiszlw/website", "path": "/search.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>app_name = "sample" router = routers.DefaultRouter() router.register(r"authors/", views.AuthorViewSet) router.register(r"books/", views.BookViewSet) urlpatterns = router.urls<|fim_prefix|># repo: unicef/unicef-attachments path: /tests/demoproject/demo/sample/urls.py from rest_framework import routers ...
code_fim
easy
{ "lang": "python", "repo": "unicef/unicef-attachments", "path": "/tests/demoproject/demo/sample/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: unicef/unicef-attachments path: /tests/demoproject/demo/sample/urls.py from rest_framework import routers from demo.sample import views <|fim_suffix|>urlpatterns = router.urls<|fim_middle|>app_name = "sample" router = routers.DefaultRouter() router.register(r"authors/", views.AuthorViewSet) ro...
code_fim
medium
{ "lang": "python", "repo": "unicef/unicef-attachments", "path": "/tests/demoproject/demo/sample/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = router.urls<|fim_prefix|># repo: unicef/unicef-attachments path: /tests/demoproject/demo/sample/urls.py from rest_framework import routers <|fim_middle|>from demo.sample import views app_name = "sample" router = routers.DefaultRouter() router.register(r"authors/", views.AuthorViewSet) ro...
code_fim
medium
{ "lang": "python", "repo": "unicef/unicef-attachments", "path": "/tests/demoproject/demo/sample/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># register command # invoke this via saying `!roll 1 100` in channel # or `!roll 1 100 5` to dice 5 times once @bot.command(name='roll') async def roll(msg: TextMsg, t_min: str, t_max: str, n: str = 1): result = [random.randint(int(t_min), int(t_max)) for i in range(int(n))] await msg.reply(f'you ...
code_fim
hard
{ "lang": "python", "repo": "hang333/khl.py", "path": "/example/ex03_cmd_args/ex03.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hang333/khl.py path: /example/ex03_cmd_args/ex03.py import json import random from khl import TextMsg, Bot, Cert # load config from config/config.json, replace `path` points to your own config file # config template: `./config/config.json.example` with open('./config/config.json', 'r', encoding...
code_fim
medium
{ "lang": "python", "repo": "hang333/khl.py", "path": "/example/ex03_cmd_args/ex03.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # register command # invoke this via saying `!roll 1 100` in channel # or `!roll 1 100 5` to dice 5 times once @bot.command(name='roll') async def roll(msg: TextMsg, t_min: str, t_max: str, n: str = 1): result = [random.randint(int(t_min), int(t_max)) for i in range(int(n))] await msg.reply(f'you...
code_fim
medium
{ "lang": "python", "repo": "hang333/khl.py", "path": "/example/ex03_cmd_args/ex03.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShuguangSun/allocation path: /allocation/adaptive_randomization.py """ Randomization is a module that provides functions to create random group assignments to be used in clinical trials """ import math import random # import scipy.stats as stats # A Response adaptive randomization technique d...
code_fim
hard
{ "lang": "python", "repo": "ShuguangSun/allocation", "path": "/allocation/adaptive_randomization.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cut = math.sqrt(pC) / (math.sqrt(pC) + math.sqrt(pT)) test = random.random() if test < cut: group = control_name else: group = treatment_name return group # A Response adaptive randomization technique def double_biased_coin_urn( control_success, control_trial...
code_fim
hard
{ "lang": "python", "repo": "ShuguangSun/allocation", "path": "/allocation/adaptive_randomization.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lusccc/mise.py path: /mise/constants.py from pytz import timezone SEOUL_CODES = [ 111121, 111123, 111131, 111141, 111142, 111151, 111152, 111161, 111171, 111181, 111191, 111201, 111212, 111221, 111231, 111241, 111251, 111261...
code_fim
hard
{ "lang": "python", "repo": "lusccc/mise.py", "path": "/mise/constants.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>"영등포구": "yeongdeungpo", "동작구": "dongjak", "관악구": "gwanak", "강남구": "gangnam", "서초구": "seocho", "송파구": "songpa", "강동구": "gangdong", "금천구": "geumcheon", "강북구": "gangbuk", "양천구": "yangcheon", "노원구": "nowon", } SEOUL_STATIONS = dict(zip(SEOUL_NAMES, SEOUL_CODES)) SEOUL...
code_fim
hard
{ "lang": "python", "repo": "lusccc/mise.py", "path": "/mise/constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_NAMES_ENGDICT = { "중구": "jung", "종로구": "jongno", "용산구": "yongsan", "광진구": "gwangjin", "성동구": "seongdong", "중랑구": "jungnang", "동대문구": "dongdaemun", "성북구": "seongbuk", "도봉구": "dobong", "은평구": "eunpyeong", "서대문구": "seodaemun", "마포구": "mapo", "강서구": "gangse...
code_fim
hard
{ "lang": "python", "repo": "lusccc/mise.py", "path": "/mise/constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> steps = [{'Name': 'Debugging', 'ActionOnFailure': 'TERMINATE_CLUSTER', 'HadoopJarStep': {'Jar': 'command-runner.jar', 'Args': ['state-pusher-script']}}] results = client.run_job_flow(Name=args['<NAME>'], ...
code_fim
hard
{ "lang": "python", "repo": "cloudmesh-community/sp19-516-122", "path": "/project-code/cloudmesh.emr/cloudmesh/emr/api/manager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> client = self.get_client() results = client.describe_cluster(ClusterId=args['<CLUSTERID>']) return results['Cluster'] def stop_cluster(self, args): client = self.get_client() client.terminate_job_flows(JobFlowIds=[args['<CLUSTERID>']]) results = {"clo...
code_fim
hard
{ "lang": "python", "repo": "cloudmesh-community/sp19-516-122", "path": "/project-code/cloudmesh.emr/cloudmesh/emr/api/manager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloudmesh-community/sp19-516-122 path: /project-code/cloudmesh.emr/cloudmesh/emr/api/manager.py import boto3 from cloudmesh.management.configuration.config import Config class Manager(object): def __init__(self): return def list(self, parameter): print("list", paramete...
code_fim
hard
{ "lang": "python", "repo": "cloudmesh-community/sp19-516-122", "path": "/project-code/cloudmesh.emr/cloudmesh/emr/api/manager.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ball6847/snipt path: /snipt/wsgi.py """ WSGI config for myproject project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ <|fim_suffix|> # @todo check if sett...
code_fim
hard
{ "lang": "python", "repo": "ball6847/snipt", "path": "/snipt/wsgi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # @todo check if settings.DEBUG is True or False # setup werkzerg application = DebuggedApplication(application, evalex=True) # error page handling def null_technical_500_response(request, exc_type, exc_value, tb): raise exc_type, exc_value, tb django.views.debug.technical_500_response = null_techn...
code_fim
medium
{ "lang": "python", "repo": "ball6847/snipt", "path": "/snipt/wsgi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "seen_date" in self.data def set_seen(self): self.seen_date = dates.now_str() @property def action(self): return self.data.get("action") @action.setter def action(self, action_url): self.data["action"] = action_url @property def classi...
code_fim
medium
{ "lang": "python", "repo": "DOAJ/doaj", "path": "/portality/models/notifications.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DOAJ/doaj path: /portality/models/notifications.py from portality.dao import DomainObject from portality.lib import dates class Notification(DomainObject): """~~Notification:Model->DomainObject:Model~~""" __type__ = "notification" def __init__(self, **kwargs): super(Notific...
code_fim
hard
{ "lang": "python", "repo": "DOAJ/doaj", "path": "/portality/models/notifications.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kuanfandevops/tfrs path: /backend/api/fixtures/operational/0023_add_renewable_naptha.py from django.db import transaction from api.management.data_script import OperationalDataScript from api.models.ApprovedFuel import ApprovedFuel from api.models.DefaultCarbonIntensityCategory import \ Defa...
code_fim
hard
{ "lang": "python", "repo": "kuanfandevops/tfrs", "path": "/backend/api/fixtures/operational/0023_add_renewable_naptha.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> provisions = ApprovedFuelProvision.objects.filter( fuel__name="Ethanol" ) for provision in provisions: ApprovedFuelProvision.objects.create( fuel_id=fuel.id, provision_act_id=provision.provision_act_id, determ...
code_fim
hard
{ "lang": "python", "repo": "kuanfandevops/tfrs", "path": "/backend/api/fixtures/operational/0023_add_renewable_naptha.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhouqiw/tensor2tensor path: /tensor2tensor/models/long_answer.py # coding=utf-8 # Copyright 2017 The Tensor2Tensor Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License...
code_fim
hard
{ "lang": "python", "repo": "zhouqiw/tensor2tensor", "path": "/tensor2tensor/models/long_answer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@registry.register_hparams def long_answer_base(): """Set of hyperparameters. Returns: a hparams object """ hparams = common_hparams.basic_params1() hparams.hidden_size = 1024 hparams.batch_size = 8192 hparams.max_length = 8192 hparams.dropout = 0.0 hparams.batching_mantissa_bits = ...
code_fim
hard
{ "lang": "python", "repo": "zhouqiw/tensor2tensor", "path": "/tensor2tensor/models/long_answer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if epoch %2 == 0: checkpoint_name = os.path.join( output_dir, 'cp1_epoch'+str(epoch)+'.ckpt') save_path = saver.save(sess, checkpoint_name) np.save( os.path.join( output_dir,'logs','train_loss.npy'), np.asarray(train_loss)) np.save( os.path.join( out...
code_fim
hard
{ "lang": "python", "repo": "batmanlab/Explanation_by_Progressive_Exaggeration", "path": "/train_classifier.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: batmanlab/Explanation_by_Progressive_Exaggeration path: /train_classifier.py import numpy as np import pandas as pd import sys import os import pdb import yaml import tensorflow as tf from classifier.DenseNet import pretrained_classifier from utils import read_data_file, load_images_and_labels i...
code_fim
hard
{ "lang": "python", "repo": "batmanlab/Explanation_by_Progressive_Exaggeration", "path": "/train_classifier.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>'expression\nd'exposant n"+ "\nSans le n : 7 est 7^n"+ "\nEt 7^2n = 49^n soit 49") exp = int(input("= ")) print("Donnez la suite de l'expression,\nde facteur n sans le n: \n7 est 7*n") fac = int(input("= ")) print("Valeur en + :") pls = int(input("= ")) print("Donne...
code_fim
hard
{ "lang": "python", "repo": "Overengined/Python-for-Numworks", "path": "/scripts/maths/congtest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>onnez le modulo :") mod = int(input("mod = ")) print("Résultats :") for n in range(1,max(exp+1, mod+1)): print(str(exp) + "^" + str(n)+"+"+str(fac)+"*"+ str(n) + "+"+str(pls) + " = " + str(r(exp**n+fac*n+pls,mod)) + " [" + str(mod)+"]") else: print("t'es con ou quoi ?")<|fi...
code_fim
hard
{ "lang": "python", "repo": "Overengined/Python-for-Numworks", "path": "/scripts/maths/congtest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Overengined/Python-for-Numworks path: /scripts/maths/congtest.py from mathsup import cong,r print("1: x en facteur\n2: n en exposant\n") s = int(input("")) if s == 1: #x en facteur print("Donnez l'expression\nde facteur x"+ "\nSans le x : 7 est 7x") exp = int(input("=...
code_fim
hard
{ "lang": "python", "repo": "Overengined/Python-for-Numworks", "path": "/scripts/maths/congtest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rospy.init_node('controller',anonymous = True) rospy.Subscriber('destination',FloatList,callback) rospy.spin() if __name__ == '__main__': try: controller() except rospy.ROSInterruptException: pass<|fim_prefix|># repo: chula-eic/Neo-FRA path: /cru_robot/controller.py #!/usr/bin/env python3 impor...
code_fim
medium
{ "lang": "python", "repo": "chula-eic/Neo-FRA", "path": "/cru_robot/controller.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chula-eic/Neo-FRA path: /cru_robot/controller.py #!/usr/bin/env python3 import rospy from std_msgs.msg import String from cru_robot.msg import FloatList <|fim_suffix|>if __name__ == '__main__': try: controller() except rospy.ROSInterruptException: pass<|fim_middle|>pub = rospy.Publisher('d...
code_fim
hard
{ "lang": "python", "repo": "chula-eic/Neo-FRA", "path": "/cru_robot/controller.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class Project(troposphere.iot1click.Project, Mixin): def __init__(self, title, # type: str template=None, # type: Template validation=True, # type: bool PlacementTemplate=REQUIRED, # type: _PlacementTemplate Descripti...
code_fim
hard
{ "lang": "python", "repo": "tsuttsu305/troposphere_mate-project", "path": "/troposphere_mate/iot1click.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Project(troposphere.iot1click.Project, Mixin): def __init__(self, title, # type: str template=None, # type: Template validation=True, # type: bool PlacementTemplate=REQUIRED, # type: _PlacementTemplate Descript...
code_fim
hard
{ "lang": "python", "repo": "tsuttsu305/troposphere_mate-project", "path": "/troposphere_mate/iot1click.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tsuttsu305/troposphere_mate-project path: /troposphere_mate/iot1click.py # -*- coding: utf-8 -*- """ This code is auto generated from troposphere_mate.code_generator.__init__.py scripts. """ import sys if sys.version_info.major >= 3 and sys.version_info.minor >= 5: # pragma: no cover from ...
code_fim
hard
{ "lang": "python", "repo": "tsuttsu305/troposphere_mate-project", "path": "/troposphere_mate/iot1click.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sgk98/Pegasos path: /pegasos.py import numpy as np import math import random from sklearn.datasets import make_classification import matplotlib.pyplot as plt def solve(X,Y,lm,n_iter=100): C=len(Y) W=np.array([0 for i in range(len(X[0]))]) <|fim_suffix|> if __name__=="__main__": separable =...
code_fim
hard
{ "lang": "python", "repo": "sgk98/Pegasos", "path": "/pegasos.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(len(X)): res=np.dot(W.T,X[i]) if res*Y[i]>=0: correct+=1.0 total+=1.0 print(correct/total)<|fim_prefix|># repo: sgk98/Pegasos path: /pegasos.py import numpy as np import math import random from sklearn.datasets import make_classification import matplotlib.pyplot as plt def sol...
code_fim
hard
{ "lang": "python", "repo": "sgk98/Pegasos", "path": "/pegasos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sureleo/leetcode path: /archive/python/LRUCache.py class Node: def __init__(self, key, value): self.key = key self.value = value self.prev = None self.next = None class DoublyLinkedList: def __init__(self): self.head = None self.tail = None...
code_fim
hard
{ "lang": "python", "repo": "sureleo/leetcode", "path": "/archive/python/LRUCache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if key in self.D: self.D[key].value = value self.cache.removeNode(self.D[key]) self.cache.addFirst(self.D[key]) else: if self.size < self.capacity: self.size += 1 else: del self.D[self.cache.tail.ke...
code_fim
hard
{ "lang": "python", "repo": "sureleo/leetcode", "path": "/archive/python/LRUCache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: harshvardhanp/SMS_sysinfo path: /sms_sysinfo.py #!/usr/bin/python3 from twilio.rest import Client import sys import platform import time account = "XXXXXXXXXXXXXXXXXXXXXXXXXX" token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX" twilio_cell = 'XXXXXXXXXXXXXXX' my_cell = 'XXXXXXXXXXXX' client = Client(accou...
code_fim
medium
{ "lang": "python", "repo": "harshvardhanp/SMS_sysinfo", "path": "/sms_sysinfo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import netifaces as ni os_name = platform.platform() sys_type = platform.machine() msg = "OS Name:{}\nSystem type:{}\n".format(os_name, sys_type) v = '' for i in ni.interfaces(): ni.ifaddresses(i) v += ni.ifaddresses(i)[ni.AF_INET][0]['addr'] + "\t" v += ...
code_fim
hard
{ "lang": "python", "repo": "harshvardhanp/SMS_sysinfo", "path": "/sms_sysinfo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import wmi import datetime w = wmi.WMI() sysinfo = w.Win32_ComputerSystem()[0] host_name = sysinfo.DNSHostName os_name = platform.platform() sys_type = platform.machine() msg = "Computer Name:{}\nOS Name:{}\nSystem type:{}\n".format(host_name, os_name, sys_type) msg +=...
code_fim
medium
{ "lang": "python", "repo": "harshvardhanp/SMS_sysinfo", "path": "/sms_sysinfo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return torch.optim.SGD(parameters, lr = lr, momentum = 0.9, weight_decay=weight_decay);<|fim_prefix|># repo: gianlucapagliara/Benchmark-Analysis-of-Speaker-Recognition-Techniques path: /graphs/optimizers/sgd.py #! /usr/bin/python # -*- encoding: utf-8 -*- import torch <|fim_middle|>def Optimizer(para...
code_fim
easy
{ "lang": "python", "repo": "gianlucapagliara/Benchmark-Analysis-of-Speaker-Recognition-Techniques", "path": "/graphs/optimizers/sgd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gianlucapagliara/Benchmark-Analysis-of-Speaker-Recognition-Techniques path: /graphs/optimizers/sgd.py #! /usr/bin/python # -*- encoding: utf-8 -*- <|fim_suffix|> return torch.optim.SGD(parameters, lr = lr, momentum = 0.9, weight_decay=weight_decay);<|fim_middle|>import torch def Optimizer(param...
code_fim
medium
{ "lang": "python", "repo": "gianlucapagliara/Benchmark-Analysis-of-Speaker-Recognition-Techniques", "path": "/graphs/optimizers/sgd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iris-garcia/sysdig-sdk-python path: /sdcclient/_monitor.py import json import re import requests from sdcclient._common import _SdcCommon from sdcclient.monitor import EventsClientV2, DashboardsClientV3 class SdMonitorClient(DashboardsClientV3, EventsClientV2, _SdcCommon): def __init__(s...
code_fim
hard
{ "lang": "python", "repo": "iris-garcia/sysdig-sdk-python", "path": "/sdcclient/_monitor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> **Example** `examples/update_alert.py <https://github.com/draios/python-sdc-client/blob/master/examples/update_alert.py>`_ ''' if 'id' not in alert: return [False, "Invalid alert format"] res = requests.put(self.url + '/api/alerts/' + str(alert['id'...
code_fim
hard
{ "lang": "python", "repo": "iris-garcia/sysdig-sdk-python", "path": "/sdcclient/_monitor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> **Success Return Value** ``None``. **Example** `examples/delete_alert.py <https://github.com/draios/python-sdc-client/blob/master/examples/delete_alert.py>`_ ''' if 'id' not in alert: return [False, 'Invalid alert format'] res =...
code_fim
hard
{ "lang": "python", "repo": "iris-garcia/sysdig-sdk-python", "path": "/sdcclient/_monitor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: njmhendrix/grand-challenge.org path: /app/grandchallenge/components/validators.py from django.core.exceptions import SuspiciousFileOperation, ValidationError from django.utils._os import safe_join def validate_safe_path(value): """Ensures that the path is safe and normalised.""" base = ...
code_fim
medium
{ "lang": "python", "repo": "njmhendrix/grand-challenge.org", "path": "/app/grandchallenge/components/validators.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }