text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: tongda/windbag path: /windbag/data/cornell_movie.py """ A neural chatbot using sequence to sequence model with attentional decoder. This is based on Google Translate Tensorflow model https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/ Sequence to sequence model by Cho et...
code_fim
hard
{ "lang": "python", "repo": "tongda/windbag", "path": "/windbag/data/cornell_movie.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_batch(data_bucket, bucket_id, batch_size=1): """ Return one batch to feed into the model """ # only pad to the max length of the bucket encoder_size, decoder_size = config.BUCKETS[bucket_id] encoder_inputs, decoder_inputs = [], [] for _ in range(batch_size): encoder_input, decoder_...
code_fim
hard
{ "lang": "python", "repo": "tongda/windbag", "path": "/windbag/data/cornell_movie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BenSchZA/wattie-whatsapp-bot path: /domain/delivery.py class Delivery: def __init__(self, number=None, txt='', url=None, media=None, filename=None) -> None: super().__init__() self.number = number self.txt = txt self.url = url self.media = media ...
code_fim
easy
{ "lang": "python", "repo": "BenSchZA/wattie-whatsapp-bot", "path": "/domain/delivery.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.number = number return self<|fim_prefix|># repo: BenSchZA/wattie-whatsapp-bot path: /domain/delivery.py class Delivery: def __init__(self, number=None, txt='', url=None, media=None, filename=None) -> None: <|fim_middle|> super().__init__() self.number = number ...
code_fim
medium
{ "lang": "python", "repo": "BenSchZA/wattie-whatsapp-bot", "path": "/domain/delivery.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Parse the traits for record.""" data = defaultdict(list) for trait, parser in self.parsers: for field_name in self.search_fields: field = record.get(field_name) if not field: continue parsed = parse...
code_fim
hard
{ "lang": "python", "repo": "rafelafrance/traiter_vertnet", "path": "/vertnet/pylib/record_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rafelafrance/traiter_vertnet path: /vertnet/pylib/record_parser.py """Parse all traits for the input record.""" from collections import defaultdict class RecordParser: # pylint: disable=too-few-public-methods """Handles all of the parsed traits for a record.""" def __init__(self, arg...
code_fim
hard
{ "lang": "python", "repo": "rafelafrance/traiter_vertnet", "path": "/vertnet/pylib/record_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>'u'): v=v+1 return v w1=raw_input("enter a word: ") s=w1 vowel=vowels(s) print "total no. of vowels in %s are "%(w1),vowel<|fim_prefix|># repo: gautam-balamurali/Python-Programs path: /no._of_vowels.py def vowels(w): w.lower() v=0 l=len(w) for i in range(0,l):<|fim_middle|> ch=w[i] ...
code_fim
medium
{ "lang": "python", "repo": "gautam-balamurali/Python-Programs", "path": "/no._of_vowels.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gautam-balamurali/Python-Programs path: /no._of_vowels.py def vowels(w): w.lower() v=0 l=len(w) for i in range(0,l): ch=w[i] if(ch=='a' or ch=='e' or ch=='i' or ch=='o' or ch==<|fim_suffix|>vowel=vowels(s) print "total no. of vowels in %s are "%(w1),vowel<|fim_middle|>'u'): v=v...
code_fim
medium
{ "lang": "python", "repo": "gautam-balamurali/Python-Programs", "path": "/no._of_vowels.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>vowel=vowels(s) print "total no. of vowels in %s are "%(w1),vowel<|fim_prefix|># repo: gautam-balamurali/Python-Programs path: /no._of_vowels.py def vowels(w): w.lower() v=0 l=len(w) for i in range(0,l):<|fim_middle|> ch=w[i] if(ch=='a' or ch=='e' or ch=='i' or ch=='o' or ch=='u'): v=v...
code_fim
medium
{ "lang": "python", "repo": "gautam-balamurali/Python-Programs", "path": "/no._of_vowels.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Skip the next instruction on zerox (flag) zero. If the register zerox_flag is True then the IP is incremented by two to execute the *next* instruction. The addr is ignored and can be zero. """ if self.reg.zerox_flag: self.reg.ip_inc() ...
code_fim
hard
{ "lang": "python", "repo": "kmggh/python-simple-machine", "path": "/decoder.py", "mode": "spm", "license": "Artistic-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kmggh/python-simple-machine path: /decoder.py # coding: utf-8 # © 2018 by Ken Guyton. All rights reserved. """Decode and execute opcodes and addresses. Each instruction is a single value op code and a single value which can be interpreted as an address, an extended opcode, or a set of flags. "...
code_fim
hard
{ "lang": "python", "repo": "kmggh/python-simple-machine", "path": "/decoder.py", "mode": "psm", "license": "Artistic-2.0", "source": "the-stack-v2" }
<|fim_suffix|> If the register zerox_flag is True then the IP is incremented by two to execute the *next* instruction. The addr is ignored and can be zero. """ if self.reg.zerox_flag: self.reg.ip_inc() self.reg.ip_inc() def addx(self, addr): ...
code_fim
hard
{ "lang": "python", "repo": "kmggh/python-simple-machine", "path": "/decoder.py", "mode": "spm", "license": "Artistic-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: venom1270/legomindstorm-challenge path: /hello.py #!/usr/bin/env python3 '''Hello to the world from ev3dev.org''' import os import sys import time import json import math import urllib.request from ev3dev.ev3 import LargeMotor, Sound, ColorSensor, GyroSensor # state constants ON = True OFF = Fa...
code_fim
hard
{ "lang": "python", "repo": "venom1270/legomindstorm-challenge", "path": "/hello.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> global searching_neighbourhood nonlocal neighbourhood_locations searching_neighbourhood = False neighbourhood_locations = [] global searching_neighbourhood searching_neighbourhood = False neighbourhood_locations = [] while locations: next_loca...
code_fim
hard
{ "lang": "python", "repo": "venom1270/legomindstorm-challenge", "path": "/hello.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ouranosinc/pyPavics path: /pavics/ncvalidator.py import os import glob import logging import random import numpy as np import matplotlib.pyplot as plt import netCDF4 fig = plt.figure(figsize=(8, 6)) def set_logger(log_file=None): logger = logging.getLogger() if len(logger.handlers): ...
code_fim
hard
{ "lang": "python", "repo": "Ouranosinc/pyPavics", "path": "/pavics/ncvalidator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def validate_calendar_consistency(nc_files, log_file=None): set_logger(log_file) try: for i, nc_file in enumerate(nc_files): nc = netCDF4.Dataset(nc_file, 'r') if 'time' in nc.variables: nctime = nc.variables['time'] if not hasattr(nc...
code_fim
hard
{ "lang": "python", "repo": "Ouranosinc/pyPavics", "path": "/pavics/ncvalidator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Single file checks for i, nc_file in enumerate(nc_files): random_sample_map = False random_sample_timeseries = False if i == fn: if sample_map: random_sample_map = True if sample_timeseries: random_sample_timeseries ...
code_fim
hard
{ "lang": "python", "repo": "Ouranosinc/pyPavics", "path": "/pavics/ncvalidator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if n < 2: return s res = ['']*n i, flag = 0, -1 for c in s: res[i] += c if i == 0 or i == n-1: flag = -flag i += flag return "".join(res) if __name__ == "__main__": s = Solution() out = s.convert("leetcode", ...
code_fim
hard
{ "lang": "python", "repo": "Qinpeng96/FindJob", "path": "/编程/leetcode_Q/6.z型字符序列.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def convert(self, s:str, n:int)-> str: if n < 2: return s res = ['']*n i, flag = 0, -1 for c in s: res[i] += c if i == 0 or i == n-1: flag = -flag i += flag return "".join(res) if __name__ == "__main__": s = ...
code_fim
hard
{ "lang": "python", "repo": "Qinpeng96/FindJob", "path": "/编程/leetcode_Q/6.z型字符序列.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Qinpeng96/FindJob path: /编程/leetcode_Q/6.z型字符序列.py """ 将一个给定字符串根据给定的行数,以从上往下、从左到右进行 Z 字形排列。 比如输入字符串为 "LEETCODEISHIRING" 行数为 3 时,排列如下: L C I R E T O E S I I G E D H N 之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:"LCIRETOESIIGEDHN"。 """ class Solution(object): <|fim_suffix|> if...
code_fim
hard
{ "lang": "python", "repo": "Qinpeng96/FindJob", "path": "/编程/leetcode_Q/6.z型字符序列.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> op_with_nothing_input(op_with_nothing_output())<|fim_prefix|># repo: dagster-io/dagster path: /python_modules/dagster-test/dagster_test/toys/nothing_input.py from dagster import In, Nothing, job, op @op def op_with_nothing_output() -> None: ... <|fim_middle|> @op(ins={"in1": In(Nothing)}) def ...
code_fim
medium
{ "lang": "python", "repo": "dagster-io/dagster", "path": "/python_modules/dagster-test/dagster_test/toys/nothing_input.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dagster-io/dagster path: /python_modules/dagster-test/dagster_test/toys/nothing_input.py from dagster import In, Nothing, job, op <|fim_suffix|> op_with_nothing_input(op_with_nothing_output())<|fim_middle|>@op def op_with_nothing_output() -> None: ... @op(ins={"in1": In(Nothing)}) def ...
code_fim
medium
{ "lang": "python", "repo": "dagster-io/dagster", "path": "/python_modules/dagster-test/dagster_test/toys/nothing_input.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: toinsson/pynatnetclient path: /sample.py import time import logging from pynatnetclient import NatNetClient logging.basicConfig(level=logging.DEBUG) <|fim_suffix|>flag = True while flag: try: time.sleep(0.1) with nnc.ed.lock: print(nnc.ed.frameNumber) except ...
code_fim
medium
{ "lang": "python", "repo": "toinsson/pynatnetclient", "path": "/sample.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>nnc.run() flag = True while flag: try: time.sleep(0.1) with nnc.ed.lock: print(nnc.ed.frameNumber) except KeyboardInterrupt: nnc.stop() flag = False<|fim_prefix|># repo: toinsson/pynatnetclient path: /sample.py import time import logging from pynatnetc...
code_fim
medium
{ "lang": "python", "repo": "toinsson/pynatnetclient", "path": "/sample.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> z = F.relu(self.critic_input(x)) z = F.relu(self.critic_fc1(z)) value = self.critic_output(z) return logits, value class SharedAgent(torch.nn.Module): """ A simple two headed / chimera Actor Critic agent. The actor and critic share the body of the network. ...
code_fim
hard
{ "lang": "python", "repo": "mpgussert/fundamentalRL", "path": "/A2C/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mpgussert/fundamentalRL path: /A2C/model.py import gym import torch import torch.nn as nn import torch.nn.functional as F class Agent(torch.nn.Module): """ A simple Actor Critic agent. note that we do not apply any form of normalization or rescaling to the output of the actor ...
code_fim
medium
{ "lang": "python", "repo": "mpgussert/fundamentalRL", "path": "/A2C/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChuckWoodraska/OverTheWire path: /example_5_putting_it_together/runner.py import requests import httpimport import time import json import traceback BASE_URL = 'http://127.0.0.1:5002' httpimport.INSECURE = True <|fim_suffix|> print(data_dict) httpimport.add_remote_repo(data_dict['import_...
code_fim
medium
{ "lang": "python", "repo": "ChuckWoodraska/OverTheWire", "path": "/example_5_putting_it_together/runner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: check_commands() time.sleep(10) except: print('Oh no something went wrong.') if __name__ == '__main__': main()<|fim_prefix|># repo: ChuckWoodraska/OverTheWire path: /example_5_putting_it_together/runner.py import requests impo...
code_fim
medium
{ "lang": "python", "repo": "ChuckWoodraska/OverTheWire", "path": "/example_5_putting_it_together/runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: faizrahmathidayat/trisakti-backend path: /config/urls.py from django.conf import settings from django.urls import include, path from django.conf.urls.static import static from django.contrib import admin from django.views.generic import TemplateView from django.views import defaults as default_vi...
code_fim
hard
{ "lang": "python", "repo": "faizrahmathidayat/trisakti-backend", "path": "/config/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if settings.DEBUG: # This allows the error pages to be debugged during development, just visit # these url in browser to see how these error pages look like. urlpatterns += [ path( "400/", default_views.bad_request, kwargs={"exception": Exception("Ba...
code_fim
hard
{ "lang": "python", "repo": "faizrahmathidayat/trisakti-backend", "path": "/config/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adamint/cloudmesh-pi-burn path: /cloudmesh/burn/util.py import os import platform import sys from pathlib import Path import requests # noinspection PyPep8 if True: ############################################## # # Ignore on pi: DH KEY TOO SMALL # # see: https://stackoverf...
code_fim
hard
{ "lang": "python", "repo": "adamint/cloudmesh-pi-burn", "path": "/cloudmesh/burn/util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> TODO: should probably mocve to cloudmesh.common :param dryrun: if set to true, does not terminate if not root user :type dryrun: bool :param terminate: terminates if not root user and dryrun is False :type terminate: bool """ uid = os.getuid() if uid == 0: print("Y...
code_fim
hard
{ "lang": "python", "repo": "adamint/cloudmesh-pi-burn", "path": "/cloudmesh/burn/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :return: """ if mode != 'r' and mode != 'rb': print(f"ERROR: incorrect mode : expected 'r' or 'rb' given {mode}\n") else: with open(Path(os.path.expanduser(filename)), mode)as f: content = f.read() f.close() return content def check_root(dr...
code_fim
hard
{ "lang": "python", "repo": "adamint/cloudmesh-pi-burn", "path": "/cloudmesh/burn/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): super(DisplayMetricsReport, self).setUp() g_common_obj.root_on_device() def tearDown(self): super(DisplayMetricsReport, self).tearDown() def test_Display_MetricsReport(self): print("[RunTest]: %s" % self.__str__()) print("1.[Debug] co...
code_fim
medium
{ "lang": "python", "repo": "intel/test-framework-and-suites-for-android", "path": "/acs_test_suites/OTC/libs/pyunit/tests/Graphics_Display/Display/test_Display_MetricsReport.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: intel/test-framework-and-suites-for-android path: /acs_test_suites/OTC/libs/pyunit/tests/Graphics_Display/Display/test_Display_MetricsReport.py ''' Copyright (C) 2018 Intel Corporation ? Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance...
code_fim
medium
{ "lang": "python", "repo": "intel/test-framework-and-suites-for-android", "path": "/acs_test_suites/OTC/libs/pyunit/tests/Graphics_Display/Display/test_Display_MetricsReport.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: logimic/iqrfboard path: /examples/embedded-led.py # # Copyright Logimic,s.r.o., www.logimic.com # # 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 at # # http://www.apac...
code_fim
hard
{ "lang": "python", "repo": "logimic/iqrfboard", "path": "/examples/embedded-led.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # GREEN LED ON await websocket.send(json.dumps(LEDG_ON)) print(f"Sent > {LEDG_ON}") response = await websocket.recv() print(f"Received < {response}") # Wait 2 sec time.sleep(2) # GREEN LED OFF await websocket.send(json.dump...
code_fim
hard
{ "lang": "python", "repo": "logimic/iqrfboard", "path": "/examples/embedded-led.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Get random images ; parse out thumbnails ; construct plate-IFUs imfiles = None try: imfiles = get_random_images(num=self.random['imnumber'], release=self._release) except (MarvinError, AssertionError) as e: self.random['error'] = 'Error: could not ...
code_fim
hard
{ "lang": "python", "repo": "sdss/marvin", "path": "/python/marvin/web/controllers/images.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sdss/marvin path: /python/marvin/web/controllers/images.py #!/usr/bin/env python # encoding: utf-8 ''' Created by Brian Cherinka on 2016-04-29 01:15:33 Licensed under a 3-clause BSD license. Revision History: Initial Version: 2016-04-29 01:15:33 by Brian Cherinka Last Modified On: 2016-...
code_fim
medium
{ "lang": "python", "repo": "sdss/marvin", "path": "/python/marvin/web/controllers/images.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Decrypt the Password using the Symmetric Key unciphered_text = (cipher_suite.decrypt(ciphered_text)) print(unciphered_text)<|fim_prefix|># repo: JanviChitroda24/pythonprogramming path: /Others/encrypt-pw.py from cryptography.fernet import Fernet # To Generate a Symmetric (Secret) Key key = Fernet.gene...
code_fim
medium
{ "lang": "python", "repo": "JanviChitroda24/pythonprogramming", "path": "/Others/encrypt-pw.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JanviChitroda24/pythonprogramming path: /Others/encrypt-pw.py from cryptography.fernet import Fernet <|fim_suffix|># Decrypt the Password using the Symmetric Key unciphered_text = (cipher_suite.decrypt(ciphered_text)) print(unciphered_text)<|fim_middle|># To Generate a Symmetric (Secret) Key key...
code_fim
hard
{ "lang": "python", "repo": "JanviChitroda24/pythonprogramming", "path": "/Others/encrypt-pw.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Encrypt the Password using the Symmetric Key cipher_suite = Fernet(key) ciphered_text = cipher_suite.encrypt(b"Rahul@123!") print(ciphered_text) # Decrypt the Password using the Symmetric Key unciphered_text = (cipher_suite.decrypt(ciphered_text)) print(unciphered_text)<|fim_prefix|># repo: JanviChi...
code_fim
medium
{ "lang": "python", "repo": "JanviChitroda24/pythonprogramming", "path": "/Others/encrypt-pw.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>processThread = threading.Thread(target=start_server, daemon=True) processThread.start() # Register the shutdown handler atexit.register(stop_server) from webinterface import views from webinterface import views_api<|fim_prefix|># repo: onlaj/Piano-LED-Visualizer path: /webinterface/__init__.py from fl...
code_fim
hard
{ "lang": "python", "repo": "onlaj/Piano-LED-Visualizer", "path": "/webinterface/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: onlaj/Piano-LED-Visualizer path: /webinterface/__init__.py from flask import Flask import asyncio import websockets import threading from lib.functions import get_ip_address import time import atexit UPLOAD_FOLDER = 'Songs/' <|fim_suffix|> async def main(): async with websockets.serv...
code_fim
hard
{ "lang": "python", "repo": "onlaj/Piano-LED-Visualizer", "path": "/webinterface/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ttlttl/fang path: /app/decorators.py # -*- coding=UTF-8 -*- from functools import wraps from flask_login import current_user from flask import abort <|fim_suffix|> if not current_user.is_administrator(): abort(404) return func(*args, **kwargs) return decorated_func...
code_fim
medium
{ "lang": "python", "repo": "ttlttl/fang", "path": "/app/decorators.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not current_user.is_administrator(): abort(404) return func(*args, **kwargs) return decorated_func<|fim_prefix|># repo: ttlttl/fang path: /app/decorators.py # -*- coding=UTF-8 -*- from functools import wraps from flask_login import current_user from flask import abort ...
code_fim
medium
{ "lang": "python", "repo": "ttlttl/fang", "path": "/app/decorators.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lab603/PicEncyclopedias path: /jni-build/jni-build/jni/include/tensorflow/python/ops/init_ops.py # Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
code_fim
hard
{ "lang": "python", "repo": "Lab603/PicEncyclopedias", "path": "/jni-build/jni-build/jni/include/tensorflow/python/ops/init_ops.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TODO(vrv): Unhide when we are ready to expose this publicly. def _random_walk(shape, nonlinearity, dtype=dtypes.float32, seed=None, name="random_walk"): """Create a random tensor such that backprop neither vanishes nor explodes. Args: shape: a python array of int or a 1-d tens...
code_fim
hard
{ "lang": "python", "repo": "Lab603/PicEncyclopedias", "path": "/jni-build/jni-build/jni/include/tensorflow/python/ops/init_ops.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mean = 0.0 stddev = rwg / math.sqrt(float(num_inputs)) return random_ops.random_normal(shape, mean=mean, stddev=stddev, dtype=dtype, seed=seed, name=name) # TODO(vrv): Unhide when we are ready to expose this publicly. class _RandomWalkInitializer(object): """An...
code_fim
hard
{ "lang": "python", "repo": "Lab603/PicEncyclopedias", "path": "/jni-build/jni-build/jni/include/tensorflow/python/ops/init_ops.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sand_vol[n] = np.maximum(0,circslice).sum() mud_vol[n] = (1-np.abs(circslice)).sum() rad_dist[n] = r0 seds = {} seds['norm_distance_from_apex'] = rad_dist / 100. seds['sand_frac_by_vol'] = sand_vol / (sand_vol + mud_vol) seds['sand_vol'] = sand_vol seds['mud...
code_fim
hard
{ "lang": "python", "repo": "mperignon/delta_metrics", "path": "/stratigraphy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def radial_stratigraphy(strata, radii = [0.1, 0.3, 0.5], centerpoint = None, density = 0.5): ''' Extracts slices of the stratigraphy at given radii from a centerpoint Input: ------- strata: (m * n * 3) numpy a...
code_fim
hard
{ "lang": "python", "repo": "mperignon/delta_metrics", "path": "/stratigraphy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mperignon/delta_metrics path: /stratigraphy.py import numpy as np from profiles import radial_profile from scipy import signal def sand_body_properties(strata_IMG): ''' Calculate sand body properties Input: ------ strata_IMG: 2D vertical slice of stratigraphy, ...
code_fim
hard
{ "lang": "python", "repo": "mperignon/delta_metrics", "path": "/stratigraphy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>start_idx = T.iscalar() end_idx = T.iscalar() updates = [(A, T.set_subtensor(A[start_idx:end_idx], A[start_idx:end_idx] - A.sum(0)))] f = theano.function([start_idx, end_idx], [], updates=updates) theano.printing.debugprint(f)<|fim_prefix|># repo: benanne/theano_wmf path: /test.py import numpy as np i...
code_fim
easy
{ "lang": "python", "repo": "benanne/theano_wmf", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: benanne/theano_wmf path: /test.py import numpy as np import theano import theano.tensor as T <|fim_suffix|>start_idx = T.iscalar() end_idx = T.iscalar() updates = [(A, T.set_subtensor(A[start_idx:end_idx], A[start_idx:end_idx] - A.sum(0)))] f = theano.function([start_idx, end_idx], [], updates...
code_fim
medium
{ "lang": "python", "repo": "benanne/theano_wmf", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>updates = [(A, T.set_subtensor(A[start_idx:end_idx], A[start_idx:end_idx] - A.sum(0)))] f = theano.function([start_idx, end_idx], [], updates=updates) theano.printing.debugprint(f)<|fim_prefix|># repo: benanne/theano_wmf path: /test.py import numpy as np import theano import theano.tensor as T a = np....
code_fim
medium
{ "lang": "python", "repo": "benanne/theano_wmf", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andybalholm/edl path: /Library/gpt.py import binascii from Library.utils import * class gpt: from enum import Enum gpt_header = [ ('signature', '8s'), ('revision', '>I'), ('header_size', 'I'), ('crc32', 'I'), ('reserved', 'I'), ('current_lb...
code_fim
hard
{ "lang": "python", "repo": "andybalholm/edl", "path": "/Library/gpt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.header = read_object(gptdata[sectorsize:sectorsize+0x5C], self.gpt_header) self.sectorsize=sectorsize if self.header["signature"]!=b"EFI PART": print("Invalid or unknown GPT magic.") return False if self.header["revision"]!=0x100: pr...
code_fim
hard
{ "lang": "python", "repo": "andybalholm/edl", "path": "/Library/gpt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tweak-com-public/tweak-api-client-python path: /test/test_workflow_api.py # coding: utf-8 """ tweak-api Tweak API to integrate with all the Tweak services. You can find out more about Tweak at <a href='https://www.tweak.com'>https://www.tweak.com</a>, #tweak. OpenAPI spec ver...
code_fim
hard
{ "lang": "python", "repo": "tweak-com-public/tweak-api-client-python", "path": "/test/test_workflow_api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Replace attributes for a model instance and persist it into the data source. """ pass def test_workflows_id_team_get(self): """ Test case for workflows_id_team_get Fetches belongsTo relation team. """ pass def test_workflows_id_tem...
code_fim
hard
{ "lang": "python", "repo": "tweak-com-public/tweak-api-client-python", "path": "/test/test_workflow_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SimonCqk/mars path: /mars/services/web/supervisor.py # Copyright 1999-2020 Alibaba Group Holding Ltd. # # 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 at # # http://ww...
code_fim
hard
{ "lang": "python", "repo": "SimonCqk/mars", "path": "/mars/services/web/supervisor.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> retrial = 5 while retrial: try: if port is None: port = get_next_port() self._web_server = Server( handlers, allow_websocket_origin=['*'], address=host, port=port, e...
code_fim
hard
{ "lang": "python", "repo": "SimonCqk/mars", "path": "/mars/services/web/supervisor.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ducis28/multiple-objects-gan path: /code/clevr/miscc/datasets.py from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import torch.utils.data as data import PIL import os import os.path import random ...
code_fim
hard
{ "lang": "python", "repo": "ducis28/multiple-objects-gan", "path": "/code/clevr/miscc/datasets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bbox = torch.from_numpy(bbox) bbox = bbox.view(-1, 4) transf_matrices_inv = compute_transformation_matrix_inverse(bbox) transf_matrices_inv = transf_matrices_inv.view(self.max_objects, 2, 3) transf_matrices = compute_transformation_matrix(bbox) transf_matric...
code_fim
hard
{ "lang": "python", "repo": "ducis28/multiple-objects-gan", "path": "/code/clevr/miscc/datasets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if raw_question["type"] == exercises.MULTIPLE_SELECTION: return questions.MultipleSelectQuestion( id=raw_question["id"], question=raw_question["question"], correct_answers=raw_question["correct_answers"], all_answers=raw_question["all_answers"],...
code_fim
hard
{ "lang": "python", "repo": "kplloyd89/ricecake", "path": "/ricecake/ricewrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kplloyd89/ricecake path: /ricecake/ricewrapper.py import os from enum import Enum from ricecooker.classes import nodes, questions, files from ricecooker.classes.licenses import get_license from ricecooker.exceptions import UnknownContentKindError, UnknownFileTypeError, UnknownQuestionTypeError, r...
code_fim
hard
{ "lang": "python", "repo": "kplloyd89/ricecake", "path": "/ricecake/ricewrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matkovic/Wi-Mind path: /WirelessMonitoringModule/gr-radar/examples/usrp/usrp_echotimer_cw.py #!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: Usrp Echotimer Cw # Generated: Fri Jan 26 19:15:02 2018 ###########...
code_fim
hard
{ "lang": "python", "repo": "matkovic/Wi-Mind", "path": "/WirelessMonitoringModule/gr-radar/examples/usrp/usrp_echotimer_cw.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> def get_min_output_buffer(self): return self.min_output_buffer def set_min_output_buffer(self, min_output_buffer): self.min_output_buffer = min_output_buffer def get_gain_tx(self): return self.gain_tx def set_gain_tx(self, gain_tx): self.gain_tx = gain_tx...
code_fim
hard
{ "lang": "python", "repo": "matkovic/Wi-Mind", "path": "/WirelessMonitoringModule/gr-radar/examples/usrp/usrp_echotimer_cw.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahmetakif/Voice-Controlled-Raspberry-Pi-Robot path: /OLD CODE/Robotics/servo1.py import RPi.GPIO as gpio import time <|fim_suffix|> a = input("aci:") servo(a)<|fim_middle|>while (True): def servo(tf): gpio.setmode(gpio.BCM) gpio.setup(5,gpio.OUT) p = gpio.PWM(5...
code_fim
hard
{ "lang": "python", "repo": "ahmetakif/Voice-Controlled-Raspberry-Pi-Robot", "path": "/OLD CODE/Robotics/servo1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> a = input("aci:") servo(a)<|fim_prefix|># repo: ahmetakif/Voice-Controlled-Raspberry-Pi-Robot path: /OLD CODE/Robotics/servo1.py import RPi.GPIO as gpio import time <|fim_middle|>while (True): def servo(tf): gpio.setmode(gpio.BCM) gpio.setup(5,gpio.OUT) p = gpio.PWM(5...
code_fim
hard
{ "lang": "python", "repo": "ahmetakif/Voice-Controlled-Raspberry-Pi-Robot", "path": "/OLD CODE/Robotics/servo1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> error_codes = { 'no_permission': ('You have no permission', '没有权限'), 'user_not_found': ('User not found', '用户未找到'), 'invalid_token': ('Invalid token', '无效的token'), 'invalid_email': ('Invalid email', '无效的邮箱'), 'invalid_mobile': ('Invalid mobile', '无效的手机号'), } error_codes.update(app.co...
code_fim
easy
{ "lang": "python", "repo": "jizhouli/ladder-tournament", "path": "/requirements/zaih-core/zaih_core/error_codes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jizhouli/ladder-tournament path: /requirements/zaih-core/zaih_core/error_codes.py # -*- coding: utf-8 -*- from __future__ import unicode_literals <|fim_suffix|>error_codes.update(app.config.get('ERROR_CODES', {}))<|fim_middle|>from flask import current_app as app error_codes = { 'no_permis...
code_fim
hard
{ "lang": "python", "repo": "jizhouli/ladder-tournament", "path": "/requirements/zaih-core/zaih_core/error_codes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def _hash_data(data, alg="sha256"): """Returns the hash value of the specified data using the specified hashing algorithm""" m = hashlib.new(alg) m.update(data) return m.hexdigest()<|fim_prefix|># repo: pmay/tifinity path: /tifinity/actions/checksum.p...
code_fim
hard
{ "lang": "python", "repo": "pmay/tifinity", "path": "/tifinity/actions/checksum.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return hashes @staticmethod def _hash_data(data, alg="sha256"): """Returns the hash value of the specified data using the specified hashing algorithm""" m = hashlib.new(alg) m.update(data) return m.hexdigest()<|fim_prefix|># repo: pmay/tifinity path: /tifi...
code_fim
hard
{ "lang": "python", "repo": "pmay/tifinity", "path": "/tifinity/actions/checksum.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmay/tifinity path: /tifinity/actions/checksum.py import hashlib class Checksum(): @staticmethod def checksum(tiff, alg="md5", justimage=False): hashes = { 'full': 'Unknown', 'images': 'Unknown', 'ifds': 'Unknown' } if not justimage...
code_fim
hard
{ "lang": "python", "repo": "pmay/tifinity", "path": "/tifinity/actions/checksum.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_downloader_can_download_file(self): dl = Downloader("https://arxiv.org/pdf/1708.03615.pdf") self.assertEqual(dl.filename, "1708.03615.pdf") self.assertTrue(os.path.isfile(dl.full_path)) def test_downloader_handles_invalid_urls(self): self.assertRaise...
code_fim
hard
{ "lang": "python", "repo": "saonam/extractpdf", "path": "/extractpdf/tests/downloader_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saonam/extractpdf path: /extractpdf/tests/downloader_test.py # -*- coding: utf-8 -*- import unittest import os import os.path from extractpdf.downloader import Downloader class DownloaderTest(unittest.TestCase): <|fim_suffix|> def test_downloader_handles_invalid_urls(self): ...
code_fim
hard
{ "lang": "python", "repo": "saonam/extractpdf", "path": "/extractpdf/tests/downloader_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/ciriculumn/week-17/python/my-intro-BG/2/module4WorkingWithNumbers.py area = 0 height = 10 width = 20 # calculate the area of a triangle area = width * height / 2 <|fim_suffix|># this is an example with m...
code_fim
hard
{ "lang": "python", "repo": "bgoonz/UsefulResourceRepo2.0", "path": "/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/ciriculumn/week-17/python/my-intro-BG/2/module4WorkingWithNumbers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># printing the formatted decimal number with right justified to take up 6 spaces # with leading zeros print("My favorite number is %06d !" % 42) # do the same thing with the .format syntax to include numbers our output print("the area of the triangle would be {0:f} ".format(area)) print("my favorite numb...
code_fim
medium
{ "lang": "python", "repo": "bgoonz/UsefulResourceRepo2.0", "path": "/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/ciriculumn/week-17/python/my-intro-BG/2/module4WorkingWithNumbers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># this is an example with multiple numbers # I have used the \ to indicate command continues on next line print( "Here are three numbers! " + "The first is {0:d} The second is {1:4d} and {2:d}".format(7, 8, 9) )<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/Lambda-Resource-Sta...
code_fim
hard
{ "lang": "python", "repo": "bgoonz/UsefulResourceRepo2.0", "path": "/MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/ciriculumn/week-17/python/my-intro-BG/2/module4WorkingWithNumbers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jherrerotardon/spies path: /src/models/recommendation.py """Recommendation module to access DB. """ from pyframework.models.mongodb_model import MongoDBModel <|fim_suffix|> """ Recommendation model to access DB. """ pass<|fim_middle|> class Recommendation(MongoDBModel):
code_fim
easy
{ "lang": "python", "repo": "jherrerotardon/spies", "path": "/src/models/recommendation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Recommendation(MongoDBModel): """ Recommendation model to access DB. """ pass<|fim_prefix|># repo: jherrerotardon/spies path: /src/models/recommendation.py """Recommendation module to access DB. """ <|fim_middle|>from pyframework.models.mongodb_model import MongoDBModel
code_fim
easy
{ "lang": "python", "repo": "jherrerotardon/spies", "path": "/src/models/recommendation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MaaikeB/apies path: /apies/controllers.py import elasticsearch from .query import Query # ### HIGHLIGHT HANDLING # DONT_HIGHLIGHT = { # 'kind', # 'kind_he', # 'budget_code', # 'entity_kind', # 'entity_id', # 'code', # } def _prepare_replacements(highlighted): retu...
code_fim
hard
{ "lang": "python", "repo": "MaaikeB/apies", "path": "/apies/controllers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def count(es_client, index_name, text_fields, term, from_date, to_date, config): counts = {} for item in config: doc_types = item['doc_types'] doc_types = _validate_types(text_fields, doc_types) filters = item['filters'] id = item['id'] query_resul...
code_fim
hard
{ "lang": "python", "repo": "MaaikeB/apies", "path": "/apies/controllers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: michael-xander/communique-webapp path: /communique/dev_settings.py # This file contains settings for the development environment from .base_settings import * <|fim_suffix|>DEBUG = True ALLOWED_HOSTS = [] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NA...
code_fim
medium
{ "lang": "python", "repo": "michael-xander/communique-webapp", "path": "/communique/dev_settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dondish/Soko path: /events.py from config import Bot import discord def setup(bot): """ Setup here bot events of your choice. """ @bot.event async def on_comma<|fim_suffix|> bot.load_extension('cogs.general') bot.load_extension('cogs.fun') await bot.change_...
code_fim
hard
{ "lang": "python", "repo": "dondish/Soko", "path": "/events.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> bot.load_extension('cogs.general') bot.load_extension('cogs.fun') await bot.change_presence(activity=discord.Game(Bot.PREFIX+"help"))<|fim_prefix|># repo: dondish/Soko path: /events.py from config import Bot import discord def setup(bot): """ Setup here bot events of your cho...
code_fim
medium
{ "lang": "python", "repo": "dondish/Soko", "path": "/events.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return f''' query {{ completeMultiPartUpload( object: "{item_str}" upload_id: "{upload_id}" parts_eTags: {etag_payload_array} ) }} '''<|fim_prefix|># repo: brandonserna/sciencebasepy path:...
code_fim
medium
{ "lang": "python", "repo": "brandonserna/sciencebasepy", "path": "/sb3/querys.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: brandonserna/sciencebasepy path: /sb3/querys.py '''GraphQL Queries for interaction with ScienceBase Manager ''' def create_multipart_upload_session(s3_filepath, content_type, username): <|fim_suffix|>def complete_multipart_upload(item_str, upload_id, etag_payload): '''complete_multipart_uploa...
code_fim
hard
{ "lang": "python", "repo": "brandonserna/sciencebasepy", "path": "/sb3/querys.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> substitute_elements = { "process_file": process_file, "output": dump({"output": output_options}, default_flow_style=False), "pyramid": dump({"pyramid": pyramid_options}, default_flow_style=False), } with open(mapchete_template, "r") as config_template: config = ...
code_fim
medium
{ "lang": "python", "repo": "ashutoshkumarjha/mapchete", "path": "/mapchete/cli/default/create.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ashutoshkumarjha/mapchete path: /mapchete/cli/default/create.py """Create dummy Mapchete and python process files.""" import click from importlib_resources import files import os from string import Template from shutil import copyfile from oyaml import dump from mapchete.cli import options FOR...
code_fim
hard
{ "lang": "python", "repo": "ashutoshkumarjha/mapchete", "path": "/mapchete/cli/default/create.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Alexval03195/DFS20210515 path: /semana6/python/03_estructura_control.py #if """ Elaborar un progra de validaciond de edad do<|fim_suffix|>t(" puede votar"); else: print("No puede votar");<|fim_middle|>nde la edad es superior a 18 puede votar """ edad = int(input("dame tu edad ")); if edad >=...
code_fim
medium
{ "lang": "python", "repo": "Alexval03195/DFS20210515", "path": "/semana6/python/03_estructura_control.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nt(input("dame tu edad ")); if edad >= 18: print(" puede votar"); else: print("No puede votar");<|fim_prefix|># repo: Alexval03195/DFS20210515 path: /semana6/python/03_estructura_control.py #if """ Elaborar un progra de validaciond de edad do<|fim_middle|>nde la edad es superior a 18 puede votar...
code_fim
easy
{ "lang": "python", "repo": "Alexval03195/DFS20210515", "path": "/semana6/python/03_estructura_control.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_workflow(self): # Create organizer and participant contracts organizer = ts4.BaseContract('TestUsage', { 'auctionRoot': self.auction_root.address, }, nickname='User', override_address=random_address()) participant = TestWallet() # Organizer...
code_fim
hard
{ "lang": "python", "repo": "tonred/auction", "path": "/test/ts4/workflow.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tonred/auction path: /test/ts4/workflow.py import json import os import unittest from tonclient.types import CallSet from tonos_ts4 import ts4 from config import BUILD_ARTIFACTS_PATH, VERBOSE from test_wallet import TestWallet from utils.utils import random_address class WorkflowTest(unittest...
code_fim
hard
{ "lang": "python", "repo": "tonred/auction", "path": "/test/ts4/workflow.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def read_columns(dataset, columns=5): file_name = dir_path + "/" + dataset + ".csv" with open(file_name) as csvfile: data = csv.reader(csvfile, delimiter=",", quotechar='|') cols = [] for column in range(columns): cols.append([]) for i, row in enumerat...
code_fim
hard
{ "lang": "python", "repo": "adam-dziedzic/bandlimited-cnns", "path": "/cnns/graphs/attackContrastReduction/graph.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for i, row in enumerate(data): if i > 0: # skip header for column in range(columns): cols[column].append(float(row[column])) return cols fig = plt.figure(figsize=(10, 8)) # datasets = ["accuracy", "compression"] datasets = ["ContrastReduction...
code_fim
hard
{ "lang": "python", "repo": "adam-dziedzic/bandlimited-cnns", "path": "/cnns/graphs/attackContrastReduction/graph.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: adam-dziedzic/bandlimited-cnns path: /cnns/graphs/attackContrastReduction/graph.py import matplotlib # matplotlib.use('TkAgg') import matplotlib.pyplot as plt import csv import os print(matplotlib.get_backend()) plt.interactive(True) # http://ksrowell.com/blog-visualizing-data/2012/02/02/optima...
code_fim
hard
{ "lang": "python", "repo": "adam-dziedzic/bandlimited-cnns", "path": "/cnns/graphs/attackContrastReduction/graph.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>""" __version__ = '0.0.1' __revision__ = '$Revision: 1.00 $' __date__ = '$Date: 2012/03/04 15:05 $' # try : # import matplotlib # from matplotlib import pylab # except ImportError: # print 'There is a problem with importing matplotlib (pylab) at initialisation' # # try : # import numpy # ...
code_fim
medium
{ "lang": "python", "repo": "emsellem/pygme", "path": "/pygme_orig_python2/astroprofiles/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: emsellem/pygme path: /pygme_orig_python2/astroprofiles/__init__.py """Copyright (C) 2011 ESO/Centre de Recherche Astronomique de Lyon (CRAL) astroprofiles: includes a few functions which are useful to describe surface brightness or spatial profiles <|fim_suffix|># try : # ...
code_fim
medium
{ "lang": "python", "repo": "emsellem/pygme", "path": "/pygme_orig_python2/astroprofiles/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return HttpResponse(data, "application/json") return decorator def cross_domain_post_response(func): def decorator(request, *args, **kwargs): resp = func(request, *args, **kwargs) iframe_id = request.POST.get('iframeId', '') data = { "status_code": r...
code_fim
hard
{ "lang": "python", "repo": "c4all/c4all", "path": "/comments/decorators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }