text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: pulumi/pulumi-azure-native path: /sdk/python/pulumi_azure_native/workloads/__init__.py
# coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from .. import _utilities
import typing
# Export this packa... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-azure-native",
"path": "/sdk/python/pulumi_azure_native/workloads/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>iew
v20221101preview = __v20221101preview
import pulumi_azure_native.workloads.v20230401 as __v20230401
v20230401 = __v20230401
else:
v20211201preview = _utilities.lazy_import('pulumi_azure_native.workloads.v20211201preview')
v20221101preview = _utilities.lazy_import('pulumi_azure_nati... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-azure-native",
"path": "/sdk/python/pulumi_azure_native/workloads/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-GameplayKit/PyObjCTest/test_gkgridgraph.py
from PyObjCTools.TestSupport import TestCase
import GameplayKit
from objc import simd
class TestGKGridGraph(TestCase):
def testMethods(self):
self.assertResultIsBOOL(GameplayKit.GKGridGraph.di... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-GameplayKit/PyObjCTest/test_gkgridgraph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertArgHasType(
GameplayKit.GKGridGraph.graphFromGridStartingAt_width_height_diagonalsAllowed_,
0,
simd.vector_int2.__typestr__,
)
self.assertArgIsBOOL(
GameplayKit.GKGridGraph.graphFromGridStartingAt_width_height_diagonalsAllo... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-GameplayKit/PyObjCTest/test_gkgridgraph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> token = {"index": values['-index-'],
"siglum": siglum,
"reading": siglum,
"original": values['-original-'],
"rule_match": rule_match,
"t": values['to_collate']}
if values['break_place'] != '':
token[f'break_{values["break_pl... | code_fim | hard | {
"lang": "python",
"repo": "d-flood/transcribedit",
"path": "/src/transcribedit/manage_token.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: d-flood/transcribedit path: /src/transcribedit/manage_token.py
import transcribedit.tokenize_text as tt
def load_token(index: str, verse: dict, siglum: str, window):
index = int(index.replace('word', ''))
try:
token = tt.get_token(index, verse, siglum)
except:
print('... | code_fim | hard | {
"lang": "python",
"repo": "d-flood/transcribedit",
"path": "/src/transcribedit/manage_token.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Single430/pyecharts path: /pyecharts/charts/heatmap.py
#!/usr/bin/env python
# coding=utf-8
from pyecharts.base import Base
from pyecharts.option import get_all_options
class HeatMap(Base):
"""
<<< HeatMap chart >>>
Heat map mainly use colors to represent values, which must be use... | code_fim | hard | {
"lang": "python",
"repo": "Single430/pyecharts",
"path": "/pyecharts/charts/heatmap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:param name:
Series name used for displaying in tooltip and filtering with legend,
or updating data and configuration with setOption.
:param x_axis:
data of xAxis, it must be catagory axis.
:param y_axis:
data of yAxis, i... | code_fim | hard | {
"lang": "python",
"repo": "Single430/pyecharts",
"path": "/pyecharts/charts/heatmap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kirk-sayre-work/xlmulator path: /doxypy.py
#!/usr/bin/env python
""" @namespace doxypy
doxypy is an input filter for Doxygen. It preprocesses python
files so that docstrings of classes and functions are extracted
as Doxygens special python documentation blocks. It can be found
at <http://code.f... | code_fim | hard | {
"lang": "python",
"repo": "kirk-sayre-work/xlmulator",
"path": "/doxypy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # split input into lines
lines = input.split("\n")
# flags, buffers, ...
fileHeadFlag = True
triggerWordFlag = False
commentFlag = False
comment = []
triggerWs = ""
triggerLines = None
# process each line
for line in enumerate(lines):
match = re.search(triggerRe, line[1])
if match:
... | code_fim | hard | {
"lang": "python",
"repo": "kirk-sayre-work/xlmulator",
"path": "/doxypy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if triggerLines:
output.append("\n".join(triggerLines))
comment = []
commentFlag = False
triggerWs = ""
triggerLines = None
triggerWordFlag = False
else:
# multiline comment begin
commentFlag = True
comment.append(
line[1][line[1].f... | code_fim | hard | {
"lang": "python",
"repo": "kirk-sayre-work/xlmulator",
"path": "/doxypy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def generate(targets):
for name, data in targets.iteritems():
globals()[name + 'Test'] = type(name + 'Test',
(SortedBTreeTestMixin, unittest.TestCase),
{'DATA': data['data'], 'order': data.get('order', 64)})
def randstr(length):
return ''.join(random.choice... | code_fim | hard | {
"lang": "python",
"repo": "bwrsandman/btree",
"path": "/tests.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
generate({
'IntShortRange': {'data': range(-10, 10)},
'IntLongRange': {'data': range(-1000, 1000)},
'StrShort': {'data': [randstr(random.randrange(20)) for i in xrange(20)]},
'StrLong': {'data': [randstr(random.randrange(20)) for i in xrange(2000)]},
'FloatShortRange': {'data': map(... | code_fim | hard | {
"lang": "python",
"repo": "bwrsandman/btree",
"path": "/tests.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bwrsandman/btree path: /tests.py
#!/usr/bin/env python
# vim: fileencoding=utf8:et:sta:ai:sw=4:ts=4:sts=4
import copy
import random
import string
import unittest
import btree
class SortedBTreeTestMixin(object):
@property
def data(self):
return copy.deepcopy(self.DATA)
def... | code_fim | hard | {
"lang": "python",
"repo": "bwrsandman/btree",
"path": "/tests.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def downgrade(tables, tester, progress_reporter):
op = ProgressWrapper(original_op, progress_reporter)
op.execute(tables
.notificationkind
.delete()
.where(tables.
notificationkind.c.name == op.inline_literal('repo_mirror_sync_started')))
... | code_fim | hard | {
"lang": "python",
"repo": "anwarchk/quay",
"path": "/data/migrations/versions/cc6778199cdb_repository_mirror_notification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> op.execute(tables
.externalnotificationevent
.delete()
.where(tables.
externalnotificationevent.c.name == op.inline_literal('repo_mirror_sync_started')))
op.execute(tables
.externalnotificationevent
.delete()
... | code_fim | hard | {
"lang": "python",
"repo": "anwarchk/quay",
"path": "/data/migrations/versions/cc6778199cdb_repository_mirror_notification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anwarchk/quay path: /data/migrations/versions/cc6778199cdb_repository_mirror_notification.py
"""repository mirror notification
Revision ID: cc6778199cdb
Revises: c059b952ed76
Create Date: 2019-10-03 17:41:23.316914
"""
# revision identifiers, used by Alembic.
revision = 'cc6778199cdb'
down_rev... | code_fim | hard | {
"lang": "python",
"repo": "anwarchk/quay",
"path": "/data/migrations/versions/cc6778199cdb_repository_mirror_notification.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sailfish009/ncats-adme path: /server/predictors/chemprop/chemprop/train/__init__.py
from .cross_validate import chemprop_train, cross_validate
from .ev<|fim_suffix|> import chemprop_predict, make_predictions
from .predict import predict
from .run_training import run_training
from .train import tr... | code_fim | medium | {
"lang": "python",
"repo": "sailfish009/ncats-adme",
"path": "/server/predictors/chemprop/chemprop/train/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> import chemprop_predict, make_predictions
from .predict import predict
from .run_training import run_training
from .train import train<|fim_prefix|># repo: sailfish009/ncats-adme path: /server/predictors/chemprop/chemprop/train/__init__.py
from .cross_validate import chemprop_train, cross_validate
from ... | code_fim | medium | {
"lang": "python",
"repo": "sailfish009/ncats-adme",
"path": "/server/predictors/chemprop/chemprop/train/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>dict
from .run_training import run_training
from .train import train<|fim_prefix|># repo: sailfish009/ncats-adme path: /server/predictors/chemprop/chemprop/train/__init__.py
from .cross_validate import chemprop_train, cross_validate
from .evaluate import evaluate, evaluate_predictions
from .make_predicti... | code_fim | medium | {
"lang": "python",
"repo": "sailfish009/ncats-adme",
"path": "/server/predictors/chemprop/chemprop/train/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_mirage.py
#calss header
class _MIRAGE():
def __init__(self,):
self.name = "MIRAGE"
self.definitions = [u'an image, produced by very hot air, of something that seems to be far away but does not really exist', u'a hope or wish that has no chance... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_mirage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
print(total, end="")
startLength += 4
endLength += 4
def main():
strings = input("Enter a binary strings: ")
binaryToHex(strings)
print()
main()<|fim_prefix|># repo: ywyz/IntroducingToProgrammingUsingPython path: /Exercise08/8-9.py
'''
@Date: 201... | code_fim | hard | {
"lang": "python",
"repo": "ywyz/IntroducingToProgrammingUsingPython",
"path": "/Exercise08/8-9.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ywyz/IntroducingToProgrammingUsingPython path: /Exercise08/8-9.py
'''
@Date: 2019-12-20 21:22:42
@Author: ywyz
@LastModifiedBy: ywyz
@Github: https://github.com/ywyz
@LastEditors : ywyz
@LastEditTime : 2019-12-22 18:37:59
'''
def binaryToHex(binaryValue):
length = len(binaryValue)
whil... | code_fim | hard | {
"lang": "python",
"repo": "ywyz/IntroducingToProgrammingUsingPython",
"path": "/Exercise08/8-9.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if daily_tran_qs.count() > 1:
# log as duplicate
items = str(daily_tran_qs.values_list('id', flat=True))
self.LOGGER.warning('Find duplicate DailyTran item: %s' % items,
... | code_fim | hard | {
"lang": "python",
"repo": "COAStatistics/aprp",
"path": "/src/apps/dailytrans/builders/amis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: COAStatistics/aprp path: /src/apps/dailytrans/builders/amis.py
from django.db.models import Q
import datetime
import json
from xml.etree import ElementTree
from .utils import date_transfer
from .abstract import AbstractApi
from apps.dailytrans.models import DailyTran
class Api(AbstractApi):
... | code_fim | hard | {
"lang": "python",
"repo": "COAStatistics/aprp",
"path": "/src/apps/dailytrans/builders/amis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: camm/vizmdend path: /vizmdend/ui_vizmdend.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './vizmdend.ui'
#
# Created: Sun Nov 3 18:22:24 2013
# by: PyQt4 UI code generator 4.9.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtC... | code_fim | hard | {
"lang": "python",
"repo": "camm/vizmdend",
"path": "/vizmdend/ui_vizmdend.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def retranslateUi(self, Vizmdend):
Vizmdend.setWindowTitle(QtGui.QApplication.translate("Vizmdend", "Plot mdend", None, QtGui.QApplication.UnicodeUTF8))
self.yFieldLabel.setText(QtGui.QApplication.translate("Vizmdend", "yField", None, QtGui.QApplication.UnicodeUTF8))
self.xFiel... | code_fim | hard | {
"lang": "python",
"repo": "camm/vizmdend",
"path": "/vizmdend/ui_vizmdend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chihchunhsu/smart path: /smart/forward_model/classSpectrum.py
ion)
Examples
--------
>>> import smart
>>> path = '/path/to/reducedData'
>>> data = smart.Spectrum(name='jan19s0022', order=33, path=path)
>>> data.plot()
"""
def __init__(self, **kwargs):
self.instrument = kwargs.get('ins... | code_fim | hard | {
"lang": "python",
"repo": "chihchunhsu/smart",
"path": "/smart/forward_model/classSpectrum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chihchunhsu/smart path: /smart/forward_model/classSpectrum.py
ns_order_dict[str(self.order)]]
self.noise = np.sqrt(var[0].data[igrins_order_dict[str(self.order)]])
#self.mask = []
self.oriWave = self.wave
self.oriFlux = self.flux
self.oriNoise = self.noise
# masking out a... | code_fim | hard | {
"lang": "python",
"repo": "chihchunhsu/smart",
"path": "/smart/forward_model/classSpectrum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return np.inner(a.oriFlux, b.oriFlux)/\
(np.average(a.oriFlux)*np.average(b.oriFlux))/a.oriFlux.shape[0]
xcorr_list = []
## mask the ending pixels
self_supers2 = copy.deepcopy(self_supers)
sp_supers2 = copy.deepcopy(sp_supers)
self_supers2.wave = self_supers2.wave[1000:-1000]
se... | code_fim | hard | {
"lang": "python",
"repo": "chihchunhsu/smart",
"path": "/smart/forward_model/classSpectrum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexprengere/euler path: /002/main.py
#!/usr/bin/env python
"""
$ python main.py 4000000
4613732
"""
import sys
<|fim_suffix|>
if __name__ == '__main__':
n = int(sys.argv[1])
print(sum(i for i in fibonacci(n) if i % 2 == 0))<|fim_middle|>def fibonacci(n):
a, b = 0, 1
while Tru... | code_fim | medium | {
"lang": "python",
"repo": "alexprengere/euler",
"path": "/002/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def fibonacci(n):
a, b = 0, 1
while True:
if b > n:
break
a, b = b, a + b
yield b
if __name__ == '__main__':
n = int(sys.argv[1])
print(sum(i for i in fibonacci(n) if i % 2 == 0))<|fim_prefix|># repo: alexprengere/euler path: /002/main.py
#!/usr/bin/e... | code_fim | easy | {
"lang": "python",
"repo": "alexprengere/euler",
"path": "/002/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
n = int(sys.argv[1])
print(sum(i for i in fibonacci(n) if i % 2 == 0))<|fim_prefix|># repo: alexprengere/euler path: /002/main.py
#!/usr/bin/env python
"""
$ python main.py 4000000
4613732
"""
<|fim_middle|>import sys
def fibonacci(n):
a, b = 0, 1
while Tru... | code_fim | medium | {
"lang": "python",
"repo": "alexprengere/euler",
"path": "/002/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>url = 'https://forum.wordreference.com/forums/english-only.6/page-'
for link in range(7881,9613):
pages.append('https://forum.wordreference.com/forums/english-only.6/page-' + str(link))
#for each url we have stored
for item in pages:
print (item)
page = requests.get(item)
if page:
soup = Beautif... | code_fim | medium | {
"lang": "python",
"repo": "everestpipkin/never",
"path": "/data_scraper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#for each url we have stored
for item in pages:
print (item)
page = requests.get(item)
if page:
soup = BeautifulSoup(page.text, 'html.parser')
############HTML############
#prints out the full html of the page.
#print (soup)
for elem in soup.find_all("a", class_="PreviewTooltip"):
p... | code_fim | hard | {
"lang": "python",
"repo": "everestpipkin/never",
"path": "/data_scraper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: everestpipkin/never path: /data_scraper.py
import requests
import csv
from bs4 import BeautifulSoup, SoupStrainer
import os
from time import sleep
# Create a file to write our data to, add a headers row
f = csv.writer(open('english4.csv', 'w'))
#f.writerow(['question, answer'])
f.writerow(['tit... | code_fim | medium | {
"lang": "python",
"repo": "everestpipkin/never",
"path": "/data_scraper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> id= models.UUIDField(primary_key=True, default=uuid.uuid4, help_text="Unique ID for this book")
book= models.ForeignKey(Book, on_delete=models.CASCADE)
imprint= models.CharField(max_length=200)
due_back= models.DateField(null=True, blank=True)
LOAN_STATUS = (
... | code_fim | hard | {
"lang": "python",
"repo": "Hassanzadeh-sd/Bookshop",
"path": "/app/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hassanzadeh-sd/Bookshop path: /app/models.py
from django.db import models
from django.urls import reverse
import uuid
from datetime import date
class Genre(models.Model):
name= models.CharField(max_length=200 , help_text="Enter a book genre")
def __str__(self):
return self... | code_fim | medium | {
"lang": "python",
"repo": "Hassanzadeh-sd/Bookshop",
"path": "/app/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BRIK-Engenharia/merra path: /merra/reshuffle.py
# The MIT License (MIT)
#
# Copyright (c) 2019, TU Wien
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restri... | code_fim | hard | {
"lang": "python",
"repo": "BRIK-Engenharia/merra",
"path": "/merra/reshuffle.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument("--temporal_sampling", type=int, default=6,
help=(
"The temporal sampling of the output time series."
"Integers between 1 (1-hourly resolution) and 24"
"(daily resolution) ar... | code_fim | hard | {
"lang": "python",
"repo": "BRIK-Engenharia/merra",
"path": "/merra/reshuffle.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # define reshuffler
reshuffler = Img2Ts(input_dataset=input_dataset,
outputpath=out_path,
startdate=start_date,
enddate=end_date,
input_grid=grid,
imgbuffer=img_buffer,
... | code_fim | hard | {
"lang": "python",
"repo": "BRIK-Engenharia/merra",
"path": "/merra/reshuffle.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acutesoftware/rawdata path: /scripts/install.py
# install.py
import os
data_fldr = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + '..' + os.sep + 'rawdata' + os.sep + 'data' )
ndx_file = data_fldr + os.sep + '_index.ndx'
def main():
<|fim_suffix|>
def rebuild_index()... | code_fim | hard | {
"lang": "python",
"repo": "acutesoftware/rawdata",
"path": "/scripts/install.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
scans rawdata\data\ folders to create lookups
of all tables, column names
"""
print('Building indexes...')
print(data_fldr)
ndx = []
for root, _, files in os.walk(data_fldr):
for f in files:
if f[-3:].upper() in ['CSV','TXT']:
ndx.ext... | code_fim | medium | {
"lang": "python",
"repo": "acutesoftware/rawdata",
"path": "/scripts/install.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = assistant.message(
workspace_id=config["workspace_id"],
input={
'text': request_example["text"]
}
).get_result()
answers_output = {
"answers":[]
}
for answer in response["output"]["generic"... | code_fim | hard | {
"lang": "python",
"repo": "cosibot/cosibot-portugal-portuguese",
"path": "/scripts/python/get_watson_answers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cosibot/cosibot-portugal-portuguese path: /scripts/python/get_watson_answers.py
import json
import shutil
import os
from os.path import join, exists
from ibm_watson import AssistantV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
## Install the sdk
## pip install --upgrade "... | code_fim | hard | {
"lang": "python",
"repo": "cosibot/cosibot-portugal-portuguese",
"path": "/scripts/python/get_watson_answers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## api key from the skill
#### IAMAuthenticator({api_key})
authenticator = IAMAuthenticator('5p8sXN8Bsy4ELDisT5QySwE4EGeLy2p42HrsU2te7sYH')
assistant = AssistantV1(
version=config["version"],
authenticator=authenticator
)
## Server url
## https://cloud.ibm.com/apidocs/assistant/assistant-v2#servi... | code_fim | hard | {
"lang": "python",
"repo": "cosibot/cosibot-portugal-portuguese",
"path": "/scripts/python/get_watson_answers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FairphoneMirrors/hiccup-server path: /crashreports/tests/test_migrations.py
"""Tests for the Django database migrations."""
import logging
import os
import tempfile
from datetime import datetime, date
import pytz
from django.test import TransactionTestCase, override_settings
from django.db.migra... | code_fim | hard | {
"lang": "python",
"repo": "FairphoneMirrors/hiccup-server",
"path": "/crashreports/tests/test_migrations.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> migrate_from = [("crashreports", "0005_add_fp_staff_group")]
migrate_to = [
("crashreports", "0006_add_unique_constraints_and_drop_duplicates")
]
def test_duplicate_heartbeats_are_deleted(self):
"""Test that duplicate heartbeats are deleted after migrating."""
self... | code_fim | hard | {
"lang": "python",
"repo": "FairphoneMirrors/hiccup-server",
"path": "/crashreports/tests/test_migrations.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif argument.lower() == "internet": # Rigged "Internet" scale
num_choices = 101
num_slots = 10
print_score_fun = lambda score: \
str(score + 9000) + "%"
argument = "Internet"
else: # Normal percentage scale
num_choices = 101
num_slots = 10
print_score_fun = lambda score: ... | code_fim | hard | {
"lang": "python",
"repo": "serpis/pynik",
"path": "/plugins/scale.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: serpis/pynik path: /plugins/scale.py
# coding: utf-8
# plugin created by Merola
import random
from commands import Command
class ScaleCommand(Command):
def __init_(self):
pass
def trig_scale(self, bot, source, target, trigger, argument):
<|fim_suffix|> # Build the answer
pos = score *... | code_fim | hard | {
"lang": "python",
"repo": "serpis/pynik",
"path": "/plugins/scale.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Build the answer
pos = score * num_slots / num_choices
scale = "[" + pos*"=" + ">" + (num_slots - 1 - pos)*"-" + "] " + \
print_score_fun(score)
return "Your score on the " + argument + " scale is " + scale<|fim_prefix|># repo: serpis/pynik path: /plugins/scale.py
# coding: utf-8
# plugi... | code_fim | hard | {
"lang": "python",
"repo": "serpis/pynik",
"path": "/plugins/scale.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rsdefever/Pore-Builder path: /porebuilder/examples/solvated_pore.py
from porebuilder import GraphenePoreSolvent
import mbuild as mb
from foyer import Forcefield
<|fim_suffix|>for child in system.children:
if child.name == 'water':
water_pmd = SPCE.apply(child)
elif child.name == ... | code_fim | hard | {
"lang": "python",
"repo": "rsdefever/Pore-Builder",
"path": "/porebuilder/examples/solvated_pore.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>system = GraphenePoreSolvent(pore_depth=4, side_dim=4, n_sheets=3,
pore_width=1.2, x_bulk=3, solvent=[water, acn],
n_solvent=[1, 1])
box = mb.Box(system.periodicity)
for child in system.children:
if child.name == 'water':
water_pmd = ... | code_fim | hard | {
"lang": "python",
"repo": "rsdefever/Pore-Builder",
"path": "/porebuilder/examples/solvated_pore.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>system = water_pmd + acn_pmd + pore_pmd
system.box[:3] = box.maxs * 10.0
system.save('solvated_pore.gro', overwrite=True)
system.save('solvated_pore.top', overwrite=True, combine='all')<|fim_prefix|># repo: rsdefever/Pore-Builder path: /porebuilder/examples/solvated_pore.py
from porebuilder import Graphe... | code_fim | hard | {
"lang": "python",
"repo": "rsdefever/Pore-Builder",
"path": "/porebuilder/examples/solvated_pore.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def bounds(self):
return self._bounds
def set_bounds(self):
bounds = []
for key in sorted(self.hptuning_config.matrix.keys()):
value = self.hptuning_config.matrix[key]
self._features.append(key)
# one hot encoding for categ... | code_fim | hard | {
"lang": "python",
"repo": "rsumner868/polyaxon",
"path": "/polyaxon/hpsearch/search_managers/bayesian_optimization/space.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rsumner868/polyaxon path: /polyaxon/hpsearch/search_managers/bayesian_optimization/space.py
import logging
import numpy as np
from schemas.hptuning import Optimization
_logger = logging.getLogger('polyaxon.hpsearch.search_managers')
class SearchSpace(object):
def __init__(self, hptuning_c... | code_fim | hard | {
"lang": "python",
"repo": "rsumner868/polyaxon",
"path": "/polyaxon/hpsearch/search_managers/bayesian_optimization/space.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dragoncall/GPflowOpt path: /testing/unit/test_design.py
import gpflowopt
import numpy as np
import os
from ..utility import GPflowOptTestCase
class _TestDesign(object):
@property
def designs(self):
raise NotImplementedError()
@property
def domains(self):
create... | code_fim | hard | {
"lang": "python",
"repo": "Dragoncall/GPflowOpt",
"path": "/testing/unit/test_design.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [gpflowopt.design.EmptyDesign(domain) for domain in self.domains]
class TestFactorialDesign(_TestDesign, GPflowOptTestCase):
@_TestDesign.designs.getter
def designs(self):
return [gpflowopt.design.FactorialDesign(4, domain) for domain in self.domains]
def test_validit... | code_fim | hard | {
"lang": "python",
"repo": "Dragoncall/GPflowOpt",
"path": "/testing/unit/test_design.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if good_weather: # Will execute if good_weather == True
if temp >= SHORTS_THRESHOLD:
print('Fabulous news! It is nice enough outside to wear shorts! Rock a clean tee and get outside!')
elif temp <= JACKET_THRESHOLD:
print('Better bundle up, if you have to go outside definitely bri... | code_fim | hard | {
"lang": "python",
"repo": "fordham-css/TryPy",
"path": "/Tutorials/jeeves.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fordham-css/TryPy path: /Tutorials/jeeves.py
'''
jeeves.py
----------
Robot to suggest outfit based on the weather
- Variables
- Conditionals
----------
Python Demo Workshop, March 22nd 2017
'''
#### Declaring variables in Python
# Good news: No need to lock variable to a type!
# Bad news... | code_fim | hard | {
"lang": "python",
"repo": "fordham-css/TryPy",
"path": "/Tutorials/jeeves.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>condition = raw_input('Now would you say it is clear, cloudy, or overcast?\n > ')
# Error Checking on condition
condition = condition.lower() # For the purposes of comparison
if condition != 'clear' and condition != 'cloudy' and condition != 'overcast':
print('You are being ridiculous..\nI shall not ... | code_fim | hard | {
"lang": "python",
"repo": "fordham-css/TryPy",
"path": "/Tutorials/jeeves.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> prots = [a for a in cdf.columns if 'proteomics' in a[0]]
if len(prots) == 0:
prots = [a for a in cdf.columns if 'proteomics' in a]
norm_rows = cdf.loc[cdf['Sample_Tumor_Normal'] == 'Normal'][prots]
norm_means = np.zeros(len(norm_rows.columns))
if len(n... | code_fim | hard | {
"lang": "python",
"repo": "sgosline/hyphalnet",
"path": "/bin/proteomicsData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Get cancer data from cptac, computes differentially expressed proteins between
tumor and pooled normal samples
'''
##these are the primary dictionaries to return
tumNormDiffs = {} #dictionary of top `qThresh`
for ct, dat in fdict.items():
if byType:
tumN... | code_fim | hard | {
"lang": "python",
"repo": "sgosline/hyphalnet",
"path": "/bin/proteomicsData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sgosline/hyphalnet path: /bin/proteomicsData.py
'''
This script uses the cptac data package and to build a reference set of signatures
We also compute the distances between patients and the communities from the reference signatures
and compute the GO enrichment
'''
import pandas as pd
import os
... | code_fim | hard | {
"lang": "python",
"repo": "sgosline/hyphalnet",
"path": "/bin/proteomicsData.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: svamol/testplan path: /testplan/testing/multitest/driver/base.py
"""Driver base classes module."""
import os
import logging
from schema import Or
from testplan.common.config import ConfigOption
from testplan.common.entity import Resource, ResourceConfig, FailedAction
from testplan.common.utils... | code_fim | hard | {
"lang": "python",
"repo": "svamol/testplan",
"path": "/testplan/testing/multitest/driver/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> err += format_regexp_matches(
name="stderr_regexps",
regexps=self.cfg.stderr_regexps,
unmatched=stderr_unmatched,
)
if self.extracts:
err += "{newline}Matching groups:{newline}".format(
... | code_fim | hard | {
"lang": "python",
"repo": "svamol/testplan",
"path": "/testplan/testing/multitest/driver/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Trigger driver abort."""
self._close_file_logger()
def context_input(self):
"""Driver context information."""
return {attr: getattr(self, attr) for attr in dir(self)}
@property
def logpath(self):
"""Path for log regex matching."""
return sel... | code_fim | hard | {
"lang": "python",
"repo": "svamol/testplan",
"path": "/testplan/testing/multitest/driver/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> id: UUID4
is_active: bool
class Config:
orm_mode = True<|fim_prefix|># repo: Deepankar01/ecom-python path: /backend/app/schemas/user.py
from uuid import uuid4
from hashlib import sha256
from typing import List
from pydantic import BaseModel, UUID4
class UserBase(BaseModel):
<|fim_m... | code_fim | hard | {
"lang": "python",
"repo": "Deepankar01/ecom-python",
"path": "/backend/app/schemas/user.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Deepankar01/ecom-python path: /backend/app/schemas/user.py
from uuid import uuid4
from hashlib import sha256
from typing import List
from pydantic import BaseModel, UUID4
<|fim_suffix|>class UserCreate(UserBase):
password: str
@property
def id_hash(self):
return uuid4().hex
... | code_fim | medium | {
"lang": "python",
"repo": "Deepankar01/ecom-python",
"path": "/backend/app/schemas/user.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _make_io_report(self):
"""
записывает в io_report отчет в строковом виде
"""
self.io_report.write(tabulate.tabulate(self.data_report, self.headers))
def make_report(self):
"""
Сформировать отчёт
"""
print(self.io_report.getvalue(... | code_fim | hard | {
"lang": "python",
"repo": "Dakhnovskiy/linguistic_analyzer_projects",
"path": "/analyzer_project/report/console_report.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dakhnovskiy/linguistic_analyzer_projects path: /analyzer_project/report/console_report.py
# -*- coding: utf-8 -*-
__author__ = 'Dmitriy.Dakhnovskiy'
import tabulate
from .abstract_report import AbstractReport
class ConsoleReport(AbstractReport):
def __init__(self, data_report, headers):
<|... | code_fim | medium | {
"lang": "python",
"repo": "Dakhnovskiy/linguistic_analyzer_projects",
"path": "/analyzer_project/report/console_report.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> confusion_matrix = torch.zeros(n_classes, n_classes)
correct = total = 0
with torch.no_grad():
for j, (inputs, labels) in enumerate(test_loader, 0):
progress_bar.update()
inputs = inputs.to(device=device)
labels = labels.to(device=device)
... | code_fim | hard | {
"lang": "python",
"repo": "KASCedric/PointNet",
"path": "/src/evaluate.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KASCedric/PointNet path: /src/evaluate.py
import torch
import numpy as np
import fire
from pathlib import Path
import os
import json
from tqdm import tqdm
from dataloader import semantic_kitti_dataloader
from model import PointNetSemSeg
from utils import load_model, save_eval
# Setting up a ra... | code_fim | hard | {
"lang": "python",
"repo": "KASCedric/PointNet",
"path": "/src/evaluate.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> path = Path(os.getenv('PYTHONPATH'))
pdf_file = os.path.join(path, "tests/data/test.pdf")
csv_file = os.path.join(path, "tests/data/test-pages.csv")
stats = [0, 0]
pages = pdf_parser.parse_pdf(pdf_file, False, stats)
pdfUtil.save_pdf_pages_tocsv("test.pdf", pages, csv_file)
ass... | code_fim | medium | {
"lang": "python",
"repo": "chengliwang/pdf-field-detection",
"path": "/app/tests/app/pdf/test_pdfUtil.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chengliwang/pdf-field-detection path: /app/tests/app/pdf/test_pdfUtil.py
from pdf import pdfUtil
from pdf import pdf_parser
import os
from pathlib import Path
import pandas as pd
def test_markup_pdf(mocker):
<|fim_suffix|> path = Path(os.getenv('PYTHONPATH'))
data_file = os.path.join(path... | code_fim | hard | {
"lang": "python",
"repo": "chengliwang/pdf-field-detection",
"path": "/app/tests/app/pdf/test_pdfUtil.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Skip self-loops
if source['id_parent'] == target['id_parent']:
continue
# Smaller id first (no direction)
if source['id'] > target['id']:
source, target = target, source
comention = {
'source': ... | code_fim | hard | {
"lang": "python",
"repo": "cns-iu/myaura",
"path": "/twitter/src/02-count_comentions_samepost.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cns-iu/myaura path: /twitter/src/02-count_comentions_samepost.py
# coding=utf-8
# Author: Rion B Correia & Wuan Wang
# Date: Jan 07, 2021
#
# Description: Loads the Mention file and builds Co-Mentions over the same post
#
import os
import sys
#
include_path = os.path.abspath(os.path.join(os.path.... | code_fim | hard | {
"lang": "python",
"repo": "cns-iu/myaura",
"path": "/twitter/src/02-count_comentions_samepost.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: osadio/mercury_mso_framework path: /mercury/fog_model/access_points/ap/access_and_control.py
rt AccessRequest, AccessResponse, RadioResourceControl
from ...common.packet.apps.ran.ran_access import DisconnectRequest, DisconnectResponse
from ...common.packet.apps.ran.ran_access_control import Creat... | code_fim | hard | {
"lang": "python",
"repo": "osadio/mercury_mso_framework",
"path": "/mercury/fog_model/access_points/ap/access_and_control.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: osadio/mercury_mso_framework path: /mercury/fog_model/access_points/ap/access_and_control.py
ps.ran.ran_access import DisconnectRequest, DisconnectResponse
from ...common.packet.apps.ran.ran_access_control import CreatePathRequest, RemovePathRequest, SwitchPathRequest
from ...common.packet.apps.r... | code_fim | hard | {
"lang": "python",
"repo": "osadio/mercury_mso_framework",
"path": "/mercury/fog_model/access_points/ap/access_and_control.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _process_access_messages(self):
overhead_xh = logging_overhead(self._clock, self.LOGGING_FROM_CROSSHAUL)
overhead_ue = logging_overhead(self._clock, self.LOGGING_FROM_UE)
# Process Create path responses from AMF
if not self.simple:
for job in self.input_... | code_fim | hard | {
"lang": "python",
"repo": "osadio/mercury_mso_framework",
"path": "/mercury/fog_model/access_points/ap/access_and_control.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Create superuser from using create_user function
"""
if password is None:
raise ValueError('Password should not be none')
# Creating user instance and saving it to database
user = self.create_user(username, email, password)
# Assign... | code_fim | hard | {
"lang": "python",
"repo": "rijalanupraj/user-authentication-api-django",
"path": "/user/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
"""
Returns User's id and username
"""
return f"{self.id} | {self.username}"
def tokens(self):
""" Genreate Access and Refresh Token for current user """
user_token = RefreshToken.for_user(self)
return {
'refre... | code_fim | hard | {
"lang": "python",
"repo": "rijalanupraj/user-authentication-api-django",
"path": "/user/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rijalanupraj/user-authentication-api-django path: /user/models.py
# External Import
from django.db import models
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
PermissionsMixin,
)
from rest_framework_simplejwt.tokens import RefreshToken
class UserManager... | code_fim | hard | {
"lang": "python",
"repo": "rijalanupraj/user-authentication-api-django",
"path": "/user/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run_step(self, update_pointers, st=None):
for k in self.inputs:
self.sum_in_variable(k, self.inputs[k], st=st)
# # retrieve all buffers into a linear array
# for k in self.inputs:
# self.retrieve_buffer(k, st=st)
self.update_func.prepared_asy... | code_fim | hard | {
"lang": "python",
"repo": "FlyBrainLab/OlfTrans",
"path": "/olftrans/neurodriver/NDComponents/OTP.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FlyBrainLab/OlfTrans path: /olftrans/neurodriver/NDComponents/OTP.py
# pylint:disable=no-member
import os
from collections import OrderedDict
import numpy as np
import pycuda.gpuarray as garray
from pycuda.tools import dtype_to_ctype
import pycuda.driver as cuda
from pycuda.compiler import Source... | code_fim | hard | {
"lang": "python",
"repo": "FlyBrainLab/OlfTrans",
"path": "/olftrans/neurodriver/NDComponents/OTP.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def enqueue(self, action, instance, sender, **kwargs):
"""
Given an individual model instance, determine if a backend
handles the model, check if the index is Celery-enabled and
enqueue task.
"""
using_backends = self.connection_router.for_write(instance... | code_fim | medium | {
"lang": "python",
"repo": "django-haystack/celery-haystack",
"path": "/celery_haystack/signals.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: django-haystack/celery-haystack path: /celery_haystack/signals.py
from django.db.models import signals
from haystack.signals import BaseSignalProcessor
from haystack.exceptions import NotHandled
from .utils import enqueue_task
from .indexes import CelerySearchIndex
class CelerySignalProcessor... | code_fim | hard | {
"lang": "python",
"repo": "django-haystack/celery-haystack",
"path": "/celery_haystack/signals.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: noisebridge/PythonClass path: /guest-talks/20171204-profiling/001-string-concat.py
def lowercase(string):
return string.lower()
# Concatenate using a loop
def concat_loop(strings):
<|fim_suffix|> return ','.join([lowercase(string) for string in strings]) # !
# Read in the system dicti... | code_fim | medium | {
"lang": "python",
"repo": "noisebridge/PythonClass",
"path": "/guest-talks/20171204-profiling/001-string-concat.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Read in the system dictionary and produce a comma-separated
# list of lowercase words
strings = open('/usr/share/dict/words').readlines()
concat_loop(strings)
concat_join(strings)<|fim_prefix|># repo: noisebridge/PythonClass path: /guest-talks/20171204-profiling/001-string-concat.py
def lowercase(strin... | code_fim | medium | {
"lang": "python",
"repo": "noisebridge/PythonClass",
"path": "/guest-talks/20171204-profiling/001-string-concat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> The shape is the number of times greater than linear speed the
middle vector travels.
A shape of 1.0 is a linear interpolation. A shape of 2.0 has
slower vectors at the end and a vector in the middle traveling
... | code_fim | hard | {
"lang": "python",
"repo": "tobykurien/rpi_lcars",
"path": "/app/ui/utils/interpolator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if start is None:
start = (0, 0)
if stop is None:
self.stop = start
else:
if (seconds is None) or (fps is None):
raise ValueError("You must specify both 'seconds' and 'fps'")
if shape <= 0.0:
raise Val... | code_fim | hard | {
"lang": "python",
"repo": "tobykurien/rpi_lcars",
"path": "/app/ui/utils/interpolator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tobykurien/rpi_lcars path: /app/ui/utils/interpolator.py
"""
interpolator.py
Perform a simple interpolation between two points of any dimention, without
the use of Numeric.
2007 Michael Thomas Greer
Released to the Public Domain
"""
class Interpolator(object):
"""
The line actor. ... | code_fim | hard | {
"lang": "python",
"repo": "tobykurien/rpi_lcars",
"path": "/app/ui/utils/interpolator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rronan/pyronan path: /pyronan/transform.py
from argparse import ArgumentParser
import albumentations
import cv2
parser_transform = ArgumentParser(add_help=False)
parser_transform.add_argument("--augmentation_list", nargs="+", default=[])
parser_transform.add_argument("--shift_limit", type=float... | code_fim | hard | {
"lang": "python",
"repo": "rronan/pyronan",
"path": "/pyronan/transform.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> transforms = []
for transform_name in args.augmentation_list:
if transform_name == "HorizontalFlip":
transform = albumentations.HorizontalFlip(p=0.5)
elif transform_name == "VerticalFlip":
transform = albumentations.VerticalFlip(p=0.5)
elif transform... | code_fim | hard | {
"lang": "python",
"repo": "rronan/pyronan",
"path": "/pyronan/transform.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># 다른 url정보도 확인해보자.
print('='*50)
r = requests.get('https://codingeverybody.github.io/scraping_sample/2.html')
soup = BeautifulSoup(r.text, 'html.parser')
print('Title : '+soup.title.string)
articles = soup.findAll('div', {'class' : 'strong'})
print('Article : '+articles[0].text)
# 추가적인 웹크로링 공부 => 웹크롤링 ... | code_fim | hard | {
"lang": "python",
"repo": "dongrami0425/opentutorials_python_basic",
"path": "/opentutorials_python2/opentutorials_python2/22_Pakage_Manager/2_Crawling_by_using_pakage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dongrami0425/opentutorials_python_basic path: /opentutorials_python2/opentutorials_python2/22_Pakage_Manager/2_Crawling_by_using_pakage.py
# < Python의 패키지 메니저를 이용해서 크롤링하는 방법 >
# 크롤링 이란?[참고]
# - Web상에 존재하는 Contents를 수집하는 작업 (프로그래밍으로 자동화 가능)
# - HTML 페이지를 가져와서, HTML/CSS등을 파싱(parsing)하고, 필요한 데이터만 추... | code_fim | medium | {
"lang": "python",
"repo": "dongrami0425/opentutorials_python_basic",
"path": "/opentutorials_python2/opentutorials_python2/22_Pakage_Manager/2_Crawling_by_using_pakage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># 출력결과
'''
<!doctype html>
<html>
<head>
<title>sample1</title>
</head>
<body>
<div class="em">important information 1</div>
</body>
</html>
'''
# 이제 가져온 정보를 분석해보자.
# 크롬에서 python3 html parser library 검색 => 분석에 필요한 라이브러리 정보를 알아본다.
# Beautiful Soup Documentation 을 통해 사용법, 설치법 확인
# (또는 pypi 사이트에 들어... | code_fim | hard | {
"lang": "python",
"repo": "dongrami0425/opentutorials_python_basic",
"path": "/opentutorials_python2/opentutorials_python2/22_Pakage_Manager/2_Crawling_by_using_pakage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haakonvt/cognite-sdk-python path: /cognite/client/utils/_auxiliary.py
"""Utilities for Cognite API SDK
This module provides helper methods and different utilities for the Cognite API Python SDK.
This module is protected and should not used by end-users.
"""
import functools
import heapq
import ... | code_fim | hard | {
"lang": "python",
"repo": "haakonvt/cognite-sdk-python",
"path": "/cognite/client/utils/_auxiliary.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PriorityQueue:
def __init__(self) -> None:
self.__heap: List[Any] = []
self.__id = 0
def add(self, elem: Any, priority: int) -> None:
heapq.heappush(self.__heap, (-priority, self.__id, elem))
self.__id += 1
def get(self) -> Any:
_, _, elem = heap... | code_fim | hard | {
"lang": "python",
"repo": "haakonvt/cognite-sdk-python",
"path": "/cognite/client/utils/_auxiliary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tevang/keras-neural-graph-fingerprint path: /utils.py
''' Utilities for loading the sample data
# Source
Imported from https://github.com/GUR9000/KerasNeuralFingerprint/blob/8f50d80/KerasNeuralfingerprint/utils.py
# Copyright
This code is governed by the licence at:
https://github.com/GUR90... | code_fim | hard | {
"lang": "python",
"repo": "tevang/keras-neural-graph-fingerprint",
"path": "/utils.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.