text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Ascensiony/EverPro-Intelligence-APIs path: /backend/everpro/competition_tracking/tests.py
from rest_framework.test import APITestCase
from competition_tracking.models import *
from django.urls import reverse
import json
<|fim_suffix|> def test_get(self):
response = self.client.get(re... | code_fim | medium | {
"lang": "python",
"repo": "Ascensiony/EverPro-Intelligence-APIs",
"path": "/backend/everpro/competition_tracking/tests.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = {"asin": "BXOSXSX", "zone": " IN"}
self.client.post(reverse("competition_tracking_list_view"), data=data)
self.assertEqual(ComepetetionTrack.objects.count(), 1)<|fim_prefix|># repo: Ascensiony/EverPro-Intelligence-APIs path: /backend/everpro/competition_tracking/tests.py
fr... | code_fim | medium | {
"lang": "python",
"repo": "Ascensiony/EverPro-Intelligence-APIs",
"path": "/backend/everpro/competition_tracking/tests.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> create_app(flask_config=flask_config)<|fim_prefix|># repo: DurandA/pokemon-battle-api path: /tests/test_app_creation.py
# encoding: utf-8
# pylint: disable=missing-docstring
import pytest
from app import create_app
<|fim_middle|>@pytest.mark.parametrize('flask_config', ['production', 'development'... | code_fim | medium | {
"lang": "python",
"repo": "DurandA/pokemon-battle-api",
"path": "/tests/test_app_creation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DurandA/pokemon-battle-api path: /tests/test_app_creation.py
# encoding: utf-8
# pylint: disable=missing-docstring
import pytest
from app import create_app
<|fim_suffix|> create_app(flask_config=flask_config)<|fim_middle|>@pytest.mark.parametrize('flask_config', ['production', 'development'... | code_fim | medium | {
"lang": "python",
"repo": "DurandA/pokemon-battle-api",
"path": "/tests/test_app_creation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert True<|fim_prefix|># repo: vanduc95/CAL_Appliances path: /FCAP/fcap/tests/test_example.py
import unittest
class BasicTestSuite(unittest.TestCase):
<|fim_middle|> """Basic test cases."""
def test_absolute_truth_and_meaning(self):
| code_fim | medium | {
"lang": "python",
"repo": "vanduc95/CAL_Appliances",
"path": "/FCAP/fcap/tests/test_example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vanduc95/CAL_Appliances path: /FCAP/fcap/tests/test_example.py
import unittest
class BasicTestSuite(unittest.TestCase):
<|fim_suffix|> assert True<|fim_middle|> """Basic test cases."""
def test_absolute_truth_and_meaning(self):
| code_fim | medium | {
"lang": "python",
"repo": "vanduc95/CAL_Appliances",
"path": "/FCAP/fcap/tests/test_example.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> images, labels = get_data(image_f, label_f)
print(labels)
outdir = image_f + "_folder"
if not os.path.exists(outdir):
os.mkdir(outdir)
for k,image in enumerate(images):
cv2.imwrite(os.path.join(outdir, '%05d.png' % (k,)), image)
labels = [outdir + '/%05d.png %d' % (k, ord(l)) for k,l ... | code_fim | hard | {
"lang": "python",
"repo": "ellepin/ICCV2019-LearningToPaint",
"path": "/mnist_save_png.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ellepin/ICCV2019-LearningToPaint path: /mnist_save_png.py
import os
import cv2
import numpy as np
import struct
train_image = 'data/kkanji/train-images-idx3-ubyte'
train_label = 'data/kkanji/train-labels-idx1-ubyte'
# test_image = 't10k-images-idx3-ubyte'
# test_label = 't10k-labels-idx1-ubyte'
... | code_fim | hard | {
"lang": "python",
"repo": "ellepin/ICCV2019-LearningToPaint",
"path": "/mnist_save_png.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(labels)
outdir = image_f + "_folder"
if not os.path.exists(outdir):
os.mkdir(outdir)
for k,image in enumerate(images):
cv2.imwrite(os.path.join(outdir, '%05d.png' % (k,)), image)
labels = [outdir + '/%05d.png %d' % (k, ord(l)) for k,l in enumerate(labels[8:])]
with open('%s.txt' ... | code_fim | hard | {
"lang": "python",
"repo": "ellepin/ICCV2019-LearningToPaint",
"path": "/mnist_save_png.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open('output.csv', 'w') as outfile:
writer = csv.writer(outfile)
for row in output:
if row == header: #Don't encode the header
outfile.write(row)
else:
row = [s.encode('utf-8') for s in row] #Encode it in utf-8
writer.writerows([row])<|fim_... | code_fim | hard | {
"lang": "python",
"repo": "flintholmm/pyhomes",
"path": "/boliga-scraper/dataCollecter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flintholmm/pyhomes path: /boliga-scraper/dataCollecter.py
from pageScraper import scrapePage
import csv
pageNumReq = int(raw_input("How many pages should be scraped? --> "))
output = []
header = "ID, ADRESSE, POSTNR, RUM, PRIS, KR/m2, BOLIG, GRUND, OPFORT, LIGGETID \n"
output.append(header)
... | code_fim | hard | {
"lang": "python",
"repo": "flintholmm/pyhomes",
"path": "/boliga-scraper/dataCollecter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
row = [s.encode('utf-8') for s in row] #Encode it in utf-8
writer.writerows([row])<|fim_prefix|># repo: flintholmm/pyhomes path: /boliga-scraper/dataCollecter.py
from pageScraper import scrapePage
import csv
pageNumReq = int(raw_input("How many pages should be scrap... | code_fim | medium | {
"lang": "python",
"repo": "flintholmm/pyhomes",
"path": "/boliga-scraper/dataCollecter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Only the last 'threshold' items are used for evaluation,
# unless less items are available (then they're used for training)
evaluation_series = pd.Series(False, index=group.index)
if len(group) > threshold:
evaluation_series.iloc[-threshold:] = True
re... | code_fim | medium | {
"lang": "python",
"repo": "ialab-puc/VisualRecSys-Tutorial-IUI2021",
"path": "/utils/data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ialab-puc/VisualRecSys-Tutorial-IUI2021 path: /utils/data.py
from pathlib import Path
import numpy as np
import pandas as pd
def extract_embedding(embedding, verbose=False):
features = list()
id2index = dict()
index2fn = dict()
filenames = set()
for i, (fn, vector_embedding... | code_fim | medium | {
"lang": "python",
"repo": "ialab-puc/VisualRecSys-Tutorial-IUI2021",
"path": "/utils/data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _mark_evaluation_rows(group):
# Only the last 'threshold' items are used for evaluation,
# unless less items are available (then they're used for training)
evaluation_series = pd.Series(False, index=group.index)
if len(group) > threshold:
evaluation_seri... | code_fim | medium | {
"lang": "python",
"repo": "ialab-puc/VisualRecSys-Tutorial-IUI2021",
"path": "/utils/data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mne-tools/mne-icalabel path: /mne_icalabel/iclabel/network/torch.py
try:
from importlib.resources import files # type: ignore
except ImportError:
from importlib_resources import files # type: ignore
import numpy as np
import torch
import torch.nn as nn
from numpy.typing import ArrayLik... | code_fim | hard | {
"lang": "python",
"repo": "mne-tools/mne-icalabel",
"path": "/mne_icalabel/iclabel/network/torch.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
self.img_conv = _ICLabelNetImg()
self.psds_conv = _ICLabelNetPSDS()
self.autocorr_conv = _ICLabelNetAutocorr()
self.conv = nn.Conv2d(
in_channels=712,
out_channels=7,
kernel_size=(4, 4),
padding=0,... | code_fim | hard | {
"lang": "python",
"repo": "mne-tools/mne-icalabel",
"path": "/mne_icalabel/iclabel/network/torch.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gauravsingh58/algo path: /topCoder/srms/300s/srm334/div2/supermarket_discount.py
class SupermarketDiscount:
<|fim_suffix|> s, i, r, c = sorted(goods), 0, 0, 0
while i < 3:
r += s[i]
if r >= 50:
c += r-10
r = 0
i +=... | code_fim | easy | {
"lang": "python",
"repo": "gauravsingh58/algo",
"path": "/topCoder/srms/300s/srm334/div2/supermarket_discount.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> s, i, r, c = sorted(goods), 0, 0, 0
while i < 3:
r += s[i]
if r >= 50:
c += r-10
r = 0
i += 1
return c + r<|fim_prefix|># repo: gauravsingh58/algo path: /topCoder/srms/300s/srm334/div2/supermarket_discount.py
clas... | code_fim | easy | {
"lang": "python",
"repo": "gauravsingh58/algo",
"path": "/topCoder/srms/300s/srm334/div2/supermarket_discount.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meng89/chenmeng.org path: /thisite/nce/views.py
import os
import flask
from flask import render_template, request
from . import nce
from .config import BOOK_DIR
reasonable1 = [
'已有实体书',
'曾有实体书,后来书坏了,扔了'
]
reasonable2 = [
'所处之地买不到实体书',
'买不起实体书'
]
requirement = '复制给别人前,会确保别... | code_fim | medium | {
"lang": "python",
"repo": "meng89/chenmeng.org",
"path": "/thisite/nce/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> selected_reasonable = request.form.get('reasonable')
selected_book = request.form.get('book')
selected_requirement = request.form.get('requirement')
if selected_book in [_book['filename'] for _book in books] \
and selected_reasonable in reasonable1 + reasonable2 \
... | code_fim | hard | {
"lang": "python",
"repo": "meng89/chenmeng.org",
"path": "/thisite/nce/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
return render_template('index.html',
books=books,
reasonable1=reasonable1, reasonable2=reasonable2,
requirement=requirement
)
@nce.route('/download', methods=['POST'])
def download():
se... | code_fim | medium | {
"lang": "python",
"repo": "meng89/chenmeng.org",
"path": "/thisite/nce/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexhor/SongBeamer_SimilarSongFinder path: /Subscribable.py
class Subscribable:
"""Registered subscription callbacks"""
_subscriptions: dict[int, list[callable]]
def __init__(self, available_subscription_types):
"""Setup subscriptions
:type available_subscription_type... | code_fim | hard | {
"lang": "python",
"repo": "alexhor/SongBeamer_SimilarSongFinder",
"path": "/Subscribable.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Run all subscriptions for the given type
:type subscription_type: int
:param subscription_type: The type of subscription to trigger
:type args: Any
:param args: Arguments to pass to the callback functions
:type kwargs: Any
:param kwargs: Named arg... | code_fim | hard | {
"lang": "python",
"repo": "alexhor/SongBeamer_SimilarSongFinder",
"path": "/Subscribable.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Register a new subscription
:type subscription_type: int
:param subscription_type: The type of subscription
:type callback: callable
:param callback: The callback to register for the subscription
"""
if subscription_type in self._subscriptions.key... | code_fim | hard | {
"lang": "python",
"repo": "alexhor/SongBeamer_SimilarSongFinder",
"path": "/Subscribable.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>, verbose_name='Видеозапись'),
),
migrations.AddField(
model_name='partitiontranscript',
name='meeting',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='partitions', to='core.meeting', verbose_name='Совещание... | code_fim | hard | {
"lang": "python",
"repo": "LeadersOfDigital2021/rosatom",
"path": "/voice_report/core/migrations/0016_auto_20210822_0052.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeadersOfDigital2021/rosatom path: /voice_report/core/migrations/0016_auto_20210822_0052.py
# Generated by Django 3.2.6 on 2021-08-21 19:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0... | code_fim | hard | {
"lang": "python",
"repo": "LeadersOfDigital2021/rosatom",
"path": "/voice_report/core/migrations/0016_auto_20210822_0052.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>d='')A,':t[T]=ord(sys.read(1))A+':t[T]+=1A-':t[T]-=1A>':T+=1A<':T-=1
R+=1""".replace('A',"\n if c=='"))<|fim_prefix|># repo: nnoodle/brainfpy path: /mbf.py
exec("""import sys
with open(sys.argv[1])as s:r=s.read()
j=p=T=R=0
t=[0]*999
def S(P,Q):
global j,p,R;R+=j
if r[R]==P:p+=1
elif r[R]==Q:
if p... | code_fim | medium | {
"lang": "python",
"repo": "nnoodle/brainfpy",
"path": "/mbf.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nnoodle/brainfpy path: /mbf.py
exec("""import sys
with open(sys.argv[1])as s:r=s.read()
j=p=T=R=0
t=[0]*999
def S(P,Q):
global j,p,R;R+=<|fim_suffix|>lif j==-1:S(']','[')
elif c=='['and t[T]==0:j=0
elif c==']'and t[T]!=0:j=-1
else:A.':print(chr(t[T]),end='')A,':t[T]=ord(sys.read(1))A+':t[T]+=... | code_fim | medium | {
"lang": "python",
"repo": "nnoodle/brainfpy",
"path": "/mbf.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peeyush1999/Chatbot path: /Chatbot/chatbot.py
from googlesearch import search
import requests
import bs4
import webbrowser
from bs4 import BeautifulSoup
import re
zomato_api = '42ba61672c6ec3b77ba9f6a8e44970f7'
class Travis:
def fetch_data(self,url):
headers = {'User-Agent': 'Mozill... | code_fim | hard | {
"lang": "python",
"repo": "peeyush1999/Chatbot",
"path": "/Chatbot/chatbot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''
''' ==========================================restaurants Near Me End======================='''
def hotels_near_me(location,stars):
query="makemytrip "+str(stars)+" star hotels near "+location
url=google(query)
soup=fetch_data(url)
hotels=soup.findAll('p',attrs={'id':'hlistp... | code_fim | hard | {
"lang": "python",
"repo": "peeyush1999/Chatbot",
"path": "/Chatbot/chatbot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: postech-di-lab/METIS path: /model-layer/knowledge-distillation-module/DE-RRD/Utils/dataset.py
import torch
import torch.nn as nn
import torch.utils.data as data
import torch.nn.functional as F
import numpy as np
from Utils.data_utils import *
from pdb import set_trace as bp
##################... | code_fim | hard | {
"lang": "python",
"repo": "postech-di-lab/METIS",
"path": "/model-layer/knowledge-distillation-module/DE-RRD/Utils/dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class implicit_CF_dataset_test(data.Dataset):
"""
Test Dataset for Leave-One-Out evaluation protocol.
It is used for a large model which cannot compute the total rating matrix at once.
"""
def __init__(self, user_count, test_sample, valid_sample, candidates, batch_size=1024):
... | code_fim | hard | {
"lang": "python",
"repo": "postech-di-lab/METIS",
"path": "/model-layer/knowledge-distillation-module/DE-RRD/Utils/dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # sampling
while True:
samples = torch.multinomial(self.ranking_mat, self.K, replacement=False)
if (samples > 500).sum() == 0:
break
samples = samples.sort(dim=1)[0]
for user in self.rating_mat:
... | code_fim | hard | {
"lang": "python",
"repo": "postech-di-lab/METIS",
"path": "/model-layer/knowledge-distillation-module/DE-RRD/Utils/dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linuxluigi/flask-meetup-data-scraper path: /tests/commands/test_get_groups.py
from meetup_search.commands.get_groups import get_groups
from meetup_search.models.group import Group
from time import sleep
from flask.app import Flask
from flask.testing import FlaskCliRunner
from click.testing import... | code_fim | medium | {
"lang": "python",
"repo": "linuxluigi/flask-meetup-data-scraper",
"path": "/tests/commands/test_get_groups.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # load all groups from JSON test file
result_1: Result = runner.invoke(
get_groups, ["/app/compose/local/flask/meetup_groups", "--load_events", "False"]
)
assert result_1.exit_code == 0
sleep(1)
# load group
group_1: Group = Group.get_group(urlname=meetup_groups["sand... | code_fim | hard | {
"lang": "python",
"repo": "linuxluigi/flask-meetup-data-scraper",
"path": "/tests/commands/test_get_groups.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> runner: FlaskCliRunner = app.test_cli_runner()
# load all groups from JSON test file
result_1: Result = runner.invoke(
get_groups, ["/app/compose/local/flask/meetup_groups", "--load_events", "False"]
)
assert result_1.exit_code == 0
sleep(1)
# load group
group_1:... | code_fim | hard | {
"lang": "python",
"repo": "linuxluigi/flask-meetup-data-scraper",
"path": "/tests/commands/test_get_groups.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zoobree/tushare path: /test/test.py
# -*- coding:utf-8 -*-
'''
Created on 2018/3/19
@author: Jimmy Liu
'''
import uni<|fim_suffix|>estName']
#unittest.main()
sys.path.append(DATA_PATH)
print(sys.path)<|fim_middle|>ttest
import sys
#import tushare.stock.trading as fd
DATA_PATH = "f:... | code_fim | medium | {
"lang": "python",
"repo": "zoobree/tushare",
"path": "/test/test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>estName']
#unittest.main()
sys.path.append(DATA_PATH)
print(sys.path)<|fim_prefix|># repo: zoobree/tushare path: /test/test.py
# -*- coding:utf-8 -*-
'''
Created on 2018/3/19
@author: Jimmy Liu
'''
import uni<|fim_middle|>ttest
import sys
#import tushare.stock.trading as fd
DATA_PATH = "f:... | code_fim | medium | {
"lang": "python",
"repo": "zoobree/tushare",
"path": "/test/test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Set up text entry widgets for red, green, and blue, storing the
# associated variables in a dictionary for later use.
colors = {}
for (name, col) in (('red', '#FF0000'),
('green', '#00FF00'),
('blue', '#0000FF')):
colors[name] = tkinter.StringVar()
colors[... | code_fim | medium | {
"lang": "python",
"repo": "jjc521/E-book-Collection",
"path": "/Python/Python编程实践gwpy2-code/code/gui/colorpicker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jjc521/E-book-Collection path: /Python/Python编程实践gwpy2-code/code/gui/colorpicker.py
import tkinter
def change(widget, colors):
""" Update the foreground color of a widget to show the RGB color value
stored in a dictionary with keys 'red', 'green', and 'blue'. Does
*not* check the col... | code_fim | hard | {
"lang": "python",
"repo": "jjc521/E-book-Collection",
"path": "/Python/Python编程实践gwpy2-code/code/gui/colorpicker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "\n".join(filter(lambda x: x != "",
map(lambda x: clear(x),
filter(lambda x: x is not None,
[contact.home_tel, contact.work_tel, contact.mobile_tel, contact.second_phone]))))<|fim_prefix|># repo: ... | code_fim | medium | {
"lang": "python",
"repo": "msergeyx/python_training",
"path": "/test/test_phones.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: msergeyx/python_training path: /test/test_phones.py
import re
def test_phones_on_home_page(app):
contact_from_home_page = app.contact.get_cont_list()[0]
contact_from_edit_page = app.contact.get_cont_info_from_edit_page(0)
assert contact_from_home_page.all_phones_from_home_page == me... | code_fim | hard | {
"lang": "python",
"repo": "msergeyx/python_training",
"path": "/test/test_phones.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def clear(s):
return re.sub("[() -]", "", s)
def merge_phones_like_on_home_page(contact):
return "\n".join(filter(lambda x: x != "",
map(lambda x: clear(x),
filter(lambda x: x is not None,
[contact... | code_fim | hard | {
"lang": "python",
"repo": "msergeyx/python_training",
"path": "/test/test_phones.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saurabh-wandhekar/Applications-of-Genetic-Algorithm path: /main.py
# -*- coding: utf-8 -*-
"""2018A7PS0157G_Saurabh.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/12WCAM0LY4M6K3tmYNv4uE5cMoCJxTpJL
"""
import random
import ... | code_fim | hard | {
"lang": "python",
"repo": "saurabh-wandhekar/Applications-of-Genetic-Algorithm",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def generateNextPopulation1(population, n):
newPopulation = []
while len(newPopulation) < n:
populationByProbability = [(x.probability(population), x) for x in population]
parent1 = pickRandomByProbability(populationByProbability)
populationByProbability = [x for x in popul... | code_fim | hard | {
"lang": "python",
"repo": "saurabh-wandhekar/Applications-of-Genetic-Algorithm",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> population = [EightQueens() for x in range(populationSize)]
while not 29 in [x.fitness() for x in population]:
best_fitness.append(max([x.fitness() for x in population]))
print("generation %d Best fitness: %d" % (generation, max([x.fitness() for x in population])))
populati... | code_fim | hard | {
"lang": "python",
"repo": "saurabh-wandhekar/Applications-of-Genetic-Algorithm",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fangpenlin/ez2pay path: /ez2pay/tests/unit/test_group.py
from __future__ import unicode_literals
from .helper import ModelTestCase
import transaction
class TestGroupModel(ModelTestCase):
def make_one(self):
from ez2pay.models.group import GroupModel
return GroupMo... | code_fim | hard | {
"lang": "python",
"repo": "fangpenlin/ez2pay",
"path": "/ez2pay/tests/unit/test_group.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with transaction.manager:
group_id = model.create(
group_name=group_name,
display_name=display_name,
)
pid1 = permission_model.create('p1')
pid2 = permission_model.create('p2')
pid3 = permission_model.creat... | code_fim | hard | {
"lang": "python",
"repo": "fangpenlin/ez2pay",
"path": "/ez2pay/tests/unit/test_group.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = self.make_one()
permission_model = self.make_permission_model()
group_name = 'tester'
display_name = group_name
with transaction.manager:
group_id = model.create(
group_name=group_name,
display_na... | code_fim | hard | {
"lang": "python",
"repo": "fangpenlin/ez2pay",
"path": "/ez2pay/tests/unit/test_group.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> "pytest>=5.4.1"
],
# the following makes a plugin available to pytest
entry_points={"pytest11": ["lego = pytest_lego.plugin"]},
# custom PyPI classifier for pytest plugins
classifiers=["Framework :: Pytest"],
)<|fim_prefix|># repo: Steven17D/Lego3 path: /lego/setup.py
"""This file... | code_fim | medium | {
"lang": "python",
"repo": "Steven17D/Lego3",
"path": "/lego/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Steven17D/Lego3 path: /lego/setup.py
"""This file describes the lego plugin setup info."""
from setuptools import setup
setup(
name="pytest-lego",
<|fim_suffix|> "pytest>=5.4.1"
],
# the following makes a plugin available to pytest
entry_points={"pytest11": ["lego = pytest_le... | code_fim | medium | {
"lang": "python",
"repo": "Steven17D/Lego3",
"path": "/lego/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rint(s[i], s[j], s[k])
exit(0)
print('NO')
if __name__ == '__main__':
main()<|fim_prefix|># repo: yuto-moriizumi/AtCoder path: /ARC022/ARC022a.py
# ARC022a
def main():
s = input()
n = len(s)
for i in range(n - 2):
for j in range(i, <|fim_middle|>n - 1):
... | code_fim | hard | {
"lang": "python",
"repo": "yuto-moriizumi/AtCoder",
"path": "/ARC022/ARC022a.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuto-moriizumi/AtCoder path: /ARC022/ARC022a.py
# ARC022a
def main():
s = input()
n = len(s)
for i in range(n - 2):
for j in range(i, n - 1):
for k in range(j, n):
if (s[i] == 'I' or s[i] == 'i') and (s[j] == 'C'<|fim_suffix|>rint(s[i], s[j], s[k])
... | code_fim | hard | {
"lang": "python",
"repo": "yuto-moriizumi/AtCoder",
"path": "/ARC022/ARC022a.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> or s[j] == 'c') and (s[k] == 't' or s[k] == 'T'):
print('YES')
#print(s[i], s[j], s[k])
exit(0)
print('NO')
if __name__ == '__main__':
main()<|fim_prefix|># repo: yuto-moriizumi/AtCoder path: /ARC022/ARC022a.py
# ARC022a
def main():
... | code_fim | hard | {
"lang": "python",
"repo": "yuto-moriizumi/AtCoder",
"path": "/ARC022/ARC022a.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.plot(gen_data[:,0], gen_data[:, 4], 'm')
plt.plot(gen_data[:,0], gen_data[:, 5], 'y')
plt.plot(gen_data[:,0], gen_data[:, 6], 'c')
plt.show()<|fim_prefix|># repo: Bookiebookie/LieSpline path: /plot.py
#!/usr/bin/env python
import sys
import numpy as np
import matplotlib.pyplot as plt
<|fim_middle|... | code_fim | hard | {
"lang": "python",
"repo": "Bookiebookie/LieSpline",
"path": "/plot.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bookiebookie/LieSpline path: /plot.py
#!/usr/bin/env python
import sys
import numpy as np
import matplotlib.pyplot as plt
<|fim_suffix|>
plt.figure()
plt.title('Accel')
plt.plot(data[:,0], data[:, 4], 'r')
plt.plot(data[:,0], data[:, 5], 'g')
plt.plot(data[:,0], data[:, 6], 'b')
plt.plot(gen_d... | code_fim | hard | {
"lang": "python",
"repo": "Bookiebookie/LieSpline",
"path": "/plot.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataBiosphere/azul path: /attic/cart/test_cart_item_manager.py
n(self):
self.dynamo_accessor.get_table(config.dynamo_cart_table_name).delete()
self.dynamo_accessor.get_table(config.dynamo_cart_item_table_name).delete()
self.dynamo_accessor.get_table(config.dynamo_user_tabl... | code_fim | hard | {
"lang": "python",
"repo": "DataBiosphere/azul",
"path": "/attic/cart/test_cart_item_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataBiosphere/azul path: /attic/cart/test_cart_item_manager.py
self.assertEqual(self.cart_item_manager.user_service.get_or_create(user_id)['DefaultCartId'], mock_cart_id)
self.assertEqual(cart['CartId'], mock_cart_id)
self.assertEqual(1, len(self.cart_item_manager.get_user_c... | code_fim | hard | {
"lang": "python",
"repo": "DataBiosphere/azul",
"path": "/attic/cart/test_cart_item_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Cart item request transform should return pages of a max size of the given value and return
a search_after string each time that will allow pagination through all documents in the index
"""
size = 700
service = ElasticsearchService()
hits, search... | code_fim | hard | {
"lang": "python",
"repo": "DataBiosphere/azul",
"path": "/attic/cart/test_cart_item_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mayalenE/holmes path: /autodisc/__init__.py
import autodisc.config
import autodisc.core
import autodisc.classifier
import autodisc.cppn
import autodisc.explorers
import autodisc.gui
import aut<|fim_suffix|>om autodisc.explorationdatahandler import ExplorationDataHandler, DataEntry<|fim_middle|>od... | code_fim | medium | {
"lang": "python",
"repo": "mayalenE/holmes",
"path": "/autodisc/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>odisc.helper
import autodisc.systems
from autodisc.config import Config
from autodisc.explorationdatahandler import ExplorationDataHandler, DataEntry<|fim_prefix|># repo: mayalenE/holmes path: /autodisc/__init__.py
import autodisc.config
import autodisc.core
import autodisc.classifier
imp<|fim_middle|>or... | code_fim | medium | {
"lang": "python",
"repo": "mayalenE/holmes",
"path": "/autodisc/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stivosaurus/rpi-snippets path: /reference_scripts/eleastic.py
from tkinter import *
trace = 0
class CanvasEventsDemo:
def __init__(self, parent=None):
canvas = Canvas(width=300, height=300, bg='white')
canvas.pack()
canvas.bind('<ButtonPress-1>', self.onStart)... | code_fim | medium | {
"lang": "python",
"repo": "stivosaurus/rpi-snippets",
"path": "/reference_scripts/eleastic.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> canvas = event.widget
if self.drawn: canvas.delete(self.drawn)
objectId = canvas.create_oval(self.start.x, self.start.y, event.x, event.y)
if trace: print (objectId)
self.drawn = objectId
def onClear(self, event):
event.widget.delete('all')
def onM... | code_fim | medium | {
"lang": "python",
"repo": "stivosaurus/rpi-snippets",
"path": "/reference_scripts/eleastic.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> event.widget.delete('all')
def onMove(self, event):
if self.drawn:
if trace: print (self.drawn)
canvas = event.widget
diffX, diffY = (event.x - self.start.x), (event.y - self.start.y)
canvas.move(self.drawn, diffX, diffY)
... | code_fim | hard | {
"lang": "python",
"repo": "stivosaurus/rpi-snippets",
"path": "/reference_scripts/eleastic.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> #UPDATE REQUIRED
previous = pd.read_csv('ENTER PREVIOUSLY ENTERED PATH AND FILENAME')
checker = previous['Links'][previous['Status'].iloc[:]=='Check & Apply']
#UPDATE REQUIRED
'''ENTER ALL THE NECESSARY DETAILS:
FLAG_WORDS - WORDS THAT ARE CLEARLY A NO-NO FOR YOU
CHECK_WORDS... | code_fim | hard | {
"lang": "python",
"repo": "nikhilharishpatel/Indeed_JD_Checker",
"path": "/Indeed_Job_Description_Checker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nikhilharishpatel/Indeed_JD_Checker path: /Indeed_Job_Description_Checker.py
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support impor... | code_fim | hard | {
"lang": "python",
"repo": "nikhilharishpatel/Indeed_JD_Checker",
"path": "/Indeed_Job_Description_Checker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hi-zhenyu/expon path: /test/test.py
from expon.core.exp import EXP
from expon.core.params import Params
from expon.core.metric import Metric
def test():
<|fim_suffix|> loss = Metric('loss', 'epoch')
acc = Metric('loss')
exp.add_metric(loss)
exp.add_metric(acc)
exp.set_seed(1... | code_fim | medium | {
"lang": "python",
"repo": "hi-zhenyu/expon",
"path": "/test/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> exp.save(output_format='html')
if __name__ == '__main__':
test()<|fim_prefix|># repo: hi-zhenyu/expon path: /test/test.py
from expon.core.exp import EXP
from expon.core.params import Params
from expon.core.metric import Metric
def test():
<|fim_middle|> exp = EXP()
params = Params()
... | code_fim | hard | {
"lang": "python",
"repo": "hi-zhenyu/expon",
"path": "/test/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(0, 100):
loss.update(1-0.01*i)
acc.update(0.01*i)
exp.save(output_format='html')
if __name__ == '__main__':
test()<|fim_prefix|># repo: hi-zhenyu/expon path: /test/test.py
from expon.core.exp import EXP
from expon.core.params import Params
from expon.core.met... | code_fim | hard | {
"lang": "python",
"repo": "hi-zhenyu/expon",
"path": "/test/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nxexox/python-rest-framework path: /rest_framework/views/sanic/__init__.py
import warnings
try:
from .views import SanicApiMethodView, SanicApiCompositionView, json_response
from .generics import (
GetResponseApiGenericMethodView, GetSerializerApiGenericMethodView, GetValidJsonAp... | code_fim | hard | {
"lang": "python",
"repo": "nxexox/python-rest-framework",
"path": "/rest_framework/views/sanic/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> GetValidJsonMixin,
json_response
]
except (ImportError, AttributeError):
warnings.warn(
'Cannot import sanic. '
'Please check that you have a version for sanic python-rest-framework[sanic] '
'installed and that sanic is installed.',
ImportWarning
... | code_fim | hard | {
"lang": "python",
"repo": "nxexox/python-rest-framework",
"path": "/rest_framework/views/sanic/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SpongePowered/SpongeAuth path: /spongeauth/accounts/tests/test_view_profile.py
import django.test
import django.shortcuts
from . import factories
from . import test_models
from .. import models
class TestProfile(django.test.TestCase):
def setUp(self):
self.user = factories.UserFact... | code_fim | hard | {
"lang": "python",
"repo": "SpongePowered/SpongeAuth",
"path": "/spongeauth/accounts/tests/test_view_profile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert self.user.current_avatar is None
# set to upload
resp = self.client.post(
self.path(), {"form": "avatar", "avatar_from": "upload", "avatar_image": test_models._generate_image()}
)
user = models.User.objects.get(id=self.user.id)
assert res... | code_fim | hard | {
"lang": "python",
"repo": "SpongePowered/SpongeAuth",
"path": "/spongeauth/accounts/tests/test_view_profile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_convert_compatible_units(self):
"""Test conversion to compatible units."""
result = convert_units(self.arr, 'degC')
expected_data = np.array([[-273.15, -272.15], [-271.15, -270.15]])
expected_units = cf_units.Unit('degC')
self.assertEquals(result.units,... | code_fim | hard | {
"lang": "python",
"repo": "aperezpredictia/ESMValCore",
"path": "/tests/unit/preprocessor/_units/test_convert_units.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aperezpredictia/ESMValCore path: /tests/unit/preprocessor/_units/test_convert_units.py
"""Unit test for the :func:`esmvalcore.preprocessor._units` function"""
import unittest
import cf_units
import iris
import numpy as np
import tests
from esmvalcore.preprocessor._units import convert_units
... | code_fim | hard | {
"lang": "python",
"repo": "aperezpredictia/ESMValCore",
"path": "/tests/unit/preprocessor/_units/test_convert_units.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_convert_incompatible_units(self):
"""Test conversion to incompatible units."""
self.assertRaises(ValueError, convert_units, self.arr, 'm')
def test_convert_compatible_units(self):
"""Test conversion to compatible units."""
result = convert_units(self.arr, ... | code_fim | hard | {
"lang": "python",
"repo": "aperezpredictia/ESMValCore",
"path": "/tests/unit/preprocessor/_units/test_convert_units.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> train_data = FeaDataIter("new_train.txt",batch_size,devs,config.NUM_LABEL,(config.MAX_SHAPE,config.FEA_LEN_INPUT_1),(config.MAX_SHAPE,config.FEA_LEN_INPUT_2))
val_data = FeaDataIter("new_val.txt",batch_size,devs,config.NUM_LABEL,(config.MAX_SHAPE,config.FEA_LEN_INPUT_1),(config.MAX_SHAPE,config.FEA_LEN... | code_fim | hard | {
"lang": "python",
"repo": "trantorrepository/NetVlad-MxNet",
"path": "/train_fea_fusion_netvlad.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trantorrepository/NetVlad-MxNet path: /train_fea_fusion_netvlad.py
ked vertically
:param pad: label to pad with
:return: tensor with max shape
"""
ndim = len(tensor_list[0].shape)
dtype = tensor_list[0].dtype
islice = tensor_list[0].shape[0]
dimensions = []
first_d... | code_fim | hard | {
"lang": "python",
"repo": "trantorrepository/NetVlad-MxNet",
"path": "/train_fea_fusion_netvlad.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trantorrepository/NetVlad-MxNet path: /train_fea_fusion_netvlad.py
g.NUM_VLAD_CENTERS = 128
config.NUM_LABEL =500
config.LEARNING_RATE = 0.2
config.FEA_LEN = 1024
config.FEA_LEN_INPUT_1 = 2048
config.FEA_LEN_INPUT_2 = 2048
config.MAX_SHAPE = 200
config.BATCH_SIZE = 32
def _save_model(model_prefi... | code_fim | hard | {
"lang": "python",
"repo": "trantorrepository/NetVlad-MxNet",
"path": "/train_fea_fusion_netvlad.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: araffin/robotics-rl-srl path: /state_representation/episode_saver.py
import os
import json
import time
import cv2
import numpy as np
from srl_zoo.utils import printYellow
from rl_baselines.utils import filterJSONSerializableObjects
from state_representation.client import SRLClient
class Episo... | code_fim | hard | {
"lang": "python",
"repo": "araffin/robotics-rl-srl",
"path": "/state_representation/episode_saver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.episode_step += 1
self.n_steps += 1
self.rewards.append(reward)
self.actions.append(action)
if reward > 0:
self.episode_success = True
if not done:
self.episode_starts.append(False)
self.ground_truth_states.append(gr... | code_fim | hard | {
"lang": "python",
"repo": "araffin/robotics-rl-srl",
"path": "/state_representation/episode_saver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chdzq/ARPAbetAndIPAConvertor path: /arpabetandipaconvertor/model/word.py
# -*- coding: utf-8 -*-
from arpabetandipaconvertor.model.stress import Stress
class Word:
def __init__(self):
self._syllable_list = []
self._stress_count = 0
def add_syllable(self, syllable):
<|fi... | code_fim | hard | {
"lang": "python",
"repo": "chdzq/ARPAbetAndIPAConvertor",
"path": "/arpabetandipaconvertor/model/word.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def translate_to_international_phonetic_alphabet(self, need_show_stress=False):
translations = ""
for i, syllable in enumerate(self._syllable_list):
translations += syllable.translate_to_english_phonetic_alphabet(hide_stress_mark=0 == i and 1 >= self._stress_count)
... | code_fim | hard | {
"lang": "python",
"repo": "chdzq/ARPAbetAndIPAConvertor",
"path": "/arpabetandipaconvertor/model/word.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> allidx = np.arange(0, len(xvar)*len(yvar)) # flattened array of all indices in mesh
noidx = np.setxor1d(allidx, avoididx) #allidx - avoididx
#noidx = np.array(list(set(allidx) - set(avoididx)))
nosampleidx = np.random.choice(noidx, size=N,replace=False)
newavoididx = np.sort(np.hstack... | code_fim | hard | {
"lang": "python",
"repo": "kbiegel-usgs/groundfailure",
"path": "/groundfailure/sample.py",
"mode": "spm",
"license": "LicenseRef-scancode-public-domain-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kbiegel-usgs/groundfailure path: /groundfailure/sample.py
"
points = [(np.cos(2*np.pi/n*x)*r, np.sin(2*np.pi/n*x)*r) for x in range(0, n+1)]
x, y = list(zip(*points))
x = np.array(x)
y = np.array(y)
x += h
y += k
return (x, y)
def createCirclePolygon(h, k, r, dx):
... | code_fim | hard | {
"lang": "python",
"repo": "kbiegel-usgs/groundfailure",
"path": "/groundfailure/sample.py",
"mode": "psm",
"license": "LicenseRef-scancode-public-domain-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Sample MultiGrid object (like a ShakeGrid) at each of a set of XY (decimal degrees) points.
:param multigrid:
MultiGrid object at which to sample data.
:param xypoints:
2D numpy array of XY points, decimal degrees.
:returns:
1D numpy array of grid values at each of in... | code_fim | hard | {
"lang": "python",
"repo": "kbiegel-usgs/groundfailure",
"path": "/groundfailure/sample.py",
"mode": "spm",
"license": "LicenseRef-scancode-public-domain-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Soldelli/gait_anomaly_detection path: /pre-processing/config.py
VISUALIZE = False # Enable several visualizatios
force = False # Force flow extractions (repeat over all directories)
video_trick = True # Set to true if you want to remove the... | code_fim | medium | {
"lang": "python",
"repo": "Soldelli/gait_anomaly_detection",
"path": "/pre-processing/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>o true if you want to plot the gait macro parameters
preproc_data_inspection = False # Set to true to produce pdf for visualization of preprocessed data.<|fim_prefix|># repo: Soldelli/gait_anomaly_detection path: /pre-processing/config.py
VISUALIZE = False # Enable several visualiza... | code_fim | hard | {
"lang": "python",
"repo": "Soldelli/gait_anomaly_detection",
"path": "/pre-processing/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> perform data normalization
filter_vis = False # Set to true if you want to plot the filter PSD
gait_macro_parmeters = False # Set to true if you want to plot the gait macro parameters
preproc_data_inspection = False # Set to true to produce pdf for visualization of preprocesse... | code_fim | medium | {
"lang": "python",
"repo": "Soldelli/gait_anomaly_detection",
"path": "/pre-processing/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suny-downstate-medical-center/netpyne path: /netpyne/network/conn.py
---
# Disynaptic bias for probability (version 2)
# bis = min fraction of conns that will be disynaptic
# -----------------------------------------------------------------------------
def _disynapticBiasProb2(self, probMatrix, a... | code_fim | hard | {
"lang": "python",
"repo": "suny-downstate-medical-center/netpyne",
"path": "/netpyne/network/conn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> probability = float(origProbability)
factor = bias / origProbability
# bias = min(bias, origProbability) # don't modify more than orig, so can compensate
if not set(prePreGids).isdisjoint(postPreGids) and disynCounter < maxImbalance:
probability = min(origProbability + bias, 1.0)
... | code_fim | hard | {
"lang": "python",
"repo": "suny-downstate-medical-center/netpyne",
"path": "/netpyne/network/conn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suny-downstate-medical-center/netpyne path: /netpyne/network/conn.py
orm'] - postConds['ynorm'])
dictVars['dist_znorm'] = lambda preConds, postConds: abs(preConds['znorm'] - postConds['znorm'])
dictVars['dist_norm3D'] = lambda preConds, postConds: np.sqrt(
(preConds['xnorm'] - pos... | code_fim | hard | {
"lang": "python",
"repo": "suny-downstate-medical-center/netpyne",
"path": "/netpyne/network/conn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def decrypt_string(data, key):
crypt = b64decode(data)
plain = "".join(chr(ord(c)^ord(k)) for c,k in izip(crypt, cycle(key)))
return b64decode(plain)
arch = 64 if idaapi.get_inf_structure().is_64bit() else 32
ea = ida_name.get_name_ea(idaapi.BADADDR, "main.decodeString")
key_addr = ida_name.g... | code_fim | hard | {
"lang": "python",
"repo": "Lifars/IDA-scripts",
"path": "/snatch_decrypt_strings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lifars/IDA-scripts path: /snatch_decrypt_strings.py
# Author: Ladislav Baco, LIFARS
# Date: July 22, 2020
#
# (c) 2020 LIFARS
# This code is licensed under MIT license (see LICENSE for details)
import idaapi
import idautils
import ida_name
import ida_bytes
from base64 import b64decode
from ite... | code_fim | hard | {
"lang": "python",
"repo": "Lifars/IDA-scripts",
"path": "/snatch_decrypt_strings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>d = sqrt( pow(x2 - x1, 2) + pow( y2 - y1, 2) )
print "%.4f" %(d)<|fim_prefix|># repo: AllefLobo/Online-Judge-System-Answers path: /uri/iniciante/1015.py
from math import sqrt, pow
<|fim_middle|>x1, y1 = map( float, raw_input().split())
x2, y2 = map( float, raw_input().split())
| code_fim | medium | {
"lang": "python",
"repo": "AllefLobo/Online-Judge-System-Answers",
"path": "/uri/iniciante/1015.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AllefLobo/Online-Judge-System-Answers path: /uri/iniciante/1015.py
from math import sqrt, pow
<|fim_suffix|>d = sqrt( pow(x2 - x1, 2) + pow( y2 - y1, 2) )
print "%.4f" %(d)<|fim_middle|>x1, y1 = map( float, raw_input().split())
x2, y2 = map( float, raw_input().split())
| code_fim | medium | {
"lang": "python",
"repo": "AllefLobo/Online-Judge-System-Answers",
"path": "/uri/iniciante/1015.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sanyalav/Hill1983 path: /lesson6_Alex.py
# 1)
print("1)")
my_list = ["qwerty", "internet", "asdfgh", "superpuper", "twenty", "blablabla", "123456" ]
print(my_list)
new_list = []
for index, value in enumerate(my_list):
if not index % 2:
new_list.append(value)
else:
new_list... | code_fim | hard | {
"lang": "python",
"repo": "sanyalav/Hill1983",
"path": "/lesson6_Alex.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>1 = "qwertyblablainternet12345555"
my_str2 = "suvxz098763jjopqtrsmnvcxzopy"
my_set1 = set(my_str1)
my_set2 = set(my_str2)
print(my_set1)
print(my_set2)
intersect = my_set1.intersection(my_set2)
my_list = list(intersect)
print(my_list)
#######################################################################... | code_fim | hard | {
"lang": "python",
"repo": "sanyalav/Hill1983",
"path": "/lesson6_Alex.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jammy2211/PyAutoArray path: /autoarray/plot/wrap/two_d/parallel_overscan_plot.py
from autoarray.plot.wrap.two_d.grid_plot import GridPlot
<|fim_suffix|> """
Plots the lines of a parallel overscan `Region2D` object.
See `wrap.base.Scatter` for a description of how matplotlib is... | code_fim | easy | {
"lang": "python",
"repo": "Jammy2211/PyAutoArray",
"path": "/autoarray/plot/wrap/two_d/parallel_overscan_plot.py",
"mode": "psm",
"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.