text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: AllanCerveaux/svg_repo_dl path: /svgrepodl/utils.py
import os
import time
from .Message import Message
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from progress.bar import IncrementalBa... | code_fim | medium | {
"lang": "python",
"repo": "AllanCerveaux/svg_repo_dl",
"path": "/svgrepodl/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def browserConfiguration(path):
"""Configure selenium browser
Run headless firefox and configure download path
Arguments:
path {[string]} -- Destination download path
Returns:
[object] -- Firefox Webdriver
"""
profile = FirefoxProfile()
profile.set_preference("browser.download.panel.shown", F... | code_fim | medium | {
"lang": "python",
"repo": "AllanCerveaux/svg_repo_dl",
"path": "/svgrepodl/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>target_img = transforms.ToTensor()(Image.open(args.target_image)).unsqueeze(0).to(device)
source_img = transforms.ToTensor()(Image.open(args.source_image)).unsqueeze(0).to(device)
with torch.no_grad():
output, _, _, _, _ = model.forward(target_img, source_img)
output = transforms.ToPILImage()(output.c... | code_fim | hard | {
"lang": "python",
"repo": "WinstonDeng/faceshifter",
"path": "/aei_inference.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WinstonDeng/faceshifter path: /aei_inference.py
import argparse
from PIL import Image
import torch
from torchvision import transforms
from aei_net import AEINet
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config", type=str, default="config/train.yaml",
h... | code_fim | medium | {
"lang": "python",
"repo": "WinstonDeng/faceshifter",
"path": "/aei_inference.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = Level
threshold = Sequence(lambda n: n + 1)
name = LazyAttribute(lambda o: f'Level {o.threshold}')
class AchievementUnlockFactory(DjangoModelFactory):
class Meta:
model = AchievementUnlock
user = SubFactory(UserFactory)
achievement = SubFactory(AchievementFactory)
class... | code_fim | hard | {
"lang": "python",
"repo": "EzraG101/otis-web",
"path": "/dashboard/factories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EzraG101/otis-web path: /dashboard/factories.py
from core.factories import SemesterFactory, UnitFactory, UnitGroupFactory, UserFactory # NOQA
from django.contrib.auth import get_user_model
from factory.declarations import LazyAttribute, Sequence, SubFactory
from factory.django import DjangoModel... | code_fim | hard | {
"lang": "python",
"repo": "EzraG101/otis-web",
"path": "/dashboard/factories.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SemesterDownloadFileFactory(DjangoModelFactory):
class Meta:
model = SemesterDownloadFile
semester = SubFactory(SemesterFactory)
content = FileField(filename='announcement.txt')
class PSetFactory(DjangoModelFactory):
class Meta:
model = PSet
student = SubFactory(StudentFactory)
unit = ... | code_fim | hard | {
"lang": "python",
"repo": "EzraG101/otis-web",
"path": "/dashboard/factories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_all_track_data(self):
self.make_track_dict()
self.make_special_number()
return self.number_by_date_dict, self.year_list<|fim_prefix|># repo: saxieyu/GitHubPoster path: /github_poster/loader/dota2_loader.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime im... | code_fim | hard | {
"lang": "python",
"repo": "saxieyu/GitHubPoster",
"path": "/github_poster/loader/dota2_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saxieyu/GitHubPoster path: /github_poster/loader/dota2_loader.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
import requests
from github_poster.loader.base_loader import BaseLoader
from github_poster.loader.config import DOTA2_CALENDAR_API
<|fim_suffix|> def... | code_fim | medium | {
"lang": "python",
"repo": "saxieyu/GitHubPoster",
"path": "/github_poster/loader/dota2_loader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def make_track_dict(self):
data_list = self.get_api_data()
for d in data_list:
date = datetime.utcfromtimestamp(d["start_time"]).strftime("%Y-%m-%d")
self.number_by_date_dict[date] += 1
for _, v in self.number_by_date_dict.items():
self.numbe... | code_fim | hard | {
"lang": "python",
"repo": "saxieyu/GitHubPoster",
"path": "/github_poster/loader/dota2_loader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in files:
df = pd.read_csv(i, sep="\t", compression="gzip")
i = i.split(os.sep)
subid = i[-4]
df.to_csv(subid + "_ecg", sep='\t', index=False)<|fim_prefix|># repo: JoelPatchitt/adie_ongoingthoughts path: /bin/adie_unzip_gz.py
from pathlib import Path
import glob
import os
import pan... | code_fim | hard | {
"lang": "python",
"repo": "JoelPatchitt/adie_ongoingthoughts",
"path": "/bin/adie_unzip_gz.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoelPatchitt/adie_ongoingthoughts path: /bin/adie_unzip_gz.py
from pathlib import Path
import glob
import os
import pandas as pd
<|fim_suffix|>for i in files:
df = pd.read_csv(i, sep="\t", compression="gzip")
i = i.split(os.sep)
subid = i[-4]
df.to_csv(subid + "_ecg", sep='\t', i... | code_fim | hard | {
"lang": "python",
"repo": "JoelPatchitt/adie_ongoingthoughts",
"path": "/bin/adie_unzip_gz.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: betasewer/machaon path: /machaon/types/dateandtime.py
if sep:
m = int(sm)
c = int(s)
else:
m = int(s)
return h, m, c
def UTCOffset(utc_delta) -> datetime.tzinfo:
""" UTCからの差分で表されるタイムゾーン """
if utc_delta < 0:
delta = -datetime.timedelta(hours=... | code_fim | hard | {
"lang": "python",
"repo": "betasewer/machaon",
"path": "/machaon/types/dateandtime.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: betasewer/machaon path: /machaon/types/dateandtime.py
""" UTCからの差分で表されるタイムゾーン """
if utc_delta < 0:
delta = -datetime.timedelta(hours=-utc_delta)
else:
delta = datetime.timedelta(hours=utc_delta)
class _UTCOffset(datetime.tzinfo):
def __repr__(self):
... | code_fim | hard | {
"lang": "python",
"repo": "betasewer/machaon",
"path": "/machaon/types/dateandtime.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ @meta """
if isinstance(s, str):
y, m, d = digits_split_by_nondigit(s, 3)
return datetime.date(y, m, d)
else:
return DateType.constructor(DateType, s)
def stringify(self, d):
""" @meta """
return d.strftime("%Y/%m/%d")
... | code_fim | hard | {
"lang": "python",
"repo": "betasewer/machaon",
"path": "/machaon/types/dateandtime.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rtateis_cozinha_e_preparadores_de_alimentos', 'portateis_casa')\
.replace('artigos_de_festas', 'artigos_festas')\
.replace('artigos_de_natal', 'artigos_festas')\
.replace('eletronicos', 'eletronicos_games')\
.replace('consoles_games', 'eletronicos_games')\
.replace('eletronicos_games', 'ele... | code_fim | hard | {
"lang": "python",
"repo": "Mpaape/olist-e-commerce",
"path": "/categories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mpaape/olist-e-commerce path: /categories.py
def join_categories(df):
df['product_category_name'] = df['product_category_name'].replace('telefonia_fixa', 'telefonia')\
.replace('eletrodomesticos_2', 'eletrodomesticos'). replace('bebes', 'brinquedos_e_bebes')\
.replace('fraldas_higiene', ... | code_fim | hard | {
"lang": "python",
"repo": "Mpaape/olist-e-commerce",
"path": "/categories.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chromium/chromium path: /chrome/renderer/cart/DEPS
include_rules = [
"+third_party/re2",
"+chrome/browser/signin",
"+chrome/browser",
"+components/commerce/core/proto/cart<|fim_suffix|>e_features.h",
"+components/ukm",
"+components/metrics",
"+services/metrics/public/cpp... | code_fim | hard | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/chrome/renderer/cart/DEPS",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ecific_include_rules = {
"commerce_hint_agent_browsertest.cc": [
"+components/optimization_guide/core/optimization_guide_features.h",
"+components/ukm",
"+components/metrics",
"+services/metrics/public/cpp/ukm_builders.h",
],
}<|fim_prefix|># repo: chromium/chromium path: /c... | code_fim | medium | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/chrome/renderer/cart/DEPS",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>e_features.h",
"+components/ukm",
"+components/metrics",
"+services/metrics/public/cpp/ukm_builders.h",
],
}<|fim_prefix|># repo: chromium/chromium path: /chrome/renderer/cart/DEPS
include_rules = [
"+third_party/re2",
"+chrome/browser/signin",
"+chrome/browser",
"+components... | code_fim | medium | {
"lang": "python",
"repo": "chromium/chromium",
"path": "/chrome/renderer/cart/DEPS",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mkowsiak/python3 path: /src/dictionaries.py
# -*- coding: utf-8 -*-
# Copyright © 2021 Michal K. Owsiak. All rights reserved.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A P... | code_fim | hard | {
"lang": "python",
"repo": "mkowsiak/python3",
"path": "/src/dictionaries.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>b = 'key1' in d # check whether key is already defined in dictionary
b = 'key3' not in d
d.get('key1') # almost the same as indexing with ['key1']
d.get('key3') # will return None - no exception here
d.get('key3', '... | code_fim | hard | {
"lang": "python",
"repo": "mkowsiak/python3",
"path": "/src/dictionaries.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> viet_ocr = VietOCR()
text = viet_ocr.image_to_string(img, lang=language)
return Response({'text': text}, status=status.HTTP_200_OK)<|fim_prefix|># repo: trangnm58/DocOCR path: /viet_ocr/api/views.py
import cv2
import numpy as np
from rest_framework import status
from rest_framewor... | code_fim | hard | {
"lang": "python",
"repo": "trangnm58/DocOCR",
"path": "/viet_ocr/api/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trangnm58/DocOCR path: /viet_ocr/api/views.py
import cv2
import numpy as np
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from viet_ocr.models import VietOCR
<|fim_suffix|> img = cv2.imdecode(np.fromstring(img.read... | code_fim | hard | {
"lang": "python",
"repo": "trangnm58/DocOCR",
"path": "/viet_ocr/api/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with it('positively matches clues with (hyph) at the end'):
expect(crossword_problem.CrosswordProblem.score(
['Example crossword clue (hyph.)'])).to(equal(1))
with it('ambiguously matches clues with lots of words'):
expect(crossword_problem.CrosswordProblem.score(
['A quick br... | code_fim | hard | {
"lang": "python",
"repo": "PhilHarnish/forge",
"path": "/spec/puzzle/problems/crossword/crossword_problem_spec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PhilHarnish/forge path: /spec/puzzle/problems/crossword/crossword_problem_spec.py
import collections
from data import data
from puzzle.problems.crossword import crossword_problem
from spec.mamba import *
_SAMPLE = {
'a': 1, 'aa': .75, 'aaa': .5, 'abb': .25, 'aabb': .2, 'aaabb': .1,
}
with de... | code_fim | hard | {
"lang": "python",
"repo": "PhilHarnish/forge",
"path": "/spec/puzzle/problems/crossword/crossword_problem_spec.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> hpu_net = HierarchicalProbUNet(latent_dims=_LATENT_DIMS,
channels_per_block=_CHANNELS_PER_BLOCK,
num_classes=_NUM_CLASSES,
initializers=_INITIALIZERS)
img, seg = _get_placeholders()
reconst... | code_fim | hard | {
"lang": "python",
"repo": "Esmidth/CS_GAN_MOD",
"path": "/hierarchical_probabilistic_unet/model_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Esmidth/CS_GAN_MOD path: /hierarchical_probabilistic_unet/model_test.py
# Copyright 2019 Deepmind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
... | code_fim | hard | {
"lang": "python",
"repo": "Esmidth/CS_GAN_MOD",
"path": "/hierarchical_probabilistic_unet/model_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_proto(self):
tag = ProtoInputTag()
tag.key = self.key
tag.value = self.value
return tag
@classmethod
def from_proto(cls, proto):
return cls(proto.key, proto.value)<|fim_prefix|># repo: mlflow/mlflow path: /mlflow/entities/input_tag.py
from mlflo... | code_fim | hard | {
"lang": "python",
"repo": "mlflow/mlflow",
"path": "/mlflow/entities/input_tag.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlflow/mlflow path: /mlflow/entities/input_tag.py
from mlflow.entities._mlflow_object import _MLflowObject
from mlflow.protos.service_pb2 import InputTag as ProtoInputTag
from mlflow.utils.annotations import experimental
@experimental
class InputTag(_MLflowObject):
"""Input tag object assoc... | code_fim | hard | {
"lang": "python",
"repo": "mlflow/mlflow",
"path": "/mlflow/entities/input_tag.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tag = ProtoInputTag()
tag.key = self.key
tag.value = self.value
return tag
@classmethod
def from_proto(cls, proto):
return cls(proto.key, proto.value)<|fim_prefix|># repo: mlflow/mlflow path: /mlflow/entities/input_tag.py
from mlflow.entities._mlflow_objec... | code_fim | hard | {
"lang": "python",
"repo": "mlflow/mlflow",
"path": "/mlflow/entities/input_tag.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wtwong316/tsd_analysis_with_es path: /com/beiwei/plots/plot.py
from io import BytesIO
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
import matplotlib as mpl
def plot_data(df, title, data_field, data_date):
fig = Figure()
... | code_fim | hard | {
"lang": "python",
"repo": "wtwong316/tsd_analysis_with_es",
"path": "/com/beiwei/plots/plot.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fig = Figure()
fig.set_figheight(15)
fig.set_figwidth(15)
ax = fig.subplots(2)
df.plot(kind='line', x=date_name, y='BBU20', ax=ax[0], color='black', label='BBU20', style=['--'])
df.plot(kind='line', x=date_name, y='BBL20', ax=ax[0], color='black', label='BBL20', style=['--'])
d... | code_fim | hard | {
"lang": "python",
"repo": "wtwong316/tsd_analysis_with_es",
"path": "/com/beiwei/plots/plot.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def plot_rsi_bb(df, title0, title1, title2, date_name):
fig = Figure()
fig.set_figheight(30)
fig.set_figwidth(20)
ax = fig.subplots(3)
ax[0].axhline(y=30, color='midnightblue', linestyle='--')
ax[0].axhline(y=70, color='midnightblue', linestyle='--')
ax0 = ax[0].twinx()
... | code_fim | hard | {
"lang": "python",
"repo": "wtwong316/tsd_analysis_with_es",
"path": "/com/beiwei/plots/plot.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ntpdev/scripts.py path: /trade-log.py
#!/usr/bin/python3
from datetime import datetime, date, time, timedelta
import argparse
import numpy as np
import pandas as pd
import glob as gb
import platform
import sys
class Blotter:
def __init__(self):
self.openPositions = []
self.s... | code_fim | hard | {
"lang": "python",
"repo": "ntpdev/scripts.py",
"path": "/trade-log.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> df = pd.read_csv(f'\\Users\\niroo\\OneDrive\\Documents\\{fname}', usecols=[0,1,2,3,4,5,6], parse_dates={'Timestamp' : [5,6]})
print(f'loaded {fname} {df.shape[0]} {df.shape[1]}')
return df
def load_fileEx(fname):
df = pd.read_csv(fname, usecols=[0,1,2,3,4,5,6], parse_dates={'Timestamp' : ... | code_fim | hard | {
"lang": "python",
"repo": "ntpdev/scripts.py",
"path": "/trade-log.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abogeorge/simpleTicket path: /simpleTicket/helpDesk/views.py
from django.shortcuts import render, render_to_response
from django.contrib import auth
from django.core.context_processors import csrf
from django.contrib.auth.decorators import login_required
from siteEngine.models import Ticket, User... | code_fim | hard | {
"lang": "python",
"repo": "abogeorge/simpleTicket",
"path": "/simpleTicket/helpDesk/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># All active orders page
@login_required
def active_orders(request):
# Retrieving user type
user_role = __get_user_role(request)
# Retrieving all Users Profile
orders = Order.objects.exclude(status = 0).exclude(status = 3)
if len(orders) == 0:
orders = False
# If the view i... | code_fim | hard | {
"lang": "python",
"repo": "abogeorge/simpleTicket",
"path": "/simpleTicket/helpDesk/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># All closed orders page
@login_required
def closed_orders(request):
# Retrieving user type
user_role = __get_user_role(request)
# Retrieving all Users Profile
orders = Order.objects.filter(status = 3)
if len(orders) == 0:
orders = False
return render(request, "closed_order... | code_fim | hard | {
"lang": "python",
"repo": "abogeorge/simpleTicket",
"path": "/simpleTicket/helpDesk/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cy-fir/flexx path: /flexx/app/session.py
"""
Definition of App class and the app manager.
"""
import time
from .. import event
from .model import Model, new_type
from .assetstore import SessionAssets
from . import logger
# todo: thread safety
def valid_app_name(name):
T = 'abcdefghijklmno... | code_fim | hard | {
"lang": "python",
"repo": "cy-fir/flexx",
"path": "/flexx/app/session.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _set_runtime(self, runtime):
if self._runtime is not None:
raise RuntimeError('Session already has a runtime.')
self._runtime = runtime
def close(self):
""" Close the runtime, if possible
"""
# todo: close via JS
if self._runtime... | code_fim | hard | {
"lang": "python",
"repo": "cy-fir/flexx",
"path": "/flexx/app/session.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> except Exception as err:
logger.error('Error when clearing old pending sessions: %s' % str(err))
def create_session(self, name):
""" Create a session for the app with the given name.
Instantiate an app and matching session object corresponding
... | code_fim | hard | {
"lang": "python",
"repo": "cy-fir/flexx",
"path": "/flexx/app/session.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kubeflow/pipelines path: /samples/contrib/pytorch-samples/cifar10/classifier.py
# !/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | code_fim | medium | {
"lang": "python",
"repo": "kubeflow/pipelines",
"path": "/samples/contrib/pytorch-samples/cifar10/classifier.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Initializes the network, optimizer and scheduler
"""
super().__init__()
self.model_conv = models.resnet50(pretrained=True)
for param in self.model_conv.parameters():
param.requires_grad = False
num_ftrs = self.model_conv.fc.in_feature... | code_fim | medium | {
"lang": "python",
"repo": "kubeflow/pipelines",
"path": "/samples/contrib/pytorch-samples/cifar10/classifier.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Initialize control dictionary
control = {'bt': True, 'gga': True, 'vtg': True, 'vectors': True}
# If checkboxes are available, enable the checkboxes if transect contains that type of data
if self.cb:
# Enable check boxes as data is available
... | code_fim | hard | {
"lang": "python",
"repo": "ricorx7/QRevPy",
"path": "/UI/BoatSpeed.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ricorx7/QRevPy path: /UI/BoatSpeed.py
ence for GGA
vtg: list
Plot reference for VTG
hover_connection: int
Index to data cursor connection
annot: Annotation
Annotation object for data cursor
"""
def __init__(self, canvas):
"""Initializ... | code_fim | hard | {
"lang": "python",
"repo": "ricorx7/QRevPy",
"path": "/UI/BoatSpeed.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Get checkbox status
# BT
if self.cb_bt.checkState() == QtCore.Qt.Checked:
control['bt'] = True
else:
control['bt'] = False
# GGA
if self.cb_gga.checkState() == QtCore.Qt.Checked:
... | code_fim | hard | {
"lang": "python",
"repo": "ricorx7/QRevPy",
"path": "/UI/BoatSpeed.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>NG)''')
conn.commit()
conn.close()
if __name__ == '__main__':
main()<|fim_prefix|># repo: Jonathan-aguilar/DAS_Sistemas path: /Ene-Jun-2019/Luis Ornelas/Extraoridnario/Ejercicio 3/Ejercicio3-ExtraDB.py
import sqlite3
def main():
conn = sqlite3.connect("Paises.db")
cur = conn.cursor(... | code_fim | medium | {
"lang": "python",
"repo": "Jonathan-aguilar/DAS_Sistemas",
"path": "/Ene-Jun-2019/Luis Ornelas/Extraoridnario/Ejercicio 3/Ejercicio3-ExtraDB.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jonathan-aguilar/DAS_Sistemas path: /Ene-Jun-2019/Luis Ornelas/Extraoridnario/Ejercicio 3/Ejercicio3-ExtraDB.py
import sqlite3
def main():
conn = sqlite3.connect("Paises.db")
cur = conn.cursor()
cur.execute('''CREATE TABLE Paises (
Nombre STRING PRIMARY KE<|fim_suffix|>NG)''')
... | code_fim | medium | {
"lang": "python",
"repo": "Jonathan-aguilar/DAS_Sistemas",
"path": "/Ene-Jun-2019/Luis Ornelas/Extraoridnario/Ejercicio 3/Ejercicio3-ExtraDB.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RavicharanN/DSL-to-Python-prototype path: /sample_dsl.py
from lark import Lark
print_grammar = """
start : instruction+
instruction : "print" STRING [STRING] -> print
| "repeat" NUMBER code_block -> repeat
code_block : "{" instruction+ "}"
STRING: LETTER+
<|fi... | code_fim | medium | {
"lang": "python",
"repo": "RavicharanN/DSL-to-Python-prototype",
"path": "/sample_dsl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parse_tree = parser.parse(code)
print(parse_tree.pretty())
for instruction in parse_tree.children:
run_instruction(instruction)
sample_code = """
repeat 9 {
print helloworld
}
"""
run_printer(sample_code)<|fim_prefix|># repo: RavicharanN/DSL-to-Python-prototype path:... | code_fim | hard | {
"lang": "python",
"repo": "RavicharanN/DSL-to-Python-prototype",
"path": "/sample_dsl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if iter % print_every == 0:
print_loss_avg = print_loss_total / print_every
print_loss_total = 0
print('%s (%d %d%%) %.4f' % (helpFn.time_slice(start, iter / n_iters),
iter, iter / n_iters * 100, print_loss_avg))
... | code_fim | hard | {
"lang": "python",
"repo": "deepanshugarg257/seq2seq-PyTorch",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> use_cuda = torch.cuda.is_available()
data_preprocess = DataPreprocess()
input_lang, output_lang, pairs = data_preprocess.prepare_data('eng', 'hin', True)
print(random.choice(pairs))
# embedding_src = GetEmbedding(input_lang.word2index, input_lang.word2count, "../Embeddings/GoogleNews... | code_fim | hard | {
"lang": "python",
"repo": "deepanshugarg257/seq2seq-PyTorch",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deepanshugarg257/seq2seq-PyTorch path: /main.py
import time
import random
import torch
import torch.nn as nn
from torch import optim
from dataPreprocess import DataPreprocess
from embeddingGoogle import GetEmbedding
from encoderRNN import EncoderRNN
from decoderRNN import DecoderRNN
from trainN... | code_fim | hard | {
"lang": "python",
"repo": "deepanshugarg257/seq2seq-PyTorch",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>slack_add, name='slack_add'),
path('slack/oauth', views.slack_oauth, name='slack_oauth'),
]<|fim_prefix|># repo: KSU-SWLab/ECC-main path: /main/urls.py
from django.urls import path
from . import view<|fim_middle|>s
urlpatterns = [
path('slack/add', views. | code_fim | easy | {
"lang": "python",
"repo": "KSU-SWLab/ECC-main",
"path": "/main/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KSU-SWLab/ECC-main path: /main/urls.py
from django.urls import path
from . import view<|fim_suffix|>auth', views.slack_oauth, name='slack_oauth'),
]<|fim_middle|>s
urlpatterns = [
path('slack/add', views.slack_add, name='slack_add'),
path('slack/o | code_fim | medium | {
"lang": "python",
"repo": "KSU-SWLab/ECC-main",
"path": "/main/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def eval_ssd_r34_mlperf_coco(args):
from coco import COCO
# Check that GPUs are actually available
use_cuda = not args.no_cuda and torch.cuda.is_available()
dboxes = dboxes_R34_coco(args.image_size,args.strides)
encoder = Encoder(dboxes)
val_trans = SSDTransformer(dboxes, (args.im... | code_fim | hard | {
"lang": "python",
"repo": "yananYangYSU/inference",
"path": "/others/cloud/single_stage_detector/pytorch/infer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yananYangYSU/inference path: /others/cloud/single_stage_detector/pytorch/infer.py
import os
from argparse import ArgumentParser
from utils import DefaultBoxes, Encoder, COCODetection
from base_model import Loss
from utils import SSDTransformer
from ssd_r34 import SSD_R34
import torch
from torch.a... | code_fim | hard | {
"lang": "python",
"repo": "yananYangYSU/inference",
"path": "/others/cloud/single_stage_detector/pytorch/infer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tokens = {
'comment': [
# Comment
(r'#.*(?=\n)', Comment),
],
'string': [
# Double-quoted string
(r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
# Single-quoted string
(r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\... | code_fim | hard | {
"lang": "python",
"repo": "stefanholek/pygments-openssl",
"path": "/pygments_openssl/lexer.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stefanholek/pygments-openssl path: /pygments_openssl/lexer.py
"""Pygments lexer for OpenSSL configuration files
With inspiration from IniLexer and BashLexer.
"""
from pygments.lexer import Lexer, LexerContext, RegexLexer, ExtendedRegexLexer, \
bygroups, include, using, this, do_insertions, ... | code_fim | hard | {
"lang": "python",
"repo": "stefanholek/pygments-openssl",
"path": "/pygments_openssl/lexer.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> view_counter = ndb.IntegerProperty()
class MyRequestHandler(webapp2.RequestHandler):
def get(self):
acct = Account.get_by_id(users.get_current_user().user_id())
acct.view_counter += 1
acct.put()
# ...read something else from Datastore...
self.response.ou... | code_fim | medium | {
"lang": "python",
"repo": "GoogleCloudPlatform/python-docs-samples",
"path": "/appengine/standard/ndb/async/app_sync.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> acct = Account.get_by_id(users.get_current_user().user_id())
acct.view_counter += 1
acct.put()
# ...read something else from Datastore...
self.response.out.write("Content of the page")
app = webapp2.WSGIApplication([("/", MyRequestHandler)])<|fim_prefix|># repo:... | code_fim | medium | {
"lang": "python",
"repo": "GoogleCloudPlatform/python-docs-samples",
"path": "/appengine/standard/ndb/async/app_sync.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoogleCloudPlatform/python-docs-samples path: /appengine/standard/ndb/async/app_sync.py
# Copyright 2016 Google Inc. 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 ... | code_fim | medium | {
"lang": "python",
"repo": "GoogleCloudPlatform/python-docs-samples",
"path": "/appengine/standard/ndb/async/app_sync.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>: 24884341205,
},
"in": {
"mcast_pkts": 214513,
"bcast_pkts": 0,
"ucast_pkts": 15716712,
"name": "GigabitEthernet1/0/1",
"octets": 3161931167,
},
}
}
}<|fim_prefix|># repo: Cisco... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/ios/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/ios/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py
expected_output = {
"interface": {
"GigabitEthernet1/0/1": {
"out": {
"mcast_pkts": 188396,
"bcast_pkts": 0,
... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/ios/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>cast_pkts": 15716712,
"name": "GigabitEthernet1/0/1",
"octets": 3161931167,
},
}
}
}<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/ios/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py
expected_outp... | code_fim | hard | {
"lang": "python",
"repo": "CiscoTestAutomation/genieparser",
"path": "/src/genie/libs/parser/ios/tests/ShowInterfacesCounters/cli/equal/golden_output_expected.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> k = k - money[i]
count += 1
break
print(count)<|fim_prefix|># repo: StudyForCoding/BEAKJOON path: /17_Greedy/Step01/wowo0709.py
n,k = map(int,input().split())
money = []
for i in range(n):
money.append(int(input()))
count = 0
while k != 0:
for i in range(len<|fim_middle|>(m... | code_fim | medium | {
"lang": "python",
"repo": "StudyForCoding/BEAKJOON",
"path": "/17_Greedy/Step01/wowo0709.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StudyForCoding/BEAKJOON path: /17_Greedy/Step01/wowo0709.py
n,k = map(int,input().split())
money = []
for i in range(n):
money.append(int(input()))
count = 0
while k != 0:
for i in range(len<|fim_suffix|> k = k - money[i]
count += 1
break
print(count)<|fim_middle|>(m... | code_fim | medium | {
"lang": "python",
"repo": "StudyForCoding/BEAKJOON",
"path": "/17_Greedy/Step01/wowo0709.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jasonpul/electron-python-boilerplate path: /server/server.py
"""
Script for starting a zerorpc server on the specified port.
The port can be given as a command line argument when starting the server.
Is no port specified, then port 8484 is used.
The API exposed is defined in the file API.py.
"""... | code_fim | hard | {
"lang": "python",
"repo": "jasonpul/electron-python-boilerplate",
"path": "/server/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Set address to localhost
address = "tcp://127.0.0.1:" + parse_port()
# Start server with class API as
server = zerorpc.Server(API.API())
server.bind(address)
print("Server started running on {}".format(address))
# Blocking command. Keeps server running
server.run()
i... | code_fim | hard | {
"lang": "python",
"repo": "jasonpul/electron-python-boilerplate",
"path": "/server/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> P = df.FunctionSpace(mesh, "CG", 1)
V = df.VectorFunctionSpace(mesh, "CG", 1)
domains = df.CellFunction("size_t", mesh)
boundaries = df.FacetFunction("size_t", mesh)
around = Around()
boundaries.set_all(0)
around.mark(boundaries, 1)
bcs_phi = df.DirichletBC(P, df.Constan... | code_fim | hard | {
"lang": "python",
"repo": "gautelinga/phasefield",
"path": "/pf_circle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gautelinga/phasefield path: /pf_circle.py
import numpy as np
import dolfin as df
import mshr
from mpi4py import MPI
import math
def make_circle_mesh(R, res=40.):
domain = mshr.Circle(df.Point(0., 0.), 1.)
mesh = mshr.generate_mesh(domain, res)
mesh.coordinates()[:] *= R
return m... | code_fim | hard | {
"lang": "python",
"repo": "gautelinga/phasefield",
"path": "/pf_circle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataDog/integrations-extras path: /sonarr/tests/conftest.py
import os
import pytest
from datadog_checks.dev import docker_run, get_docker_hostname, get_here
URL = 'http://{}:8989'.format(get_docker_hostname())
INSTANCE = {'url': URL, 'api_key': 'deadbeef'}
@pytest.fixture(scope='session')
de... | code_fim | medium | {
"lang": "python",
"repo": "DataDog/integrations-extras",
"path": "/sonarr/tests/conftest.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> compose_file = os.path.join(get_here(), 'docker-compose.yml')
# This does 3 things:
#
# 1. Spins up the services defined in the compose file
# 2. Waits for the url to be available before running the tests
# 3. Tears down the services when the tests are finished
with docker_run... | code_fim | medium | {
"lang": "python",
"repo": "DataDog/integrations-extras",
"path": "/sonarr/tests/conftest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, domain='gw.api.taobao.com', port=80):
RestApi.__init__(self, domain, port)
self.template_id = None
def getapiname(self):
return 'cainiao.cloudprint.customares.get'<|fim_prefix|># repo: ScottLeeF/python-example path: /taobao-tianmao/top/api/rest/Cai... | code_fim | easy | {
"lang": "python",
"repo": "ScottLeeF/python-example",
"path": "/taobao-tianmao/top/api/rest/CainiaoCloudprintCustomaresGetRequest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ScottLeeF/python-example path: /taobao-tianmao/top/api/rest/CainiaoCloudprintCustomaresGetRequest.py
'''
Created by auto_sdk on 2018.07.26
'''
from top.api.base import RestApi
<|fim_suffix|> return 'cainiao.cloudprint.customares.get'<|fim_middle|>class CainiaoCloudprintCustomaresGe... | code_fim | hard | {
"lang": "python",
"repo": "ScottLeeF/python-example",
"path": "/taobao-tianmao/top/api/rest/CainiaoCloudprintCustomaresGetRequest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'cainiao.cloudprint.customares.get'<|fim_prefix|># repo: ScottLeeF/python-example path: /taobao-tianmao/top/api/rest/CainiaoCloudprintCustomaresGetRequest.py
'''
Created by auto_sdk on 2018.07.26
'''
from top.api.base import RestApi
class CainiaoCloudprintCustomaresGetRequest(RestA... | code_fim | medium | {
"lang": "python",
"repo": "ScottLeeF/python-example",
"path": "/taobao-tianmao/top/api/rest/CainiaoCloudprintCustomaresGetRequest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
with open(os.path.dirname(__file__) + "/" + ConfigurationModule.CONFIG_FILE, 'r') as f:
data = json.load(f)
props = None
for mdl in data["config"]["modules"]:
if mdl["name"] == mdlname:
props = mdl
... | code_fim | hard | {
"lang": "python",
"repo": "DorianThiv/py-ryn",
"path": "/src/samples/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DorianThiv/py-ryn path: /src/samples/config.py
import sys
import os
import json
class ConfigurationModule:
CONFIG_FILE = "files/config.json"
@staticmethod
def addModule(mdlname, lower_name, upper_name, class_name, callback=None):
try:
with open(os.path.dirname(_... | code_fim | hard | {
"lang": "python",
"repo": "DorianThiv/py-ryn",
"path": "/src/samples/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mustelideos/recsys-challenge-2019 path: /scripts/014_Features_General_01.py
future', default=DEFAULT_SPLIT)
parser.add_argument('--debug', help='debug mode (verbose output and no saving)', action='store_true')
return parser
def setup_logger(debug):
logger = logging.getLogger()
lo... | code_fim | hard | {
"lang": "python",
"repo": "mustelideos/recsys-challenge-2019",
"path": "/scripts/014_Features_General_01.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> df_all = pd.concat(df).reset_index()
df_temp = df_all.groupby('session_id').step.max().reset_index()
df_temp['is_last_step'] = True
df_all = df_all.merge(df_temp, how='left', on=['session_id', 'step'])
df_all['is_last_step'] = df_all['is_last_step'].fillna(False)... | code_fim | hard | {
"lang": "python",
"repo": "mustelideos/recsys-challenge-2019",
"path": "/scripts/014_Features_General_01.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_index(row):
return row.imp_list.index(row.reference_true_enc)
def make_target(df, is_test=False):
if is_test:
df['targ'] = 'nan'
else:
df['targ'] = df.apply(get_index, axis=1)
df.drop('reference_true_enc', axis=1, inplace=True)
... | code_fim | hard | {
"lang": "python",
"repo": "mustelideos/recsys-challenge-2019",
"path": "/scripts/014_Features_General_01.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HectorPulido/ConsoleGameEngine path: /gameEngine.py
import math
class gameEngine:
def __init__(self, room, screenSize, pov, minStep, minStepAngle, maxDistance, wallHeight):
self.roomMatrix = room.split("\n")
self.screenSize = screenSize
self.pov = pov
self.mi... | code_fim | hard | {
"lang": "python",
"repo": "HectorPulido/ConsoleGameEngine",
"path": "/gameEngine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if distance >= 0 and distance < 4:
return u"\u2588"
elif distance >= 4 and distance < 8:
return u"\u2593"
elif distance >= 8 and distance < 12:
return u"\u2592"
elif distance >= 10 and distance < 15:
return u"\u2591"
r... | code_fim | hard | {
"lang": "python",
"repo": "HectorPulido/ConsoleGameEngine",
"path": "/gameEngine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> distances = []
for i in range(self.screenSize[0]):
rayAngle = (angle - self.pov/2) + (i/self.screenSize[0]) * self.pov
value = self.calcDistance(position, rayAngle)
distances.append(value)
return distances
def getBlock(self, distance):
... | code_fim | hard | {
"lang": "python",
"repo": "HectorPulido/ConsoleGameEngine",
"path": "/gameEngine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> res[j][c] = res[i][1 - c] + 1
bfs.append([j, 1 - c])
return [x if x < n * 2 else -1 for x in map(min, res)]<|fim_prefix|># repo: sweetpand/Algorithms path: /AlgoOnGraphs/1129. Shortest Path with Alternating Colors/shortestAlternatingPaths1.py
def shortestAlternatingPaths(se... | code_fim | hard | {
"lang": "python",
"repo": "sweetpand/Algorithms",
"path": "/AlgoOnGraphs/1129. Shortest Path with Alternating Colors/shortestAlternatingPaths1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sweetpand/Algorithms path: /AlgoOnGraphs/1129. Shortest Path with Alternating Colors/shortestAlternatingPaths1.py
def shortestAlternatingPaths(self, n, red_edges, blue_edges):
G = [[[], []] for i in range(n)]
for i, j in red_edges: G<|fim_suffix|> res[j][c] = res[i][1 - c] + 1
... | code_fim | hard | {
"lang": "python",
"repo": "sweetpand/Algorithms",
"path": "/AlgoOnGraphs/1129. Shortest Path with Alternating Colors/shortestAlternatingPaths1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lothilius/oiPy path: /fb_grab_events.py
__author__ = 'Lothilius'
import json
import unicodedata
import authentication as oath
import re
from datetime import datetime
import urllib2
import numpy as np
url = 'https://graph.facebook.com/v2.2/100004568139047/events/not_replied?fields=id&limit=200'
... | code_fim | hard | {
"lang": "python",
"repo": "Lothilius/oiPy",
"path": "/fb_grab_events.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return the_how
def change_datetime_format(the_datetime):
"""Change the format of the datetime value to a true python datetime value."""
year = int(the_datetime[:4])
month = int(the_datetime[5:7])
day = int(the_datetime[8:10])
try:
hour = int(the_datetime[11:13])
m... | code_fim | hard | {
"lang": "python",
"repo": "Lothilius/oiPy",
"path": "/fb_grab_events.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paulxiong/fixmatch path: /imagenet/datasets/imagenet.py
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/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | code_fim | hard | {
"lang": "python",
"repo": "paulxiong/fixmatch",
"path": "/imagenet/datasets/imagenet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paulxiong/fixmatch path: /imagenet/datasets/imagenet.py
/www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o... | code_fim | hard | {
"lang": "python",
"repo": "paulxiong/fixmatch",
"path": "/imagenet/datasets/imagenet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
Dictionary with combined suvervised and unsupervised examples.
"""
# Copy all values from supervised data as is
output_dict = dict(sup_data)
# take only 'image' and 'aug_image' from unsupervised dataset and
# rename then into 'unsup_image' and 'unsup_aug_image'
if 'image' in un... | code_fim | hard | {
"lang": "python",
"repo": "paulxiong/fixmatch",
"path": "/imagenet/datasets/imagenet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chinmayHundekari/NSEDatabase path: /getbhav.py
#Copyright (c) 2017 Chinmay Hundekari
#See the file license.txt for copying permission.
import urllib2
import datetime
from dateutil.relativedelta import relativedelta
import requests
import httplib, StringIO, zipfile
import os
import sys
class nse... | code_fim | hard | {
"lang": "python",
"repo": "chinmayHundekari/NSEDatabase",
"path": "/getbhav.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "Downloading %s ..." % (filename)
if c.getResponse(reqstr) == -1:
return -1
sdata = StringIO.StringIO(c.data)
z = zipfile.ZipFile(sdata)
try:
csv = z.read(z.namelist()[0])
except Exception as e:
print "%s" % (format(e))
return -1
if not csv... | code_fim | hard | {
"lang": "python",
"repo": "chinmayHundekari/NSEDatabase",
"path": "/getbhav.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def _get_defaults(context, config_defaults):
"""Get default quota values.
If the default class is defined, use the values defined
in the class, otherwise use the values from the config.
:param context:
:param config_defaults:
:return:... | code_fim | hard | {
"lang": "python",
"repo": "rickyhai11/plmano_rm",
"path": "/playnetmano_rm/api/controllers/quota_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rickyhai11/plmano_rm path: /playnetmano_rm/api/controllers/quota_manager.py
import collections
from oslo_config import cfg
from oslo_log import log as logging
from oslo_log import versionutils
import pecan
from pecan import expose
from pecan import request
import restcomm
import six
from playne... | code_fim | hard | {
"lang": "python",
"repo": "rickyhai11/plmano_rm",
"path": "/playnetmano_rm/api/controllers/quota_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ************************************************************
####UnitTest Specifications
- Given: line1
When : line2
Then : line3
`test__findDockBlock()`
******************************************... | code_fim | hard | {
"lang": "python",
"repo": "anconaesselmann/LiveUnit",
"path": "/classes_and_testsTest/DocumentationFromUnitTestsTestData/DataSet8_py_Result.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anconaesselmann/LiveUnit path: /classes_and_testsTest/DocumentationFromUnitTestsTestData/DataSet8_py_Result.py
class DocumentationFromUnitTestsCommand(sublime_plugin.TextCommand):
def _getMethodNames(self, fileContent, fileExtension):
""" finds all method names int string "fileContent... | code_fim | hard | {
"lang": "python",
"repo": "anconaesselmann/LiveUnit",
"path": "/classes_and_testsTest/DocumentationFromUnitTestsTestData/DataSet8_py_Result.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> `test__findDockBlock()`
************************************************************
@param str classFileContent The content of a class file
@param str functionName the name of a function
returns: the position and length of the documentat... | code_fim | hard | {
"lang": "python",
"repo": "anconaesselmann/LiveUnit",
"path": "/classes_and_testsTest/DocumentationFromUnitTestsTestData/DataSet8_py_Result.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catapult-project/catapult path: /dashboard/dashboard/services/crrev_service_test.py
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from __futur... | code_fim | medium | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/dashboard/dashboard/services/crrev_service_test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.