text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>if __name__ == '__main__': import runpy import sys sys.modules['test_pulse'] = sys.modules['__main__'] del sys.argv[0] __file__ = sys.argv[0] runpy.run_module(sys.argv[0], run_name='__main__', alter_sys=True)<|fim_prefix|># repo: jpaalasm/pyglet path: /experimental/pulse/test_pul...
code_fim
medium
{ "lang": "python", "repo": "jpaalasm/pyglet", "path": "/experimental/pulse/test_pulse.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='community', name='num_timber_facilities', field=models.IntegerField(null=True), ), ]<|fim_prefix|># repo: syin/CIT path: /web/pipeline/migrations/0031_community_num_timber_facilities.py # Generated...
code_fim
medium
{ "lang": "python", "repo": "syin/CIT", "path": "/web/pipeline/migrations/0031_community_num_timber_facilities.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: syin/CIT path: /web/pipeline/migrations/0031_community_num_timber_facilities.py # Generated by Django 2.2.13 on 2020-07-15 21:42 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('pipeline', '0030_auto_20200714_2254'), ] operations = [ migrat...
code_fim
easy
{ "lang": "python", "repo": "syin/CIT", "path": "/web/pipeline/migrations/0031_community_num_timber_facilities.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print 'Renaming columns' df.columns = [COLUMN_RENAMES.get(c, c) for c in df.columns] dummies = [c for c in df.columns if c.startswith('DUMMY')] to_drop = list(set(COLUMNS_TO_DROP + dummies)) print 'Dropping %d columns:\n%s' % (len(to_drop), to_drop) df.drop(to_drop, axis=1, inplace...
code_fim
hard
{ "lang": "python", "repo": "deepesch/bayeshack-transportation-railroad", "path": "/cleaning/scripts/fix_railroad.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: deepesch/bayeshack-transportation-railroad path: /cleaning/scripts/fix_railroad.py """Script to fix the transportation datafile.""" import datetime import os import sys import string import tempfile import pandas as pd VALID_CHARS = set(string.punctuation + string.ascii_letters + ...
code_fim
hard
{ "lang": "python", "repo": "deepesch/bayeshack-transportation-railroad", "path": "/cleaning/scripts/fix_railroad.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> df['SUICIDE_ATTEMPTED'] = df['COVERDATA'] == 'X' df.ix[df['YEAR'] < 2011, 'SUICIDE_ATTEMPTED'] = None # Combine narrative columns into one narratives = [] for n1, n2 in zip(df['NARR1'], df['NARR2']): narratives.append(str(n1 if pd.notnull(n1) else '') + ...
code_fim
hard
{ "lang": "python", "repo": "deepesch/bayeshack-transportation-railroad", "path": "/cleaning/scripts/fix_railroad.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> excl_paths = excluded_paths.split(',') + default_excluded_paths return ( path and any([p for p in excl_paths if path.startswith(p)]))<|fim_prefix|># repo: universalcore/unicore-cms path: /cms/utils.py default_excluded_paths = ['/health/', '/api/notify/'] <|fim_middle|>def exclud...
code_fim
easy
{ "lang": "python", "repo": "universalcore/unicore-cms", "path": "/cms/utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: universalcore/unicore-cms path: /cms/utils.py default_excluded_paths = ['/health/', '/api/notify/'] <|fim_suffix|> excl_paths = excluded_paths.split(',') + default_excluded_paths return ( path and any([p for p in excl_paths if path.startswith(p)]))<|fim_middle|>def exclud...
code_fim
easy
{ "lang": "python", "repo": "universalcore/unicore-cms", "path": "/cms/utils.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # check nnn distances assert len(data["nnn_distances"][0][0]["corner"]) == 8 assert len(data["nnn_distances"][0][0]["edge"]) == 2 assert data["nnn_distances"][0][0]["edge"][0] == approx(3.24322132) # check components assert data["components"][0]["dimensiona...
code_fim
hard
{ "lang": "python", "repo": "hackingmaterials/robocrystallographer", "path": "/robocrys/condense/tests/test_structure.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # check angles assert len(data["angles"][0][0]["corner"]) == 8 assert len(data["angles"][0][0]["edge"]) == 4 assert data["angles"][0][0]["edge"][0] == approx(101.62284671698572) # check nnn distances assert len(data["nnn_distances"][0][0]["corner"]) == 8 ...
code_fim
hard
{ "lang": "python", "repo": "hackingmaterials/robocrystallographer", "path": "/robocrys/condense/tests/test_structure.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hackingmaterials/robocrystallographer path: /robocrys/condense/tests/test_structure.py from __future__ import annotations from pytest import approx from robocrys.condense.condenser import StructureCondenser from robocrys.tests import RobocrysTest class TestStructureCondenser(RobocrysTest): ...
code_fim
hard
{ "lang": "python", "repo": "hackingmaterials/robocrystallographer", "path": "/robocrys/condense/tests/test_structure.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mateuspadua/design-patterns path: /behavioral/chain_of_responsability/udemy.py """ Avoids coupling the sender of a request to the receiver by giving more than one object a chance to handle the request. """ class Car: def __init__(self, name: str, water: int, fuel: int, oil: int) -> None: ...
code_fim
hard
{ "lang": "python", "repo": "mateuspadua/design-patterns", "path": "/behavioral/chain_of_responsability/udemy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>car: Car = Car(name='my car', water=10, fuel=10, oil=10) garage_handler.handle_request(car) car: Car = Car(name='my car', water=20, fuel=20, oil=20) garage_handler.handle_request(car)<|fim_prefix|># repo: mateuspadua/design-patterns path: /behavioral/chain_of_responsability/udemy.py """ Avoids coupling ...
code_fim
medium
{ "lang": "python", "repo": "mateuspadua/design-patterns", "path": "/behavioral/chain_of_responsability/udemy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("����һ��Dog��") pass ''' ��Ҫʹ��ģ�������� ��Ҫ����ģ�� '''<|fim_prefix|># repo: cjj1472111531/exception path: /01-module.py # coding=gbk # @file:01-module.py # @data:2021/7/11 9:36 # Editor:clown ''' python ����python�����б����Ѿ�д�õĴ����ļ����ļ��� �����Լ����������Ƕ�����ʹ�� ʹ��ģ...
code_fim
medium
{ "lang": "python", "repo": "cjj1472111531/exception", "path": "/01-module.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cjj1472111531/exception path: /01-module.py # coding=gbk # @file:01-module.py # @data:2021/7/11 9:36 # Editor:clown ''' python ����python�����б����Ѿ�д�õĴ����ļ����ļ��� �����Լ����������Ƕ�����ʹ�� ʹ��ģ��ĺô���ֱ��ʹ�ñ����Ѿ�ʵ�ֺõĹ��� ģ��==python�ļ� ����ģ����Ƕ���python�����ļ� ע��� ģ�����Ͷ�Ӱ�...
code_fim
medium
{ "lang": "python", "repo": "cjj1472111531/exception", "path": "/01-module.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> plt.title(title) #Axis Label Data plt.xlabel("Time of Day (10m Intervals)") plt.ylabel("Normalised Values [Anomaly Score] for " + row_index) ax2 = plt.twinx() ax2.set_ylabel(data_field + " values for " + row_index) ax2.axhline(y=max(upper_bound.tolist()), color='red') #Intercepts ax2.axhline(y=mi...
code_fim
hard
{ "lang": "python", "repo": "tushariyer/anomalydetector", "path": "/anomalydetector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tushariyer/anomalydetector path: /anomalydetector.py # -*- coding: utf-8 -*- """ Tushar Iyer """ import pandas as pd import math import datetime from matplotlib import pyplot as plt import numpy as np from itertools import compress, starmap from operator import gt from operator import lt #--...
code_fim
hard
{ "lang": "python", "repo": "tushariyer/anomalydetector", "path": "/anomalydetector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mlf_logger = MLFlowLogger(experiment_name=hparams.exp_name, tracking_uri="./mlruns", tags=args.tags) exp = mlf_logger.experiment.get_experiment_by_name(hparams.exp_name) artifacts_dir = os.path.join(exp.artifact_location, mlf_logger.run_id, "artifacts") checkpoint_callback = ModelCheckpo...
code_fim
medium
{ "lang": "python", "repo": "5n7/cifar10", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": parser = argparse.ArgumentParser(add_help=False) parser.add_argument("--exp-name", default="Default") parser.add_argument("--num-epochs", default=128, type=int) parser.add_argument("--tags", action=utils.DictPairParser, metavar=utils.DictPairParser.METAVAR) ...
code_fim
hard
{ "lang": "python", "repo": "5n7/cifar10", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 5n7/cifar10 path: /train.py import argparse import os import warnings from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import MLFlowLogger from cifar10 import Module, utils <|fim_suffix|> exp = mlf_logger.experiment...
code_fim
hard
{ "lang": "python", "repo": "5n7/cifar10", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def feature_traversal(feature): yield feature for sub_feature in feature.sub_features: yield from feature_traversal(sub_feature) if __name__ == '__main__': args = parse_args() noid_count = 1 tx_counts = Counter() gene_counts = Counter() records = list(GFF.parse(args.i...
code_fim
hard
{ "lang": "python", "repo": "ComparativeGenomicsToolkit/Comparative-Annotation-Toolkit", "path": "/programs/convert_ncbi_gff3", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> new_qualifiers = OrderedDict() for key, val in feature.qualifiers.items(): # no upper case keys unless it is ID or Parent or Name if key not in ['ID', 'Parent', 'Name']: key = key.lower() # collapse to a single item # replace all semicolons if le...
code_fim
hard
{ "lang": "python", "repo": "ComparativeGenomicsToolkit/Comparative-Annotation-Toolkit", "path": "/programs/convert_ncbi_gff3", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ComparativeGenomicsToolkit/Comparative-Annotation-Toolkit path: /programs/convert_ncbi_gff3 #!/usr/bin/env python """Developed against Rnor6 RefSeq""" import argparse from BCBio import GFF from collections import Counter, OrderedDict def parse_args(): parser = argparse.ArgumentParser() ...
code_fim
hard
{ "lang": "python", "repo": "ComparativeGenomicsToolkit/Comparative-Annotation-Toolkit", "path": "/programs/convert_ncbi_gff3", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def rum_saveshell2log(cmd,ordilogfile,errorlogfile): fdout = open(ordilogfile, 'a') fderr = open(errorlogfile, 'a') p = subprocess.Popen(cmd, stdout=fdout, stderr=fderr, shell=True, encoding='utf-8') if p.poll(): return 1 p.wait() return 0 if __name__ == '__main__': pr...
code_fim
medium
{ "lang": "python", "repo": "LewisGu/SteamRankTimerSpider", "path": "/RunTimerSpiderWithLog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fdout = open(ordilogfile, 'a') fderr = open(errorlogfile, 'a') p = subprocess.Popen(cmd, stdout=fdout, stderr=fderr, shell=True, encoding='utf-8') if p.poll(): return 1 p.wait() return 0 if __name__ == '__main__': print('the steam rank spider is started\nlog recording....
code_fim
medium
{ "lang": "python", "repo": "LewisGu/SteamRankTimerSpider", "path": "/RunTimerSpiderWithLog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LewisGu/SteamRankTimerSpider path: /RunTimerSpiderWithLog.py import os import time import subprocess errorlogfile = f'ErrorLog.log' ordilogfile = f'OrdiLog.log' run_spider_command = 'python3 TimerSpider.py' current_folder = os.getcwd() #表示当前所处的文件夹 # this script is used to start spider b...
code_fim
medium
{ "lang": "python", "repo": "LewisGu/SteamRankTimerSpider", "path": "/RunTimerSpiderWithLog.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> again_conflict_data = [] for item_data in table_data: if item_data['name'] != item_data['src_name']: tag = self.case_data_manager.db_helper.query_tag_by_name(item_data['name']) if tag: again_conflict_data.append(item_data['nam...
code_fim
hard
{ "lang": "python", "repo": "chenlei-123/uitester", "path": "/uitester/ui/case_manager/conflict_tag.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chenlei-123/uitester path: /uitester/ui/case_manager/conflict_tag.py # @Time : 2016/8/30 15:46 # @Author : lixintong import math import os from threading import Thread from PyQt5 import uic from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont, QImage, QPixmap, QMovie from PyQt5.QtWidgets...
code_fim
hard
{ "lang": "python", "repo": "chenlei-123/uitester", "path": "/uitester/ui/case_manager/conflict_tag.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bchaiks/2D_Cutting_Stock path: /cutting_stock_OO.py ''' Aproach for solving an instance using this file: import cutting_stock_OO as cso # Inputs request = "some json request dict with the parts" # size of stock sheets sheet_size = [96.0, 48.0] # desired margin at edge of sheet sheet_margin ...
code_fim
hard
{ "lang": "python", "repo": "bchaiks/2D_Cutting_Stock", "path": "/cutting_stock_OO.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return(OUTPUT) ''' ## TEST PART LIST p_m = 1.0 s_m = 1.0 s_d = [96., 48.] parts = { "1": [45.0, 15.0], "2": [50.0, 12.0], "3": [55.0, 13.0], "4": [30.0, 9.0], "5": [12.0, 9.0], "6": [67.0, 9.0]} parts = { "1": [67.0, 9.0], "2": [67.0, 9.0], "3": [67.0, 9.0], ...
code_fim
hard
{ "lang": "python", "repo": "bchaiks/2D_Cutting_Stock", "path": "/cutting_stock_OO.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brenowca/graphlab path: /apps/bnets/generatingBNets.py import sys, itertools from random import choice, sample, seed from os import path, makedirs from reading_bnets import createBBNF ''' This method returns a bayesian network, a pair (vars,cpds) of maps that encompass the structure of the netw...
code_fim
hard
{ "lang": "python", "repo": "brenowca/graphlab", "path": "/apps/bnets/generatingBNets.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> seed(r_seed) def choose_children_random(id): n_children = min(nodes_qtd-id, out_degree) if(n_children > 0): return sample(range(id+1, nodes_qtd+1), n_children) else: return [] def choose_cardinality(id): if(max_cardinality > 0): ...
code_fim
hard
{ "lang": "python", "repo": "brenowca/graphlab", "path": "/apps/bnets/generatingBNets.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def newreservation(request): if request.method == 'POST': form = ReservationForm(request.POST) if form.is_valid(): r = Reservation() r.user = request.user r.resource = Resource.objects.get(pk=int(request.POST['resource'])) r.priority = request.POST['priority'] r.reservation_start = req...
code_fim
hard
{ "lang": "python", "repo": "simon-andrews/django-resource-scheduler", "path": "/resource_scheduler/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: simon-andrews/django-resource-scheduler path: /resource_scheduler/views.py from django.http import Http404 from django.shortcuts import redirect, render, render_to_response from .forms import ResourceForm, ReservationForm from .models import Resource, Reservation def index(request): return r...
code_fim
hard
{ "lang": "python", "repo": "simon-andrews/django-resource-scheduler", "path": "/resource_scheduler/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomciopp/FrameworkBenchmarks path: /frameworks/Python/webware/app/Context/DbSession.py import os from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker DBDRIVER = 'mysql' DBHOSTNAME = 'tfb-database' DATABASE_URI = '%s...
code_fim
easy
{ "lang": "python", "repo": "tomciopp/FrameworkBenchmarks", "path": "/frameworks/Python/webware/app/Context/DbSession.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> Base = declarative_base() db_engine = create_engine(DATABASE_URI) Session = sessionmaker(bind=db_engine) DbSession = Session()<|fim_prefix|># repo: tomciopp/FrameworkBenchmarks path: /frameworks/Python/webware/app/Context/DbSession.py import os from sqlalchemy.ext.declarative import declarative_base...
code_fim
easy
{ "lang": "python", "repo": "tomciopp/FrameworkBenchmarks", "path": "/frameworks/Python/webware/app/Context/DbSession.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": dataYear = input("Please chose year fo analysis (2015 or 2016) \n") project_dir = str(Path(__file__).resolve().parents[1]) main(project_dir, dataYear)<|fim_prefix|># repo: sebastian-konicz/WRM path: /src/CreatingReport.py from pathlib import Path import data.aDataLo...
code_fim
medium
{ "lang": "python", "repo": "sebastian-konicz/WRM", "path": "/src/CreatingReport.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sebastian-konicz/WRM path: /src/CreatingReport.py from pathlib import Path import data.aDataLoadAndCleaningHistorical as DataLoad import data.bDataEnrichment as DataEnrichment import features.RidingPatternsPlots as Plots import visualization.NetArivalsDepartures <|fim_suffix|> DataLoad.main(d...
code_fim
medium
{ "lang": "python", "repo": "sebastian-konicz/WRM", "path": "/src/CreatingReport.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # do two passes to put all non-optional edges first for source, dest, optional in self.edges: if optional: continue lines.append(f" {source} -> {dest};") for source, dest, optional in self.edges: if not optional: ...
code_fim
hard
{ "lang": "python", "repo": "globus/globus-sdk-python", "path": "/src/globus_sdk/experimental/scope_parser/_parser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: globus/globus-sdk-python path: /src/globus_sdk/experimental/scope_parser/_parser.py from __future__ import annotations import typing as t from collections import defaultdict, deque from .errors import ScopeCycleError, ScopeParseError SPECIAL_CHARACTERS = set("[]* ") SPECIAL_TOKENS = set("[]*")...
code_fim
hard
{ "lang": "python", "repo": "globus/globus-sdk-python", "path": "/src/globus_sdk/experimental/scope_parser/_parser.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # for each child edge, do two basic things: # - check if we found a back-edge (cycle!) # - create a new path to explore, with the child node as its current # terminus for edge in children: _, dest, _ = edge if de...
code_fim
hard
{ "lang": "python", "repo": "globus/globus-sdk-python", "path": "/src/globus_sdk/experimental/scope_parser/_parser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: azeem110201/quick-dsa path: /quickdsa/sorting/bubble.py from typing import List def BubbleSort(nums: List, reverse: bool = False) -> List: ''' Functions takes in two arguments that is the array and reverse which indicates ascending or descending sorting. ''' <|fim_suffix|> r...
code_fim
hard
{ "lang": "python", "repo": "azeem110201/quick-dsa", "path": "/quickdsa/sorting/bubble.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> n = len(nums) if reverse == True: for i in range(n): for j in range(n - i - 1): if nums[j] < nums[j+1]: nums[j+1], nums[j] = nums[j], nums[j+1] return nums else: for i in range(n): for j in range(n - i ...
code_fim
hard
{ "lang": "python", "repo": "azeem110201/quick-dsa", "path": "/quickdsa/sorting/bubble.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> df = pd.DataFrame(data, columns=[ 'protein', 'dms', 'model_name', 'corr', 'pval', ]) plt.figure(figsize=(12, 5)) sns.barplot( data=df, x='protein', y='corr', hue='model_name', ci=None, ) sns.stripplot(...
code_fim
medium
{ "lang": "python", "repo": "brianhie/evolocity", "path": "/bin/plot_dms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brianhie/evolocity path: /bin/plot_dms.py from utils import * def load_model(model_name): data = [] with open(f'target/dms/dms_{model_name}.log') as f: for line in f: line = line.rstrip().split(' | ')[-1] if line.startswith('Results for '): ...
code_fim
hard
{ "lang": "python", "repo": "brianhie/evolocity", "path": "/bin/plot_dms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebook/ThreatExchange path: /hasher-matcher-actioner/hmalib/lambdas/api/datasets.py # Copyright (c) Meta Platforms, Inc. and affiliates. import bottle import typing as t from dataclasses import dataclass, asdict from mypy_boto3_dynamodb.service_resource import Table from hmalib import metrics...
code_fim
hard
{ "lang": "python", "repo": "facebook/ThreatExchange", "path": "/hasher-matcher-actioner/hmalib/lambdas/api/datasets.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @dataclass class MatchSettingsResponse(JSONifiable): match_settings: t.List[MatchSettingsResponseBody] def to_json(self) -> t.Dict: return { "match_settings": [settings.to_json() for settings in self.match_settings] } @dataclass class MatchSettingsUpdateRequest(Dict...
code_fim
hard
{ "lang": "python", "repo": "facebook/ThreatExchange", "path": "/hasher-matcher-actioner/hmalib/lambdas/api/datasets.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return cls( d["privacy_group_id"], d["pdq_match_threshold"], ) @dataclass class MatchSettingsUpdateResponse(JSONifiable): response: str def to_json(self) -> t.Dict: return asdict(self) def _get_signal_hash_count_and_last_modified( threat_exc...
code_fim
hard
{ "lang": "python", "repo": "facebook/ThreatExchange", "path": "/hasher-matcher-actioner/hmalib/lambdas/api/datasets.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dazuma/synthtool path: /tests/test_autosynth_git.py # Copyright 2020 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 # # https://www.apache.org/licenses/...
code_fim
hard
{ "lang": "python", "repo": "dazuma/synthtool", "path": "/tests/test_autosynth_git.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Many commit messages, especially from commits in googleapis/googleapis like https://github.com/googleapis/googleapis/commit/9ff6fd3b22f99167827e89aae7778408b5e82425 do not not have a blank line separating the subject from the body. In such cases, we only want to get the first line. ...
code_fim
hard
{ "lang": "python", "repo": "dazuma/synthtool", "path": "/tests/test_autosynth_git.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: andela-Taiwo/favorite-things path: /backend/favorite_things/response.py from rest_framework.response import Response class FavoriteAPIResponse(Response): <|fim_suffix|> super(FavoriteAPIResponse, self).__init__( data, status, template_name, headers, exception, content_type ...
code_fim
hard
{ "lang": "python", "repo": "andela-Taiwo/favorite-things", "path": "/backend/favorite_things/response.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> template_name=None, headers=None, exception=False, content_type=None, schema=None): data = { 'VERSION': 1, 'schema': schema, 'payload': data } super(FavoriteAPIResponse, self).__init__( ...
code_fim
hard
{ "lang": "python", "repo": "andela-Taiwo/favorite-things", "path": "/backend/favorite_things/response.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ImperialCollegeLondon/champ path: /main/migrations/0012_support_oauth.py # Generated by Django 3.2.2 on 2021-08-05 14:48 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AddField( model_name='profil...
code_fim
hard
{ "lang": "python", "repo": "ImperialCollegeLondon/champ", "path": "/main/migrations/0012_support_oauth.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='profile', name='affiliation', field=models.CharField(default='', max_length=50), preserve_default=False, ), migrations.AddField( model_name='profile', name='f...
code_fim
hard
{ "lang": "python", "repo": "ImperialCollegeLondon/champ", "path": "/main/migrations/0012_support_oauth.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class FeedViewsTest(TestCase): def setUp(self): self.test_feed = Feed.objects.create(feed_url="http://example.com/feed.xml") self.test_item = Item.objects.create(feed=self.test_feed, link="http://example.com/feedaggregator-news", title="Some title") def test_index(self): ...
code_fim
hard
{ "lang": "python", "repo": "fasouto/django-feedaggregator", "path": "/feedaggregator/tests/test_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class SyndicationTest(TestCase): def setUp(self): self.rss_example = b'<?xml version="1.0" encoding="utf-8"?>\n<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Latest posts</title><link>http://example.com/feed/rss/</link><description></description><atom:link href="h...
code_fim
hard
{ "lang": "python", "repo": "fasouto/django-feedaggregator", "path": "/feedaggregator/tests/test_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fasouto/django-feedaggregator path: /feedaggregator/tests/test_views.py # -*- coding: utf-8 -*- from django.test import TestCase, override_settings from django.core.urlresolvers import reverse from django.conf import settings from feedaggregator.models import Item, Feed class OPMLExportTests(T...
code_fim
hard
{ "lang": "python", "repo": "fasouto/django-feedaggregator", "path": "/feedaggregator/tests/test_views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>########################## read in files abundances_file = open(args.abundance_name, "r") abundances_d = {} #abundance_total_d {} timeToDate_d = {} times_index = 'NA' for line in abundances_file: line_l = line.strip().split(",") if line_l[0] == "names": times_index = line_l.index("times") ...
code_fim
hard
{ "lang": "python", "repo": "jennifer-bio/epimuller", "path": "/scripts/drawMuller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jennifer-bio/epimuller path: /scripts/drawMuller.py e, size = (str(WIDTH)+"px", str(HEIGHT)+"px")) img.add(img.polyline(points = [(0,0), (0, HEIGHT), (WIDTH, HEIGHT), (WIDTH, 0)], stroke='black', fill = 'white')) #img.add(img.text(text = 'Legend', insert = (WIDTH-LEGENDWIDTH, LEGENDWIDTH), font...
code_fim
hard
{ "lang": "python", "repo": "jennifer-bio/epimuller", "path": "/scripts/drawMuller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> startDay = date.fromisoformat(timeToDate_d[times_l[0]]) endDay = date.fromisoformat(timeToDate_d[times_l[1]]) global timeWindow timeWindow = (endDay-startDay).days hierarchy_file = open(args.parentHierarchy_name, "r") childParent_d = {} cladeColor_d = {} hasHeader = False hasColor = False ...
code_fim
hard
{ "lang": "python", "repo": "jennifer-bio/epimuller", "path": "/scripts/drawMuller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kimbugp/MyDiary path: /app/schemas/users.py import re from jsonschema import validate from app.utils.error_handlers import ValidationError user_schema = { 'type': 'object', 'properties': { 'username': {"allOf": [ {"type": "string"}, {"minLength": 5} ...
code_fim
hard
{ "lang": "python", "repo": "kimbugp/MyDiary", "path": "/app/schemas/users.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Function to process user signup info from browser''' schema = user_schema.copy() if partial: schema.pop('required') validate(var, schema) if re.match(r'\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b', var['email'], re.I) and re.match("^[A-Za-z0-9_-]*$", var['username']): ...
code_fim
medium
{ "lang": "python", "repo": "kimbugp/MyDiary", "path": "/app/schemas/users.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> optimizer.zero_grad() y_pred = model(x) loss = loss_fn(y_pred.float(), y.float()) ### Change loss.backward() within the closure to: ### optimizer.backward(loss) ### return loss loss = optimizer.step(closure) print("final loss = ", loss)<|fim_pre...
code_fim
hard
{ "lang": "python", "repo": "hzshuai/apex", "path": "/examples/deprecated_api/FP16_Optimizer_simple/closure.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hzshuai/apex path: /examples/deprecated_api/FP16_Optimizer_simple/closure.py import torch from apex.fp16_utils import FP16_Optimizer torch.backends.cudnn.benchmark = True <|fim_suffix|>optimizer = torch.optim.LBFGS(model.parameters()) ### Construct FP16_Optimizer optimizer = FP16_Optimizer(opti...
code_fim
hard
{ "lang": "python", "repo": "hzshuai/apex", "path": "/examples/deprecated_api/FP16_Optimizer_simple/closure.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class MyGraph(models.Model): profile = models.ForeignKey(Profile) name = models.CharField(max_length=64) url = models.TextField()<|fim_prefix|># repo: zwidny/graphite path: /src/account/models.py # -*- coding: utf-8 -*- from __future__ import absolute_import from django.db import models from...
code_fim
hard
{ "lang": "python", "repo": "zwidny/graphite", "path": "/src/account/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> profile = models.ForeignKey(Profile) name = models.CharField(max_length=64) class Window(models.Model): view = models.ForeignKey(View) name = models.CharField(max_length=64) top = models.IntegerField() left = models.IntegerField() width = models.IntegerField() height = mo...
code_fim
medium
{ "lang": "python", "repo": "zwidny/graphite", "path": "/src/account/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zwidny/graphite path: /src/account/models.py # -*- coding: utf-8 -*- from __future__ import absolute_import from django.db import models from django.contrib.auth import models as auth_models class Profile(models.Model): user = models.OneToOneField(auth_models.User) history = models.Tex...
code_fim
hard
{ "lang": "python", "repo": "zwidny/graphite", "path": "/src/account/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: scalabli/quo path: /tests/test_console.py .platform == "win32", reason="does not run on windows") def test_16color_terminal(): console = Console( force_terminal=True, _environ={"TERM": "xterm-16color"}, legacy_windows=False ) assert console.color_system == "standard" @pytest...
code_fim
hard
{ "lang": "python", "repo": "scalabli/quo", "path": "/tests/test_console.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scalabli/quo path: /tests/test_console.py \x1b[0m\n" result = console.file.getvalue() print(repr(result)) assert result == expected def test_log_milliseconds(): def time_formatter(timestamp: datetime) -> Text: return Text("TIME")...
code_fim
hard
{ "lang": "python", "repo": "scalabli/quo", "path": "/tests/test_console.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_print_json_error(): console = Console(file=io.StringIO(), color_system="truecolor") with pytest.raises(TypeError): console.print_json(["foo"], indent=4) def test_print_json_data(): console = Console(file=io.StringIO(), color_system="truecolor") console.print_json(data=[F...
code_fim
hard
{ "lang": "python", "repo": "scalabli/quo", "path": "/tests/test_console.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> imp = BGBlImporter( options['db_path'], options['doc_path'], rerun=options['rerun'], reindex=options['reindex'], watermark=options['watermark'], years=create_range_argument(options['years']), parts=create_range_argument(option...
code_fim
hard
{ "lang": "python", "repo": "okfde/api.offenegesetze.de", "path": "/bgbl/management/commands/index_documents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument('db_path', type=str) parser.add_argument('doc_path', type=str) parser.add_argument("-r", action='store_true', dest='rerun') parser.add_argument("-i", action='store_true', dest='reindex') par...
code_fim
hard
{ "lang": "python", "repo": "okfde/api.offenegesetze.de", "path": "/bgbl/management/commands/index_documents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: okfde/api.offenegesetze.de path: /bgbl/management/commands/index_documents.py import datetime from multiprocessing import Pool from django.core.management.base import BaseCommand from bgbl.search_indexes import ( _destroy_index, init_es ) from bgbl.importer import BGBlImporter def create_...
code_fim
hard
{ "lang": "python", "repo": "okfde/api.offenegesetze.de", "path": "/bgbl/management/commands/index_documents.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KahHinLai/cvguipy path: /genetic_search.py #!/usr/bin/env python import os, sys, subprocess import argparse import subprocess import threading import timeit from multiprocessing import Queue, Lock from configobj import ConfigObj from numpy import loadtxt from numpy.linalg import inv import matpl...
code_fim
hard
{ "lang": "python", "repo": "KahHinLai/cvguipy", "path": "/genetic_search.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__' : parser = argparse.ArgumentParser(description="compare all sqlites that are created by cfg_combination.py to the Annotated version to find the ID of the best configuration") parser.add_argument('inputVideo', help= "input video filename") parser.add_argument('-r', '--...
code_fim
hard
{ "lang": "python", "repo": "KahHinLai/cvguipy", "path": "/genetic_search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cdb = trajstorage.CVsqlite(dbfile) cdb.open() cdb.getLatestAnnotation() cdb.createBoundingBoxTable(cdb.latestannotations, inv(homography)) cdb.loadAnnotaion() for a in cdb.annotations: a.computeCentroidTrajectory(homography) print("Latest Annotaions in "+dbfile+": ", cd...
code_fim
hard
{ "lang": "python", "repo": "KahHinLai/cvguipy", "path": "/genetic_search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: certik/sfepy path: /tests/test_quadratures.py # 13.11.2007, c # last revision: 25.02.2008 filename_mesh = 'database/tests/triquad.mesh' material_1 = { 'name' : 'm', 'mode' : 'here', 'region' : 'Omega', 'val' : 1.0, } region_1000 = { 'name' : 'Omega', 'select' : 'all', } ...
code_fim
hard
{ "lang": "python", "repo": "certik/sfepy", "path": "/tests/test_quadratures.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> test = Test( conf = conf, options = options ) return test from_conf = staticmethod( from_conf ) ## # 13.11.2007, c def test_problem_creation( self ): from sfepy.solvers.generic import solve_stationary problem, vec, data = solve_stationary( self.conf ) ...
code_fim
hard
{ "lang": "python", "repo": "certik/sfepy", "path": "/tests/test_quadratures.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def setUpClass(cls): super(MonolithicKEpsilonPeriodicTest, cls).setUpCase( "ChannelFlowTest", "channel_flow_mon_ke_parameters.json", False) if __name__ == '__main__': UnitTest.main()<|fim_prefix|># repo: KratosMultiphysics/Kratos path...
code_fim
hard
{ "lang": "python", "repo": "KratosMultiphysics/Kratos", "path": "/applications/RANSApplication/tests/monolithic_k_epsilon_formulation_tests.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> cls.transient_scheme_type = "bossak" class MonolithicKEpsilonPeriodicTest(periodic_turbulence_modelling_test_case.PeriodicTurbulenceModellingTestCase): @classmethod def setUpClass(cls): super(MonolithicKEpsilonPeriodicTest, cls).setUpCase( "ChannelFlowTest", ...
code_fim
medium
{ "lang": "python", "repo": "KratosMultiphysics/Kratos", "path": "/applications/RANSApplication/tests/monolithic_k_epsilon_formulation_tests.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: KratosMultiphysics/Kratos path: /applications/RANSApplication/tests/monolithic_k_epsilon_formulation_tests.py import KratosMultiphysics.KratosUnittest as UnitTest import turbulence_modelling_test_case import periodic_turbulence_modelling_test_case class MonolithicKEpsilonTest(turbulence_modell...
code_fim
hard
{ "lang": "python", "repo": "KratosMultiphysics/Kratos", "path": "/applications/RANSApplication/tests/monolithic_k_epsilon_formulation_tests.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nainaidaa/dapodik path: /tests/test_validasi.py import attr from dapodik.base import BaseDapodik from dapodik.validasi import Validasi from dapodik.validasi import ValidasiSekolah from dapodik.validasi import ValidasiPrasarana from dapodik.validasi import ValidasiPesertaDidik from dapodik.validas...
code_fim
medium
{ "lang": "python", "repo": "nainaidaa/dapodik", "path": "/tests/test_validasi.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> assert issubclass(BaseValidasi, BaseDapodik) def test_member(): assert attr.has(Validasi) assert attr.has(ValidasiSekolah) assert issubclass(ValidasiSekolah, Validasi) assert attr.has(ValidasiPrasarana) assert issubclass(ValidasiPrasarana, Validasi) assert attr.has(ValidasiPe...
code_fim
medium
{ "lang": "python", "repo": "nainaidaa/dapodik", "path": "/tests/test_validasi.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: persinM/IFPI-assessment path: /Task3Cleanse.py from websites.resources.data import WEBSITES def cleanse_data(sites): <|fim_suffix|> Checks and updates sites so that 'https' urls are set to secure = True and 'http' urls are set to secure = False """ for data_item in sites: ...
code_fim
medium
{ "lang": "python", "repo": "persinM/IFPI-assessment", "path": "/Task3Cleanse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Checks and updates sites so that 'https' urls are set to secure = True and 'http' urls are set to secure = False """ for data_item in sites: if data_item['url'][4] == 's': data_item['secure'] = True else: data_item['secure'] = False if __name__ == "...
code_fim
medium
{ "lang": "python", "repo": "persinM/IFPI-assessment", "path": "/Task3Cleanse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if p.status_code != 200: return "Error in pinPost(): %s" % p.json()["error_msg"] else: post = p.json()["data"] return post def unpin(self, token, alias, id): data = [{"id": id}] p = requests.post(COLL_URI + "/%s/unpin" % alias, da...
code_fim
hard
{ "lang": "python", "repo": "Vistaus/Norka", "path": "/norka/writeasapi/collection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vistaus/Norka path: /norka/writeasapi/collection.py import requests import json from .uri import COLL_URI class collection(object): def get(self, alias): c = requests.get(COLL_URI + "/%s" % alias, headers={"Content-Type": "application/json"}) if c.status_code...
code_fim
hard
{ "lang": "python", "repo": "Vistaus/Norka", "path": "/norka/writeasapi/collection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # (T, B, D) -> (B, D, T) return x.permute([1, 2, 0]) class LabelSmoothingLoss(nn.Module): def __init__(self, smoothing=0.1): super(LabelSmoothingLoss, self).__init__() self.smoothing = smoothing def forward(self, logits, target): """ :param logits...
code_fim
hard
{ "lang": "python", "repo": "hackerekcah/ESRelation", "path": "/layers/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hackerekcah/ESRelation path: /layers/base.py import torchaudio import torch.nn as nn import torch.nn.functional as F import torch import copy class FakeLrScheduler: def step(self): pass def get_clones(module, n): return nn.ModuleList([copy.deepcopy(module) for i in range(n)]) ...
code_fim
hard
{ "lang": "python", "repo": "hackerekcah/ESRelation", "path": "/layers/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, x): # (T, B, D) -> (B, D, T) return x.permute([1, 2, 0]) class LabelSmoothingLoss(nn.Module): def __init__(self, smoothing=0.1): super(LabelSmoothingLoss, self).__init__() self.smoothing = smoothing def forward(self, logits, target): ...
code_fim
hard
{ "lang": "python", "repo": "hackerekcah/ESRelation", "path": "/layers/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def construct_go_op(self): main_program = self.helper.main_program go_block = main_program.current_block() parent_block = main_program.block(main_program.current_block() .parent_idx) x_name_list = set() out_vars = set()...
code_fim
hard
{ "lang": "python", "repo": "kavyasrinet/Paddle", "path": "/python/paddle/v2/fluid/concurrency.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kavyasrinet/Paddle path: /python/paddle/v2/fluid/concurrency.py # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the L...
code_fim
hard
{ "lang": "python", "repo": "kavyasrinet/Paddle", "path": "/python/paddle/v2/fluid/concurrency.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: FB-5/Desafio_dataproc path: /contador.py import sys from pyspark import SparkContext, SparkConf if __name__ == "__main__": sc = SparkContext("local","PySpark Exemplo - Desafio Dataproc") words = sc.textFile("gs://filipe-desafio-dataproc/livro.txt").flatMa<|fim_suffix|>.sortBy(lambda a:a[1...
code_fim
medium
{ "lang": "python", "repo": "FB-5/Desafio_dataproc", "path": "/contador.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>.sortBy(lambda a:a[1], ascending=False) wordCounts.saveAsTextFile("gs://filipe-desafio-dataproc/resultado")<|fim_prefix|># repo: FB-5/Desafio_dataproc path: /contador.py import sys from pyspark import SparkContext, SparkConf if __name__ == "__main__": sc = SparkContext("local","PySpark Exemplo - ...
code_fim
medium
{ "lang": "python", "repo": "FB-5/Desafio_dataproc", "path": "/contador.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rinikerlab/PyGromosTools path: /pygromos/files/simulation_parameters/imd.py """ FUNCTIONLIB: gromos++ input file functions Description: in this lib, gromosXX input file mainpulating functions are gathered Author: Kay Schaller & Benjamin Schroeder """ import numpy as np import copy ...
code_fim
hard
{ "lang": "python", "repo": "rinikerlab/PyGromosTools", "path": "/pygromos/files/simulation_parameters/imd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # single number if isinstance(EIR, Number): # depends on SVALS and NRES EIR_vector = [EIR for x in range(reeds_block.NUMSTATES)] for z in EIR_vector: EIR_matrix.append([z for i in range(int(reeds_block.NRES))...
code_fim
hard
{ "lang": "python", "repo": "rinikerlab/PyGromosTools", "path": "/pygromos/files/simulation_parameters/imd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Darooks/MKDG path: /uploads/core/sobelTransformation.py from django.core.files.storage import FileSystemStorage from skimage.morphology import skeletonize from skimage.color.adapt_rgb import adapt_rgb, each_channel, hsv_value from skimage.exposure import rescale_intensity from skimage import fil...
code_fim
hard
{ "lang": "python", "repo": "Darooks/MKDG", "path": "/uploads/core/sobelTransformation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def canny(myfile): img = color.rgb2gray(io.imread(myfile)) edges = img_as_float(feature.canny(img, sigma=2)) file_url = os.path.join(settings.MEDIA_ROOT, 'image_transformed.jpg') scipy.misc.imsave(file_url, edges) return IMAGE_URL<|fim_prefix|># repo: Darooks/MKDG path: /uploads/core/...
code_fim
hard
{ "lang": "python", "repo": "Darooks/MKDG", "path": "/uploads/core/sobelTransformation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Este1le/hpo_nmt path: /scripts/eval_single.py import argparse import numpy as np def get_args(): parser = argparse.ArgumentParser(description="Evaluate HPO methods on single-objective optimization.") parser.add_argument("--sample-sequence", "-s", type=str, help="The path to a file of sam...
code_fim
hard
{ "lang": "python", "repo": "Este1le/hpo_nmt", "path": "/scripts/eval_single.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": args = get_args() sample_sequence = args.sample_sequence evals = args.evals num_init = args.num_init tolerance = args.tolerance budget = args.budget # Read sampling sequences with open(sample_sequence) as f: lines = f.readlines() ss =...
code_fim
hard
{ "lang": "python", "repo": "Este1le/hpo_nmt", "path": "/scripts/eval_single.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }