text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> # Calculate r and theta in pixels and radians:
r = np.sqrt(x_offset ** 2 + y_offset ** 2)
theta = np.arctan2(y_offset, x_offset)
# The maximum value r can take is the diagonal corner:
max_x_offset, max_y_offset = output_shape[1]/2, output_shape[0]/2
max_r = np.sqrt(max_x_offset **... | code_fim | hard | {
"lang": "python",
"repo": "druedaplata/app_gnss",
"path": "/utils/planet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def r_theta_to_input_coords(r_theta):
"""Convert a Nx2 array of r, theta co-ordinates into the corresponding
co-ordinates in the input image.
Return a Nx2 array of input image co-ordinates.
"""
# Extract r and theta from input
r, theta = r_theta[:,0], r_theta[:,1]
# Theta... | code_fim | hard | {
"lang": "python",
"repo": "druedaplata/app_gnss",
"path": "/utils/planet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: viniciusjps/turing-machine-emulator path: /test_structured.py
from turing_machine_structured import turing_machine
from time import sleep
def testando():
files = ['adicao_binaria.txt', 'alan_turing.txt', 'binario_decimal.txt',
'castor_ocupado.txt', 'checa_parentes.txt', 'multi... | code_fim | hard | {
"lang": "python",
"repo": "viniciusjps/turing-machine-emulator",
"path": "/test_structured.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #palindromos
assert turing_machine(entradas[7][0], files[7]) == [":)", "halt-accept", 38]
sleep(3)
#Testando 10100101
assert turing_machine(entradas[7][1], files[7]) == [":)", "halt-accept", 46]
sleep(3)
#Testando 001101 - Rejeita
assert turing_machine(entradas[7][2], files... | code_fim | hard | {
"lang": "python",
"repo": "viniciusjps/turing-machine-emulator",
"path": "/test_structured.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kurhula/cloudcafe path: /cloudcafe/compute/extensions/security_groups_api/client.py
"""
Copyright 2013 Rackspace
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://ww... | code_fim | hard | {
"lang": "python",
"repo": "kurhula/cloudcafe",
"path": "/cloudcafe/compute/extensions/security_groups_api/client.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def list_security_groups(self, requestslib_kwargs=None):
url = '{base_url}/os-security-groups'.format(base_url=self.url)
resp = self.request('GET', url,
response_entity_type=SecurityGroups,
requestslib_kwargs=requestslib_kwargs)
... | code_fim | hard | {
"lang": "python",
"repo": "kurhula/cloudcafe",
"path": "/cloudcafe/compute/extensions/security_groups_api/client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Generic game state object"""
def __init__(self, screen):
self.screen = screen
self.name = None
self.label = None
self.bgcolor = (20, 20, 20)
pg.display.set_caption(self.label)
def update(self):
pass
def draw(self):
pass
def... | code_fim | medium | {
"lang": "python",
"repo": "trinhhoaichuong/gamedev",
"path": "/misc/gamestate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trinhhoaichuong/gamedev path: /misc/gamestate.py
import pygame as pg
import os
class StateManager:
def __init__(self, screen, state):
self.screen = screen
self.state = state
def change(self, state):
<|fim_suffix|> GameState.__init__(self, screen)
self.name... | code_fim | hard | {
"lang": "python",
"repo": "trinhhoaichuong/gamedev",
"path": "/misc/gamestate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class SplashScreen(GameState):
"""docstring for SplashScreen"""
def __init__(self, screen):
GameState.__init__(self, screen)
self.name = "splash"
self.label = "Welcome!"
def draw(self):
self.screen.fill(self.bgcolor)
# draw title and spla... | code_fim | hard | {
"lang": "python",
"repo": "trinhhoaichuong/gamedev",
"path": "/misc/gamestate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nishantml/100-days-of-code path: /matrix/spiralOrder.py
"""
Given an m x n matrix, return all elements of the matrix in spiral order.
Example 1:
Input: matrix = [[1,2,3],[4,5,6],[7,8,9]]
Output: [1,2,3,6,9,8,7,4,5]
Example 2:
Input: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
Output: [1,... | code_fim | hard | {
"lang": "python",
"repo": "nishantml/100-days-of-code",
"path": "/matrix/spiralOrder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> direction = 0
left = 0;
right = len(matrix[0]) - 1
top = 0
bottom = len(matrix) - 1
# print(left,right,top,bottom)
res = []
while left <= right and top <= bottom:
if direction == 0:
for i in range(left, right + 1)... | code_fim | medium | {
"lang": "python",
"repo": "nishantml/100-days-of-code",
"path": "/matrix/spiralOrder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
from typing import List
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
direction = 0
left = 0;
right = len(matrix[0]) - 1
top = 0
bottom = len(matrix) - 1
# print(left,right,top,bottom)
res = []
while... | code_fim | medium | {
"lang": "python",
"repo": "nishantml/100-days-of-code",
"path": "/matrix/spiralOrder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mviadere-openig/Geotrek-admin path: /geotrek/zoning/models.py
"""
Zoning models
(not MapEntity : just layers, on which intersections with objects is done in triggers)
"""
from django.conf import settings
from django.contrib.gis.db import models
from django.utils.translation import ugettex... | code_fim | hard | {
"lang": "python",
"repo": "mviadere-openig/Geotrek-admin",
"path": "/geotrek/zoning/models.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def topology_city_edges(cls, topology):
return cls.overlapping(topology).select_related('city')
if settings.TREKKING_TOPOLOGY_ENABLED:
Path.add_property('city_edges', CityEdge.path_city_edges, _("City edges"))
Path.add_property('cities', lambda self: uniquify(map(att... | code_fim | hard | {
"lang": "python",
"repo": "mviadere-openig/Geotrek-admin",
"path": "/geotrek/zoning/models.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_output_names_for_role(role, full=True):
flow_spec = flow.FLOW
return [x[full and "fullName" or "smartName"] for x in flow_spec["out"] if x["role"] == role]
def get_recipe_config():
"""Returns a map of the recipe parameters.
Parameters are defined in recipe.json (see inline doc in... | code_fim | hard | {
"lang": "python",
"repo": "Cosmian/cosmian-dataiku-plugin",
"path": "/dataiku_dev_env/lib/python3.6/site-packages/dataiku/customrecipe/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cosmian/cosmian-dataiku-plugin path: /dataiku_dev_env/lib/python3.6/site-packages/dataiku/customrecipe/__init__.py
import os, json
from dataiku.core import flow
def get_input_names(full=True):
flow_spec = flow.FLOW
return [x[full and "fullName" or "smartName"] for x in flow_spec["in"]]
... | code_fim | medium | {
"lang": "python",
"repo": "Cosmian/cosmian-dataiku-plugin",
"path": "/dataiku_dev_env/lib/python3.6/site-packages/dataiku/customrecipe/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_recipe_config():
"""Returns a map of the recipe parameters.
Parameters are defined in recipe.json (see inline doc in this file)
and set by the user in the recipe page in DSS' GUI"""
return json.loads(os.getenv("DKU_CUSTOM_RECIPE_CONFIG"))
def get_plugin_config():
"""Return... | code_fim | hard | {
"lang": "python",
"repo": "Cosmian/cosmian-dataiku-plugin",
"path": "/dataiku_dev_env/lib/python3.6/site-packages/dataiku/customrecipe/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataDog/dd-trace-py path: /ddtrace/sourcecode/setuptools_auto.py
from ddtrace.vendor.wrapt import wrap_function_wrapper as _w
try:
import distutils.core as distutils_core
import setuptools
except ImportError:
distutils_core = None # type: ignore[assignment]
setuptools = None ... | code_fim | hard | {
"lang": "python",
"repo": "DataDog/dd-trace-py",
"path": "/ddtrace/sourcecode/setuptools_auto.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if distutils_core and setuptools:
_w(distutils_core, "setup", _setup)
_w(setuptools, "setup", _setup)
_patch()<|fim_prefix|># repo: DataDog/dd-trace-py path: /ddtrace/sourcecode/setuptools_auto.py
from ddtrace.vendor.wrapt import wrap_function_wrapper as _w
try:
import distuti... | code_fim | medium | {
"lang": "python",
"repo": "DataDog/dd-trace-py",
"path": "/ddtrace/sourcecode/setuptools_auto.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShaojieJiang/tldr path: /parlai/mturk/core/dev/data_model.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Commands to communicate between ... | code_fim | hard | {
"lang": "python",
"repo": "ShaojieJiang/tldr",
"path": "/parlai/mturk/core/dev/data_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Socket function names / packet types
# TODO document
# WISH pull all of these from one area, or test equivalence
WORLD_MESSAGE = 'world message' # Message from world to agent
AGENT_MESSAGE = 'agent message' # Message from agent to world
WORLD_PING = 'world ping' # Ping from the world for this server ... | code_fim | hard | {
"lang": "python",
"repo": "ShaojieJiang/tldr",
"path": "/parlai/mturk/core/dev/data_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rajendrakrp/GeoMicroFormat path: /common_urls.py
from django.conf.urls.defaults import *
from core.models import Post
post_info_dict = {
'queryset': Post.live.all(),
'date_field': 'date',
}
urlpatterns = patterns('django.views.generic.date_b... | code_fim | hard | {
"lang": "python",
"repo": "rajendrakrp/GeoMicroFormat",
"path": "/common_urls.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ct(post_info_dict, template_name="post_archive_day.html"), 'blog_post_archive_day'),
(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', 'object_detail',
dict(post_info_dict, template_name="post_detail.html"), 'blog_post_detail'),
)<|fim_p... | code_fim | hard | {
"lang": "python",
"repo": "rajendrakrp/GeoMicroFormat",
"path": "/common_urls.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hdknr/django-mautic path: /sample/web/app/databases.py
''' DatabaseRouter
'''
class DatabaseRouter(object):
_maps = {
'mautic': {
'apps': ['mautic'],
},
}
def get_database(self, model, **hints):
for db, conf in self._maps.items():
if ... | code_fim | medium | {
"lang": "python",
"repo": "hdknr/django-mautic",
"path": "/sample/web/app/databases.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.get_database(model, **hints)
def db_for_write(self, model, **hints):
return self.get_database(model, **hints)
def allow_migrate(self, db, app_label, model_name=None, **hints):
for db, conf in self._maps.items():
if app_label in conf['apps']:
... | code_fim | medium | {
"lang": "python",
"repo": "hdknr/django-mautic",
"path": "/sample/web/app/databases.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return None
@classmethod
def router(cls):
return "{0}.{1}".format(cls.__module__, cls.__name__)<|fim_prefix|># repo: hdknr/django-mautic path: /sample/web/app/databases.py
''' DatabaseRouter
'''
class DatabaseRouter(object):
_maps = {
'mautic': {
'apps':... | code_fim | hard | {
"lang": "python",
"repo": "hdknr/django-mautic",
"path": "/sample/web/app/databases.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>### @export "import-differentiate"
import com.opengamma.math.differentiation as pkgDiff
### @export "compute-derivative"
ddx = pkgDiff.VectorFieldFirstOrderDifferentiator()
dYdX = ddx.differentiate(pkgFcns.Squares)
print dYdX.evaluate(X)
print dYdX.evaluate(DoubleMatrix1D(range(-1,-10,-2)))<|fim_prefix|>... | code_fim | medium | {
"lang": "python",
"repo": "henriqueolliveira/OG-Platform",
"path": "/projects/OG-Analytics/docs/examples/function.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>### @export "compute-derivative"
ddx = pkgDiff.VectorFieldFirstOrderDifferentiator()
dYdX = ddx.differentiate(pkgFcns.Squares)
print dYdX.evaluate(X)
print dYdX.evaluate(DoubleMatrix1D(range(-1,-10,-2)))<|fim_prefix|># repo: henriqueolliveira/OG-Platform path: /projects/OG-Analytics/docs/examples/functio... | code_fim | medium | {
"lang": "python",
"repo": "henriqueolliveira/OG-Platform",
"path": "/projects/OG-Analytics/docs/examples/function.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: henriqueolliveira/OG-Platform path: /projects/OG-Analytics/docs/examples/function.py
### @export "create-matrix"
import com.opengamma.math.matrix.DoubleMatrix1D as DoubleMatrix1D
X = DoubleMatrix1D(range(4))
print X
### @export "square-elements"
import com.opengamma.tutorial.ExampleFunctions as ... | code_fim | medium | {
"lang": "python",
"repo": "henriqueolliveira/OG-Platform",
"path": "/projects/OG-Analytics/docs/examples/function.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
"""
TODO:
"""
sierpinski_triangle(ORDER, LENGTH, UPPER_LEFT_X, UPPER_LEFT_Y)
def sierpinski_triangle(order, length, upper_left_x, upper_left_y):
"""
:param order: The number of orders/layers that the fractal will be structure
:param length: The length of each side of triangle
:param... | code_fim | medium | {
"lang": "python",
"repo": "Timeverse/stanCode-Projects",
"path": "/SC101_Assignment5/sierpinski.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Timeverse/stanCode-Projects path: /SC101_Assignment5/sierpinski.py
"""
File: sierpinski.py
Name: Ralph
---------------------------
This file recursively prints the Sierpinski triangle on GWindow.
The Sierpinski triangle is a fractal described in 1915 by Waclaw Sierpinski.
It is a self similar str... | code_fim | medium | {
"lang": "python",
"repo": "Timeverse/stanCode-Projects",
"path": "/SC101_Assignment5/sierpinski.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michaelloose/DualStepperController path: /Python_GUI/Controller.py
import serial
from MotorController import MotorController
import queue
from PyQt5 import QtCore, QtGui, QtWidgets, uic
#from MyThreading import Worker
from time import sleep
from functools import partial
class Controller:
de... | code_fim | hard | {
"lang": "python",
"repo": "michaelloose/DualStepperController",
"path": "/Python_GUI/Controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.MotorController.EStop()
def EStopReset(self):
self.MotorController.EStopReset()
def moveTurntable(self, speed, position):
self.turntableSpeed = speed
self.MotorController.setSpeed('t', self.turntableSpeed)
self.MotorController.setPosition('t', positi... | code_fim | hard | {
"lang": "python",
"repo": "michaelloose/DualStepperController",
"path": "/Python_GUI/Controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def build(self):
self._patch_sources()
meson = self._configure_meson()
meson.build()
def package(self):
self.copy("COPYING", src=self._source_subfolder, dst="licenses")
meson = self._configure_meson()
meson.install()
tools.rmdir(os.path.joi... | code_fim | hard | {
"lang": "python",
"repo": "CAMOBAP/conan-center-index",
"path": "/recipes/dav1d/all/conanfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CAMOBAP/conan-center-index path: /recipes/dav1d/all/conanfile.py
import os
from conans import ConanFile, Meson, tools
from conans.errors import ConanInvalidConfiguration
required_conan_version = ">=1.33.0"
class Dav1dConan(ConanFile):
name = "dav1d"
description = "dav1d is a new AV1 cr... | code_fim | hard | {
"lang": "python",
"repo": "CAMOBAP/conan-center-index",
"path": "/recipes/dav1d/all/conanfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BanFcc/SPM path: /SmartDoc/code.py
# Copyright (C) 2019 Hui Lan
# The following line fixes SyntaxError: Non-UTF-8 code starting with ...
# coding=utf8
import string
#{see rq1}
def remove_punctuation(s):
p = ',.:’“”' + string.punctuation
t = ''
for c in s:
if not c in p:
... | code_fim | hard | {
"lang": "python",
"repo": "BanFcc/SPM",
"path": "/SmartDoc/code.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_word_frequency(self):
'''
Assign the attribute freq_lst with a list of tuples, in the following form:
[('the', 55), ('and', 19), ('to', 19), ('of', 16), ('on', 15), ('may', 13), ('deal', 13)]
'''
self.freq_lst = [] # modify this such that it become... | code_fim | medium | {
"lang": "python",
"repo": "BanFcc/SPM",
"path": "/SmartDoc/code.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> cmd_parser = super().add_documentation(argparse_obj)
find_instances.add_argparse_args(cmd_parser)
def blocked_actions(self, _):
return validate_perms.blocked(actions=["ec2:DescribeInstances"])<|fim_prefix|># repo: TakingItCasual/ec2mc path: /ec2mc/commands/servers_sub/check_... | code_fim | hard | {
"lang": "python",
"repo": "TakingItCasual/ec2mc",
"path": "/ec2mc/commands/servers_sub/check_cmd.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TakingItCasual/ec2mc path: /ec2mc/commands/servers_sub/check_cmd.py
from ec2mc.utils import handle_ip
from ec2mc.utils.base_classes import CommandBase
from ec2mc.utils.find import find_instances
from ec2mc.validate import validate_perms
<|fim_suffix|> @classmethod
def add_documentation(cl... | code_fim | hard | {
"lang": "python",
"repo": "TakingItCasual/ec2mc",
"path": "/ec2mc/commands/servers_sub/check_cmd.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HorizonRobotics/alf path: /alf/algorithms/decoding_algorithm.py
# Copyright (c) 2019 Horizon Robotics. 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... | code_fim | hard | {
"lang": "python",
"repo": "HorizonRobotics/alf",
"path": "/alf/algorithms/decoding_algorithm.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> decoder: Network,
loss=torch.nn.MSELoss(reduction='none'),
loss_weight=1.0,
name="DecodingAlgorithm"):
"""
Args:
decoder (Network): network for decoding target from input.
loss (Callable): loss fun... | code_fim | hard | {
"lang": "python",
"repo": "HorizonRobotics/alf",
"path": "/alf/algorithms/decoding_algorithm.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> "this is from issue 487 where open libray link points to correct title"
title = "Life on the Mississippi"
open_library_link = "http://openlibrary.org/books/OL6710196M/Life_on_the_Mississippi"
open_library_title = get_open_library_item_title(open_library_link)
self.a... | code_fim | medium | {
"lang": "python",
"repo": "leighannskeen/launchpad",
"path": "/lp/ui/tests/open_library_title_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leighannskeen/launchpad path: /lp/ui/tests/open_library_title_test.py
from django.test import TestCase
from ui.voyager import get_open_library_item_title
class OpenLibraryTitleTest(TestCase):
def test_correct_title(self):
<|fim_suffix|> def test_incorrect_title(self):
"from issu... | code_fim | hard | {
"lang": "python",
"repo": "leighannskeen/launchpad",
"path": "/lp/ui/tests/open_library_title_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DoumanAsh/collectionScripts path: /python/tpp/bencodepy/decoder.py
from collections import OrderedDict
from collections.abc import Iterable
from . import DecodingError
class Decoder:
def __init__(self, data: bytes):
self.data = data
self.idx = 0
def __read(sel... | code_fim | hard | {
"lang": "python",
"repo": "DoumanAsh/collectionScripts",
"path": "/python/tpp/bencodepy/decoder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Returns an list of nested bencode elements."""
self.idx += 1
l = []
while self.data[self.idx: self.idx + 1] != b'e':
l.append(self.__parse())
self.idx += 1
return l
def decode_from_file(path: str) -> Iterable:
"""Convenience fu... | code_fim | hard | {
"lang": "python",
"repo": "DoumanAsh/collectionScripts",
"path": "/python/tpp/bencodepy/decoder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(properties.error_info)
return {
'host': '127.0.0.1',
'port': 10010,
'error_info': 'JSON'
}
@GetRoute('/raise/500')
@ResponseBody()
def raise_500():
1 / 0
return<|fim_prefix|># repo: Ca11MeE/dophon path: /test_remote_config/routes/ConfigTest.py
from doph... | code_fim | easy | {
"lang": "python",
"repo": "Ca11MeE/dophon",
"path": "/test_remote_config/routes/ConfigTest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ca11MeE/dophon path: /test_remote_config/routes/ConfigTest.py
from dophon.annotation import *
from dophon import properties
<|fim_suffix|>@GetRoute('/raise/500')
@ResponseBody()
def raise_500():
1 / 0
return<|fim_middle|>
@GetRoute('/config/get')
@ResponseBody()
def get_config():
pri... | code_fim | medium | {
"lang": "python",
"repo": "Ca11MeE/dophon",
"path": "/test_remote_config/routes/ConfigTest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glebpro/computervisionproject2018 path: /scripts/preprocess.py
#
# Preprocess bird image data.
#
# @author Gleb Promokhov
# @author Greg Goh
#
import os
import errno
import pathlib
from shutil import copyfile
import matplotlib.pyplot as plt
import cv2
import numpy as np
PROJECT_ROOT = os... | code_fim | hard | {
"lang": "python",
"repo": "glebpro/computervisionproject2018",
"path": "/scripts/preprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.exists(PROJECT_ROOT+'/data/segmentations'):
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), PROJECT_ROOT+'/data/segmentations')
if not os.path.exists(PROJECT_ROOT+'/data/attributes.txt'):
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOEN... | code_fim | hard | {
"lang": "python",
"repo": "glebpro/computervisionproject2018",
"path": "/scripts/preprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cao527121128/python path: /check_private_ip.py
#!/usr/bin/env python
#coding:utf-8
'''
Created on 2019-03-05
@author: yunify
'''
import qingcloud.iaas
import threading
import time
from optparse import OptionParser
import sys
import os
import qingcloud.iaas.constants as const
import common.commo... | code_fim | hard | {
"lang": "python",
"repo": "cao527121128/python",
"path": "/check_private_ip.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #连接iaas后台
conn = Common.connect_iaas(zone_id, access_key_id, secret_access_key, host,port,protocol)
print("connect_iaas conn == %s" % (conn))
# 获取账号ID
user_id = Common.get_user_id(conn,access_key_id)
print("get_user_id user_id == %s" % (user_id))
ret = check_private_ip(conn,u... | code_fim | hard | {
"lang": "python",
"repo": "cao527121128/python",
"path": "/check_private_ip.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> opt_parser.add_option("-v", "--vxnet_id", action="store", type="string", \
dest="vxnet_id", help='vxnet id', default="")
opt_parser.add_option("-m", "--private_ips", action="store", type="string", \
dest="private_ips", help='private ips', defaul... | code_fim | hard | {
"lang": "python",
"repo": "cao527121128/python",
"path": "/check_private_ip.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 64x64 / 16x16
conv3 = ConvBlock(num_filter * 2, num_filter * 4, kernel_size=4, stride=2, padding=1, activation='lrelu')
# 32x32 / 8x8
conv4 = ConvBlock(num_filter * 4, num_filter * 8, kernel_size=4, stride=1, padding=1, activation='lrelu')
# ?? / ??
con... | code_fim | hard | {
"lang": "python",
"repo": "lovish1234/MLPrototype",
"path": "/CycleGAN/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, x):
out = self.resnet_block(x)
return out
class Generator(torch.nn.Module):
def __init__(self, input_dim, num_filter, output_dim, num_resnet):
super(Generator, self).__init__()
# 256x256 / 64x64
# Reflection padding
self.pad = t... | code_fim | hard | {
"lang": "python",
"repo": "lovish1234/MLPrototype",
"path": "/CycleGAN/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lovish1234/MLPrototype path: /CycleGAN/model.py
import torch
debug=0
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=2, padding=1, activation='relu', batch_norm=True):
super(ConvBlock, self).__init__()
# define the building... | code_fim | hard | {
"lang": "python",
"repo": "lovish1234/MLPrototype",
"path": "/CycleGAN/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_upload_from_file(self):
f = NamedTemporaryFile()
contents = b"Hello world!\n"
destination = "hello_world.txt"
f.write(contents)
f.flush()
bf = self.bucket.file(destination)
self.assertFalse(bf.exists())
self.bucket.upload(f.na... | code_fim | hard | {
"lang": "python",
"repo": "jthomas/nimbella-sdk-python",
"path": "/test/integration/test_provider.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jthomas/nimbella-sdk-python path: /test/integration/test_provider.py
import unittest
from dotenv import load_dotenv
load_dotenv()
import os
from datetime import datetime, timedelta
from tempfile import NamedTemporaryFile
from nimbella import storage
from urllib.request import Request, urlopen
fr... | code_fim | hard | {
"lang": "python",
"repo": "jthomas/nimbella-sdk-python",
"path": "/test/integration/test_provider.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
val = mychiller.get_work_temperature()
print("Julabo working temperature is: " + str(val) )
val = mychiller.get_temperature()
print("Julabo actual bath temperature is: " + str(val) )
mychiller.close()<|fim_prefix|># repo: jopekonk/julabolib path: /julabo_set_temp.py
#!/usr/bin/env python3
# -*- coding... | code_fim | medium | {
"lang": "python",
"repo": "jopekonk/julabolib",
"path": "/julabo_set_temp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>val = mychiller.get_temperature()
print("Julabo actual bath temperature is: " + str(val) )
mychiller.close()<|fim_prefix|># repo: jopekonk/julabolib path: /julabo_set_temp.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Script to set the working temperature of the JULABO chiller.
# 20190110 - Joona... | code_fim | medium | {
"lang": "python",
"repo": "jopekonk/julabolib",
"path": "/julabo_set_temp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jopekonk/julabolib path: /julabo_set_temp.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Script to set the working temperature of the JULABO chiller.
# 20190110 - Joonas Konki
import julabolib
import sys
if len(sys.argv) != 2:
print("Usage: ./julabo_set_temp [TEMP]")
print("where TEMP is... | code_fim | medium | {
"lang": "python",
"repo": "jopekonk/julabolib",
"path": "/julabo_set_temp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> initIndex = 1
while True:
browser = webdriver.Chrome(chromedriver, options=options)
browser.get(url_1.format(PAGENUMBER=initIndex))
time.sleep(5)
print(url_1.format(PAGENUMBER=initIndex))
aTagsInLi = browser.find_elements_by_css_selector('a')
totalLi... | code_fim | medium | {
"lang": "python",
"repo": "arvindeybram/GitHubSearch",
"path": "/searchGit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def processURL(url_1):
initIndex = 1
while True:
browser = webdriver.Chrome(chromedriver, options=options)
browser.get(url_1.format(PAGENUMBER=initIndex))
time.sleep(5)
print(url_1.format(PAGENUMBER=initIndex))
aTagsInLi = browser.find_elements_by_css_select... | code_fim | medium | {
"lang": "python",
"repo": "arvindeybram/GitHubSearch",
"path": "/searchGit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arvindeybram/GitHubSearch path: /searchGit.py
import time
import argparse
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless")
def traversePage(tagName):
global outputFile
newIndex = 0
linkList =... | code_fim | hard | {
"lang": "python",
"repo": "arvindeybram/GitHubSearch",
"path": "/searchGit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## local modules ##
import functions_v5 as fxn
### data structures ###
### called/local plotting parameters ###
ps = fxn.pseasons
sl = fxn.gp_seasonlabels
fs = 24
fssml = 16
### functions ###
### data files ###
zORin = open('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/Py_export/SDI_nat_c... | code_fim | hard | {
"lang": "python",
"repo": "eclee25/flu-SDI-exploratory-age",
"path": "/scripts/create_fluseverity_figs_v5/S_zRR_vax_v5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eclee25/flu-SDI-exploratory-age path: /scripts/create_fluseverity_figs_v5/S_zRR_vax_v5.py
#!/usr/bin/python
##############################################
###Python template
###Author: Elizabeth Lee
###Date: 11/4/14
###Function: scatter plot zOR metrics vs. trivalent vaccine match and vaccine ef... | code_fim | hard | {
"lang": "python",
"repo": "eclee25/flu-SDI-exploratory-age",
"path": "/scripts/create_fluseverity_figs_v5/S_zRR_vax_v5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> calls = [
{
'function_name': c.function_name,
'function_signature': BaseFormatter._get_signature(c)
} for c in calls
]
return calls
def write_summary(self):
template = BaseFormatter._get_template(self.summary_temp... | code_fim | hard | {
"lang": "python",
"repo": "majorpayne327/attack-surface-metrics",
"path": "/attacksurfacemeter/formatters/base_formatter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: majorpayne327/attack-surface-metrics path: /attacksurfacemeter/formatters/base_formatter.py
import os
from statistics import StatisticsError
import networkx as nx
from django.template import Template, Context
from django.conf import settings
class BaseFormatter(object):
"""Formatters' bas... | code_fim | hard | {
"lang": "python",
"repo": "majorpayne327/attack-surface-metrics",
"path": "/attacksurfacemeter/formatters/base_formatter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jinnykoo/wuyisj.com path: /tests/integration/offer/applicator_tests.py
from decimal import Decimal as D
from mock import Mock
from django.test import TestCase
from django_dynamic_fixture import G
from oscar.apps.offer.utils import Applicator
from oscar.apps.offer import models
from oscar.test.... | code_fim | hard | {
"lang": "python",
"repo": "jinnykoo/wuyisj.com",
"path": "/tests/integration/offer/applicator_tests.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_applies_offer_multiple_times_by_default(self):
add_product(self.basket, D('100'), 5)
offer = models.ConditionalOffer(
id="test", condition=self.condition, benefit=self.benefit)
self.applicator.apply_offers(self.basket, [offer])
applications = self.b... | code_fim | hard | {
"lang": "python",
"repo": "jinnykoo/wuyisj.com",
"path": "/tests/integration/offer/applicator_tests.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benblack769/audiosearch path: /nearest_neighbors_db/utils/metric.py
import numpy as np
def compute_metric(keys, query, comparator):
'''
return score of query. low scores are better. metric does not necessarily follow triangle inequality
and is thus not a true met<|fim_suffix|>if comp... | code_fim | hard | {
"lang": "python",
"repo": "benblack769/audiosearch",
"path": "/nearest_neighbors_db/utils/metric.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if comparator == "inner":
'''
general formula for inner metric is
(a*b)
'''
return - keys @ query
elif comparator == "euclid":
'''
euclidian distance means (a-b)^2 = a^2 - 2ab + b^2
'''
return np.sqrt(np.linalg.norm(keys, axis=1) ... | code_fim | hard | {
"lang": "python",
"repo": "benblack769/audiosearch",
"path": "/nearest_neighbors_db/utils/metric.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bdraco/netdisco path: /netdisco/discoverables/heos.py
"""Discover Heos devices."""
from . import SSDPDiscoverable
<|fim_suffix|> """Get all the HEOS devices."""
return self.find_by_st("urn:schemas-denon-com:device:ACT-Denon:1")<|fim_middle|>class Discoverable(SSDPDiscoverable):
... | code_fim | medium | {
"lang": "python",
"repo": "bdraco/netdisco",
"path": "/netdisco/discoverables/heos.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Add support for discovering DLNA services."""
def get_entries(self):
"""Get all the HEOS devices."""
return self.find_by_st("urn:schemas-denon-com:device:ACT-Denon:1")<|fim_prefix|># repo: bdraco/netdisco path: /netdisco/discoverables/heos.py
"""Discover Heos devices."""
from ... | code_fim | easy | {
"lang": "python",
"repo": "bdraco/netdisco",
"path": "/netdisco/discoverables/heos.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def subValid(self, board):
return all(self.isUnitValid([board[r+i][c+j] for i in range(3) for j in range(3)]) for r in (0, 3, 6) for c in (0, 3, 6))
def isUnitValid(self, unit):
digits = [digit for digit in unit if digit != '.']
# print(digits)
return len(s... | code_fim | medium | {
"lang": "python",
"repo": "wyaadarsh/LeetCode-Solutions",
"path": "/Python3/0036-Valid-Sudoku/soln.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/0036-Valid-Sudoku/soln.py
class Solution:
def isValidSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: bool
"""
return self.rowValid(board) and self.colValid(board) and self.subValid(board)
... | code_fim | medium | {
"lang": "python",
"repo": "wyaadarsh/LeetCode-Solutions",
"path": "/Python3/0036-Valid-Sudoku/soln.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._pod_message_filter.get_type(pod)
def enable(self):
self._subscriber.subscribe()
def disable(self):
self._subscriber.unsubscribe()<|fim_prefix|># repo: zhouzhuojie/pyddp path: /ddp/pubsub/pod_message_filter.py
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog ... | code_fim | hard | {
"lang": "python",
"repo": "zhouzhuojie/pyddp",
"path": "/ddp/pubsub/pod_message_filter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhouzhuojie/pyddp path: /ddp/pubsub/pod_message_filter.py
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog Studios
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | code_fim | medium | {
"lang": "python",
"repo": "zhouzhuojie/pyddp",
"path": "/ddp/pubsub/pod_message_filter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _on_received(self, topic, pod):
if self._accept(pod):
topic = ':pod:accepted:' + self._get_type(pod)
else:
topic = ':pod:rejected'
self._board.publish(topic, pod)
def _accept(self, pod):
return self._pod_message_filter.accept(pod)
d... | code_fim | hard | {
"lang": "python",
"repo": "zhouzhuojie/pyddp",
"path": "/ddp/pubsub/pod_message_filter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: python-fedex-devs/python-fedex path: /tests/test_package_movement_service.py
"""
Test module for the Fedex PackageMovementInformationService WSDL.
"""
import unittest
import logging
import sys
import warnings
warnings.simplefilter('always', DeprecationWarning) # Show deprecation on this module... | code_fim | medium | {
"lang": "python",
"repo": "python-fedex-devs/python-fedex",
"path": "/tests/test_package_movement_service.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def test_postal_inquiry(self):
inquiry = PostalCodeInquiryRequest(self.config_obj)
inquiry.PostalCode = '29631'
inquiry.CountryCode = 'US'
inquiry.send_request()
assert inquiry.response
assert inquiry.response.HighestSeverity == 'SUCCESS'... | code_fim | medium | {
"lang": "python",
"repo": "python-fedex-devs/python-fedex",
"path": "/tests/test_package_movement_service.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert inquiry.response
assert inquiry.response.HighestSeverity == 'SUCCESS'
if __name__ == "__main__":
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
unittest.main()<|fim_prefix|># repo: python-fedex-devs/python-fedex path: /tests/test_package_movement_service.py
""... | code_fim | hard | {
"lang": "python",
"repo": "python-fedex-devs/python-fedex",
"path": "/tests/test_package_movement_service.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nsidc/polarstereo-lonlat-convert-py path: /polar_convert/validators.py
from polar_convert.constants import (
VALID_HEMISPHERES,
VALID_GRID_SIZES,
)
<|fim_suffix|>
def validate_hemisphere(hemisphere):
if not isinstance(hemisphere, str) or hemisphere.lower() not in VALID_HEMISPHERES:
... | code_fim | hard | {
"lang": "python",
"repo": "nsidc/polarstereo-lonlat-convert-py",
"path": "/polar_convert/validators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def validate_hemisphere(hemisphere):
if not isinstance(hemisphere, str) or hemisphere.lower() not in VALID_HEMISPHERES:
raise ValueError(
f'Got `hemisphere` of {hemisphere} but expected one of {VALID_HEMISPHERES}'
)
return hemisphere.lower()<|fim_prefix|># repo: nsidc... | code_fim | hard | {
"lang": "python",
"repo": "nsidc/polarstereo-lonlat-convert-py",
"path": "/polar_convert/validators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Lower bound for cmap is inclusive, upper bound is non-inclusive
bounds = list(range( len(np.unique(flags)) )) # need (max_cluster+1) to be the upper bound
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
ax.xaxis.set_major_formatter(DateFormatter("%H:%M"))
hours ... | code_fim | hard | {
"lang": "python",
"repo": "shibaji7/AMGeO-SD",
"path": "/sd/sd_plots.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shibaji7/AMGeO-SD path: /sd/sd_plots.py
import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.dates as mdates
from matplotlib.dates import DateFormatter, num2date
from matplotlib import patches
import matplotlib.patches as mpatches
import random
i... | code_fim | hard | {
"lang": "python",
"repo": "shibaji7/AMGeO-SD",
"path": "/sd/sd_plots.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xelrach/DASaveReader path: /choice/denerim.py
# Copyright 2014 Charles Noneman
#
# 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.apache.org/licenses/LIC... | code_fim | hard | {
"lang": "python",
"repo": "xelrach/DASaveReader",
"path": "/choice/denerim.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if has_flag(quest_data, goldanna.MET_GOLDANNA):
response.result = goldanna.YES
elif has_flag(quest_data, goldanna.WANT_TO_MEET_GOLDANNA):
response.result = goldanna.NO
else:
response.result = goldanna.NOTHING
return response
class scroll:
ORDER = 5
TITLE = "Did the Warden bring the an... | code_fim | hard | {
"lang": "python",
"repo": "xelrach/DASaveReader",
"path": "/choice/denerim.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='registrant',
name='payment_receipt',
field=models.CharField(blank=True, max_length=128, null=True),
),
]<|fim_prefix|># repo: arkavidia5/arkav-is path: /arkav_is_api/seminar/migrations/0007_auto_... | code_fim | medium | {
"lang": "python",
"repo": "arkavidia5/arkav-is",
"path": "/arkav_is_api/seminar/migrations/0007_auto_20190118_1733.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arkavidia5/arkav-is path: /arkav_is_api/seminar/migrations/0007_auto_20190118_1733.py
# Generated by Django 2.1.4 on 2019-01-18 10:33
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='registrant',
name='p... | code_fim | medium | {
"lang": "python",
"repo": "arkavidia5/arkav-is",
"path": "/arkav_is_api/seminar/migrations/0007_auto_20190118_1733.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michelbauer/pypet path: /pypet/tests/backwards_compat_test.py
__author__ = 'robert'
import sys
import os
if (sys.version_info < (2, 7, 0)):
import unittest2 as unittest
else:
import unittest
<|fim_suffix|> self.assertTrue(old_pypet_traj.v_version=='0.1b.6')
self.... | code_fim | hard | {
"lang": "python",
"repo": "michelbauer/pypet",
"path": "/pypet/tests/backwards_compat_test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(old_pypet_traj.v_version=='0.1b.6')
self.assertTrue(old_pypet_traj.par.x==0)
self.assertTrue(len(old_pypet_traj)==9)
self.assertTrue(old_pypet_traj.res.runs.r_4.z==12)
else:
pass<|fim_prefix|># repo: michelbauer/pypet pat... | code_fim | hard | {
"lang": "python",
"repo": "michelbauer/pypet",
"path": "/pypet/tests/backwards_compat_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_backwards_compatibility(self):
if (sys.version_info < (3, 0, 0)):
# Test only makes sense with python 2.7 or lower
old_pypet_traj = Trajectory()
module_path, init_file = os.path.split(pypet.__file__)
filename= os.path.join(module_path, '... | code_fim | medium | {
"lang": "python",
"repo": "michelbauer/pypet",
"path": "/pypet/tests/backwards_compat_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Danaroth83/irca path: /src/interface/characterization.py
from __future__ import annotations
from pathlib import Path
from dataclasses import dataclass, replace
import numpy as np
from src.characterization.protocols import CharacterizationProtocol
from src.characterization.interface import Chara... | code_fim | medium | {
"lang": "python",
"repo": "Danaroth83/irca",
"path": "/src/interface/characterization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self._characterization is not None:
return self._characterization
interferometers = self.acquisition.data.shape[0]
init = Parameters.init_zeros(interferometers=interferometers)
init = replace(init, opd=self.device.opd[:, np.newaxis])
characterize_prot... | code_fim | hard | {
"lang": "python",
"repo": "Danaroth83/irca",
"path": "/src/interface/characterization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebastiao-sousa-br/Extrator_SPEDFiscal path: /Regs/Block_1/__init__.py
from .R1001 import R1001
from .R1010 import R1010
from .R1100 import R1100
from .R1105 import R1105
from .R1110 import R1110
from .R1200 import R1200
from .R1210 import R1210
from .R1250 import R1250
from .R1255 import R1255
f... | code_fim | hard | {
"lang": "python",
"repo": "sebastiao-sousa-br/Extrator_SPEDFiscal",
"path": "/Regs/Block_1/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>import R1500
from .R1510 import R1510
from .R1600 import R1600
from .R1700 import R1700
from .R1710 import R1710
from .R1800 import R1800
from .R1900 import R1900
from .R1910 import R1910
from .R1920 import R1920
from .R1921 import R1921
from .R1922 import R1922
from .R1923 import R1923
from .R1925 import... | code_fim | hard | {
"lang": "python",
"repo": "sebastiao-sousa-br/Extrator_SPEDFiscal",
"path": "/Regs/Block_1/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> R1921
from .R1922 import R1922
from .R1923 import R1923
from .R1925 import R1925
from .R1926 import R1926
from .R1960 import R1960
from .R1970 import R1970
from .R1975 import R1975
from .R1980 import R1980
from .R1990 import R1990<|fim_prefix|># repo: sebastiao-sousa-br/Extrator_SPEDFiscal path: /Regs/B... | code_fim | hard | {
"lang": "python",
"repo": "sebastiao-sousa-br/Extrator_SPEDFiscal",
"path": "/Regs/Block_1/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itdagene-ntnu/itdagene path: /itdagene/app/events/migrations/0001_initial.py
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("company", "0001_initial"),
... | code_fim | hard | {
"lang": "python",
"repo": "itdagene-ntnu/itdagene",
"path": "/itdagene/app/events/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> null=True,
),
),
(
"creator",
models.ForeignKey(
related_name="ticket_creator",
editable=False,
to=settings.AUTH_USER_MODEL,
... | code_fim | hard | {
"lang": "python",
"repo": "itdagene-ntnu/itdagene",
"path": "/itdagene/app/events/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: llimllib/champsleagueviz path: /europa/dl.py
import re, requests, csv, time
def parse_team(teamrow):
cols = re.findall("<td.*?>(.*?)<", teamrow)
name = cols[1]
odds = []
for c in cols[3:]:
if not c: odds.append(None)
else:
try:
odds.app... | code_fim | hard | {
"lang": "python",
"repo": "llimllib/champsleagueviz",
"path": "/europa/dl.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.