text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> links = get_links()
download_url(links)
if __name__ == '__main__':
main()<|fim_prefix|># repo: cobanov/demc-homework path: /dataset_download.py
from bs4 import BeautifulSoup
from urllib.request import urlopen
import requests
from requests.api import get
def get_links():
html = request... | code_fim | hard | {
"lang": "python",
"repo": "cobanov/demc-homework",
"path": "/dataset_download.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
elif ch == 5:
info.information()
elif ch == 6:
hacking_menu()
if ch6 == 1:
wp.wordpress()
elif ch6 == 2:
q = str('filetype:ini “wordfence”')
print('\nSearching... \n')
search_url.url_search(q)
elif ch6 == ... | code_fim | hard | {
"lang": "python",
"repo": "gsatyadev/Dorkify",
"path": "/dorkify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gsatyadev/Dorkify path: /dorkify.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import argparse
import core.search_url as search_url
import core.logo as logo
import core.colors as colors
import core.mods as mods
import Modules.wordpress as wp
import Modules.information as info
import M... | code_fim | hard | {
"lang": "python",
"repo": "gsatyadev/Dorkify",
"path": "/dorkify.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if args['cam']:
logo.dorkify_logo()
print(notice)
yn = input()
if yn == 'y' or yn =='Y':
cam.cameras()
else :
print('YOU MUST AGREE TO THE TERMS')
sys.exit()
# FTP Server
if args['ftp']:
logo.dorkify_logo()
print(notice)
yn = input()
if yn == '... | code_fim | hard | {
"lang": "python",
"repo": "gsatyadev/Dorkify",
"path": "/dorkify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>import versioneer
setup(
name="microsetta-public-api",
packages=find_packages(),
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
url="https://github.com/biocore/microsetta-public-api",
description="A RESTful API to support The Microsetta Initiative",
lice... | code_fim | medium | {
"lang": "python",
"repo": "biocore/microsetta-public-api",
"path": "/setup.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: biocore/microsetta-public-api path: /setup.py
# ----------------------------------------------------------------------------
# Copyright (c) 2019-, The Microsetta Initiative development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE,... | code_fim | medium | {
"lang": "python",
"repo": "biocore/microsetta-public-api",
"path": "/setup.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>setup(
name="microsetta-public-api",
packages=find_packages(),
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
url="https://github.com/biocore/microsetta-public-api",
description="A RESTful API to support The Microsetta Initiative",
license='BSD-3-Clause',... | code_fim | medium | {
"lang": "python",
"repo": "biocore/microsetta-public-api",
"path": "/setup.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>validation = ImageFolder('lines/validation', transform=None)
validation.target_transform = tgc.classMap.get_target_transform(validation.class_to_idx)
good = 0
bad = 0
with torch.no_grad():
tgc.network.eval()
for idx in tqdm(range(validation.__len__()), desc='Evaluation'):
sample, target =... | code_fim | hard | {
"lang": "python",
"repo": "seuretm/printed-vs-handwritten",
"path": "/evaluate-model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seuretm/printed-vs-handwritten path: /evaluate-model.py
import os
import sys
import torch
import pickle
from torch import nn
from torch import optim
from torchvision.datasets import ImageFolder
from torchvision import transforms
from torch.optim.lr_scheduler import LambdaLR
from tqdm import tqdm
... | code_fim | hard | {
"lang": "python",
"repo": "seuretm/printed-vs-handwritten",
"path": "/evaluate-model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CodeHemP/CAREER-TRACK-Data-Scientist-with-Python path: /12_Intermediate Data Visualization with Seaborn/02_Customizing Seaborn Plots/04_Matplotlib color codes.py
'''
04 - Matplotlib color codes
Seaborn offers several options for modifying the colors of your visualizations.
The simplest approach ... | code_fim | medium | {
"lang": "python",
"repo": "CodeHemP/CAREER-TRACK-Data-Scientist-with-Python",
"path": "/12_Intermediate Data Visualization with Seaborn/02_Customizing Seaborn Plots/04_Matplotlib color codes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>- Set the default Seaborn style and enable the matplotlib color codes.
- Create a distplot for the fmr_3 column using matplotlib's magenta (m) color code.
'''
# Set style, enable color code, and create a magenta distplot
sns.set(color_codes=True)
sns.distplot(df['fmr_3'], color='m')
# Show the plot
plt.s... | code_fim | medium | {
"lang": "python",
"repo": "CodeHemP/CAREER-TRACK-Data-Scientist-with-Python",
"path": "/12_Intermediate Data Visualization with Seaborn/02_Customizing Seaborn Plots/04_Matplotlib color codes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return tf.contrib.training.HParams(
num_embedding_size = 16, # 每个词语的向量的长度
# 指定 lstm 的 步长, 一个sentence中会有多少个词语
# 因为执行的过程中是用的minibatch,每个batch之间还是需要对齐的
# 在测试时,可以是一个变长的
num_timesteps = 50, # 在一个sentence中 有 50 个词语
num_lstm_nodes = [32, 32], # 每一层的size是多少
... | code_fim | hard | {
"lang": "python",
"repo": "tianyunzqs/text_classifier_tasks",
"path": "/task_LSTM_inbuild/step3_evaluate_line.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tianyunzqs/text_classifier_tasks path: /task_LSTM_inbuild/step3_evaluate_line.py
# -*- coding: utf-8 -*-
# @Time : 2019/7/26 10:18
# @Author : tianyunzqs
# @Description :
import os
import sys
import numpy as np
import tensorflow as tf
sys.path.append(os.path.dirname(os.path.dirnam... | code_fim | hard | {
"lang": "python",
"repo": "tianyunzqs/text_classifier_tasks",
"path": "/task_LSTM_inbuild/step3_evaluate_line.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: biotite-dev/biotite path: /src/biotite/structure/hbond.py
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
"""
This module provides functions for hydrogen bonding calculation.
"""
__name__ ... | code_fim | hard | {
"lang": "python",
"repo": "biotite-dev/biotite",
"path": "/src/biotite/structure/hbond.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Put selections to list for cleaner iteration
selections = [
exclusive_selection1, exclusive_selection2, overlap_selection
]
selection_combinations = [
#(0,0), is not included, would be same selection
# as donor and acceptor si... | code_fim | hard | {
"lang": "python",
"repo": "biotite-dev/biotite",
"path": "/src/biotite/structure/hbond.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yelp/Tron path: /tron/core/job_collection.py
import logging
from tron.core.job import Job
from tron.utils import collections
from tron.utils import proxy
log = logging.getLogger(__name__)
class JobCollection:
"""A collection of jobs."""
def __init__(self):
self.jobs = collect... | code_fim | hard | {
"lang": "python",
"repo": "Yelp/Tron",
"path": "/tron/core/job_collection.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for name, state in job_state_data.items():
self.jobs[name].restore_state(state, config_action_runner)
log.info(f"Loaded state for {len(job_state_data)} jobs")
def get_by_name(self, name):
return self.jobs.get(name)
def get_names(self):
return self.jobs... | code_fim | hard | {
"lang": "python",
"repo": "Yelp/Tron",
"path": "/tron/core/job_collection.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arkits/dss path: /monitoring/tracer/polling.py
import datetime
from typing import Any, Callable, Dict, Optional
import s2sphere
from termcolor import colored
import yaml
from monitoring.monitorlib import fetch
import monitoring.monitorlib.fetch.rid
import monitoring.monitorlib.fetch.scd
from mo... | code_fim | hard | {
"lang": "python",
"repo": "arkits/dss",
"path": "/monitoring/tracer/polling.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def poll_scd_constraints(resources: ResourceSet) -> Any:
if 'constraints' not in resources.scd_cache:
resources.scd_cache['constraints']: Dict[str, fetch.scd.FetchedEntity] = {}
return fetch.scd.constraints(
resources.dss_client, resources.area, resources.start_time,
resources.end_time, c... | code_fim | hard | {
"lang": "python",
"repo": "arkits/dss",
"path": "/monitoring/tracer/polling.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asokoloski/oil path: /mycpp/demo/mypy_subtype.py
#!/usr/bin/env python2
"""
Example of MyPy's ability to downcast a var under the same name in a functino.
Our ASDL code gen will rely on this.
"""
from __future__ import print_function
import sys
<|fim_suffix|> b = 1
def __init__(self):
#... | code_fim | medium | {
"lang": "python",
"repo": "asokoloski/oil",
"path": "/mycpp/demo/mypy_subtype.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def f(obj, i):
# type: (Foo, int) -> None
if i > 5:
obj = cast(Bar, obj)
print(obj.b)
else:
obj = cast(Baz, obj)
print(obj.a)
def main():
# type: () -> None
f(Bar(), 5)
print('Hello from m.py')
if __name__ == '__main__':
try:
main()
except RuntimeError as e:
pri... | code_fim | hard | {
"lang": "python",
"repo": "asokoloski/oil",
"path": "/mycpp/demo/mypy_subtype.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tgrx/benzak path: /src/apps/actual/views.py
from django.views.generic import ListView
from apps.dynamics.models import Currency
from apps.dynamics.models import Fuel
from apps.dynamics.models import PriceHistory
class ActualView(ListView):
<|fim_suffix|> fuels = Fuel.objects.all()
... | code_fim | hard | {
"lang": "python",
"repo": "tgrx/benzak",
"path": "/src/apps/actual/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> template_name = "actual/index.html"
def get_queryset(self):
fuels = Fuel.objects.all()
currency = Currency.objects.all()
prices = list(
filter(
lambda _v: _v[-1],
(
(
f,
... | code_fim | hard | {
"lang": "python",
"repo": "tgrx/benzak",
"path": "/src/apps/actual/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_queryset(self):
fuels = Fuel.objects.all()
currency = Currency.objects.all()
prices = list(
filter(
lambda _v: _v[-1],
(
(
f,
tuple(
... | code_fim | hard | {
"lang": "python",
"repo": "tgrx/benzak",
"path": "/src/apps/actual/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testModelInit(self):
model = SqueezeNet()
self.assertIsNotNone(model)
def testTFwPrediction(self):
keras.backend.set_image_dim_ordering('tf')
model = SqueezeNet()
img = image.load_img('images/cat.jpeg', target_size=(227, 227))
x = image.img_to_ar... | code_fim | medium | {
"lang": "python",
"repo": "CaperAi/keras-squeezenet",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> keras.backend.set_image_dim_ordering('tf')
model = SqueezeNet()
img = image.load_img('images/cat.jpeg', target_size=(227, 227))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
preds = model.predict(x)
decoded... | code_fim | medium | {
"lang": "python",
"repo": "CaperAi/keras-squeezenet",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CaperAi/keras-squeezenet path: /test.py
import numpy as np
from keras_squeezenet import SqueezeNet
from keras.applications.imagenet_utils import preprocess_input, decode_predictions
from keras.preprocessing import image
import keras
import unittest
<|fim_suffix|> keras.backend.set_image_d... | code_fim | medium | {
"lang": "python",
"repo": "CaperAi/keras-squeezenet",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in combinations_with_replacement(range(1, 7), 3):
terms = explain(i)
print(i, terms)
test_explain()
event = {"big": 100, "11": 20, "12": 20}
res = main(event, None)
pprint(res)<|fim_prefix|># repo: MacHu-GWU/learn_awslambda-project path: /ex... | code_fim | hard | {
"lang": "python",
"repo": "MacHu-GWU/learn_awslambda-project",
"path": "/example-projects/dice-gamble-project/awslambda.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MacHu-GWU/learn_awslambda-project path: /example-projects/dice-gamble-project/awslambda.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import json
import random
def explain(bowl):
"""赌骰子秘籍: http://blog.sina.com.cn/s/blog_4c8894390101384t.html
bao... | code_fim | hard | {
"lang": "python",
"repo": "MacHu-GWU/learn_awslambda-project",
"path": "/example-projects/dice-gamble-project/awslambda.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(1, 1+6):
if i in bowl:
terms.append("%s-" % i)
return terms
def main(event, context):
"""玩一个色子的游戏, 输入Event是用户在各个项目上的押注额, 返回丢色子的结果以及你的奖金。
"""
odds = {
"baozi": 24,
"4": 50, "17": 50,
"5": 18, "16": 18,
... | code_fim | hard | {
"lang": "python",
"repo": "MacHu-GWU/learn_awslambda-project",
"path": "/example-projects/dice-gamble-project/awslambda.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olivierdalang/django-toosimple-q path: /django_toosimple_q/tests/tests_concurrency.py
import os
import time
import unittest
from django.contrib.auth.models import User
from django_toosimple_q.models import TaskExec, WorkerStatus
from .base import TooSimpleQBackgroundTestCase
from .concurrency.... | code_fim | hard | {
"lang": "python",
"repo": "olivierdalang/django-toosimple-q",
"path": "/django_toosimple_q/tests/tests_concurrency.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Start the task in a background process
self.start_worker_in_background(queue="tasks")
# Check that it is now processing
time.sleep(5)
t.refresh_from_db()
self.assertEqual(t.state, TaskExec.States.PROCESSING)
# Wait for the background process to f... | code_fim | hard | {
"lang": "python",
"repo": "olivierdalang/django-toosimple-q",
"path": "/django_toosimple_q/tests/tests_concurrency.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KhanovaSkola/KSTools path: /api/amara_api.py
#!/usr/bin/env python3
import json, sys, os
import requests
from pprint import pprint
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
class Amara:
AMARA_BASE_URL = 'https://amara.org'
EXIT_ON_HTTPERROR = True
... | code_fim | hard | {
"lang": "python",
"repo": "KhanovaSkola/KSTools",
"path": "/api/amara_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for obj in json_response['objects']:
if obj['language_code'] == lang:
is_lang_present = True
sub_version = len(obj['versions'])
break
# Paginated output if there are many languages
next = json_response['meta']['next']
... | code_fim | hard | {
"lang": "python",
"repo": "KhanovaSkola/KSTools",
"path": "/api/amara_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> url = "%s/api/videos/%s/languages/%s/subtitles/actions/" \
% (self.AMARA_BASE_URL, amara_id, lang)
body = {'actions': action}
response = self._get(url, body)
return response
def list_subtitle_requests(self, amara_id, lang, team):
url = "%s/api/t... | code_fim | hard | {
"lang": "python",
"repo": "KhanovaSkola/KSTools",
"path": "/api/amara_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app.config['UPLOAD_FOLDER'] = UPLOADS_PATH
# recaptcha junk here
app.config['RECAPTCHA_USE_SSL'] = False
app.config['RECAPTCHA_PUBLIC_KEY']= '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
app.config['RECAPTCHA_OPTIONS'] = {'theme':'white'}
# create DB object
db = DB()
# import routes
from src.app_pkg.route... | code_fim | medium | {
"lang": "python",
"repo": "aa2858/csc-648",
"path": "/application/src/app_pkg/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aa2858/csc-648 path: /application/src/app_pkg/__init__.py
########################################
# Flask Applciation
######################################
from flask import Flask
from src.database_manager.db_manager import DB
from os.path import join, dirname, realpath
UPLOADS_PATH = join(... | code_fim | hard | {
"lang": "python",
"repo": "aa2858/csc-648",
"path": "/application/src/app_pkg/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>forum_post_thread', name='forum-post-topic'),
#url(r'^reply/new/(?P<topic_id>\d+)/$', 'forum_post_thread', name='forum-post-replay'),
#url(r'^thread/(?P<post_id>\d+)/edit/$', edit_post, name='forum-post-edit'),
#url(r'^user/(?P<user_id>\d+)/topics/$', user_topics, name='forum-user-topics'),... | code_fim | hard | {
"lang": "python",
"repo": "indexofire/gork",
"path": "/src/gork/application/forum/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: indexofire/gork path: /src/gork/application/forum/urls.py
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from pows.apps.forum.views import *
urlpatterns = patterns('',
# landing page of a forum
url(r'^$',
ForumIndexView.as_view(),
name='forum-in... | code_fim | hard | {
"lang": "python",
"repo": "indexofire/gork",
"path": "/src/gork/application/forum/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michael760odhiambo/woodwatch path: /hood/views.py
from django.shortcuts import render,redirect
from .models import Neighbourhood,Services,Authorities,Post,Profile,Notifications,Comment,Business,Hoods,Joinhood
from django.http import HttpResponse,Http404,HttpResponseRedirect
from django.contrib.au... | code_fim | hard | {
"lang": "python",
"repo": "michael760odhiambo/woodwatch",
"path": "/hood/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'form':form,
}
return render(request, 'all-pages/hood.html',{'form':form}, context)
def joinone(request):
context = {
'hoods':Hoods.objects.all(),
}
return render(request, 'all-pages/nhood.html', context)
def joinhood(request):
current_user = request.user
... | code_fim | hard | {
"lang": "python",
"repo": "michael760odhiambo/woodwatch",
"path": "/hood/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PythonSanSebastian/docstamp path: /docstamp/svg_utils.py
"""
Function helpers to do stuff on svg files.
"""
import os
import logging
from docstamp.commands import call_command, which, check_command
import svgutils.transform as sg
log = logging.getLogger(__name__)
def replace_chars_for_svg_cod... | code_fim | hard | {
"lang": "python",
"repo": "PythonSanSebastian/docstamp",
"path": "/docstamp/svg_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Calls the `rsvg-convert` command, to convert a svg to a PDF (with unicode).
Parameters
----------
rsvg_binpath: str
Path to `rsvg-convert` command
input_file: str
Path to the input file
output_file: str
Path to the output file
Returns
------... | code_fim | hard | {
"lang": "python",
"repo": "PythonSanSebastian/docstamp",
"path": "/docstamp/svg_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Jira ID: DAOS-7337.
Test Description: Test server restart works during aggregation and IOR data is intact
after restart.
Use Case: Create the pool, disabled rebuild, run IOR with supported EC object type class
for small and large ... | code_fim | hard | {
"lang": "python",
"repo": "minmingzhu/daos",
"path": "/src/tests/ftest/erasurecode/restart.py",
"mode": "spm",
"license": "BSD-2-Clause-Patent",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: minmingzhu/daos path: /src/tests/ftest/erasurecode/restart.py
#!/usr/bin/python
"""
(C) Copyright 2020-2022 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import time
from ec_utils import ErasureCodeIor, check_aggregation_status
class EcodServerRestart(ErasureCodeIor):
... | code_fim | hard | {
"lang": "python",
"repo": "minmingzhu/daos",
"path": "/src/tests/ftest/erasurecode/restart.py",
"mode": "psm",
"license": "BSD-2-Clause-Patent",
"source": "the-stack-v2"
} |
<|fim_suffix|> if agg_check == "After":
size_after_restart = self.pool.pool_percentage_used()
self.log.info("Size after Restarti: %s ", self.pool.pool_percentage_used())
# Verify if Aggregation is getting started
if not size_after_restart['scm'] > size_before_resta... | code_fim | hard | {
"lang": "python",
"repo": "minmingzhu/daos",
"path": "/src/tests/ftest/erasurecode/restart.py",
"mode": "spm",
"license": "BSD-2-Clause-Patent",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@registry.register_hparams(binarynet)
class latentweights(HParams):
input_quantizer = "ste_sign"
kernel_quantizer = None
kernel_constraint = None
# Training properties
epochs = 100
batch_size = 64
optimizer = "Adam"
opt_param = dict(
lr = 1e-3,
beta_1... | code_fim | hard | {
"lang": "python",
"repo": "nancy-nayak/rethinking-bnn",
"path": "/src/models/binary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> input_quantizer = "ste_sign"
kernel_quantizer = None
kernel_constraint = None
# Training properties
epochs = 100
batch_size = 64
optimizer = "Adam"
opt_param = dict(
lr = 1e-3,
beta_1 = 0.99,
beta_2 = 0.999
)
@registry.register_hparams(bi... | code_fim | hard | {
"lang": "python",
"repo": "nancy-nayak/rethinking-bnn",
"path": "/src/models/binary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nancy-nayak/rethinking-bnn path: /src/models/binary.py
# Archictectures for Binary Neural Networks
import tensorflow as tf
import larq as lq
from zookeeper import registry, HParams
# Generic Binary ConvNet
@registry.register_model
def bcnn(hparams, input_shape, num_classes):
kwargs = dict(... | code_fim | hard | {
"lang": "python",
"repo": "nancy-nayak/rethinking-bnn",
"path": "/src/models/binary.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stephrdev/django-tapeforms path: /tests/contrib/conftest.py
from . import FormFieldsSnapshotTestMixin
def pytest_generate_tests(metafunc):
# Set the field_name parametrization for the form class defined in
# FormFieldsSnapshotTestMixin derived class
if metafunc.cls and issubclass(me... | code_fim | medium | {
"lang": "python",
"repo": "stephrdev/django-tapeforms",
"path": "/tests/contrib/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>' in metafunc.fixturenames:
try:
fields = metafunc.cls.form_class.declared_fields.keys()
except AttributeError:
raise ValueError("%r must define a valid form_class property" % (metafunc.cls))
metafunc.parametrize('field_name', fields)<|fi... | code_fim | medium | {
"lang": "python",
"repo": "stephrdev/django-tapeforms",
"path": "/tests/contrib/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yong0011/Research path: /Python/PythonFundamentals/5-python-fundamentals-m04-objects-exercise-files/demos/banner.py
def banner(message, border='-'):
<|fim_suffix|>banner("Norwegian Blue")
banner("Sun, Moon and Stars", "*")
banner("Sun, Moon and Stars", border="*")
banner(border=".", message="Hell... | code_fim | medium | {
"lang": "python",
"repo": "yong0011/Research",
"path": "/Python/PythonFundamentals/5-python-fundamentals-m04-objects-exercise-files/demos/banner.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>banner("Norwegian Blue")
banner("Sun, Moon and Stars", "*")
banner("Sun, Moon and Stars", border="*")
banner(border=".", message="Hello from Earth")<|fim_prefix|># repo: yong0011/Research path: /Python/PythonFundamentals/5-python-fundamentals-m04-objects-exercise-files/demos/banner.py
def banner(message,... | code_fim | medium | {
"lang": "python",
"repo": "yong0011/Research",
"path": "/Python/PythonFundamentals/5-python-fundamentals-m04-objects-exercise-files/demos/banner.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaol/gearhead-caramel path: /gears/oldghloader.py
break
# Read the second descriptive label
myfile.readline()
# Read the visibility
tile = 0
while tile < x_max * y_max:
count = myfile.readline()
if len(count)<1:
... | code_fim | hard | {
"lang": "python",
"repo": "kaol/gearhead-caramel",
"path": "/gears/oldghloader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaol/gearhead-caramel path: /gears/oldghloader.py
else:
tile += int(count)
# **************************************
# *** GEARHEAD ARENA CONSTANTS ***
# **************************************
GG_CHARACTER = 2
NAG_LOCATION = -1
NAS_TEAM ... | code_fim | hard | {
"lang": "python",
"repo": "kaol/gearhead-caramel",
"path": "/gears/oldghloader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def convert_character( self, pc ):
# Convert a character from GH1 rules to GearHead Caramel rules.
statline = dict()
t = 1
for stat in stats.PRIMARY_STATS:
statline[stat] = pc.stats.get(t,10)
t += 1
# Convert the skills. MechaGunnery is ... | code_fim | hard | {
"lang": "python",
"repo": "kaol/gearhead-caramel",
"path": "/gears/oldghloader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhagyas/Pyto path: /downloadable-site-packages/skimage/util/compare.py
import numpy as np
from ..util import img_as_float
from itertools import product
def compare_images(image1, image2, method='diff', *, n_tiles=(8, 8)):
"""
Return an image showing the differences between two images.
... | code_fim | hard | {
"lang": "python",
"repo": "bhagyas/Pyto",
"path": "/downloadable-site-packages/skimage/util/compare.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Notes
-----
``'diff'`` computes the absolute difference between the two images.
``'blend'`` computes the mean value.
``'checkerboard'`` makes tiles of dimension `n_tiles` that display
alternatively the first and the second image.
"""
if image1.shape != image2.shape:
... | code_fim | hard | {
"lang": "python",
"repo": "bhagyas/Pyto",
"path": "/downloadable-site-packages/skimage/util/compare.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mantoshkumar1/sitemap path: /webcrawler/urlparse.py
import logging
import dflt_cfg
from webcrawler.app_constant import OUTPUT_PATH, DOMAIN
class UrlNode:
"""
This class represents an URL and its children
"""
def __init__ ( self, url ):
"""
:param url: str
... | code_fim | hard | {
"lang": "python",
"repo": "mantoshkumar1/sitemap",
"path": "/webcrawler/urlparse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # file pointer to the output file
self.output_fd = None
def write_sitemap ( self ):
"""
This function opens the output file and writes the sitemap into that and finally closes it safely.
:return:
"""
try:
self.output_fd = open ( file... | code_fim | hard | {
"lang": "python",
"repo": "mantoshkumar1/sitemap",
"path": "/webcrawler/urlparse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aryn-VG/ASTGN-cDB path: /bandit_sampler.py
import dgl.function as fn
import torch
class OriBandit_sampler:
def __init__(self,eta,T,k):
self.eta=eta
self.T=T
self.k=k
self.device='cuda:0' if torch.cuda.is_available() else 'cpu'
self.qij_soft=torch.nn.Sof... | code_fim | hard | {
"lang": "python",
"repo": "Aryn-VG/ASTGN-cDB",
"path": "/bandit_sampler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return{'q_s':edges.data['q_ij']}
def qij_sum_2edges(self,edges):
return {'qij_sum': edges.dst['qij_sum']}
def prob_update(self,blocks):
blocks[-1].update_all(self.weight_sum,fn.sum('w_s','weight_sum'))
blocks[-1].apply_edges(self.weight_sum_2edges)
weight... | code_fim | medium | {
"lang": "python",
"repo": "Aryn-VG/ASTGN-cDB",
"path": "/bandit_sampler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Geolocation
street = factory.Faker('street_name')
street_number = factory.Faker('building_number')
locality = factory.Faker('city')
position = Point(13.4, 52.5)
country = factory.SubFactory(CountryFactory)
formatted_address = factory.LazyAttribute(
lambda o... | code_fim | hard | {
"lang": "python",
"repo": "onepercentclub/bluebottle",
"path": "/bluebottle/test/factory_models/geo.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onepercentclub/bluebottle path: /bluebottle/test/factory_models/geo.py
from builtins import object
import factory
from django.contrib.gis.geos import Point
from bluebottle.geo.models import (
Country, SubRegion, Region, Location, LocationGroup, Place,
Geolocation)
class RegionFactory(... | code_fim | medium | {
"lang": "python",
"repo": "onepercentclub/bluebottle",
"path": "/bluebottle/test/factory_models/geo.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def getContentLength(self) -> int: ...
def getContentLengthLong(self) -> long: ...
def getContentType(self) -> unicode: ...
def getDate(self) -> long: ...
@staticmethod
def getDefaultAllowUserInteraction() -> bool: ...
@staticmethod
def getDefaultRequestProperty(__a0:... | code_fim | hard | {
"lang": "python",
"repo": "kohnakagawa/ghidra_scripts",
"path": "/ghidra9.2.1_pyi/ghidra/framework/protocol/ghidra/GhidraURLConnection.pyi",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kohnakagawa/ghidra_scripts path: /ghidra9.2.1_pyi/ghidra/framework/protocol/ghidra/GhidraURLConnection.pyi
from typing import List
import ghidra.framework.model
import java.io
import java.lang
import java.net
import java.security
import java.util
class GhidraURLConnection(java.net.URLConnection... | code_fim | hard | {
"lang": "python",
"repo": "kohnakagawa/ghidra_scripts",
"path": "/ghidra9.2.1_pyi/ghidra/framework/protocol/ghidra/GhidraURLConnection.pyi",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liyi-david/holboost path: /server.py
#!rlwrap python3.6
from lib.server import run_coq_server
from lib.top import Top
import sys
sys.setrecursionlimit(10000)
<|fim_suffix|>try:
t.toploop()
except (KeyboardInterrupt, EOFError):
print('toploop stopped.')
t.store()
if server is not... | code_fim | hard | {
"lang": "python",
"repo": "liyi-david/holboost",
"path": "/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
t.toploop()
except (KeyboardInterrupt, EOFError):
print('toploop stopped.')
t.store()
if server is not None:
server.shutdown()<|fim_prefix|># repo: liyi-david/holboost path: /server.py
#!rlwrap python3.6
from lib.server import run_coq_server
from lib.top import Top
<|fim_mid... | code_fim | hard | {
"lang": "python",
"repo": "liyi-david/holboost",
"path": "/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>categories = {}
found = set()
for category_filename in category_filenames:
category_file = library_docs / category_filename
category_name = category_filename.removesuffix(".rst")
print("Category:", category_name)
with category_file.open("r", encoding="UTF-8") as file:
category_line... | code_fim | hard | {
"lang": "python",
"repo": "brettcannon/stdlib-stats",
"path": "/categories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brettcannon/stdlib-stats path: /categories.py
import json
import pathlib
import sys
repo = pathlib.Path(sys.argv[1])
library_docs = repo / "Doc" / "library"
index_file = library_docs / "index.rst"
with (library_docs / "index.rst").open("r", encoding="UTF-8") as file:
index_lines = file.read... | code_fim | hard | {
"lang": "python",
"repo": "brettcannon/stdlib-stats",
"path": "/categories.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>categories["eastereggs"] = ["antigravity", "this"]
found.update(categories["eastereggs"])
if diff := module_names - private_modules - found:
print("Public modules with no category:", sorted(diff))
with open("categories.json", "w", encoding="UTF-8") as file:
json.dump(categories, file, sort_keys=... | code_fim | hard | {
"lang": "python",
"repo": "brettcannon/stdlib-stats",
"path": "/categories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: astropy/photutils path: /photutils/datasets/make.py
odels_table, make_gaussian_sources_image
Examples
--------
.. plot::
:include-source:
import matplotlib.pyplot as plt
from astropy.modeling.models import Moffat2D
from photutils.datasets import (make... | code_fim | hard | {
"lang": "python",
"repo": "astropy/photutils",
"path": "/photutils/datasets/make.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: astropy/photutils path: /photutils/datasets/make.py
`~astropy.modeling.functional_models.Gaussian2D` parameter
names or ``'flux'``. If ``'flux'`` is specified, but not
``'amplitude'`` then the 2D Gaussian amplitudes will be
calculated and placed in the output table. I... | code_fim | hard | {
"lang": "python",
"repo": "astropy/photutils",
"path": "/photutils/datasets/make.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _make_nonoverlap_coords(xrange, yrange, ncoords, min_separation, seed=0):
from scipy.spatial import KDTree
rng = np.random.default_rng(seed)
xycoords = np.zeros((0, 2))
niter = 1
while xycoords.shape[0] < ncoords:
if niter > 20:
break
x_new = rng.uni... | code_fim | hard | {
"lang": "python",
"repo": "astropy/photutils",
"path": "/photutils/datasets/make.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> pad_dims = []
for d in generator.dimensions:
if len(d.axes) == 1:
pad_dims.append("%s_set" % d.axes[0])
else:
pad_dims.append(".")
pad_dims += ["."] * self.NUM_VDS_AXES
with h5.File(vds_path, self.CREATE, libver="lat... | code_fim | hard | {
"lang": "python",
"repo": "jamesmudd/pymalcolm",
"path": "/malcolm/modules/excalibur/parts/vdswrapperpart.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with h5.File(vds_path, self.CREATE, libver="latest") as vds:
for node in self.required_nodes:
vds.require_group(node)
for node in node_tree:
vds[node] = h5.ExternalLink(raw_file_path, node)
vds["/entry/detector"].attrs["axes"] = ... | code_fim | hard | {
"lang": "python",
"repo": "jamesmudd/pymalcolm",
"path": "/malcolm/modules/excalibur/parts/vdswrapperpart.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jamesmudd/pymalcolm path: /malcolm/modules/excalibur/parts/vdswrapperpart.py
import os
from annotypes import Anno, add_call_types
import numpy as np
import h5py as h5
from vdsgen.subframevdsgenerator import SubFrameVDSGenerator
from malcolm.core import Part, APartName, PartRegistrar
from malcol... | code_fim | hard | {
"lang": "python",
"repo": "jamesmudd/pymalcolm",
"path": "/malcolm/modules/excalibur/parts/vdswrapperpart.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> paginator = OffenseRecordPaginator(petition, initial_page_size=initial_page_size)
assert paginator.initial_page_size == expected
@pytest.mark.parametrize(
"attachment_page_size,expected", [[10, 10], [0, 20], [-10, 20]]
)
def test_paginator_attachment_page_size(petition, attachment_page_size,... | code_fim | hard | {
"lang": "python",
"repo": "JuanFML/dear-petition",
"path": "/dear_petition/petition/etl/tests/test_petition_offenses.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JuanFML/dear-petition path: /dear_petition/petition/etl/tests/test_petition_offenses.py
import pytest
from dear_petition.petition.etl.load import link_offense_records_and_attachments
from dear_petition.petition.etl.paginator import OffenseRecordPaginator
from dear_petition.petition.types import ... | code_fim | hard | {
"lang": "python",
"repo": "JuanFML/dear-petition",
"path": "/dear_petition/petition/etl/tests/test_petition_offenses.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Javex/pytimerfd path: /timerfd/__init__.py
import _timerfd
import math
import struct
import os
from _timerfd import *
"""
A thin wrapper around the timerfd interface.
The following constants are defined here (they have the same meaning as
on the original ``timerfd_create(2)`` documentation).
... | code_fim | hard | {
"lang": "python",
"repo": "Javex/pytimerfd",
"path": "/timerfd/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Get the time left on a file descriptor. Returns a pair of ``(interval, value)``
similar to the values passed in to ``settime``.
"""
interval, value = _timerfd._timerfd.gettime(self)
interval = self._join_time(*interval)
value = self._join_time(*v... | code_fim | hard | {
"lang": "python",
"repo": "Javex/pytimerfd",
"path": "/timerfd/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Return the number of times the timer has expired. Usually this will be one but
if you don't check it fast enough it might grow. Returns an int with the number
of expirations.
Note that when you call it without it having expired and the descriptor is created
... | code_fim | hard | {
"lang": "python",
"repo": "Javex/pytimerfd",
"path": "/timerfd/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def download_wheel(url: str, expected_md5: str) -> bytes:
session = requests.session()
cached_session = CacheControl(session, cache=FileCache(".web_cache"))
response = cached_session.get(url)
return response.content
def populated_script_constraints(original_constraints):
"""Yields t... | code_fim | hard | {
"lang": "python",
"repo": "qmutz/get-pip",
"path": "/scripts/generate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qmutz/get-pip path: /scripts/generate.py
"""Update all the get-pip.py scripts."""
import itertools
import operator
import re
from base64 import b85encode
from functools import lru_cache
from io import BytesIO
from pathlib import Path, PosixPath
from typing import Dict, Iterable, List, Tuple
from... | code_fim | hard | {
"lang": "python",
"repo": "qmutz/get-pip",
"path": "/scripts/generate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Order the (version, template) tuples, by increasing version numbers.
return sorted(ordered_templates, key=operator.itemgetter(0))
def determine_template(version: Version):
ordered_templates = get_ordered_templates()
for template_version, template in ordered_templates:
if versio... | code_fim | hard | {
"lang": "python",
"repo": "qmutz/get-pip",
"path": "/scripts/generate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jddixon/vmmgr path: /src/vm_update
#!/usr/bin/python3
#
# ~/dev/py/vmmgr/vmUpdate
""" Update network entities. """
import sys
from argparse import ArgumentParser
from optionz import dump_options
from vmmgr import (__version__, __version_date__,
valid_region,
... | code_fim | hard | {
"lang": "python",
"repo": "jddixon/vmmgr",
"path": "/src/vm_update",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # complete setup ------------------------------------------------
app_name = 'vmUpdate %s' % __version__
if args.show_version:
print(("%s %s" % (app_name, __version_date__)))
sys.exit(0)
if args.verbose or args.just_show:
print(dump_options(args))
if args.jus... | code_fim | hard | {
"lang": "python",
"repo": "jddixon/vmmgr",
"path": "/src/vm_update",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_probabilities_sum_in_uniform_losses_scenario(self) -> None:
exact_distribution_calculator = \
BosonSamplingWithUniformLossesExactDistributionCalculator(self.experiment_configuration)
exact_distribution = exact_distribution_calculator.calculate_exact_distribution()
... | code_fim | hard | {
"lang": "python",
"repo": "sisco0/BoSS",
"path": "/src_tests/test_exact_distribution_calculator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create configuration object.
self.experiment_configuration = BosonSamplingExperimentConfiguration(
interferometer_matrix=self.permutation_matrix,
initial_state=self.initial_state,
number_of_modes=len(self.initial_state),
initial_number_of_p... | code_fim | hard | {
"lang": "python",
"repo": "sisco0/BoSS",
"path": "/src_tests/test_exact_distribution_calculator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sisco0/BoSS path: /src_tests/test_exact_distribution_calculator.py
__author__ = 'Tomasz Rybotycki'
import unittest
from numpy import array
from src.LossyBosonSamplingExactDistributionCalculators import BosonSamplingExperimentConfiguration, \
BosonSamplingWithFixedLossesExactDistributionCal... | code_fim | hard | {
"lang": "python",
"repo": "sisco0/BoSS",
"path": "/src_tests/test_exact_distribution_calculator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='image',
name='user',
),
migrations.AddField(
model_name='project',
name='image',
field=models.ImageField(default=django.utils.timezone.now, upload_to='picture/'),
... | code_fim | medium | {
"lang": "python",
"repo": "Adelice/Awwards",
"path": "/aww/migrations/0004_auto_20190401_1422.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('aww', '0003_image_location'),
]
operations = [
migrations.RemoveField(
model_name='image',
name='user',
),
migrations.AddField(
model_name='project',
name='image',
field=models.Image... | code_fim | medium | {
"lang": "python",
"repo": "Adelice/Awwards",
"path": "/aww/migrations/0004_auto_20190401_1422.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Adelice/Awwards path: /aww/migrations/0004_auto_20190401_1422.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-04-01 12:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
<|fim_suffix|> operations = [
migratio... | code_fim | medium | {
"lang": "python",
"repo": "Adelice/Awwards",
"path": "/aww/migrations/0004_auto_20190401_1422.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> min_pr = min(df_stock0, df_stock1)
max_pr = max(df_stock0, df_stock1)
if min_pr == df_stock0:
min_date = date0
max_date = date1
else:
min_date = date1
max_date = date0
else:
data_to_use = df_stock.iloc[period:]["A... | code_fim | hard | {
"lang": "python",
"repo": "sechours/GamestonkTerminal",
"path": "/gamestonk_terminal/common/technical_analysis/custom_indicators_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sechours/GamestonkTerminal path: /gamestonk_terminal/common/technical_analysis/custom_indicators_model.py
"""Custom Indicator Models"""
__docformat__ = "numpy"
from typing import Any, Tuple
import pandas as pd
def calculate_fib_levels(
df_stock: pd.DataFrame, period: int, open_date: Any, ... | code_fim | hard | {
"lang": "python",
"repo": "sechours/GamestonkTerminal",
"path": "/gamestonk_terminal/common/technical_analysis/custom_indicators_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def tr_opt(self, market_type, input1, input2, code, prev_next, screen_no):
# 시장구분 = 000:전체, 001:코스피, 101:코스닥
# 금액수량구분 = 1:금액, 2:수량
# 매매구분 = 0:순매수, 1:매수, 2:매도
# 종목코드 = 전문 조회할 종목코드
self.core.set_input_value('시장구분', market_type)
self.core.set_input_value('... | code_fim | hard | {
"lang": "python",
"repo": "atheling44/KiwoomTrader",
"path": "/tr_option/opt10066.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: atheling44/KiwoomTrader path: /tr_option/opt10066.py
from tr_option.base import KWTR
from copy import deepcopy
# [ opt10066 : 장중투자자별매매차트요청 ]
class Opt10066(KWTR):
def __init__(self, core):
super().__init__(core)
self.rq_name = self.tr_code = 'opt10066'
self.record_... | code_fim | hard | {
"lang": "python",
"repo": "atheling44/KiwoomTrader",
"path": "/tr_option/opt10066.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 시장구분 = 000:전체, 001:코스피, 101:코스닥
# 금액수량구분 = 1:금액, 2:수량
# 매매구분 = 0:순매수, 1:매수, 2:매도
# 종목코드 = 전문 조회할 종목코드
self.core.set_input_value('시장구분', market_type)
self.core.set_input_value('금액수량구분', input1)
self.core.set_input_value('매매구분', input2)
self... | code_fim | hard | {
"lang": "python",
"repo": "atheling44/KiwoomTrader",
"path": "/tr_option/opt10066.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mkasmi/quantum-neural-network path: /quantum-neural-network/ansatz/variational_ansatz_factory.py
from ansatz.abbas import Abbas
from ansatz.alternating_layer_tdcnot_ansatz import AlternatingLayerTDCnotAnsatz
from ansatz.farhi_ansatz import FarhiAnsatz
from ansatz.null_ansatz import NullAnsatz
fro... | code_fim | hard | {
"lang": "python",
"repo": "mkasmi/quantum-neural-network",
"path": "/quantum-neural-network/ansatz/variational_ansatz_factory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif self.ansatz_type == 'sim_circ_15':
return SimCirc15(self.layers, self.sweeps_per_layer, self.activation_function)
elif self.ansatz_type == 'sim_circ_19':
return SimCirc19(self.layers, self.sweeps_per_layer, self.activation_function)
elif self.ansatz_t... | code_fim | hard | {
"lang": "python",
"repo": "mkasmi/quantum-neural-network",
"path": "/quantum-neural-network/ansatz/variational_ansatz_factory.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.