text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>##########################################################
# My code
def make_er_graph(num_nodes, probability):
""" int, int -> dict
Takes an integer and a probabilty and returns a dictionary of a
complete digraph containing that many nodes.
"""
graph = {}
for node in range(0, nu... | code_fim | hard | {
"lang": "python",
"repo": "znalbert/alg_think_mod_2",
"path": "/assignment2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: znalbert/alg_think_mod_2 path: /assignment2.py
"""
Provided code for Application portion of Module 2
"""
import urllib2
import random
import time
import math
import matplotlib.pyplot as plt
import upa_trial as upa
import graph_operations as go
############################################
# Prov... | code_fim | hard | {
"lang": "python",
"repo": "znalbert/alg_think_mod_2",
"path": "/assignment2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.legend(loc='upper right')
plt.ylabel('Size of Largest Connected Component')
plt.xlabel('Number of Nodes Removed')
plt.grid(True)
plt.title('Comparison of Graph Resilience\nMeasured by Largest Connected Component vs Nodes Removed by Target Attack\n')
plt.show()
def fast_target... | code_fim | hard | {
"lang": "python",
"repo": "znalbert/alg_think_mod_2",
"path": "/assignment2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pcrama/rikiki path: /test/models/test_card.py
import pytest # type: ignore
from app.models import (Card, beats, card_allowed, same_suit)
def test_same_suit__examples():
assert same_suit(Card.Heart2, Card.HeartKing)
assert same_suit(Card.Spade7, Card.Spade10)
assert same_suit(Card.... | code_fim | hard | {
"lang": "python",
"repo": "pcrama/rikiki",
"path": "/test/models/test_card.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Anything is allowed as first card on the table
assert card_allowed(Card.Heart2,
hand=[Card.Heart2, Card.Diamond7, Card.SpadeAce],
table=[])
# Must follow suit of first played card, with or without trump
assert card_allowed(
Card.Hea... | code_fim | hard | {
"lang": "python",
"repo": "pcrama/rikiki",
"path": "/test/models/test_card.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_card_allowed__examples():
# Anything is allowed as first card on the table
assert card_allowed(Card.Heart2,
hand=[Card.Heart2, Card.Diamond7, Card.SpadeAce],
table=[])
# Must follow suit of first played card, with or without trump
a... | code_fim | hard | {
"lang": "python",
"repo": "pcrama/rikiki",
"path": "/test/models/test_card.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lewismc/incubator-senssoft-tap path: /app_mgr/migrations/0003_auto_20160629_0112.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-29 05:12
from __future__ import unicode_literals
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('auth', '0007_al... | code_fim | medium | {
"lang": "python",
"repo": "lewismc/incubator-senssoft-tap",
"path": "/app_mgr/migrations/0003_auto_20160629_0112.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='organization',
name='admin_group',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='admins_of', to='auth.Group'),
),
migrations.AddField(
... | code_fim | medium | {
"lang": "python",
"repo": "lewismc/incubator-senssoft-tap",
"path": "/app_mgr/migrations/0003_auto_20160629_0112.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> client.force_login(user_staff)
url = reverse('locations-create')
response = client.get(url)
assert response.status_code == 200
assert response.context['form'].initial.get('agency') == user_staff.agency
@pytest.mark.django_db
def test_location_list(client, user_staff, location, locat... | code_fim | hard | {
"lang": "python",
"repo": "datamade/just-spaces",
"path": "/tests/test_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.django_db
def test_survey_edit_observational(client, user_staff, survey_form_entry_observational, form_element_observational):
client.force_login(user_staff)
url = reverse('fobi.edit_form_entry', kwargs={'form_entry_id': survey_form_entry_observational.id})
response = client.get(u... | code_fim | hard | {
"lang": "python",
"repo": "datamade/just-spaces",
"path": "/tests/test_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: datamade/just-spaces path: /tests/test_views.py
import uuid
from urllib.parse import urlencode
import pytest
from django.urls import reverse
from django.forms.widgets import HiddenInput, CheckboxInput
from pldp.forms import AGE_COMPLEX_CHOICES
from pldp.models import SurveyComponent
from survey... | code_fim | hard | {
"lang": "python",
"repo": "datamade/just-spaces",
"path": "/tests/test_views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> onnx2tensorrt = PIPELINE_MANAGER.register_pipeline()(_onnx2tensorrt)
__all__ += ['onnx2tensorrt']
except Exception:
pass<|fim_prefix|># repo: open-mmlab/mmdeploy path: /mmdeploy/apis/tensorrt/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from mmdeploy.backend.ten... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmdeploy",
"path": "/mmdeploy/apis/tensorrt/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-mmlab/mmdeploy path: /mmdeploy/apis/tensorrt/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from mmdeploy.backend.tensorrt import is_available
from ..core import PIPELINE_MANAGER
<|fim_suffix|> onnx2tensorrt = PIPELINE_MANAGER.register_pipeline()(_onnx2tensorrt)
... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmdeploy",
"path": "/mmdeploy/apis/tensorrt/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jerry-xiazj/EfficientDet path: /efficientDet_builder.py
from core import EfficientNet
from core import BiFPN
import tensorflow as tf
_DEFAULT_BLOCKS_ARGS = [
EfficientNet.BlockArgs(kernel_size=2,
num_repeat=1,
input_filters=32,
... | code_fim | hard | {
"lang": "python",
"repo": "jerry-xiazj/EfficientDet",
"path": "/efficientDet_builder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> name,
config,
features_only=False,
pooled_features_only=False,
**kwargs):
if kwargs:
config.override(kwargs)
logging.info(config)
# build backbone features.
backbone_name = efficientdet_model_param_di... | code_fim | hard | {
"lang": "python",
"repo": "jerry-xiazj/EfficientDet",
"path": "/efficientDet_builder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>emplates/*", "azure_templates/*"]},
}
setup(**args)<|fim_prefix|># repo: RoboStack/vinca path: /setup.py
from setuptools import find_packages, setup
args =<|fim_middle|> {
"include_package_data": True,
"packages": find_packages(),
"package_data": {"vinca": ["t | code_fim | medium | {
"lang": "python",
"repo": "RoboStack/vinca",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RoboStack/vinca path: /setup.py
from setuptools import find_packages, setup
args =<|fim_suffix|> find_packages(),
"package_data": {"vinca": ["templates/*", "azure_templates/*"]},
}
setup(**args)<|fim_middle|> {
"include_package_data": True,
"packages": | code_fim | easy | {
"lang": "python",
"repo": "RoboStack/vinca",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rocksnow1942/mymodule path: /mymodule/RNAstructure/RNAstructure_wrap.py
error, 5 = error reading
thermodynamic parameter files, 14 = traceback error).
"""
return _RNAstructure_wrap.HybridRNA_AccessFold(self, gamma, percent, maximumstructures, window, maxinternalloopsize)
... | code_fim | hard | {
"lang": "python",
"repo": "rocksnow1942/mymodule",
"path": "/mymodule/RNAstructure/RNAstructure_wrap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, *args):
this = _RNAstructure_wrap.new_StringVector(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def push_back(self, x):
return _RNAstructure_wrap.StringVector_push_back(self, x)
de... | code_fim | hard | {
"lang": "python",
"repo": "rocksnow1942/mymodule",
"path": "/mymodule/RNAstructure/RNAstructure_wrap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> The RNA class provides an entry point for all the single sequence
operations of RNAstructure.
C++ includes: RNA.h
"""
__swig_setmethods__ = {}
for _s in [Thermodynamics]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, na... | code_fim | hard | {
"lang": "python",
"repo": "rocksnow1942/mymodule",
"path": "/mymodule/RNAstructure/RNAstructure_wrap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GDG-Buea/learn-python path: /chpt7/N_sided_regular_polygon.py
# This program displays the perimeter and area of three regular polygons
#
# An n-sided regular polygon’s sides all have the same length and all of its angles have the same degree
# (i.e., the polygon is both equilateral and equiangula... | code_fim | hard | {
"lang": "python",
"repo": "GDG-Buea/learn-python",
"path": "/chpt7/N_sided_regular_polygon.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_length_of_side(self):
return self.__var2
def get_x_center_axis(self):
return self.__var3
def get_y__center_axis(self):
return self.__var4
def set_number_of_sides(self, number_of_sides):
self.__var1 = number_of_sides
def set_length_of_side(sel... | code_fim | hard | {
"lang": "python",
"repo": "GDG-Buea/learn-python",
"path": "/chpt7/N_sided_regular_polygon.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
hexagon = RegularPolygon(6, 4)
decagon = RegularPolygon(10, 4, 5.6, 7.8)
print()
print("__________________________________________________________________________________________")
print()
print("Polygon one:\tnumber of sides=", hexagon.get_number_of_sides(), "\t\tle... | code_fim | hard | {
"lang": "python",
"repo": "GDG-Buea/learn-python",
"path": "/chpt7/N_sided_regular_polygon.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vsbogd/language-learning path: /src/common/pearson_coeff.py
#!/usr/bin/env python
# ASuMa, Mar 2018
# Read data from files, calculate and plot Parson's coefficient
# See main() documentation below for usage details
import platform
import getopt, sys
import matplotlib.pyplot as plt
import numpy ... | code_fim | hard | {
"lang": "python",
"repo": "vsbogd/language-learning",
"path": "/src/common/pearson_coeff.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Usage: ./PearsonsCoeff.py -l <LG file> -d <distance file>
-n <no-distance file> -p <plotfile>
LG file file with LG any fmi
distance file file with window distance fmi
no-distance file file with window no-distance fmi
plotfile ... | code_fim | hard | {
"lang": "python",
"repo": "vsbogd/language-learning",
"path": "/src/common/pearson_coeff.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webclinic017/framework path: /uvicore/typing/__init__.py
# type: ignore
from typing import *
from .dictionary import Dict, OrderedDict
try:
from starlette.types import Scope, Message, Receive, Send, ASGIApp
except:
Scope = None
Message = None
Receive = None
Send = None
ASG... | code_fim | hard | {
"lang": "python",
"repo": "webclinic017/framework",
"path": "/uvicore/typing/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># # If key does exist but is None AND starts with __
# if not ret and key.startswith("__"):
# raise AttributeError()
# # Key exists, even None, return value
# return ret
# def __setattr__(self, key, value):
# self[key] = value
# def __getstate... | code_fim | hard | {
"lang": "python",
"repo": "webclinic017/framework",
"path": "/uvicore/typing/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
The Character defaults to implementing some of its hook methods with the
following standard functionality:
at_basetype_setup - always assigns the DefaultCmdSet to this object type
(important!)sets locks so character cannot be picked up
and its c... | code_fim | medium | {
"lang": "python",
"repo": "nobodxbodon/muddery",
"path": "/muddery/game_templates/example_cn/typeclasses/player_character.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nobodxbodon/muddery path: /muddery/game_templates/example_cn/typeclasses/player_character.py
"""
Player Characters
Player Characters are (by default) Objects setup to be puppeted by Players.
They are what you "see" in game. The Character class in this module
is setup to be the "default" characte... | code_fim | medium | {
"lang": "python",
"repo": "nobodxbodon/muddery",
"path": "/muddery/game_templates/example_cn/typeclasses/player_character.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MingSun-KAUST/joint_sparse_algorithms path: /cs_algorithms/greedy/cosamp.py
import numpy as np
import cs_algorithms.utils as ut
from cs_algorithms.greedy.greedyalgorithm import GreedyAlgorithm
class COSAMP(GreedyAlgorithm):
<|fim_suffix|> # Step 1: Form signal proxy
correlation = ... | code_fim | hard | {
"lang": "python",
"repo": "MingSun-KAUST/joint_sparse_algorithms",
"path": "/cs_algorithms/greedy/cosamp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Step 4: Signal estimation via least squares
x_kk = ut.least_squares(y=self.measurements, A=self.A[:, self.support_sol], lsqr_meth=self.lsqr_meth.lower())
self.sol[self.support_sol] = x_kk
# Step 5: Signal pruning
self.sol, self.support_sol = ut.pruning(z=self.sol... | code_fim | hard | {
"lang": "python",
"repo": "MingSun-KAUST/joint_sparse_algorithms",
"path": "/cs_algorithms/greedy/cosamp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wq/django-data-wizard path: /tests/celery.py
from __future__ import absolute_import
import os
<|fim_suffix|> app = Celery("tests")
app.config_from_object("django.conf:settings")
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)<|fim_middle|>if os.environ.get("TEST_BACKEND") == "... | code_fim | medium | {
"lang": "python",
"repo": "wq/django-data-wizard",
"path": "/tests/celery.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> app = Celery("tests")
app.config_from_object("django.conf:settings")
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)<|fim_prefix|># repo: wq/django-data-wizard path: /tests/celery.py
from __future__ import absolute_import
import os
<|fim_middle|>if os.environ.get("TEST_BACKEND") == "... | code_fim | medium | {
"lang": "python",
"repo": "wq/django-data-wizard",
"path": "/tests/celery.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scharlau/polar_bears_p path: /polar_bears.py
import sqlite3
from flask import Flask, render_template
app = Flask(__name__)
<|fim_suffix|> # open the connection to the database
conn = sqlite3.connect('polar_bear_data.db')
conn.row_factory = sqlite3.Row
cur = conn.cursor()
cur.... | code_fim | easy | {
"lang": "python",
"repo": "scharlau/polar_bears_p",
"path": "/polar_bears.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> # open the connection to the database
conn = sqlite3.connect('polar_bear_data.db')
conn.row_factory = sqlite3.Row
cur = conn.cursor()
cur.execute("select * from deployments")
rows = cur.fetchall()
conn.close()
return render_template('index.html', rows=rows)<|fim_prefix|># r... | code_fim | easy | {
"lang": "python",
"repo": "scharlau/polar_bears_p",
"path": "/polar_bears.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: obastani/covid19demographics-fall path: /code/env/lib/python3.7/site-packages/tesseract/__init__.py
#!/usr/bin/python
"""
tesseract
=========
A package for measuring the concentration of halos from Nbody simulations
non-parametrically using Voronoi tessellation.
Subpackages
-----------
voro
... | code_fim | hard | {
"lang": "python",
"repo": "obastani/covid19demographics-fall",
"path": "/code/env/lib/python3.7/site-packages/tesseract/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
# Basic dependencies
import ConfigParser
import os
import shutil
# Initialize config file
_config_file_def = os.path.join(os.path.dirname(__file__),"default_config.ini")
_config_file_usr = os.path.expanduser("~/.tessrc")
if not os.path.isfile(_config_file_usr):
print 'Creating user config file: ... | code_fim | hard | {
"lang": "python",
"repo": "obastani/covid19demographics-fall",
"path": "/code/env/lib/python3.7/site-packages/tesseract/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: siva-bathula/Brilliant path: /packages/Python/source-archive/pyprimes/src/pyprimes/utilities.py
# -*- coding: utf-8 -*-
## Part of the pyprimes.py package.
##
## Copyright © 2014 Steven D'Aprano.
## See the file __init__.py for the licence terms for this software.
from __future__ import divi... | code_fim | hard | {
"lang": "python",
"repo": "siva-bathula/Brilliant",
"path": "/packages/Python/source-archive/pyprimes/src/pyprimes/utilities.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> E.g. given a mapping ``{"frob": MethodStats(250, 357, 993)}``,
that indicates that the method ``frob`` determined the primality of its
argument 250 times (not necessarily distinct arguments), with the
smallest such argument being 357 and the largest being 993.
"""
def __init__(sel... | code_fim | hard | {
"lang": "python",
"repo": "siva-bathula/Brilliant",
"path": "/packages/Python/source-archive/pyprimes/src/pyprimes/utilities.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class MethodStats(object):
"""Statistics for individual methods of ``is_probably_prime``.
Instances are intended to be mapped to a method name in a dict, where
they record how often the method was able to conclusively determine
the primality of its argument (that is, by returning 0 or 1 ... | code_fim | hard | {
"lang": "python",
"repo": "siva-bathula/Brilliant",
"path": "/packages/Python/source-archive/pyprimes/src/pyprimes/utilities.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Plot The Memory Addresses
plt.figure(num=None, figsize=(5.5, 4), dpi=80, facecolor='w', edgecolor='k')
ax = plt.subplot(111)
ax.scatter(ADDRESSx, ADDRESS1, c='k', label='Byte 0', edgecolor='none', s=30)
ax.scatter(ADDRESSx + 1, ADDRESS2, c='k', marker="^", label='Byte 1', edgecolor='none', s=30)
ax.s... | code_fim | hard | {
"lang": "python",
"repo": "k8edev/aslr-overflow",
"path": "/ASLRestima/flatten64.addresses.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: k8edev/aslr-overflow path: /ASLRestima/flatten64.addresses.py
"""
Plot Addresses
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.font_manager import FontProperties
if len(sys.argv) != 5:
print "Usage: python flatten64.ad... | code_fim | medium | {
"lang": "python",
"repo": "k8edev/aslr-overflow",
"path": "/ASLRestima/flatten64.addresses.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if (len(sys.argv) == 5):
yLabel = sys.argv[3]
title = sys.argv[4]
plt.xlabel(xLabel)
plt.ylabel(yLabel)
plt.title(title)
fileName = sys.argv[1].replace("addresses", "flattened");
saveLocation = './graphs/' + fileName.split('.')[0] + '_flattened.png'
plt.savefig(saveLocation, bbox_inches='tight')
... | code_fim | hard | {
"lang": "python",
"repo": "k8edev/aslr-overflow",
"path": "/ASLRestima/flatten64.addresses.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangzhenjjcn/YSW_Spider path: /myquanwei.com/reader.py
for cateLogpageLink in cateLogpageLinks.keys():
try:
cateLogpage2=urllib2.urlopen(cateLogpageLink)
except Exception,e:
pri... | code_fim | hard | {
"lang": "python",
"repo": "wangzhenjjcn/YSW_Spider",
"path": "/myquanwei.com/reader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangzhenjjcn/YSW_Spider path: /myquanwei.com/reader.py
print str(e)
pass
else:
if cateLogpage:
catalogPageTxt=cateLogpage.read()
data=catalogPageTxt
links=data.split("<dl onclick=\"gotoNext(\'")
... | code_fim | hard | {
"lang": "python",
"repo": "wangzhenjjcn/YSW_Spider",
"path": "/myquanwei.com/reader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
readall_file.write("类别1,类别2,类别3,地址,名称,类型,型号,生产厂家,功能主治,用法用量,不良反应,使用禁忌提示,使用注意,孕妇及哺乳妇女使用注意,儿童使用注意,老年人使用注意,药物相互作用,用药小知识,适用范围,使用方法\n".decode('utf-8').encode(sys.getfilesystemencoding()))
readall_file.flush()
for weblink in webdata.keys():
print weblink
try:
#testurl="http:/... | code_fim | hard | {
"lang": "python",
"repo": "wangzhenjjcn/YSW_Spider",
"path": "/myquanwei.com/reader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: loictessier/weborchestra path: /weborchestra/settings/local.py
from .base import *
DEBUG = True
# Email backend
# https://docs.djangoproject.com/fr/3.0/topics/email/
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
<|fim_suffix|># Logging configuration
# https://docs.djangopro... | code_fim | hard | {
"lang": "python",
"repo": "loictessier/weborchestra",
"path": "/weborchestra/settings/local.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.abspath(os.path.join(BASE_DIR, '../media'))
# Logging configuration
# https://docs.djangoproject.com/en/3.0/topics/logging/
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.... | code_fim | hard | {
"lang": "python",
"repo": "loictessier/weborchestra",
"path": "/weborchestra/settings/local.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: commoncode/django-fancypages path: /tests/unit/blocks/test_page_navigation_block.py
# -*- coding: utf-8- -*-
from __future__ import absolute_import, unicode_literals
import pytest
from fancypages.test import factories
from fancypages.models import PageNavigationBlock
@pytest.fixture
def tree(... | code_fim | hard | {
"lang": "python",
"repo": "commoncode/django-fancypages",
"path": "/tests/unit/blocks/test_page_navigation_block.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> block = PageNavigationBlock(
depth=depth, origin=PageNavigationBlock.ABSOLUTE)
nav_tree = block.get_page_tree(tree.get_children()[0])
assert len(nav_tree) == 1
assert nav_tree[0][0].node.path == '0001'
assert nav_tree[0][0].node.name == 'root'
if depth == 2:
asser... | code_fim | hard | {
"lang": "python",
"repo": "commoncode/django-fancypages",
"path": "/tests/unit/blocks/test_page_navigation_block.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # insert new record for current topic, date and hour
dest_db['hourly_data'].replace_one(
{'topic_id': topic_id,
'date_hr': datetime(date.year, date.month, date.day, hour)
},
{'topic_id': topic_id,
'd... | code_fim | hard | {
"lang": "python",
"repo": "carlatpnl/volttron",
"path": "/volttrontesting/services/aggregate_historian/copy_to_new_schema.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> #reset variables
topic_id = record['topic_id']
date = record['ts'].date()
hour = record['ts'].hour
# insert new record for current topic, date and hour
dest_db['hourly_data'].replace_one(
{'topic_id': topic_id,
... | code_fim | hard | {
"lang": "python",
"repo": "carlatpnl/volttron",
"path": "/volttrontesting/services/aggregate_historian/copy_to_new_schema.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carlatpnl/volttron path: /volttrontesting/services/aggregate_historian/copy_to_new_schema.py
import pytz
try:
import pymongo
except:
raise Exception("Required: pymongo")
from datetime import datetime
from bson.objectid import ObjectId
from pymongo import ReplaceOne
from numbers import Nu... | code_fim | hard | {
"lang": "python",
"repo": "carlatpnl/volttron",
"path": "/volttrontesting/services/aggregate_historian/copy_to_new_schema.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/submit', methods=["POST"])
def submitScore():
data = json.loads(request.data)
new_score = Score(data['name'], data['score'])
db.session.add(new_score)
db.session.commit()
return jsonify(data), 200<|fim_prefix|># repo: willelson/react-quiz path: /app/views.py
from flask import render_t... | code_fim | medium | {
"lang": "python",
"repo": "willelson/react-quiz",
"path": "/app/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: willelson/react-quiz path: /app/views.py
from flask import render_template, url_for, request, abort, redirect, jsonify
from app import app, db
from .models import Score
import json
@app.route('/')
def index():
return render_template('index.html')
@app.route('/leaderboard')
def leaderboard():... | code_fim | medium | {
"lang": "python",
"repo": "willelson/react-quiz",
"path": "/app/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if num > 1:
for i in range(2, num):
if (num % i) == 0:
break
else:
print(num,end =" ")<|fim_prefix|># repo: Kunal3Kumar/Assignment path: /prime_range.py
#WAP to print prime numbers between 55 and 180.
print("Enter lower and upper number:")
l,u ... | code_fim | easy | {
"lang": "python",
"repo": "Kunal3Kumar/Assignment",
"path": "/prime_range.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kunal3Kumar/Assignment path: /prime_range.py
#WAP to print prime numbers between 55 and 180.
print("Enter lower and upper number:")
l,u = int(input()), int(input())
<|fim_suffix|> if num > 1:
for i in range(2, num):
if (num % i) == 0:
break
else:... | code_fim | easy | {
"lang": "python",
"repo": "Kunal3Kumar/Assignment",
"path": "/prime_range.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def configure_extensions(app, cli):
"""configure flask extensions
"""
pass
def configure_apispec(app):
"""Configure APISpec for swagger support
"""
pass
def register_blueprints(app):
"""register all blueprints for application
"""
app.register_blueprint(hello_world.b... | code_fim | hard | {
"lang": "python",
"repo": "DonalChilde/flask_cli",
"path": "/src/flask_cli/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """register all blueprints for application
"""
app.register_blueprint(hello_world.bp_config.bp)<|fim_prefix|># repo: DonalChilde/flask_cli path: /src/flask_cli/app.py
"""Entry point for flask app.
derived from
https://github.com/karec/cookiecutter-flask-restful/blob/master/%7B%7Bcookie... | code_fim | hard | {
"lang": "python",
"repo": "DonalChilde/flask_cli",
"path": "/src/flask_cli/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DonalChilde/flask_cli path: /src/flask_cli/app.py
"""Entry point for flask app.
derived from
https://github.com/karec/cookiecutter-flask-restful/blob/master/%7B%7Bcookiecutter.project_name%7D%7D/%7B%7Bcookiecutter.app_name%7D%7D/app.py
"""
from flask import Flask
from flask_cli.blu... | code_fim | medium | {
"lang": "python",
"repo": "DonalChilde/flask_cli",
"path": "/src/flask_cli/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WillBishop12/asset-allocation path: /tests/test_frontend.py
"""
This file contains test cases for the functions
defined in the frontend folder. Tests for all the modules
have been included in the same file.
Classes:
UnitTests: Class containing all the test cases
Functions:
Different typ... | code_fim | hard | {
"lang": "python",
"repo": "WillBishop12/asset-allocation",
"path": "/tests/test_frontend.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """check if page tab returns a Dash module as output
Args:
No special arguments as it is a unittest.
Returns:
No return values. Passes the test if all okay else
raises an error if unexpected return type encountered.
Raises:
... | code_fim | hard | {
"lang": "python",
"repo": "WillBishop12/asset-allocation",
"path": "/tests/test_frontend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|><group>
Port Name Status Vlan Duplex Speed Type {{ _headers_ }}
</group>
"""
parser = ttp(template=template, log_level="ERROR")
parser.parse()
res = parser.result()
# pprint.pprint(res)
assert res == [
[
[
{
... | code_fim | hard | {
"lang": "python",
"repo": "dmulyalin/ttp",
"path": "/test/pytest/test_headers_indicator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmulyalin/ttp path: /test/pytest/test_headers_indicator.py
]
]
# test_headers_indicator_3()
def test_headers_indicator_columns_merged():
template = """
<input load="text">
Port Name Status Vlan Duplex Speed Type
Gi0/1 PIT-VDU213 connected 18 ... | code_fim | hard | {
"lang": "python",
"repo": "dmulyalin/ttp",
"path": "/test/pytest/test_headers_indicator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmulyalin/ttp path: /test/pytest/test_headers_indicator.py
": "1457328",
"Mounted_on": "/sys/fs/cgroup",
"Use_": "0%",
"Used": "0",
},
{
"Available": "8251560",
"Fil... | code_fim | hard | {
"lang": "python",
"repo": "dmulyalin/ttp",
"path": "/test/pytest/test_headers_indicator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thierrydecker/myason path: /collector.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import queue
import socket
import time
from myason.collector.conf import conf_is_ok
from myason.collector.listener import Listener
from myason.collector.processor import Processor
from myason.collector.write... | code_fim | hard | {
"lang": "python",
"repo": "thierrydecker/myason",
"path": "/collector.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not conf_is_ok(logger_conf_fn, collector_conf_fn):
return
# Load configurations
logger_conf = logger_conf_loader(logger_conf_fn)
collector_conf = conf_loader(collector_conf_fn)
# Create socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Create the messa... | code_fim | hard | {
"lang": "python",
"repo": "thierrydecker/myason",
"path": "/collector.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zlite/PX4_flight_review path: /thiel.py
boxGroup
from bokeh.models import RadioButtonGroup
from bokeh.models import Range1d
from bokeh.server.server import Server
from bokeh.themes import Theme
from bokeh.application.handlers import DirectoryHandler
import time
import copy
from bokeh.models imp... | code_fim | hard | {
"lang": "python",
"repo": "zlite/PX4_flight_review",
"path": "/thiel.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zlite/PX4_flight_review path: /thiel.py
ime
import copy
from bokeh.models import Div
import pandas as pd
import argparse
from bokeh.layouts import column, row
from bokeh.models import ColumnDataSource, PreText, Select
from bokeh.plotting import figure
DATA_DIR = join(dirname(__file__), 'datal... | code_fim | hard | {
"lang": "python",
"repo": "zlite/PX4_flight_review",
"path": "/thiel.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ POST request callback """
if self.multipart_streamer:
try:
file_input = FileInput(accept=".ulg, .csv")
file_input.on_change('value', upload_new_data_sim)
file_input2 = FileInput(accept=".ulg, .csv")
file_input2... | code_fim | hard | {
"lang": "python",
"repo": "zlite/PX4_flight_review",
"path": "/thiel.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ax.plot((freqs-fc)*2.*np.pi, np.abs(fft))
ax.set_yscale("log")
ax.set_xlim([-bw*1.8*np.pi, bw*1.8*np.pi])
#ax.set_ylim([5e-3, 2e1])
ax.set_xlabel(r"$\omega-2\omega_{0}$ [rad/s]")
ax.set_ylabel(r"$P_{\bot}/P_{0}$ [ppm]")
#ax.set_yticks([1e-2, 1e-1, 1, 1e1])
#ax[0].set_title("a)", loc = "left")
plt.subplo... | code_fim | hard | {
"lang": "python",
"repo": "stanfordbeads/opt_lev_analysis",
"path": "/scripts/spinning/just_spinning_spec_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stanfordbeads/opt_lev_analysis path: /scripts/spinning/just_spinning_spec_plot.py
import numpy as np
import matplotlib.pyplot as plt
from piecewise_line import *
from hs_digitizer import *
from scipy.optimize import curve_fit
import matplotlib
import re
import scipy.signal as ss
#path = "/data/... | code_fim | hard | {
"lang": "python",
"repo": "stanfordbeads/opt_lev_analysis",
"path": "/scripts/spinning/just_spinning_spec_plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#plt.show()
wob_freq_plt = np.linspace(0, 2785, 10000)
#################################################################################################
matplotlib.rcParams.update({'font.size':14})
f, ax = plt.subplots(dpi = 200)
#ax.axvline(x = f_rot, linestyle = '--', color = 'k', alpha = 0.5, ... | code_fim | hard | {
"lang": "python",
"repo": "stanfordbeads/opt_lev_analysis",
"path": "/scripts/spinning/just_spinning_spec_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def to_decibel(x, ref_val, name=None):
"""
Converts to decibel scale.
:param x Tensor with values to convert to dB scale.
:param ref_val Scalar representing reference value in bel scale
:return: 10*log10(value/reference_value)
"""
with tf.name_scope(name, op_util.resolve_op_name("ToDecibel"... | code_fim | medium | {
"lang": "python",
"repo": "Deroes/waveflow",
"path": "/waveflow/python/ops/math/unit_ops.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param x Tensor with values to convert to dB scale.
:param ref_val Scalar representing reference value in bel scale
:return: 10*log10(value/reference_value)
"""
with tf.name_scope(name, op_util.resolve_op_name("ToDecibel"), [x]):
zero = tf.constant(0, dtype=ref_val.dtype)
with tf.control... | code_fim | medium | {
"lang": "python",
"repo": "Deroes/waveflow",
"path": "/waveflow/python/ops/math/unit_ops.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Deroes/waveflow path: /waveflow/python/ops/math/unit_ops.py
"""
Functions for conversion between common SI units.
"""
import tensorflow as tf
<|fim_suffix|>def to_decibel(x, ref_val, name=None):
"""
Converts to decibel scale.
:param x Tensor with values to convert to dB scale.
:param re... | code_fim | medium | {
"lang": "python",
"repo": "Deroes/waveflow",
"path": "/waveflow/python/ops/math/unit_ops.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ahmfrz/theprogrammersblog path: /infrastructure/gql_queries.py
"""Defines GQL queries"""
# region Queries
SELECT_AL<|fim_suffix|>ity WHERE created_by = {0} ORDER BY created_date DESC"<|fim_middle|>L_POSTS = "SELECT * FROM PostEntity ORDER BY created_date DESC"
SELECT_ALL_POSTS_BY = "SELECT * FRO... | code_fim | medium | {
"lang": "python",
"repo": "ahmfrz/theprogrammersblog",
"path": "/infrastructure/gql_queries.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ity WHERE created_by = {0} ORDER BY created_date DESC"<|fim_prefix|># repo: ahmfrz/theprogrammersblog path: /infrastructure/gql_queries.py
"""Defines GQL queries"""
# region Queries
SELECT_ALL_POSTS = "SELECT * FROM PostEntity ORDER BY created_d<|fim_middle|>ate DESC"
SELECT_ALL_POSTS_BY = "SELECT * FRO... | code_fim | easy | {
"lang": "python",
"repo": "ahmfrz/theprogrammersblog",
"path": "/infrastructure/gql_queries.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlpsRunner/money_transfer_page path: /usersapp/factories.py
import random
import factory
from django.conf import settings
from faker import Faker
fake = Faker(locale='ru_RU')
<|fim_suffix|> model = settings.AUTH_USER_MODEL
first_name = factory.lazy_attribute(lambda x: fake.first_n... | code_fim | medium | {
"lang": "python",
"repo": "AlpsRunner/money_transfer_page",
"path": "/usersapp/factories.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = settings.AUTH_USER_MODEL
first_name = factory.lazy_attribute(lambda x: fake.first_name())
last_name = factory.lazy_attribute(lambda x: fake.last_name())
username = factory.lazy_attribute(lambda x: fake.user_name())
email = factory.lazy_attribute(lambda x: fake.safe_email()... | code_fim | medium | {
"lang": "python",
"repo": "AlpsRunner/money_transfer_page",
"path": "/usersapp/factories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebastiandaberdaku/PoCavEDT path: /python/prepare_structures.py
# -*- coding: utf-8 -*-
import os
from Bio.PDB import Select
from Bio.PDB.PDBIO import PDBIO
from Bio.PDB.PDBParser import PDBParser
pdb_parser = PDBParser(QUIET=True, PERMISSIVE=True)
io = PDBIO()
class LigandSelect(Select):
d... | code_fim | hard | {
"lang": "python",
"repo": "sebastiandaberdaku/PoCavEDT",
"path": "/python/prepare_structures.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if not os.path.exists("./structures/"): os.makedirs("./structures/")
for bound_pdb_id, unbound_pdb_id, ligand_name in pdb_list :
bound_structure = pdb_parser.get_structure(bound_pdb_id, "./PDB/pdb%s.ent" % bound_pdb_id.lower())
unbound_structure = pdb_parser.get_structure(unbound_pdb_id, "./PDB/... | code_fim | hard | {
"lang": "python",
"repo": "sebastiandaberdaku/PoCavEDT",
"path": "/python/prepare_structures.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnsonc/Social-Media-Impact-on-Stock-Market-and-Price path: /data/20 nike/nikedataParse.py
from parseJSONdata import parseData
<|fim_suffix|>parseData(negativeFileName, postiveFileName, neutralFileName, numNegativ, numPositive, numNeutral)<|fim_middle|># Edit Here
negativeFileName = 'nike_neg_'... | code_fim | medium | {
"lang": "python",
"repo": "johnsonc/Social-Media-Impact-on-Stock-Market-and-Price",
"path": "/data/20 nike/nikedataParse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>parseData(negativeFileName, postiveFileName, neutralFileName, numNegativ, numPositive, numNeutral)<|fim_prefix|># repo: johnsonc/Social-Media-Impact-on-Stock-Market-and-Price path: /data/20 nike/nikedataParse.py
from parseJSONdata import parseData
<|fim_middle|># Edit Here
negativeFileName = 'nike_neg_'... | code_fim | medium | {
"lang": "python",
"repo": "johnsonc/Social-Media-Impact-on-Stock-Market-and-Price",
"path": "/data/20 nike/nikedataParse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ThreeFDDI/nornir-stack_upgrader path: /ftp_server.py
import os
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
def main():
# Instantiate a dummy authorizer for managing 'virtual' users
authorizer = Dummy... | code_fim | hard | {
"lang": "python",
"repo": "ThreeFDDI/nornir-stack_upgrader",
"path": "/ftp_server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Instantiate a dummy authorizer for managing 'virtual' users
authorizer = DummyAuthorizer()
# Define a new user having full r/w permissions and a read-only
# anonymous user
authorizer.add_anonymous('/images')
# Instantiate FTP handler class
handler = FTPHandler
handler.a... | code_fim | medium | {
"lang": "python",
"repo": "ThreeFDDI/nornir-stack_upgrader",
"path": "/ftp_server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # put it in a tempfile to deal with
# very long files and paper over the
# encoding, escaping junk
handle, name = tempfile.mkstemp(suffix='.xml')
write(handle, cleaned_content)
close(handle)
tc = TimedCmd(cmd % name)
... | code_fim | hard | {
"lang": "python",
"repo": "b-cube/Response-Identification-Info",
"path": "/scripts/run_wordcounts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tc = TimedCmd(cmd % name)
try:
status, output, error = tc.run(timeout)
except:
print 'failed extraction: ', response_id
with open('outputs/bow_fails.txt', 'a') as f:
f.write('extract fail: {0}\n'.format... | code_fim | hard | {
"lang": "python",
"repo": "b-cube/Response-Identification-Info",
"path": "/scripts/run_wordcounts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: b-cube/Response-Identification-Info path: /scripts/run_wordcounts.py
from datetime import datetime
import json as js # name conflict with sqla
import sqlalchemy as sqla
from sqlalchemy.orm import sessionmaker
from sqlalchemy import and_, or_, not_
from mpp.models import Response
from mpp.models ... | code_fim | hard | {
"lang": "python",
"repo": "b-cube/Response-Identification-Info",
"path": "/scripts/run_wordcounts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # If this is a discrete process, t will be an index.
# Convert it to a time.
if isinstance(index_set, DiscreteTimeSequence):
ts = [t / index_set.fs for t in ts]
# Check that every t is in the index set
for... | code_fim | hard | {
"lang": "python",
"repo": "bdatko/symbulate",
"path": "/symbulate/gaussian_process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Initialize Gaussian process.
Args:
mean_func: mean function (function of one argument)
cov_func: (auto)covariance function (function of two arguments)
index_set: index set for the Gaussian process
(by default, all real numbers)
... | code_fim | hard | {
"lang": "python",
"repo": "bdatko/symbulate",
"path": "/symbulate/gaussian_process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bdatko/symbulate path: /symbulate/gaussian_process.py
import numpy as np
from .index_sets import (
DiscreteTimeSequence,
Reals
)
from .probability_space import ProbabilitySpace
from .result import (
DiscreteTimeFunction,
ContinuousTimeFunction,
Vector,
is_number,
is_n... | code_fim | hard | {
"lang": "python",
"repo": "bdatko/symbulate",
"path": "/symbulate/gaussian_process.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def feeling_good_callback(hermes, intent_message):
session_id = intent_message.session_id
response = "That's awesome! I love dinosoaurs."
hermes.publish_end_session(session_id, response)
def feeling_bad_callback(hermes, intent_message):
session_id = intent_message.session_id
response... | code_fim | hard | {
"lang": "python",
"repo": "terezaif/snips-workshop-trex",
"path": "/V2_action-how-are-you.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def how_are_you_callback(hermes, intent_message):
session_id = intent_message.session_id
response = "How do you ask a tyrannosaur out to lunch? Tea, Rex?. Are you a dinosaur?"
hermes.publish_continue_session(session_id, response, INTENT_FILTER_FEELING)
def feeling_good_callback(hermes, inte... | code_fim | hard | {
"lang": "python",
"repo": "terezaif/snips-workshop-trex",
"path": "/V2_action-how-are-you.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: terezaif/snips-workshop-trex path: /V2_action-how-are-you.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from hermes_python.hermes import Hermes
INTENT_HOW_ARE_YOU = "bezzam:how_are_you"
INTENT_GOOD = "bezzam:yes_dino"
INTENT_BAD = "bezzam:no_dino"
INTENT_FILTER_FEELING = [INTENT_GOOD, INTEN... | code_fim | hard | {
"lang": "python",
"repo": "terezaif/snips-workshop-trex",
"path": "/V2_action-how-are-you.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rashidlasker/artificial-intelligence path: /AI1/Lab03-WordLadder/Lab03_5.py
""" +=========================================================================================+
|| Lab03.5: Word Ladder ||
|| ... | code_fim | hard | {
"lang": "python",
"repo": "rashidlasker/artificial-intelligence",
"path": "/AI1/Lab03-WordLadder/Lab03_5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> wordLadder = [finalWord]
currWord = finalWord
while alreadyFoundList.get(currWord) != 'none':
currWord = alreadyFoundList.get(currWord)
wordLadder.append(currWord)
wordLadder.reverse()
print('Answer = ' + str(wordLadder))
#-----------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "rashidlasker/artificial-intelligence",
"path": "/AI1/Lab03-WordLadder/Lab03_5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertResultIsBOOL(MapKit.MKRoute.hasTolls)
self.assertResultIsBOOL(MapKit.MKRoute.hasHighways)<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-MapKit/PyObjCTest/test_mkdirectionsresponse.py
from PyObjCTools.TestSupport import TestCase, min_os_level
import objc
<|... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-MapKit/PyObjCTest/test_mkdirectionsresponse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-MapKit/PyObjCTest/test_mkdirectionsresponse.py
from PyObjCTools.TestSupport import TestCase, min_os_level
import objc
import MapKit
<|fim_suffix|> @min_os_level("13.0")
def test_methods13_0(self):
self.assertResultIsBOOL(MapKit.MKRout... | code_fim | hard | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-MapKit/PyObjCTest/test_mkdirectionsresponse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: euirim/fundraising-propensity path: /RandomForest/ds.py
class Features:
def __init__(self, title=None, story=None, created=0, goal=0, category=0, finished=0):
self.title = title
self.story = story
self.created = created
self.goal = goal
self.category = ... | code_fim | easy | {
"lang": "python",
"repo": "euirim/fundraising-propensity",
"path": "/RandomForest/ds.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.