text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> """
获取sku商品信息
:param request:
:return:
"""
# 1、查询所有sku商品
skus = SKU.objects.all()
# 2、序列化返回
ser = SKUSerializer(skus, many=True)
return Response(ser.data)<|fim_prefix|># repo: HuiDBK/meiduo_project path: /meiduo_mall/meiduo_m... | code_fim | hard | {
"lang": "python",
"repo": "HuiDBK/meiduo_project",
"path": "/meiduo_mall/meiduo_mall/apps/meiduo_admin/views/images.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HuiDBK/meiduo_project path: /meiduo_mall/meiduo_mall/apps/meiduo_admin/views/images.py
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from goods.models import SKUImage, SKU
from meiduo_admin.serializers.images import ImagesSerializer, SKUSerializer
f... | code_fim | medium | {
"lang": "python",
"repo": "HuiDBK/meiduo_project",
"path": "/meiduo_mall/meiduo_mall/apps/meiduo_admin/views/images.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> queryset = SKUImage.objects.all()
serializer_class = ImagesSerializer
pagination_class = PageNum
permission_classes = [IsAdminUser]
def simple(self, request):
"""
获取sku商品信息
:param request:
:return:
"""
# 1、查询所有sku商品
skus = SKU.ob... | code_fim | medium | {
"lang": "python",
"repo": "HuiDBK/meiduo_project",
"path": "/meiduo_mall/meiduo_mall/apps/meiduo_admin/views/images.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryliejamesthomas/tumblr_backup path: /tumblr_backup.py
# standard Python library imports
import os
import sys
import urllib2
import codecs
import logging
# extra required packages
from bs4 import BeautifulSoup
# Tumblr specific constants
TUMBLR_URL = "/api/read"
# configuration variables
ENCOD... | code_fim | hard | {
"lang": "python",
"repo": "ryliejamesthomas/tumblr_backup",
"path": "/tumblr_backup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if quote:
f.write("<blockquote>\n\t\t<p>" + quote + "</p>\n\t\t")
if source:
f.write('<cite>' + source + '</cite>\n\t')
if quote:
f.write("</blockquote>")
# Footer for all posts
f.write("\n</article>")
f.close()
# - - - - - - - - - - - - - - - - -
#
# SCRAPING
def backup(account, sa... | code_fim | hard | {
"lang": "python",
"repo": "ryliejamesthomas/tumblr_backup",
"path": "/tumblr_backup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kylebegovich/ICIdo path: /forum/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-18 20:33
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|>
initial = True
dependencies = [
('mainsite', '000... | code_fim | hard | {
"lang": "python",
"repo": "kylebegovich/ICIdo",
"path": "/forum/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('mainsite', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Event',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', m... | code_fim | hard | {
"lang": "python",
"repo": "kylebegovich/ICIdo",
"path": "/forum/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ManishBilore/deep-sight path: /test/convert_to_vdb.py
'''
Copyright 2020 CITA
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/LICENSE-2.0
<... | code_fim | hard | {
"lang": "python",
"repo": "ManishBilore/deep-sight",
"path": "/test/convert_to_vdb.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not file_path:
return
# Load grid
print("Loading {}...".format(file_path))
grid = deepsight.Grid.read(file_path)
mat = [
[0.001,0,0,0],
[0,0.001,0,0],
[0,0,0.01,0],
[0,0,0,1]]
grid.transform = mat
grid.name = "density"
file_pat... | code_fim | hard | {
"lang": "python",
"repo": "ManishBilore/deep-sight",
"path": "/test/convert_to_vdb.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = tf.keras.models.Sequential([
tf.keras.layers.Conv2D(
32,
kernel_size=(3, 3),
activation='relu',
data_format=data_format,
input_shape=(28, 28, 1),
kernel_initializer=initializer),
tf.keras.layers.MaxPool2D(pool_size=(2, 2), d... | code_fim | hard | {
"lang": "python",
"repo": "google-research/federated",
"path": "/utils/models/emnist_models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google-research/federated path: /utils/models/emnist_models.py
# Copyright 2019, Google LLC.
#
# 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.... | code_fim | hard | {
"lang": "python",
"repo": "google-research/federated",
"path": "/utils/models/emnist_models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: googleapis/discovery-artifact-manager path: /google-api-client-generator/src/googleapis/codegen/utilities/ordered_set_test.py
#!/usr/bin/python2.7
"""Tests for ordered_set.py."""
from google.apputils import basetest
from googleapis.codegen.utilities import ordered_set
<|fim_suffix|> s = ord... | code_fim | hard | {
"lang": "python",
"repo": "googleapis/discovery-artifact-manager",
"path": "/google-api-client-generator/src/googleapis/codegen/utilities/ordered_set_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = ordered_set.MutableOrderedSet()
for i in range(5):
s.add(i)
self.assertEquals(5, len(s))
self.assertTrue(4 in s)
self.assertEquals(range(5), list(s))
s.remove(3)
self.assertEquals([0, 1, 2, 4], list(s))
s.clear()
self.assertEquals(0, len(s))
if __name__ == ... | code_fim | hard | {
"lang": "python",
"repo": "googleapis/discovery-artifact-manager",
"path": "/google-api-client-generator/src/googleapis/codegen/utilities/ordered_set_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:type nums: List[int]
:rtype: int
"""
result = len(nums)*(len(nums)-1)//2
cnt = collections.Counter()
for i, x in enumerate(nums):
result -= cnt[x-i]
cnt[x-i] += 1
return result<|fim_prefix|># repo: kamyu104/LeetCo... | code_fim | medium | {
"lang": "python",
"repo": "kamyu104/LeetCode-Solutions",
"path": "/Python/count-number-of-bad-pairs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kamyu104/LeetCode-Solutions path: /Python/count-number-of-bad-pairs.py
# Time: O(n)
# Space: O(n)
import collections
<|fim_suffix|> """
:type nums: List[int]
:rtype: int
"""
result = len(nums)*(len(nums)-1)//2
cnt = collections.Counter()
... | code_fim | medium | {
"lang": "python",
"repo": "kamyu104/LeetCode-Solutions",
"path": "/Python/count-number-of-bad-pairs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Alonso94/fanlearn path: /fl_control/scripts/fanuc_teleop_joy.py
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
from sensor_msgs.msg import Joy
# This ROS Node converts Joystick inputs from the joy node into commands for Fanuc
<|fim_suffix|> if data.buttons[6] == 1:
... | code_fim | hard | {
"lang": "python",
"repo": "Alonso94/fanlearn",
"path": "/fl_control/scripts/fanuc_teleop_joy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # publishing to 'Gamepad_wasd' to control Fanuc
global pub
rospy.init_node('gamepad_node')
pub = rospy.Publisher('gamepad_wasd', String, queue_size=5)
# subscribed to joystick inputs on topic "joy"
rospy.Subscriber("joy", Joy, callback)
# starts the node
rospy.spin()
if _... | code_fim | hard | {
"lang": "python",
"repo": "Alonso94/fanlearn",
"path": "/fl_control/scripts/fanuc_teleop_joy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return GPIO.input(sensor)
def CheckForMotion(pin):
return GPIO.input(pin)
def SoundTheAlarm():
os.system('mpg123 -q alarm.mp3 &')<|fim_prefix|># repo: rburkhead/RPiDayActivity path: /RPiDayActivityFiles/Setup.py
import RPi.GPIO as GPIO
import time
import os
# Using the BCM layout instead o... | code_fim | hard | {
"lang": "python",
"repo": "rburkhead/RPiDayActivity",
"path": "/RPiDayActivityFiles/Setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def SoundTheAlarm():
os.system('mpg123 -q alarm.mp3 &')<|fim_prefix|># repo: rburkhead/RPiDayActivity path: /RPiDayActivityFiles/Setup.py
import RPi.GPIO as GPIO
import time
import os
# Using the BCM layout instead of the physical pin layout
GPIO.setmode (GPIO.BCM)
GPIO.setwarnings(False)
# Pin num... | code_fim | medium | {
"lang": "python",
"repo": "rburkhead/RPiDayActivity",
"path": "/RPiDayActivityFiles/Setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rburkhead/RPiDayActivity path: /RPiDayActivityFiles/Setup.py
import RPi.GPIO as GPIO
import time
import os
# Using the BCM layout instead of the physical pin layout
GPIO.setmode (GPIO.BCM)
GPIO.setwarnings(False)
<|fim_suffix|>def CheckForMotion(pin):
return GPIO.input(pin)
def SoundTheAla... | code_fim | hard | {
"lang": "python",
"repo": "rburkhead/RPiDayActivity",
"path": "/RPiDayActivityFiles/Setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> end_of_url = 'assetinfo/assets/{id}'.format(id=str(self.id))
self._info = self._imi.make_request(method='get', end_of_url=end_of_url)
@property
def history(self):
self._get_history()
return self._history
def _get_history(self):
end_of_url = 'assethisto... | code_fim | medium | {
"lang": "python",
"repo": "mdmeacham/pyimi",
"path": "/pyimi/assets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mdmeacham/pyimi path: /pyimi/assets.py
from .exceptions import MoveError
from datetime import datetime
class Asset:
def __init__(self, imi_data, imi):
self._imi = imi
self.id = imi_data['assetId']
self.name = imi_data['assetName']
self.vendor_id = imi_data['as... | code_fim | hard | {
"lang": "python",
"repo": "mdmeacham/pyimi",
"path": "/pyimi/assets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self._model_variable_scope('ssd300_model'):
if self.data_format == 'channels_first':
# Convert the inputs from channels_last (NHWC) to channels_first (NCHW).
# This provides a large performance boost on GPU. See
# https://www.tensorf... | code_fim | hard | {
"lang": "python",
"repo": "koala7580/deep-learning-practice",
"path": "/tensorflow/object_detection/models/ssd/ssd300.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: koala7580/deep-learning-practice path: /tensorflow/object_detection/models/ssd/ssd300.py
# Copyright 2017 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 o... | code_fim | hard | {
"lang": "python",
"repo": "koala7580/deep-learning-practice",
"path": "/tensorflow/object_detection/models/ssd/ssd300.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Add operations to classify a batch of input images.
Args:
inputs: A Tensor representing a batch of input images.
training: A boolean. Set to True to add operations required only when
training the classifier.
Returns:
A logits Tensor wi... | code_fim | hard | {
"lang": "python",
"repo": "koala7580/deep-learning-practice",
"path": "/tensorflow/object_detection/models/ssd/ssd300.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kreusada/python-dcl path: /dcl/objects.py
from ._maps import _diacritic_map, _diacritic_char_map
from .errors import DiacriticError
__all__ = ("DiacriticApplicant", "Character")
class Character:
def __init__(self, char, diacritic_name):
self.character = char
self.raw = f"\\... | code_fim | hard | {
"lang": "python",
"repo": "Kreusada/python-dcl",
"path": "/dcl/objects.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._fetch_diacritic("umlaut")
@property
def caron(self):
return self._fetch_diacritic("caron")
@property
def ring(self):
return self._fetch_diacritic("ring")
@property
def cedilla(self):
return self._fetch_diacritic("cedilla")
@prope... | code_fim | hard | {
"lang": "python",
"repo": "Kreusada/python-dcl",
"path": "/dcl/objects.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi-azure-native path: /sdk/python/pulumi_azure_native/desktopvirtualization/v20220210preview/_enums.py
# coding=utf-8
# *** WARNING: this file was generated by pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ =... | code_fim | medium | {
"lang": "python",
"repo": "pulumi/pulumi-azure-native",
"path": "/sdk/python/pulumi_azure_native/desktopvirtualization/v20220210preview/_enums.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SessionHostLoadBalancingAlgorithm(str, Enum):
"""
Load balancing algorithm for ramp up period.
"""
BREADTH_FIRST = "BreadthFirst"
DEPTH_FIRST = "DepthFirst"
class SkuTier(str, Enum):
"""
This field is required to be implemented by the Resource Provider if the service ha... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-azure-native",
"path": "/sdk/python/pulumi_azure_native/desktopvirtualization/v20220210preview/_enums.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>9 4
n=int(input())
a=list(map(int,input().split()))
l,k=[],[]
for i in a:
b=bin(i)[2:]
l.append([b.count("1"),i])
if b.count("1") not in k:
k.append(b.count("1"))
l.sort()
k.sort(reverse=True)
i=n-1
while(i>-1):
j=i-1
m=[]
m.append(l[i][1])
while(j>=0 and l[i][0]==l[j][... | code_fim | hard | {
"lang": "python",
"repo": "muhammad-masood-ur-rehman/Skillrack",
"path": "/Python Programs/sort-integers-based-on-ones.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>on of 31 is 11111.
The binary representation of 790 is 1100010110.
The binary representation of 78 is 1001110.
The binary representation of 10 is 1010.
The binary representation of 65 is 1000001.
The binary representation of 2 is 10.
Here the 6 integers are sorted based on the number of ones in their bina... | code_fim | hard | {
"lang": "python",
"repo": "muhammad-masood-ur-rehman/Skillrack",
"path": "/Python Programs/sort-integers-based-on-ones.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muhammad-masood-ur-rehman/Skillrack path: /Python Programs/sort-integers-based-on-ones.py
Sort Integers based on Ones
The program must accept N integers as the input. The program must sort the integers based on the number of ones in their binary representation in descending order. If more than o... | code_fim | hard | {
"lang": "python",
"repo": "muhammad-masood-ur-rehman/Skillrack",
"path": "/Python Programs/sort-integers-based-on-ones.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: radtek/MultiverseClientServer path: /Media/common/Scripts/Startup.py
import ClientAPI
# Most worlds will want this for the client side animations,
# though it should probably be customized
import ClientAnimations
# This sets up the character creation and selection
import SampleCharacterCreation... | code_fim | hard | {
"lang": "python",
"repo": "radtek/MultiverseClientServer",
"path": "/Media/common/Scripts/Startup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># this contains the (limited) training api
import MarsTraining
# this contains the (limited) class ability api
import MarsClassAbility
# this contains the skill api
import MarsSkill
# this contains a system to handle commands on the client
import MarsCommand
# this contains code to create ui events for so... | code_fim | hard | {
"lang": "python",
"repo": "radtek/MultiverseClientServer",
"path": "/Media/common/Scripts/Startup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lee-vius/python-preview path: /pythonFiles/pydev/debugger.py
import sys
import socket
import traceback
import pg_logger
import json
import util as _util
to_bytes = _util.to_bytes
to_str = _util.to_str
read_bytes = _util.read_bytes
write_bytes = _util.write_bytes
read_int = _util.read_int
write_... | code_fim | hard | {
"lang": "python",
"repo": "lee-vius/python-preview",
"path": "/pythonFiles/pydev/debugger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DebuggerExitException(Exception): pass
class DebuggerLoop:
instacne = None
def __init__(self, conn):
DebuggerLoop.instacne = self
self._conn = conn
self._command_table = {
to_bytes('outp'): self.command_exec_script,
to_bytes('detc'): sel... | code_fim | hard | {
"lang": "python",
"repo": "lee-vius/python-preview",
"path": "/pythonFiles/pydev/debugger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arnabs542/interview-notes path: /notes/algo-ds-practice/problems/divide_conquer/largest_rectangle_in_histogram.py
'''
Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars.
For simplicity, assume that all bars have s... | code_fim | medium | {
"lang": "python",
"repo": "arnabs542/interview-notes",
"path": "/notes/algo-ds-practice/problems/divide_conquer/largest_rectangle_in_histogram.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>SOLUTION 2:
We can use Divide and Conquer to solve this in O(nLogn) time.
The idea is to find the minimum value in the given array.
Once we have index of the minimum value, the max area is maximum of following three values.
a) Maximum area in left side of minimum value (Not including the min value)
b) Max... | code_fim | hard | {
"lang": "python",
"repo": "arnabs542/interview-notes",
"path": "/notes/algo-ds-practice/problems/divide_conquer/largest_rectangle_in_histogram.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kbren/uwnet path: /uwnet/sam_ngaqua.py
import os
import numpy as np
import torch
import logging
import attr
import xarray as xr
from toolz import valmap, curry
from uwnet.thermo import compute_apparent_source
def _dataarray_to_numpy(x):
<|fim_suffix|>
@curry
def _get_numpy_from_time(x, time):
... | code_fim | medium | {
"lang": "python",
"repo": "kbren/uwnet",
"path": "/uwnet/sam_ngaqua.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.sources = dict(
FQTNN=compute_apparent_source(ngaqua.QT, ngaqua.FQT * 86400),
FSLINN=compute_apparent_source(ngaqua.SLI, ngaqua.FSLI * 86400)
)
def get_forcings(self, time):
self.logger.info(f"Getting forcing from day {time}")
ret... | code_fim | medium | {
"lang": "python",
"repo": "kbren/uwnet",
"path": "/uwnet/sam_ngaqua.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>REPO_LOCAL_VARIABLES = [
'NAME',
'VERSION',
'BASE',
'DESC',
'URL',
'ARCH',
'BUILDDATE',
'INSTALLDATE',
'PACKAGER',
'SIZE',
'DEPENDS',
'LICENSE',
'VALIDATION',
'REPLACES',
'OPTDEPENDS',
'CONFLICTS',
'PROVIDES', ]
REPO_SYNC_VARIABLES = [
... | code_fim | hard | {
"lang": "python",
"repo": "KaiSforza/pywer",
"path": "/libaur/data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KaiSforza/pywer path: /libaur/data.py
# -*- coding: utf-8 -*-
import re
# All of the variables available in a PKGBUILD
PB_VARIABLES = [
# String variables
'pkgver', 'pkgrel', 'pkgdesc', 'url', 'epoch', 'pkgbase',
# Bash Array variables
'pkgname', 'license', 'source', 'groups', '... | code_fim | hard | {
"lang": "python",
"repo": "KaiSforza/pywer",
"path": "/libaur/data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ry = MibTableRow((1, 3, 6, 1, 4, 1, 231, 2, 31, 17, 3, 1), ).setIndexNames((0, "Omnis-Management-MIB", "omnisExitTIDsEAC"), (0, "Omnis-Management-MIB", "omnisExitTIDsID"))
if mibBuilder.loadTexts: omnisExitTIDsEntry.setStatus('mandatory')
if mibBuilder.loadTexts: omnisExitTIDsEntry.setDescription('An entr... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp-with-texts/Omnis-Management-MIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp-with-texts/Omnis-Management-MIB.py
(1, 2, 3, 4))).clone(namedValues=NamedValues(("all", 1), ("activ", 2), ("hold", 3), ("inactiv", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: omnisTerminalsStatus.setStatus('mandatory')
if mibBuilder.loadTe... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp-with-texts/Omnis-Management-MIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>Pass=omnisTerminalInfoOPass, omnisSettingsHOLD=omnisSettingsHOLD, omnisTerminalsState=omnisTerminalsState, omnisExitTable=omnisExitTable, omnisSettingsChangeLogging=omnisSettingsChangeLogging, sniOmnisParameters=sniOmnisParameters, omnisTerminalInfoHold=omnisTerminalInfoHold, omnisGlobalDataTabNum=omnisGl... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp-with-texts/Omnis-Management-MIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Extracts course descriptions.
Args:
browser: A handle to the browser object.
college: The name of the college from which courses are being extracted.
Returns:
A list of courses.
"""
depts = browser.find_element_by_id('departments')
courses = []
for i in depts.find_elements_b... | code_fim | hard | {
"lang": "python",
"repo": "kjiwa/seattle-colleges-course-catalog",
"path": "/sccourses.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kjiwa/seattle-colleges-course-catalog path: /sccourses.py
"""A program that extracts Seattle Colleges courses and exports them to CSV.
The Seattle College class schedule is a dynamic web application. A web browser
object is invoked to visit the site and interact with it in order to view and
extr... | code_fim | hard | {
"lang": "python",
"repo": "kjiwa/seattle-colleges-course-catalog",
"path": "/sccourses.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> courses = []
for i in entries.find_elements_by_xpath('div/div'):
course = parse_course(browser, college, i)
if course:
courses.append(course)
# go back to the department index
back_button = browser.find_element_by_id('btn-deptlist')
back_button.click()
wait_for_load(browser)
... | code_fim | hard | {
"lang": "python",
"repo": "kjiwa/seattle-colleges-course-catalog",
"path": "/sccourses.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' clean-up text '''
try:
message = message.decode('utf-8')
except:
try:
message = message.decode('ISO-8859-1')
except:
try:
message = message.decode('windows-1252')
except:
message = None
return message<|fim_prefix|># repo: IntelliMindTeam/helpers path: /helpers/cleanup/__i... | code_fim | medium | {
"lang": "python",
"repo": "IntelliMindTeam/helpers",
"path": "/helpers/cleanup/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IntelliMindTeam/helpers path: /helpers/cleanup/__init__.py
def curate_text(content):
''' curate text content '''
return content.encode('ascii','ignore').decode('utf-8') \
if type(content) == str else content
<|fim_suffix|> try:
message = message.decode('utf-8')
except:
try:
message ... | code_fim | easy | {
"lang": "python",
"repo": "IntelliMindTeam/helpers",
"path": "/helpers/cleanup/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SiggiGue/sigfeat path: /tests/test_metadata.py
import pytest
from sigfeat.base.metadata import MetadataMixin
class MetadataMixinSubclass(MetadataMixin):
<|fim_suffix|>def test_add_metadata():
s = MetadataMixinSubclass()
s.add_metadata('bum', 1)
s.add_metadata('eins', 'Bum')
ass... | code_fim | medium | {
"lang": "python",
"repo": "SiggiGue/sigfeat",
"path": "/tests/test_metadata.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_add_metadata():
s = MetadataMixinSubclass()
s.add_metadata('bum', 1)
s.add_metadata('eins', 'Bum')
assert s.metadata[-1] == ('eins', 'Bum')
def test_extend_metadata():
s = MetadataMixinSubclass()
s.extend_metadata((
('a', 'b'),
('c', 'd')
))
asse... | code_fim | medium | {
"lang": "python",
"repo": "SiggiGue/sigfeat",
"path": "/tests/test_metadata.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_fetch_metadata_as_attributes():
s = MetadataMixinSubclass()
s.add_metadata('test', 'test')
s.fetch_metadata_as_attrs()
assert s.test == 'test'
if __name__ == '__main__':
pytest.main() # pragma: no coverage<|fim_prefix|># repo: SiggiGue/sigfeat path: /tests/test_metadata.py... | code_fim | hard | {
"lang": "python",
"repo": "SiggiGue/sigfeat",
"path": "/tests/test_metadata.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ConstClModelTest(tf.test.TestCase):
def test_build_const_cl_pretrain_model(self):
model_config = const_cl_cfg.ConstCLModel()
images_input_specs = tf.keras.layers.InputSpec(
shape=[None, 16, 224, 224, 4])
boxes_input_specs = tf.keras.layers.InputSpec(shape=[None, 16, 8, 4])
... | code_fim | hard | {
"lang": "python",
"repo": "jianzhnie/models",
"path": "/official/projects/const_cl/modeling/const_cl_model_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model_config = const_cl_cfg.ConstCLModel()
images_input_specs = tf.keras.layers.InputSpec(
shape=[None, 16, 224, 224, 4])
boxes_input_specs = tf.keras.layers.InputSpec(shape=[None, 16, 8, 4])
masks_input_specs = tf.keras.layers.InputSpec(shape=[None, 16, 8])
input_specs_dict =... | code_fim | hard | {
"lang": "python",
"repo": "jianzhnie/models",
"path": "/official/projects/const_cl/modeling/const_cl_model_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jianzhnie/models path: /official/projects/const_cl/modeling/const_cl_model_test.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 ... | code_fim | hard | {
"lang": "python",
"repo": "jianzhnie/models",
"path": "/official/projects/const_cl/modeling/const_cl_model_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cheog/city-scrapers-pitt path: /city_scrapers/spiders/alle_library_assoc.py
import re
from datetime import datetime, time, date
from typing import Optional, List, Dict, Union
from scrapy.http import HtmlResponse
from lxml.html import fromstring, HtmlElement
from city_scrapers_core.constants impo... | code_fim | hard | {
"lang": "python",
"repo": "cheog/city-scrapers-pitt",
"path": "/city_scrapers/spiders/alle_library_assoc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _ensure_times_are_as_expected(self, board_div: HtmlElement) -> MeetingTimes:
"""I expect the board and general meetings to be at a certain time."""
# They put their meeting times in plain english inside paragraph tags
# (p). Instead of trying to parse plain english I'm just... | code_fim | hard | {
"lang": "python",
"repo": "cheog/city-scrapers-pitt",
"path": "/city_scrapers/spiders/alle_library_assoc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>gather = INIT_GATHER
terraform = INIT_TERRAFORM
wait = 0
path = [playerPos]
destination = playerPos
turns = 0
h_time = 0
s_time = 0
while True:
abilities.position = playerPos
turns += 1
placePosition = 10
meta = tilemap._map[playerPos[0]][playerPos[1]]
string = 'Turns: {0}'.format(t... | code_fim | hard | {
"lang": "python",
"repo": "kelceydamage/learning",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kelceydamage/learning path: /main.py
#!/usr/bin/env python
# Author: Kelcey Jamison-Damage
# Python: 2.66 +
# OS: CentOS | Other
# Portable: True
# License: Apache 2.0
# License
#-----------------------------------------------------------------------#
# Copyright [2016] [Kelcey Jamison-... | code_fim | hard | {
"lang": "python",
"repo": "kelceydamage/learning",
"path": "/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> hdf5 = spec['hdf5']
szlib = spec["szip"]
configure( "--prefix=%s" % prefix,
"--disable-pythonmodule",
"--disable-browser",
"--enable-shared",
"--disable-silex",
"--disable-fortran",
... | code_fim | hard | {
"lang": "python",
"repo": "LLNL-Collaboration/conduit",
"path": "/scripts/uberenv/packages/silo/package.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LLNL-Collaboration/conduit path: /scripts/uberenv/packages/silo/package.py
from spack import *
class Silo(Package):
"""A Mesh and Field I/O Library and Scientific Database"""
homepage = "https://wci.llnl.gov/simulation/computer-codes/silo/"
url = "http://50.56.174.237/svn/visit/... | code_fim | hard | {
"lang": "python",
"repo": "LLNL-Collaboration/conduit",
"path": "/scripts/uberenv/packages/silo/package.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> configure( "--prefix=%s" % prefix,
"--disable-pythonmodule",
"--disable-browser",
"--enable-shared",
"--disable-silex",
"--disable-fortran",
"--without-zlib",
"--wit... | code_fim | hard | {
"lang": "python",
"repo": "LLNL-Collaboration/conduit",
"path": "/scripts/uberenv/packages/silo/package.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: githwxi/ATS-Postiats-frozen path: /projects/SMALL/openshift-flask-2016-08-02/libatscc2py3/ats2pypre_arrayref_dats.py
######
##
## The Python3 code
## is generated from ATS source by atscc2py3
## The starting compilation time is: 2016-7-26: 22h:28m
##
######
######
#ATSextcode_beg()
######
######... | code_fim | hard | {
"lang": "python",
"repo": "githwxi/ATS-Postiats-frozen",
"path": "/projects/SMALL/openshift-flask-2016-08-02/libatscc2py3/ats2pypre_arrayref_dats.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tmpret18 = None
tmp19 = None
funlab_py = None
tmplab_py = None
#__patsflab_arrszref_size
tmp19 = PYlist_length(arg0)
tmpret18 = tmp19
return tmpret18
def ats2pypre_arrszref_get_at(arg0, arg1):
tmpret20 = None
funlab_py = None
tmplab_py = None
#__patsflab_arrszref_get_at
tmpret2... | code_fim | hard | {
"lang": "python",
"repo": "githwxi/ATS-Postiats-frozen",
"path": "/projects/SMALL/openshift-flask-2016-08-02/libatscc2py3/ats2pypre_arrayref_dats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hail-is/hail path: /hail/python/hailtop/fs/fs_utils.py
import io
from typing import List
from .router_fs import RouterFS
from .stat_result import StatResult
_router_fs = None
def _fs() -> RouterFS:
global _router_fs
if _router_fs is None:
_router_fs = RouterFS()
return _ro... | code_fim | hard | {
"lang": "python",
"repo": "hail-is/hail",
"path": "/hail/python/hailtop/fs/fs_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Ensure files can be created whose dirname is `path`.
Warning
-------
On file systems without a notion of directories, this function will do nothing. For example,
on Google Cloud Storage, this operation does nothing.
"""
_fs().mkdir(path)
def remove(path: str):
"""Re... | code_fim | hard | {
"lang": "python",
"repo": "hail-is/hail",
"path": "/hail/python/hailtop/fs/fs_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
path : :class:`str`
Returns
-------
:obj:`.bool`
"""
return _fs().exists(path)
def is_file(path: str) -> bool:
"""Returns ``True`` if `path` both exists and is a file.
Parameters
----------
path : :class:`str`
Returns
-----... | code_fim | hard | {
"lang": "python",
"repo": "hail-is/hail",
"path": "/hail/python/hailtop/fs/fs_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> y = math.sqrt(r)
a = x + y
b = x - y
return a, b
def primesFound(x, y):
factors.add(x)
factors.add(y)
debug("found that both %d and %d are primes" % (x, y))
def output(factors):
print "The prime factors of %d are:" % n,
for x in sorted(factors):
print int... | code_fim | hard | {
"lang": "python",
"repo": "olivereggert/euler",
"path": "/euler003.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while len(queue) > 0:
candidate = queue.pop()
debug("checking %d" % candidate)
(a, b) = factorize(candidate)
if a == 1:
primesFound(candidate, b)
elif b == 1:
primesFound(candidate, a)
else:
queue.append(a)
... | code_fim | hard | {
"lang": "python",
"repo": "olivereggert/euler",
"path": "/euler003.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olivereggert/euler path: /euler003.py
#! /usr/bin/env python
#
# ProjectEuler.net - problem #003
#
# Summary: The prime factors of 13195 are 5, 7, 13 and 29.
# What is the largest prime factor of the number 600851475143 ?
import sys
from sets import Set
import time
import math
n = 600851475143
... | code_fim | hard | {
"lang": "python",
"repo": "olivereggert/euler",
"path": "/euler003.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 5l1v3r1/etym-cli path: /setup.py
from setuptools import setup
import etym_cli.__main__ as m
with open("README.md", "r") as fh:
long_description = fh.read()
<|fim_suffix|>VERSION = m.__version__
DESCRIPTION = "Command-line tool for etymonline with rich output."
setup(
name="etym-cli",
... | code_fim | medium | {
"lang": "python",
"repo": "5l1v3r1/etym-cli",
"path": "/setup.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>setup(
name="etym-cli",
version=VERSION,
url="https://github.com/agmmnn/etym-cli",
description=DESCRIPTION,
long_description=long_description,
long_description_content_type="text/markdown",
author="agmmnn",
classifiers=[
"Programming Language :: Python :: 3",
... | code_fim | medium | {
"lang": "python",
"repo": "5l1v3r1/etym-cli",
"path": "/setup.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pnpnpn/gimsan-py path: /gimsan_submit.py
#!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import time_benchmark
import os
import sys
import json
import re
import time
import... | code_fim | hard | {
"lang": "python",
"repo": "pnpnpn/gimsan-py",
"path": "/gimsan_submit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
epilog = """
Examples:
%(prog)s --conf=conf_examples/test_window_sampling.cfg -v
%(prog)s --conf=conf_examples/test_window_sampling.cfg -v --overwrite
%(prog)s --conf=conf_examples/test_window_sampling.cfg -v --overwrite --dryrun --skip-null
"""
argp = ArgumentParserPlus(description=description... | code_fim | hard | {
"lang": "python",
"repo": "pnpnpn/gimsan-py",
"path": "/gimsan_submit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
benchmark = time_benchmark.Benchmark()
#defaults
description = """
Submit GIMSAN job
"""
epilog = """
Examples:
%(prog)s --conf=conf_examples/test_window_sampling.cfg -v
%(prog)s --conf=conf_examples/test_window_sampling.cfg -v --overwrite
%(prog)s --conf=con... | code_fim | hard | {
"lang": "python",
"repo": "pnpnpn/gimsan-py",
"path": "/gimsan_submit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: snower/pyslock path: /pyslock/asyncio/rlock.py
# -*- coding: utf-8 -*-
# 2019/7/1
# create by: snower
from ..utils import ensure_bytes
from .lock import Lock, Result, LockUnlockedError, LockLockedError
class RLock(object):
def __init__(self, db, lock_name, timeout=0, expried=60):
se... | code_fim | hard | {
"lang": "python",
"repo": "snower/pyslock",
"path": "/pyslock/asyncio/rlock.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> await self._lock.acquire()
self._locked_count += 1
async def release(self):
if self._locked_count == 0:
raise LockUnlockedError(Result(b'\x56\x01' + b'\x00' * 62))
self._locked_count -= 1
await self._lock.release()<|fim_prefix|># repo: snower/pyslo... | code_fim | medium | {
"lang": "python",
"repo": "snower/pyslock",
"path": "/pyslock/asyncio/rlock.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __call__(self, x):
x, y = x
y = -np.abs(np.sin(x)*np.cos(y)*np.exp(np.abs(1 - np.sqrt(x**2 + y**2)/np.pi)))
return y<|fim_prefix|># repo: wolegechu/lagom path: /lagom/core/es/test_functions/holder_table.py
import numpy as np
from .base_test_function impo... | code_fim | medium | {
"lang": "python",
"repo": "wolegechu/lagom",
"path": "/lagom/core/es/test_functions/holder_table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x, y = x
y = -np.abs(np.sin(x)*np.cos(y)*np.exp(np.abs(1 - np.sqrt(x**2 + y**2)/np.pi)))
return y<|fim_prefix|># repo: wolegechu/lagom path: /lagom/core/es/test_functions/holder_table.py
import numpy as np
from .base_test_function import BaseTestFunction
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "wolegechu/lagom",
"path": "/lagom/core/es/test_functions/holder_table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wolegechu/lagom path: /lagom/core/es/test_functions/holder_table.py
import numpy as np
from .base_test_function import BaseTestFunction
<|fim_suffix|> def __call__(self, x):
x, y = x
y = -np.abs(np.sin(x)*np.cos(y)*np.exp(np.abs(1 - np.sqrt(x**2 + y**2)/np.pi)))
... | code_fim | medium | {
"lang": "python",
"repo": "wolegechu/lagom",
"path": "/lagom/core/es/test_functions/holder_table.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Reginald-Lee/biji-ben path: /uoft/CSC108/Week 1/bio_calc.py
print "My average on the BIO test was", 87.5 / 112 * 100
if 87.5 / 112 * 100 >= 90:
print "Awesome!"
elif 87.5 / 112 * 10<|fim_suffix|> print "So so"
elif 87.5 / 112 * 100 < 50:
print "Uh oh!!"<|fim_middle|>0 >= 70:
print "D... | code_fim | medium | {
"lang": "python",
"repo": "Reginald-Lee/biji-ben",
"path": "/uoft/CSC108/Week 1/bio_calc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "So so"
elif 87.5 / 112 * 100 < 50:
print "Uh oh!!"<|fim_prefix|># repo: Reginald-Lee/biji-ben path: /uoft/CSC108/Week 1/bio_calc.py
print "My average on the BIO test was", 87.5 / 112 * 100
if 87.5 / 112 * 100 >= 90:
print "Awesome!"
elif 87.5 / 112 * 10<|fim_middle|>0 >= 70:
print "D... | code_fim | medium | {
"lang": "python",
"repo": "Reginald-Lee/biji-ben",
"path": "/uoft/CSC108/Week 1/bio_calc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>0 >= 70:
print "Doing fine"
elif 87.5 / 112 * 100 >= 50:
print "So so"
elif 87.5 / 112 * 100 < 50:
print "Uh oh!!"<|fim_prefix|># repo: Reginald-Lee/biji-ben path: /uoft/CSC108/Week 1/bio_calc.py
print "My average on the BIO test was", 87.5 / 112 * 100
if 87<|fim_middle|>.5 / 112 * 100 >= 90:... | code_fim | medium | {
"lang": "python",
"repo": "Reginald-Lee/biji-ben",
"path": "/uoft/CSC108/Week 1/bio_calc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def __socket_options_dict_from_object(cls, socket_options_obj):
socket_options_dict = {}
if socket_options_obj.get_IP_MULTICAST_IF() is not None: socket_options_dict['ip_multicast_if'] = {'value' : socket_options_obj.get_IP_MULTICAST_IF()}
if socket_options_ob... | code_fim | hard | {
"lang": "python",
"repo": "2xyo/python-cybox",
"path": "/cybox/objects/socket_object.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 2xyo/python-cybox path: /cybox/objects/socket_object.py
import cybox.utils as utils
import cybox.bindings.cybox_common_types_1_0 as common_types_binding
import cybox.bindings.socket_object_1_4 as socket_binding
from cybox.common.baseobjectattribute import Base_Object_Attribute
from cybox.objects.... | code_fim | hard | {
"lang": "python",
"repo": "2xyo/python-cybox",
"path": "/cybox/objects/socket_object.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> socket_options_dict = {}
if socket_options_obj.get_IP_MULTICAST_IF() is not None: socket_options_dict['ip_multicast_if'] = {'value' : socket_options_obj.get_IP_MULTICAST_IF()}
if socket_options_obj.get_IP_MULTICAST_IF2() is not None: socket_options_dict['ip_multicast_if2'] = {'va... | code_fim | hard | {
"lang": "python",
"repo": "2xyo/python-cybox",
"path": "/cybox/objects/socket_object.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ayust/pluss path: /pluss/util/db.py
import sqlite3
# This is really hacky. At some point it should really get replaced with a proper
# database system that can share connections between threads, et cetera - but for
# now, this works.
global_db_path = None
def init(db_path):
global glob... | code_fim | hard | {
"lang": "python",
"repo": "ayust/pluss",
"path": "/pluss/util/db.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def remove_id(cls, id):
conn = sqlite3.connect(global_db_path)
cursor = conn.execute("""
DELETE FROM token_id_mapping
WHERE person_id = ?
""", (id,))
conn.commit()<|fim_prefix|># repo: ayust/pluss path: /pluss/util/db.py
import sqlite3
# This is really hacky. A... | code_fim | hard | {
"lang": "python",
"repo": "ayust/pluss",
"path": "/pluss/util/db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> conn = sqlite3.connect(global_db_path)
cursor = conn.execute("""
DELETE FROM token_id_mapping
WHERE person_id = ?
""", (id,))
conn.commit()<|fim_prefix|># repo: ayust/pluss path: /pluss/util/db.py
import sqlite3
# This is really hacky. At some point it should really get repla... | code_fim | hard | {
"lang": "python",
"repo": "ayust/pluss",
"path": "/pluss/util/db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linkdd/phase-currentcost path: /pavement.py
#!/usr/bin/python
# -*- coding: utf8 -*-
# -*- Mode: Python; py-indent-offset: 4 -*-
"""
Paver tasker script for phase-currentcost.
"""
from paver.easy import options, Bunch, task, needs, sh, path
PACKAGE = "currentcost"
options(
sphinx=Bunc... | code_fim | hard | {
"lang": "python",
"repo": "linkdd/phase-currentcost",
"path": "/pavement.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> files="*.py %s/*.py bin/phase-%s tests/*.py features/steps/*.py" % (
PACKAGE, PACKAGE),
)
@task
def prepare():
"""Install dependencies in this virtualenv
"""
sh('pip install pylint pyflakes behave nose clonedigger pep8 sphinx')
sh('pip install watchdog coverage ipython sphin... | code_fim | hard | {
"lang": "python",
"repo": "linkdd/phase-currentcost",
"path": "/pavement.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/1111-Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/soln.py
class Solution:
def maxDepthAfterSplit(self, seq: str) -> List[int]:
A, B = 0, 0
cntA, cntB = 0, 0
ans = []
for ch in seq:
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "wyaadarsh/LeetCode-Solutions",
"path": "/Python3/1111-Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/soln.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cntA -= 1
ans.append(0)
else:
cntB -= 1
ans.append(1)
return ans<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/1111-Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/soln.py
class S... | code_fim | hard | {
"lang": "python",
"repo": "wyaadarsh/LeetCode-Solutions",
"path": "/Python3/1111-Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/soln.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thormeier-fhnw-repos/ip619bb-i4ds02-audio-text-alignment path: /lib/src/model/AdditionalData.py
class AdditionalData:
"""
Additional data for a Sentence
"""
def __init__(self, google_confidence: float, normalized_sentence_score: float, gaps_transcript: float,
gap... | code_fim | hard | {
"lang": "python",
"repo": "thormeier-fhnw-repos/ip619bb-i4ds02-audio-text-alignment",
"path": "/lib/src/model/AdditionalData.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Formats itself to audacity label format
:return: Formatted data
"""
return str(self.google_confidence) + \
"\t" + str(self.normalized_sentence_score) + \
"\t" + str(self.gaps_transcript) + \
"\t" + str(self.gaps_goog... | code_fim | hard | {
"lang": "python",
"repo": "thormeier-fhnw-repos/ip619bb-i4ds02-audio-text-alignment",
"path": "/lib/src/model/AdditionalData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return: Formatted data
"""
return str(self.google_confidence) + \
"\t" + str(self.normalized_sentence_score) + \
"\t" + str(self.gaps_transcript) + \
"\t" + str(self.gaps_google)<|fim_prefix|># repo: thormeier-fhnw-repos/ip619bb-i4ds02-... | code_fim | hard | {
"lang": "python",
"repo": "thormeier-fhnw-repos/ip619bb-i4ds02-audio-text-alignment",
"path": "/lib/src/model/AdditionalData.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._clear_events()
response = self._request_test_document_type_ocr_settings_put_api_view()
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
events = self._get_test_events()
self.assertEqual(events.count(), 0)
def test_document_type_ocr_sett... | code_fim | hard | {
"lang": "python",
"repo": "azees-math/Mayan-EDMS",
"path": "/mayan/apps/ocr/tests/test_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class DocumentVersionPageOCRAPIViewTestCase(
DocumentTestMixin, DocumentVersionOCRTestMixin,
DocumentVersionPageOCRAPIViewTestMixin, BaseAPITestCase
):
def test_get_document_version_page_content_api_view_no_permission(self):
self._create_test_document_version_ocr_content()
se... | code_fim | hard | {
"lang": "python",
"repo": "azees-math/Mayan-EDMS",
"path": "/mayan/apps/ocr/tests/test_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: azees-math/Mayan-EDMS path: /mayan/apps/ocr/tests/test_api.py
from rest_framework import status
from mayan.apps.documents.tests.mixins.document_mixins import DocumentTestMixin
from mayan.apps.rest_api.tests.base import BaseAPITestCase
from ..events import (
event_ocr_document_version_finish... | code_fim | hard | {
"lang": "python",
"repo": "azees-math/Mayan-EDMS",
"path": "/mayan/apps/ocr/tests/test_api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.