text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> # ============================================================================= # >> COMMANDS # ============================================================================= @TypedSayCommand('!test') def typed_say_test(command_info): global urls_sent urls_sent += 1 url = URL_TEMPLATE.format(...
code_fim
hard
{ "lang": "python", "repo": "KirillMysnik/sp-motd-issue-test", "path": "/addons/source-python/plugins/motd_issue_test/motd_issue_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> n = n // div break s += n print(s)<|fim_prefix|># repo: shaarangg/CP-codes path: /codeforces/Python/Rectangular Game(Easy).py n = int(input()) s = n div = 2 while n > 1: if n % div == 0: n = n // div else: for i in range(div + 1, <|fim_middle|>n + 1)...
code_fim
medium
{ "lang": "python", "repo": "shaarangg/CP-codes", "path": "/codeforces/Python/Rectangular Game(Easy).py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shaarangg/CP-codes path: /codeforces/Python/Rectangular Game(Easy).py n = int(input()) s = n div = 2 while n > 1: if n % div == 0:<|fim_suffix|>n + 1): if n % i == 0: div = i n = n // div break s += n print(s)<|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "shaarangg/CP-codes", "path": "/codeforces/Python/Rectangular Game(Easy).py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># this Method helps give info about the passed in function or Argument! #help(str) # finding strings in strings print("corn" in "Buttered Popcorn")<|fim_prefix|># repo: Coryf65/Python-Basics path: /PythonBasics.py #Python uses Snake Case for naming conventions first_name = "Ada" last_name = "Lovelace" ...
code_fim
hard
{ "lang": "python", "repo": "Coryf65/Python-Basics", "path": "/PythonBasics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Coryf65/Python-Basics path: /PythonBasics.py #Python uses Snake Case for naming conventions first_name = "Ada" last_name = "Lovelace" <|fim_suffix|># displaying the mood ! print("I am glad that you are ,", current_mood) # PEMDAS... print("PEMDAS: ", 0.1 + 0.1 + 0.1 - 0.3) # we get 0.0000005 #...
code_fim
hard
{ "lang": "python", "repo": "Coryf65/Python-Basics", "path": "/PythonBasics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># we get 0.0000005 # now we can round this print("rounding: ",round(0.1 + 0.1 + 0.1 - 0.3)) # this Method helps give info about the passed in function or Argument! #help(str) # finding strings in strings print("corn" in "Buttered Popcorn")<|fim_prefix|># repo: Coryf65/Python-Basics path: /PythonBasics...
code_fim
hard
{ "lang": "python", "repo": "Coryf65/Python-Basics", "path": "/PythonBasics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msaad1311/Flight-Fare path: /Scripts/Utils.py import pandas as pd import numpy as np # from IPython.display import display import holidays from math import sqrt import seaborn as sns import matplotlib.pyplot as plt from sklearn.ensemble import ExtraTreesRegressor from sklearn.metrics import mean...
code_fim
hard
{ "lang": "python", "repo": "msaad1311/Flight-Fare", "path": "/Scripts/Utils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def timing(x): if (x > 7) and (x <= 12): return 'Morning' elif (x > 12) and (x <= 17): return 'Afternoon' elif (x > 17) and (x <= 20): return 'Evening' elif (x > 20) or (x <= 7): return 'Night' def times(df): df_temp = df.copy(deep=True) df_temp['...
code_fim
hard
{ "lang": "python", "repo": "msaad1311/Flight-Fare", "path": "/Scripts/Utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> df_temp = dropper(df_temp, ['Arrival_Time1', 'Dep_Time', 'Arrival_Time']) # display(df_temp.head()) return df_temp def encoder(df, name): source = df[[name]] df_temp = pd.get_dummies(source, drop_first=True) return df_temp def metric(actual, predicted): e_mse = mse(actual,...
code_fim
hard
{ "lang": "python", "repo": "msaad1311/Flight-Fare", "path": "/Scripts/Utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_datasource_tables(ndjson_test_data_dir, pathling_ctx): pathling_ctx.read.ndjson(ndjson_test_data_dir).write.tables() data_source = pathling_ctx.read.tables() result = ndjson_query(data_source) assert result.columns == list(ResultRow) assert result.collect() == [ Resu...
code_fim
hard
{ "lang": "python", "repo": "aehrc/pathling", "path": "/lib/python/tests/test_datasource.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pathling_ctx.read.delta(delta_test_data_dir).write.delta(temp_delta_dir) data_source = pathling_ctx.read.delta(temp_delta_dir) result = delta_query(data_source) assert result.columns == list(ResultRow) assert result.collect() == [ ResultRow(71), ] def test_datasource_del...
code_fim
hard
{ "lang": "python", "repo": "aehrc/pathling", "path": "/lib/python/tests/test_datasource.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aehrc/pathling path: /lib/python/tests/test_datasource.py # Copyright 2023 Commonwealth Scientific and Industrial Research # Organisation (CSIRO) ABN 41 687 119 230. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the L...
code_fim
hard
{ "lang": "python", "repo": "aehrc/pathling", "path": "/lib/python/tests/test_datasource.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DataDog/datadog-api-client-python path: /examples/v1/azure-integration/DeleteAzureIntegration.py """ Delete an Azure integration returns "OK" response """ from datadog_api_client import ApiClient, Configuration from datadog_api_client.v1.api.azure_integration_api import AzureIntegrationApi from ...
code_fim
hard
{ "lang": "python", "repo": "DataDog/datadog-api-client-python", "path": "/examples/v1/azure-integration/DeleteAzureIntegration.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>configuration = Configuration() with ApiClient(configuration) as api_client: api_instance = AzureIntegrationApi(api_client) response = api_instance.delete_azure_integration(body=body) print(response)<|fim_prefix|># repo: DataDog/datadog-api-client-python path: /examples/v1/azure-integration/...
code_fim
hard
{ "lang": "python", "repo": "DataDog/datadog-api-client-python", "path": "/examples/v1/azure-integration/DeleteAzureIntegration.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1036225283/python path: /face/Config.py import model as models DATA_SIZE = 320 # DATA_SIZE = 304 IMAGE_SIZE = 224 B<|fim_suffix|> models.Point68_residual MODEL_SAVE_PATH = model.path print(MODEL_SAVE_PATH)<|fim_middle|>ATCH_SIZE = 32 EPOCH = 400 # model = models.Point68_y1 # model = models.Po...
code_fim
medium
{ "lang": "python", "repo": "1036225283/python", "path": "/face/Config.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> models.Point68_residual MODEL_SAVE_PATH = model.path print(MODEL_SAVE_PATH)<|fim_prefix|># repo: 1036225283/python path: /face/Config.py import model as models DATA_SIZE = 320 # DATA_SIZE = 304 IMAGE_SIZE = 224 BATCH_SIZE = 32 EPOCH = 400 # model = models.Point68_y1 # model = models.Poin<|fim_middle...
code_fim
medium
{ "lang": "python", "repo": "1036225283/python", "path": "/face/Config.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: adafruit/Adafruit_Learning_System_Guides path: /Motion_Buddy/code.py # SPDX-FileCopyrightText: 2022 Charlyn G for Adafruit Industries # # SPDX-License-Identifier: MIT # # Code for the Adafruit Learning System tutorial # Exercise Buddy: Motion aware BLE media controller # https://learn.adafrui...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_Learning_System_Guides", "path": "/Motion_Buddy/code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if paused: print("play!") paused = False ams.play() except OSError: supervisor.reload() except UnsupportedCommand: # This means that we tried to pause but th...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_Learning_System_Guides", "path": "/Motion_Buddy/code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eruffaldi/ukfmanifold path: /task_headpose/headPose.py import csv import livestat import sys a = csv.DictReader(open(sys.argv[1] if len(sys.argv) > 1 else "headPose.txt","rb")) o = csv.DictWriter(open(sys.argv[2] if len(sys.argv) > 2 else "headPoseout.csv","wb"),fieldnames=[x.strip() for x in a....
code_fim
medium
{ "lang": "python", "repo": "eruffaldi/ukfmanifold", "path": "/task_headpose/headPose.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print d["pose_Tx"],d["pose_Ty"],d["pose_Tz"],d["pose_Rx"],d["pose_Ry"],d["pose_Rz"] o.writerow(d) for k in sorted(w.keys()): print w[k]<|fim_prefix|># repo: eruffaldi/ukfmanifold path: /task_headpose/headPose.py import csv import livestat import sys a = csv.DictReader(open(sys.argv[1] if len(sys.ar...
code_fim
medium
{ "lang": "python", "repo": "eruffaldi/ukfmanifold", "path": "/task_headpose/headPose.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": bank = Cardbank() res = set_next_round_ressources() cards = set_drafted_card() scenarios = list(itertools.product([0, 1], repeat=7)) for scenario in scenarios: early_ressources = set_early_ressources(cards, scenario) pass<|fim_prefix|># repo...
code_fim
hard
{ "lang": "python", "repo": "parking52/ITWW", "path": "/wonderfulworld.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: parking52/ITWW path: /wonderfulworld.py from cardbank import Cardbank import time import itertools def set_next_round_ressources(): grey = input("Enter your value for grey: ") or 0 black = input("Enter your value for black: ") or 0 green = input("Enter your value for green: ") or 0 ...
code_fim
hard
{ "lang": "python", "repo": "parking52/ITWW", "path": "/wonderfulworld.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> grey, black, green, yellow, blue = 0, 0, 0, 0, 0 for i in range(len(cards)): if scenario[i]: grey = grey + cards[i].discard_reward.grey black = black + cards[i].discard_reward.black green = green + cards[i].discard_reward.green yellow = yello...
code_fim
medium
{ "lang": "python", "repo": "parking52/ITWW", "path": "/wonderfulworld.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: salshaw749/Fyyur_FSND path: /app.py g') db = SQLAlchemy(app) # TODO: connect to a local postgresql database app.config['SQLALCHEMY_DATABASE_URI'] app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False migrate = Migrate(app, db) db.create_all() #----------------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "salshaw749/Fyyur_FSND", "path": "/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> form = VenueForm() #venue = Venue.query.filter(Venue.id == venue_id) venue=Venue.query.filter(Venue.id == venue_id).one() # TODO: populate form with values from venue with ID <venue_id> return render_template('forms/edit_venue.html', form=form, venue=venue) @app.route('/venues/<int:venue_id...
code_fim
hard
{ "lang": "python", "repo": "salshaw749/Fyyur_FSND", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: salshaw749/Fyyur_FSND path: /app.py information data = [] # render the upcoming shows def upcoming_shows(): # create empty arr upcoming_shows = [] # loop through each show that we have recieved for show in shows: # now compare the time of a speci...
code_fim
hard
{ "lang": "python", "repo": "salshaw749/Fyyur_FSND", "path": "/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return { 'auth': BitbucketOAuth(access_token) } elif self.username != '' and self.password != '': return { 'auth': HTTPBasicAuth(self.username, self.password) } else: if self.client_id == '': ...
code_fim
hard
{ "lang": "python", "repo": "SHyx0rmZ/bitbucket-build-status-resource", "path": "/scripts/bitbucket/bitbucket_cloud.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SHyx0rmZ/bitbucket-build-status-resource path: /scripts/bitbucket/bitbucket_cloud.py from bitbucket import BitbucketDriver, BitbucketOAuth, request_access_token from concourse import ConcourseResource, MissingSourceException, print_error from requests.auth import HTTPBasicAuth class BitbucketCl...
code_fim
hard
{ "lang": "python", "repo": "SHyx0rmZ/bitbucket-build-status-resource", "path": "/scripts/bitbucket/bitbucket_cloud.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>env.Program("bin/MockServer", ["src/Mock/MockServer.cpp"] + loc["util_src"] + loc["tpl_src"], CPPPATH=["include"] + loc["openni_inc"] + loc["tpl_inc"] + loc["util_inc"], LIBPATH=loc["openni_lib"], LIBS="OpenNI")<|fim_prefix|># repo: kinect-fun/ocv_kinect path: /tools/GestureServer...
code_fim
hard
{ "lang": "python", "repo": "kinect-fun/ocv_kinect", "path": "/tools/GestureServer/SConscript", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kinect-fun/ocv_kinect path: /tools/GestureServer/SConscript Import("loc") Import("env") env.Program("bin/GestureServer", ["src/GestureServer.cpp"] + loc["tpl_src"] + loc["util_src"], CPPPATH=["include"] + loc["openni_inc"] + loc["tpl_inc"] + loc["util_inc"], LIBPATH=loc["openni_lib"]...
code_fim
hard
{ "lang": "python", "repo": "kinect-fun/ocv_kinect", "path": "/tools/GestureServer/SConscript", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub_date = models.DateTimeField(default=timezone.now) def __str__(self): #return self.cart_id return str(self.title)<|fim_prefix|># repo: lurdray/study_aid path: /theory/models.py from django.db import models from django.utils import timezone # Create your models here. class Theory(models.Model):...
code_fim
medium
{ "lang": "python", "repo": "lurdray/study_aid", "path": "/theory/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lurdray/study_aid path: /theory/models.py from django.db import models from django.utils import timezone # Create your models here. class Theory(models.Model): <|fim_suffix|> def __str__(self): #return self.cart_id return str(self.title)<|fim_middle|> title = models.CharField(max_length=500,...
code_fim
hard
{ "lang": "python", "repo": "lurdray/study_aid", "path": "/theory/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> category = models.CharField(max_length=500, default="general") level = models.CharField(max_length=500, default="simple") pub_date = models.DateTimeField(default=timezone.now) def __str__(self): #return self.cart_id return str(self.title)<|fim_prefix|># repo: lurdray/study_aid path: /theory/mo...
code_fim
medium
{ "lang": "python", "repo": "lurdray/study_aid", "path": "/theory/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RemoveField( model_name='data_type_collection', name='num_tables', ), ]<|fim_prefix|># repo: fzhao99/washu-act-db path: /hello/migrations/0007_remove_data_type_collection_num_tables.py # Generated by Django 2.1 on 2018-08-06 16:52 ...
code_fim
medium
{ "lang": "python", "repo": "fzhao99/washu-act-db", "path": "/hello/migrations/0007_remove_data_type_collection_num_tables.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('hello', '0006_auto_20180801_1203'), ] operations = [ migrations.RemoveField( model_name='data_type_collection', name='num_tables', ), ]<|fim_prefix|># repo: fzhao99/washu-act-db path: /hello/migrations/0007_remove_data_t...
code_fim
easy
{ "lang": "python", "repo": "fzhao99/washu-act-db", "path": "/hello/migrations/0007_remove_data_type_collection_num_tables.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fzhao99/washu-act-db path: /hello/migrations/0007_remove_data_type_collection_num_tables.py # Generated by Django 2.1 on 2018-08-06 16:52 <|fim_suffix|> operations = [ migrations.RemoveField( model_name='data_type_collection', name='num_tables', ), ...
code_fim
medium
{ "lang": "python", "repo": "fzhao99/washu-act-db", "path": "/hello/migrations/0007_remove_data_type_collection_num_tables.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: valechitarivera/Fase3_Rivera_Garrido_HerreraL path: /locallibreria/catalogo/migrations/0013_auto_20201112_2207.py # Generated by Django 3.1.2 on 2020-11-13 01:07 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations...
code_fim
hard
{ "lang": "python", "repo": "valechitarivera/Fase3_Rivera_Garrido_HerreraL", "path": "/locallibreria/catalogo/migrations/0013_auto_20201112_2207.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='producto', name='img1', field=models.ImageField(null=True, upload_to=''), ), migrations.AddField( model_name='producto', name='img2', field=models.ImageField(...
code_fim
hard
{ "lang": "python", "repo": "valechitarivera/Fase3_Rivera_Garrido_HerreraL", "path": "/locallibreria/catalogo/migrations/0013_auto_20201112_2207.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # In[14]: # Using k-means clustering to group into 5 sets of players # In[15]: # Define number of clusters#Define n clusters = 5 # In[16]: # Train a model using KMeans() machine learning method model = KMeans(init='k-means++',n_clusters=clusters,n_init=20).fit(groups) # In[17]: # Counting ...
code_fim
hard
{ "lang": "python", "repo": "sundarram98/Footbal-Training-Drill-Suggestion-System", "path": "/Project.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sundarram98/Footbal-Training-Drill-Suggestion-System path: /Project.py # coding: utf-8 # <h3> Football Drill Suggestion </h3> # # # <p> # This program is used to analyze the data of 18,000+ soccer players from European Soccer leagues. The dataset used here is an open European Soccer Database...
code_fim
hard
{ "lang": "python", "repo": "sundarram98/Footbal-Training-Drill-Suggestion-System", "path": "/Project.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># In[16]: # Train a model using KMeans() machine learning method model = KMeans(init='k-means++',n_clusters=clusters,n_init=20).fit(groups) # In[17]: # Counting the number of players in each cluster print(60*"_") print("\nCount of players in each cluster : ") print(60*"_") pd.value_counts(model.labe...
code_fim
hard
{ "lang": "python", "repo": "sundarram98/Footbal-Training-Drill-Suggestion-System", "path": "/Project.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: njread/New-Python path: /functions.py def print_two(name, age): print("your name is %s" % name) print("your age is %d" % age) <|fim_suffix|> print("I got nothing") print_two("Nicholas", 22) print_one("Nichoals") print_none()<|fim_middle|>def print_one(name): print("your name is %s" % name) ...
code_fim
medium
{ "lang": "python", "repo": "njread/New-Python", "path": "/functions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def print_one(name): print("your name is %s" % name) def print_none(): print("I got nothing") print_two("Nicholas", 22) print_one("Nichoals") print_none()<|fim_prefix|># repo: njread/New-Python path: /functions.py def print_two(name, age): <|fim_middle|> print("your name is %s" % name) print("your a...
code_fim
medium
{ "lang": "python", "repo": "njread/New-Python", "path": "/functions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: njread/New-Python path: /functions.py def print_two(name, age): <|fim_suffix|>def print_none(): print("I got nothing") print_two("Nicholas", 22) print_one("Nichoals") print_none()<|fim_middle|> print("your name is %s" % name) print("your age is %d" % age) def print_one(name): print("your nam...
code_fim
medium
{ "lang": "python", "repo": "njread/New-Python", "path": "/functions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jkaariain/python-exercises path: /Kierros6/tehtava6.10.py def laske_abbat(string): abba_lkm = 0 for i in range(0, len(string)): <|fim_suffix|>"b" and string[i + 2] == "b" \ and string[i + 3] == "a": abba_lkm += 1 else: conti...
code_fim
hard
{ "lang": "python", "repo": "jkaariain/python-exercises", "path": "/Kierros6/tehtava6.10.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>"b" and string[i + 2] == "b" \ and string[i + 3] == "a": abba_lkm += 1 else: continue return abba_lkm<|fim_prefix|># repo: jkaariain/python-exercises path: /Kierros6/tehtava6.10.py def laske_abbat(string): abba_lkm = 0 for i i...
code_fim
hard
{ "lang": "python", "repo": "jkaariain/python-exercises", "path": "/Kierros6/tehtava6.10.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> abba_lkm += 1 else: continue return abba_lkm<|fim_prefix|># repo: jkaariain/python-exercises path: /Kierros6/tehtava6.10.py def laske_abbat(string): abba_lkm = 0 for i in range(0, len(string)): if string[i] == "a" and i+3 < len(string): ...
code_fim
hard
{ "lang": "python", "repo": "jkaariain/python-exercises", "path": "/Kierros6/tehtava6.10.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhishekambastha/PedestrianDetection path: /evaluation/main.py #! /usr/bin/env python import glob import os from detect import Detector from model import * # define model_path, image_path image_path = '/home/ambastha/abhishek/matlab-eval/caltech_tool_kit/data-INRIA/images/set01/V000/' model_path...
code_fim
medium
{ "lang": "python", "repo": "abhishekambastha/PedestrianDetection", "path": "/evaluation/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> d = Detector(model_path, image_path) frames = list() for i, img in enumerate(img_list): img_obj = Image(i+1) # 1 based index for matlab img_obj.bboxes.extend(d.detect(img)) print '[INFO]: Detecting {}'.format(img) frames.append(img_obj) os.chdir(curr_dir) with open('V000.txt', 'w') as f...
code_fim
medium
{ "lang": "python", "repo": "abhishekambastha/PedestrianDetection", "path": "/evaluation/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>frames = list() for i, img in enumerate(img_list): img_obj = Image(i+1) # 1 based index for matlab img_obj.bboxes.extend(d.detect(img)) print '[INFO]: Detecting {}'.format(img) frames.append(img_obj) os.chdir(curr_dir) with open('V000.txt', 'w') as f: for fr in frames: boxes =...
code_fim
medium
{ "lang": "python", "repo": "abhishekambastha/PedestrianDetection", "path": "/evaluation/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def setup(app): # type: (Sphinx) -> Dict[unicode, Any] app.add_builder(IpynbBuilder) app.add_config_value('ipynb_kernel', 'python', False) app.add_config_value('ipynb_indent', '>>> ', False) app.add_config_value('ipynb_continue', '... ', False) return {'version': sphinx.__display_v...
code_fim
hard
{ "lang": "python", "repo": "haraldschilly/sphinx-ipynbbuilder", "path": "/ipynbbuilder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def write_doc(self, docname, doctree): self.current_docname = docname destination = StringOutput(encoding='utf-8') self.writer.write(doctree, destination) outfilename = path.join(self.outdir, os_path(docname) + self.out_suffix) ensuredir(path.dirname(outfilename...
code_fim
hard
{ "lang": "python", "repo": "haraldschilly/sphinx-ipynbbuilder", "path": "/ipynbbuilder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucaskmiyazaki/document_reader path: /houghOCR.py import cv2 import numpy as np from pdf2image import convert_from_path import pytesseract as ocr import sys import time import requests # parametrizar variaveis # enviar imagem com filtro para tesseract def region_growing(pts, map_pts, img, n): ...
code_fim
hard
{ "lang": "python", "repo": "lucaskmiyazaki/document_reader", "path": "/houghOCR.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def microsoftOCR(frame, debug): subscription_key = "12w1asde663bsdasd9eeeqc0a7" endpoint = "https://v360testingocr.cognitiveservices.azure.com/" ocr_url = endpoint + "vision/v3.0/ocr" image_path = "test.jpg" image_data = open(image_path, "rb").read() headers = {'Ocp-Apim-Subscript...
code_fim
hard
{ "lang": "python", "repo": "lucaskmiyazaki/document_reader", "path": "/houghOCR.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if debug: print(full_text) return full_text def ocr_manager(file_path, mode='tesseract', debug=False, th_filter=False): # preprocess document time0 = time.time() res = 0.80 max_gap = 0 pages=convert_from_path(file_path) pages[0].save("tax.jpeg","jpeg") img...
code_fim
hard
{ "lang": "python", "repo": "lucaskmiyazaki/document_reader", "path": "/houghOCR.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeremybrachle/Merge-Sort path: /Assignment2_JeremyBrachle_Q1-2.py #This program will implement merge sort #Jeremy Brachle 46659942 #23 February 2017 #import necessary libraries import sys import time import re #create a list for containing the numbers numbers = [] #get the command line argumen...
code_fim
hard
{ "lang": "python", "repo": "jeremybrachle/Merge-Sort", "path": "/Assignment2_JeremyBrachle_Q1-2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #build back up in ascending order #loop through each half until equally sorted (or until one uneven half finishes) while i < len(leftHalfSide) and j < len(rightHalfSide): if leftHalfSide[i] < rightHalfSide[j]: values[k]=leftHalfSide[i] i=i+1 else: values[k]=rightHalfSide[j] j=j...
code_fim
hard
{ "lang": "python", "repo": "jeremybrachle/Merge-Sort", "path": "/Assignment2_JeremyBrachle_Q1-2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>else: if i%2 != 0: res[i], right = right - 1, right - 1 else: res[i], left = left + 1, left + 1 if i != 0: k -= 1<|fim_prefix|># repo: jxhangithub/leetcode path: /solutions/python3/667.py class Solution: def constructArray(self, n, k): """ ...
code_fim
hard
{ "lang": "python", "repo": "jxhangithub/leetcode", "path": "/solutions/python3/667.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jxhangithub/leetcode path: /solutions/python3/667.py class Solution: def constructArray(self, n, k): """ :type n: int :type k: int :rtype: List[int] """ left, ri<|fim_suffix|>else: if i%2 != 0: res[i], right = right - 1, right - ...
code_fim
hard
{ "lang": "python", "repo": "jxhangithub/leetcode", "path": "/solutions/python3/667.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dtran39/Programming_Preparation path: /01_Arrays/384_Shuffle_Array/ShuffleArray.py ''' Problem: - Shuffle a set of numbers without duplicates. ---------------------------------------------------------------------------------------------------- Examples: // Init an array with set 1, 2, and 3....
code_fim
hard
{ "lang": "python", "repo": "dtran39/Programming_Preparation", "path": "/01_Arrays/384_Shuffle_Array/ShuffleArray.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def shuffle(self): """ Returns a random shuffling of the array. :rtype: List[int] """ new_nums = self.nums[:] n = len(new_nums) import random for i in range(n): rand_num = random.randint(0, n - 1) # Swap nums[i] wi...
code_fim
medium
{ "lang": "python", "repo": "dtran39/Programming_Preparation", "path": "/01_Arrays/384_Shuffle_Array/ShuffleArray.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: imalkov97/Python path: /Week 2/Lab 2 Q5 Mitroi.py #Labsheet 2 #Question 5 hoursStr=input("How many hours?") inpHours=int(hoursStr) minutesStr=input("How many minutes?") minutes=int(minutesStr) currHours=inpHours midi="in the morning." periodHour='' #-----------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "imalkov97/Python", "path": "/Week 2/Lab 2 Q5 Mitroi.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif (minutes>=8) and (minutes<=22): periodHour='quarter past ' elif (minutes>=23) and (minutes<=37): periodHour='half past ' #This bit transforms the integer currHours into the word representing the number #It also prints the message numToWords=['twelve ', 'one ', 'two ', 'thr...
code_fim
hard
{ "lang": "python", "repo": "imalkov97/Python", "path": "/Week 2/Lab 2 Q5 Mitroi.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class GPS: gpgga_info = "$GPGGA," ser = serial.Serial("/dev/ttyS0") GPGGA_buffer = 0 NMEA_buff = 0 EARTH_RADIUS = 6371 DIST_TRAVELLED = 0 DIST_INITIAL = 0 CURRENT_COORDINATES = [] PREV_COORDINATES = [] COUNTER = 0 # convert raw NMEA string into degree decimal ...
code_fim
hard
{ "lang": "python", "repo": "MarcoGrazi/PR-05-Talos2020", "path": "/Software/ANIMA/Anima1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> CURRENT_COORDINATES[0] = self.convert_to_degrees(lat) # get latitude in degree decimal format CURRENT_COORDINATES[1] = self.convert_to_degrees(longi) # get longitude in degree decimal format PREV_COORDINATES.append(CURRENT_COORDINATES) COUNTER += 1 def CalculateDist...
code_fim
hard
{ "lang": "python", "repo": "MarcoGrazi/PR-05-Talos2020", "path": "/Software/ANIMA/Anima1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarcoGrazi/PR-05-Talos2020 path: /Software/ANIMA/Anima1.py import tflite import Adafruit_PCA9685 import adafruit_mpu6050 import threading import cv2 import math import sys import serial from time import sleep from picamera import PiCamera import BlynkLib as B BLYNK_AUTH = "" CAM = PiCamera() BL...
code_fim
hard
{ "lang": "python", "repo": "MarcoGrazi/PR-05-Talos2020", "path": "/Software/ANIMA/Anima1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> url = baseurl+'/api/range/?name=plot' data = {} response = self.client.get(url, data, format='json') print json.loads(response.content) self.assertEqual(json.loads(response.content),[{u'id': 1, u'value': 5000000, u'name': u'plot'}]) class HowSoonTest(APITestCase): ...
code_fim
hard
{ "lang": "python", "repo": "harikakoye/code", "path": "/core tests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: harikakoye/code path: /core tests.py from __future__ import unicode_literals import json from rest_framework import status from django.test import TestCase, Client from django.urls import reverse from core.models import * from rest_framework.test import APIClient from rest_framework.test import A...
code_fim
hard
{ "lang": "python", "repo": "harikakoye/code", "path": "/core tests.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_basic_model_results(X_train, X_test, y_train, y_test): scaler = preprocessing.StandardScaler().fit(X_train) X_train = scaler.transform(X_train) X_test = scaler.transform(X_test) print("\n TRAIN AND TEST SHAPES ARE AS FOLLOWS") print("\n X TRAIN : ",X_train.shape) pri...
code_fim
hard
{ "lang": "python", "repo": "avik-samanta99/Fake-News-Detection", "path": "/basic_model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: avik-samanta99/Fake-News-Detection path: /basic_model.py import time import sys sys.path.insert(0,"/content/FakeNewsPropagation") import matplotlib import numpy as np from sklearn import preprocessing, svm from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier from sklearn.l...
code_fim
hard
{ "lang": "python", "repo": "avik-samanta99/Fake-News-Detection", "path": "/basic_model.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> matplotlib.rcParams['figure.figsize'] = 5, 2 # Plot the feature importances of the forest plt.figure() plt.bar(range(X_train.shape[1]), importances[indices], color="b", yerr=std[indices], align="center") plt.xticks(range(X_train.shape[1]), np.array(short_feature_names)[in...
code_fim
hard
{ "lang": "python", "repo": "avik-samanta99/Fake-News-Detection", "path": "/basic_model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ModaoT/firstkill path: /utils.py from collections import Counter from sklearn.metrics import roc_curve, auc import pandas as pd import numpy as np import sys def create_lookup_tables(words): word_counts = Counter(words) sorted_vocab = sorted(word_counts, key=word_counts.get, reverse=Tr...
code_fim
hard
{ "lang": "python", "repo": "ModaoT/firstkill", "path": "/utils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> merged = source.copy() f1 = source[feature1].copy() f2 = source[feature2].fillna('NaN') length = len(f1) step = length // 10 for i, e in enumerate(f1.fillna('NaN')): if e == 'NaN': f1[i] = f2[i] else: if f2[i] != 'NaN': formed...
code_fim
hard
{ "lang": "python", "repo": "ModaoT/firstkill", "path": "/utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: joshianshul2/Python path: /floorceilandrint.py import numpy numpy.set_printoptions(sign=' ')# setprintoption provied space b/w float values arr = input().split() a = numpy.array(arr,dtype=float) print(numpy.floor(a)) print(numpy.ceil(a)) print(numpy.rint(a)) '''0/p: 1 2.3 4.5 67.78 [ 1....
code_fim
medium
{ "lang": "python", "repo": "joshianshul2/Python", "path": "/floorceilandrint.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(numpy.floor(a)) print(numpy.ceil(a)) print(numpy.rint(a)) '''<|fim_prefix|># repo: joshianshul2/Python path: /floorceilandrint.py import numpy numpy.set_printoptions(sign=' ')# setprintoption provied space b/w float values arr = input().split() a = numpy.array(arr,dtype=float) print...
code_fim
hard
{ "lang": "python", "repo": "joshianshul2/Python", "path": "/floorceilandrint.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Product', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=120)), ('description'...
code_fim
hard
{ "lang": "python", "repo": "ed85w/stream_3_project", "path": "/shop/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ed85w/stream_3_project path: /shop/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-22 13:04 from __future__ import unicode_literals from django.conf import settings import django.core.validators from django.db import migrations, models import django.db....
code_fim
hard
{ "lang": "python", "repo": "ed85w/stream_3_project", "path": "/shop/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: WarlockD/tapeimgr path: /tapeimgr/shared.py #! /usr/bin/env python3 """Shared functions module""" import os import logging import glob import hashlib import datetime import subprocess as sub import pytz def launchSubProcess(args, writeLog=True): """Launch subprocess and return exit code, st...
code_fim
hard
{ "lang": "python", "repo": "WarlockD/tapeimgr", "path": "/tapeimgr/shared.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # All files in directory allFiles = glob.glob(directory + "/*." + extension) # Dictionary for storing results checksums = {} for thisFile in allFiles: hashString = generate_file_sha512(thisFile) fName = os.path.basename(thisFile) checksums[fName] = hashString ...
code_fim
hard
{ "lang": "python", "repo": "WarlockD/tapeimgr", "path": "/tapeimgr/shared.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>input("\n\nPress ENTER to exit the program.")<|fim_prefix|># repo: Markay12/learningPython path: /Chapter2/repeat_string.py # String Repetition # You can repeat the same string multiple times by using a '*' operator <|fim_middle|>print('pie' * 10)
code_fim
easy
{ "lang": "python", "repo": "Markay12/learningPython", "path": "/Chapter2/repeat_string.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Markay12/learningPython path: /Chapter2/repeat_string.py # String Repetition # You can repeat the same string multiple times by using a '*' operator <|fim_suffix|> input("\n\nPress ENTER to exit the program.")<|fim_middle|>print('pie' * 10)
code_fim
easy
{ "lang": "python", "repo": "Markay12/learningPython", "path": "/Chapter2/repeat_string.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> admin.site.urls), path('',mediaApp_views.home,name='home'), path('query/', mediaApp_views.youtube_query, name='youtube_query'), path('query/<int:vid>', mediaApp_views.show_video, name='show_video'), path('query/<vid>', mediaApp_views.show_local_video, name='show_local_video'), path('d...
code_fim
hard
{ "lang": "python", "repo": "Shiru99/Software-Engineering", "path": "/miniproject-cs305autumn2020-develop/DjangoProject/mediaWebApp/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shiru99/Software-Engineering path: /miniproject-cs305autumn2020-develop/DjangoProject/mediaWebApp/urls.py """mediaWebApp URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function ...
code_fim
hard
{ "lang": "python", "repo": "Shiru99/Software-Engineering", "path": "/miniproject-cs305autumn2020-develop/DjangoProject/mediaWebApp/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pascal-tgn/gb-python-basics path: /lesson_3/task-02.py def user_info(first_name, last_name, birth_year, city, email, phone): print(", ".join([first_name, last_name, birth_year, city, email, phone])) <|fim_suffix|>user_info(first_name=first_name, last_name=last_name, birth_year=birth_year, city...
code_fim
hard
{ "lang": "python", "repo": "Pascal-tgn/gb-python-basics", "path": "/lesson_3/task-02.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>first_name = input("Введите имя: ") last_name = input("Введите фамилию: ") birth_year = input("Введите год рождения: ") city = input("Введите город: ") email = input("Введите e-mail: ") phone = input("Введите телефон: ") user_info(first_name=first_name, last_name=last_name, birth_year=bi...
code_fim
medium
{ "lang": "python", "repo": "Pascal-tgn/gb-python-basics", "path": "/lesson_3/task-02.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if is_integer(args.device): args.device = int(args.device) if args.device < 0: use_oak = True arg_vid_cap = args.device else: use_oak = False arg_vid_cap = args.device else: use_oak = False arg_vid_cap = args.device pipeline = nobita_vision.VisionPipeli...
code_fim
medium
{ "lang": "python", "repo": "wbawakate/nobita", "path": "/demo/face_landmark.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wbawakate/nobita path: /demo/face_landmark.py import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "..")) from nobita import nobita_vision from nobita.modules import FaceDetection, FaceLandmark import cv2 import numpy as np import argparse parser = argparse.ArgumentParse...
code_fim
hard
{ "lang": "python", "repo": "wbawakate/nobita", "path": "/demo/face_landmark.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print ("after prunning #non zero parameters " + str(np.sum(weight_arr_pruned!=0))) sess.run(dense_w[target_name].assign(weight_arr_pruned)) dict_nzidx[target_name] = mask return dict_nzidx def apply_prune_on_grads(grads_and_vars,dict_nzidx): for key, nzidx in dict_nzidx.items(): c...
code_fim
hard
{ "lang": "python", "repo": "Originofamonia/admm-pruning", "path": "/tensorflow-mnist-code/prune_utility.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Originofamonia/admm-pruning path: /tensorflow-mnist-code/prune_utility.py import numpy as np import tensorflow as tf class PruneConfiguration(): P1 = 80 P2 = 92 P3 = 99.1 P4 = 93 @staticmethod def display(): print("P1 is %f"% PruneConfiguration.P1) print("P2 is %f"% PruneC...
code_fim
hard
{ "lang": "python", "repo": "Originofamonia/admm-pruning", "path": "/tensorflow-mnist-code/prune_utility.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> res = requests.get(Nasa_api_url) res.raise_for_status() result = json.loads(res.content) return result except Exception as e: msg = f'Exception occur while retrieve response from {url}. Exception :: {e}' ...
code_fim
hard
{ "lang": "python", "repo": "svijay87/Python-Learning-Assignment", "path": "/Assignment-Complete.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: svijay87/Python-Learning-Assignment path: /Assignment-Complete.py import requests from abc import ABC,abstractmethod import logging import json import unittest logging.basicConfig(filename="Nasa-shooting-star.log",filemode="a",format="%(asctime)s|%(process)s|%(level)s|%(message)s",level=logging...
code_fim
hard
{ "lang": "python", "repo": "svijay87/Python-Learning-Assignment", "path": "/Assignment-Complete.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> option.add_experimental_option("detach", True) driver = webdriver.Chrome(options=option) log.info("启动{}浏览器".format(browser)) driver.get(url) log.info("打开链接:{}".format(url)) return driver if __name__ == '__main__': open_browser()<|fim_prefix|># repo: Yuen...
code_fim
hard
{ "lang": "python", "repo": "Yuenleung/UIautomation", "path": "/public/browser.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yuenleung/UIautomation path: /public/browser.py from selenium import webdriver from public.log import Log from public.readconfig import ReadConfig log = Log() def open_browser(): read = ReadConfig() browser = read.getValue("browserType", "browserName") url = read.getValue("testServer"...
code_fim
hard
{ "lang": "python", "repo": "Yuenleung/UIautomation", "path": "/public/browser.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ome正受到自动测试软件的控制” # V75以及以下版本 # option.add_argument('disable-infobars') # V76以及以上版本 option.add_experimental_option('useAutomationExtension', False) option.add_experimental_option('excludeSwitches', ['enable-automation']) # 不自动关闭浏览器 option.add_experime...
code_fim
hard
{ "lang": "python", "repo": "Yuenleung/UIautomation", "path": "/public/browser.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rabernat/oocgcm path: /examples/scripts/make_movie_cartopy_ffmpeg.py #!/usr/bin/env python # coding=utf-8 # """ Create a movie of a 2D variable requires: cartopy, ffmpeg to do: - automatically choose lon,lat bounds and ticks - fix loading of the library - improve t...
code_fim
hard
{ "lang": "python", "repo": "rabernat/oocgcm", "path": "/examples/scripts/make_movie_cartopy_ffmpeg.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># create repertory if need be if not os.path.exists('./movies'): os.makedirs('./movies') os.system("rm -rf movies/*.jpg >& /dev/null") vmin, vmax=(-1.0,1.3) # setup the plot fig = plt.figure(figsize=(8,3)) ax=plt.axes(projection=ccrs.PlateCarree()) ax.set_extent([-90, 15, 25, 70],ccrs.PlateCarree()) plt...
code_fim
hard
{ "lang": "python", "repo": "rabernat/oocgcm", "path": "/examples/scripts/make_movie_cartopy_ffmpeg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for i in xrange(v_xr.shape[0]): plt_hdl.remove() plt_hdl = v_xr[i, ...].plot.pcolormesh('nav_lon','nav_lat',ax=ax, vmin=vmin, vmax=vmax, transform=ccrs.PlateCarree(), ...
code_fim
hard
{ "lang": "python", "repo": "rabernat/oocgcm", "path": "/examples/scripts/make_movie_cartopy_ffmpeg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ksingla025/multimodal path: /lib/model.py #!/usr/bin/python #standard python imports import sys #reload(sys) #sys.setdefaultencoding('utf-8') #standard python imports from collections import Counter import math import os import random import zipfile import glob import ntpath import re import r...
code_fim
hard
{ "lang": "python", "repo": "ksingla025/multimodal", "path": "/lib/model.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Now, let's access and create placeholders variables and # create feed-dict to feed new data graph = tf.get_default_graph() self.input = graph.get_tensor_by_name("input_placeholder:0") enc_state = graph.get_tensor_by_name("enc_state:0") w2 = graph.get_tensor_by_name("w2:0") feed_dict ={w...
code_fim
hard
{ "lang": "python", "repo": "ksingla025/multimodal", "path": "/lib/model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># One hot encoding for resolution train_output = pd.get_dummies(train_output,prefix=['Resolution'], dummy_na=True) # Convert to MLB encoded format from sklearn.preprocessing import MultiLabelBinarizer mlb_afn = MultiLabelBinarizer() # Altered File Names mlb_data_afn = pd.DataFrame(mlb_afn.fit_transform(t...
code_fim
hard
{ "lang": "python", "repo": "Archmonger/Xanadu-Parse", "path": "/Xanadu-Parse/XanaduParse.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }