text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: archerckk/PyTest path: /guest/sign/urls.py
from django.conf.urls import url
from sign import views_if
from sign import views_if_sec
urlpatterns=[
# sign system interface:
# ex: /api/add_event/
url(r'^add_event',views_if.add_event,name='<|fim_suffix|> # ex: /api/get_guest_list/
... | code_fim | hard | {
"lang": "python",
"repo": "archerckk/PyTest",
"path": "/guest/sign/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ex: /api/get_guest_list/
url(r'^get_guest_list',views_if.get_guest_list,name='get_guest_list'),
# ex:/api/user_sign/
url(r'^user_sign',views_if.user_sign,name='user_sign'),
# ex : /api/sec_get_event_list/
url(r'^sec_get_event_list/', views_if_sec.get_event_list, name='get_event_li... | code_fim | hard | {
"lang": "python",
"repo": "archerckk/PyTest",
"path": "/guest/sign/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def _get_filename(file: FileStorage) -> str:
return secure_filename(file.filename)
@staticmethod
def _get_file_extension(filename: str) -> str:
return os.path.splitext(filename)[1]
@property
def available_extensions(self) -> typing.Set[str]:
... | code_fim | medium | {
"lang": "python",
"repo": "kamil559/Pomodorr_backend_v2",
"path": "/pomodoro_system/web_app/marshallers/fields/file_field.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kamil559/Pomodorr_backend_v2 path: /pomodoro_system/web_app/marshallers/fields/file_field.py
import imghdr
import os
import typing
from flask import current_app
from foundation.i18n import N_
from marshmallow import ValidationError, fields
from web_app.utils import get_file_url
from werkzeug.dat... | code_fim | hard | {
"lang": "python",
"repo": "kamil559/Pomodorr_backend_v2",
"path": "/pomodoro_system/web_app/marshallers/fields/file_field.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ath.factorial(2*k)
if abs(term) <= 1e-8:
break
cos += term
k += 1
print(cos,k-1)<|fim_prefix|># repo: zuikaru/2110101_Com_Prog_2018_2 path: /03/03_P7.py
import math
x = float(input())
k = 0
cos = 0
term<|fim_middle|> = 1
while True:
term = ((-1)**k)*(x**(2*k))/m | code_fim | easy | {
"lang": "python",
"repo": "zuikaru/2110101_Com_Prog_2018_2",
"path": "/03/03_P7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zuikaru/2110101_Com_Prog_2018_2 path: /03/03_P7.py
import math
x = float(input())
k = 0
cos = 0
term<|fim_suffix|> break
cos += term
k += 1
print(cos,k-1)<|fim_middle|> = 1
while True:
term = ((-1)**k)*(x**(2*k))/math.factorial(2*k)
if abs(term) <= 1e-8:
| code_fim | medium | {
"lang": "python",
"repo": "zuikaru/2110101_Com_Prog_2018_2",
"path": "/03/03_P7.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gaurish26bhosale/infinisdk path: /infinisdk/infinibox/filesystem.py
from ..core.q import Q
from ..core import Field
from ..core.api.special_values import Autogenerate, OMIT
from ..core.bindings import RelatedObjectBinding
from .dataset import Dataset, DatasetTypeBinder
from .treeq import TreeQBin... | code_fim | medium | {
"lang": "python",
"repo": "gaurish26bhosale/infinisdk",
"path": "/infinisdk/infinibox/filesystem.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_treeq_binder_by_id(self, filesystem_id):
return self._treeq_binders[filesystem_id]
class Filesystem(Dataset):
FIELDS = [
Field("parent", type='infinisdk.infinibox.filesystem:Filesystem', cached=True, api_name="parent_id",
binding=RelatedObjectBinding('filesy... | code_fim | medium | {
"lang": "python",
"repo": "gaurish26bhosale/infinisdk",
"path": "/infinisdk/infinibox/filesystem.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vgrem/Office365-REST-Python-Client path: /tests/sharepoint/test_change.py
from office365.sharepoint.changes.log_item_query import ChangeLogItemQuery
from tests.sharepoint.sharepoint_case import SPTestCase
<|fim_suffix|> def test_2_get_site_changes(self):
changes = self.client.site.get... | code_fim | hard | {
"lang": "python",
"repo": "vgrem/Office365-REST-Python-Client",
"path": "/tests/sharepoint/test_change.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_2_get_site_changes(self):
changes = self.client.site.get_changes(query=ChangeQuery(site=True, fetch_limit=100)).execute_query()
self.assertIsInstance(changes, ChangeCollection)
def test_3_get_list_item_changes_since_token(self):
target_list = self.client.site.root... | code_fim | medium | {
"lang": "python",
"repo": "vgrem/Office365-REST-Python-Client",
"path": "/tests/sharepoint/test_change.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Create NetMRI context manager. It will close session after execution
with NetMRIEasy(**defaults) as easy:
subnet_broker = easy.client.get_broker('Subnet')
all_subnets = subnet_broker.index
print(all_subnets)
params = {
'select': 'SubnetCIDR'
}
results = all_subnets(**para... | code_fim | hard | {
"lang": "python",
"repo": "rexyim/netmri-toolkit",
"path": "/python/NetMRI_GUI_Python/find_subnets_with_broker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rexyim/netmri-toolkit path: /python/NetMRI_GUI_Python/find_subnets_with_broker.py
# BEGIN-SCRIPT-BLOCK
#
# Script-Filter:
# true
#
# END-SCRIPT-BLOCK
from infoblox_netmri.easy import NetMRIEasy
import re
<|fim_suffix|># Create NetMRI context manager. It will close session after execution
wi... | code_fim | hard | {
"lang": "python",
"repo": "rexyim/netmri-toolkit",
"path": "/python/NetMRI_GUI_Python/find_subnets_with_broker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def deletedImage(hashimage, token):
headers = {'Authorization': 'Client-ID ' + token}
req = requests.delete(url= "https://api.imgur.com/3/image/" + hashimage, headers= headers)
if req.status_code == requests.codes.ok:
return True
else:
return False
def yandex(image,token,... | code_fim | hard | {
"lang": "python",
"repo": "mishav78/SpyScrap",
"path": "/src/osint_sources/yandex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i,al in enumerate(a):
aclass = al.get_attribute('class')
if aclass == 'other-sites__preview-link':
link=al.get_attribute('href')
if link != None and link != "":
name=os.path.join('data/yandex/'+str(now)+'_images',str(j)+"-yandex.jpg")
j=j+1
title = s.find_element... | code_fim | hard | {
"lang": "python",
"repo": "mishav78/SpyScrap",
"path": "/src/osint_sources/yandex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mishav78/SpyScrap path: /src/osint_sources/yandex.py
#!/usr/bin/python
# coding: utf-8
# encoding=utf8
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from urllib.parse import unquote
from os.path import isfile, ... | code_fim | hard | {
"lang": "python",
"repo": "mishav78/SpyScrap",
"path": "/src/osint_sources/yandex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if from_state_type == TASK_STATE:
form_data = []
if isinstance(instance.form_data, list) and instance.form_data:
for item in instance.form_data:
form_data.append(
{
"output_variables": i... | code_fim | hard | {
"lang": "python",
"repo": "TencentBlueKing/bk-itsm",
"path": "/itsm/openapi/ticket/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TicketCreateSerializer(TicketSerializer):
"""
单据处理序列化
"""
creator = serializers.CharField(required=True)
tag = serializers.CharField(required=False)
class Meta:
model = Ticket
fields = (
"id",
"catalog_id",
"catalog_name"... | code_fim | hard | {
"lang": "python",
"repo": "TencentBlueKing/bk-itsm",
"path": "/itsm/openapi/ticket/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TencentBlueKing/bk-itsm path: /itsm/openapi/ticket/serializers.py
ONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
import random
import string
from django.utils.translation import ugettext as _
from rest_framework import serializers
from itsm.component.constants imp... | code_fim | hard | {
"lang": "python",
"repo": "TencentBlueKing/bk-itsm",
"path": "/itsm/openapi/ticket/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mountain-Lotus-Digital/ninjarmm-apiv2-client path: /ninjarmmpy/queries.py
from .utils import return_response, api_get_request # noqa, flake8 issue
class QueriesMixin():
# Queries
NINJA_API_QUERIES = '/v2/queries'
NINJA_API_QUERIES_ANTIVIRUS_THREATS... | code_fim | hard | {
"lang": "python",
"repo": "Mountain-Lotus-Digital/ninjarmm-apiv2-client",
"path": "/ninjarmmpy/queries.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @return_response
def getDeviceHealthReport(self, df: str = None, ts: str = None, cursor: str = None, pageSize: int = None):
"""Returns list of device health summary records
Keyword arguments:
df: str -- Device filter
ts: str -- Monitoring timestamp filte... | code_fim | hard | {
"lang": "python",
"repo": "Mountain-Lotus-Digital/ninjarmm-apiv2-client",
"path": "/ninjarmmpy/queries.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Returns list of drives connected to RAID controllers
Keyword arguments:
df: str -- Device filter
ts: str -- Monitoring timestamp filter
cursor: str -- Cursor name
pageSize: int -- Limit number of records per page
"""
params =... | code_fim | hard | {
"lang": "python",
"repo": "Mountain-Lotus-Digital/ninjarmm-apiv2-client",
"path": "/ninjarmmpy/queries.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IanBotashev/Miware path: /root/miware/jsonCommon.py
import json, os
class JsonShort:
"""A class for making it easier opening json files, and dumping data on json files."""
def __init__(self, file):
<|fim_suffix|> def openJson(self):
"""Open a json file."""
json_file = ... | code_fim | medium | {
"lang": "python",
"repo": "IanBotashev/Miware",
"path": "/root/miware/jsonCommon.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Close a json file, and dump data in it."""
with open(self.file, 'w') as f:
json.dump(data, f)<|fim_prefix|># repo: IanBotashev/Miware path: /root/miware/jsonCommon.py
import json, os
class JsonShort:
"""A class for making it easier opening json files, and dumping data ... | code_fim | hard | {
"lang": "python",
"repo": "IanBotashev/Miware",
"path": "/root/miware/jsonCommon.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BLTowsen/NeuralNetworkFromScratch path: /venv/Lib/site-packages/nnfs/datasets/sine.py
import numpy as np
<|fim_suffix|>
X = np.arange(samples).reshape(-1, 1) / samples
y = np.sin(2 * np.pi * X).reshape(-1, 1)
return X, y<|fim_middle|># Sine sample dataset
def create_data(samples=10... | code_fim | easy | {
"lang": "python",
"repo": "BLTowsen/NeuralNetworkFromScratch",
"path": "/venv/Lib/site-packages/nnfs/datasets/sine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
X = np.arange(samples).reshape(-1, 1) / samples
y = np.sin(2 * np.pi * X).reshape(-1, 1)
return X, y<|fim_prefix|># repo: BLTowsen/NeuralNetworkFromScratch path: /venv/Lib/site-packages/nnfs/datasets/sine.py
import numpy as np
<|fim_middle|># Sine sample dataset
def create_data(samples=10... | code_fim | easy | {
"lang": "python",
"repo": "BLTowsen/NeuralNetworkFromScratch",
"path": "/venv/Lib/site-packages/nnfs/datasets/sine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def day11b(input_path):
seating = Seating2(input_path)
prev_total = 0
delta = 1
while delta:
seating.step()
delta = seating.total - prev_total
prev_total = seating.total
return seating.total
def test11b():
assert 26 == day11b('test_input.txt')
if __name... | code_fim | hard | {
"lang": "python",
"repo": "sheromon/aoc2020",
"path": "/day11/day11.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sheromon/aoc2020 path: /day11/day11.py
import numpy as np
def day11a(input_path):
seating = Seating(input_path)
prev_total = 0
delta = 1
while delta:
seating.step()
delta = seating.total - prev_total
prev_total = seating.total
return seating.total
d... | code_fim | hard | {
"lang": "python",
"repo": "sheromon/aoc2020",
"path": "/day11/day11.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_rows, n_cols = self.state.shape
total = 0
for delta in self.deltas:
done = False
val = '.'
next_row, next_col = row, col
while not done:
next_row += delta[0]
next_col += delta[1]
if (n... | code_fim | hard | {
"lang": "python",
"repo": "sheromon/aoc2020",
"path": "/day11/day11.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def price_dict(self):
return self._price_dict.copy()
@property
def health_check_endpoint(self):
# Only fetch data of one asset - so that the health check is faster
return self.health_check_url
def get_price(self, asset: str) -> float:
return ... | code_fim | hard | {
"lang": "python",
"repo": "carlolm/hummingbot",
"path": "/hummingbot/data_feed/kucoin_price_feed.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carlolm/hummingbot path: /hummingbot/data_feed/kucoin_price_feed.py
import asyncio
import logging
from typing import (
Dict,
Optional,
)
from decimal import Decimal
from hummingbot.data_feed.data_feed_base import DataFeedBase
from hummingbot.logger import HummingbotLogger
from hummingbot.... | code_fim | hard | {
"lang": "python",
"repo": "carlolm/hummingbot",
"path": "/hummingbot/data_feed/kucoin_price_feed.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Only fetch data of one asset - so that the health check is faster
return self.health_check_url
def get_price(self, asset: str) -> float:
return self._price_dict.get(asset.upper())
async def fetch_price_loop(self):
while True:
try:
awa... | code_fim | hard | {
"lang": "python",
"repo": "carlolm/hummingbot",
"path": "/hummingbot/data_feed/kucoin_price_feed.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GRSEB9S/pointpats path: /pointpats/api.py
from .centrography import (mbr, hull, mean_center, weighted_mean_center,
manhattan_me<|fim_suffix|>import G, F, J, K, L, Genv, Fenv, Jenv, Kenv, Lenv
from .pointpattern import PointPattern
from .process import PoissonPointProcess... | code_fim | medium | {
"lang": "python",
"repo": "GRSEB9S/pointpats",
"path": "/pointpats/api.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>PoissonPointProcess, PoissonClusterPointProcess
from .quadrat_statistics import RectangleM, HexagonM, QStatistic<|fim_prefix|># repo: GRSEB9S/pointpats path: /pointpats/api.py
from .centrography import (mbr, hull, mean_center, weighted_mean_center,
manhattan_me<|fim_middle|>dian... | code_fim | hard | {
"lang": "python",
"repo": "GRSEB9S/pointpats",
"path": "/pointpats/api.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@mock.patch('f5.multi_device.trust_domain.TrustDomain._add_trustee')
@mock.patch('f5.multi_device.trust_domain.pollster')
def test_create(mock_add_trustee, mock_pollster, TrustDomainCreateNew):
td, mock_bigips = TrustDomainCreateNew
td.create(devices=mock_bigips, partition='test')
assert td.de... | code_fim | hard | {
"lang": "python",
"repo": "F5Networks/f5-common-python",
"path": "/f5/multi_device/test/unit/test_trust_domain.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: F5Networks/f5-common-python path: /f5/multi_device/test/unit/test_trust_domain.py
# Copyright 2015-2016 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at... | code_fim | hard | {
"lang": "python",
"repo": "F5Networks/f5-common-python",
"path": "/f5/multi_device/test/unit/test_trust_domain.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Init the lazy state."""
self._row = row
self.entity_id = self._row.entity_id
self.state = self._row.state
self._attributes = None
self._last_changed = None
self._last_updated = None
self._context = None
@property # type: ignore
d... | code_fim | hard | {
"lang": "python",
"repo": "tchellomello/home-assistant",
"path": "/homeassistant/components/history/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class LazyState(State):
"""A lazy version of core State."""
__slots__ = [
"_row",
"entity_id",
"state",
"_attributes",
"_last_changed",
"_last_updated",
"_context",
]
def __init__(self, row): # pylint: disable=super-init-not-called... | code_fim | hard | {
"lang": "python",
"repo": "tchellomello/home-assistant",
"path": "/homeassistant/components/history/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tchellomello/home-assistant path: /homeassistant/components/history/__init__.py
ass=hass) as session:
baked_query = hass.data[HISTORY_BAKERY](
lambda session: session.query(*QUERY_STATES)
)
baked_query += lambda q: q.filter(
(States.last_changed ==... | code_fim | hard | {
"lang": "python",
"repo": "tchellomello/home-assistant",
"path": "/homeassistant/components/history/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lycantropos/martinez path: /tests/bind_tests/boolean_tests/events_queue_key_tests/test_initialization.py
from hypothesis import given
from tests.bind_tests.hints import (BoundEventsQueueKey,
BoundSweepEvent)
from . import strategies
<|fim_suffix|> result =... | code_fim | medium | {
"lang": "python",
"repo": "lycantropos/martinez",
"path": "/tests/bind_tests/boolean_tests/events_queue_key_tests/test_initialization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = BoundEventsQueueKey(event)
assert result.event == event<|fim_prefix|># repo: lycantropos/martinez path: /tests/bind_tests/boolean_tests/events_queue_key_tests/test_initialization.py
from hypothesis import given
from tests.bind_tests.hints import (BoundEventsQueueKey,
... | code_fim | medium | {
"lang": "python",
"repo": "lycantropos/martinez",
"path": "/tests/bind_tests/boolean_tests/events_queue_key_tests/test_initialization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zizai/chemreps path: /tests/coulomb_matrix_test.py
from chemreps.coulomb_matrix import coulomb_matrix
import numpy as np
import pytest as pt
def test_cm():
cm_true = np.array([36.84, 23.33, 36.84, 23.38, 14.15, 36.84, 14.15,
23.38, 9.195, 36.84, 5.492, 2.762, 2.7... | code_fim | hard | {
"lang": "python",
"repo": "zizai/chemreps",
"path": "/tests/coulomb_matrix_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 0.3193, 0.387, 0.3254, 0.3982, 0.2095, 0.2256, 0.2041,
0.5, 2.145, 2.752, 1.42, 5.492, 0.387, 0.3193,
0.3982, 0.3254, 0.2256, 0.2095, 0.2041, 0.5635, 0.5,
1.717, 2.76, 1.272, 5.492, 0.265, 0.265, 0.4016,
... | code_fim | hard | {
"lang": "python",
"repo": "zizai/chemreps",
"path": "/tests/coulomb_matrix_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hktxt/Kaggle-Cornell-Birdcall-Identification path: /data/clipssplit.py
# organize data, read wav to get duration and split train/test
# to a csv file
# author: Max, 2020.09.02
import os
import librosa
from tqdm import tqdm
import pandas as pd
from sklearn.model_selection import StratifiedKFold
... | code_fim | hard | {
"lang": "python",
"repo": "hktxt/Kaggle-Cornell-Birdcall-Identification",
"path": "/data/clipssplit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
main('D:/project/Cornell-Birdcall-Identification/data/birdsong-recognition/resampled_clips/')
# https://www.kaggle.com/ttahara/training-birdsong-baseline-resnest50-fast#split-data
skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
train_all = pd.... | code_fim | hard | {
"lang": "python",
"repo": "hktxt/Kaggle-Cornell-Birdcall-Identification",
"path": "/data/clipssplit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if idx == 1:
# break
df = pd.DataFrame(data, columns=['label', 'ebird_code', 'resampled_filename', 'xc_id', 'duration'])
df.to_csv('df_clips.csv', index=False)
df = pd.read_csv('df_clips.csv')
# df['fold'] = -1
# skf = StratifiedKFold(n_splits=5,... | code_fim | hard | {
"lang": "python",
"repo": "hktxt/Kaggle-Cornell-Birdcall-Identification",
"path": "/data/clipssplit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not self.url.startswith("http") and not self.url.startswith("https"):
self.url = "http://" + self.url
try:
check_req = request.post(self.url, headers = self.headers, data = self.check_payload)
hostname = urlparse(self.url).hostname
port = ... | code_fim | hard | {
"lang": "python",
"repo": "baozhazhizi/linbing",
"path": "/flask/app/plugins/Struts2/S2_052.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baozhazhizi/linbing path: /flask/app/plugins/Struts2/S2_052.py
#!/usr/bin/env python3
'''
name: Struts2 S2-052漏洞,又名CVE-2017-9805漏洞
description: Struts2 S2-052漏洞可执行任意命令
'''
import urllib
from urllib.parse import urlparse
from app.lib.utils.common import get_capta
from app.lib.utils.request impor... | code_fim | hard | {
"lang": "python",
"repo": "baozhazhizi/linbing",
"path": "/flask/app/plugins/Struts2/S2_052.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RBuractaon/animated-octo-nemesis path: /SSH Keystrokes/training/reverse_time.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# reverse_time.py
# Syntax: reverse_time.py <user sessions file> <output file>
# normalizes the time of each user session. T = Time - Max(Time) for each user.
# wo... | code_fim | hard | {
"lang": "python",
"repo": "RBuractaon/animated-octo-nemesis",
"path": "/SSH Keystrokes/training/reverse_time.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Print last line
TVEC = np.array(t_hist)
TVEC.sort()
RevTimes = TVEC-max(TVEC)
RevTimes = RevTimes * (-1)
DeltaT = np.ediff1d(TVEC, to_begin=999999999)
NDX = range(0, len(RevTimes))
for ii in range(0, len(TVEC)):
dtg = datetime.datetime.fromtimestamp(TVEC[ii]).strf... | code_fim | hard | {
"lang": "python",
"repo": "RBuractaon/animated-octo-nemesis",
"path": "/SSH Keystrokes/training/reverse_time.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: almarklein/translate_to_legacy path: /tests.py
""" Run tests.
"""
import os
import subprocess
import pytest
from pytest import raises
from translate_to_legacy import (BaseTranslator, LegacyPythonTranslator,
Token, CancelTranslation)
def test_token1():
... | code_fim | hard | {
"lang": "python",
"repo": "almarklein/translate_to_legacy",
"path": "/tests.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_fix_getcwd():
code = """
getcwd()
os.getcwd()
"""
new_code = LegacyPythonTranslator(code).translate()
assert new_code.count('getcwd(') == 0
assert new_code.count('getcwdu(') == 2
def test_fix_imports():
code = """
from urllib.request import urlopen
import... | code_fim | hard | {
"lang": "python",
"repo": "almarklein/translate_to_legacy",
"path": "/tests.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QuincyMa/sentry path: /src/sentry/lang/native/unreal.py
from __future__ import absolute_import
from symbolic import Unreal4Crash
from sentry.lang.native.minidump import MINIDUMP_ATTACHMENT_TYPE
from sentry.models import UserReport
from sentry.utils.safe import set_path, setdefault_path
import re... | code_fim | hard | {
"lang": "python",
"repo": "QuincyMa/sentry",
"path": "/src/sentry/lang/native/unreal.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def merge_unreal_context_event(unreal_context, event, project):
"""Merges the context from an Unreal Engine 4 crash
with the given event."""
runtime_prop = unreal_context.get('runtime_properties')
if runtime_prop is None:
return
message = runtime_prop.pop('error_message', Non... | code_fim | hard | {
"lang": "python",
"repo": "QuincyMa/sentry",
"path": "/src/sentry/lang/native/unreal.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> gpu_brand = runtime_prop.pop('misc_primary_cpu_brand', None)
if gpu_brand is not None:
set_path(event, 'contexts', 'gpu', 'name', value=gpu_brand)
user_desc = runtime_prop.pop('user_description', None)
if user_desc is not None:
event_id = event.setdefault('event_id', uuid.... | code_fim | hard | {
"lang": "python",
"repo": "QuincyMa/sentry",
"path": "/src/sentry/lang/native/unreal.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @patch('gevent.sleep')
def test_award_not_valid_identifier_id(self, gevent_sleep):
gevent_sleep.side_effect = custom_sleep
self.client.request.return_value = ResponseMock(
{'X-Request-ID': self.request_ids[0]},
munchify({'prev_page': {'offset': '123'},
... | code_fim | hard | {
"lang": "python",
"repo": "JrooTJunior/bot.dfs",
"path": "/bot/dfs/tests/test_workers/test_filter_tender.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @patch('gevent.sleep')
def test_worker_award_with_cancelled_lot(self, gevent_sleep):
gevent_sleep.side_effect = custom_sleep
self.client.request.return_value = ResponseMock(
{'X-Request-ID': self.request_ids[0]},
munchify({'prev_page': {'offset': '123'},
... | code_fim | hard | {
"lang": "python",
"repo": "JrooTJunior/bot.dfs",
"path": "/bot/dfs/tests/test_workers/test_filter_tender.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JrooTJunior/bot.dfs path: /bot/dfs/tests/test_workers/test_filter_tender.py
a
from bot.dfs.tests.utils import custom_sleep, generate_request_id, ResponseMock
from bot.dfs.bridge.bridge import TendersClientSync
from bot.dfs.bridge.sleep_change_value import APIRateController
SERVER_RESPONSE_FLAG =... | code_fim | hard | {
"lang": "python",
"repo": "JrooTJunior/bot.dfs",
"path": "/bot/dfs/tests/test_workers/test_filter_tender.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michaelborck/brandwatch path: /config.py
import streamlit as st
class TwitterConfig:
CONSUMER_KEY <|fim_suffix|>']
ACCESS_TOKEN_SECRET = st.secrets['ACCESS_TOKEN_SECRET']<|fim_middle|>= st.secrets['CONSUMER_KEY']
CONSUMER_SECRET = st.secrets['CONSUMER_SECRET']
ACCESS_TOKEN = st.s... | code_fim | medium | {
"lang": "python",
"repo": "michaelborck/brandwatch",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>']
ACCESS_TOKEN_SECRET = st.secrets['ACCESS_TOKEN_SECRET']<|fim_prefix|># repo: michaelborck/brandwatch path: /config.py
import streamlit as st
class TwitterConfig:
CONSUMER_KEY <|fim_middle|>= st.secrets['CONSUMER_KEY']
CONSUMER_SECRET = st.secrets['CONSUMER_SECRET']
ACCESS_TOKEN = st.s... | code_fim | medium | {
"lang": "python",
"repo": "michaelborck/brandwatch",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.departamento=dep
def departa(self):
self.departamento=input("Ingresar el departamento al que pertenece el empleado: ")
def mostrarDeparta(self):
print("El empleado pertenece al departamento de: {}".format(self.departamento))
class Pagos(Empleado):
def __init__(se... | code_fim | hard | {
"lang": "python",
"repo": "Alopezm5/PROYECTO-PARTE-1",
"path": "/.history/DEBER_20210904225322.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Alopezm5/PROYECTO-PARTE-1 path: /.history/DEBER_20210904225322.py
import os
class Empresa():
def __init__(self,nom="",ruc=0,dire="",tele=0,ciud="",tipEmpr=""):
self.nombre=nom
self.ruc=ruc
self.direccion=dire
self.telefono=tele
self.ciudad=ciud
... | code_fim | hard | {
"lang": "python",
"repo": "Alopezm5/PROYECTO-PARTE-1",
"path": "/.history/DEBER_20210904225322.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: junbaih/mednickdb_pyparse path: /mednickdb_pyparse/utils.py
from scipy.io import loadmat
from datetime import datetime, timedelta
import numpy as np
STRIP = "' ', ',', '\'', '(', '[', '{', ')', '}', ']'"
def extract_file_tags_from_file_name(filePath): #TODO untested and unused
"""to delete... | code_fim | hard | {
"lang": "python",
"repo": "junbaih/mednickdb_pyparse",
"path": "/mednickdb_pyparse/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def mat_datenum_to_py_datetime(mat_datenum):
"""
Converts a matlab "datenum" type to a python datetime type
:param mat_datenum: matlab datenum to conver
:return: converted datetime
"""
return datetime.fromordinal(int(mat_datenum)) + timedelta(days=mat_datenum % 1) - timedelta(days=... | code_fim | hard | {
"lang": "python",
"repo": "junbaih/mednickdb_pyparse",
"path": "/mednickdb_pyparse/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Download h5 model from public AWS S3 bucket"""
logging.info("[genreml] Downloading model...")
with urllib.request.urlopen(config.FMAModelConfig.FMA_MODEL_URL) as f:
data = f.read()
open(config.FMAModelConfig.FMA_MODEL_PATH, 'wb').write(data)
logging.info("[genreml] Mode... | code_fim | easy | {
"lang": "python",
"repo": "adaros92/genreml",
"path": "/genreml/model/utils/model_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adaros92/genreml path: /genreml/model/utils/model_utils.py
import logging
from genreml.model.cnn import config
<|fim_suffix|>def download_model():
""" Download h5 model from public AWS S3 bucket"""
logging.info("[genreml] Downloading model...")
with urllib.request.urlopen(config.FMAM... | code_fim | easy | {
"lang": "python",
"repo": "adaros92/genreml",
"path": "/genreml/model/utils/model_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('rthl_site', '0002_player'),
]
operations = [
migrations.AlterModelOptions(
name='player',
options={'verbose_name': 'Игрок', 'verbose_name_plural': 'Игроки'},
),
migrations.AddField(
model_name='player',
... | code_fim | medium | {
"lang": "python",
"repo": "Mauzzz0/freelance-projects",
"path": "/Python/Django_demo/rthl_site/migrations/0003_auto_20210131_1746.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mauzzz0/freelance-projects path: /Python/Django_demo/rthl_site/migrations/0003_auto_20210131_1746.py
# Generated by Django 3.1.4 on 2021-01-31 14:46
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('rthl_site', '0002_player'),
]
operations = [
... | code_fim | medium | {
"lang": "python",
"repo": "Mauzzz0/freelance-projects",
"path": "/Python/Django_demo/rthl_site/migrations/0003_auto_20210131_1746.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timolson/django-static-precompiler path: /static_precompiler/templatetags/sass.py
from django.template.base import Library
from static_precompiler.compilers import SASS
from static_precompiler.templatetags.compile_static import register_compiler_tags
<|fim_suffix|>register_compiler_tags(register... | code_fim | easy | {
"lang": "python",
"repo": "timolson/django-static-precompiler",
"path": "/static_precompiler/templatetags/sass.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>register_compiler_tags(register, compiler)<|fim_prefix|># repo: timolson/django-static-precompiler path: /static_precompiler/templatetags/sass.py
from django.template.base import Library
from static_precompiler.compilers import SASS
from static_precompiler.templatetags.compile_static import register_comp... | code_fim | easy | {
"lang": "python",
"repo": "timolson/django-static-precompiler",
"path": "/static_precompiler/templatetags/sass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Total pages completed
page_complete = pyqtSignal(int)
# Event Name
scrape_event = pyqtSignal(int)<|fim_prefix|># repo: sqz269/BooruScraper path: /UserInterface/libs/log_window_update_helper.py
from PyQt5.QtCore import QObject, pyqtSignal
class ScraperEvent:
IN_PROGRESS = 0
CL... | code_fim | medium | {
"lang": "python",
"repo": "sqz269/BooruScraper",
"path": "/UserInterface/libs/log_window_update_helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Log message, Normal Message, Level Count, Level Name
log_event = pyqtSignal(str, str, int, str)
# Total pages completed
page_complete = pyqtSignal(int)
# Event Name
scrape_event = pyqtSignal(int)<|fim_prefix|># repo: sqz269/BooruScraper path: /UserInterface/libs/log_window_upd... | code_fim | easy | {
"lang": "python",
"repo": "sqz269/BooruScraper",
"path": "/UserInterface/libs/log_window_update_helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sqz269/BooruScraper path: /UserInterface/libs/log_window_update_helper.py
from PyQt5.QtCore import QObject, pyqtSignal
class ScraperEvent:
IN_PROGRESS = 0
CLEANING_UP = 1
COMPLETED = 2
class UiLoggingHelper(QObject):
<|fim_suffix|> # Event Name
scrape_event = pyqtSignal(int... | code_fim | medium | {
"lang": "python",
"repo": "sqz269/BooruScraper",
"path": "/UserInterface/libs/log_window_update_helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## Get average stock levels for product
averagesales = self.AverageSales(product)
## Get stock level
stocklevel = self.prod.GetStockLevel(product)
## If no data for either value, return 0
if not averagesales or not stocklevel:
return 0
## Round down the two items divided ... | code_fim | hard | {
"lang": "python",
"repo": "benchungiscool/quickpos",
"path": "/quickpos/transaction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## Remove a transaction from the transactions table
def RemoveTransaction(self, transaction_id):
## Delete from the transactions table, where id is the given number
instruction = """
DELETE FROM transactions
WHERE id = {}
""".format(transaction_id)
## Send this to the database
... | code_fim | hard | {
"lang": "python",
"repo": "benchungiscool/quickpos",
"path": "/quickpos/transaction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benchungiscool/quickpos path: /quickpos/transaction.py
from quickpos.product import Product
from quickpos.database import Database
class Transaction:
def __init__(self):
self.db = Database()
self.prod = Product()
## Record a transaction using a list of products
def RecordTransact... | code_fim | hard | {
"lang": "python",
"repo": "benchungiscool/quickpos",
"path": "/quickpos/transaction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattravenhall/outbreaker path: /src/utils.py
#!/usr/bin/env python3
import sys
def binary_query(query, default=False):
if default:
reply = input(f"{query} (Y/n): ")
elif not default:
reply = input(f"{query} (y/N): ")
else:
raise ValueError('Inappropriate defa... | code_fim | hard | {
"lang": "python",
"repo": "mattravenhall/outbreaker",
"path": "/src/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def int_query(query, minVal=None, maxVal=None):
if minVal is None: # no floor
if isinstance(maxVal, int): # a ceiling
reply = input(f"{query} (max {maxVal}): ")
else: # Max isn't an int, so default to no maxlimit
reply = input(f"{query}")
elif maxVal is None... | code_fim | medium | {
"lang": "python",
"repo": "mattravenhall/outbreaker",
"path": "/src/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ReduceNone(Layer):
def call(self, inputs, training=None, mask=None):
return inputs
reduce_mode_registry = {
'last': ReduceLast,
'sum': ReduceSum,
'mean': ReduceMean,
'avg': ReduceMean,
'max': ReduceMax,
'concat': ReduceConcat,
'attention': FeedForwardAttent... | code_fim | hard | {
"lang": "python",
"repo": "litanlitudan/ludwig",
"path": "/ludwig/modules/reduction_modules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: litanlitudan/ludwig path: /ludwig/modules/reduction_modules.py
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License ... | code_fim | hard | {
"lang": "python",
"repo": "litanlitudan/ludwig",
"path": "/ludwig/modules/reduction_modules.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ReduceMax(Layer):
def call(self, inputs, training=None, mask=None):
return tf.reduce_max(inputs, axis=1)
class ReduceConcat(Layer):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.reduce_last = ReduceLast()
def call(self, inputs, training=None, ... | code_fim | hard | {
"lang": "python",
"repo": "litanlitudan/ludwig",
"path": "/ludwig/modules/reduction_modules.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ybxgood/CCF_1 path: /Codes/Run.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time
import xgboost as xgb
from sklearn.cross_validation import train_test_split
if __name__ == '__main__':
traindata=pd.read_csv('G:\\CCF_1\\Result\\Middle_2017-11-10_22.55.52.csv... | code_fim | hard | {
"lang": "python",
"repo": "ybxgood/CCF_1",
"path": "/Codes/Run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ng_rounds 当设置的迭代次数较大时,early_stopping_rounds 可在一定的迭代次数内准确率没有提升就停止训练
watchlist=[(Big_train,'Train'),(Big_val,'Validation')]
Big_BST = xgb.train(plst, Big_train, num_round,watchlist,early_stopping_rounds=100)
S_Name = time.strftime("%Y-%m-%d_%H.%M.%S", time.localtime())
Big_BST.save_model('G:... | code_fim | hard | {
"lang": "python",
"repo": "ybxgood/CCF_1",
"path": "/Codes/Run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sample_array = ArrayField(models.CharField(max_length=20), blank=True, null=True)<|fim_prefix|># repo: reverland/django-better-admin-arrayfield path: /sample_project/sample_app/models.py
from django.db import models
<|fim_middle|>from django_better_admin_arrayfield.models.fields import ArrayField
... | code_fim | medium | {
"lang": "python",
"repo": "reverland/django-better-admin-arrayfield",
"path": "/sample_project/sample_app/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reverland/django-better-admin-arrayfield path: /sample_project/sample_app/models.py
from django.db import models
from django_better_admin_arrayfield.models.fields import ArrayField
<|fim_suffix|> sample_array = ArrayField(models.CharField(max_length=20), blank=True, null=True)<|fim_middle|>... | code_fim | easy | {
"lang": "python",
"repo": "reverland/django-better-admin-arrayfield",
"path": "/sample_project/sample_app/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ArrayModel(models.Model):
sample_array = ArrayField(models.CharField(max_length=20), blank=True, null=True)<|fim_prefix|># repo: reverland/django-better-admin-arrayfield path: /sample_project/sample_app/models.py
from django.db import models
<|fim_middle|>from django_better_admin_arrayfield.m... | code_fim | medium | {
"lang": "python",
"repo": "reverland/django-better-admin-arrayfield",
"path": "/sample_project/sample_app/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>< a < (b + c) and abs(a - c) < b < (a + c) and abs(a - b) < c < (a + b):
print('Esse triângulo existe')
else:
print('Não é possível construir um triângulo com essas medidas')<|fim_prefix|># repo: raulgranja/Python-Course path: /PythonExercicios/ex035.py
a = float(input('Digite o lado "a" de um tr... | code_fim | medium | {
"lang": "python",
"repo": "raulgranja/Python-Course",
"path": "/PythonExercicios/ex035.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raulgranja/Python-Course path: /PythonExercicios/ex035.py
a = float(input('Digite o lado "a" de um triângulo: '))
b = float(input('Digite o lado "b" <|fim_suffix|>iângulo existe')
else:
print('Não é possível construir um triângulo com essas medidas')<|fim_middle|>desse triângulo: '))
c = floa... | code_fim | medium | {
"lang": "python",
"repo": "raulgranja/Python-Course",
"path": "/PythonExercicios/ex035.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dst_axes = []
for axis in src_axes:
if axis not in used_by_other_axes:
continue
dst_axes.append(axis)
summed_axis_indices = [i for i in range(len(src_axes)) if src_axes[i] not in dst_axes]
if summed_axis_indices:
x = mb.re... | code_fim | hard | {
"lang": "python",
"repo": "apple/coremltools",
"path": "/coremltools/converters/mil/frontend/_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> e.g.:
input : "abce,acd->ae"
returns : "ace,ac->ae"
In this example, since each of those axes is only used by one var and does not appear in the output,
axes `b` and `d` can be reduced before binary einsum.
"""
def solve_sum_einsum_one_step(src_axes, used_by_other_axes, x):
... | code_fim | hard | {
"lang": "python",
"repo": "apple/coremltools",
"path": "/coremltools/converters/mil/frontend/_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apple/coremltools path: /coremltools/converters/mil/frontend/_utils.py
ypes.symbolic import any_symbolic, is_symbolic
def value_at(x: Var, idx: int, name=None, before_op=None):
"""
input x: 1D tensor (vector).
return value at index idx. x[idx].
Could specify the name of the retu... | code_fim | hard | {
"lang": "python",
"repo": "apple/coremltools",
"path": "/coremltools/converters/mil/frontend/_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"0x90542bb21403137d552b892f179331d7f7f79b11",
"0x90546ed2396f56e51f8c8c7cff921c7eed915322",
"0x9054a2cab167a2a6a911adef8030833f6ff6aec3",
"0x9055045b86439858d7ef6aa85e09ab3c4cb820da",
"0x905588f83b0f02dc74c0af0dd6fb7f81333c1df9",
"0x9055d5694174d25fef8f83ed789a6ab117830215",
"0x905... | code_fim | hard | {
"lang": "python",
"repo": "Soptq/balsnap",
"path": "/examples/extensive.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Soptq/balsnap path: /examples/extensive.py
6b38cafc",
"0x8f86121f5d21c4a24da341eb016b243581b1207b",
"0x8f862d733ac803d2e000cd804b3e5b9f11b3df5b",
"0x8f86331ef06e0aa1e3c8567099324f0a0f81bc5a",
"0x8f86a6243499f203a7a2742ac37410950f290466",
"0x8f86ab8f79e6821e41189b86781ddc6c644d... | code_fim | hard | {
"lang": "python",
"repo": "Soptq/balsnap",
"path": "/examples/extensive.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Soptq/balsnap path: /examples/extensive.py
55ef0dd880a9c534255ddc93fdb075a6d",
"0x8e0f3973b831fc2e255f61eb75c32898d7a7481a",
"0x8e0fa04a0f35b0fc5de16075cbed1e76bf91f634",
"0x8e0ffe43016e2645397ce7bd96eaf96fa3b02eb2",
"0x8e102e60ac73ccdc956ae658a1d3b26da967511b",
"0x8e10c4ce182... | code_fim | hard | {
"lang": "python",
"repo": "Soptq/balsnap",
"path": "/examples/extensive.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>resize1 = cv2.resize(image_of_concatenated_images, (0,0), 0.25, 0.25)
status = cv2.imwrite(f'{INPUT_AND_OUTPUT_DIR}//big long boi smaller.png', image_of_concatenated_images)
if status:
print('success!')
else:
print('no succes!! :(')
print('resizing...10%')
resize1 = cv2.resize(image_of_concate... | code_fim | hard | {
"lang": "python",
"repo": "Queuebee2/EFT-CaseCompilator-Screenshot-Cropper-Combinator",
"path": "/case_concatenator.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Queuebee2/EFT-CaseCompilator-Screenshot-Cropper-Combinator path: /case_concatenator.py
import cv2
import numpy as np
import os
INPUT_AND_OUTPUT_DIR = 'output'
""" Code from
https://note.nkmk.me/en/python-opencv-hconcat-vconcat-np-tile/
I changed 'min' to max, that's all.
"""
def vconcat_res... | code_fim | hard | {
"lang": "python",
"repo": "Queuebee2/EFT-CaseCompilator-Screenshot-Cropper-Combinator",
"path": "/case_concatenator.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>status = cv2.imwrite(f'{INPUT_AND_OUTPUT_DIR}//big long boi.png', image_of_concatenated_images)
if status:
print('success!')
else:
print('no succes!! :(')
print('resizing... 50%')
resize1 = cv2.resize(image_of_concatenated_images, (0,0), 0.5, 0.5, cv2.INTER_AREA)
status = cv2.imwrite(f'{INPUT_... | code_fim | hard | {
"lang": "python",
"repo": "Queuebee2/EFT-CaseCompilator-Screenshot-Cropper-Combinator",
"path": "/case_concatenator.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
if 'log_time' in kw:
name = kw.get('log_name', method.__name__.upper())
kw['log_time'][name] = int((te - ts) * 1000)
else:
print('%r %2.2f... | code_fim | hard | {
"lang": "python",
"repo": "raviteja-kvns/cycada_release",
"path": "/UPSNet/lib/utils/timer.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raviteja-kvns/cycada_release path: /UPSNet/lib/utils/timer.py
# ---------------------------------------------------------------------------
# Unified Panoptic Segmentation Network
#
# Copyright (c) 2018-2019 Uber Technologies, Inc.
#
# Licensed under the Uber Non-Commercial License (the "License"... | code_fim | medium | {
"lang": "python",
"repo": "raviteja-kvns/cycada_release",
"path": "/UPSNet/lib/utils/timer.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ts = time.time()
result = method(*args, **kw)
te = time.time()
if 'log_time' in kw:
name = kw.get('log_name', method.__name__.upper())
kw['log_time'][name] = int((te - ts) * 1000)
else:
print('%r %2.2f ms' % \
(... | code_fim | medium | {
"lang": "python",
"repo": "raviteja-kvns/cycada_release",
"path": "/UPSNet/lib/utils/timer.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wikimedia/pywikibot path: /tests/xmlreader_tests.py
#!/usr/bin/env python3
"""Tests for xmlreader module."""
#
# (C) Pywikibot team, 2009-2022
#
# Distributed under the terms of the MIT license.
#
import unittest
from contextlib import suppress
from pywikibot import xmlreader
from tests import j... | code_fim | hard | {
"lang": "python",
"repo": "wikimedia/pywikibot",
"path": "/tests/xmlreader_tests.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.