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
260450377
#!/usr/bin/env python # coding: utf-8 # # Tournois de Tennis # In[1]: class Joueur(): def __init__(self, nom, prénom, classement): self.nom = nom self.prénom = prénom self.classement = classement def __str__(self): return "{} {} ({})".format(self.nom, self.prénom, se...
null
Tournois.py
Tournois.py
py
8,284
python
en
code
null
code-starcoder2
83
[ { "api_name": "random.choices", "line_number": 69, "usage_type": "call" }, { "api_name": "graphviz.Digraph", "line_number": 82, "usage_type": "call" }, { "api_name": "{'Digraph': 'graphviz.Digraph'}", "line_number": 121, "usage_type": "call" }, { "api_name": "{'Di...
528508951
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('shelf', '0004_auto_20161202_0020'), ] operations = [ migrations.AlterField( model_name='book', name=...
null
shelf/migrations/0005_auto_20161202_1254.py
0005_auto_20161202_1254.py
py
430
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.db.migrations.Migration", "line_number": 7, "usage_type": "attribute" }, { "api_name": "django.db.migrations", "line_number": 7, "usage_type": "name" }, { "api_name": "django.db.migrations.AlterField", "line_number": 14, "usage_type": "call" }, {...
225098200
class Solution: def findSubstring(self, s: str, words: List[str]) -> List[int]: if s == "" or words == []: return [] n = len(s) l_word = len(words[0]) length = len(words)*l_word flag = True out = [] # 哈希表1 hash1 = {} hash2 = {} for word...
null
Qustion Code/30. 串联所有单词的子串.py
30. 串联所有单词的子串.py
py
1,722
python
en
code
null
code-starcoder2
83
[ { "api_name": "collections.Counter", "line_number": 34, "usage_type": "call" }, { "api_name": "collections.Counter", "line_number": 41, "usage_type": "call" } ]
168236688
import numpy as np import matplotlib.pyplot as plt from cv2 import cv2 from math import sqrt, log from scipy.spatial.distance import squareform, pdist scalar = 5 """ Helper Functions """ """======================================================""" def scatter(img,x,y): half_size = 3 for i in range(x-half_si...
null
CS270-Digital-Image-Processing/hw1/question2image/hw1-part2.py
hw1-part2.py
py
4,235
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.zeros", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.int32", "line_number": 24, "usage_type": "attribute" }, { "api_name": "numpy.zeros", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.int32", "line_numb...
438079620
from itertools import islice from datapackage import Resource from .. import DataStreamProcessor, schema_validator class set_type(DataStreamProcessor): def __init__(self, name, **options): super(set_type, self).__init__() self.name = name self.options = options self.resource = Non...
null
dataflows/processors/set_type.py
set_type.py
py
1,150
python
en
code
null
code-starcoder2
83
[ { "api_name": "itertools.islice", "line_number": 17, "usage_type": "call" }, { "api_name": "datapackage.Resource", "line_number": 28, "usage_type": "call" } ]
230105070
import gc import json import time import datetime from django.utils import timezone from dataminer.models import * class Worker(): def __init__(self): self.start_time = timezone.now() def run(self): infos_count = PairInfo.objects.all().count() count_on_party = 100 count_o...
null
daven/dataminer/fixers/content.py
content.py
py
1,176
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.utils.timezone.now", "line_number": 13, "usage_type": "call" }, { "api_name": "django.utils.timezone", "line_number": 13, "usage_type": "name" }, { "api_name": "gc.collect", "line_number": 27, "usage_type": "call" }, { "api_name": "json.loads...
164623729
""" Tests for the base formatter implementation """ import typing import unittest import packer.errors import packer.formatters class TestFormatter(unittest.TestCase): """ Tests for the base formatter implementation """ def test_register_hook(self): """ Tests that formatters are auto...
null
tests/small/formatters/test_base.py
test_base.py
py
1,896
python
en
code
null
code-starcoder2
83
[ { "api_name": "unittest.TestCase", "line_number": 11, "usage_type": "attribute" }, { "api_name": "packer.errors.formatters", "line_number": 23, "usage_type": "attribute" }, { "api_name": "packer.errors", "line_number": 23, "usage_type": "name" }, { "api_name": "pa...
574675683
# -*- coding: utf-8 -*- from __future__ import print_function import base64 import logging import json import processor.core as core import lambdautils.utils as utils from processor.exceptions import KinesisError, FirehoseError # Tell humilis to pre-process the file using Jinja2 # preprocessor:jinja2 OUTPUT_STREAM ...
null
humilis_filter/lambda_function/processor/main.py
main.py
py
2,661
python
en
code
null
code-starcoder2
83
[ { "api_name": "logging.getLogger", "line_number": 19, "usage_type": "call" }, { "api_name": "logging.INFO", "line_number": 20, "usage_type": "attribute" }, { "api_name": "processor.core.transform_events", "line_number": 29, "usage_type": "call" }, { "api_name": "p...
260865104
import json from django.template.loader import render_to_string from activity.handlers import BasicActionHandler class NewProjectPhotoHandler(BasicActionHandler): def __init__( self, template_name='projects/new_photo_action.html' ): self.template_name = template_name def get_html_outpu...
null
hackbox/hackbox/apps/projects/activity_handlers.py
activity_handlers.py
py
971
python
en
code
null
code-starcoder2
83
[ { "api_name": "activity.handlers.BasicActionHandler", "line_number": 8, "usage_type": "name" }, { "api_name": "projects.models.ProjectPhoto.objects.get", "line_number": 21, "usage_type": "call" }, { "api_name": "projects.models.ProjectPhoto.objects", "line_number": 21, "u...
523151474
""" Storage object used to store data scanned from text corpus. This object has methods to save and load to/from a file. Data structure: { (Predictor_word_1, ... Predictor_word_n) : [Word_option_1, Word_option_2] } """ import sqlite3 import os class MarkovStorage(object): def __init__(self, markov_order, ...
null
storage_object.py
storage_object.py
py
3,815
python
en
code
null
code-starcoder2
83
[ { "api_name": "sqlite3.connect", "line_number": 71, "usage_type": "call" }, { "api_name": "os.utime", "line_number": 91, "usage_type": "call" }, { "api_name": "sqlite3.connect", "line_number": 105, "usage_type": "call" }, { "api_name": "sqlite3.OperationalError", ...
350275204
import sys import signal from PyQt5 import QtWidgets from Application.application import Application from Application.threadapplication import ThreadApplication from Camera.camera import Camera from Camera.threadcamera import ThreadCamera import config import comm signal.signal(signal.SIGINT, signal.SIG_DFL) if _...
null
guitest.py
guitest.py
py
1,471
python
en
code
null
code-starcoder2
83
[ { "api_name": "signal.signal", "line_number": 15, "usage_type": "call" }, { "api_name": "signal.SIGINT", "line_number": 15, "usage_type": "attribute" }, { "api_name": "signal.SIG_DFL", "line_number": 15, "usage_type": "attribute" }, { "api_name": "PyQt5.QtWidgets....
465120747
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render, redirect, get_object_or_404 from django.db import connection from cadastros.models import Instituicoes, Canais, Deficiencia, Responsavel, Evento, Atividade, Grupo_Atividade,Agendamentos from cadastros.forms import Insti...
null
cadastros/views_cadastro.py
views_cadastro.py
py
20,209
python
en
code
null
code-starcoder2
83
[ { "api_name": "visite_mv.funcoes.constantes.QTD_ITEMS_PER_PAGE_LISTAGENS", "line_number": 21, "usage_type": "attribute" }, { "api_name": "visite_mv.funcoes.constantes", "line_number": 21, "usage_type": "name" }, { "api_name": "visite_mv.funcoes.Util.Util", "line_number": 23, ...
266433014
import asyncio from config import * from spider import Spider class Tasker: def __init__(self): self.redis_client = REDIS_CLIENT_DB2 self.start_page = START_PAGE self.stop_page = STOP_PAGE self.start_per_step = START_PER_STEP self.stop_per_step = STOP_PER_STEP def get_...
null
celery+asyncio/tasker.py
tasker.py
py
1,199
python
en
code
null
code-starcoder2
83
[ { "api_name": "spider.Spider", "line_number": 32, "usage_type": "call" }, { "api_name": "asyncio.ensure_future", "line_number": 35, "usage_type": "call" }, { "api_name": "spider.parse", "line_number": 35, "usage_type": "call" } ]
250890036
from __future__ import print_function from __future__ import absolute_import import fnmatch import torch class ConstraintModule(object): def __init__(self, constraints): self.constraints = constraints self.batch_constraints = [c for c in self.constraints if c.unit == 'batch'] self.epoc...
null
torchsample/constraints.py
constraints.py
py
3,031
python
en
code
null
code-starcoder2
83
[ { "api_name": "fnmatch.fnmatch", "line_number": 22, "usage_type": "call" }, { "api_name": "torch.norm", "line_number": 61, "usage_type": "call" }, { "api_name": "torch.norm", "line_number": 91, "usage_type": "call" } ]
68686991
"""Purpose of this script is to initialise all the model parameters""" # Import libraries import numpy as np import pandas as pd import os from hurst import compute_Hc from scipy import stats from pyabc import Distribution, RV, ABCSMC, UniformAcceptor from hft_abm_smc_abc.config import DELTA_TRUE, MU_TRUE, ALPHA_TRU...
null
hft_abm_smc_abc/SMC_ABC_init.py
SMC_ABC_init.py
py
5,400
python
en
code
null
code-starcoder2
83
[ { "api_name": "hurst.compute_Hc", "line_number": 25, "usage_type": "call" }, { "api_name": "scipy.stats.ks_2samp", "line_number": 46, "usage_type": "call" }, { "api_name": "scipy.stats", "line_number": 46, "usage_type": "name" }, { "api_name": "numpy.ravel", "...
480505051
import os import cv2 import numpy as np import math from numpy import linalg as LA import matplotlib.pyplot as plt import mahotas # link data city_path = './data/city' forest_path = './data/forest' sea_path = './data/sea' # link image city_image_path = [os.path.join(city_path,i) for i in os.listdir(city_path)] forest_...
null
landscape/exm.py
exm.py
py
5,121
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.path.join", "line_number": 14, "usage_type": "call" }, { "api_name": "os.path", "line_number": 14, "usage_type": "attribute" }, { "api_name": "os.listdir", "line_number": 14, "usage_type": "call" }, { "api_name": "os.path.join", "line_number"...
448597454
#!/usr/bin/env python3 import argparse import os import yaml import sys import tensorflow as tf from tfprocess import TFProcess START_FROM = 0 def main(cmd): cfg = yaml.safe_load(cmd.cfg.read()) print(yaml.dump(cfg, default_flow_style=False)) root_dir = os.path.join(cfg['training']['path'], cfg['name']) ...
null
tf/update_steps.py
update_steps.py
py
1,391
python
en
code
null
code-starcoder2
83
[ { "api_name": "yaml.safe_load", "line_number": 12, "usage_type": "call" }, { "api_name": "yaml.dump", "line_number": 13, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path", "line_number": 15...
428749933
# # Compute Ontario Summer School # Neural Networks with Python I # 26 June 2019 # Erik Spence # # This file, plotting_routines.py, contains some simple plotting # routines. # ####################################################################### """ plotting_routines.py contains two routines for plotting the class...
null
Summer School Scinet/nn1_code/nn1_code/plotting_routines.py
plotting_routines.py
py
3,674
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.array", "line_number": 67, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.scatter", "line_number": 71, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 71, "usage_type": "name" }, { "api_name": "matplotlib.py...
212117866
from django.template import Library from ...order import OrderStatus register = Library() ERRORS = {} SUCCESSES = {OrderStatus.SHIPPED,} LABEL_DANGER = 'danger' LABEL_SUCCESS = 'success' LABEL_DEFAULT = 'default' @register.inclusion_tag('status_label.html') def render_status(status, status_display=None): if...
null
saleor/core/templatetags/status.py
status.py
py
554
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.template.Library", "line_number": 5, "usage_type": "call" }, { "api_name": "order.OrderStatus.SHIPPED", "line_number": 9, "usage_type": "attribute" }, { "api_name": "order.OrderStatus", "line_number": 9, "usage_type": "name" } ]
523882197
#!/usr/bin/env python3 ''' Euler angle order needs to be ZXY for consistent stability Follows Right hand convention. X is forward Z is right Y is up in drone frame TODO: Possible issues with Optitrack environment alignment on initialization. May need a calibration protocol ''' import rospy from acsi_controller.msg i...
null
src/ACSI_package/acsi_controller/nodes/position_control_node.py
position_control_node.py
py
9,207
python
en
code
null
code-starcoder2
83
[ { "api_name": "geometry_msgs.msg.PoseArray", "line_number": 23, "usage_type": "call" }, { "api_name": "acsi_pid.pid.PID", "line_number": 29, "usage_type": "call" }, { "api_name": "acsi_pid.pid", "line_number": 29, "usage_type": "name" }, { "api_name": "acsi_observ...
154521661
""" A module defining a list of fixture functions that are shared across all the skabase tests. """ import mock import pytest import importlib from tango.test_context import DeviceTestContext @pytest.fixture(scope="class") def tango_context(request): """Creates and returns a TANGO DeviceTestContext object. ...
null
skabase/conftest.py
conftest.py
py
1,297
python
en
code
null
code-starcoder2
83
[ { "api_name": "importlib.import_module", "line_number": 26, "usage_type": "call" }, { "api_name": "tango.test_context.DeviceTestContext", "line_number": 29, "usage_type": "call" }, { "api_name": "mock.Mock", "line_number": 31, "usage_type": "call" }, { "api_name":...
419943514
import csv import json import time import requests from bs4 import BeautifulSoup from fake_useragent import UserAgent def fetch_data(result_id): url = f"https://www.speedtest.net/result/{result_id}" ua = UserAgent() header = {'User-Agent': str(ua.chrome)} url_data = requests.get(url,...
null
web_crawler.py
web_crawler.py
py
2,679
python
en
code
null
code-starcoder2
83
[ { "api_name": "fake_useragent.UserAgent", "line_number": 13, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 16, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 23, "usage_type": "call" }, { "api_name": "requests.get", "...
523823973
import glob import numpy as np from scipy import misc from tqdm import tqdm, trange singFiles = glob.glob("./answers/sing*") pkls = glob.glob("./pkls/*.pkl") pkls = [name.split('/')[-1] for name in pkls] training_list_path = "./pkls/training.csv" validation_list_path = "./pkls/validation.csv" img = np.zeros(shape...
null
processing/data_split.py
data_split.py
py
763
python
en
code
null
code-starcoder2
83
[ { "api_name": "glob.glob", "line_number": 6, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 7, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 13, "usage_type": "call" }, { "api_name": "numpy.float32", "line_number": 13, ...
249302894
import requests from bs4 import BeautifulSoup import csv def isolate_secondary_structure(string): structure_marks = "" for char in string: if char == '<' or '>' or '.': structure_marks += char return structure_marks def edit_name (tRNA_name): new_parts = [] tRN...
null
tRNA_scraper.py
tRNA_scraper.py
py
7,886
python
en
code
null
code-starcoder2
83
[ { "api_name": "csv.reader", "line_number": 143, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 156, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 163, "usage_type": "call" } ]
50837484
################################################################ # Author : yiorgosynkl (find me in Github: https://github.com/yiorgosynkl) # Date created : 20220903 # Problem link : https://leetcode.com/contest/biweekly-contest-86/problems/maximum-rows-covered-by-columns/ #########################...
null
biweekly_contest_86/2397-maximum-rows-covered-by-columns.py
2397-maximum-rows-covered-by-columns.py
py
1,612
python
en
code
null
code-starcoder2
83
[ { "api_name": "itertools.combinations", "line_number": 15, "usage_type": "call" } ]
421489460
from django.urls import reverse from .factories import CaseWithVariantSetFactory from .helpers import ApiViewTestBase # TODO: add tests that include permission testing def transmogrify_pedigree(pedigree): return [ {{"patient": "name"}.get(key, key): value for key, value in m.items()} for m in pedigree ...
null
variants/tests/test_views_api.py
test_views_api.py
py
5,885
python
en
code
null
code-starcoder2
83
[ { "api_name": "helpers.ApiViewTestBase", "line_number": 15, "usage_type": "name" }, { "api_name": "factories.CaseWithVariantSetFactory.get", "line_number": 21, "usage_type": "call" }, { "api_name": "factories.CaseWithVariantSetFactory", "line_number": 21, "usage_type": "n...
393722571
from bot_admin import models from django.contrib.auth.models import User def save_notification(request): notification_type = request.POST.get('type', '') notification = models.Notify(type=notification_type, activity=get_boolean_from_html(request.POST.get('activity', F...
null
bot_admin/functions.py
functions.py
py
3,592
python
en
code
null
code-starcoder2
83
[ { "api_name": "bot_admin.models.Notify", "line_number": 8, "usage_type": "call" }, { "api_name": "bot_admin.models", "line_number": 8, "usage_type": "name" }, { "api_name": "django.contrib.auth.models.User.objects.get", "line_number": 10, "usage_type": "call" }, { ...
130417881
from __future__ import print_function import nvidia_smi import sys, os, time import random import math import cv2 as cv from PIL import Image import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.backends.cudnn as cudnn from torchvision import datasets, transform...
null
myTest.py
myTest.py
py
9,208
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.zeros", "line_number": 65, "usage_type": "call" }, { "api_name": "torch.sort", "line_number": 69, "usage_type": "call" }, { "api_name": "opts.parse_opts", "line_number": 83, "usage_type": "call" }, { "api_name": "cfg.parse_cfg", "line_numb...
341184755
import torch from torch import nn from torch.nn import functional as F from torch.multiprocessing import Pool import numpy as np from inner import Inner from copy import deepcopy class Outer(nn.Module): """ Meta learner for the outer loop """ def __init__(self, args, config=None): """ ...
null
outer.py
outer.py
py
8,640
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 9, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 9, "usage_type": "name" }, { "api_name": "torch.nn.functional.mse_loss", "line_number": 28, "usage_type": "attribute" }, { "api_name": "torch.n...
575796004
# -*- coding: utf-8 -*- import sys, os, sqlite3 as db, requests, json from bottle import route, run, template, static_file, get, post, request from elasticsearch import Elasticsearch connection = db.connect('database/test.db') connection.text_factory = str es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) IND...
null
server2.py
server2.py
py
7,972
python
en
code
null
code-starcoder2
83
[ { "api_name": "sqlite3.connect", "line_number": 7, "usage_type": "call" }, { "api_name": "elasticsearch.Elasticsearch", "line_number": 9, "usage_type": "call" }, { "api_name": "os.path.isfile", "line_number": 69, "usage_type": "call" }, { "api_name": "os.path", ...
517107283
import torch import torch.nn as nn import torchvision.models as models import torch.nn.functional as F class ConvNet(nn.Module): """EmbeddingNet using ResNet-101.""" def __init__(self): """Initialize EmbeddingNet model.""" super(ConvNet, self).__init__() # Use ResNet for ConvNet ...
null
net.py
net.py
py
2,508
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 7, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 7, "usage_type": "name" }, { "api_name": "torchvision.models.resnet101", "line_number": 15, "usage_type": "call" }, { "api_name": "torchvision....
361518871
############################################################################## # # Copyright (c) 2005 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SO...
null
zf.zscp/trunk/src/zf/zscp/fields.py
fields.py
py
957
python
en
code
null
code-starcoder2
83
[ { "api_name": "zope.schema.schema", "line_number": 22, "usage_type": "attribute" }, { "api_name": "zope.schema", "line_number": 22, "usage_type": "name" }, { "api_name": "datetime.date", "line_number": 27, "usage_type": "call" } ]
394480075
import os import glob import torch import torch.nn as nn from inference.torch_model.dendiffcnn.denoising_diffusion_mysc import Unet_encoder from inference.torch_model.dendiffcnn.denoising_diffusion_mysc import Unet_decoder from inference.torch_model.transformer.transformer import cnnTransformer class InferenceModel(nn...
null
inference/inference_model.py
inference_model.py
py
1,914
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 9, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 9, "usage_type": "name" }, { "api_name": "inference.torch_model.dendiffcnn.denoising_diffusion_mysc.Unet_encoder", "line_number": 19, "usage_type": "ca...
631550763
from utils import TreeNode from typing import List, Optional class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': if p.val > q.val: p, q = q, p return self.travseral(root, p.val, q.val) def travseral(self, node, p, ...
null
source code/235. Lowest Common Ancestor of a Binary Search Tree.py
235. Lowest Common Ancestor of a Binary Search Tree.py
py
996
python
en
code
null
code-starcoder2
83
[ { "api_name": "utils.TreeNode.build_by_str", "line_number": 31, "usage_type": "call" }, { "api_name": "utils.TreeNode", "line_number": 31, "usage_type": "name" }, { "api_name": "utils.TreeNode", "line_number": 32, "usage_type": "call" }, { "api_name": "utils.TreeN...
485117751
import pytest import numpy as np from jina.executors.evaluators.encode.cosine import CosineEvaluator @pytest.mark.parametrize( 'doc_embedding, gt_embedding, expected', [ ([0, 1], [0, 1], 0.0), ([0, 1], [1, 0], 1.0), ([1, 0], [0, 1], 1.0), ([1, 0], [1, 0], 0.0), ([0, -1...
null
tests/unit/executors/evaluators/encode/test_cosine.py
test_cosine.py
py
1,374
python
en
code
null
code-starcoder2
83
[ { "api_name": "jina.executors.evaluators.encode.cosine.CosineEvaluator", "line_number": 18, "usage_type": "call" }, { "api_name": "pytest.mark.parametrize", "line_number": 7, "usage_type": "call" }, { "api_name": "pytest.mark", "line_number": 7, "usage_type": "attribute" ...
125129333
from django.shortcuts import render_to_response from News.models import News from django.template import RequestContext #form django.views.generic import DetailView def index(request): items = News.objects.all()[:10] q = RequestContext(request, { 'item':items }) ...
null
News/views.py
views.py
py
714
python
en
code
null
code-starcoder2
83
[ { "api_name": "News.models.News.objects.all", "line_number": 9, "usage_type": "call" }, { "api_name": "News.models.News.objects", "line_number": 9, "usage_type": "attribute" }, { "api_name": "News.models.News", "line_number": 9, "usage_type": "name" }, { "api_name...
605069822
'''Takes a list of URLs, and returns a list of formatted complaints.''' import datetime import logging import urllib2 import time import json def pull_and_format(list_of_urls): formatted_complaints = [] pull_timestamp = datetime.datetime.now() for url in list_of_urls: logging.info('Pul...
null
pull_json.py
pull_json.py
py
1,082
python
en
code
null
code-starcoder2
83
[ { "api_name": "datetime.datetime.now", "line_number": 11, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 11, "usage_type": "attribute" }, { "api_name": "logging.info", "line_number": 13, "usage_type": "call" }, { "api_name": "urllib2.url...
616838292
import requests from pybyte.endpoints import Endpoints import json import pathlib from loguru import logger from pybyte.session import ByteSession from pybyte.user import ByteAccount, ByteUser from pybyte.post import BytePost from ffprobe import FFProbe from ffmpy import FFmpeg class Byte(object): @staticmet...
null
pybyte/byte.py
byte.py
py
8,811
python
en
code
null
code-starcoder2
83
[ { "api_name": "json.dumps", "line_number": 21, "usage_type": "call" }, { "api_name": "loguru.logger.error", "line_number": 36, "usage_type": "call" }, { "api_name": "loguru.logger", "line_number": 36, "usage_type": "name" }, { "api_name": "loguru.logger.error", ...
235493435
import gym from lake2 import LakeLoadEnv import matplotlib.pyplot as plt from Net import NeuralNetwork import numpy as np ALPHA = 0.3 GAMMA = 0.9 #Discount Rate EPSILON = 0.1 #Epsilon for Epsilon-Greedy NUM_EPISODES = 20 #Number of total episodes NUM_MOVES = 500 #Numb...
null
Q_Agent.py
Q_Agent.py
py
5,798
python
en
code
null
code-starcoder2
83
[ { "api_name": "Net.NeuralNetwork", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 34, "usage_type": "call" }, { "api_name": "numpy.random.random_sample", "line_number": 36, "usage_type": "call" }, { "api_name": "numpy.random...
80334310
import cv2 import numpy as np import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import matplotlib.pyplot as plt pixelAverage=0 counter=0 flag=0 #method for sending mail def email_trigger(number): msg = MIMEMultipart() msg['Subject'] = 'Human Fall' msg['Fro...
null
Source Code/main.py
main.py
py
5,601
python
en
code
null
code-starcoder2
83
[ { "api_name": "email.mime.multipart.MIMEMultipart", "line_number": 15, "usage_type": "call" }, { "api_name": "email.mime.text.MIMEText", "line_number": 20, "usage_type": "call" }, { "api_name": "smtplib.SMTP", "line_number": 23, "usage_type": "call" }, { "api_name...
317138689
from django_cron import CronJobBase, Schedule from .models import OpenExchange import requests from datetime import datetime import logging logger = logging.getLogger(__name__) class MyCronJob(CronJobBase): RUN_EVERY_MINS = 60 schedule = Schedule(run_every_mins=RUN_EVERY_MINS) code = 'my_app.my_cron_job...
null
koytola/product/cron.py
cron.py
py
1,469
python
en
code
null
code-starcoder2
83
[ { "api_name": "logging.getLogger", "line_number": 7, "usage_type": "call" }, { "api_name": "django_cron.CronJobBase", "line_number": 10, "usage_type": "name" }, { "api_name": "django_cron.Schedule", "line_number": 13, "usage_type": "call" }, { "api_name": "request...
367836242
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import logging from dataclasses import dataclass from pathlib import Path from textwrap import dedent from typing import List, Type from pants.core.goa...
null
src/python/pants/core/goals/fmt_test.py
fmt_test.py
py
6,514
python
en
code
null
code-starcoder2
83
[ { "api_name": "pants.engine.fs.FileContent", "line_number": 23, "usage_type": "call" }, { "api_name": "pants.engine.fs.FileContent", "line_number": 24, "usage_type": "call" }, { "api_name": "pants.engine.target.MultipleSourcesField", "line_number": 27, "usage_type": "name...
74276638
# 신경망학습: 미니 배치(mini-batch) import os import sys import numpy as np from pathlib import Path try: sys.path.append(os.path.join(Path(os.getcwd()).parent, 'lib')) from mnist import load_mnist from common import cross_entropy_error except ImportError: print('Library Module Can Not Found') # test1 (train_x,...
null
02.neural-network/06.neural-network-training/ex03.py
ex03.py
py
1,195
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.path.append", "line_number": 7, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path", "line_number": ...
616788963
import datetime import numpy import numpy as np import pandas as pd from keras.layers import Dense, Dropout from keras.models import Sequential from keras.wrappers.scikit_learn import KerasClassifier from sklearn.model_selection import StratifiedKFold from sklearn.preprocessing import StandardScaler from models.tools...
null
models/nn_deep.py
nn_deep.py
py
4,546
python
en
code
null
code-starcoder2
83
[ { "api_name": "models.tools.load_data", "line_number": 62, "usage_type": "call" }, { "api_name": "sklearn.preprocessing.StandardScaler", "line_number": 65, "usage_type": "call" }, { "api_name": "keras.models.Sequential", "line_number": 75, "usage_type": "call" }, { ...
132153834
from PIL import Image, ImageDraw, ImageFont '''ImageDraw生成一个可操作的图像对象,Imagefont是字体对象。 在本段代码中,ImageDraw提供在图片上写字的方法,Imagefont提供字体对象,控制字的大小''' im = Image.open("lsp.jpg") im_draw = ImageDraw.Draw(im) im_size = im.im_size font_size = min(im_size) // 11#确定字的大小 my_font = ImageFont.truetype("font.tff", size=font_size) font_l...
null
code/q0.py
q0.py
py
615
python
en
code
null
code-starcoder2
83
[ { "api_name": "PIL.Image.open", "line_number": 5, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 5, "usage_type": "name" }, { "api_name": "PIL.ImageDraw.Draw", "line_number": 7, "usage_type": "call" }, { "api_name": "PIL.ImageDraw", "line_nu...
375177697
import requests TOKEN = '' source_user = 577250478 target_user = 355405083 list_users = [] class User: def __init__(self, user_id): self.user_id = user_id def __str__(self): return str(f'https://vk.com/id{self.user_id}') def __and__(self, other): response = requests.get( ...
null
netology_basic_python_tasks/12_work_in_class_api_vk/task_get_mutual.py
task_get_mutual.py
py
829
python
en
code
null
code-starcoder2
83
[ { "api_name": "requests.get", "line_number": 18, "usage_type": "call" } ]
319579854
import os from flask import send_file, request, redirect, url_for, jsonify from dadd.master import app from dadd.master.files import FileStorage @app.route('/') def index(): return redirect(url_for('admin.index')) @app.route('/files/<path:path>', methods=['PUT', 'GET']) def files(path): storage = FileStor...
null
dadd/master/handlers.py
handlers.py
py
882
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.redirect", "line_number": 11, "usage_type": "call" }, { "api_name": "flask.url_for", "line_number": 11, "usage_type": "call" }, { "api_name": "dadd.master.app.route", "line_number": 9, "usage_type": "call" }, { "api_name": "dadd.master.app", ...
149427017
#!/usr/bin/env python # coding: utf-8 # In[2]: import numpy,sys,time from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras.layers import Flatten from keras.layers import LSTM from keras.callbacks import ModelCheckpoint from keras.utils import np_utils import s...
null
generate_by_rnn.py
generate_by_rnn.py
py
6,013
python
en
code
null
code-starcoder2
83
[ { "api_name": "string.punctuation", "line_number": 28, "usage_type": "attribute" }, { "api_name": "gensim.models.Word2Vec", "line_number": 84, "usage_type": "call" }, { "api_name": "gensim.models", "line_number": 84, "usage_type": "attribute" }, { "api_name": "num...
596125085
#dataを使う #各、ランダムクロップ import tensorflow as tf import numpy as np import pandas as pd import datetime import time import os import glob import math import argparse import sys import random import cv2 parser = argparse.ArgumentParser() parser.add_argument("--load_model", action='store_true', help="test is do --load...
null
bunkatu_re_1.py
bunkatu_re_1.py
py
11,632
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 17, "usage_type": "call" }, { "api_name": "tensorflow_hub.Module", "line_number": 37, "usage_type": "call" }, { "api_name": "tensorflow_hub.Module", "line_number": 40, "usage_type": "call" }, { "api_name": "t...
458112978
#! /usr/bin/env python # Copyright (c) 2019 Uber Technologies, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
null
ludwig/data/dataset/ray.py
ray.py
py
11,169
python
en
code
null
code-starcoder2
83
[ { "api_name": "distutils.version.LooseVersion", "line_number": 41, "usage_type": "call" }, { "api_name": "ray.__version__", "line_number": 41, "usage_type": "attribute" }, { "api_name": "ludwig.constants.BINARY", "line_number": 44, "usage_type": "name" }, { "api_n...
614948598
import PIL.Image from torchvision import transforms import torch import numpy as np import cv2 import os import random from torch.utils.data import Dataset import pdb cuda = torch.cuda.is_available() class LinemodDataset(Dataset): def __init__(self, base_dir='data/linemod', objec...
null
lib/datasets/linemod.py
linemod.py
py
8,872
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.cuda.is_available", "line_number": 11, "usage_type": "call" }, { "api_name": "torch.cuda", "line_number": 11, "usage_type": "attribute" }, { "api_name": "torch.utils.data.Dataset", "line_number": 13, "usage_type": "name" }, { "api_name": "nump...
563339349
# -*- coding: utf-8 -*- """ Created on Fri Jun 2 13:09:20 2017 @author: 凯风 """ import nltk # 英文 import jieba # 中文 ''' 不说人话的翻译... 如何理解呢... 英文名称 中文翻译 理解 token 令牌 每一个词的起始字符位置和结束位置 tokenize 令牌化 对一个字符串的句子,生成每个词的令牌 ...
null
Text_Operation/Basic_Operation/tokenize.py
tokenize.py
py
1,252
python
en
code
null
code-starcoder2
83
[ { "api_name": "jieba.tokenize", "line_number": 22, "usage_type": "call" }, { "api_name": "nltk.ReppTokenizer", "line_number": 32, "usage_type": "call" } ]
235160243
from sqlalchemy import (create_engine, String, Integer, Column) from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from data_db import db_info from contextlib import contextmanager Base = declarative_base() # 创建一个基础类 # 创建连接数据库引擎 (适配器采用mysql-connector-python) engine = create...
null
data_db/create_db.py
create_db.py
py
1,280
python
en
code
null
code-starcoder2
83
[ { "api_name": "sqlalchemy.ext.declarative.declarative_base", "line_number": 6, "usage_type": "call" }, { "api_name": "sqlalchemy.create_engine", "line_number": 8, "usage_type": "call" }, { "api_name": "data_db.db_info.info", "line_number": 8, "usage_type": "attribute" }...
81427839
# Under MIT license, see LICENSE.txt from typing import List from RULEngine.Game.OurPlayer import OurPlayer from RULEngine.Util.Pose import Pose from ai.states.game_state import GameState from ai.STA.Tactic.tactic import Tactic from ai.STA.Tactic.tactic_constants import Flags from ai.STA.Action.MoveToPosition import ...
null
ai/STA/Tactic/go_to_position_pathfinder.py
go_to_position_pathfinder.py
py
1,797
python
en
code
null
code-starcoder2
83
[ { "api_name": "ai.STA.Tactic.tactic.Tactic", "line_number": 14, "usage_type": "name" }, { "api_name": "ai.states.game_state.GameState", "line_number": 15, "usage_type": "name" }, { "api_name": "RULEngine.Game.OurPlayer.OurPlayer", "line_number": 15, "usage_type": "name" ...
566680484
from PyQt5.QtWidgets import (QApplication, QWidget, QHBoxLayout, QVBoxLayout, QScrollArea, QTableWidget, QTableWidgetItem, QLabel, QPushButton, QAbstractItemView, QMessageBox, QLineEdit, QFormLayout) from PyQt5.QtCore import Qt impor...
null
OperatorPanelUi.py
OperatorPanelUi.py
py
12,991
python
en
code
null
code-starcoder2
83
[ { "api_name": "matplotlib.use", "line_number": 7, "usage_type": "call" }, { "api_name": "PyQt5.QtWidgets.QScrollArea", "line_number": 13, "usage_type": "name" }, { "api_name": "PyQt5.QtWidgets.QLabel", "line_number": 19, "usage_type": "call" }, { "api_name": "PyQt...
520046802
"""Add scan Revision ID: 184924ecd052 Revises: 8be0b8538d61 Create Date: 2021-03-07 16:15:30.259925 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "184924ecd052" down_revision = "8be0b8538d61" branch_labels = None depe...
null
redata/alembic/versions/184924ecd052_add_scan.py
184924ecd052_add_scan.py
py
1,627
python
en
code
null
code-starcoder2
83
[ { "api_name": "alembic.op.create_table", "line_number": 21, "usage_type": "call" }, { "api_name": "alembic.op", "line_number": 21, "usage_type": "name" }, { "api_name": "sqlalchemy.Column", "line_number": 23, "usage_type": "call" }, { "api_name": "sqlalchemy.Integ...
451352490
# In[1]: import numpy as np import cv2 import matplotlib.image as mpimg from matplotlib import pyplot as plt from sklearn.cluster import KMeans get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: def centroid_histogram(clt): # grab the number of different clusters and create a histogram ...
null
cluster_4color_detect.py
cluster_4color_detect.py
py
2,305
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.arange", "line_number": 27, "usage_type": "call" }, { "api_name": "numpy.unique", "line_number": 27, "usage_type": "call" }, { "api_name": "numpy.histogram", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_num...
528563169
from TikTokApi import TikTokapi # Starts The Api Class api = TikTokapi("browsermob-proxy/bin/browsermob-proxy") # The Number of trending TikToks you want to be displayed results = 10 # The TikTok user's ID, can be found in the JSON from trending id = "7119601" trending = api.userPosts(id, count=results) for tiktok...
null
examples/getAUsersVideos.py
getAUsersVideos.py
py
450
python
en
code
null
code-starcoder2
83
[ { "api_name": "TikTokApi.TikTokapi", "line_number": 4, "usage_type": "call" } ]
123532169
__author__ = 'btciavol' __date__ = '3/20/12' #---- Library Imports --------------------------------------------------------- import xml.etree.ElementTree as et import copy #---- 3rd Party Imports -------------------------------------------------------- import traits.api as tr #---- Local Imports --------------------...
null
repo/catalog.py
catalog.py
py
8,949
python
en
code
null
code-starcoder2
83
[ { "api_name": "traits.api.List", "line_number": 18, "usage_type": "call" }, { "api_name": "traits.api", "line_number": 18, "usage_type": "name" }, { "api_name": "traits.api.Instance", "line_number": 18, "usage_type": "call" }, { "api_name": "drawables.Drawable", ...
397370316
import os import json from django.shortcuts import render from django.http import JsonResponse, HttpRequest, HttpResponse from teamstudyCodingChallenge import settings def index(request): with open(os.path.join(settings.BASE_DIR, "notes/notes.json")) as notes_file: data = json.load(notes_file) re...
null
backend/teamstudyCodingChallenge/notes/views.py
views.py
py
839
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.path.join", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path", "line_number": 10, "usage_type": "attribute" }, { "api_name": "teamstudyCodingChallenge.settings.BASE_DIR", "line_number": 10, "usage_type": "attribute" }, { "api_nam...
431949942
import json from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404 from django.test import TestCase from google.appengine.ext import testbed from ingredients.models import Ingredient class TestIngredientViews(TestCase): def setUp(self): """ Initialize GAE test stubs...
null
ingredients/tests/test_views.py
test_views.py
py
4,716
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.test.TestCase", "line_number": 10, "usage_type": "name" }, { "api_name": "google.appengine.ext.testbed.Testbed", "line_number": 15, "usage_type": "call" }, { "api_name": "google.appengine.ext.testbed", "line_number": 15, "usage_type": "name" }, {...
293738876
# Copying Holly Grimm's solution https://github.com/hollygrimm/cs294-homework/blob/master/hw1/bc.py # Copy and pasting and merging it into a copy of my behavior_cloner.py code. import argparse import pickle import os import sys import tensorflow.compat.v1 as tf import numpy as np from sklearn.model_selection import tr...
null
hw1/hollygrimm_behavior_cloner.py
hollygrimm_behavior_cloner.py
py
7,913
python
en
code
null
code-starcoder2
83
[ { "api_name": "mlflow.tensorflow.tensorflow.autolog", "line_number": 21, "usage_type": "call" }, { "api_name": "mlflow.tensorflow.tensorflow", "line_number": 21, "usage_type": "attribute" }, { "api_name": "mlflow.tensorflow", "line_number": 21, "usage_type": "name" }, ...
558160972
# f = open(r'E:\Jmeter\fee.txt','r') # lines = f.readlines() # print(lines) # # for line in lines: # print(line.split(',')[0]) from io import StringIO # write to StringIO: f = StringIO() f.write('hello') f.write(' ') f.write('world!') print(f.getvalue()) # read from StringIO: f = StringIO('水面细风生,\n菱歌慢慢声。\n客亭临小市,\...
null
Common/Py_Study/String_io.py
String_io.py
py
461
python
en
code
null
code-starcoder2
83
[ { "api_name": "io.StringIO", "line_number": 10, "usage_type": "call" }, { "api_name": "io.StringIO", "line_number": 17, "usage_type": "call" } ]
624781286
''' Copyright(C) 2015 Intel Corporation and Jaak Simm KU Leuven All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of con...
null
chemo/chemo_db.py
chemo_db.py
py
4,390
python
en
code
null
code-starcoder2
83
[ { "api_name": "struct.unpack_from", "line_number": 42, "usage_type": "call" }, { "api_name": "struct.unpack", "line_number": 43, "usage_type": "call" }, { "api_name": "struct.pack", "line_number": 61, "usage_type": "call" }, { "api_name": "enum.Enum", "line_nu...
515998488
import numpy as np import matplotlib.pyplot as plt import plottools import os from ModelSelection import ModelSelection # Read data ms = ModelSelection() optimizer_method = ms.read_pareto_curve() # Generate Pareto curve plt.rcParams.update({'font.size': 20}) fig, ax = plt.subplots(1, 1, figsize = (15, 7.5), dpi = 300...
null
SIR Compartmental/SINDy/Pareto.py
Pareto.py
py
1,815
python
en
code
null
code-starcoder2
83
[ { "api_name": "ModelSelection.ModelSelection", "line_number": 8, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.rcParams.update", "line_number": 12, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.rcParams", "line_number": 12, "usage_type": "attribute" ...
185436227
# coding: utf-8 from django.core.management.base import BaseCommand from main.models import City, CountryCode from django.db import transaction class Command(BaseCommand): help = "Заносим данные в дазу банных" @transaction.atomic() def handle(self, *args, **options): file_path = '/home...
null
main/management/commands/filldatabase.py
filldatabase.py
py
1,030
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.core.management.base.BaseCommand", "line_number": 7, "usage_type": "name" }, { "api_name": "main.models.City", "line_number": 17, "usage_type": "call" }, { "api_name": "main.models.CountryCode.objects.get_or_create", "line_number": 20, "usage_type": ...
607022221
"""test IEMRE stuff""" import datetime try: from zoneinfo import ZoneInfo except ImportError: from backports.zoneinfo import ZoneInfo import numpy as np from pyiem.util import utc, get_dbconn from pyiem import iemre def test_ncname(): """Test the responses for get_names.""" assert iemre.get_daily_nc...
null
tests/test_iemre.py
test_iemre.py
py
3,543
python
en
code
null
code-starcoder2
83
[ { "api_name": "pyiem.iemre.get_daily_ncname", "line_number": 16, "usage_type": "call" }, { "api_name": "pyiem.iemre", "line_number": 16, "usage_type": "name" }, { "api_name": "pyiem.iemre.get_hourly_ncname", "line_number": 17, "usage_type": "call" }, { "api_name":...
521625076
''' A class defining the nodes in our Differentially Private Random Decision Forest ''' from collections import defaultdict import random import numpy as np import math from scipy import stats # for Exponential Mechanism class node: def __init__(self, parent_node, split_value_from_parent, splitting_attribute, t...
null
src/private_tree/node.py
node.py
py
4,334
python
en
code
null
code-starcoder2
83
[ { "api_name": "collections.defaultdict", "line_number": 20, "usage_type": "call" }, { "api_name": "numpy.random.RandomState", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 25, "usage_type": "attribute" }, { "api_name": "ma...
159649914
# In [1] import time, sys, os tbegin = time.time() import h5py import numpy as np import matplotlib.pyplot as plt # In [2] import fsps import sedpy import prospect import emcee import sg_params as params from corner import quantile # more imports from matplotlib.backends.backend_pdf import PdfPages from sg_likelihood...
null
hst/PROSPECTOR/prospect_ssp.py
prospect_ssp.py
py
18,967
python
en
code
null
code-starcoder2
83
[ { "api_name": "time.time", "line_number": 3, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 25, "usage_type": "attribute" }, { "api_name": "astropy.table.Table", "line_number": 37, "usage_type": "call" }, { "api_name": "astropy.table.Column", ...
442535435
# Copyright (c) 2015-2016 Tigera, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
null
tests/st/bgp/test_bgp_config.py
test_bgp_config.py
py
4,774
python
en
code
null
code-starcoder2
83
[ { "api_name": "tests.st.test_base.TestBase", "line_number": 41, "usage_type": "name" }, { "api_name": "tests.st.utils.docker_host.DockerHost", "line_number": 47, "usage_type": "call" }, { "api_name": "tests.st.utils.exceptions.CommandExecError", "line_number": 52, "usage_...
262534530
import pandas as pd import numpy as np from scipy import sparse as sps import math import csv def load_data(path="../ml-20m/ratings.csv"): df = pd.read_csv(path) userIds = df.userId.unique() del df user_data = [] movie_data = [] rating_data = [] ## Missing movie ids in dataset - we co...
null
hw1/datahandler.py
datahandler.py
py
2,674
python
en
code
null
code-starcoder2
83
[ { "api_name": "pandas.read_csv", "line_number": 8, "usage_type": "call" }, { "api_name": "csv.reader", "line_number": 20, "usage_type": "call" }, { "api_name": "scipy.sparse.coo_matrix", "line_number": 34, "usage_type": "call" }, { "api_name": "scipy.sparse", ...
554027439
#!/usr/bin/env python # -*- coding: utf-8 -*- # diskCache.py import os import sys import zlib import time import logging as logger import urlparse from datetime import datetime, timedelta try: import cPickle as pickle except ImportError: logger.info ("cPickle module not available") import pickle sy...
null
database/diskCache.py
diskCache.py
py
3,668
python
en
code
null
code-starcoder2
83
[ { "api_name": "logging.info", "line_number": 16, "usage_type": "call" }, { "api_name": "sys.setrecursionlimit", "line_number": 18, "usage_type": "call" }, { "api_name": "datetime.timedelta", "line_number": 28, "usage_type": "call" }, { "api_name": "os.path.exists"...
600593333
# code for this partially borrowed from tjcsl/cslbot import git import json import requests import plugins from ghinfo import * from links import * from control import * from urllib.parse import quote as sanitize def _initialise(): plugins.register_admin_command(['pull', 'issue', 'commit']) plugins.register_u...
null
hangupsbot/plugins/github.py
github.py
py
6,392
python
en
code
null
code-starcoder2
83
[ { "api_name": "plugins.register_admin_command", "line_number": 13, "usage_type": "call" }, { "api_name": "plugins.register_user_command", "line_number": 14, "usage_type": "call" }, { "api_name": "urllib.parse.quote", "line_number": 28, "usage_type": "call" }, { "a...
80055497
import game_settings as gs import numpy as np import random from readchar import readchar import time replay = True lost = False score = 0 print("\n" + ("*"*35)) print("Python Guessing Game.\n\nContinue by pressing any key...") print("\n" + ("*"*35)) readchar() while replay: guess_count = 0 print("\nGame S...
null
main_game.py
main_game.py
py
2,458
python
en
code
null
code-starcoder2
83
[ { "api_name": "readchar.readchar", "line_number": 14, "usage_type": "call" }, { "api_name": "game_settings.game_start", "line_number": 22, "usage_type": "call" }, { "api_name": "game_settings.get_game_word", "line_number": 23, "usage_type": "call" }, { "api_name":...
644042012
import sys import os import pandas as pd import argparse parser = argparse.ArgumentParser() parser.add_argument("-d", "--dof", type=str, help="DOF file", required=True) parser.add_argument("-i", "--inputdir", type=str, help="Inputdir", required=True) parser.add_argument("-o", "--outputfile", type=str, help="Output f...
null
PileupMC/joinStripWeights.py
joinStripWeights.py
py
909
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 6, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 15, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 25, "usage_type": "call" }, { "api_name": "pandas.concat"...
66416233
# SANDBOX # FLASK from flask import Flask, request, redirect, url_for, Response import re import docx2html import os from werkzeug.utils import secure_filename app_instructions = """ <br> <h2>FORMATTING</h2> <ul> <li> for each chunk of content, use hashtag "#" and the type of block in caps (INSTRUCTION, TIP, CHINESE...
null
apps/post_parser/post_parser_web_app.py
post_parser_web_app.py
py
14,869
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Flask", "line_number": 101, "usage_type": "call" }, { "api_name": "flask.request.method", "line_number": 123, "usage_type": "attribute" }, { "api_name": "flask.request", "line_number": 123, "usage_type": "name" }, { "api_name": "flask.request....
107805310
from __future__ import print_function import json import datetime import time import boto3 print('Loading function') def lambda_handler(event, context): AUTO_SCALLING_GROUP = 'Hayes-Test-ASG' LC = 'LC-micro' print("Received event: " + json.dumps(event, indent=2)) # get autoscaling client clien...
null
4-lc-sg-lambda-update-one.py
4-lc-sg-lambda-update-one.py
py
1,039
python
en
code
null
code-starcoder2
83
[ { "api_name": "json.dumps", "line_number": 15, "usage_type": "call" }, { "api_name": "boto3.client", "line_number": 18, "usage_type": "call" } ]
384104947
#task_master.py import random,time,queue,threading from multiprocessing.managers import BaseManager from multiprocessing import freeze_support from task_worker import worker task_queue=queue.Queue() result_queue=queue.Queue() class QueueManager(BaseManager): pass def task_q(): return task_queue def result_...
null
task_master.py
task_master.py
py
1,165
python
en
code
null
code-starcoder2
83
[ { "api_name": "queue.Queue", "line_number": 8, "usage_type": "call" }, { "api_name": "queue.Queue", "line_number": 9, "usage_type": "call" }, { "api_name": "multiprocessing.managers.BaseManager", "line_number": 12, "usage_type": "name" }, { "api_name": "random.ran...
288536244
"""Train (basic) densely-connected oracle.""" import os import time import multiprocessing as mp import pandas as pd import torch from torch import optim from torch.utils.data import DataLoader, Subset, TensorDataset, WeightedRandomSampler from profit.dataset.splitters import split_method_dict from profit.models.to...
null
examples/gb1/train_oracle.py
train_oracle.py
py
5,919
python
en
code
null
code-starcoder2
83
[ { "api_name": "time.strftime", "line_number": 23, "usage_type": "call" }, { "api_name": "time.gmtime", "line_number": 23, "usage_type": "call" }, { "api_name": "torch.device", "line_number": 24, "usage_type": "call" }, { "api_name": "torch.cuda.is_available", ...
233337743
# The second file for exploratory modelling as the first one got over-written #Import relevant libraries import pandas as pd import os import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.ensemble import RandomForestClassifier from sklearn.externals import joblib from sklearn.model_sel...
null
Exploratory_Modelling_2.py
Exploratory_Modelling_2.py
py
12,669
python
en
code
null
code-starcoder2
83
[ { "api_name": "pandas.options", "line_number": 20, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 24, "usage_type": "call" }, { "api_name": "os.path", "line_number": 24, "usage_type": "attribute" }, { "api_name": "os.getcwd", "line_n...
112534418
#!/usr/bin/python # -*- coding:utf-8 -*- import sys sys.path.append(r'../lib') import epd1in54 import epdconfig import time from PIL import Image,ImageDraw,ImageFont import traceback try: print("epd1in54 Demo") epd = epd1in54.EPD() print("init and Clear") epd.init(epd.lut_full_update) epd.Cle...
null
python3/test_demo/python3/examples/epd_1in54_test.py
epd_1in54_test.py
py
2,573
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.path.append", "line_number": 4, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 4, "usage_type": "attribute" }, { "api_name": "epd1in54.EPD", "line_number": 15, "usage_type": "call" }, { "api_name": "PIL.Image.new", "line_nu...
595530228
import os import sqlite3 conn = sqlite3.connect('programs.db') cursor = conn.cursor() try: cursor.execute('''CREATE TABLE programs(file text, way text) ''') except sqlite3.OperationalError: pass def add(file, way): cursor.execute("INSERT INTO programs (file,way) VALUES ('%s','%s')"%(file,way)) conn.commit() def o...
null
main.py
main.py
py
751
python
en
code
null
code-starcoder2
83
[ { "api_name": "sqlite3.connect", "line_number": 4, "usage_type": "call" }, { "api_name": "sqlite3.OperationalError", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.startfile", "line_number": 19, "usage_type": "call" } ]
6253659
import numpy as np import cv2 colors = { 'green': (0, 255, 0), 'pink': (255, 0, 255), 'blue': (0, 0, 255) } def get_calibration_cam_to_image(cab_f): for line in open(cab_f): if 'P2:' in line: cam_to_img = line.strip().split(' ') cam_to_img = np.asarray([float(number) for ...
null
draw_3dbox.py
draw_3dbox.py
py
3,442
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.asarray", "line_number": 12, "usage_type": "call" }, { "api_name": "numpy.reshape", "line_number": 13, "usage_type": "call" }, { "api_name": "numpy.pi", "line_number": 31, "usage_type": "attribute" }, { "api_name": "numpy.arctan", "line_nu...
585795105
"""Database module This module declares Database Models of User and Group Resources. User Resource is internally stored in User class object. Group Resource is internally stored in Group class object. db, an instance of SQLAlchemy from Flask-SQLAlchemy is declared here and is initialized in Application Factory funct...
null
appusers/database.py
database.py
py
8,719
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask_sqlalchemy.SQLAlchemy", "line_number": 26, "usage_type": "call" }, { "api_name": "sqlalchemy.text", "line_number": 99, "usage_type": "call" }, { "api_name": "sqlalchemy.text", "line_number": 101, "usage_type": "call" }, { "api_name": "sqlalche...
324482778
#!/usr/bin/env python """An ivyprobe script for ivy-python """ import os, string, sys, time, getopt #sys.path.append ("F:\ivy-python-2.1") from ivy.std_api import * from ModeleCompteBon import * from VueCompteBon import * from random import randint #On cree la vue en global root = Tk() app = Application(ro...
null
PILS/Ivy/ivy-python-2.1/IvySniffCompteBon.py
IvySniffCompteBon.py
py
15,853
python
en
code
null
code-starcoder2
83
[ { "api_name": "random.randint", "line_number": 17, "usage_type": "call" }, { "api_name": "os.path.basename", "line_number": 48, "usage_type": "call" }, { "api_name": "os.path", "line_number": 48, "usage_type": "attribute" }, { "api_name": "ivy.ivy.IvyRegexpAdded",...
544666754
# module imports import pygame import gamedefs import math import os # class for player sprite class Blob(pygame.sprite.Sprite): # sprite for the player def __init__(self, x, y): pygame.sprite.Sprite.__init__(self) # get os-independent folder name root_dir = os.path.dirname(__file__) ...
null
blobclass.py
blobclass.py
py
753
python
en
code
null
code-starcoder2
83
[ { "api_name": "pygame.sprite", "line_number": 9, "usage_type": "attribute" }, { "api_name": "pygame.sprite.Sprite.__init__", "line_number": 12, "usage_type": "call" }, { "api_name": "pygame.sprite", "line_number": 12, "usage_type": "attribute" }, { "api_name": "os...
259048315
from elasticsearch import Elasticsearch, helpers import request_rss as rrss import json def createIndex(index_name, mapping_file): with open(mapping_file) as source: mapping = json.load(source) es = Elasticsearch() return es.indices.create(index_name , body = mapping) def putBulk(feed_dict): e...
null
es_config.py
es_config.py
py
865
python
en
code
null
code-starcoder2
83
[ { "api_name": "json.load", "line_number": 7, "usage_type": "call" }, { "api_name": "elasticsearch.Elasticsearch", "line_number": 8, "usage_type": "call" }, { "api_name": "elasticsearch.Elasticsearch", "line_number": 12, "usage_type": "call" }, { "api_name": "elast...
74881622
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('sites', '0001_initial'), ('mezzanine_blocks', '0001_initial'), ] operations = [ mig...
null
mezzanine_blocks/migrations/0002_auto_20150719_2213.py
0002_auto_20150719_2213.py
py
1,797
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.db.migrations.Migration", "line_number": 8, "usage_type": "attribute" }, { "api_name": "django.db.migrations", "line_number": 8, "usage_type": "name" }, { "api_name": "django.db.migrations.CreateModel", "line_number": 16, "usage_type": "call" }, ...
277835100
import pytest from numpy import newaxis, inf, nan from numpy.random import RandomState from numpy.testing import assert_allclose from glimix_core.lmm import LMM from numpy_sugar.linalg import economic_qs_linear def test_lmm_interface(): random = RandomState(0) y = random.randn(4) X = random.randn(5, 2) ...
null
glimix_core/lmm/test/test_lmm_interface.py
test_lmm_interface.py
py
1,355
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.random.RandomState", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy_sugar.linalg.economic_qs_linear", "line_number": 16, "usage_type": "call" }, { "api_name": "pytest.raises", "line_number": 17, "usage_type": "call" }, { "api_...
355627062
import pymysql,logging,os import time import json class amendMoneyApi(): def connectdb(self): # db = pymysql.connect("jintcadev.mysql.rds.aliyuncs.com","huyuanji","RBWfQQOm0foX","bizpay") db = pymysql.connect("121.40.73.49","h5","h5@123","bikeca") return db #修改虚拟卡状态为可用 def querydb(s...
null
mySql/connectMysql.py
connectMysql.py
py
1,623
python
en
code
null
code-starcoder2
83
[ { "api_name": "pymysql.connect", "line_number": 7, "usage_type": "call" } ]
621074452
import argparse import re import os, glob, datetime, time import numpy as np import torch import torch.nn as nn import torch.nn.init as init from torch.utils.data import DataLoader import torch.optim as optim from torch.optim.lr_scheduler import MultiStepLR import data_generator as dg from data_generator import Denois...
null
train/main_train_fourier_sep.py
main_train_fourier_sep.py
py
8,720
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 23, "usage_type": "call" }, { "api_name": "torch.cuda.is_available", "line_number": 34, "usage_type": "call" }, { "api_name": "torch.cuda", "line_number": 34, "usage_type": "attribute" }, { "api_name": "numpy...
628159796
from glob import glob import subprocess import re import dateparser import csv from iso4217 import Currency from itertools import tee from os import path DATE_CLUES = ['statement date', 'as at'] CURRENCIES = set([c.code for c in Currency]) CURRENCY_AMOUNT_REGEX = '({} \d+[\.|,|\d]*\d+)' def parse_statement_date(lin...
null
cleaning/pdf-mining/pdftotxt.py
pdftotxt.py
py
3,389
python
en
code
null
code-starcoder2
83
[ { "api_name": "iso4217.Currency", "line_number": 12, "usage_type": "name" }, { "api_name": "dateparser.parse", "line_number": 20, "usage_type": "call" }, { "api_name": "re.search", "line_number": 32, "usage_type": "call" }, { "api_name": "re.IGNORECASE", "line...
378871116
import torch import torch.nn as nn from utils import intersection_over_union class YOLOloss(nn.Module): def __init__(self): super().__init__() self.mean_sqrt_err = nn.MSELoss() self.bce = nn.BCEWithLogitsLoss() self.entropy = nn.CrossEntropyLoss() self.sigmoid = nn.Sigmoid(...
null
loss.py
loss.py
py
1,631
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 6, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 6, "usage_type": "name" }, { "api_name": "torch.nn.MSELoss", "line_number": 9, "usage_type": "call" }, { "api_name": "torch.nn", "line_numb...
341825250
import engine from pandas import DataFrame from math import e from matplotlib import pyplot as plt def approx(b, x): return 2 / (1+e**(-b*x))-1 def qerror(b, x): return engine.quad_error(approx, b, x) def average_quadratic_error(b): return engine.integrate(qerror, b, 0, 5, 0.01)/5 def graph_error(min, m...
null
src/logarithmic_approx.py
logarithmic_approx.py
py
1,195
python
en
code
null
code-starcoder2
83
[ { "api_name": "math.e", "line_number": 7, "usage_type": "name" }, { "api_name": "engine.quad_error", "line_number": 10, "usage_type": "call" }, { "api_name": "engine.integrate", "line_number": 13, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.plot", ...
486426982
import os import re import sys import json import urllib # figure out where we'll be making the build for line in open( "SConstruct" ).readlines() : if re.search( "gaffer[A-Za-z]*Version = ", line ) : exec( line.strip() ) platform = "osx" if sys.platform == "darwin" else "linux" buildDir = "build/gaffer-%d.%d.%...
null
config/travis/installDependencies.py
installDependencies.py
py
1,019
python
en
code
null
code-starcoder2
83
[ { "api_name": "re.search", "line_number": 10, "usage_type": "call" }, { "api_name": "sys.platform", "line_number": 13, "usage_type": "attribute" }, { "api_name": "json.load", "line_number": 19, "usage_type": "call" }, { "api_name": "urllib.urlopen", "line_numb...
4143864
from django.conf.urls import url from . import views app_name = 'general' urlpatterns = [ url(r'^$', view=views.index, name='index'), url(r'^construction/', view=views.construction, name='construction'), url(r'^contact/', view=views.contact, name='contact'), url(r'^login$', view=views.log...
null
apps/general/urls.py
urls.py
py
400
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.conf.urls.url", "line_number": 8, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 9, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 10, "usage_type": "call" }, { "api_name": "django.c...
209348806
import itertools import pytest import main def test_update(): config = { 'ginger': { 'django': 2, 'flask': 3, }, 'cucumber': { 'flask': 1, }, } main.update(config, 'pylons', 7) assert config == { 'ginger': { 'djang...
null
test.py
test.py
py
1,385
python
en
code
null
code-starcoder2
83
[ { "api_name": "main.update", "line_number": 16, "usage_type": "call" }, { "api_name": "main.update", "line_number": 36, "usage_type": "call" }, { "api_name": "main.update", "line_number": 37, "usage_type": "call" }, { "api_name": "itertools.permutations", "lin...
341060032
import numpy as np from tools import add_intercept def predict_(x, theta) -> np.ndarray: """Computes the vector of prediction y_hat from two non-empty numpy.ndarray. Args: x: has to be an numpy.ndarray, a vector of dimension m * 1. theta: has to be an numpy.ndarray, a vector of dimension 2 * 1. Returns: y_hat a...
null
day00/ex07/prediction.py
prediction.py
py
890
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.matmul", "line_number": 18, "usage_type": "call" }, { "api_name": "tools.add_intercept", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.ndarray", "line_number": 4, "usage_type": "attribute" }, { "api_name": "numpy.arange", ...
69235868
# coding: utf-8 import os import time import random import logging import argparse import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torchvision import datasets from torch.autograd import Variable from lr_scheduler import * from model import * from da...
null
main.py
main.py
py
4,673
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.manual_seed", "line_number": 24, "usage_type": "call" }, { "api_name": "torch.cuda.manual_seed", "line_number": 25, "usage_type": "call" }, { "api_name": "torch.cuda", "line_number": 25, "usage_type": "attribute" }, { "api_name": "numpy.random...
175654195
#!/usr/bin/env python3 # Evaluate relation annotations in standoff data. import sys import os from collections import defaultdict from logging import error # Relation types to treat as symmetric SYMMETRIC_RELATION_TYPES = set([ 'Complex_formation' ]) def argparser(): from argparse import ArgumentParser ...
null
TensorFlow/LanguageModeling/BERT/evalsorel.py
evalsorel.py
py
13,976
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 20, "usage_type": "call" }, { "api_name": "logging.error", "line_number": 261, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 289, "usage_type": "call" }, { "api_name": "os.path.splitext",...