text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> @classmethod
def get_exception_details_from_ctx(cls, ctx) -> ExceptionDetails:
position = ctx.start.start + 1
line = ctx.start.line
wrong_symbol = str(ctx.start.text)
expression = str(ctx.start.source[1])
return ExceptionDetails(position=position, line=line,... | code_fim | hard | {
"lang": "python",
"repo": "panoramichq/panoramic-cli",
"path": "/src/panoramic/cli/husky/core/tel/helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
edge_type : Tuple[int, int]
Type if edges.
edge_class : int
Index of edge class in given edge type
(e. g. for (1, 1) i means ith side effect).
min_val_test_size : int
Minimum size of test and vali... | code_fim | hard | {
"lang": "python",
"repo": "karl-crl/decagon",
"path": "/decagon/deep/minibatch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
sparse : sp.csr_matrix
Sparse matrix.
n_of_samples : int
Number os samples to get.
submatrix_size : int
Size of submatrix (height and width).
Returns
-------
List[List[int]]
... | code_fim | hard | {
"lang": "python",
"repo": "karl-crl/decagon",
"path": "/decagon/deep/minibatch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karl-crl/decagon path: /decagon/deep/minibatch.py
e of edges in one symmetry group with edge_type
(e.g. if edge_type = (0, 1), symmetry edge_type can be (1, 0)).
edge_class : int
Index of edge class.
Returns
-------
"""
all_edges_s... | code_fim | hard | {
"lang": "python",
"repo": "karl-crl/decagon",
"path": "/decagon/deep/minibatch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jannekai/project-euler path: /041.py
import time
import math
from euler import *
<|fim_suffix|>end = time.time() - start
print "Total time was " + str(end)+ " seconds"<|fim_middle|>start = time.time()
# Check out the
p = permutations([1, 2, 3, 4, 5, 6, 7])
p.sort()
for i in range(l... | code_fim | hard | {
"lang": "python",
"repo": "jannekai/project-euler",
"path": "/041.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jannekai/project-euler path: /041.py
import time
import math
from euler import *
start = time.time()
<|fim_suffix|>end = time.time() - start
print "Total time was " + str(end)+ " seconds"<|fim_middle|># Check out the
p = permutations([1, 2, 3, 4, 5, 6, 7])
p.sort()
for i in range(l... | code_fim | medium | {
"lang": "python",
"repo": "jannekai/project-euler",
"path": "/041.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Check out the
p = permutations([1, 2, 3, 4, 5, 6, 7])
p.sort()
for i in range(len(p)-1, 0, -1):
v = int("".join(map(str, p[i])))
if isPrime(v):
print "Found %d " % v
break
end = time.time() - start
print "Total time was " + str(end)+ " seconds"<|fim_prefix|># repo: jannekai/project-e... | code_fim | easy | {
"lang": "python",
"repo": "jannekai/project-euler",
"path": "/041.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
voltage = get_battery_voltage()
print("Battery Voltage:", voltage)
vs = repr(int(voltage*100))
for i in range(3):
pxs = [0, 0, 0]
for _ in range(int(vs[i])):
pxs[i] = 255
led.fill(pxs)
t... | code_fim | hard | {
"lang": "python",
"repo": "eteq/feather-office-status",
"path": "/battery_check_feather.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eteq/feather-office-status path: /battery_check_feather.py
import time
import board
import analogio
__all__ = ['get_battery_voltage']
def get_battery_voltage(battery_pin='guess'):
if battery_pin == 'guess':
if hasattr(board, 'BATTERY'):
battery_pin = board.BATTERY
... | code_fim | hard | {
"lang": "python",
"repo": "eteq/feather-office-status",
"path": "/battery_check_feather.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if led_neopixel:
import neopixel
led = neopixel.NeoPixel(pin, 1, brightness=brightness)
else:
import adafruit_dotstar
led = adafruit_dotstar.DotStar(pin[0], pin[1], 1, brightness=brightness)
while True:
voltage = get_battery_voltage()
print("Bat... | code_fim | medium | {
"lang": "python",
"repo": "eteq/feather-office-status",
"path": "/battery_check_feather.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adviti/melange path: /app/soc/modules/gsoc/views/statistic.py
#!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# 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 Lice... | code_fim | hard | {
"lang": "python",
"repo": "adviti/melange",
"path": "/app/soc/modules/gsoc/views/statistic.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'v2/modules/gsoc/statistic/base.html'
def checkAccess(self):
self.isHost = False
try:
self.check.isHost()
self.isHost = True
except AccessViolation:
pass
def context(self):
if self.isHost:
infos = GSoCStatisticInfo.getInstance().getStatistics()
... | code_fim | hard | {
"lang": "python",
"repo": "adviti/melange",
"path": "/app/soc/modules/gsoc/views/statistic.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: faisaldialpad/hellouniverse path: /Python/dev/maths/climbing_stairs.py
class ClimbStairs:
@staticmethod
def find_nth_fibo(n):
"""
:type n: int
<|fim_suffix|> temp = first + second
first = second
second = temp
return second<|fim_middle|> ... | code_fim | medium | {
"lang": "python",
"repo": "faisaldialpad/hellouniverse",
"path": "/Python/dev/maths/climbing_stairs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> temp = first + second
first = second
second = temp
return second<|fim_prefix|># repo: faisaldialpad/hellouniverse path: /Python/dev/maths/climbing_stairs.py
class ClimbStairs:
@staticmethod
def find_nth_fibo(n):
"""
:type n: int
<|fim_middle|> ... | code_fim | medium | {
"lang": "python",
"repo": "faisaldialpad/hellouniverse",
"path": "/Python/dev/maths/climbing_stairs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def elasticsearch_start():
'''
Starts
:return: Returns success if es_start_cmd command executes successfully or error message is shown
'''
log.info("\nStarting elasticsearch\n")
header_key = request.headers.get('API-KEY')
api_status = check_apiKey(header_key)
if api_status... | code_fim | hard | {
"lang": "python",
"repo": "ekbanasolutions/aditas",
"path": "/agent/src/ElasticSearch/run_es_services.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ekbanasolutions/aditas path: /agent/src/ElasticSearch/run_es_services.py
import json
import os
import sys
import run_services
from API_KEYS.keys import check_apiKey
from Basic_linux_commands.kill_service import kill_service
from System_Info.hostname_info import get_system_ip
from bigdata_logs.l... | code_fim | hard | {
"lang": "python",
"repo": "ekbanasolutions/aditas",
"path": "/agent/src/ElasticSearch/run_es_services.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gelbpunkt/veldpy path: /veldpy/http.py
"""
Copyright (c) 2020, Jens Reidel
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above ... | code_fim | hard | {
"lang": "python",
"repo": "Gelbpunkt/veldpy",
"path": "/veldpy/http.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class HTTPClient:
def __init__(self) -> None:
self.session = aiohttp.ClientSession()
self.token: Optional[str] = None
# /api/v1/channels
async def create_channel(self, name: str) -> Channel:
"""
Creates a new channel.
"""
async with s... | code_fim | hard | {
"lang": "python",
"repo": "Gelbpunkt/veldpy",
"path": "/veldpy/http.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Delete Unwanted Shortcuts
desktop = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
files = os.listdir(desktop)
delete = []
for i in delete:
try:
os.remove(desktop + "\\" + i)
except FileNotFoundError:
continue<|fim_prefix|># repo: MuberraKocak/Helpers path: ... | code_fim | medium | {
"lang": "python",
"repo": "MuberraKocak/Helpers",
"path": "/temp/Shortcut/shortcuts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MuberraKocak/Helpers path: /temp/Shortcut/shortcuts.py
"""
Author: Mert Cobanoglu // MSI-GA
Date: 3.10.2019
This script can delete unwanted shorcuts
and change the wallpaper to black screen.
"""
import os
from pathlib import Path
import ctypes
# Change Wallpaper
<|fim_suffix|>
# Delete U... | code_fim | medium | {
"lang": "python",
"repo": "MuberraKocak/Helpers",
"path": "/temp/Shortcut/shortcuts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> config_settings: dict[str, Any] | None = None
) -> list[str]:
"""
https://peps.python.org/pep-0660/#get-requires-for-build-editable
"""
return read_dependencies()<|fim_prefix|># repo: pypa/hatch path: /backend/src/hatchling/ouroboros.py
from __future__ import annotations
import os
im... | code_fim | hard | {
"lang": "python",
"repo": "pypa/hatch",
"path": "/backend/src/hatchling/ouroboros.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_requires_for_build_editable( # type: ignore[no-redef]
config_settings: dict[str, Any] | None = None
) -> list[str]:
"""
https://peps.python.org/pep-0660/#get-requires-for-build-editable
"""
return read_dependencies()<|fim_prefix|># repo: pypa/hatch path: /backend/src/hatchlin... | code_fim | hard | {
"lang": "python",
"repo": "pypa/hatch",
"path": "/backend/src/hatchling/ouroboros.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pypa/hatch path: /backend/src/hatchling/ouroboros.py
from __future__ import annotations
import os
import re
from ast import literal_eval
from typing import Any
from hatchling.build import * # noqa: F403
def read_dependencies() -> list[str]:
<|fim_suffix|> """
https://peps.python.org/p... | code_fim | hard | {
"lang": "python",
"repo": "pypa/hatch",
"path": "/backend/src/hatchling/ouroboros.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># std_msgs/Bool state_a
# std_msgs/Bool state_b << as defined in khan_msgs
a_state = Bool state_a.data
b_state = Bool state_b.data
# calculates the position and velocity using the quadrature.py file
quadrature.update(a_state, b_state)
def mynode():
rospy.init_node('mynode', a... | code_fim | medium | {
"lang": "python",
"repo": "ccc395/Robotics",
"path": "/catkin_ws/src/added_control/scripts/assignment2node",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ccc395/Robotics path: /catkin_ws/src/added_control/scripts/assignment2node
#!/usr/bin/env python
import rospy
from std_msgs.msg import Bool
from std_msgs.msg import msg.state_a.data
from std_msgs.msg import msg.state_b.data
import sys
import quadrature
<|fim_suffix|> rospy.init_node('mynode',... | code_fim | hard | {
"lang": "python",
"repo": "ccc395/Robotics",
"path": "/catkin_ws/src/added_control/scripts/assignment2node",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> rospy.init_node('mynode', anonymous=True)
#subscribes to the "ticks" topic for the Bool type (boolean) and executes change function
rospy.Subscriber("/ticks", Bool, change)
#publishes to joint_out of type JointState
pub = rospy.Publisher('/joint_out', JointState, queue_size=10) # The q... | code_fim | hard | {
"lang": "python",
"repo": "ccc395/Robotics",
"path": "/catkin_ws/src/added_control/scripts/assignment2node",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: graphcore/examples path: /nlp/bert/popxl/tests/unit/layer/test_feed_forward_graph.py
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import numpy as np
import popart._internal.ir as _ir
import popxl
import popxl_addons as addons
from config import BertConfig
from modelling.feed_forward ... | code_fim | hard | {
"lang": "python",
"repo": "graphcore/examples",
"path": "/nlp/bert/popxl/tests/unit/layer/test_feed_forward_graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert len(acts_shapes) == 10
# Gradient, Input to intermediateMM, Input to groupnorm
assert acts_shapes.count((bs * seq, h)) == 3
# groupnorm mean, groupnorm inv_std_dev
assert acts_shapes.count((bs * seq,)) == 2
# Input to outputMM, Input to Gelu
assert acts_shapes.count((bs... | code_fim | hard | {
"lang": "python",
"repo": "graphcore/examples",
"path": "/nlp/bert/popxl/tests/unit/layer/test_feed_forward_graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ppizarror/pygame-menu path: /pygame_menu/baseimage.py
position: str) -> 'BaseImage':
"""
Set the image position.
.. note::
See :py:mod:`pygame_menu.locals` for valid ``position`` values.
:param position: Image position
:return: Self reference... | code_fim | hard | {
"lang": "python",
"repo": "ppizarror/pygame-menu",
"path": "/pygame_menu/baseimage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Getting and setting pixels one at a time is generally too slow to be used
in a game or realtime situation. It is better to use methods which operate
on many pixels at a time like with the blit, fill and draw methods - or by
using pygame.surfarraypygame module for accessing ... | code_fim | hard | {
"lang": "python",
"repo": "ppizarror/pygame-menu",
"path": "/pygame_menu/baseimage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ppizarror/pygame-menu path: /pygame_menu/baseimage.py
age_id: str
"""
_angle: NumberType
_drawing_mode: int
_drawing_offset: Tuple2IntType
_drawing_position: str
_extension: str
_filename: str
_filepath: Union[str, 'BytesIO']
_frombase64: bool
_last_transfo... | code_fim | hard | {
"lang": "python",
"repo": "ppizarror/pygame-menu",
"path": "/pygame_menu/baseimage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pjln/autorizator path: /autorizator/casbin_adapters.py
"""casbin adapter"""
from typing import List, NamedTuple, Set
import casbin.persist # type: ignore
from autorizator.errors import AutorizatorError
from autorizator.data_types import Role, RoleList, ActionList
class RoleActionPolicy(Nam... | code_fim | medium | {
"lang": "python",
"repo": "pjln/autorizator",
"path": "/autorizator/casbin_adapters.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for policy in self._policies:
if policy.includes is not None:
for include in policy.includes:
model.model['g']['g'].policy.append([policy.role, include])
for action in policy.actions:
model.model['p']['p'].policy.append([... | code_fim | medium | {
"lang": "python",
"repo": "pjln/autorizator",
"path": "/autorizator/casbin_adapters.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def import_submodules(package: str, recursive: bool = True) -> Dict[str, ModuleType]:
""" Import all submodules of a module, recursively, including subpackages. """
package: ModuleType = importlib.import_module(package)
results = {}
# pyre-fixme[16]: `ModuleType` has no attribute `__path__... | code_fim | hard | {
"lang": "python",
"repo": "jimmylai/Fixit",
"path": "/fixit/common/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@add_slots
@dataclass(frozen=True)
class InvalidTestCase:
code: str
kind: Optional[str] = None
line: Optional[int] = None
column: Optional[int] = None
expected_replacement: Optional[str] = None
filename: str = DEFAULT_FILENAME
config: LintConfig = DEFAULT_CONFIG
@property... | code_fim | hard | {
"lang": "python",
"repo": "jimmylai/Fixit",
"path": "/fixit/common/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jimmylai/Fixit path: /fixit/common/utils.py
# 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.
import importlib
import inspect
import json
import pkgutil
import re
import... | code_fim | hard | {
"lang": "python",
"repo": "jimmylai/Fixit",
"path": "/fixit/common/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>plant_prob = np.zeros((ROWS, COLS, 1 + len(plant_types)))
leaf_grid = np.zeros((ROWS, COLS, len(plant_types)))
plant_locations = {}
id_ctr = 0
for plant in plant_objs:
add_plant(plant, id_ctr, plants, plant_types, plant_locations, grid, plant_grid, leaf_grid)
id_ctr += 1
grid['health'] = c... | code_fim | hard | {
"lang": "python",
"repo": "Rishiparikh/AlphaGarden",
"path": "/Learning/create_state.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rishiparikh/AlphaGarden path: /Learning/create_state.py
from simulator.sim_globals import ROWS, COLS, STEP, SECTOR_ROWS, SECTOR_COLS, PRUNE_WINDOW_ROWS, PRUNE_WINDOW_COLS, PRUNE_RATE, IRR_THRESHOLD
from simulator.plant_presets import PLANT_TYPES
from simulator.plant_type import PlantType
from sim... | code_fim | hard | {
"lang": "python",
"repo": "Rishiparikh/AlphaGarden",
"path": "/Learning/create_state.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>grid = np.empty((ROWS, COLS), dtype=[('water', 'f'), ('health', 'i'), ('nearby', 'O')])
grid['water'] = np.random.normal(0.4, 0.1, grid['water'].shape)
for i in range(ROWS):
for j in range(COLS):
grid[i, j]['nearby'] = set()
plant_grid = np.zeros((ROWS, COLS, len(plant_types)))
plant_prob = ... | code_fim | hard | {
"lang": "python",
"repo": "Rishiparikh/AlphaGarden",
"path": "/Learning/create_state.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: m80126colin/zzvm path: /lib/python/zzvm/__init__.py
from .instruction import Instruction
from .registers import Registers
from .opcode import Opcodes
from .parse<|fim_suffix|>truction', 'Registers', 'Opcodes', 'Parser', 'encode' ]<|fim_middle|>r import Parser
from . import encode
__all__ = [ 'In... | code_fim | easy | {
"lang": "python",
"repo": "m80126colin/zzvm",
"path": "/lib/python/zzvm/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>truction', 'Registers', 'Opcodes', 'Parser', 'encode' ]<|fim_prefix|># repo: m80126colin/zzvm path: /lib/python/zzvm/__init__.py
from .instruction import Instruction
from .registers i<|fim_middle|>mport Registers
from .opcode import Opcodes
from .parser import Parser
from . import encode
__all__ = [ 'In... | code_fim | medium | {
"lang": "python",
"repo": "m80126colin/zzvm",
"path": "/lib/python/zzvm/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: clEsperanto/pyclesperanto_prototype path: /pyclesperanto_prototype/_tier1/_transpose_xz.py
from .._tier0 import execute
from .._tier0 import plugin_function
from .._tier0 import create_none
from .._tier0 import create
from .._tier0 import Image
@plugin_function(output_creator=create_none, catego... | code_fim | hard | {
"lang": "python",
"repo": "clEsperanto/pyclesperanto_prototype",
"path": "/pyclesperanto_prototype/_tier1/_transpose_xz.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> execute(__file__, '../clij-opencl-kernels/kernels/transpose_xz_3d_x.cl', 'transpose_xz_3d', destination.shape, parameters)
return destination<|fim_prefix|># repo: clEsperanto/pyclesperanto_prototype path: /pyclesperanto_prototype/_tier1/_transpose_xz.py
from .._tier0 import execute
from .._tier0... | code_fim | hard | {
"lang": "python",
"repo": "clEsperanto/pyclesperanto_prototype",
"path": "/pyclesperanto_prototype/_tier1/_transpose_xz.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, child, dim_name=None):
"""
Args:
child (Node): The only child node of the Series node.
dim_name (str, optional): A named dimension with a given name may be given to the node, which it will
then pass to its child node. Defaults ... | code_fim | hard | {
"lang": "python",
"repo": "thalvari/dpEmu-AutoML",
"path": "/dpemu/nodes/series.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thalvari/dpEmu-AutoML path: /dpemu/nodes/series.py
# MIT License
#
# Copyright (c) 2019 Tuomas Halvari, Juha Harviainen, Juha Mylläri, Antti Röyskö, Juuso Silvennoinen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation ... | code_fim | hard | {
"lang": "python",
"repo": "thalvari/dpEmu-AutoML",
"path": "/dpemu/nodes/series.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Args:
children (list): List of child nodes of the TupleSeries node.
dim_name (str, optional): A named dimension with a given name may be given to the node, which it will
then pass to its child node. Defaults to None.
"""
super()._... | code_fim | hard | {
"lang": "python",
"repo": "thalvari/dpEmu-AutoML",
"path": "/dpemu/nodes/series.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
:param str location_arn: The Amazon Resource Name (ARN) of the location that is created.
"""
__args__ = dict()
__args__['locationArn'] = location_arn
opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
__ret__ = pulumi.runtime.invoke('aws-native:datasync... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws-native",
"path": "/sdk/python/pulumi_aws_native/datasync/get_location_object_storage.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi-aws-native path: /sdk/python/pulumi_aws_native/datasync/get_location_object_storage.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws-native",
"path": "/sdk/python/pulumi_aws_native/datasync/get_location_object_storage.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_custom.py
#calss header
class _CUSTOM():
def __init__(self,):
self.name = "CUSTOM"
self.definitions = [u'a way of behaving or a belief that has been established for a long time: ', u'something you usually do: ', u'the support given to a busine... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_custom.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KarishmaChanglani/MDDSearchEmail path: /SqlliteUtil.py
import sqlite3
from sqlite3 import Error
def create_connection(db_file):
""" create a database connection to a SQLite database """
conn = None
try:
conn = sqlite3.connect(db_file)
print(sqlite3.version)
excep... | code_fim | hard | {
"lang": "python",
"repo": "KarishmaChanglani/MDDSearchEmail",
"path": "/SqlliteUtil.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Create a new project into the projects table
:param conn:
:param url:
:return: project id
"""
sql = ''' SELECT * FROM results WHERE url= \"'''
cur = conn.cursor()
cur.execute(sql + url + "\"")
return cur.fetchone()
if __name__ == '__main__'... | code_fim | hard | {
"lang": "python",
"repo": "KarishmaChanglani/MDDSearchEmail",
"path": "/SqlliteUtil.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.extract_work_info(data_items)
def extract_work_info(self, data_items):
"""
Extracts information from the json.
"""
result = []
count = 0
for data_item in data_items:
keep = True
if self.filters.get('min') != None and data_item['bookmarkCount'] < se... | code_fim | hard | {
"lang": "python",
"repo": "ALMSIVI/pixiv_tools",
"path": "/PixivCrawler/Pixiv.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ALMSIVI/pixiv_tools path: /PixivCrawler/Pixiv.py
import requests
import json
from bs4 import BeautifulSoup
from pathlib import Path
from ParamParser import *
import time
class Pixiv:
def __init__(self):
with open('config.json', encoding='utf-8') as config:
self.config = json.load(con... | code_fim | hard | {
"lang": "python",
"repo": "ALMSIVI/pixiv_tools",
"path": "/PixivCrawler/Pixiv.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: projectscara2014/scara path: /working_directory/utils/exception_handling.py
import sys
import inspect
WORKING_DIRECTORY = ''
SPLITTING_CHARACTER = ''
if sys.platform.startswith('win') :
SPLITTING_CHARACTER = '\{}'.format('')
elif sys.platform.startswith('darwin') :
SPLITTING_CHARACTER = '/'
... | code_fim | hard | {
"lang": "python",
"repo": "projectscara2014/scara",
"path": "/working_directory/utils/exception_handling.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> module_name = inspect.stack()[1][1].split("\\")[-1].split(".")[0]
executable_string = "gui_init_module.gui_exception_handling." + module_name + "_" + exception_name + "(*args)"
print(executable_string)
log_error(module_name,exception_name)
try :
exec(executable_string)
except NameError :
pri... | code_fim | hard | {
"lang": "python",
"repo": "projectscara2014/scara",
"path": "/working_directory/utils/exception_handling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gustavozf/image_segmentation path: /colors.py
import numpy as np
MAX_GRAY = 256
MIN_GRAY = 0
def tri_factors(n):
mmc = []
divisor = 2
while n > 1:
if n % divisor == 0:
mmc.append(divisor)
n = n/divisor
else:
divisor += 1
<|fim_suf... | code_fim | hard | {
"lang": "python",
"repo": "gustavozf/image_segmentation",
"path": "/colors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = np.linspace(MIN_GRAY, MAX_GRAY-1, a, dtype=int)
b = np.linspace(MIN_GRAY, MAX_GRAY-1, b, dtype=int)
c = np.linspace(MIN_GRAY, MAX_GRAY-1, c, dtype=int)
return np.array(np.meshgrid(a, b, c)).T.reshape(-1, 3)<|fim_prefix|># repo: gustavozf/image_segmentation path: /colors.py
import num... | code_fim | hard | {
"lang": "python",
"repo": "gustavozf/image_segmentation",
"path": "/colors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cur_business_url = _BUSINESS_URL.format(code=movie_code)
busi_page = bs(request.urlopen(cur_business_url), "html.parser")
busi_str = str(busi_page)
weekend_contents = re.findall(_WEEKEND_CONTENT_REGEX, busi_str)[0]
num_screens_list = [
int(match.replace(',', ''))
for ma... | code_fim | hard | {
"lang": "python",
"repo": "Sandy4321/holcrawl",
"path": "/holcrawl/imdb_crawl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> content = []
for row in table.find_all("tr")[1:]:
content.append([td.get_text() for td in row.find_all("td")])
return content
_RATINGS_URL = 'http://www.imdb.com/title/{code}/ratings'
def _get_rating_props(movie_code):
cur_ratings_url = _RATINGS_URL.format(code=movie_code)
r... | code_fim | hard | {
"lang": "python",
"repo": "Sandy4321/holcrawl",
"path": "/holcrawl/imdb_crawl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sandy4321/holcrawl path: /holcrawl/imdb_crawl.py
B movie profiles."""
import sys
import re
import os
from datetime import datetime
from urllib import request
import urllib
import traceback
from bs4 import BeautifulSoup as bs
from tqdm import tqdm
import pandas as pd
import morejson as json
fro... | code_fim | hard | {
"lang": "python",
"repo": "Sandy4321/holcrawl",
"path": "/holcrawl/imdb_crawl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t_version(),
packages=find_packages()
)<|fim_prefix|># repo: teambank/nuedigitalfestival2019-ml-api-kubernetes path: /setup.py
"""Setup
"""
from setuptools import setup, find_packages
from version import get_version
setu<|fim_middle|>p(
name="nuedigitalmlapi",
version=ge | code_fim | easy | {
"lang": "python",
"repo": "teambank/nuedigitalfestival2019-ml-api-kubernetes",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: teambank/nuedigitalfestival2019-ml-api-kubernetes path: /setup.py
"""Setup
"""
from setuptools import setup, find_packages
from version import get_version
setu<|fim_suffix|>t_version(),
packages=find_packages()
)<|fim_middle|>p(
name="nuedigitalmlapi",
version=ge | code_fim | easy | {
"lang": "python",
"repo": "teambank/nuedigitalfestival2019-ml-api-kubernetes",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>p(
name="nuedigitalmlapi",
version=get_version(),
packages=find_packages()
)<|fim_prefix|># repo: teambank/nuedigitalfestival2019-ml-api-kubernetes path: /setup.py
"""Setup
"""
from setuptools import setup, fin<|fim_middle|>d_packages
from version import get_version
setu | code_fim | easy | {
"lang": "python",
"repo": "teambank/nuedigitalfestival2019-ml-api-kubernetes",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloew/NytramBox2D path: /nytram_box2d/collisions/collision.py
from .collidable_pair import CollidablePair
class Collision:
""" Represents a possible collision between bodies """
@classmethod
def createCollision(cls, first, second, fnKwarg):
def createCollision(fn):
... | code_fim | medium | {
"lang": "python",
"repo": "cloew/NytramBox2D",
"path": "/nytram_box2d/collisions/collision.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Decorator to create a collision between the given collidables """
return cls.createCollision(first, second, "start")
@classmethod
def stop(cls, first, second):
""" Decorator to create a collision between the given collidables """
return cls.createColl... | code_fim | hard | {
"lang": "python",
"repo": "cloew/NytramBox2D",
"path": "/nytram_box2d/collisions/collision.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: longdongchuan/ML_Project path: /Package/bayesian_tree/bayesian_decision_tree/hyperplane_optimization.py
from abc import ABC, abstractmethod
import numpy as np
from numpy.random import RandomState
from scipy.sparse import csr_matrix, csc_matrix
from bayesian_decision_tree.utils import r2_series_... | code_fim | hard | {
"lang": "python",
"repo": "longdongchuan/ML_Project",
"path": "/Package/bayesian_tree/bayesian_decision_tree/hyperplane_optimization.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
A simple gradient descent optimizer (experimental).
TODO: Complete
"""
def __init__(self, n_init, n_keep):
super().__init__(search_space_is_unit_hypercube=True)
self.n_init = n_init
self.n_keep = n_keep
def solve(self, optimization_function):
... | code_fim | hard | {
"lang": "python",
"repo": "longdongchuan/ML_Project",
"path": "/Package/bayesian_tree/bayesian_decision_tree/hyperplane_optimization.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> indices2 = class_indices[class2]
p1 = X[indices1[rand.randint(0, len(indices1))]]
p2 = X[indices2[rand.randint(0, len(indices2))]]
if not dense:
p1 = p1.toarray()[0]
p2 = p2.toarray()[0]
normal = p2-p1
... | code_fim | hard | {
"lang": "python",
"repo": "longdongchuan/ML_Project",
"path": "/Package/bayesian_tree/bayesian_decision_tree/hyperplane_optimization.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#
# - the port's value is stored as Optional[DataItemValue]
# - order of union is used to parse object upon construction
# - DataItemValue values are resolved into an ItemValue using Port.get_value()
# - ItemValue values are resolved into ItemConcreteValue using Port.get()
# - ItemConcreteValue are the ... | code_fim | hard | {
"lang": "python",
"repo": "ITISFoundation/osparc-simcore",
"path": "/packages/simcore-sdk/src/simcore_sdk/node_ports_v2/links.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ITISFoundation/osparc-simcore path: /packages/simcore-sdk/src/simcore_sdk/node_ports_v2/links.py
from pathlib import Path
from typing import Any, Union
from models_library.basic_regex import UUID_RE
from models_library.projects_nodes_io import BaseFileLink, DownloadLink
from models_library.proje... | code_fim | hard | {
"lang": "python",
"repo": "ITISFoundation/osparc-simcore",
"path": "/packages/simcore-sdk/src/simcore_sdk/node_ports_v2/links.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>| Operator | Is Supported |
|-------|------------------ |
"""
if __name__ == "__main__":
pattern = re.compile("\(([^)]*)\)")
for name, alias in (
('TensorFlow Lite', 'tflite'),
('Caffe', 'caffe'),
('ONNX', 'onnx'),
('PaddlePaddle', 'paddle'),
):
txt = ... | code_fim | medium | {
"lang": "python",
"repo": "kendryte/nncase",
"path": "/tools/gen_op_support_doc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kendryte/nncase path: /tools/gen_op_support_doc.py
import re
def get_file_header(name: str):
return f"""## Supported {name} ops
<|fim_suffix|>
if __name__ == "__main__":
pattern = re.compile("\(([^)]*)\)")
for name, alias in (
('TensorFlow Lite', 'tflite'),
('Caffe'... | code_fim | medium | {
"lang": "python",
"repo": "kendryte/nncase",
"path": "/tools/gen_op_support_doc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
pattern = re.compile("\(([^)]*)\)")
for name, alias in (
('TensorFlow Lite', 'tflite'),
('Caffe', 'caffe'),
('ONNX', 'onnx'),
('PaddlePaddle', 'paddle'),
):
txt = get_file_header(name)
with open(f'src/importer/{alias}/o... | code_fim | medium | {
"lang": "python",
"repo": "kendryte/nncase",
"path": "/tools/gen_op_support_doc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for key, value in sorted(hashtagcount_dic.iteritems(), key=lambda (k,v): (v,k), reverse=True):
print "%s %s" % (key, value)
count += 1
if (count==10):
break
#for k, v in hashtagcount_dic.iteritems():
#print k, ' ', v
#count10 += 1
#if (c... | code_fim | hard | {
"lang": "python",
"repo": "hkaushalya/IntroDataScienceCoursera",
"path": "/Ass1_TwitterSentimentAnalysis/rawcode/top_ten.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tags_dic = tag_lst[0]
hashtag = tags_dic[u'text']
if (DEBUG):
print 'found tags = ', hashtag, '(', type(hashtag),')'
word = hashtag.encode('utf-8')
if word in hashtagcount_dic: # increment c... | code_fim | hard | {
"lang": "python",
"repo": "hkaushalya/IntroDataScienceCoursera",
"path": "/Ass1_TwitterSentimentAnalysis/rawcode/top_ten.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hkaushalya/IntroDataScienceCoursera path: /Ass1_TwitterSentimentAnalysis/rawcode/top_ten.py
import sys
#from tweet_sentiment import *
import json
DEBUG = False
def myprocess(tw_file):
hashtagcount_dic = {}
for line in tw_file:
sc = 0
try: json_dic = json.loads(line)
... | code_fim | hard | {
"lang": "python",
"repo": "hkaushalya/IntroDataScienceCoursera",
"path": "/Ass1_TwitterSentimentAnalysis/rawcode/top_ten.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simotrone/astro path: /li_ma/monte_carlo_significance.py
from scipy import average as avg
from scipy.stats import poisson, norm
import argparse
import matplotlib.pyplot as plt
import numpy as np
import pprint
import lib.significance as li_ma
def describe_data(data, title='No title', **opts):
... | code_fim | hard | {
"lang": "python",
"repo": "simotrone/astro",
"path": "/li_ma/monte_carlo_significance.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def compute_integral_frequency_distribution(data, total_observations, keys, thresholds=[0,1,2,3,4,5]):
result = {}
for k in keys:
result[k] = { # for each significance equation:
'count': np.zeros(len(thresholds)), # counts per significance threshold
... | code_fim | hard | {
"lang": "python",
"repo": "simotrone/astro",
"path": "/li_ma/monte_carlo_significance.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Mish: A Self Regularized Non-Monotonic Activation Function
https://arxiv.org/pdf/1908.08681.pdf
Mish(x) = x * tanh(ln(1+e^x))
Args:
x: A `Tensor` representing preactivation values.
Returns:
The activation value.
"""
x = tf.convert_to_tensor(x)
return x * tf.tanh(tf.nn.s... | code_fim | medium | {
"lang": "python",
"repo": "jianzhnie/models",
"path": "/official/modeling/activations/mish.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jianzhnie/models path: /official/modeling/activations/mish.py
# Copyright 2023 The TensorFlow Authors. 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 | medium | {
"lang": "python",
"repo": "jianzhnie/models",
"path": "/official/modeling/activations/mish.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> responses.add(
method="POST",
url=f"/upload/storage/v1/b/{bucket_name}/o?uploadType=multipart",
match_querystring=True,
body="{}",
status=200,
content_type='multipart/form-data'
)<|fim_prefix|># repo: alokranjan1234/turing path: /sdk/tests/fixtures/... | code_fim | hard | {
"lang": "python",
"repo": "alokranjan1234/turing",
"path": "/sdk/tests/fixtures/gcs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alokranjan1234/turing path: /sdk/tests/fixtures/gcs.py
import json
import os
import pytest
import google.auth.environment_vars
@pytest.fixture
def mock_gcs(responses, bucket_name):
os.environ[google.auth.environment_vars.PROJECT] = "test-project"
<|fim_suffix|> responses.add(
me... | code_fim | hard | {
"lang": "python",
"repo": "alokranjan1234/turing",
"path": "/sdk/tests/fixtures/gcs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pub = rospy.Publisher('gps_topic', gps_message, queue_size=10)
rospy.init_node('gps_node', anonymous=True)
rate = rospy.Rate(5)
while not rospy.is_shutdown():
gps.update()
message = gps_message()
#message.timeStamp = int(time.mktime((1999, 11, 20, 5, 27, 35, 0, 1, 0... | code_fim | hard | {
"lang": "python",
"repo": "cchienhao/VisionSystemForAnAutonomousRailwayMaintenanceVehicle",
"path": "/ROS Sources/gps/src/gps_node.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cchienhao/VisionSystemForAnAutonomousRailwayMaintenanceVehicle path: /ROS Sources/gps/src/gps_node.py
#!/usr/bin/env python3
import rospy
import time
#import busio
import adafruit_gps
import serial
from gps.msg import gps_message
# Connect to GPS receiver and send out data through ROS
def publi... | code_fim | hard | {
"lang": "python",
"repo": "cchienhao/VisionSystemForAnAutonomousRailwayMaintenanceVehicle",
"path": "/ROS Sources/gps/src/gps_node.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_fetch_publication_data():
base_dir = "fermi_hubbard_data"
fetch_publication_data(base_dir=base_dir, exclude=["trapping_3u3d"])
for path in ("gaussians_1u1d_nofloquet", "gaussians_1u1d", "trapping_2u2d"):
assert os.path.exists(base_dir + os.path.sep + path)
fetch_publicat... | code_fim | medium | {
"lang": "python",
"repo": "quantumlib/ReCirq",
"path": "/recirq/fermi_hubbard/publication_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fetch_publication_data(base_dir=base_dir)
assert os.path.exists(base_dir + os.path.sep + "trapping_3u3d")<|fim_prefix|># repo: quantumlib/ReCirq path: /recirq/fermi_hubbard/publication_test.py
# Copyright 2020 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may no... | code_fim | hard | {
"lang": "python",
"repo": "quantumlib/ReCirq",
"path": "/recirq/fermi_hubbard/publication_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quantumlib/ReCirq path: /recirq/fermi_hubbard/publication_test.py
# Copyright 2020 Google
#
# 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
#
# https://www.apache.org... | code_fim | medium | {
"lang": "python",
"repo": "quantumlib/ReCirq",
"path": "/recirq/fermi_hubbard/publication_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# ##########################################################
# Gather on root
# ##########################################################
list_all_dicts = comm.gather(list_of_dict_agg_feat, root=0)
# print TEMP_FOLDER
shutil.rmtree(TEMP_FOLDER)
del list_of_dict_agg_feat
print 'Rank {0} finis... | code_fim | hard | {
"lang": "python",
"repo": "vigliensoni/MLHD",
"path": "/scripts/MPI/12_mainstreamness_to_hdf5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># input_folder, H5_FILEPATH, precomputed_artist_ranking, precomputed_album_ranking, precomputed_track_ranking
def run(input_folder, H5_FILEPATH, precomputed_artist_ranking, precomputed_album_ranking, precomputed_track_ranking):
"""
Running the core code. Taking this approach for creating a different ... | code_fim | hard | {
"lang": "python",
"repo": "vigliensoni/MLHD",
"path": "/scripts/MPI/12_mainstreamness_to_hdf5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vigliensoni/MLHD path: /scripts/MPI/12_mainstreamness_to_hdf5.py
#! /opt/sharcnet/python/2.7.5/intel/bin/python
# #######################################
# SUBMISSION
# #######################################
# sqsub -r 5m -q mpi --mpp 6GB -o test_mainstreamness.log -n 2 python 4_SCRIPTS/MPI/12... | code_fim | hard | {
"lang": "python",
"repo": "vigliensoni/MLHD",
"path": "/scripts/MPI/12_mainstreamness_to_hdf5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __str__(this):
return "%d%s_{%d/2}" % \
( this.n, this.spectral_notation_reverse[this.l], this.j)
def __eq__(this, other):
return this.n == other.n and this.l == other.l and this.j == other.j
def __neq__(this, other): return not this == other<|fim_prefix|># r... | code_fim | medium | {
"lang": "python",
"repo": "NuclearTalent/NuclearStructure",
"path": "/doc/Programs/PythonCodesVeff/partial_wave.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NuclearTalent/NuclearStructure path: /doc/Programs/PythonCodesVeff/partial_wave.py
class PartialWave(object):
spectral_notation = {
"s" : 0,
"p" : 1,
"d" : 2,
"f" : 3,
"g" : 4,
"h" : 5
}
<|fim_suffix|> return "%d%s_{%d/2}" % \
... | code_fim | hard | {
"lang": "python",
"repo": "NuclearTalent/NuclearStructure",
"path": "/doc/Programs/PythonCodesVeff/partial_wave.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: podoc/podoc path: /podoc/tree.py
# -*- coding: utf-8 -*-
"""Tree."""
#-------------------------------------------------------------------------------------------------
# Imports
#-------------------------------------------------------------------------------------------------
from itertools i... | code_fim | hard | {
"lang": "python",
"repo": "podoc/podoc",
"path": "/podoc/tree.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def filter_tree(tree, func):
class FilterTransformer(TreeTransformer):
def transform_Node(self, node):
node = func(node.copy())
if node:
node.children = self.transform_children(node)
return node
return FilterTransformer().transform(tree)... | code_fim | hard | {
"lang": "python",
"repo": "podoc/podoc",
"path": "/podoc/tree.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> chain = project.get_chain(chain_name)
if isinstance(chain, BaseGethChain):
chain.geth.register_stdout_callback(logger.info)
chain.geth.register_stderr_callback(logger.error)
with chain:
try:
while True:
time.sleep(0.2)
except Keyboa... | code_fim | hard | {
"lang": "python",
"repo": "voith/populus",
"path": "/populus/cli/chain_cmd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: voith/populus path: /populus/cli/chain_cmd.py
import logging
import time
import click
from populus.api.utils import (
new_local_chain,
)
from populus.chain import (
BaseGethChain,
)
from populus.utils.geth import (
reset_chain,
)
from .main import main
@main.group('chain')
@cli... | code_fim | hard | {
"lang": "python",
"repo": "voith/populus",
"path": "/populus/cli/chain_cmd.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if x < y and x < z:
print('x is least')
elif y < z:
print('y is least')
else:
print('z is least')<|fim_prefix|># repo: luchenhua/MIT-OCW-600 path: /src/lect02.py
from Tools.Scripts.treesync import raw_input
__author__ = 'luchenhua'
x = 3
x *= x
print(x)
y = raw_input('Enter a number: ')
pr... | code_fim | medium | {
"lang": "python",
"repo": "luchenhua/MIT-OCW-600",
"path": "/src/lect02.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = int(raw_input('Enter x: '))
y = int(raw_input('Enter y: '))
z = int(raw_input('Enter z: '))
if x < y:
if x < z:
print('x is least')
else:
print('z is least')
else:
print('y is least')
if x < y:
if x < z:
print('x is least')
else:
print('z is least'... | code_fim | hard | {
"lang": "python",
"repo": "luchenhua/MIT-OCW-600",
"path": "/src/lect02.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luchenhua/MIT-OCW-600 path: /src/lect02.py
from Tools.Scripts.treesync import raw_input
__author__ = 'luchenhua'
x = 3
x *= x
print(x)
y = raw_input('Enter a number: ')
print(type(y))
print(y)
y = float(raw_input('Enter a number: '))
print(type(y))
print(y)
print(y * y)
x = int(raw_input('En... | code_fim | medium | {
"lang": "python",
"repo": "luchenhua/MIT-OCW-600",
"path": "/src/lect02.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: diogoaurelio/floto path: /floto/decider/dynamic_decider.py
import floto
from floto.decider import Decider
import json
class DynamicDecider(Decider):
def __init__(self, decider_spec):
<|fim_suffix|> def get_decider_spec_from_input(self):
input_ = self.history.get_workflow_input()
... | code_fim | hard | {
"lang": "python",
"repo": "diogoaurelio/floto",
"path": "/floto/decider/dynamic_decider.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.