text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: ryanslynch/FrequencyOptimizer path: /make_dict.py
import sys
infile = open(sys.argv[1], "r")
lines = infile.readlines()
lines = [line.strip() for line in lines]
<|fim_suffix|>for line in lines[1:]:
sline = line.split()
print(" \"%s\" : {"%sline[0])
for ii,value in enumerate(slin... | code_fim | medium | {
"lang": "python",
"repo": "ryanslynch/FrequencyOptimizer",
"path": "/make_dict.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>for line in lines[1:]:
sline = line.split()
print(" \"%s\" : {"%sline[0])
for ii,value in enumerate(sline):
if value == "None":
print(" \"%s\" : None,"%(keys[ii]))
elif ii == 0 or ii == 8:
print(" \"%s\" : \"%s\","%(keys[ii],... | code_fim | medium | {
"lang": "python",
"repo": "ryanslynch/FrequencyOptimizer",
"path": "/make_dict.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janishsiroya/Janish_Basics_Python path: /src/google-python-exercises/8.jpg/Dict_Files.py
dict={}
dict['a'] = ['janish1']
dict['c']=['anubhuti']
dict['b']=['binni']
dict['d']=['rahil']
print dict #{'a','janish','b','anubhuti','c','binni','d','rahil'}
for key in dict:
print key
for key in dict... | code_fim | hard | {
"lang": "python",
"repo": "janishsiroya/Janish_Basics_Python",
"path": "/src/google-python-exercises/8.jpg/Dict_Files.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print dict.items()
for key in sorted(dict.keys()):
print ' the key are', key, dict[key]
for k,v in dict.items():
print k, '>', v
dict['d']=['rahil123']
print dict['d']
print 'a' in dict
if 'z' in dict:
print 'True'
else:
print 'False'
if 'p' in dict:
print dict ['p']
print dict.... | code_fim | medium | {
"lang": "python",
"repo": "janishsiroya/Janish_Basics_Python",
"path": "/src/google-python-exercises/8.jpg/Dict_Files.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # map name to first name and last name
df[name_col] = df[name_col].str.strip()
df[name_col] = df[name_col].str.title()
full_name_split = df[name_col].str.rsplit(n=1, expand=True)
df['First Name'] = full_name_split[0]
df['Last Name'] = full_name_split[1]
return df... | code_fim | hard | {
"lang": "python",
"repo": "vincevertulfo/python_mysql_pipeline",
"path": "/etl_scripts/online_forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vincevertulfo/python_mysql_pipeline path: /etl_scripts/online_forms.py
import pandas as pd
import os
from .reference import online_form_event_columns, online_form_use_cols, online_form_brand_columns, online_form_brand_columns_v2
class OnlineForm():
def __init__(self, FILE_PATH, info_type):... | code_fim | hard | {
"lang": "python",
"repo": "vincevertulfo/python_mysql_pipeline",
"path": "/etl_scripts/online_forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def map_name(df, name_col):
# map name to first name and last name
df[name_col] = df[name_col].str.strip()
df[name_col] = df[name_col].str.title()
full_name_split = df[name_col].str.rsplit(n=1, expand=True)
df['First Name'] = full_name_split[0]
df['Las... | code_fim | hard | {
"lang": "python",
"repo": "vincevertulfo/python_mysql_pipeline",
"path": "/etl_scripts/online_forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plecto/django-shift path: /django_shift/docs/views.py
from django.views.generic import TemplateView
class DocumentationRoot(TemplateView):
template_name = 'django_shift/docs/docs_root.html'
router = None
def get_context_data(self, **kwargs):
<|fim_suffix|> # Apparently templ... | code_fim | medium | {
"lang": "python",
"repo": "plecto/django-shift",
"path": "/django_shift/docs/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Apparently templates does not work when passing raw classes, so we're making an instance for now
ctx.update({
'resources': [resource for resource in [cls(self.request) for cls in self.router.get_objects()]],
'changelog': [[
version, changelogs
... | code_fim | medium | {
"lang": "python",
"repo": "plecto/django-shift",
"path": "/django_shift/docs/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: monado3/MagicAmazonWishList path: /core/command/generate_setting_file.py
from core.helper.const import PROJ_DIR, SETTING_CONTENTS, SETTING_FILE_NAME
<|fim_suffix|>
if __name__ == '__main__':
main()<|fim_middle|>
def main():
with PROJ_DIR.joinpath(SETTING_FILE_NAME).open('w', encoding='ut... | code_fim | medium | {
"lang": "python",
"repo": "monado3/MagicAmazonWishList",
"path": "/core/command/generate_setting_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
main()<|fim_prefix|># repo: monado3/MagicAmazonWishList path: /core/command/generate_setting_file.py
from core.helper.const import PROJ_DIR, SETTING_CONTENTS, SETTING_FILE_NAME
def main():
<|fim_middle|> with PROJ_DIR.joinpath(SETTING_FILE_NAME).open('w', encoding='utf... | code_fim | medium | {
"lang": "python",
"repo": "monado3/MagicAmazonWishList",
"path": "/core/command/generate_setting_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geekygirlsarah/adventofcode-2017 path: /day02/day02part2.py
# Advent of Code 2017
# Day 2, Part 2
# @geekygirlsarah
# Files to run through
# input.txt being the input the puzzle provides
inputFile = "input.txt"
# inputFile = "testinput.txt"
# Variables
checksum = 0
# Process file
with open(inp... | code_fim | hard | {
"lang": "python",
"repo": "geekygirlsarah/adventofcode-2017",
"path": "/day02/day02part2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> num1 = row_numbers[i]
num2 = row_numbers[j]
mod1 = num1 % num2
mod2 = num2 % num1
if num1 > num2 and num1 % num2 == 0:
checksum += int(num1 / num2)
print("Num1: " + str(num1))
... | code_fim | hard | {
"lang": "python",
"repo": "geekygirlsarah/adventofcode-2017",
"path": "/day02/day02part2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> interaction_resolver = self.get_resolver()
chosen_dialog = self.dialog(resolver=interaction_resolver)
dialog = chosen_dialog((self.sim), resolver=interaction_resolver)
dialog.show_dialog(on_response=on_response)
return True
if False:
yield None<|... | code_fim | hard | {
"lang": "python",
"repo": "velocist/TS4CheatsInfo",
"path": "/Scripts/simulation/sims/household_management_interactions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> services.sim_info_manager().set_default_genealogy()
resolver = DataResolver(self.sim.sim_info)
if not resolver(self.situation_blacklist):
return True
else:
return self.target.is_sim or True
if self.sim.household_id == self.target.household_id... | code_fim | hard | {
"lang": "python",
"repo": "velocist/TS4CheatsInfo",
"path": "/Scripts/simulation/sims/household_management_interactions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: velocist/TS4CheatsInfo path: /Scripts/simulation/sims/household_management_interactions.py
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\S... | code_fim | hard | {
"lang": "python",
"repo": "velocist/TS4CheatsInfo",
"path": "/Scripts/simulation/sims/household_management_interactions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ivanprokopets/Web-application path: /Aplikacja_Webowa_Etap_2/serwer/main.py
from flask import redirect, send_file
import sys
import redis
from jwt import decode, InvalidTokenError
from uuid import uuid4
from flask import Flask
from flask import request
JWT_SECRET = "TESTSECRET"
SESSION_ID = "s... | code_fim | hard | {
"lang": "python",
"repo": "ivanprokopets/Web-application",
"path": "/Aplikacja_Webowa_Etap_2/serwer/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route("/upload", methods=["POST"])
def upload():
f = request.files.get('file')
t = request.form.get('token')
c = request.form.get('callback')
if f is None:
return redirect(f"{c}?error=No+file+provided") if c \
else ('<h1>CDN</h1> No file provided', 400)
if t i... | code_fim | hard | {
"lang": "python",
"repo": "ivanprokopets/Web-application",
"path": "/Aplikacja_Webowa_Etap_2/serwer/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hsintien-Ng/order-learning path: /test/util/Predict_age.py
import numpy as np
import sys
def predict_age(ch, youngest, oldest, lb_list, ub_list, ref_features, test_features, val_data, Comparator):
if ch == 1:
gender_num = 1
race_num = 1
elif ch == 2:
... | code_fim | hard | {
"lang": "python",
"repo": "Hsintien-Ng/order-learning",
"path": "/test/util/Predict_age.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> test_batch_size = min(len(val_data), total_test_num)
compare_matrix = np.zeros([test_batch_size, ub_list[-1]])
for gender in range(gender_num):
for race in range(race_num):
test_features_filtered_index = val_data
if ch == 2 o... | code_fim | hard | {
"lang": "python",
"repo": "Hsintien-Ng/order-learning",
"path": "/test/util/Predict_age.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Executa o inicializador desejado.
:param Contexto contexto: contexto com todas as informações necessárias
"""
self.log(texto=f"Executando {self._name}")
def inicializacao(self):
self.log(texto=f"Inicialização {self._name}")
self.... | code_fim | hard | {
"lang": "python",
"repo": "randersonLemos/SIDRAT",
"path": "/tardis/src/modulo/otimizacao/OtimizadorPadrao.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: randersonLemos/SIDRAT path: /tardis/src/modulo/otimizacao/OtimizadorPadrao.py
"""
:author: Rafael
:data: 06/12/2019
"""
from abc import ABCMeta
from src.contexto.Contexto import Contexto
from src.contexto.EnumAtributo import EnumValues, EnumAtributo
from src.inout.Exportacao import Expor... | code_fim | hard | {
"lang": "python",
"repo": "randersonLemos/SIDRAT",
"path": "/tardis/src/modulo/otimizacao/OtimizadorPadrao.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._solucoes: Solucoes = self._contexto.get_atributo(EnumAtributo.SOLUCOES)
self._iteracao = max(list(self._solucoes.solucoes))
self._id = max(list(self._solucoes.solucoes[self._iteracao]))
def before(self):
self.log(texto=f"Before {self._name}")
def afte... | code_fim | hard | {
"lang": "python",
"repo": "randersonLemos/SIDRAT",
"path": "/tardis/src/modulo/otimizacao/OtimizadorPadrao.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert compare_prefixes(b'AAXAA', b'AAAAATTTTTTTTT') == (0, 5, 0, 5, 4, 1)
assert compare_prefixes(b'AANAA', b'AACAATTTTTTTTT', ALLOW_WILDCARD_SEQ1) == (0, 5, 0, 5, 5, 0)
assert compare_prefixes(b'AANAA', b'AACAATTTTTTTTT', ALLOW_WILDCARD_SEQ1) == (0, 5, 0, 5, 5, 0)
assert compare_prefixes(b'XAAAAA', ... | code_fim | hard | {
"lang": "python",
"repo": "vittoriozamboni/cutadapt",
"path": "/tests/testalign.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vittoriozamboni/cutadapt path: /tests/testalign.py
from __future__ import print_function, division, absolute_import
from cutadapt.align import (globalalign_locate, compare_prefixes,
ALLOW_WILDCARD_SEQ1, ALLOW_WILDCARD_SEQ1)
from cutadapt.adapters import BACK
def test_polya():
<|fim_suffix|> as... | code_fim | hard | {
"lang": "python",
"repo": "vittoriozamboni/cutadapt",
"path": "/tests/testalign.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.seller_email = '' # 卖家的支付宝账户,E-mail
self.partner = '' # 合作身份者id,以2088开头的16位纯数字
self.key = '' # 安全检验码,以数字和字母组成的32位字符
self.sign_type = 'MD5' # 签名方式
self.input_charset = 'utf-8' # 字符编码
self.cacert = 'th... | code_fim | medium | {
"lang": "python",
"repo": "cspilgrimzww/Alipay_Python_API",
"path": "/third_part/alipay_dual/alipay_config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cspilgrimzww/Alipay_Python_API path: /third_part/alipay_dual/alipay_config.py
#!/usr/bin/env python
#coding=utf-8
# Note:
# Alipay Config Class
# 基础配置
class Alipay_Config:
<|fim_suffix|> self.seller_email = '' # 卖家的支付宝账户,E-mail
self.partner = '' # 合... | code_fim | medium | {
"lang": "python",
"repo": "cspilgrimzww/Alipay_Python_API",
"path": "/third_part/alipay_dual/alipay_config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pedal-edu/pedal path: /pedal/types/library/microbit.py
from pedal.types.builtin import BUILTIN_MODULES
from pedal.types.new_types import ModuleType, FunctionType, register_builtin_module
from pedal.types.new_types import void_function, int_function, ClassType, bool_function, InstanceType
<|fim_s... | code_fim | medium | {
"lang": "python",
"repo": "pedal-edu/pedal",
"path": "/pedal/types/library/microbit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _MICROBIT_SUBMODULES = {
'display': ModuleType('display', {
'show': void_function('show'),
'scroll': void_function('scroll'),
'on': void_function('on'),
'off': void_function('off'),
'clear': void_function('clear'),
'set_pi... | code_fim | hard | {
"lang": "python",
"repo": "pedal-edu/pedal",
"path": "/pedal/types/library/microbit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zwork101/pycord path: /pycord/models/guild.py
from __future__ import annotations
from typing import List, Optional
import pycord.config
from pycord.helpers import parse_timestamp
from .base import comboproperty, Model
class Role(Model):
"""
This role model is used to represent discord ... | code_fim | hard | {
"lang": "python",
"repo": "Zwork101/pycord",
"path": "/pycord/models/guild.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Member(Model):
"""
This member model represents discord members
This is linked under MEMBER. A member is simply a normal user with guild specific information. There will be no way
to find the original guild from a member object unless it's received from a gateway event such as when ... | code_fim | hard | {
"lang": "python",
"repo": "Zwork101/pycord",
"path": "/pycord/models/guild.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # CrawlSpider的rules属性是直接从response对象的文本中提取url,然后自动创建新的请求。
# 与Spider不同的是,CrawlSpider已经重写了parse函数
# scrapy crawl spidername开始运行,程序自动使用start_urls构造Request并发送请求,
# 然后调用parse函数对其进行解析,在这个解析过程中使用rules中的规则从html(或xml)文本中提取匹配的链接,
# 通过这个链接再次生成Request,如此不断循环,直到返回的文本中再也没有匹配的链接,或调度器中的Request对象用尽,程序才停... | code_fim | hard | {
"lang": "python",
"repo": "zanachka/ScrapyRedisBloomFilterBlockCluster",
"path": "/demo/MeinvSpider/MeinvSpider/spiders/meinv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> items.append(item)
# yield item
except BaseException:
print(traceback.format_exc())
for item in items:
tmp_time = get_time_stamp()
item['capture_time'] = tmp_time
... | code_fim | hard | {
"lang": "python",
"repo": "zanachka/ScrapyRedisBloomFilterBlockCluster",
"path": "/demo/MeinvSpider/MeinvSpider/spiders/meinv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zanachka/ScrapyRedisBloomFilterBlockCluster path: /demo/MeinvSpider/MeinvSpider/spiders/meinv.py
# -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from scrapy_redis_bloomfilter_block_cluster.spiders import RedisCrawl... | code_fim | hard | {
"lang": "python",
"repo": "zanachka/ScrapyRedisBloomFilterBlockCluster",
"path": "/demo/MeinvSpider/MeinvSpider/spiders/meinv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if(line.split()[42] == "0"):
continue
cv2.line(img, (200 + CurrentTime, 65 + counter*60), (200 + CurrentTime, 115+ counter*60), ColorLabel[line.split()[42]])
cv2.putText(img, line.split()[0], (35, 95 + counter*60), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0,... | code_fim | hard | {
"lang": "python",
"repo": "hhojatansari/DatasetPloter",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hhojatansari/DatasetPloter path: /main.py
import numpy as np
import cv2
ColorLabel = {
"0" : (255, 255, 255), #NoLabel
"1" : (0, 240, 190), #Meal_Preparation
"2" : (178, 255, 102), #Relax
"3" : (255, 255, 0), #Eating
"4" : (200, 200, 200), #Work
"5" : (250, 206, 135), #Sl... | code_fim | hard | {
"lang": "python",
"repo": "hhojatansari/DatasetPloter",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
crawler(2, 3)
'''
MySQL
values = {
'CategoryId': '108715',
'CategoryType': "SiteCategory",
'ItemListActionName': "PostList",
'PageIndex': index,
'ParentCategoryId': '108712',
'TotalPostCount': '1872'
}
PHP
values = {
... | code_fim | hard | {
"lang": "python",
"repo": "Ctrl-12/Project-experience",
"path": "/python-百度关键字爬虫/SEO/mysql/cnblogs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
crawler(2, 3)
'''
MySQL
values = {
'CategoryId': '108715',
'CategoryType': "SiteCategory",
'ItemListActionName': "PostList",
'PageIndex': index,
'ParentCategoryId': '108712',
'TotalPostCount': '1872'
}
PHP
values = {
... | code_fim | hard | {
"lang": "python",
"repo": "Ctrl-12/Project-experience",
"path": "/python-百度关键字爬虫/SEO/mysql/cnblogs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ctrl-12/Project-experience path: /python-百度关键字爬虫/SEO/mysql/cnblogs.py
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import urllib.request
import os
# cnblogs post请求
def getDoc(index):
print(
'--------------------------------------------------当前爬取cnblogs第' + ... | code_fim | hard | {
"lang": "python",
"repo": "Ctrl-12/Project-experience",
"path": "/python-百度关键字爬虫/SEO/mysql/cnblogs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # vanilla
loss_cfg = dict(
type='GANLoss',
gan_type='vanilla',
real_label_val=1.0,
fake_label_val=0.0,
loss_weight=2.0)
gan_loss = build_loss(loss_cfg)
loss = gan_loss(input_1, True, is_disc=False)
assert_almost_equal(loss.item(), 0.6265233)
... | code_fim | hard | {
"lang": "python",
"repo": "ViTAE-Transformer/ViTPose",
"path": "/tests/test_losses/test_mesh_losses.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ViTAE-Transformer/ViTPose path: /tests/test_losses/test_mesh_losses.py
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from numpy.testing import assert_almost_equal
from mmpose.models import build_loss
from mmpose.models.utils.geometry import batch_rodrigues
def test... | code_fim | hard | {
"lang": "python",
"repo": "ViTAE-Transformer/ViTPose",
"path": "/tests/test_losses/test_mesh_losses.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
tracker = Tracker_temp(tracker_name='deep_sort', config_path='./config.cfg')
tracker.start_tracking()<|fim_prefix|># repo: Zumbalamambo/probability-driven-realtime-multiple-object-tracking-using-mobiletnet-and-deep-SORT path: /tracker_test.py
# -*- coding: utf-8 -*-
"""... | code_fim | easy | {
"lang": "python",
"repo": "Zumbalamambo/probability-driven-realtime-multiple-object-tracking-using-mobiletnet-and-deep-SORT",
"path": "/tracker_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from tracker.tracker import Tracker_temp
if __name__ == "__main__":
tracker = Tracker_temp(tracker_name='deep_sort', config_path='./config.cfg')
tracker.start_tracking()<|fim_prefix|># repo: Zumbalamambo/probability-driven-realtime-multiple-object-tracking-using-mobiletnet-and-deep-SORT path: /t... | code_fim | easy | {
"lang": "python",
"repo": "Zumbalamambo/probability-driven-realtime-multiple-object-tracking-using-mobiletnet-and-deep-SORT",
"path": "/tracker_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zumbalamambo/probability-driven-realtime-multiple-object-tracking-using-mobiletnet-and-deep-SORT path: /tracker_test.py
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 24 16:23:31 2018
<|fim_suffix|>from tracker.tracker import Tracker_temp
if __name__ == "__main__":
tracker = Tracker_temp(tr... | code_fim | easy | {
"lang": "python",
"repo": "Zumbalamambo/probability-driven-realtime-multiple-object-tracking-using-mobiletnet-and-deep-SORT",
"path": "/tracker_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
write data in gzipped h5 format.
"""
f = h5py.File(filename, 'w', libver='latest')
dset = f.create_dataset('array', shape=(data.shape), data = data, compression='gzip', compression_opts=9)
f.close()
def create_directory_structure(root):
"""
create competition output di... | code_fim | hard | {
"lang": "python",
"repo": "jvpoulos/NeurIPS2019-traffic4cast",
"path": "/utils/create_submissiontest_like.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jvpoulos/NeurIPS2019-traffic4cast path: /utils/create_submissiontest_like.py
#!/usr/bin/env/python3
# Copyright 2019 Institute of Advanced Research in Artificial Intelligence (IARAI) GmbH.
# IARAI licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use t... | code_fim | hard | {
"lang": "python",
"repo": "jvpoulos/NeurIPS2019-traffic4cast",
"path": "/utils/create_submissiontest_like.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # gather command line arguments.
inpath = ''
outpath = ''
outvalue = int(0)
out_data = np.zeros((5,3,495,436,3))
random = False
try:
opts, args = getopt.getopt(sys.argv[1:], "hi:o:v:", ["inpath=","outpath=","outvalue="])
except getopt.GetoptError:
print('usa... | code_fim | hard | {
"lang": "python",
"repo": "jvpoulos/NeurIPS2019-traffic4cast",
"path": "/utils/create_submissiontest_like.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxim-filkov/mobile-test-helper path: /action/RecordVideoAction.py
"""
This module contains actions related to recording video from connected mobile device.
"""
import framework.utils.argparsing.completion as completion
import framework.utils.argparsing.defaults as defaults
import framework.util... | code_fim | hard | {
"lang": "python",
"repo": "maxim-filkov/mobile-test-helper",
"path": "/action/RecordVideoAction.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param device: string, device identifier, e.g. "TA9890AMTG".
:param timeout: int, maximum duration for video, seconds.
:param bitrate: int, video bit-rate, megabits per second.
:param compress: boolean, compress out video or not, by default yes.
"""
if devic... | code_fim | hard | {
"lang": "python",
"repo": "maxim-filkov/mobile-test-helper",
"path": "/action/RecordVideoAction.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class RecordVideoAction(object):
"""
Action for recording video.
"""
__metaclass__ = ActionFactory
class Meta(object):
"""
Meta class to describe action.
"""
action = "video"
help = "Record video from device"
@staticmethod
def init_par... | code_fim | hard | {
"lang": "python",
"repo": "maxim-filkov/mobile-test-helper",
"path": "/action/RecordVideoAction.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muthujothi/CrowdAnalytix-CrimeRates-PredictiveModelling path: /benchmark_median_submission.py
import csv
from collections import Counter
from collections import OrderedDict
from collections import defaultdict
year_crimerates = {}
year_crimerates['1Robbery_rate'] = 157.7
year_crimerates['2Robbe... | code_fim | medium | {
"lang": "python",
"repo": "muthujothi/CrowdAnalytix-CrimeRates-PredictiveModelling",
"path": "/benchmark_median_submission.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
datareader = csv.reader(open('C:/Pst Files/CrowdAnalytix/CrimeRates/CA_Crime_Rate_Submission_Format.csv','rb'))
open_file_object = csv.writer(open("C:/Pst Files/CrowdAnalytix/CrimeRates/submission_crime_yearwise_medians.csv", "wb"))
header = datareader.next() #skip the first line of the test file.
for d... | code_fim | medium | {
"lang": "python",
"repo": "muthujothi/CrowdAnalytix-CrimeRates-PredictiveModelling",
"path": "/benchmark_median_submission.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> chat_id = update.message.chat_id
if len(context.args) < 1:
return
if len(context.args[0]) > self.maxQuoteeChars:
context.bot.send_message(chat_id=chat_id, text=':D')
return
if chat_id not in self.correctQuote or chat_id not in self.guess... | code_fim | hard | {
"lang": "python",
"repo": "Aivoapina/imneversorry",
"path": "/quotedle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aivoapina/imneversorry path: /quotedle.py
import enum
from telegram import Update
from telegram.ext import CallbackContext
import random
import db
GREEN = '🟩'
YELLO = '🟨'
BLACK = '⬛️'
def makeGuessString(guess, correct):
n_chars_guess = len(guess)
n_chars_correct = len(correct)
... | code_fim | hard | {
"lang": "python",
"repo": "Aivoapina/imneversorry",
"path": "/quotedle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gkdas2/vtol_sizing path: /src/Python/Stage_1/extract_plot_data.py
import numpy, sys
from conversions import *
#=========================================================================
# Write file header information
#========================================================================= ... | code_fim | hard | {
"lang": "python",
"repo": "gkdas2/vtol_sizing",
"path": "/src/Python/Stage_1/extract_plot_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
icom = com['icom']
Wt = data1['Wt']
Power = data1['Power']
Fuel = data1['Fuel']
Empty = data1['Empty']
payload = data1['payload']
op_cost = data1['op_cost']
valid ... | code_fim | hard | {
"lang": "python",
"repo": "gkdas2/vtol_sizing",
"path": "/src/Python/Stage_1/extract_plot_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NeutrinoLiu/FedML path: /fedml_api/standalone/hierarchical_fl/group.py
import logging
from fedml_api.standalone.hierarchical_fl.client import Client
#from fedml_api.standalone.fedavg.fedavg_trainer import FedAvgTrainer
from fedml_api.distributed.fedavg.FedAVGTrainer import FedAVGTrainer as FedAv... | code_fim | hard | {
"lang": "python",
"repo": "NeutrinoLiu/FedML",
"path": "/fedml_api/standalone/hierarchical_fl/group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> sampled_client_list = [self.client_dict[client_idx] for client_idx in sampled_client_indexes]
w_group = w
w_group_list = []
for group_round_idx in range(self.args.group_comm_round):
logging.info("Group ID : {} / Group Communication Round : {}".format(self.idx, g... | code_fim | hard | {
"lang": "python",
"repo": "NeutrinoLiu/FedML",
"path": "/fedml_api/standalone/hierarchical_fl/group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if n%10==0:
print(0)
elif n%5==0:
print(1)
else:
print(-1)
t = t-1<|fim_prefix|># repo: srijan-singh/CodeChef path: /Beginner/Two vs Ten (TWOVSTEN)/twovsten.py
t = int(input())
<|fim_middle|>while t:
n = int(input())
| code_fim | easy | {
"lang": "python",
"repo": "srijan-singh/CodeChef",
"path": "/Beginner/Two vs Ten (TWOVSTEN)/twovsten.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: srijan-singh/CodeChef path: /Beginner/Two vs Ten (TWOVSTEN)/twovsten.py
t = int(input())
<|fim_suffix|> if n%10==0:
print(0)
elif n%5==0:
print(1)
else:
print(-1)
t = t-1<|fim_middle|>while t:
n = int(input())
| code_fim | easy | {
"lang": "python",
"repo": "srijan-singh/CodeChef",
"path": "/Beginner/Two vs Ten (TWOVSTEN)/twovsten.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>This shows that we can not multiply the two arrays
#Question 3.b
A.T.dot(B) #this is just the transpose
np.linalg.matrix_rank(A.T.dot(B))#this is the rank<|fim_prefix|># repo: amypitts01/data440 path: /hw0/matrix_checks.py
import numpy as np
#The two arrays given in question three
A = np.array([[1<|fim... | code_fim | medium | {
"lang": "python",
"repo": "amypitts01/data440",
"path": "/hw0/matrix_checks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>this is just the transpose
np.linalg.matrix_rank(A.T.dot(B))#this is the rank<|fim_prefix|># repo: amypitts01/data440 path: /hw0/matrix_checks.py
import numpy as np
#The two arrays given in question three
A = np.array([[1<|fim_middle|>,4,-3],[2,-1,3]])
B = np.array([[-2,0,5],[0,-1,4]])
#Question 3.a
A... | code_fim | medium | {
"lang": "python",
"repo": "amypitts01/data440",
"path": "/hw0/matrix_checks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amypitts01/data440 path: /hw0/matrix_checks.py
import numpy as np
#The two arrays given in question three
A = np.array([[1,4,-3],[2,-1,3]])
B = np.array([[-2,0,5],[0,-1,4]])
#Question 3.a
A.dot(B) #<|fim_suffix|>this is just the transpose
np.linalg.matrix_rank(A.T.dot(B))#this is the rank<|fim... | code_fim | medium | {
"lang": "python",
"repo": "amypitts01/data440",
"path": "/hw0/matrix_checks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pbreaux/LupSeat2.0 path: /models/room.py
from models.seat import *
def chr_to_int(char):
'''Convert row char to row number
Args:
row (char): ('a', 'b')
Returns:
int: row number (1 to max_row)
'''
return ord(char.lower()) - ord('a') + 1
def int_to_chr(num):
... | code_fim | hard | {
"lang": "python",
"repo": "pbreaux/LupSeat2.0",
"path": "/models/room.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _add_seats(self, f_raw):
"""Adds seats to room (during instantiation)"""
# Row major
for row in range(self.max_row):
self.row_breaks.append([])
self.seats.append([None] * self.max_col)
seat_flag = False
infer_row_num = 0
for ... | code_fim | hard | {
"lang": "python",
"repo": "pbreaux/LupSeat2.0",
"path": "/models/room.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pombredanne/taskflow-1 path: /taskflow/engines/action_engine/analyzer.py
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Yahoo! Inc. 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": "pombredanne/taskflow-1",
"path": "/taskflow/engines/action_engine/analyzer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Analyzes a compilation and aids in execution processes.
Its primary purpose is to get the next atoms for execution or reversion
by utilizing the compilations underlying structures (graphs, nodes and
edge relations...) and using this information along with the atom
state/states stor... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/taskflow-1",
"path": "/taskflow/engines/action_engine/analyzer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: furas/python-examples path: /tkinter/__canvas__/canvas-dash/example-1.py
#!/usr/bin/env python3
import tkinter as tk
root = tk.Tk()
<|fim_suffix|>canvas.create_line(0, 10, 400, 10, dash=(5, 1))
canvas.create_line(0, 20, 400, 20, dash=(5, 5))
canvas.create_line(0, 30, 400, 30, dash=(1, 1))
canv... | code_fim | easy | {
"lang": "python",
"repo": "furas/python-examples",
"path": "/tkinter/__canvas__/canvas-dash/example-1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>canvas.create_line(0, 10, 400, 10, dash=(5, 1))
canvas.create_line(0, 20, 400, 20, dash=(5, 5))
canvas.create_line(0, 30, 400, 30, dash=(1, 1))
canvas.create_line(0, 40, 400, 40, dash=(4, 1))
canvas.create_line(0, 50, 400, 50, dash=(5, 10))
canvas.create_line(0, 60, 400, 60, dash=(5, 5, 2, 5))
canvas.crea... | code_fim | easy | {
"lang": "python",
"repo": "furas/python-examples",
"path": "/tkinter/__canvas__/canvas-dash/example-1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> command.add_argument('db_account_key', '--key', required=False, default=None,
arg_group=group_name,
help='DocumentDB account key. Must be used in conjunction with documentdb '
'account name or url-connection.')
comman... | code_fim | hard | {
"lang": "python",
"repo": "darshanhs90/azure-cli",
"path": "/src/command_modules/azure-cli-documentdb/azure/cli/command_modules/documentdb/_command_type.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> command.add_argument('db_resource_group_name', '--resource-group-name', '-g',
arg_group=group_name,
help='name of the resource group. Must be used in conjunction with '
'documentdb account name.')
command.add_argument(... | code_fim | hard | {
"lang": "python",
"repo": "darshanhs90/azure-cli",
"path": "/src/command_modules/azure-cli-documentdb/azure/cli/command_modules/documentdb/_command_type.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darshanhs90/azure-cli path: /src/command_modules/azure-cli-documentdb/azure/cli/command_modules/documentdb/_command_type.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under t... | code_fim | hard | {
"lang": "python",
"repo": "darshanhs90/azure-cli",
"path": "/src/command_modules/azure-cli-documentdb/azure/cli/command_modules/documentdb/_command_type.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def updateData(id, StdID = "", Firstname = "", Lastname = "", DOB = "", Age = "", Gender = "", Address = "", Mobile = ""):
con = sqlite3.connect("student.db")
cur = con.cursor()
cur.execute("UPDATE student SET StdID = ? , Firstname = ? , Lastname = ? , DOB = ?, Age - ?, Gender = ?, Address, M... | code_fim | hard | {
"lang": "python",
"repo": "arhaan26/Akwins",
"path": "/stdDatabase_Backend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arhaan26/Akwins path: /stdDatabase_Backend.py
import sqlite3
#Backend
def studentData():
con = sqlite3.connect("student.db")
cur = con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS student(id INTEGER PRIMARY KEY, StdID text, Firstname text, Lastname text, DOB text, Age text, Gend... | code_fim | hard | {
"lang": "python",
"repo": "arhaan26/Akwins",
"path": "/stdDatabase_Backend.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> con = sqlite3.connect("student.db")
cur = con.cursor()
cur.execute("INSERT INTO student VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?)", (StdID, Firstname, Lastname, DOB, Age, Gender, Address, Mobile))
con.commit()
con.close()
def viewData():
con = sqlite3.connect("student.db")
cur = c... | code_fim | medium | {
"lang": "python",
"repo": "arhaan26/Akwins",
"path": "/stdDatabase_Backend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def check_file_extension(data, alloed_extensions):
extension = data.name.split(".")[1:]
if len(extension) == 1 and extension[0].lower() in alloed_extensions:
return True
return False
def clean(self):
if self.data:
if self.... | code_fim | hard | {
"lang": "python",
"repo": "xhnilic3/django-courses",
"path": "/courses/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xhnilic3/django-courses path: /courses/models.py
> 0
def get_active_runs(self):
if self.state == "O":
return self.run_set.filter(Q(end__gte=datetime.today()) | Q(end=None)).order_by("-start")
else:
return self.objects.none()
@property
def leng... | code_fim | hard | {
"lang": "python",
"repo": "xhnilic3/django-courses",
"path": "/courses/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xhnilic3/django-courses path: /courses/models.py
("Draft")),
("O", _("Open")),
("C", _("Closed")),
("P", _("Private")),
)
LECTURE_TYPE = (
("V", _("Video Lesson")),
("T", _("Text to read")),
("PF", _("Peer Feedback")),
("P", _("Project")),
("F", _("Feedback")),
... | code_fim | hard | {
"lang": "python",
"repo": "xhnilic3/django-courses",
"path": "/courses/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: INCATools/ontology-access-kit path: /tests/test_validation/test_definition_ontology_rules.py
import unittest
from oaklib.datamodels.obograph import (
ExistentialRestrictionExpression,
LogicalDefinitionAxiom,
)
from oaklib.datamodels.vocabulary import PART_OF
from oaklib.implementations.p... | code_fim | hard | {
"lang": "python",
"repo": "INCATools/ontology-access-kit",
"path": "/tests/test_validation/test_definition_ontology_rules.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_rule(self):
"""
Checks logical definitions and text definitions are aligned.
"""
rule = self.rule
cases = [
(
"A membrane that is part of a nucleus. Blah.",
"membrane",
"is part of a nucleus",
... | code_fim | hard | {
"lang": "python",
"repo": "INCATools/ontology-access-kit",
"path": "/tests/test_validation/test_definition_ontology_rules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Checks logical definitions and text definitions are aligned.
"""
rule = self.rule
cases = [
(
"A membrane that is part of a nucleus. Blah.",
"membrane",
"is part of a nucleus",
"Blah.",
... | code_fim | hard | {
"lang": "python",
"repo": "INCATools/ontology-access-kit",
"path": "/tests/test_validation/test_definition_ontology_rules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> url(r'^learning_recipient/$', 'learning_recipient',
name="learning_recipient_set"),
url(r'^(?P<mail_id>[\w\-\+]+)/$', 'viewmail', name="mail_detail"),
url(r'^(?P<mail_id>[\w\-\+]+)/headers/$', 'viewheaders',
name="headers_detail"),
)<|fim_prefix|># repo: carragom/modoboa-amavis p... | code_fim | hard | {
"lang": "python",
"repo": "carragom/modoboa-amavis",
"path": "/modoboa_amavis/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carragom/modoboa-amavis path: /modoboa_amavis/urls.py
from django.conf.urls import patterns, url
urlpatterns = patterns(
'modoboa_amavis.views',
url(r'^$', 'index', name="index"),
url(r'^listing/$', '_listing', name="_mail_list"),
url(r'^listing/page/$', 'listing_page', name="ma... | code_fim | hard | {
"lang": "python",
"repo": "carragom/modoboa-amavis",
"path": "/modoboa_amavis/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fbacchella/oscmd path: /oslib/ami/run.py
import oslib
from oslib.command import Command
from oslib import build
class Run(Command):
"""
This class is used to launch a new instance, that can be autoconfigured using a known puppet class"""
object = 'ami'
verb = 'run'
def fill_pars... | code_fim | hard | {
"lang": "python",
"repo": "fbacchella/oscmd",
"path": "/oslib/ami/run.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if status.__class__ == "".__class__ or status.__class__ == u"".__class__:
return status
else:
instance = status
key_file = self.ctxt.key_file
if hasattr(instance, 'key_file'):
key_file = instance.key_file
message =... | code_fim | medium | {
"lang": "python",
"repo": "fbacchella/oscmd",
"path": "/oslib/ami/run.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def generate_samples_same_seed(wgan, params, nsamples=1, checkpoint=None):
# Sample latent variables
init_params = np.array([[wgan.net.params['init_range'][c][0] for c in range(wgan.net.params['cond_params'])]])
latent_0 = wgan.net.sample_latent(bs=nsamples, params=init_params)
z_0 = late... | code_fim | hard | {
"lang": "python",
"repo": "nperraud/3DcosmoGAN",
"path": "/cosmotools/metric/evaluation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nperraud/3DcosmoGAN path: /cosmotools/metric/evaluation.py
l']):
real = dic['real']()
else:
real = dic['real']
fig, ax = plt.subplots(nrows=2, ncols=3, figsize=(20, 10))
row_idx = 0
for row in ax:
if row_idx == 0:
... | code_fim | hard | {
"lang": "python",
"repo": "nperraud/3DcosmoGAN",
"path": "/cosmotools/metric/evaluation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Comparison plot between two curves real and fake corresponding to axis x
def plot_cmp(x, fake, real=None, xscale='linear', yscale='log', xlabel="", ylabel="", ax=None, title="", shade=False, confidence=None, xlim=None, ylim=None, fractional_difference=False, algorithm='classic', loc=3):
if ax is No... | code_fim | hard | {
"lang": "python",
"repo": "nperraud/3DcosmoGAN",
"path": "/cosmotools/metric/evaluation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jolibrain/dd_widgets path: /dd_widgets/text.py
from pathlib import Path
from typing import List, Optional
from ipywidgets import HBox, SelectMultiple
from .core import JSONType
from .mixins import TextTrainerMixin, sample_from_iterable
from .widgets import Solver, GPUIndex, Engine
alpha = "abc... | code_fim | hard | {
"lang": "python",
"repo": "jolibrain/dd_widgets",
"path": "/dd_widgets/text.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
"connector": "txt",
"characters": self.characters.value,
"sequence": self.sequence.value,
"read_forward": self.read_forward.value,
"alphabet": self.alphabet.value,
"sparse": self.sparse.value,
"embedding":... | code_fim | hard | {
"lang": "python",
"repo": "jolibrain/dd_widgets",
"path": "/dd_widgets/text.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awesome-security/streamalert path: /stream_alert/athena_partition_refresh/main.py
'''
Copyright 2017-present, Airbnb Inc.
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
h... | code_fim | hard | {
"lang": "python",
"repo": "awesome-security/streamalert",
"path": "/stream_alert/athena_partition_refresh/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
string: The result of the Query. This value can be SUCCEEDED, FAILED, or CANCELLED.
Reference https://bit.ly/2uuRtda.
"""
@backoff.on_predicate(backoff.fibo,
lambda status: status in ('QUEUED', 'RUNNING'),
... | code_fim | hard | {
"lang": "python",
"repo": "awesome-security/streamalert",
"path": "/stream_alert/athena_partition_refresh/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoelcortes/pyflowsheet path: /pyflowsheet/backends/foreignObject.py
import svgwrite
class ForeignObject(
svgwrite.base.BaseElement,
svgwrite.mixins.Transform,
svgwrite.container.Presentation,
):
"""Create an instance of the ForeignObject class. This class describes an add-on to ... | code_fim | medium | {
"lang": "python",
"repo": "yoelcortes/pyflowsheet",
"path": "/pyflowsheet/backends/foreignObject.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_xml(self):
xml = super().get_xml()
xml.append(svgwrite.etree.etree.fromstring(self.obj))
return xml<|fim_prefix|># repo: yoelcortes/pyflowsheet path: /pyflowsheet/backends/foreignObject.py
import svgwrite
class ForeignObject(
svgwrite.base.BaseElement,
svgwri... | code_fim | medium | {
"lang": "python",
"repo": "yoelcortes/pyflowsheet",
"path": "/pyflowsheet/backends/foreignObject.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(**extra)
self.obj = obj
def get_xml(self):
xml = super().get_xml()
xml.append(svgwrite.etree.etree.fromstring(self.obj))
return xml<|fim_prefix|># repo: yoelcortes/pyflowsheet path: /pyflowsheet/backends/foreignObject.py
import svgwrite
clas... | code_fim | medium | {
"lang": "python",
"repo": "yoelcortes/pyflowsheet",
"path": "/pyflowsheet/backends/foreignObject.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dasewasia10/bydase-0002 path: /main.py
import random
import aiofiles
import discord
from discord.ext import commands
from dotenv import load_dotenv
from os import getenv
load_dotenv()
TOKEN = getenv('DISCORD_TOKEN')
intents = discord.Intents.default()
intents.members = True
activity = discor... | code_fim | hard | {
"lang": "python",
"repo": "Dasewasia10/bydase-0002",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> message_id = payload.message_id
guild = bot.get_guild(payload.guild_id)
member = guild.get_member(payload.user_id)
if message_id == 875962741733601280: # ID depends on message
if payload.emoji.name == '🇮🇩':
role = discord.utils.get(guild.roles, id=875321668363501568)... | code_fim | hard | {
"lang": "python",
"repo": "Dasewasia10/bydase-0002",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ncml_file = args.ncml_file
if ncml_file is not None:
ncml_file = os.path.realpath(ncml_file)
hard_start = None
if args.hard_start:
hard_start = parse(args.hard_start)
if hard_start.tzinfo is None:
hard_start = hard_start.replace(tzinfo=pytz.utc)
... | code_fim | hard | {
"lang": "python",
"repo": "doron2402/pyaxiom",
"path": "/pyaxiom/netcdf/grids/binner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doron2402/pyaxiom path: /pyaxiom/netcdf/grids/binner.py
#! python
import os
import sys
import argparse
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
import six
from pyaxiom.netcdf.grids import Collection
import pytz
# Log to stdout
import logging
ch = lo... | code_fim | hard | {
"lang": "python",
"repo": "doron2402/pyaxiom",
"path": "/pyaxiom/netcdf/grids/binner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>dents in college < 1000
#
# Output Format
# Output total number of students who have subscriptions to the English or the French newspaper but not both.
#
# Sample Input
# 9
# 1 2 3 4 5 6 7 8 9
# 9
# 10 1 2 3 11 21 55 6 8
#
# Sample Output
# 8
#
# Explanation
# The roll numbers of stu... | code_fim | hard | {
"lang": "python",
"repo": "sagarnikam123/learnNPractice",
"path": "/hackerRank/tracks/languages/python/4_sets/9_set.symmetricDifferenceOperation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.