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
119121275
import torch as tr import torch.nn.functional as F import numpy as np import sklearn.metrics class Net(tr.nn.Module): """ computation graph of Prototypical Network """ def __init__(self,nn_config,**kwargs): super(Net,self).__init__() self.nn_config = nn_config in_dim = self.nn_c...
null
u6068252_code/experiment2/super_proto_linear.py
super_proto_linear.py
py
9,201
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn", "line_number": 6, "usage_type": "attribute" }, { "api_name": "torch.nn.Linear", "line_number": 15, "usage_type": "call" }, { "api_name": "torch.nn", "line_number": 15, "usage_type": "attribute" }, { "api_name": "torch.nn.Parameter", "...
390431899
import zmq_connections import argparse ports = [5000, 5001, 5002, 5003, 5004, 5005, 5006] class General(object): def __init__(self, istraitor=0): self.node_id = 0 self.istraitor = istraitor ports.pop(self.node_id) self.socket, self.context = zmq_connections.req_conn...
null
general.py
general.py
py
2,486
python
en
code
null
code-starcoder2
76
[ { "api_name": "zmq_connections.req_connection", "line_number": 14, "usage_type": "call" }, { "api_name": "argparse.ArgumentParser", "line_number": 60, "usage_type": "call" } ]
163478719
from django.conf.urls import url from . import views urlpatterns = [ url(r'^index/$', views.index,name='index'), url(r'^register/$', views.register,name='register'), url(r'^logins/$', views.logins,name='logins'), url(r'^logouts/$', views.logouts,name='logouts'), url(r'^reg_email/$', views.reg_emai...
null
TB/users/urls.py
urls.py
py
1,024
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.conf.urls.url", "line_number": 6, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 7, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 8, "usage_type": "call" }, { "api_name": "django.co...
182753977
import pandas as pd import cv2 import numpy as np import lib.draw as draw def match_two_groups(g1, g2, max_pos_bias): assert g1.iloc[0]['alignment_in_group'] == g2.iloc[0]['alignment_in_group'] alignment = g1.iloc[0]['alignment_in_group'] match_num = 0 pairs = {} for i in range(len(g1)): ...
null
lib/pairing.py
pairing.py
py
4,061
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.full", "line_number": 59, "usage_type": "call" }, { "api_name": "lib.draw.visualize", "line_number": 101, "usage_type": "call" }, { "api_name": "lib.draw", "line_number": 101, "usage_type": "name" }, { "api_name": "lib.draw.visualize_block", ...
17710209
import numpy as np from scipy.special import gamma import matplotlib.pyplot as plt from random import shuffle ''' def likelihood(dataset): res = 1 mu = np.sum(dataset[dataset==1])/dataset.shape[0] for x in dataset: res *= ((mu**x) * ((1-mu)**(1-x))) return res ''' def bet...
null
A1 - Prior to posterior probability/assignment1.py
assignment1.py
py
2,338
python
en
code
null
code-starcoder2
76
[ { "api_name": "scipy.special.gamma", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.ndarray", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.random.seed", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.random", ...
474649373
# uncompyle6 version 3.7.4 # Python bytecode 2.4 (62061) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: build/bdist.linux-i686/egg/iw/recipe/backup/tests/test_docs.py # Compiled at: 2009-11-25 08:12:06 """ Doctest runner for 'iw.recipe.backup'. """ __docformat__ = ...
null
pycfiles/iw.recipe.backup-0.2.1-py2.4/test_docs.py
test_docs.py
py
1,252
python
en
code
null
code-starcoder2
76
[ { "api_name": "zope.testing.doctest.ELLIPSIS", "line_number": 13, "usage_type": "attribute" }, { "api_name": "zope.testing.doctest", "line_number": 13, "usage_type": "name" }, { "api_name": "zope.testing.doctest.NORMALIZE_WHITESPACE", "line_number": 13, "usage_type": "att...
403085611
import os import pprint import pickle class Writer: def __init__(self, block_ips_to_offsets, block_offsets_to_ips): self.block_ips_to_offset = block_ips_to_offsets self.block_offsets_to_ips = block_offsets_to_ips def save(self, filename): pickle.dump([self.block_ips_to_offset, self.blo...
null
pyipttool/cache.py
cache.py
py
4,232
python
en
code
null
code-starcoder2
76
[ { "api_name": "pickle.dump", "line_number": 11, "usage_type": "call" }, { "api_name": "pickle.load", "line_number": 16, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 58, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": ...
168494165
import boto3 from collections import Counter import time s3 = boto3.resource('s3') dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('SongIndexToId') bucket = s3.Bucket('million-song-dataset-yizhou') prefix = "s3://million-song-dataset-yizhou/" fileList = [] for obj in bucket.objects.filter( Prefix='TasteP...
null
Recommend/putSongIndex.py
putSongIndex.py
py
4,858
python
en
code
null
code-starcoder2
76
[ { "api_name": "boto3.resource", "line_number": 5, "usage_type": "call" }, { "api_name": "boto3.resource", "line_number": 6, "usage_type": "call" }, { "api_name": "time.time", "line_number": 41, "usage_type": "call" }, { "api_name": "time.time", "line_number": ...
344600329
import sys import os import time import logging import inspect import multiprocessing from pymedimage.notifications import pushNotification from abc import ABCMeta, abstractmethod # initialize module logger logger = logging.getLogger(__name__) class MultiprocessManagerBase: """Base class for multiprocessing with ...
null
pymedimage/multiprocess_manager.py
multiprocess_manager.py
py
5,957
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 11, "usage_type": "call" }, { "api_name": "abc.ABCMeta", "line_number": 15, "usage_type": "name" }, { "api_name": "multiprocessing.cpu_count", "line_number": 16, "usage_type": "call" }, { "api_name": "abc.abstractm...
635112185
import sys import redis from multiprocessing import Pool import ray import json import os ray.init() print('''This cluster consists of {} nodes in total {} CPU resources in total '''.format(len(ray.nodes()), ray.cluster_resources()['CPU'])) @ray.remote def process(program): print(program) r = redi...
null
experiments/check_stability/get_patterns.py
get_patterns.py
py
2,748
python
en
code
null
code-starcoder2
76
[ { "api_name": "ray.init", "line_number": 9, "usage_type": "call" }, { "api_name": "ray.nodes", "line_number": 15, "usage_type": "call" }, { "api_name": "ray.cluster_resources", "line_number": 15, "usage_type": "call" }, { "api_name": "redis.Redis", "line_numbe...
122774315
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 21 23:00:06 2020 @author: shantanu """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.linear_model import Ridge,LinearRegression,LassoLars, Lasso, ElasticNet from sklearn.neighbors import K...
null
adv_algos.py
adv_algos.py
py
9,998
python
en
code
null
code-starcoder2
76
[ { "api_name": "hyperopt.hp.choice", "line_number": 40, "usage_type": "call" }, { "api_name": "hyperopt.hp", "line_number": 40, "usage_type": "name" }, { "api_name": "hyperopt.hp.choice", "line_number": 41, "usage_type": "call" }, { "api_name": "hyperopt.hp", "...
428991158
import torch import torch.nn as nn import torch.nn.functional as F from torchvision.utils import * def passthrough(x): return x def ELUCons(elu, nchan): if elu: return nn.ELU(inplace=True) else: return nn.PReLU(nchan) class LUConv(nn.Module): def __init__(self, nchan, elu,dilation=1,...
null
model2.py
model2.py
py
8,970
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn.ELU", "line_number": 12, "usage_type": "call" }, { "api_name": "torch.nn", "line_number": 12, "usage_type": "name" }, { "api_name": "torch.nn.PReLU", "line_number": 14, "usage_type": "call" }, { "api_name": "torch.nn", "line_number": 14...
426945975
import decimal import regex import ast import logging import json from datetime import datetime from dotted.collection import DottedDict def search_json(json_data, key): """Search for dot notation in json If ALL or ANY are included in the search path, then we will return a list of matching items. For exa...
null
framework/features/steps/step_library/framework/general/src/jsons.py
jsons.py
py
4,850
python
en
code
null
code-starcoder2
76
[ { "api_name": "dotted.collection.DottedDict", "line_number": 39, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 42, "usage_type": "name" }, { "api_name": "json.dumps", "line_number": 47, "usage_type": "call" }, { "api_name": "dotted.coll...
151304571
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from typing import Optional from azure.ai.ml._restclient.v2023_04_01_preview.models import NlpFixedParameters as RestNlpFixedParameters fro...
null
sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/automl/nlp/nlp_fixed_parameters.py
nlp_fixed_parameters.py
py
3,476
python
en
code
null
code-starcoder2
76
[ { "api_name": "azure.ai.ml.entities._mixins.RestTranslatableMixin", "line_number": 10, "usage_type": "name" }, { "api_name": "typing.Optional", "line_number": 16, "usage_type": "name" }, { "api_name": "typing.Optional", "line_number": 17, "usage_type": "name" }, { ...
532597502
import amino import database import datetime import requests import hashlib import random import uuid import os import io IS_ON = False IS_SENSITIVE = False client = amino.Client() activity_modules = { "registering": {}, "online": [], "blog_developing": {} } image_flags = {} message_handlers = [] superu...
null
main.py
main.py
py
29,704
python
en
code
null
code-starcoder2
76
[ { "api_name": "amino.Client", "line_number": 13, "usage_type": "call" }, { "api_name": "amino.socket", "line_number": 30, "usage_type": "attribute" }, { "api_name": "database.session.query", "line_number": 42, "usage_type": "call" }, { "api_name": "database.sessio...
440977944
""" Copyright 2018 Goldman Sachs. 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 applicable law or agreed to in writing, software di...
null
gs_quant/test/markets/test_portfolio.py
test_portfolio.py
py
9,883
python
en
code
null
code-starcoder2
76
[ { "api_name": "gs_quant.session.OAuth2Session.init", "line_number": 32, "usage_type": "attribute" }, { "api_name": "gs_quant.session.OAuth2Session", "line_number": 32, "usage_type": "name" }, { "api_name": "unittest.mock.MagicMock", "line_number": 32, "usage_type": "call"...
3134503
"""Test :class:`qibo.core.circuit.Circuit` for density matrix and noise simulation.""" import numpy as np import pytest import qibo from qibo import K, gates from qibo.models import Circuit def test_pauli_noise_channel(backend): from qibo import matrices c = Circuit(2, density_matrix=True) c.add(gates.H(0...
null
src/qibo/tests/test_core_circuit_noise.py
test_core_circuit_noise.py
py
5,794
python
en
code
null
code-starcoder2
76
[ { "api_name": "qibo.models.Circuit", "line_number": 11, "usage_type": "call" }, { "api_name": "qibo.gates.H", "line_number": 12, "usage_type": "call" }, { "api_name": "qibo.gates", "line_number": 12, "usage_type": "name" }, { "api_name": "qibo.gates.H", "line_...
290864969
import numpy as np import cv2 import sys faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') cap = cv2.VideoCapture(0) while(True): # Capture frame-by-frame ret, frame = cap.read() # Our operations on the frame come here heatMap = cv2.applyColorMap(frame,cv2.COLORMAP_JET) ...
null
hello.py
hello.py
py
1,058
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.CascadeClassifier", "line_number": 6, "usage_type": "call" }, { "api_name": "cv2.VideoCapture", "line_number": 7, "usage_type": "call" }, { "api_name": "cv2.applyColorMap", "line_number": 14, "usage_type": "call" }, { "api_name": "cv2.COLORMAP_J...
187305670
import requests from bs4 import BeautifulSoup BASE_URL = 'http://cmmcd.com/PokemonGo/' def get_pokengo_server_status(): try: r = requests.get(BASE_URL) if r.status_code != 200: return "Online!" soup = BeautifulSoup( r.text, 'html.parser' ) return soup.bod...
null
PokemonGoClient.py
PokemonGoClient.py
py
379
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 9, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 14, "usage_type": "call" } ]
586736443
import unittest import mock import os from .device_mocks.ios import send_command, send_command_expect from pyntc.devices.base_device import RollbackError from pyntc.devices import IOSDevice from pyntc.devices.ios_device import FileTransferError from pyntc.errors import CommandError, CommandListError, NTCFileNotFoundEr...
null
test/unit/test_devices/test_ios_device.py
test_ios_device.py
py
14,801
python
en
code
null
code-starcoder2
76
[ { "api_name": "unittest.TestCase", "line_number": 16, "usage_type": "attribute" }, { "api_name": "pyntc.devices.IOSDevice", "line_number": 21, "usage_type": "call" }, { "api_name": "device_mocks.ios.send_command", "line_number": 23, "usage_type": "name" }, { "api_...
616813745
from bs4 import BeautifulSoup import requests import json ##################################### # SCRAPING # ##################################### genreDict = {} url = "https://en.m.wikipedia.org/wiki/List_of_music_styles" r = requests.get(url) soup = BeautifulSoup(r.content) # this finds all...
null
scripts/wiki-scrape.py
wiki-scrape.py
py
2,227
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 10, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 11, "usage_type": "call" }, { "api_name": "json.dump", "line_number": 52, "usage_type": "call" } ]
456056531
#!/usr/bin/env python import threading, logging, time import multiprocessing from kafka import KafkaConsumer import json class Consumer(multiprocessing.Process): def __init__(self): # key as the stock symbol, value as a tuple two, left is the average, right is the total count self.data = {} ...
null
dockercompose/consumer/consumer.py
consumer.py
py
1,714
python
en
code
null
code-starcoder2
76
[ { "api_name": "multiprocessing.Process", "line_number": 7, "usage_type": "attribute" }, { "api_name": "threading.Event", "line_number": 11, "usage_type": "call" }, { "api_name": "multiprocessing.Process.__init__", "line_number": 12, "usage_type": "call" }, { "api_...
380119188
# -*- coding: utf-8 -*- """ Potassium Analysis Loads SQL File and creates a DF from both telepath systems Created on Tue Dec 24 11:44:15 2019 @author: Craig Webster """ import pyodbc import pandas as pd # Connect to datasource conn = pyodbc.connect('DSN=QE Telepath', autocommit=True) conn1 = pyodbc.con...
null
potassium.py
potassium.py
py
817
python
en
code
null
code-starcoder2
76
[ { "api_name": "pyodbc.connect", "line_number": 14, "usage_type": "call" }, { "api_name": "pyodbc.connect", "line_number": 15, "usage_type": "call" }, { "api_name": "pandas.read_sql", "line_number": 23, "usage_type": "call" }, { "api_name": "pandas.read_sql", "...
38010870
#!/usr/bin/python3 # -*- encoding: utf-8 -*- ''' File: ngmainwin.py Description: NgMainWin definition Change History: 2018-1-19 v0.1 created. github/zhenggao2 ''' from PyQt5.QtWidgets import QMainWindow, QAction, QMenu, QTabWidget, QTextEdit, QMessageBox from PyQt5.QtWidgets import qApp, QApplicat...
null
ngmainwin.py
ngmainwin.py
py
6,615
python
en
code
null
code-starcoder2
76
[ { "api_name": "PyQt5.QtWidgets.QMainWindow", "line_number": 28, "usage_type": "name" }, { "api_name": "PyQt5.QtWidgets.QTabWidget", "line_number": 32, "usage_type": "call" }, { "api_name": "PyQt5.QtWidgets.QTextEdit", "line_number": 34, "usage_type": "call" }, { "...
397816940
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import cloudinary.models class Migration(migrations.Migration): dependencies = [ ('videos', '0001_initial'), ] operations = [ migrations.AlterField( model_name='contentty...
null
videos/migrations/0002_auto_20150812_1621.py
0002_auto_20150812_1621.py
py
658
python
en
code
null
code-starcoder2
76
[ { "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.AlterField", "line_number": 15, "usage_type": "call" }, {...
535604947
import numpy as np from sklearn import datasets def sign(x): return 1 if x >= 0 else -1 ''' 函数功能: 数据加载函数,使用sklearn中的乳腺癌数据集。其中data标签对应的是数据的特征,target是分类的标签。 因为target中的分类标签是0和1的,而感知机的分类集是1和-1,所以通过numpy的bool索引筛选之后在转化 输入参数: 无 返回数据: features:表示数据样本的特征值,一个二维的array。 labels:表示数据样本的分类标签,一个一维的array。 ''' ...
null
Chapter02_Perceptron/src/perceptron.py
perceptron.py
py
3,941
python
en
code
null
code-starcoder2
76
[ { "api_name": "sklearn.datasets.load_breast_cancer", "line_number": 24, "usage_type": "call" }, { "api_name": "sklearn.datasets", "line_number": 24, "usage_type": "name" }, { "api_name": "numpy.zeros", "line_number": 44, "usage_type": "call" }, { "api_name": "nump...
551122571
from ase.calculators.calculator import Calculator class OnlineMLP(Calculator): def __init__(self, restart=None, label=None, atoms=None, directory='.', **kwargs): """Basic calculator implementation. restart: str ...
null
learn-onlineML/test_ase_md/oml_ase_calc.py
oml_ase_calc.py
py
1,149
python
en
code
null
code-starcoder2
76
[ { "api_name": "ase.calculators.calculator.Calculator", "line_number": 4, "usage_type": "name" }, { "api_name": "ase.calculators.calculator.Calculator", "line_number": 28, "usage_type": "argument" } ]
437724659
from django.urls import path from . import views urlpatterns = [ path("registerLawyer", views.registerLawyer,name='registerLawyer'), path("registerClient",views.registerClient,name='registerClient'), path("login",views.login,name='login'), path("logout",views.logout,name='logout'), ]
null
accounts/urls.py
urls.py
py
302
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.urls.path", "line_number": 6, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 7, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 8, "usage_type": "call" }, { "api_name": "django.urls.path", ...
347420889
from django.http import HttpResponse from django.shortcuts import render, get_object_or_404, redirect from django.contrib.auth.decorators import login_required from .models import Task from .forms import TaskForm from django.contrib import messages from django.core.paginator import Paginator # Create your views here. ...
null
tasks/views.py
views.py
py
3,041
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.http.HttpResponse", "line_number": 14, "usage_type": "call" }, { "api_name": "models.Task.objects.filter", "line_number": 21, "usage_type": "call" }, { "api_name": "models.Task.objects", "line_number": 21, "usage_type": "attribute" }, { "api_...
512308474
import warnings warnings.simplefilter("ignore", UserWarning) warnings.simplefilter("ignore", FutureWarning) warnings.simplefilter("ignore", DeprecationWarning) from sklearn.metrics import accuracy_score import tensorflow as tf from tensorflow.keras import backend as K import os import json import pickle from tensorflow...
null
fed_av_algo.py
fed_av_algo.py
py
9,819
python
en
code
null
code-starcoder2
76
[ { "api_name": "warnings.simplefilter", "line_number": 2, "usage_type": "call" }, { "api_name": "warnings.simplefilter", "line_number": 3, "usage_type": "call" }, { "api_name": "warnings.simplefilter", "line_number": 4, "usage_type": "call" }, { "api_name": "pickle...
277409703
import cv2 cap = cv2.VideoCapture('../DATA/finger_move.mp4') width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(cap.get(cv2.CAP_PROP_FRAME_HIGHT)) # Top left corner x = width // 2 # allows integer y = height // 2 # width and height of rectangle w = width // 4 h = height // 4 # bottom right corner while ...
null
opencv/opencv-code/video-basics/drawing-on-video.py
drawing-on-video.py
py
556
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.VideoCapture", "line_number": 3, "usage_type": "call" }, { "api_name": "cv2.CAP_PROP_FRAME_WIDTH", "line_number": 5, "usage_type": "attribute" }, { "api_name": "cv2.CAP_PROP_FRAME_HIGHT", "line_number": 6, "usage_type": "attribute" }, { "api_nam...
380913545
from django.http import HttpResponse from django.template import RequestContext, loader from smdb.models import * def index(request): small_molecules = [] sms = SmallMolecule.objects.all() species_list = [] for sm in sms: sm_map = {} sm_map['object'] = sm sm_map['species'] = [stu.species for stu in sm.study...
null
smdb/views.py
views.py
py
1,423
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.template.loader.get_template", "line_number": 15, "usage_type": "call" }, { "api_name": "django.template.loader", "line_number": 15, "usage_type": "name" }, { "api_name": "django.template.RequestContext", "line_number": 16, "usage_type": "call" }, ...
283503708
from timeit import default_timer as timer from django.conf import settings from django.http import Http404, HttpResponseBadRequest from django.shortcuts import redirect from main import models def host_middleware(get_response): def middleware(request): host = request.META.get("HTTP_HOST") # no ...
null
main/middleware.py
middleware.py
py
3,139
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.conf.settings.CANONICAL_HOST.split", "line_number": 19, "usage_type": "call" }, { "api_name": "django.conf.settings.CANONICAL_HOST", "line_number": 19, "usage_type": "attribute" }, { "api_name": "django.conf.settings", "line_number": 19, "usage_type"...
588914731
import requests import sys from PyQt5.QtWidgets import QWidget, QApplication , QPushButton, QGridLayout , QLabel import matplotlib.pyplot as plt from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from bs4 import BeautifulSoup import numpy as np req = requests.get('http://www.inven.co.kr/b...
null
ChartInQt.py
ChartInQt.py
py
2,875
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 9, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 11, "usage_type": "call" }, { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 25, "usage_type": "name" }, { "api_name": "PyQt5.QtWidgets...
644360780
import json from django.http import HttpResponse from django.shortcuts import render # 序列化 ---- 生成json数据 # 反序列化 ----- 解析json数据 from home.models import Product, ProductImage, Category, CategorySub, Banner, BaseModel def index(request): return render(request, 'index.html', {}) def get_head_data(request): ...
null
home/views.py
views.py
py
2,847
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.shortcuts.render", "line_number": 12, "usage_type": "call" }, { "api_name": "home.models.Product.objects.filter", "line_number": 56, "usage_type": "call" }, { "api_name": "home.models.Product.objects", "line_number": 56, "usage_type": "attribute" }...
41874975
# -*- coding: utf-8 -*- from accounts.forms import Form_sign_in, Form_sign_up from accounts.models import Profile from django.contrib import messages from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from dja...
null
build/lib/accounts/views.py
views.py
py
2,574
python
en
code
null
code-starcoder2
76
[ { "api_name": "ppcd.common._common", "line_number": 13, "usage_type": "call" }, { "api_name": "accounts.forms.Form_sign_in", "line_number": 15, "usage_type": "call" }, { "api_name": "accounts.forms.Form_sign_in", "line_number": 20, "usage_type": "call" }, { "api_n...
627028507
#!/usr/bin/env python # -*- coding: utf-8 -*- # 本模块测试发布任务以后,任务相关的公共api,包括: # 1. 领取、退回、提交等用户操作; # 2. 重新发布、删除、指派等管理员操作; # 3. 定时回收超时任务等系统操作 from bson.objectid import ObjectId from tests import users as u from tests.testcase import APITestCase from controller import errors as e from controller import helper as hp from dat...
null
tests/task/test_task.py
test_task.py
py
12,389
python
en
code
null
code-starcoder2
76
[ { "api_name": "tests.testcase.APITestCase", "line_number": 18, "usage_type": "name" }, { "api_name": "tests.users.expert1", "line_number": 26, "usage_type": "attribute" }, { "api_name": "tests.users", "line_number": 26, "usage_type": "name" }, { "api_name": "tests...
42698130
# -*- coding:utf-8 -*- #pre-condition: install scrapy: sudo pip3 install sctapy #command: scrapy runspider filename.py -o outputfilename.json import scrapy from shiyanlougithub.items import RepositoryItem class RepositorySpider(scrapy.Spider): name = 'repository' @property def start_urls(self): ...
null
shiyanlougithub/shiyanlougithub/spiders/repository.py
repository.py
py
790
python
en
code
null
code-starcoder2
76
[ { "api_name": "scrapy.Spider", "line_number": 10, "usage_type": "attribute" } ]
111831672
from __future__ import print_function import os import sys import timeit import numpy from collections import defaultdict import theano import theano.tensor as T from scipy.sparse import csc_matrix from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams from theano import sparse from algo.preprocess.dim_...
null
algo/dA.py
dA.py
py
8,439
python
en
code
null
code-starcoder2
76
[ { "api_name": "const.conf.midStepFolder", "line_number": 17, "usage_type": "attribute" }, { "api_name": "const.conf", "line_number": 17, "usage_type": "name" }, { "api_name": "const.conf.midStepFolder", "line_number": 19, "usage_type": "attribute" }, { "api_name":...
397140195
#! /usr/bin/python import numpy as np import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import subprocess as subp import os import timeit import argparse ############################################################# # # # ...
null
25_vf2.0_varying_beta_and_nrand/ellipsoid_analysis.py
ellipsoid_analysis.py
py
10,030
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.use", "line_number": 4, "usage_type": "call" }, { "api_name": "argparse.ArgumentParser", "line_number": 20, "usage_type": "call" }, { "api_name": "subprocess.run", "line_number": 75, "usage_type": "call" }, { "api_name": "timeit.default_t...
180111191
# -*- coding: utf-8 -*- # -----------------------------Импорт модулей----------------------------------- from PyQt5 import QtSql from PyQt5 import QtCore import os import os.path import shutil from PyQt5.QtWidgets import QWidget, QLabel, QVBoxLayout, QFormLayout, QTableWidget, QComboBox, \ QSpinBox, QPushButton, ...
null
forms/system_forms/mirrorMeshDict_y_form.py
mirrorMeshDict_y_form.py
py
13,972
python
en
code
null
code-starcoder2
76
[ { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 16, "usage_type": "name" }, { "api_name": "PyQt5.QtWidgets.QWidget.__init__", "line_number": 18, "usage_type": "call" }, { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 18, "usage_type": "name" }, { "...
411971239
from multiprocessing import Queue from threading import Thread import time def producer(d): print ('start pruducer') for i in range(10): d.put(i) print ('producer to put:',i) time.sleep(0.5) def customer(d): print ('start customer') while 1: data = d.get()...
null
twostr/__init__.py
__init__.py
py
533
python
en
code
null
code-starcoder2
76
[ { "api_name": "time.sleep", "line_number": 10, "usage_type": "call" }, { "api_name": "multiprocessing.Queue", "line_number": 19, "usage_type": "call" }, { "api_name": "threading.Thread", "line_number": 20, "usage_type": "call" }, { "api_name": "threading.Thread", ...
238065799
import cv2 import numpy as np img =cv2.imread('faizan.jpg') # Stroe height and width of the image height ,width =img.shape[:2] # shape is function and print height and width o to 2 index value print(height) print(width) # It means original img devide by any form ,How much img u re see #And quarter is a function whi...
null
Geometric-Image-Transformation/Imagetranslation.py
Imagetranslation.py
py
1,180
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.imread", "line_number": 3, "usage_type": "call" }, { "api_name": "numpy.float32", "line_number": 21, "usage_type": "call" }, { "api_name": "cv2.warpAffine", "line_number": 31, "usage_type": "call" }, { "api_name": "cv2.imshow", "line_number"...
390217714
#constants from flask import Flask, jsonify, abort, request from flask_mongoengine import MongoEngine from flask_cors import CORS import logging import os import datetime as dt from flasgger import Swagger,swag_from from flask_jwt_extended import ( JWTManager, jwt_required, create_access_token, get_jwt_identity, jw...
null
src/app/common/config.py
config.py
py
1,864
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.abspath", "line_number": 16, "usage_type": "call" }, { "api_name": "os.path", "line_number": 16, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 17, "usage_type": "call" }, { "api_name": "os.path", "line_numb...
502149714
import networkx as nx def dfs(g: nx.Graph, curr, parent, distance, lens, start, matris): ans = False if distance == lens: return False for node in g.neighbors(curr): matris[node][curr] += 1 matris[curr][node] += 1 ans2 = dfs(g, node, curr, distance + 1, lens, start, matris)...
null
executables/walk2.py
walk2.py
py
998
python
en
code
null
code-starcoder2
76
[ { "api_name": "networkx.Graph", "line_number": 4, "usage_type": "attribute" }, { "api_name": "networkx.Graph", "line_number": 27, "usage_type": "call" } ]
325989919
# coding: utf-8 # MTMM.00.195 Sissejuhatus finantsmatemaatikasse # 2. kodutöö - Priit Lätt # Impordime edaspidises vajaminevad moodulid: # * `datetime` - kuupäevade formaatimiseks, # * `numpy` - vektorarvutuse jaoks, # * `matplotlib` - jooniste tegemiseks, # * `HTML` - algandmete tabelina kuvamiseks. import date...
null
yl2/sfm_yl2_aktsiahinnad_priit_latt.py
sfm_yl2_aktsiahinnad_priit_latt.py
py
3,520
python
en
code
null
code-starcoder2
76
[ { "api_name": "IPython.display.HTML", "line_number": 42, "usage_type": "call" }, { "api_name": "datetime.date", "line_number": 50, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 53, "usage_type": "call" }, { "api_name": "numpy.array", "lin...
246961534
''' 문제 올해 ACM-ICPC 대전 인터넷 예선에는 총 n개의 팀이 참가했다. 팀은 1번부터 n번까지 번호가 매겨져 있다. 놀랍게도 올해 참가하는 팀은 작년에 참가했던 팀과 동일하다. 올해는 인터넷 예선 본부에서는 최종 순위를 발표하지 않기로 했다. 그 대신에 작년에 비해서 상대적인 순위가 바뀐 팀의 목록만 발표하려고 한다. (작년에는 순위를 발표했다) 예를 들어, 작년에 팀 13이 팀 6 보다 순위가 높았는데, 올해 팀 6이 팀 13보다 순위가 높다면, (6, 13)을 발표할 것이다. 창영이는 이 정보만을 가지고 올해 최종 순위를 만들어보려고 한다. 작년 순...
null
algorithms/source/위상정렬/2.Final rank (3665_topology_sort).py
2.Final rank (3665_topology_sort).py
py
3,950
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.stdin", "line_number": 36, "usage_type": "attribute" }, { "api_name": "collections.deque", "line_number": 98, "usage_type": "call" } ]
372009984
# Module to select an elliptical ROI from an image stack and return a mask from matplotlib.patches import Ellipse from matplotlib.widgets import EllipseSelector import matplotlib.pyplot as plt from pylab import * import numpy as np def draw_ellipse(imagestack): #### Main function to draw ellipse on the stack # Make...
null
roi_ellipse.py
roi_ellipse.py
py
3,146
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.zeros_like", "line_number": 14, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure", "line_number": 19, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 19, "usage_type": "name" }, { "api_name": "matplotli...
580347333
import numpy as np import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import sys import os #label = "1 GeV" filename = sys.argv[1] alldat = np.loadtxt(filename) pts = alldat[:,0] markers=['s', '+', 'd', '.', 'o', '*'] for i, pt in enumerate(np.unique(pts)): dat = alldat[pts==pt] eta = np.ar...
null
scripts/plot_delta_pt.py
plot_delta_pt.py
py
1,655
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.use", "line_number": 3, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 10, "usage_type": "attribute" }, { "api_name": "numpy.loadtxt", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.unique", "line_nu...
389785329
from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth.models import User from django.contrib import auth from .models import Blog from django.utils import timezone def signup(request): if request.method == "POST": if request.POST['password1'] == request.POST['password2'...
null
main/views.py
views.py
py
5,550
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.contrib.auth.models.User.objects.create_user", "line_number": 11, "usage_type": "call" }, { "api_name": "django.contrib.auth.models.User.objects", "line_number": 11, "usage_type": "attribute" }, { "api_name": "django.contrib.auth.models.User", "line_numb...
127415912
# A module with functions for testing models # ------------------------------------------------------------------------------------------------------ # Imports import numpy as np from statistics import mean, pstdev, StatisticsError # -----------------------------------------------------------------------------------...
null
Scripts/Regressors/test_harness.py
test_harness.py
py
6,863
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.where", "line_number": 27, "usage_type": "call" }, { "api_name": "numpy.where", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.unique", "line_number": 29, "usage_type": "call" }, { "api_name": "numpy.concatenate", "line_nu...
306509855
import scipy from bayesdend.rec_model.rec_model_util import * from bayesdend.rec_model.spikes import * from tensorflow.contrib.distributions import BernoulliWithSigmoidProbs class SOMA_VIMCO(Spikes): """ Soma sample-based model. """ def __init__(self, Nb, *args, **kwargs): super().__init__(*a...
null
bayesdend/rec_model/soma_vimco.py
soma_vimco.py
py
1,949
python
en
code
null
code-starcoder2
76
[ { "api_name": "tensorflow.contrib.distributions.BernoulliWithSigmoidProbs", "line_number": 27, "usage_type": "call" }, { "api_name": "scipy.special.logit", "line_number": 31, "usage_type": "call" }, { "api_name": "scipy.special", "line_number": 31, "usage_type": "attribut...
653181127
import json import os import sys from apimgt import swagger from policy import policy_engine from utils import utils __author__ = 'hiranya' __email__ = 'hiranya@cs.ucsb.edu' class Eager: """ Eager class is the main entry point to the AppScale Eager implementation. An instance of this class can be used to perf...
null
Eager/eager.py
eager.py
py
8,161
python
en
code
null
code-starcoder2
76
[ { "api_name": "utils.utils.get_secret", "line_number": 34, "usage_type": "call" }, { "api_name": "utils.utils", "line_number": 34, "usage_type": "name" }, { "api_name": "os.path.dirname", "line_number": 35, "usage_type": "call" }, { "api_name": "os.path", "lin...
343942397
from scipy.io import loadmat import glob import re import os.path from ntpath import basename from data_gen.data_gen_utils import * class LSP_dataset(DataGen): image_dir, joint_file = "lspet/images", "lspet/joints.mat" transpose_order = (2, 0, 1) def _load_image_joints(self): """ The file...
null
src/data_gen/lsp_datgen.py
lsp_datgen.py
py
1,387
python
en
code
null
code-starcoder2
76
[ { "api_name": "scipy.io.loadmat", "line_number": 23, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 28, "usage_type": "call" }, { "api_name": "os.path.path.join", "line_number": 28, "usage_type": "call" }, { "api_name": "os.path.path", "line...
178829379
import csv import numpy as np import math import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties np.set_printoptions(precision=15,linewidth=105,threshold=34) np.random.seed(2) addressList = [] TEST_TRAIN_SET_NUMBER = 4 # This number corresponds to which testing/training data set needs to ...
null
Trevin/TestingVsTrainingAnalysis/PlotMismatch_dB.py
PlotMismatch_dB.py
py
5,654
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.set_printoptions", "line_number": 7, "usage_type": "call" }, { "api_name": "numpy.random.seed", "line_number": 8, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 8, "usage_type": "attribute" }, { "api_name": "csv.reader", ...
135790345
from django.contrib import admin from mptt.admin import MPTTModelAdmin from .models import Issue, Place, Priority, Skill @admin.register(Place) class PlaceAdmin(MPTTModelAdmin): list_display = ('title', ) search_fields = ('title', ) @admin.register(Skill) class SkillAdmin(admin.ModelAdmin): list_display...
null
upkeep/admin.py
admin.py
py
744
python
en
code
null
code-starcoder2
76
[ { "api_name": "mptt.admin.MPTTModelAdmin", "line_number": 7, "usage_type": "name" }, { "api_name": "django.contrib.admin.register", "line_number": 6, "usage_type": "call" }, { "api_name": "models.Place", "line_number": 6, "usage_type": "argument" }, { "api_name": ...
238615061
from typing import Generator from database import LocalSession # noinspection PyUnboundLocalVariable def get_db() -> Generator: """ Provides with a database dependency, closes connection after endpoint has completed """ try: db = LocalSession() yield db finally: db.close()
null
backend/api/dependencies.py
dependencies.py
py
313
python
en
code
null
code-starcoder2
76
[ { "api_name": "database.LocalSession", "line_number": 10, "usage_type": "call" }, { "api_name": "typing.Generator", "line_number": 7, "usage_type": "name" } ]
351163117
from flask import Blueprint, jsonify, request, session, redirect, url_for,\ flash from flask_restful import Resource, Api import requests import json from functools import wraps from extensions import login_required USERNAME = "TA2JPwy5BjQfzJ102l-kN8gXbJOC3M6O9OH80XjM" IP_ADDR = "192.168.0.100" BASEURL = "http://" + I...
null
home/hue.py
hue.py
py
1,039
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask_restful.Api", "line_number": 14, "usage_type": "call" }, { "api_name": "flask.Blueprint", "line_number": 14, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 18, "usage_type": "call" }, { "api_name": "requests.get", "line...
193421849
from __future__ import unicode_literals from django.db import models # Create your models here. # ********************************************************************* # CARGA * # ********************************************************************* from...
null
DataUpload/models.py
models.py
py
1,143
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.db.models.Model", "line_number": 14, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 14, "usage_type": "name" }, { "api_name": "django.db.models.CharField", "line_number": 15, "usage_type": "call" }, { "api_name"...
509425285
# Copyright (C) 2010-2014 by Dr. Dieter Maurer <dieter@handshake.de>; see 'LICENSE.txt' for details """Support for the http redirect binding. The redirect binding allows to transport an SAML2 message (request or response) via query string parameters in an HTTP ``GET`` request, usually used via an HTTP redirect. Due t...
null
dm/saml2/binding/httpredirect.py
httpredirect.py
py
4,537
python
en
code
null
code-starcoder2
76
[ { "api_name": "dm.saml2.config.signature_method", "line_number": 51, "usage_type": "attribute" }, { "api_name": "dm.saml2.config", "line_number": 51, "usage_type": "name" }, { "api_name": "zlib.compress", "line_number": 54, "usage_type": "call" }, { "api_name": "p...
249130289
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymongo from TikTokBot.items import DouYinBotItem,TiktokbotItem import urllib.request import pymongo import os class D...
null
TikTokBot/pipelines.py
pipelines.py
py
2,260
python
en
code
null
code-starcoder2
76
[ { "api_name": "pymongo.MongoClient", "line_number": 17, "usage_type": "call" }, { "api_name": "TikTokBot.items.DouYinBotItem", "line_number": 25, "usage_type": "argument" }, { "api_name": "TikTokBot.items.TiktokbotItem", "line_number": 28, "usage_type": "argument" }, ...
583709434
from mpi4py import MPI from tmr import TMR import argparse import os # Create the communicator comm = MPI.COMM_WORLD # Create an argument parser to read in command-line arguments p = argparse.ArgumentParser() p.add_argument('--reverse', default=False, action='store_true') p.add_argument('--forest_output', type=str, d...
null
examples/crm/ucrm_to_forest.py
ucrm_to_forest.py
py
1,481
python
en
code
null
code-starcoder2
76
[ { "api_name": "mpi4py.MPI.COMM_WORLD", "line_number": 7, "usage_type": "attribute" }, { "api_name": "mpi4py.MPI", "line_number": 7, "usage_type": "name" }, { "api_name": "argparse.ArgumentParser", "line_number": 10, "usage_type": "call" }, { "api_name": "tmr.TMR.L...
564169126
import numpy as np from dt_apriltags import Detection from datetime import datetime import math import aprilTagLocations as atl #import matplotlib.pyplot as plt def LinePlaneCollision(planeNormal, planePoint, rayDirection, rayPoint, epsilon=1e-6): ndotu = planeNormal.dot(rayDirection) if abs(ndotu) < epsilon: ...
null
AprilTag_Detections.py
AprilTag_Detections.py
py
8,882
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.array", "line_number": 22, "usage_type": "call" }, { "api_name": "numpy.matmul", "line_number": 23, "usage_type": "call" }, { "api_name": "datetime.datetime.now", "line_number": 36, "usage_type": "call" }, { "api_name": "datetime.datetime", ...
146150404
import mongokit from bson import ObjectId # When site admin is true, all other fields are irrelevant class Rule(mongokit.Document): structure = { 'label' : basestring, 'db' : ObjectId, 'facebook_id' : basestring, 'can_see' : [ObjectId], 'can_see_all' : bool, 'db_adm...
null
slideatlas/model/rule.py
rule.py
py
400
python
en
code
null
code-starcoder2
76
[ { "api_name": "mongokit.Document", "line_number": 6, "usage_type": "attribute" }, { "api_name": "bson.ObjectId", "line_number": 9, "usage_type": "name" }, { "api_name": "bson.ObjectId", "line_number": 11, "usage_type": "name" } ]
471711631
import pygame from pygame.locals import * from math import * import main class Car(pygame.sprite.Sprite): def __init__(self, start_pos, start_angle, image, keys, username, initial_score, initial_laps, initial_hits): '''Initialises the Car object''' super().__init__() self.x = start_pos[...
null
Proyectos/proyecto3/jgonzalez-proyecto3/Car_Class.py
Car_Class.py
py
2,593
python
en
code
null
code-starcoder2
76
[ { "api_name": "pygame.sprite", "line_number": 6, "usage_type": "attribute" }, { "api_name": "pygame.transform.scale", "line_number": 15, "usage_type": "call" }, { "api_name": "pygame.transform", "line_number": 15, "usage_type": "attribute" }, { "api_name": "pygame...
482114682
#!/usr/bin/env python from importlib import import_module import subprocess # TODO: Use regex module for better PCRE support? # https://bitbucket.org/mrabarnett/mrab-regex import re import time import copy from inspect import isfunction from functools import reduce import urwid from vit import version from vi...
null
vit/application.py
application.py
py
42,219
python
en
code
null
code-starcoder2
76
[ { "api_name": "urwid.Frame", "line_number": 44, "usage_type": "attribute" }, { "api_name": "vit.loader.Loader", "line_number": 70, "usage_type": "call" }, { "api_name": "vit.config_parser.ConfigParser", "line_number": 78, "usage_type": "call" }, { "api_name": "vit...
554239687
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
null
keras/engine/keras_tensor_test.py
keras_tensor_test.py
py
4,648
python
en
code
null
code-starcoder2
76
[ { "api_name": "keras.keras_parameterized.TestCase", "line_number": 27, "usage_type": "attribute" }, { "api_name": "keras.keras_parameterized", "line_number": 27, "usage_type": "name" }, { "api_name": "keras.engine.keras_tensor.KerasTensor", "line_number": 30, "usage_type"...
18825291
# -*- coding=utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016 R1tschY # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
null
benchmarks/icount.py
icount.py
py
4,386
python
en
code
null
code-starcoder2
76
[ { "api_name": "itertools.count", "line_number": 37, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 38, "usage_type": "call" }, { "api_name": "itertools.count", "line_number": 38, "usage_type": "call" }, { "api_name": "collections.deque",...
126253967
import os import speech_recognition as sr import youtube_dl import pydub parameter = { 'format': 'bestaudio/best', 'outtmpl':'\\%(input)s.%(ext)s', 'postprocessors':[{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '192', }], } youtube...
null
main.py
main.py
py
1,962
python
en
code
null
code-starcoder2
76
[ { "api_name": "youtube_dl.YoutubeDL", "line_number": 16, "usage_type": "call" }, { "api_name": "pydub.AudioSegment.from_mp3", "line_number": 19, "usage_type": "call" }, { "api_name": "pydub.AudioSegment", "line_number": 19, "usage_type": "attribute" }, { "api_name...
334326864
""" En este apartado vamos a ver la diferencia entre los diferentes modos de cifrado. Para ello se va a repetir el ejercicio anterior, utilizando los modos de cifrado OFB, CFB, ECB. Compara el criptograma obtenido en cada uno de los casos. """ import os from cryptography.hazmat.primitives.ciphers import Cipher...
null
criptografia_1B_CFB.py
criptografia_1B_CFB.py
py
900
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.urandom", "line_number": 15, "usage_type": "call" }, { "api_name": "cryptography.hazmat.primitives.ciphers.Cipher", "line_number": 17, "usage_type": "call" }, { "api_name": "cryptography.hazmat.primitives.ciphers.algorithms.AES", "line_number": 17, "usag...
158073177
from selenium import webdriver import time import math def calc(x): return str(math.log(abs(12*math.sin(x)))) # считаем функцию по этой формуле try: browser = webdriver.Chrome() browser.get("http://suninjuly.github.io/redirect_accept.html") #open browser browser.find_element_by_xpath("//button[@cl...
null
lesson_2.3.6.py
lesson_2.3.6.py
py
920
python
en
code
null
code-starcoder2
76
[ { "api_name": "math.log", "line_number": 6, "usage_type": "call" }, { "api_name": "math.sin", "line_number": 6, "usage_type": "call" }, { "api_name": "selenium.webdriver.Chrome", "line_number": 10, "usage_type": "call" }, { "api_name": "selenium.webdriver", "l...
400463565
import os import logging from dotenv import load_dotenv from pymongo import MongoClient from slack_bolt.async_app import AsyncApp from slack_sdk.web.async_client import AsyncWebClient from data_collector import DataCollector from controller import Controller from app_home import AppHome from message_handler import s...
null
app.py
app.py
py
4,906
python
en
code
null
code-starcoder2
76
[ { "api_name": "dotenv.load_dotenv", "line_number": 19, "usage_type": "call" }, { "api_name": "logging.basicConfig", "line_number": 20, "usage_type": "call" }, { "api_name": "logging.INFO", "line_number": 20, "usage_type": "attribute" }, { "api_name": "os.environ.g...
425360295
import aiohttp import asyncio from app.services.utils import random_name_generator class AsyncCrawler: """ Crawler using aiohttlp to downloads images asynchronously. """ def __init__(self, target_urls=[]): self.target_urls = target_urls @staticmethod async def fetch(client, url): ...
null
app/services/crawler.py
crawler.py
py
1,163
python
en
code
null
code-starcoder2
76
[ { "api_name": "app.services.utils.random_name_generator", "line_number": 19, "usage_type": "call" }, { "api_name": "aiohttp.ClientSession", "line_number": 27, "usage_type": "call" }, { "api_name": "asyncio.gather", "line_number": 36, "usage_type": "call" }, { "api...
247414210
# coding=utf-8 ''' Torrent-tv.ru Playlist Downloader Plugin http://ip:port/ttv ''' import re import logging import urllib2 import time import gevent from modules.PluginInterface import AceProxyPlugin from modules.PlaylistGenerator import PlaylistGenerator import config.ttv as config import urllib import urlparse class...
null
plugins/ttv_plugin.py
ttv_plugin.py
py
4,210
python
en
code
null
code-starcoder2
76
[ { "api_name": "modules.PluginInterface.AceProxyPlugin", "line_number": 17, "usage_type": "name" }, { "api_name": "logging.getLogger", "line_number": 22, "usage_type": "call" }, { "api_name": "config.ttv.updateevery", "line_number": 41, "usage_type": "attribute" }, { ...
34833959
__author__ = 'roman' def word_endings(flag, number): patterns = {'days': ['день', 'дня', 'дней'], 'hours': ['час', 'часа', 'часов'], 'minutes': ['минуту', 'минуты', 'минут']} if flag in ('days', 'hours', 'minutes'): if number == 1: return patterns[flag][0] ...
null
utils.py
utils.py
py
1,675
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.utils.timezone.localtime", "line_number": 30, "usage_type": "call" }, { "api_name": "django.utils.timezone", "line_number": 30, "usage_type": "name" }, { "api_name": "datetime.datetime", "line_number": 31, "usage_type": "call" } ]
444322088
import os import pandas as pd import numpy as np import PIL import PIL.Image as Image, PIL.ImageDraw as ImageDraw, PIL.ImageFont as ImageFont import cv2 from tqdm import tqdm as T from p_tqdm import p_map HEIGHT = 137 WIDTH = 236 SIZE = 128 dir_name = 'data/train_128px' if os.path.exists(dir_name): ...
null
image_creator.py
image_creator.py
py
2,716
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.exists", "line_number": 16, "usage_type": "call" }, { "api_name": "os.path", "line_number": 16, "usage_type": "attribute" }, { "api_name": "os.mkdir", "line_number": 19, "usage_type": "call" }, { "api_name": "pandas.read_parquet", "line_...
652383378
from bs4 import BeautifulSoup import xml.etree.ElementTree as ET from transliterate import translit # some magic write nice xml's def indent(elem, level=0): i = "\n" + level*" " j = "\n" + (level-1)*" " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " ...
null
Kirill_Stuff/trup/main.py
main.py
py
8,159
python
en
code
null
code-starcoder2
76
[ { "api_name": "transliterate.translit", "line_number": 34, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 45, "usage_type": "call" }, { "api_name": "xml.etree.ElementTree.Element", "line_number": 63, "usage_type": "call" }, { "api_name":...
264942901
import sys import re from collections import defaultdict inf = sys.stdin outf = sys.stdout def handle_case(case_num): case_str = 'Case #{0}: '.format(case_num) tx, ty = map(int, inf.readline().strip().split()) paths = defaultdict(list) current_points = set([(0, 0)]) for i in range(1, 600): ...
null
codejam/2013/1C/B/solve.py
solve.py
py
1,023
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.stdin", "line_number": 6, "usage_type": "attribute" }, { "api_name": "sys.stdout", "line_number": 7, "usage_type": "attribute" }, { "api_name": "collections.defaultdict", "line_number": 13, "usage_type": "call" }, { "api_name": "sys.argv", "...
172957860
import requests import pymongo import datetime import json def insert_mongodb(data): MONGODB_SERVER = "124.42.117.168" MONGODB_PORT = 27017 MONGODB_DB = "qisu" MONGODB_COLLECTION = "dailynews" client = pymongo.MongoClient(MONGODB_SERVER, MONGODB_PORT) db = client[MONGODB_DB] db.authenticat...
null
qisu/daynews/publicSougou.py
publicSougou.py
py
2,324
python
en
code
null
code-starcoder2
76
[ { "api_name": "pymongo.MongoClient", "line_number": 12, "usage_type": "call" }, { "api_name": "datetime.datetime.utcnow", "line_number": 23, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 23, "usage_type": "attribute" }, { "api_name": "r...
288783261
import numpy as np from ast import literal_eval from spacy.gold import biluo_tags_from_offsets, tags_to_entities from wasabi import Printer from scipy.sparse import coo_matrix messenger = Printer() def get_default_columns(): """ To get list of columns names to be default in annotation dataframe. :return: ...
null
dframcy/utils.py
utils.py
py
15,540
python
en
code
null
code-starcoder2
76
[ { "api_name": "wasabi.Printer", "line_number": 6, "usage_type": "call" }, { "api_name": "ast.literal_eval", "line_number": 207, "usage_type": "call" }, { "api_name": "spacy.gold.biluo_tags_from_offsets", "line_number": 208, "usage_type": "call" }, { "api_name": "s...
578142278
# -*- coding: utf-8 -*- import logging from math import sqrt import numpy as np from numpy.testing import assert_almost_equal import pyhrf from pyhrf import xmlio from pyhrf.ndarray import xndarray, stack_cuboids from pyhrf.jde.models import WN_BiG_Drift_BOLDSamplerInput, GSDefaultCallbackHandler from pyhrf.jde.sa...
null
python/pyhrf/jde/asl_physio.py
asl_physio.py
py
78,197
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 22, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 35, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 36, "usage_type": "call" }, { "api_name": "numpy.divide", "line_nu...
302433436
from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button class PrMenu(BoxLayout): """Menu Widget""" def __init__(self, **kwargs): # make sure we aren't overriding any important functionality super(PrMenu, self).__init__(**kwargs) # props self.size_hint = (1, ...
null
piro/widgets/menu.py
menu.py
py
680
python
en
code
null
code-starcoder2
76
[ { "api_name": "kivy.uix.boxlayout.BoxLayout", "line_number": 4, "usage_type": "name" }, { "api_name": "kivy.uix.button.Button", "line_number": 16, "usage_type": "call" }, { "api_name": "kivy.uix.button.Button", "line_number": 17, "usage_type": "call" } ]
192203068
import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.rc('text', usetex=True) matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"] #---------------------------------------------------------- """ use log2() for log base 2 """ #----------------------------------------------------...
null
phd/reports/eighteen_month/res/static_fcts.py
static_fcts.py
py
1,406
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.rc", "line_number": 4, "usage_type": "call" }, { "api_name": "matplotlib.rcParams", "line_number": 5, "usage_type": "attribute" }, { "api_name": "numpy.log", "line_number": 10, "usage_type": "call" }, { "api_name": "numpy.log", "line_...
229141117
import logging import copy import math from enum import Enum from cobra.core import Metabolite, Reaction from cobra.core.dictlist import DictList from cobra.util import format_long_string from modelseedpy.core.msmodel import get_direction_from_constraints, \ get_reaction_constraints_from_direction, get_cmp_...
null
modelseedpy/core/mstemplate.py
mstemplate.py
py
31,183
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 13, "usage_type": "call" }, { "api_name": "enum.Enum", "line_number": 25, "usage_type": "name" }, { "api_name": "cobra.util.format_long_string", "line_number": 99, "usage_type": "call" }, { "api_name": "cobra.util....
312816608
import json import pika, logging from config import * from performer import * def on_message(channel, method_frame, header_frame, body): body = json.loads(body) send = body["NAME"] = perform(body["NAME"]) send_to_queve(body) LOG.info(f'Message "{send}" has been sent') channel.basic_ack(delivery_tag...
null
main.py
main.py
py
1,239
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.loads", "line_number": 7, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 17, "usage_type": "call" }, { "api_name": "logging.basicConfig", "line_number": 21, "usage_type": "call" }, { "api_name": "logging.INFO", "line_num...
627722880
from bilmo.scripts.config import Config from fastai.text.models import TransformerXL, Transformer, Activation from torch import nn import logging conf = Config.conf log = logging.getLogger("cafa-logger") def init_transformer(m): classname = m.__class__.__name__ if classname.find('Linear') != -1: if has...
null
bilmo/models/Transformer.py
Transformer.py
py
1,436
python
en
code
null
code-starcoder2
76
[ { "api_name": "bilmo.scripts.config.Config.conf", "line_number": 5, "usage_type": "attribute" }, { "api_name": "bilmo.scripts.config.Config", "line_number": 5, "usage_type": "name" }, { "api_name": "logging.getLogger", "line_number": 6, "usage_type": "call" }, { "...
338530376
from django.contrib import admin # Register your models here. from .models import Reporter, Report, Receiver, ReportStatus class ReportInLine(admin.TabularInline): model = Report class ReportStatusInLine(admin.TabularInline): model = ReportStatus @admin.register(Reporter) class ReporterAdmin(admin.ModelAdmin): ...
null
report/admin.py
admin.py
py
985
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.contrib.admin.TabularInline", "line_number": 6, "usage_type": "attribute" }, { "api_name": "django.contrib.admin", "line_number": 6, "usage_type": "name" }, { "api_name": "models.Report", "line_number": 7, "usage_type": "name" }, { "api_name"...
276262447
from selenium import webdriver from selenium.webdriver.common.by import By #Driver Intialization driver=webdriver.Chrome(executable_path="D:\SeleniumPython\drivers\chromedriver.exe") driver.maximize_window() driver.get("https://techcanvass.com/examples/webtable.html") # Launch Browser driver.implicitly_wait(10) row...
null
SeleniumPython/Table.py
Table.py
py
739
python
en
code
null
code-starcoder2
76
[ { "api_name": "selenium.webdriver.Chrome", "line_number": 5, "usage_type": "call" }, { "api_name": "selenium.webdriver", "line_number": 5, "usage_type": "name" }, { "api_name": "selenium.webdriver.common.by.By.XPATH", "line_number": 12, "usage_type": "attribute" }, { ...
518563699
import numpy as np import utils.helmholtz3D from poisson_scc import * from utils.utils_basic import * import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm class poisson_IIM_solver(object): def __init__(self, pde): self.pde = pde self.irr_proj ...
null
poisson_IIM_solver.py
poisson_IIM_solver.py
py
23,560
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.ndarray", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.float64", "line_number": 15, "usage_type": "attribute" }, { "api_name": "numpy.ndarray", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.float64", "l...
378753179
from django.conf.urls import patterns, include, url from django.contrib import admin from django.contrib.auth.decorators import permission_required from ikwen.flatpages.views import FlatPageView from ikwen_shavida.movies.views import Home from ikwen_shavida.sales.views import Dashboard admin.autodiscover() urlpatter...
null
conf/urls.py
urls.py
py
1,373
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.contrib.admin.autodiscover", "line_number": 9, "usage_type": "call" }, { "api_name": "django.contrib.admin", "line_number": 9, "usage_type": "name" }, { "api_name": "django.conf.urls.patterns", "line_number": 11, "usage_type": "call" }, { "ap...
513302034
from django.urls import path from . import views urlpatterns = [ path('insert1', views.insert1, name='insert1'), path('select1', views.select1, name='select1'), path('select_m', views.select_m, name='select_m'), path('select3', views.select3, name='se...
null
2py_web/django/web1/api/urls.py
urls.py
py
338
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.urls.path", "line_number": 5, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 6, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 7, "usage_type": "call" }, { "api_name": "django.urls.path", ...
397016061
""" Ukázkový příklad použití pygame. Hodně vysvětlování... """ # https://www.pygame.org/docs/tut/PygameIntro.html import sys import os import pygame # relativní cesta vzhledem k tomuto souboru -> absolutní cesta def fix_path(p): return os.path.dirname(os.path.realpath(__file__)) + "/" + p # připraví pygame (mus...
null
prg/2020-11-23/01-pygame.py
01-pygame.py
py
2,348
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.dirname", "line_number": 14, "usage_type": "call" }, { "api_name": "os.path", "line_number": 14, "usage_type": "attribute" }, { "api_name": "os.path.realpath", "line_number": 14, "usage_type": "call" }, { "api_name": "pygame.init", "line...
197488086
""" Textractor module """ import re from nltk import sent_tokenize from tika import parser from .base import Pipeline class Textractor(Pipeline): """ Extracts text from files. """ def __init__(self, sentences=False, lines=False, paragraphs=False, minlength=None, join=False): """ Cr...
null
src/python/txtai/pipeline/textractor.py
textractor.py
py
3,055
python
en
code
null
code-starcoder2
76
[ { "api_name": "base.Pipeline", "line_number": 13, "usage_type": "name" }, { "api_name": "tika.parser.from_file", "line_number": 57, "usage_type": "call" }, { "api_name": "tika.parser", "line_number": 57, "usage_type": "name" }, { "api_name": "nltk.sent_tokenize", ...
32995996
from typing import Optional from fastapi import Depends, HTTPException, status from sqlalchemy.orm import Session from ..models.operations import ( OperationKind, OperationCreate, OperationUpdate, ) from ..database import get_session from .. import tables class OperationsService: def __init__(self, se...
null
workshop/services/operations.py
operations.py
py
2,363
python
en
code
null
code-starcoder2
76
[ { "api_name": "sqlalchemy.orm.Session", "line_number": 14, "usage_type": "name" }, { "api_name": "fastapi.Depends", "line_number": 14, "usage_type": "call" }, { "api_name": "database.get_session", "line_number": 14, "usage_type": "argument" }, { "api_name": "fasta...
253267871
import IPython import argparse import string from collections import deque import pandas as pd from commentsbot.markov import POSMarkovModel import spacy.en def main(): parser = argparse.ArgumentParser() parser.add_argument('filename', type=str) args = parser.parse_args() df = pd.read_csv(args.filena...
null
commentsbot/train_markov_model.py
train_markov_model.py
py
1,248
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 12, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 15, "usage_type": "call" }, { "api_name": "spacy.en.en.English", "line_number": 17, "usage_type": "call" }, { "api_name": "spacy.en....
77427547
# -*- coding: utf-8 -*- """ Created on Wed Jan 29 03:48:22 2020 @author: Jagseer Singh """ import pandas as pd import numpy as np import pickle Pkl_Filename = "selling_predictor.pkl" dataset=pd.read_csv("dataset.csv") x=dataset.iloc[:,0:7] y=dataset.iloc[:,7].values print(x.shape,y.shape) from skle...
null
training.py
training.py
py
975
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.read_csv", "line_number": 13, "usage_type": "call" }, { "api_name": "sklearn.preprocessing.PolynomialFeatures", "line_number": 19, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_split", "line_number": 25, "usage_type": "cal...
324477958
#!/usr/bin/python # -*- coding: utf-8 -*- # Filename: support.py # Shell and config manipulation # Author: Pedro H. A. Hasselmann # Escrevendo em python3 e usando python2.6: from __future__ import print_function, unicode_literals, absolute_import, division from numpy import array, arange, concatenate, all, insert, ve...
null
binarytree.py
binarytree.py
py
4,394
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.vectorize", "line_number": 17, "usage_type": "name" }, { "api_name": "numpy.vectorize", "line_number": 23, "usage_type": "name" }, { "api_name": "scipy.cluster.hierarchy.median", "line_number": 41, "usage_type": "call" }, { "api_name": "scipy....
9587296
import typing from dataclasses import dataclass, field from .. import constants, errors, utils __all__ = ( 'JsonRpcRequest', 'JsonRpcBatchRequest', ) @dataclass class JsonRpcRequest: method_name: str id: typing.Any = constants.NOTHING jsonrpc: str = constants.VERSION_2_0 extra_args: dict = ...
null
aiohttp_rpc/protocol/request.py
request.py
py
3,073
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.Any", "line_number": 16, "usage_type": "attribute" }, { "api_name": "dataclasses.field", "line_number": 18, "usage_type": "call" }, { "api_name": "dataclasses.field", "line_number": 19, "usage_type": "call" }, { "api_name": "typing.Any", ...
142307095
#!/usr/bin/env python3 import numpy as np from baselines.common.cmd_util import mujoco_arg_parser from baselines import bench, logger from baselines.common import set_global_seeds from libs.PPO.vec_normalize import VecNormalize from libs.PPO import ppo2 from libs.PPO.policies import * import gym import tensorflow as t...
null
Matrix/libs/PPO/Backup/PPO.py
PPO.py
py
2,142
python
en
code
null
code-starcoder2
76
[ { "api_name": "baselines.logger.configure", "line_number": 20, "usage_type": "call" }, { "api_name": "baselines.logger", "line_number": 20, "usage_type": "name" }, { "api_name": "tensorflow.ConfigProto", "line_number": 23, "usage_type": "call" }, { "api_name": "te...
385860348
""" LAG (Link Aggregation Group) configuration module. Copyright 2013 Aviat Networks This file contains a set of functions for LAG configuration. """ import time import re import logging def lag_configure(lag_name, testrig): '''Perform and validate named lag configuration (lag_name) per topology file.''' ...
null
protocols/lag.py
lag.py
py
2,163
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.info", "line_number": 16, "usage_type": "call" }, { "api_name": "re.search", "line_number": 18, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 55, "usage_type": "call" }, { "api_name": "re.search", "line_number": 62, ...