seq_id
string
text
string
repo_name
string
sub_path
string
file_name
string
file_ext
string
file_size_in_byte
int64
program_lang
string
lang
string
doc_type
string
stars
int64
dataset
string
pt
string
api
list
232770074
# -*- coding: utf-8 -*- from django.contrib import admin # Register your models here. from student.models import Student, Contact, Tag # admin.site.register([Contact,Student, Tag]) # Register your models here. # 自定义管理页面,来取代默认的页面。比如上面的 "add" 页面。我们想只显示 name 和 email 部分。修改 # 定义了一个 ContactAdmin 类,用以说明管理页面的显示格式。 # 里面的 f...
null
study-python-django/student/admin.py
admin.py
py
2,058
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.contrib.admin.TabularInline", "line_number": 40, "usage_type": "attribute" }, { "api_name": "django.contrib.admin", "line_number": 40, "usage_type": "name" }, { "api_name": "student.models.Tag", "line_number": 41, "usage_type": "name" }, { "a...
581314733
from django import template import datetime register = template.Library() @register.filter def format_date(value): date = datetime.datetime.fromtimestamp(value) delta = datetime.datetime.now() - date if delta.seconds <= 600: return 'только что' elif delta.seconds <= 86400: return '{...
null
task3/app/templatetags/news_filters.py
news_filters.py
py
1,227
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.template.Library", "line_number": 6, "usage_type": "call" }, { "api_name": "django.template", "line_number": 6, "usage_type": "name" }, { "api_name": "datetime.datetime.fromtimestamp", "line_number": 11, "usage_type": "call" }, { "api_name": ...
219814302
import os,sys from pathlib import Path import importlib class parser: def __init__(self): sys.path.append('commands') self.vaild_command_names = self.get_valid_command_names() self.commands = self.get_commands() def get_commands(self): commands = {} for x in self.vaild_...
null
parser.py
parser.py
py
1,401
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.path.append", "line_number": 7, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "pathlib.Path", "line_number": 26, "usage_type": "call" } ]
374217528
import sys import os import imghdr import ntpath from PIL import Image from eirx.api import trans_image def convert(): if len(sys.argv) != 4: print >> sys.stderr, 'Usage:' print >> sys.stderr, ' erix MODE SRC DEST' return sys.exit(1) mode = sys.argv[1] src = sys.argv[2] dest ...
null
src/eirx/main.py
main.py
py
2,293
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.argv", "line_number": 10, "usage_type": "attribute" }, { "api_name": "sys.stderr", "line_number": 11, "usage_type": "attribute" }, { "api_name": "sys.stderr", "line_number": 12, "usage_type": "attribute" }, { "api_name": "sys.exit", "line_nu...
442919603
import unittest import json from os import listdir from os.path import isfile, join from dataproxy import Config from bos_incidents import factory from bos_incidents.mongodb_storage import IncidentNotFoundException class TestWithConfig(unittest.TestCase): def setUp(self): Config.load("config-tests.yam...
null
tests/abstract.py
abstract.py
py
1,202
python
en
code
null
code-starcoder2
76
[ { "api_name": "unittest.TestCase", "line_number": 13, "usage_type": "attribute" }, { "api_name": "dataproxy.Config.load", "line_number": 16, "usage_type": "call" }, { "api_name": "dataproxy.Config", "line_number": 16, "usage_type": "name" }, { "api_name": "unittes...
652430632
# -*- coding: utf-8 -*- import sqlite3 # الاتّصال بقاعدة البيانات db = sqlite3.connect('database.db') # إنشاء مُؤشّر في قاعدة البيانات لنتمكّن من تنفيذ استعلامات SQL cursor = db.cursor() # إنشاء الجدول cursor.execute(""" CREATE TABLE posts( id INTEGER PRIMARY KEY, title TEXT, content TE...
null
lesson5_logout/create_db.py
create_db.py
py
909
python
en
code
null
code-starcoder2
76
[ { "api_name": "sqlite3.connect", "line_number": 5, "usage_type": "call" } ]
8958692
# -*- coding: utf-8 -*- """ Created on Thu Apr 4 16:01:30 2019 使用词语相似度计算的方法处理未登录词 区别于使用平滑系数 @author: 李畅 """ from os import path,listdir,makedirs,rename,chmod import pickle from math import pow,log,exp import argparse import time import sys from gensim.models import word2vec class Naive_bayes: de...
null
naive_bayes_add_word_sim.py
naive_bayes_add_word_sim.py
py
8,520
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.exists", "line_number": 28, "usage_type": "call" }, { "api_name": "os.path", "line_number": 28, "usage_type": "name" }, { "api_name": "gensim.models.word2vec.Word2Vec.load", "line_number": 29, "usage_type": "call" }, { "api_name": "gensim.mo...
138393221
#!/usr/bin/env python import json import re import shutil from pathlib import Path from subprocess import run, CalledProcessError import click from dulwich.repo import Repo from dulwich.porcelain import active_branch, reset from jinja2 import Environment, FileSystemLoader from jsonschema import validate from packaging...
null
metadata/compile.py
compile.py
py
3,824
python
en
code
null
code-starcoder2
76
[ { "api_name": "jinja2.Environment", "line_number": 16, "usage_type": "call" }, { "api_name": "re.sub", "line_number": 27, "usage_type": "call" }, { "api_name": "subprocess.run", "line_number": 35, "usage_type": "call" }, { "api_name": "subprocess.CalledProcessErro...
450288321
import torch import torchvision import torch.optim as optim import matplotlib.pyplot as plt import os from datetime import datetime import numpy as np from skimage import io, data, metrics # This is very ugly im sorry import sys # insert at 1, 0 is the script path (or '' in REPL) sys.path.insert(1, r"C:\Users\daan\De...
null
neural_network/rerun_experiment.py
rerun_experiment.py
py
4,373
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.path.insert", "line_number": 13, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 13, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 27, "usage_type": "call" }, { "api_name": "os.path", "line_number...
164568721
# Sphinx documentation build configuration file import os import re import time import sphinx extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', 'sphinx.ext.autosummary', 'sphinx.ext.extlinks', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode', 'sphin...
null
doc/conf.py
conf.py
py
7,400
python
en
code
null
code-starcoder2
76
[ { "api_name": "time.strftime", "line_number": 18, "usage_type": "call" }, { "api_name": "sphinx.__display_version__", "line_number": 19, "usage_type": "attribute" }, { "api_name": "re.compile", "line_number": 129, "usage_type": "call" }, { "api_name": "sphinx.addn...
125172824
import xmltodict import json import os from utils import image_id def json2xml(js): convertXml='' jsDict = json.load(js) try: convertXml=xmltodict.unparse(jsDict,encoding='utf-8') except: convertXml=xmltodict.unparse({'request':jsDict},encoding='utf-8') return convertXml rootdi...
null
json2xml.py
json2xml.py
py
942
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.load", "line_number": 8, "usage_type": "call" }, { "api_name": "xmltodict.unparse", "line_number": 10, "usage_type": "call" }, { "api_name": "xmltodict.unparse", "line_number": 12, "usage_type": "call" }, { "api_name": "utils.image_id", "li...
487017387
# !/usr/bin/env python from __future__ import print_function from setuptools import setup, find_packages import sys with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name = "PyGenphi", version = "0.1.10", author = "David", author_email = "david@eigenphi.com", descrip...
null
setup.py
setup.py
py
1,100
python
en
code
null
code-starcoder2
76
[ { "api_name": "setuptools.setup", "line_number": 9, "usage_type": "call" } ]
197252121
import os import logging from logging.handlers import RotatingFileHandler, TimedRotatingFileHandler import json import datetime from pymongo import MongoClient def logInit(loglevel, log_file, backup_count=0, consoleshow=False): if not os.path.exists(log_file): dir_path, file_name = os.path.split(log_file) ...
null
common_func.py
common_func.py
py
3,412
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.exists", "line_number": 9, "usage_type": "call" }, { "api_name": "os.path", "line_number": 9, "usage_type": "attribute" }, { "api_name": "os.path.split", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path", "line_number": ...
595063950
from django.shortcuts import render from django.http import HttpResponse from .forms import SearchForm import requests import pandas as pd import numpy as np from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split from sklearn.naive_bayes import MultinomialNB fr...
null
spam/views.py
views.py
py
1,483
python
en
code
null
code-starcoder2
76
[ { "api_name": "forms.SearchForm", "line_number": 16, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 21, "usage_type": "call" }, { "api_name": "sklearn.feature_extraction.text.CountVectorizer", "line_number": 25, "usage_type": "call" }, { "...
258352111
""" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0 """ from cfnlint.rules import CloudFormationLintRule from cfnlint.rules import RuleMatch class And(CloudFormationLintRule): """Check And Condition Function Logic""" id = 'E8004' shortdesc = 'Check Fn::And...
null
src/cfnlint/rules/conditions/And.py
And.py
py
2,909
python
en
code
null
code-starcoder2
76
[ { "api_name": "cfnlint.rules.CloudFormationLintRule", "line_number": 9, "usage_type": "name" }, { "api_name": "cfnlint.rules.RuleMatch", "line_number": 31, "usage_type": "call" }, { "api_name": "cfnlint.rules.RuleMatch", "line_number": 37, "usage_type": "call" }, { ...
373768004
# TODO : Add back navigation button # Take user to personal homepage after login # Handle empty button clicks # Handle face not detected case # Fix "Waiting" text import sys # import some PyQt5 modules from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QWidget from PyQt5...
null
UI/employeelogin.py
employeelogin.py
py
4,810
python
en
code
null
code-starcoder2
76
[ { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 28, "usage_type": "name" }, { "api_name": "PyQt5.QtCore.QTimer", "line_number": 34, "usage_type": "call" }, { "api_name": "employeesplashscreen.Ui_MainWindow", "line_number": 48, "usage_type": "call" }, { "ap...
597168622
from django.shortcuts import render_to_response from education.models import * from django.db.models import Q from django.contrib import auth from django.http import * from django.core.paginator import Paginator, InvalidPage, EmptyPage from sources.models import * # Imports for the Ajax calls and the Jquery autocomple...
null
colonialismdb/education/views.py
views.py
py
9,476
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.utils.encoding.smart_str", "line_number": 28, "usage_type": "call" }, { "api_name": "django.utils.encoding.smart_str", "line_number": 29, "usage_type": "call" }, { "api_name": "django.utils.simplejson.dumps", "line_number": 30, "usage_type": "call" ...
204290975
from collections import deque def solution(m , load): if (max(load) > 40 or min(load) <1 or max(load) > m) : return -1 load.sort() q_a = deque(sorted(load)) while q_a: if len(q_a) >= 2: tmp_a , tmp_b = q_a.pop() , q_a.popleft() sum_= tmp_a + tmp_b sum...
null
16/05_BruteForce/algo/t01.py
t01.py
py
674
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.deque", "line_number": 6, "usage_type": "call" } ]
442290608
from academic_constants import * from academic_data import Author, AcademicPaper from request_handler import construct_params from request_handler import evaluate_request from django.core.cache import cache import json attributes = { ATT_CITATIONS, ATT_AUTHOR_AFFILIATION, ATT_WORDS, ATT_PAPER_TITLE, ATT_FIELD_OF_...
null
academic_db_interface.py
academic_db_interface.py
py
4,663
python
en
code
null
code-starcoder2
76
[ { "api_name": "request_handler.construct_params", "line_number": 38, "usage_type": "call" }, { "api_name": "request_handler.evaluate_request", "line_number": 39, "usage_type": "call" }, { "api_name": "academic_data.AcademicPaper", "line_number": 47, "usage_type": "call" ...
643696622
# con render from django.shortcuts import render # con class # from django.views.generic import TemplateView # form from contacts.forms import ContactForm from django.http import HttpResponse, HttpResponseRedirect # con render # def contacts(request): # return render(request, 'contacts/contacts.html', {'contacts': ...
null
ejercicios/plomerous/contacts/views.py
views.py
py
716
python
en
code
null
code-starcoder2
76
[ { "api_name": "contacts.forms.ContactForm", "line_number": 21, "usage_type": "call" }, { "api_name": "django.http.HttpResponseRedirect", "line_number": 23, "usage_type": "call" }, { "api_name": "contacts.forms.ContactForm", "line_number": 25, "usage_type": "call" }, {...
131046239
import cv2 import tensorflow as tf import os # quindi ora vogliamo convertire il numero nella stringa categorie = ["Cane", "Gatto"] def prepare(filepath): IMG_SIZE = 50 img_array = cv2.imread(filepath, cv2.IMREAD_GRAYSCALE) new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) return new_array.res...
null
animal_classifier/predict_animal.py
predict_animal.py
py
958
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.imread", "line_number": 11, "usage_type": "call" }, { "api_name": "cv2.IMREAD_GRAYSCALE", "line_number": 11, "usage_type": "attribute" }, { "api_name": "cv2.resize", "line_number": 12, "usage_type": "call" }, { "api_name": "tensorflow.keras.mode...
47530731
''' @author: An Dang, Henning Schulz ''' import numpy as np from collections import defaultdict from sklearn.neighbors import KNeighborsClassifier from behavior_model import BehaviorModel class Cluster_analysis: def __init__(self, prev_behavior_models, new_means, cluster_counts, label_encoder): self.new...
null
clustinator/analysis/cluster_analysis.py
cluster_analysis.py
py
6,186
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.array", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 27, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.linalg.norm", "line_num...
166224561
# -*- coding: utf-8 -*- import json import logging from werkzeug.exceptions import Forbidden from odoo import http, tools, _ from odoo.http import request from odoo.addons.website_event.controllers.main import WebsiteEventController _logger = logging.getLogger(__name__) class WebsiteEventControllerMoreInfo(WebsiteE...
null
mmm_website_event_registration_fleet_manager/controllers/main.py
main.py
py
2,400
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 10, "usage_type": "call" }, { "api_name": "odoo.addons.website_event.controllers.main.WebsiteEventController", "line_number": 13, "usage_type": "name" }, { "api_name": "odoo.http.request.httprequest.form.getlist", "line_number...
260883729
from jwt import decode, InvalidTokenError, DecodeError, get_unverified_header import sys from tqdm import tqdm # Classe vera e propria del crack def jwt_crack(jwt, dictionary): header = get_unverified_header(jwt) with open(dictionary) as fp: for secret in tqdm(fp): secret = secret.rstrip() ...
null
unimoljwtcrack.py
unimoljwtcrack.py
py
1,827
python
en
code
null
code-starcoder2
76
[ { "api_name": "jwt.get_unverified_header", "line_number": 7, "usage_type": "call" }, { "api_name": "tqdm.tqdm", "line_number": 9, "usage_type": "call" }, { "api_name": "jwt.decode", "line_number": 13, "usage_type": "call" }, { "api_name": "jwt.DecodeError", "l...
51764280
# coding: utf-8 from typing import List import numpy as np from nuwe_cimiss import apiinterface_pb2 as pb class RequestInfo(object): def __init__( self, error_code: int = 0, error_message: str = "", request_elements: str = "", request_params: str = "",...
null
nuwe_cimiss/data.py
data.py
py
13,334
python
en
code
null
code-starcoder2
76
[ { "api_name": "nuwe_cimiss.apiinterface_pb2.RequestInfo", "line_number": 21, "usage_type": "attribute" }, { "api_name": "nuwe_cimiss.apiinterface_pb2", "line_number": 21, "usage_type": "name" }, { "api_name": "nuwe_cimiss.apiinterface_pb2.RequestInfo", "line_number": 36, ...
48476212
import config import os, re TMP_FOLDER = config.TMP_FOLDER CAMERA_SEQ_PATH = config.CAMERA_SEQ_PATH SCREEN_SEQ_PATH = config.SCREEN_SEQ_PATH JM_PATH=config.JM_PATH PSNR_PATH=config.PSNR_PATH OUT_DATA_PATH = config.OUT_DATA_PATH def get_did_from_resolution(width, height): reso = width+height if reso >= (9...
null
__init__.py
__init__.py
py
1,375
python
en
code
null
code-starcoder2
76
[ { "api_name": "config.TMP_FOLDER", "line_number": 5, "usage_type": "attribute" }, { "api_name": "config.CAMERA_SEQ_PATH", "line_number": 6, "usage_type": "attribute" }, { "api_name": "config.SCREEN_SEQ_PATH", "line_number": 7, "usage_type": "attribute" }, { "api_n...
527773087
import datetime class nagiostime(datetime.time): def __new__(cls, *args, **kwargs): if len(args): args = args[1:] kwargs.pop('is_end', None) return super(nagiostime, cls).__new__(cls, *args, **kwargs) def __init__(self, is_end=False, *args, **kwargs): self.is_end = is_end super(nagiostime, self).__init...
null
bubble/types.py
types.py
py
446
python
en
code
null
code-starcoder2
76
[ { "api_name": "datetime.time", "line_number": 3, "usage_type": "attribute" } ]
138437671
from utils import config, parse_midas_data, sample_utils, diversity_utils, core_gene_utils, substitution_rates_utils, clade_utils import os.path, sys, gzip import numpy min_coverage = config.min_median_coverage alpha = 0.5 # Confidence interval range for rate estimates low_pi_threshold = 1e-03 low_divergence_threshold...
null
Metagenomics/HMP1-2/postprocess/calculate_snv_distances.py
calculate_snv_distances.py
py
5,509
python
en
code
null
code-starcoder2
76
[ { "api_name": "utils.config.min_median_coverage", "line_number": 5, "usage_type": "attribute" }, { "api_name": "utils.config", "line_number": 5, "usage_type": "name" }, { "api_name": "argparse.ArgumentParser", "line_number": 18, "usage_type": "call" }, { "api_name...
521112427
# -*- coding: utf-8 -*- import sys # sys.path.append('/usr/local/Cellar/opencv3/3.0.0/lib/python2.7/site-packages/') import cv2 import os from multiprocessing import Pool from tqdm import tqdm if len(sys.argv) < 5: print("Usage:\n\tpython %s <casc_path> <src_dir_path> <dist_dir_path> <trash_dir_path>" % sys.argv[0...
null
scrapy/retrieve_faces/images/face-detector.py
face-detector.py
py
2,293
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.argv", "line_number": 9, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 10, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 13, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number"...
228700709
#!/usr/bin/env python # -*- coding: utf-8 -*- import io try: from setuptools import setup except ImportError: from distutils.core import setup from logya import __version__ # Use io.open to be able to set encoding to utf-8. with io.open('README.rst', encoding='utf-8') as f: readme = f.read() with io.ope...
null
setup.py
setup.py
py
1,795
python
en
code
null
code-starcoder2
76
[ { "api_name": "io.open", "line_number": 13, "usage_type": "call" }, { "api_name": "io.open", "line_number": 16, "usage_type": "call" }, { "api_name": "distutils.core.setup", "line_number": 19, "usage_type": "call" }, { "api_name": "logya.__version__", "line_nu...
506990657
# Copyright 2016-present CERN – European Organization for Nuclear Research # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
null
qf_lib/tests/unit_tests/data_providers/portara/test_portara_data_provider_daily.py
test_portara_data_provider_daily.py
py
8,654
python
en
code
null
code-starcoder2
76
[ { "api_name": "unittest.TestCase", "line_number": 34, "usage_type": "name" }, { "api_name": "qf_lib.common.utils.dateutils.string_to_date.str_to_date", "line_number": 38, "usage_type": "call" }, { "api_name": "qf_lib.common.utils.dateutils.string_to_date.str_to_date", "line_n...
505529137
""" setup.py setuptools control """ import re from setuptools import setup version = re.search( '^__version__\s*=\s*"(.*)"', open('xssmap/XssMap.py').read(), re.M ).group(1) with open('README.md', 'rb') as f: long_descr = f.read().decode('utf-8') setup( name = 'xssmap', packages = [...
null
setup.py
setup.py
py
692
python
en
code
null
code-starcoder2
76
[ { "api_name": "re.search", "line_number": 11, "usage_type": "call" }, { "api_name": "re.M", "line_number": 14, "usage_type": "attribute" }, { "api_name": "setuptools.setup", "line_number": 20, "usage_type": "call" } ]
388966591
import numpy as np import cv2 from collections import deque from PIL import Image import tensorflow as tf from config import * import sys data_names = ["train", "test"] for dn in data_names: list_f = open('data_video/' + dn + '_list', 'rw+') temp = list_f.read() video_list = temp.split('\n') writer...
null
gen_data.py
gen_data.py
py
3,177
python
en
code
null
code-starcoder2
76
[ { "api_name": "tensorflow.python_io.TFRecordWriter", "line_number": 14, "usage_type": "call" }, { "api_name": "tensorflow.python_io", "line_number": 14, "usage_type": "attribute" }, { "api_name": "cv2.VideoCapture", "line_number": 19, "usage_type": "call" }, { "ap...
5624401
#!/usr/bin/env python3 ''' CLEAN AND WRAGLE DATA INTO JSON ''' import os import io import time import pandas as pd import numpy as np import simplejson # READ IN CONTRIBUTIONS CSV FILE AND CLEAN IT UP A BIT input_dir = '../csv' input_file_name = 'ocf_contributions.csv' output_dir = '../json' ocf_retrieval_time = ti...
null
data-wrangling/generate_json.py
generate_json.py
py
7,440
python
en
code
null
code-starcoder2
76
[ { "api_name": "time.ctime", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path.getctime", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path", "line_number": 19, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_num...
413173944
from django.conf.urls import include, url,patterns from django.contrib import admin from ShopGame import settings from rest_framework import routers from shopping import views router = routers.DefaultRouter() router.register(r'category', views.CategoryViewSet) router.register(r'item', views.ItemViewSet2) urlpatter...
null
ShopGame/ShopGame/urls.py
urls.py
py
729
python
en
code
null
code-starcoder2
76
[ { "api_name": "rest_framework.routers.DefaultRouter", "line_number": 7, "usage_type": "call" }, { "api_name": "rest_framework.routers", "line_number": 7, "usage_type": "name" }, { "api_name": "shopping.views.CategoryViewSet", "line_number": 9, "usage_type": "attribute" ...
534681680
import os.path import numpy as np import pyam import pytest import scmdata from climate_assessment.harmonization_and_infilling import harmonization_and_infilling pytestmark = pytest.mark.nightly def test_harmonize_and_infill_negative_co2_afolu_in_input(test_data_dir, tmpdir): # the trick is that there is a neg...
null
tests/nightly/test_harmonization_and_infilling_nightly.py
test_harmonization_and_infilling_nightly.py
py
1,956
python
en
code
null
code-starcoder2
76
[ { "api_name": "pytest.mark", "line_number": 10, "usage_type": "attribute" }, { "api_name": "scmdata.ScmRun", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 19, "usage_type": "call" }, { "api_name": "pyam.IamDataFrame", "...
476506318
import pytest from pytest_mock import mocker from docopt import docopt, DocoptExit from ns1cli.commands import record import nsone from nsone.records import Records try: # Python 2 from itertools import izip as zip except ImportError: pass try: # Python 3.3 + import unittest.mock as mock except ImportE...
null
tests/unit/test_record.py
test_record.py
py
2,959
python
en
code
null
code-starcoder2
76
[ { "api_name": "mock.MagicMock", "line_number": 29, "usage_type": "call" }, { "api_name": "nsone.records.Records", "line_number": 29, "usage_type": "name" }, { "api_name": "mock.MagicMock", "line_number": 36, "usage_type": "call" }, { "api_name": "pytest_mock.mocke...
481460110
import numpy as np from gym import spaces from gym import Env class PointEnv(Env): """ point mass on a 2-D plane goals are sampled randomly from a square """ def __init__(self, num_tasks=1): self._test_train_shift = False self._skew_to_train = True self.reset_task() ...
null
hw5/meta/point_mass.py
point_mass.py
py
4,491
python
en
code
null
code-starcoder2
76
[ { "api_name": "gym.Env", "line_number": 6, "usage_type": "name" }, { "api_name": "gym.spaces.Box", "line_number": 17, "usage_type": "call" }, { "api_name": "gym.spaces", "line_number": 17, "usage_type": "name" }, { "api_name": "numpy.inf", "line_number": 17, ...
10623310
# -*- coding: utf-8 -*- from flask import current_app, Markup, render_template, request, jsonify, make_response from werkzeug.exceptions import default_exceptions, HTTPException def error_handler(error): msg = "Request resulted in: {}".format(error) current_app.logger.warning(msg, exc_info=error) if isin...
null
app/errors.py
errors.py
py
1,034
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.current_app.logger.warning", "line_number": 8, "usage_type": "call" }, { "api_name": "flask.current_app.logger", "line_number": 8, "usage_type": "attribute" }, { "api_name": "flask.current_app", "line_number": 8, "usage_type": "name" }, { "api...
461515588
# (c) 2014-2016, Ben Osman (@benosman) # # This file is part of Able # # Able is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Able ...
null
able/cli/command.py
command.py
py
3,095
python
en
code
null
code-starcoder2
76
[ { "api_name": "able.cli.base_command.CLIBaseCommand", "line_number": 33, "usage_type": "name" }, { "api_name": "able.cli.base_command.CLIBaseCommand.__init__", "line_number": 35, "usage_type": "call" }, { "api_name": "able.cli.base_command.CLIBaseCommand", "line_number": 35, ...
482607386
# Utilities import argparse import random import time import os from timeit import default_timer as timer # Libraries import numpy as np # Torch import torch from torch.utils import data import torch.optim as optim # Customized Imports from nnet.logger import setup_logs from nnet.dataset import VectorDataset from nn...
null
model_ivector_gmm/ivector/src/main_NN.py
main_NN.py
py
6,983
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 33, "usage_type": "call" }, { "api_name": "torch.cuda.empty_cache", "line_number": 62, "usage_type": "call" }, { "api_name": "torch.cuda", "line_number": 62, "usage_type": "attribute" }, { "api_name": "nnet.M...
632196315
import os from keras.models import model_from_json import src.config as config class ClassifierANN(): def __init__(self, classifier=None): if classifier: self.classifier = classifier else: self.load_model() self.load_weights() def save_model(self...
null
app/src/classifierann.py
classifierann.py
py
1,903
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.dirname", "line_number": 21, "usage_type": "call" }, { "api_name": "os.path", "line_number": 21, "usage_type": "attribute" }, { "api_name": "os.path.realpath", "line_number": 21, "usage_type": "call" }, { "api_name": "src.config.get_value", ...
504815939
from collections import OrderedDict from functools import wraps, update_wrapper import time import os ############################### # useful decorators ############################### __memoization_registry = [] _CALL_FUNC_COUNTERS = {} # a decorator for memoizing function outputs def memoize_i...
null
solutions_5648941810974720_0/Python/bigOnion/phone.py
phone.py
py
9,410
python
en
code
null
code-starcoder2
76
[ { "api_name": "functools.wraps", "line_number": 20, "usage_type": "call" }, { "api_name": "time.ctime", "line_number": 42, "usage_type": "call" }, { "api_name": "time.time", "line_number": 43, "usage_type": "call" }, { "api_name": "time.time", "line_number": 4...
444051450
#TODO: issues when selecting only 1 roi, dimensional related to extraction from movie import numpy as np import cv2 import pylab as pl import warnings import matplotlib.lines as mlines CV_VERSION = int(cv2.__version__[0]) def select_roi(img=None, n=0, ax=None, existing=None, mode='polygon', show_mode='mask', cmap=pl....
null
pyfluo/roi.py
roi.py
py
12,352
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.__version__", "line_number": 8, "usage_type": "attribute" }, { "api_name": "pylab.cm", "line_number": 10, "usage_type": "attribute" }, { "api_name": "pylab.figure", "line_number": 44, "usage_type": "call" }, { "api_name": "pylab.gca", "line_...
606685830
# -*- coding: utf-8 -*- import csv import os os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__)) import pywikibot os.environ['TZ'] = 'UTC' site = pywikibot.Site() site.login() with open('list.csv', 'r') as f: r = csv.reader(f) for row in r: title = row[0] edit = row[1]...
null
mass-protect/protect.py
protect.py
py
807
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.environ", "line_number": 5, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 5, "usage_type": "call" }, { "api_name": "os.path", "line_number": 5, "usage_type": "attribute" }, { "api_name": "os.path.realpath", "lin...
357699289
import itertools import logging import sys import time import warnings from typing import ( TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, List, Optional, Union, ) import numpy as np import ray from ray.air.util.data_batch_conversion import BlockFormat from ray.data._inter...
null
python/ray/data/dataset_pipeline.py
dataset_pipeline.py
py
54,515
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.version_info", "line_number": 50, "usage_type": "attribute" }, { "api_name": "typing.TYPE_CHECKING", "line_number": 55, "usage_type": "name" }, { "api_name": "logging.getLogger", "line_number": 64, "usage_type": "call" }, { "api_name": "typing.I...
586239285
from flask_wtf import FlaskForm from wtforms import TextAreaField, StringField, SubmitField from wtforms.validators import DataRequired, Length, ValidationError from app.models import User class EditProfileForm(FlaskForm): username = StringField('Username', validators=[DataRequired()]) about_me = TextAreaFi...
null
app/main/forms.py
forms.py
py
1,172
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask_wtf.FlaskForm", "line_number": 8, "usage_type": "name" }, { "api_name": "wtforms.StringField", "line_number": 9, "usage_type": "call" }, { "api_name": "wtforms.validators.DataRequired", "line_number": 9, "usage_type": "call" }, { "api_name": "...
39162119
__author__ = 'jim' from scrapy.http import Request from alascrapy.items import ProductItem, ReviewItem from alascrapy.spiders.base_spiders.ala_spider import AlaSpider from alascrapy.lib.generic import get_full_url, date_format class GsminfoNlSpider(AlaSpider): name = 'gsminfo_nl' allowed_domains = ['gsminfo...
null
alascrapy/spiders/gsminfo_nl.py
gsminfo_nl.py
py
4,344
python
en
code
null
code-starcoder2
76
[ { "api_name": "alascrapy.spiders.base_spiders.ala_spider.AlaSpider", "line_number": 10, "usage_type": "name" }, { "api_name": "scrapy.http.Request", "line_number": 18, "usage_type": "call" }, { "api_name": "alascrapy.lib.generic.get_full_url", "line_number": 18, "usage_ty...
79011370
from app.core.exceptions import * from typing import Any from app.core.config import settings from aiogoogle import Aiogoogle from .utills import build_service, build_user_creds, build_client_creds from app.core.schemas.google.gmail_api import * from app.core.schemas.topics.watch import WatchModel class GmailApiProvid...
null
app/providers/google/gmail_api.py
gmail_api.py
py
5,402
python
en
code
null
code-starcoder2
76
[ { "api_name": "app.core.config.settings.GOOGLE_CLIENT_SETTINGS", "line_number": 19, "usage_type": "attribute" }, { "api_name": "app.core.config.settings", "line_number": 19, "usage_type": "name" }, { "api_name": "app.core.config.settings", "line_number": 23, "usage_type":...
509345918
import torch import torch.nn as nn import torch.functional as F from Config import * # Define model class SiamNet(nn.Module): def __init__(self): super(SiamNet,self).__init__() # architecture (AlexNet) self.embedding_function = nn.Sequential( nn.Conv2d(3,96,11,2), # conv1 ...
null
SiamFC.py
SiamFC.py
py
3,183
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn.Module", "line_number": 7, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 7, "usage_type": "name" }, { "api_name": "torch.nn.Sequential", "line_number": 12, "usage_type": "call" }, { "api_name": "torch.nn", "line_...
542378588
import pandas as pd import numpy as np import logging from uszipcode import ZipcodeSearchEngine def zip_state(df, zip_col, state_col): ''' :type df: pd.DataFrame :param df: :param zip_col: :param state_col: :return: ''' search = ZipcodeSearchEngine() f = lambda x: str(search.by_...
null
recoding/src/main/recoding.py
recoding.py
py
10,586
python
en
code
null
code-starcoder2
76
[ { "api_name": "uszipcode.ZipcodeSearchEngine", "line_number": 17, "usage_type": "call" }, { "api_name": "logging.getLogger", "line_number": 35, "usage_type": "call" }, { "api_name": "numpy.nan", "line_number": 254, "usage_type": "attribute" } ]
122028438
import json import jsonlines import pandas import random import re import argparse import numpy as np import tensorflow as tf def getparams(): parser = argparse.ArgumentParser( description="BiLSTM-CRF for Chinese NER task") parser.add_argument( "--Word2idPath", type=str, defaul...
null
utils.py
utils.py
py
11,339
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 12, "usage_type": "call" }, { "api_name": "jsonlines.open", "line_number": 158, "usage_type": "call" }, { "api_name": "json.load", "line_number": 163, "usage_type": "call" }, { "api_name": "json.load", "l...
470619119
import asyncio from argparse import ArgumentParser from aiofile import AIOFile import os from datetime import datetime async def parseArguments(): analizador = ArgumentParser(description='Entrada al Servidor') analizador.add_argument("-p","--port",type=int,default=5000,help = "Puerto donde se espera la c...
null
alumnos/59103-alejandro-marotta/tp4/tp4.py
tp4.py
py
3,174
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 9, "usage_type": "call" }, { "api_name": "asyncio.create_task", "line_number": 35, "usage_type": "call" }, { "api_name": "asyncio.create_task", "line_number": 36, "usage_type": "call" }, { "api_name": "os.pat...
392536188
# encoding: utf-8 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "Licens...
null
odps/pai/metrics/nodes/classification.py
classification.py
py
4,363
python
en
code
null
code-starcoder2
76
[ { "api_name": "metrics_base.MetricNode", "line_number": 29, "usage_type": "name" }, { "api_name": "time.time", "line_number": 34, "usage_type": "call" }, { "api_name": "core.dag.DagEndpointType.DATA", "line_number": 42, "usage_type": "attribute" }, { "api_name": "...
483020909
''' Utility function for running the LoadData class ''' ################################# # Configuration ################################# import sys import os import logging import argparse PYTHON_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) s...
null
python/scripts/load_data.py
load_data.py
py
3,235
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.abspath", "line_number": 13, "usage_type": "call" }, { "api_name": "os.path", "line_number": 13, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 13, "usage_type": "call" }, { "api_name": "os.path.dirname", "line...
92919573
#!/usr/bin/env python # pre-commit git hook that runs python and R linters, validates JSON files, # removes trailing whitespace from lines, and checks for encryption # secrets, aws keys, and large files which shouldn't be added to git. # Currently it does not prevent the commit from occuring, it simply warns # of poss...
null
githooks/pre-commit.py
pre-commit.py
py
4,415
python
en
code
null
code-starcoder2
76
[ { "api_name": "subprocess.check_output", "line_number": 21, "usage_type": "call" }, { "api_name": "subprocess.CalledProcessError", "line_number": 22, "usage_type": "attribute" }, { "api_name": "json.load", "line_number": 56, "usage_type": "call" }, { "api_name": "...
479936242
#-*- coding: utf-8 -*- import sys, os, re from tempfile import NamedTemporaryFile from importlib import import_module import requests from flask import Flask, request, json, Response, make_response, render_template, redirect from flask_cors import CORS from wikispeech_server.voice_config import textprocessor_configs,...
null
wikispeech_server/wikispeech.py
wikispeech.py
py
30,058
python
en
code
null
code-starcoder2
76
[ { "api_name": "wikispeech_server.log.debug", "line_number": 26, "usage_type": "call" }, { "api_name": "wikispeech_server.log", "line_number": 26, "usage_type": "name" }, { "api_name": "os.system", "line_number": 27, "usage_type": "call" }, { "api_name": "os.system...
28060733
from datetime import date from tkinter import messagebox from tkinter import * import os import mysql.connector # Designing window for cancellation mydb = mysql.connector.connect(user='root', password='password', host='localhost', database='OSHES') mycursor...
null
src/CustomerAndAdminFunctions/cancel.py
cancel.py
py
2,113
python
en
code
null
code-starcoder2
76
[ { "api_name": "mysql.connector.connector.connect", "line_number": 8, "usage_type": "call" }, { "api_name": "mysql.connector.connector", "line_number": 8, "usage_type": "attribute" }, { "api_name": "mysql.connector", "line_number": 8, "usage_type": "name" }, { "api...
373828001
import MFRC522 import signal import requests import json import time import datetime continue_reading = True MIFAREReader = MFRC522.MFRC522() def end_read(signal, frame): global continue_reading continue_reading = False print('Ctrl+C captured, ending read.') MIFAREReader.GPIO_CLEEN() def post_tag_d...
null
rfid_python_lib/bck_user_reader.py
bck_user_reader.py
py
1,338
python
en
code
null
code-starcoder2
76
[ { "api_name": "MFRC522.MFRC522", "line_number": 9, "usage_type": "call" }, { "api_name": "requests.post", "line_number": 21, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 21, "usage_type": "call" }, { "api_name": "requests.codes", "line_nu...
653797772
from bs4 import BeautifulSoup html = ''' <dl> <dt>국적</dt> <dd>대한민국</dd> <dt>활동장르</dt> <dd>Dance, Ballad, Drama</dd> <dt>데뷔</dt> <dd class="debut_song"> <span class="ellipsis"> 2016.05.05 <span class="bar"> ...
null
parsing_test.py
parsing_test.py
py
1,364
python
en
code
null
code-starcoder2
76
[ { "api_name": "bs4.BeautifulSoup", "line_number": 34, "usage_type": "call" } ]
283368246
from options.test_options import TestOptions from models.models import create_model import imageio from tqdm import tqdm from skimage.transform import resize import torch import numpy as np from skimage import img_as_ubyte import matplotlib matplotlib.use("TkAgg") import matplotlib.pyplot as plt def show(img): ...
null
apply_to_video.py
apply_to_video.py
py
2,822
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.use", "line_number": 12, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure", "line_number": 18, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 18, "usage_type": "name" }, { "api_name": "matplotlib....
408464207
import os from flask import Flask, render_template, request app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/', methods=['POST']) def result(): number = int(request.form['task']) if request.method == 'POST': open("tasks.txt", "w").close() ...
null
STR_Project/app.py
app.py
py
1,314
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 5, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 10, "usage_type": "call" }, { "api_name": "flask.request.form", "line_number": 15, "usage_type": "attribute" }, { "api_name": "flask.reques...
592217467
import torchvision import torchvision.transforms as transforms def imagenet_loader(split, args=None, cfg=None): normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) if split == 'val': val_transform = transforms.Compose([ transforms.Resize(256), ...
null
imagenet/datasets/classification.py
classification.py
py
2,336
python
en
code
null
code-starcoder2
76
[ { "api_name": "torchvision.transforms.Normalize", "line_number": 6, "usage_type": "call" }, { "api_name": "torchvision.transforms", "line_number": 6, "usage_type": "name" }, { "api_name": "torchvision.transforms.Compose", "line_number": 8, "usage_type": "call" }, { ...
218887269
# Importing celery from celery.task.schedules import crontab from celery.decorators import periodic_task from celery import shared_task # Importing profile and jobpost manager for management assignment from users.models import Profile from service.models import JobPost # Importing email from django.core.mail import E...
null
management/tasks.py
tasks.py
py
1,546
python
en
code
null
code-starcoder2
76
[ { "api_name": "service.models.JobPost.objects.get", "line_number": 26, "usage_type": "call" }, { "api_name": "service.models.JobPost.objects", "line_number": 26, "usage_type": "attribute" }, { "api_name": "service.models.JobPost", "line_number": 26, "usage_type": "name" ...
302369589
from os.path import join import json import os import random import argparse from collections import Counter import pickle as pkl import re def _count_data(path): """ count number of data in the given path""" matcher = re.compile(r'[0-9]+\.json') match = lambda name: bool(matcher.match(name)) names = ...
null
build_weighted_vocab.py
build_weighted_vocab.py
py
1,995
python
en
code
null
code-starcoder2
76
[ { "api_name": "re.compile", "line_number": 13, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 21, "usage_type": "call" }, { "api_name": "collections.Counter", "line_nu...
133377610
#-*- coding: utf-8 -*- import random from unidecode import unidecode import time def assess(rr, w): tot = rr + w acc = rr/tot print('Summary:\t') if w == 0: print('Wonderful! You answered all {} questions correctly! Let us drink to that!\n....Cheers! (party) (party)'.format(rr)) ...
null
azbuka.py
azbuka.py
py
4,040
python
en
code
null
code-starcoder2
76
[ { "api_name": "random.choice", "line_number": 77, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 94, "usage_type": "call" }, { "api_name": "unidecode.unidecode", "line_number": 97, "usage_type": "call" }, { "api_name": "unidecode.unidecode", ...
27728230
"""Utilities for LH5 file inventory.""" from __future__ import annotations import json import logging import os import re import string import warnings import h5py import lgdo import numpy as np import pandas as pd from lgdo import Array, Scalar, VectorOfVectors from lgdo import lh5_store as lh5 from parse import par...
null
src/pygama/flow/file_db.py
file_db.py
py
27,393
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 21, "usage_type": "call" }, { "api_name": "json.load", "line_number": 129, "usage_type": "call" }, { "api_name": "json.JSONDecodeError", "line_number": 131, "usage_type": "attribute" }, { "api_name": "string.Format...
556748358
# Copyright 2021 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 import argparse import os from githubDataExtraction import GithubDataExtractor def getRepos(access_token, organization, reaction): """ Method to extract data for all repositories in organization """ extractor = GithubDataExtractor(a...
null
ml-conversational-analytic-tool/runDataExtraction.py
runDataExtraction.py
py
1,609
python
en
code
null
code-starcoder2
76
[ { "api_name": "githubDataExtraction.GithubDataExtractor", "line_number": 14, "usage_type": "call" }, { "api_name": "githubDataExtraction.GithubDataExtractor", "line_number": 26, "usage_type": "call" }, { "api_name": "argparse.ArgumentParser", "line_number": 32, "usage_typ...
81674030
import argparse import os from collections import namedtuple from split import split_list Tweet = namedtuple('Tweet', ['string', 'label', 'index']) def read_riloff_dataset(path): tweets_file_path = os.path.join(path, 'riloff.tweets.tsv') labels_file_path = os.path.join(path, 'riloff.txt') tweets = [] ...
null
prepare/prepare_riloff.py
prepare_riloff.py
py
3,200
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.namedtuple", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 11, "usage_type": "call" }, { "api_name": "os.path", "line_number": 11, "usage_type": "attribute" }, { "api_name": "os.path.join", "l...
159213331
from django import forms from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django.urls import reverse from django.utils.html import format_html from instruments.models import MethodPage from userdata.models import StaffUser from userinput.models import RUBIONUser, W...
null
userinput/rai/forms.py
forms.py
py
12,090
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.forms.Form", "line_number": 19, "usage_type": "attribute" }, { "api_name": "django.forms", "line_number": 19, "usage_type": "name" }, { "api_name": "django.forms.ChoiceField", "line_number": 20, "usage_type": "call" }, { "api_name": "django.f...
176592390
from VirtualCopernicusNG import TkCircuit import rooms.lighting as lighting room_id = "client5" configuration = { "name": "lobby", "sheet": "sheet_smarthouse.png", "width": 332, "height": 300, "leds": [ {"x": 112, "y": 70, "name": "LED 1", "pin": 21}, {"x": 71, "y": 141, "name": "L...
null
lab3/rooms/lobby.py
lobby.py
py
2,376
python
en
code
null
code-starcoder2
76
[ { "api_name": "VirtualCopernicusNG.TkCircuit", "line_number": 24, "usage_type": "call" }, { "api_name": "gpiozero.LED", "line_number": 33, "usage_type": "call" }, { "api_name": "gpiozero.LED", "line_number": 34, "usage_type": "call" }, { "api_name": "rooms.lightin...
403511891
#!/usr/bin/python import re, sys from argparse import ArgumentParser def read_lines(): try: while True: yield raw_input() except EOFError: pass def iter_file(filename=None): def file_iterator(): with open(filename, 'r') as f: for line in f: yield line.rstrip('\n') return file_iterator() if fi...
null
web-extension/update_manifest.py
update_manifest.py
py
1,587
python
en
code
null
code-starcoder2
76
[ { "api_name": "re.compile", "line_number": 25, "usage_type": "call" }, { "api_name": "re.I", "line_number": 25, "usage_type": "attribute" }, { "api_name": "argparse.ArgumentParser", "line_number": 55, "usage_type": "call" }, { "api_name": "sys.stdout.write", "...
321090566
import xml.etree.ElementTree as ET import json import html import uuid from functools import reduce import os import sqlite3 allSkills = [] allCompetences = [] def skillRLPschema (tree): #skills with tags correctNode = tree.findall('./{http://bsbb.eu}c2/') skillUUID = "" skillAltName = "" comp1 = ...
null
xmlToJson.py
xmlToJson.py
py
6,525
python
en
code
null
code-starcoder2
76
[ { "api_name": "html.escape", "line_number": 52, "usage_type": "call" }, { "api_name": "uuid.uuid4", "line_number": 54, "usage_type": "call" }, { "api_name": "uuid.uuid4", "line_number": 57, "usage_type": "call" }, { "api_name": "html.escape", "line_number": 58...
498258807
""" The heartbeat checker implements heartbeat check behavior and is non-client facing. """ import logging import threading import time from rabbitpy import exceptions LOGGER = logging.getLogger(__name__) class Checker(object): MAX_MISSED_HEARTBEATS = 2 def __init__(self, io, exception_queue): se...
null
rabbitpy/heartbeat.py
heartbeat.py
py
2,353
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 12, "usage_type": "call" }, { "api_name": "threading.Lock", "line_number": 25, "usage_type": "call" }, { "api_name": "time.time", "line_number": 31, "usage_type": "call" }, { "api_name": "time.time", "line_numb...
101673688
from scenario import Scenario from filter import * import time from cyber_py import cyber from modules.drivers.proto.sensor_image_pb2 import Image from modules.drivers.proto.pointcloud_pb2 import PointCloud, PointXYZIT from modules.perception.proto.perception_obstacle_pb2 import PerceptionObstacles, PerceptionObstacle,...
null
modules/scenario/fault_injection/simulation.py
simulation.py
py
7,030
python
en
code
null
code-starcoder2
76
[ { "api_name": "modules.perception.proto.perception_obstacle_pb2.PerceptionObstacles", "line_number": 23, "usage_type": "argument" }, { "api_name": "modules.drivers.proto.sensor_image_pb2.Image", "line_number": 24, "usage_type": "argument" }, { "api_name": "modules.drivers.proto.s...
49398945
import numpy as np import tensorflow as tf import os from keras.datasets.cifar10 import load_data from ares import Boundary from ares.model.loader import load_model_from_path logger = tf.get_logger() logger.setLevel(tf.logging.INFO) batch_size = 200 session = tf.Session() model_path = os.path.join(os.path.dirname...
null
test/test_boundary.py
test_boundary.py
py
2,287
python
en
code
null
code-starcoder2
76
[ { "api_name": "tensorflow.get_logger", "line_number": 10, "usage_type": "call" }, { "api_name": "tensorflow.logging", "line_number": 11, "usage_type": "attribute" }, { "api_name": "tensorflow.Session", "line_number": 15, "usage_type": "call" }, { "api_name": "os.p...
496336210
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time :2019/8/22 20:27 # @Author :ytq import time import pytest from src.appium_study.po_study.common.appium_driver import AppiumDriver @pytest.fixture def init_appium_driver(): comm = AppiumDriver() driver = comm.driver yield driver time.sleep(2) ...
null
src/appium_study/po_study/conftest.py
conftest.py
py
342
python
en
code
null
code-starcoder2
76
[ { "api_name": "src.appium_study.po_study.common.appium_driver.AppiumDriver", "line_number": 14, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 17, "usage_type": "call" }, { "api_name": "pytest.fixture", "line_number": 12, "usage_type": "attribute" } ...
597306239
import logging from .lbfgs import LBFGS from .lincg import LinearCG from .slq_logdet import SLQLogDet __all__ = [ LBFGS, LinearCG, SLQLogDet, ] class pd_catcher(object): ''' A decorator to deal with non-positive definite matrices (useful during optimization) If an error due to non-psotiive de...
null
gpytorch/utils/__init__.py
__init__.py
py
1,466
python
en
code
null
code-starcoder2
76
[ { "api_name": "lbfgs.LBFGS", "line_number": 7, "usage_type": "name" }, { "api_name": "lincg.LinearCG", "line_number": 8, "usage_type": "name" }, { "api_name": "slq_logdet.SLQLogDet", "line_number": 9, "usage_type": "name" }, { "api_name": "logging.warning", "l...
365345713
#-*- coding: utf-8 -*- from django.shortcuts import render, redirect from photos.models import Photo from django.http import HttpResponseNotFound from django.contrib.auth import authenticate, login, logout from photos.forms import LoginForm, PhotoForm from django.contrib.auth.decorators import login_required from djang...
null
photos/views.py
views.py
py
4,899
python
en
code
null
code-starcoder2
76
[ { "api_name": "photos.models", "line_number": 17, "usage_type": "name" }, { "api_name": "photos.models.Photo.objects.filter", "line_number": 17, "usage_type": "call" }, { "api_name": "photos.models.Photo.objects", "line_number": 17, "usage_type": "attribute" }, { ...
114139383
import csv import urllib.request import urllib import json from PIL import Image, ImageFile def main(): input = "(path to csv data)" output = "(path to new csv data)" hd_folder = "(path to directory)" crop_folder = "(path to directory)" final_arr = [] with open(input, 'r') as csvfile: ...
null
python/image_annotation_resize(bb).py
image_annotation_resize(bb).py
py
6,037
python
en
code
null
code-starcoder2
76
[ { "api_name": "csv.reader", "line_number": 16, "usage_type": "call" }, { "api_name": "PIL.Image.open", "line_number": 24, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 24, "usage_type": "name" }, { "api_name": "json.loads", "line_number": 3...
566451468
# -*- coding: utf-8 -*- """ @File : cnn.py @Time : 2020/4/18 下午5:54 @Author : yizuotian @Description : 卷积网络 """ import argparse import os import time from six.moves import cPickle from losses import cross_entropy_loss from optimizers import * from utils import to_categorical, save_weights, load_weights ...
null
nn/cnn.py
cnn.py
py
4,820
python
en
code
null
code-starcoder2
76
[ { "api_name": "six.moves.cPickle.load", "line_number": 32, "usage_type": "call" }, { "api_name": "six.moves.cPickle", "line_number": 32, "usage_type": "name" }, { "api_name": "os.path.join", "line_number": 58, "usage_type": "call" }, { "api_name": "os.path", "...
504646206
import numpy as np import tensorflow as tf # 读取mnist文件,并存为ndarray类型的images和labels # images为60000×784(60000个样本,每个样本784个特征(28×28)) # labels为大小是60000一维向量 def load_mnist(path, kind='train'): import os import struct labels_path = os.path.join(path, '%s-labels.idx1-ubyte' % kind) images_path = os.path.join...
null
dnn_mnist.py
dnn_mnist.py
py
3,923
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 12, "usage_type": "call" }, { "api_name": "os.path", "line_number": 12, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 13, "usage_type": "call" }, { "api_name": "os.path", "line_number": 1...
411538322
"""Create datapoints table Revision ID: 6d2eacd5da3f Revises: N/A Create Date: 2019-09-29 13:43:21.242706 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "6d2eacd5da3f" down_revision = None branch_labels = None depends_...
null
src/apd/aggregation/alembic/versions/6d2eacd5da3f_create_sensor_values_table.py
6d2eacd5da3f_create_sensor_values_table.py
py
760
python
en
code
null
code-starcoder2
76
[ { "api_name": "alembic.op.create_table", "line_number": 20, "usage_type": "call" }, { "api_name": "alembic.op", "line_number": 20, "usage_type": "name" }, { "api_name": "sqlalchemy.Column", "line_number": 22, "usage_type": "call" }, { "api_name": "sqlalchemy.Integ...
232156387
# n 皇后问题 研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。 # # 给你一个整数 n ,返回所有不同的 n 皇后问题 的解决方案。 # # # # 每一种解法包含一个不同的 n 皇后问题 的棋子放置方案,该方案中 'Q' 和 '.' 分别代表了皇后和空位。 # # # # 示例 1: # # # 输入:n = 4 # 输出:[[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]] # 解释:如上图所示,4 皇后问题存在两个不同的解法。 # # # 示例 2: # # # 输入...
null
[51]N皇后.py
[51]N皇后.py
py
2,221
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.List", "line_number": 45, "usage_type": "name" } ]
428384176
from flask import Flask, jsonify, request from flask_jwt_extended import JWTManager, jwt_required, \ create_access_token, jwt_refresh_token_required, \ create_refresh_token, get_jwt_identity, set_access_cookies, \ set_refresh_cookies, unset_jwt_cookies # NOTE: This is just a basic example of how to enabl...
null
examples/jwt_in_cookie.py
jwt_in_cookie.py
py
3,356
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 13, "usage_type": "call" }, { "api_name": "flask_jwt_extended.JWTManager", "line_number": 29, "usage_type": "call" }, { "api_name": "flask.request.json.get", "line_number": 37, "usage_type": "call" }, { "api_name": "flas...
578405660
from django.db import models from .fields import HashField from .utils import hashit class HashManager(models.Manager): hash_field_name = 'hash_key' def hash_keys(self, **kwargs): qs = super(HashManager, self).get_query_set() return list(qs.filter(**kwargs).values_list(self.get_hash_field_nam...
null
hashfield/manager.py
manager.py
py
1,875
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.db.models.Manager", "line_number": 6, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 6, "usage_type": "name" }, { "api_name": "fields.HashField", "line_number": 16, "usage_type": "argument" }, { "api_name": "fie...
83758396
import os import requests from semantic_version import Version TARGET_NAME = os.environ["TARGET_NAME"] TARGET_STAGE = os.environ["TARGET_STAGE"] TARGET_VERSION = os.environ["TARGET_VERSION"] # Convert PEP 440 to Semantic Versioning 2.0.0 def convert_to_semantic_version(release_key): return Version.coerce(releas...
null
scripts/resolve_target_version.py
resolve_target_version.py
py
1,685
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.environ", "line_number": 6, "usage_type": "attribute" }, { "api_name": "os.environ", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.environ", "line_number": 8, "usage_type": "attribute" }, { "api_name": "semantic_version.Version...
980010
import cv2 import mediapipe as mp import time import streamlit as st import base64 def app(): main_bg = 'bck3.png' st.markdown( f""" <style> .reportview-container {{ background: url(data:image/png;base64,{base64.b64encode(open(main_bg, "rb").read()).decode()}) }} ...
null
live_face_recog.py
live_face_recog.py
py
2,147
python
en
code
null
code-starcoder2
76
[ { "api_name": "streamlit.markdown", "line_number": 10, "usage_type": "call" }, { "api_name": "base64.b64encode", "line_number": 14, "usage_type": "call" }, { "api_name": "streamlit.title", "line_number": 22, "usage_type": "call" }, { "api_name": "streamlit.checkbo...
75994263
#! /usr/bin/env python # _*_ coding: UTF-8 _*_ import time, sys import pymeasure class ml2437a(object): ''' DESCRIPTION ================ This class cntrols the ML2437A. ARGUMENTS ================ 1. dev: device number Type: int Default: 1 ''' de...
null
NASCORX_System/device/ML2437A.py
ML2437A.py
py
4,353
python
en
code
null
code-starcoder2
76
[ { "api_name": "pymeasure.gpib_prologix", "line_number": 47, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 52, "usage_type": "call" }, { "api_name": "pymeasure.gpib_prologix", "line_number": 80, "usage_type": "call" }, { "api_name": "pymeasure....
149677719
import pytest import pexpect def test_trasaction_rprompt(cli): cli.sendline("multi") cli.expect(["OK", "transaction", "127.0.0.1"]) cli.sendline("get foo") cli.expect(["QUEUED", "127.0.0.1"]) cli.sendline("EXEC") def test_trasaction_syntax_error(cli): cli.sendline("multi") cli.sendline...
null
tests/cli_tests/test_transaction.py
test_transaction.py
py
593
python
en
code
null
code-starcoder2
76
[ { "api_name": "pytest.raises", "line_number": 22, "usage_type": "call" }, { "api_name": "pexpect.exceptions", "line_number": 22, "usage_type": "attribute" } ]
500365518
import sys sys.path.append('utils') import os import argparse import json from tensorboardX import SummaryWriter from dataset.spot import DailyDataset_nn, get_loader, TOTAL_STD, TOTAL_MEAN, SPOT from tool import to_gpu import torch import torch.nn as nn import torch.optim as optim from tqdm import trange, tqdm import n...
null
EPEX/bootstrap.py
bootstrap.py
py
4,076
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.path.append", "line_number": 2, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 2, "usage_type": "attribute" }, { "api_name": "argparse.ArgumentParser", "line_number": 19, "usage_type": "call" }, { "api_name": "tensorboardX.Summ...
7090782
#coding:utf-8 """ @info: 代码放入同文件,窗体展示测试 @author:NetFj @software:PyCharm @file:qt07_main.py @time:2018/11/5.14:12 """ from PyQt5 import QtWidgets,QtCore import sys class MyWindow(QtWidgets.QWidget): def __init__(self): pass def setupUi(self, Form): Form.setObjectName("Form") Form.resiz...
null
qt/qt01/qt07_main.py
qt07_main.py
py
1,030
python
en
code
null
code-starcoder2
76
[ { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 10, "usage_type": "attribute" }, { "api_name": "PyQt5.QtWidgets", "line_number": 10, "usage_type": "name" }, { "api_name": "PyQt5.QtWidgets.QPushButton", "line_number": 17, "usage_type": "call" }, { "api_name...
597102431
import numpy as np import pandas as pd import unittest from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By import time from bs4 import BeautifulSoup from selenium.webdriver.support.ui import Select # url de la pagina url_1 = 'https://www.chip.gov.c...
null
1_download/scr/1_web_scraping_data.py
1_web_scraping_data.py
py
3,147
python
en
code
null
code-starcoder2
76
[ { "api_name": "selenium.webdriver.Chrome", "line_number": 13, "usage_type": "call" }, { "api_name": "selenium.webdriver", "line_number": 13, "usage_type": "name" }, { "api_name": "pandas.read_stata", "line_number": 17, "usage_type": "call" }, { "api_name": "numpy....
609734371
from django.contrib.auth import get_user_model from django.core.exceptions import ObjectDoesNotExist from django.http import QueryDict import json from rest_framework_jwt.utils import jwt_decode_handler def get_request_body_dict(request): try: if isinstance(request.data, str): json_data = jso...
null
newbee/newbee_util/request.py
request.py
py
1,758
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.loads", "line_number": 12, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 17, "usage_type": "call" }, { "api_name": "django.http.QueryDict", "line_number": 19, "usage_type": "call" }, { "api_name": "rest_framework_jwt.utils....
229977855
from clay.core import * from .data_descriptors import * from clay.shared.py_utils import * from collections import OrderedDict, namedtuple from copy import copy class Component(ParentRel): # source_map is a dict from rel ID in source rtree -> Relation in this rtree # source_filename is the filename of the sour...
null
clay/std_lib/components.py
components.py
py
10,840
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.OrderedDict", "line_number": 17, "usage_type": "call" }, { "api_name": "copy.copy", "line_number": 75, "usage_type": "call" }, { "api_name": "collections.OrderedDict", "line_number": 76, "usage_type": "call" } ]
317880903
""" Class to define GAN discriminator """ import torch from torchvision import models import torch.nn as nn import numpy class Encoder(nn.Module): def __init__(self, cnn_model, input_dim, hidden_dim, lstm_layers, embedding_dim, sequence_len): super(Encoder, self).__init__() # Convolutions (pre-tr...
null
generative_models/encoder_single.py
encoder_single.py
py
1,801
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn.Module", "line_number": 10, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 10, "usage_type": "name" }, { "api_name": "torchvision.models.vgg16", "line_number": 18, "usage_type": "call" }, { "api_name": "torchvision.mo...
24687284
import torch def predict(batch_paras, word_attn_model, sent_attn_model): word_attn_model.eval() sent_attn_model.eval() max_para_len, batch_size, max_sent_len = batch_paras.size() word_init_state = word_attn_model.init_hidden(batch_size=batch_size) sent_init_state = sent_attn_model.init_hidden(batc...
null
validate.py
validate.py
py
1,407
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.cat", "line_number": 21, "usage_type": "call" }, { "api_name": "torch.argmax", "line_number": 25, "usage_type": "call" }, { "api_name": "torch.sum", "line_number": 37, "usage_type": "call" } ]
53684818
import json import os import sys from datetime import datetime, time, timedelta import spotipy from spotipy.oauth2 import SpotifyClientCredentials from default_config import (_CLIENT_ID, _CLIENT_SECRET, _DATE_FORMAT, _INDICATOR_PLAYLIST, _PROMOTOR_PLAYLISTS, _TRACK) class Track: de...
null
main.py
main.py
py
4,396
python
en
code
null
code-starcoder2
76
[ { "api_name": "default_config._DATE_FORMAT", "line_number": 29, "usage_type": "argument" }, { "api_name": "default_config._DATE_FORMAT", "line_number": 47, "usage_type": "argument" }, { "api_name": "spotipy.Spotify", "line_number": 67, "usage_type": "call" }, { "a...
90162303
import sys import pygame #监视屏幕和鼠标事件 def check_events(ship): for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_RIGHT: ship.moving_right=True elif event.key == pygam...
null
game_functions.py
game_functions.py
py
882
python
en
code
null
code-starcoder2
76
[ { "api_name": "pygame.event.get", "line_number": 6, "usage_type": "call" }, { "api_name": "pygame.event", "line_number": 6, "usage_type": "attribute" }, { "api_name": "pygame.QUIT", "line_number": 7, "usage_type": "attribute" }, { "api_name": "sys.exit", "line...
81826488
# -*- coding: utf-8 -*- import json from importlib import import_module import rest_framework_swagger as rfs from django.apps import apps from django.conf import settings from django.core.exceptions import PermissionDenied from django.shortcuts import render_to_response from django.template import RequestContext, Temp...
null
universal_notifications/docs.py
docs.py
py
12,230
python
en
code
null
code-starcoder2
76
[ { "api_name": "universal_notifications.notifications.EmailNotification", "line_number": 23, "usage_type": "name" }, { "api_name": "universal_notifications.notifications.NotificationBase", "line_number": 23, "usage_type": "name" }, { "api_name": "universal_notifications.notificati...