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
617433100
# coding: utf-8 import os import random import numpy as np import pickle as pkl import networkx as nx import scipy.sparse as sp from utils import loadWord2Vec, clean_str from math import log from sklearn import svm from nltk.corpus import wordnet as wn from sklearn.feature_extraction.text import TfidfVectorizer import...
null
graph_builder.py
graph_builder.py
py
16,986
python
en
code
null
code-starcoder2
66
[ { "api_name": "random.seed", "line_number": 77, "usage_type": "call" }, { "api_name": "random.shuffle", "line_number": 78, "usage_type": "call" }, { "api_name": "random.shuffle", "line_number": 79, "usage_type": "call" }, { "api_name": "scipy.sparse.csr_matrix", ...
235209546
# -------------------------------------------------------- # Deep Iterative Matching Network # Licensed under The Apache-2.0 License [see LICENSE for details] # Written by Gu Wang, Yi Li # -------------------------------------------------------- from __future__ import print_function, division import numpy as np import...
null
toolkit/ModelNet_4_gen_rendered_and_pair_set.py
ModelNet_4_gen_rendered_and_pair_set.py
py
5,904
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.dirname", "line_number": 11, "usage_type": "call" }, { "api_name": "os.path", "line_number": 11, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 11, "usage_type": "call" }, { "api_name": "sys.path.insert", "l...
189897464
__package__ = 'keras_retinanet.utils' from .transform import random_transform from .image import apply_transform, TransformParameters, adjust_transform_for_image import cv2 image = cv2.imread('test.jpg') cv2.imshow('image', image) cv2.waitKey(0) m1 = random_transform(flip_x_chance=1) print(m1) transform_parameters = T...
null
keras_retinanet/utils/test_transform.py
test_transform.py
py
518
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.imread", "line_number": 6, "usage_type": "call" }, { "api_name": "cv2.imshow", "line_number": 7, "usage_type": "call" }, { "api_name": "cv2.waitKey", "line_number": 8, "usage_type": "call" }, { "api_name": "transform.random_transform", "line...
545320224
from trac.core import * from trac.web.chrome import ITemplateProvider, add_stylesheet #from trac.wiki.api import IWikiMacroProvider from trac.web.main import IRequestHandler from trac.util import escape from genshi.core import Markup from trac.wiki.macros import WikiMacroBase import re __all__ = ['ShellExample'] ####...
null
shellexamplemacro/0.12/tags/0.12.1/shellexample/module.py
module.py
py
6,729
python
en
code
null
code-starcoder2
66
[ { "api_name": "re.compile", "line_number": 42, "usage_type": "call" }, { "api_name": "re.compile", "line_number": 43, "usage_type": "call" }, { "api_name": "re.M", "line_number": 45, "usage_type": "attribute" }, { "api_name": "re.S", "line_number": 45, "us...
468362484
from typing import overload, NamedTuple from abc import ABCMeta from pyraknet.bitstream import Serializable, c_uint8, c_uint16, c_uint32 from enums import PACKET_IDS, PACKET_NAMES class CString(Serializable): def __init__(self, data, allocated_length=None, length_type=None): self.data = data self.a...
null
server/structs.py
structs.py
py
2,122
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyraknet.bitstream.Serializable", "line_number": 6, "usage_type": "name" }, { "api_name": "pyraknet.bitstream.Serializable", "line_number": 20, "usage_type": "name" }, { "api_name": "typing.overload", "line_number": 21, "usage_type": "name" }, { "ap...
159528591
import sqlite3 from sqlite3 import Error def create_connection(db_file): """ create a database connection to the SQLite database specified by the db_file :param db_file: database file :return: Connection object or None """ conn = None try: conn = sqlite3.connect(db_...
null
MAMEly/sqlitetest.py
sqlitetest.py
py
2,560
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 13, "usage_type": "call" }, { "api_name": "sqlite3.Error", "line_number": 14, "usage_type": "name" }, { "api_name": "sqlite3.Error", "line_number": 28, "usage_type": "name" } ]
545266574
import os import subprocess import sys import textwrap import yaml from datetime import date from importlib import import_module import connexion from cloudmesh.common.Shell import Shell from cloudmesh.common.console import Console from cloudmesh.common.debug import VERBOSE from cloudmesh.common.util import path_expan...
null
cloudmesh/openapi3/function/server.py
server.py
py
9,017
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.fork", "line_number": 22, "usage_type": "call" }, { "api_name": "os._exit", "line_number": 30, "usage_type": "call" }, { "api_name": "os.EX_OK", "line_number": 30, "usage_type": "attribute" }, { "api_name": "importlib.import_module", "line_nu...
271843764
import os, sys, math, random, itertools import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torchvision import datasets, transforms, models from torch.optim.lr_scheduler import MultiStepLR from models import TrainableModel from utils import * class ConvBlock(nn.Module): d...
null
modules/resnet.py
resnet.py
py
2,174
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.nn.Module", "line_number": 15, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 15, "usage_type": "name" }, { "api_name": "torch.nn.Conv2d", "line_number": 19, "usage_type": "call" }, { "api_name": "torch.nn", "line_nu...
350690072
from collections import namedtuple import pytest from solax import inverter XHYBRID_DE01_RESPONSE = { 'method': 'uploadsn', 'version': 'Solax_SI_CH_2nd_20160912_DE02', 'type': 'AL_SE', 'SN': 'XXXXXXX', 'Data': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...
null
tests/fixtures.py
fixtures.py
py
5,249
python
en
code
null
code-starcoder2
66
[ { "api_name": "pytest.fixture", "line_number": 130, "usage_type": "call" }, { "api_name": "collections.namedtuple", "line_number": 140, "usage_type": "call" }, { "api_name": "solax.inverter.XHybrid", "line_number": 151, "usage_type": "attribute" }, { "api_name": "...
628044039
from shapely.geometry import Point from shapely.geometry import Polygon from shapely.geometry import box from BFS import bfs from DFS import dfs from AS import astar inputf = open('input.txt','r') IP = [line.rstrip('\n') for line in inputf] inputf.close() # SP = Starting point # FP = Goal point # POLY ...
null
python_scripts/CS180_MP_Khim/Main.py
Main.py
py
992
python
en
code
null
code-starcoder2
66
[ { "api_name": "shapely.geometry.Point", "line_number": 25, "usage_type": "call" }, { "api_name": "shapely.geometry.Point", "line_number": 26, "usage_type": "call" }, { "api_name": "shapely.geometry.Polygon", "line_number": 32, "usage_type": "call" }, { "api_name":...
430007972
#!/usr/bin/env python3 """ This module contains a class for converting a TOMES Excel 2007+ (.xlsx) entity dictionary file to a Python generator where each item is a dict with headers as keys and row data as values. """ # import modules. import hashlib import itertools import logging import os from openpyxl import lo...
null
tomes_entities/lib/xlsx_to_entities.py
xlsx_to_entities.py
py
13,117
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 36, "usage_type": "call" }, { "api_name": "logging.NullHandler", "line_number": 37, "usage_type": "call" }, { "api_name": "hashlib.sha256", "line_number": 61, "usage_type": "call" }, { "api_name": "itertools.produc...
57328911
import argparse import collections import json import os import sys from vocab import Dictionary from eval_util import * from dstore_util import * from dataset_util import * import numpy as np import torch from tqdm import tqdm class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' ...
null
offline_eval_hunt.py
offline_eval_hunt.py
py
8,129
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.full_like", "line_number": 45, "usage_type": "call" }, { "api_name": "numpy.bool", "line_number": 45, "usage_type": "attribute" }, { "api_name": "tqdm.tqdm", "line_number": 47, "usage_type": "call" }, { "api_name": "numpy.isin", "line_numb...
553610731
from django import template from oscar.core.loading import get_model register = template.Library() Line = get_model('wishlists', 'Line') Product = get_model('catalogue', 'Product') @register.simple_tag def get_product_parent(product): if product and product.is_child: return product.parent return pr...
null
app/catalogue/templatetags/find_parent_tags.py
find_parent_tags.py
py
751
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.template.Library", "line_number": 5, "usage_type": "call" }, { "api_name": "django.template", "line_number": 5, "usage_type": "name" }, { "api_name": "oscar.core.loading.get_model", "line_number": 7, "usage_type": "call" }, { "api_name": "osc...
391598952
import itertools import six class ProxyDictPostWrite(dict): """ Dictionary wrapper that updates an arguments instance on any item set in the dictionary """ def __init__(self, update_obj, update_func, *args, **kwargs): super(ProxyDictPostWrite, self).__init__(*args, **kwargs) self._update_obj...
null
trains/utilities/proxy_object.py
proxy_object.py
py
5,025
python
en
code
null
code-starcoder2
66
[ { "api_name": "six.string_types", "line_number": 83, "usage_type": "attribute" }, { "api_name": "six.string_types", "line_number": 86, "usage_type": "attribute" }, { "api_name": "six.string_types", "line_number": 100, "usage_type": "attribute" }, { "api_name": "si...
362933787
import numpy as np from scipy import linalg from random import randint from sys import argv from matplotlib import pyplot as plt # companion pencil def comPencil(P): # degree and size m = len(P) - 1 n = len(P[0]) # matrix A A0 = -P[0] for j in range(1,m): A0 = np.concatenate((A0,-P[j]),...
null
Python/pellet.py
pellet.py
py
3,249
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.concatenate", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.concatenate", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.eye", "line...
343000379
from cryptography.fernet import Fernet as fernet from tkinter import messagebox def decryptFromUserInput(): userInputToken = entry2.get() userInputFile = entry1.get() try: decdet=getDecryptionDetails(userInputFile) decrypted = decryptFile(userInputToken,decdet['encryptedContents']) m...
null
encryption.py
encryption.py
py
2,419
python
en
code
null
code-starcoder2
66
[ { "api_name": "tkinter.messagebox.showinfo", "line_number": 9, "usage_type": "call" }, { "api_name": "tkinter.messagebox", "line_number": 9, "usage_type": "name" }, { "api_name": "tkinter.messagebox.showinfo", "line_number": 12, "usage_type": "call" }, { "api_name...
139685208
import os import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib import rcParams rcParams.update({'figure.autolayout': True}) mc_experiments = [e for e in os.listdir('results') if e.startswith('mc_')] os.makedirs('figures', exist_ok=True) fig = plt.figure(figsize=...
null
tests/plot_mc_results.py
plot_mc_results.py
py
1,254
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.use", "line_number": 5, "usage_type": "call" }, { "api_name": "matplotlib.rcParams.update", "line_number": 8, "usage_type": "call" }, { "api_name": "matplotlib.rcParams", "line_number": 8, "usage_type": "name" }, { "api_name": "os.listdir...
151986377
import pandas as pd import numpy as np train = pd.read_csv('train.csv') test = pd.read_csv('test.csv') import matplotlib.pyplot as plt plt.style.use(style='ggplot') plt.rcParams['figure.figsize'] = (10, 6) #plot a histogram of SalePrice print ("Skew is:", train.SalePrice.skew()) plt.hist(train.SalePrice, col...
null
houseprice decision tree.py
houseprice decision tree.py
py
5,214
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 3, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 4, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.style.use", "line_number": 6, "usage_type": "call" }, { "api_name": "matplotlib.p...
334523592
import pandas as pd import numpy as np import datetime as dt from datetime import date , time class dataassertionreport: # ''' # Function does Sanitcy Check on the dataframe to look for data consistency and accuracy # ''' def __init__(self, dataframe, primarykey_list, main_date_key): ...
null
Mortgage_Loan_Segment_Project/data_assertion.py
data_assertion.py
py
1,447
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.DataFrame", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.select", "line_number": 29, "usage_type": "call" }, { "api_name": "datetime.date.today", "line_number": 35, "usage_type": "call" }, { "api_name": "datetime.date", ...
451963833
from django.shortcuts import render, redirect, HttpResponse import requests import json import time # Create your views here. def main(req): return render(req, 'main/container.html') def get_stats(req): if req.method == 'GET': return render(req,'main/__stats__.html') def getChartData(ticker, gr...
null
apps/main/views.py
views.py
py
1,669
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.shortcuts.render", "line_number": 9, "usage_type": "call" }, { "api_name": "django.shortcuts.render", "line_number": 13, "usage_type": "call" }, { "api_name": "requests.request", "line_number": 29, "usage_type": "call" }, { "api_name": "djang...
328472557
import io import os.path from cStringIO import StringIO from django.utils.translation import ugettext_lazy as _ from django.utils import translation from submissions.models import Submission SUBMIT_CONFIRMATION = [ (_('Film'), [ 'title', 'title_en', 'country', 'language', 'genre', 'section', 'sy...
null
submissions/pdf.py
pdf.py
py
3,939
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.utils.translation.ugettext_lazy", "line_number": 12, "usage_type": "call" }, { "api_name": "django.utils.translation.ugettext_lazy", "line_number": 16, "usage_type": "call" }, { "api_name": "django.utils.translation.ugettext_lazy", "line_number": 19, ...
535276217
#!/usr/bin/env python # -*- coding: utf-8 -*- """ CHAVE-Sim: The simulator for research based in clouds architecture CHAVE: Consolidation with High Availability on virtualyzed environments """ from shelve import DbfilenameShelf, Shelf import shelve from copy import deepcopy import random from math import sqrt from ...
null
misc/tests/database/MetricDB_shelve.py
MetricDB_shelve.py
py
5,180
python
en
code
null
code-starcoder2
66
[ { "api_name": "shelve.open", "line_number": 28, "usage_type": "call" }, { "api_name": "collections.OrderedDict", "line_number": 130, "usage_type": "call" } ]
53004994
from selenium import webdriver from selenium.webdriver.chrome.options import Options class WeatherCrawler(): def __init__(self, url="https://www.cwb.gov.tw/V8/C/W/Town/Town.html?TID=6400600"): self.url = url # ---------------------------------------------------------------------------------...
null
Models/WeatherCrawler.py
WeatherCrawler.py
py
1,760
python
en
code
null
code-starcoder2
66
[ { "api_name": "selenium.webdriver.chrome.options.Options", "line_number": 12, "usage_type": "call" }, { "api_name": "selenium.webdriver.Chrome", "line_number": 24, "usage_type": "call" }, { "api_name": "selenium.webdriver", "line_number": 24, "usage_type": "name" } ]
12382334
from docx import Document import os def combine_word_documents(files): merged_document = Document() for index, file in enumerate(files): sub_doc = Document(file) if index < len(files)-1: sub_doc.add_page_break() for element in sub_doc.element.body: merged_docu...
null
ocr_niilakantha_jiivana_daasa/merge_docs.py
merge_docs.py
py
547
python
en
code
null
code-starcoder2
66
[ { "api_name": "docx.Document", "line_number": 5, "usage_type": "call" }, { "api_name": "docx.Document", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path.dirname", "line_number": 16, "usage_type": "call" }, { "api_name": "os.path", "line_number"...
626924623
from sklearn.neighbors import KNeighborsClassifier as KNC from MLalgorithms._Classification import Classification class KNeighborsClassifier(Classification): def fit(self, X, y): return self.model.fit(X=X, y=y) def predict(self, X): return self.model.predict(X=X) def __init__(self, n_neig...
null
Code/Implement and design a machine learning hierarchy wrapper for SimpleML/MLalgorithms/Classification/_KNeighborsClassifier.py
_KNeighborsClassifier.py
py
914
python
en
code
null
code-starcoder2
66
[ { "api_name": "MLalgorithms._Classification.Classification", "line_number": 6, "usage_type": "name" }, { "api_name": "sklearn.neighbors.KNeighborsClassifier", "line_number": 24, "usage_type": "call" } ]
51256673
from __future__ import print_function import sqlite3 def get_name(database_file, person_id): query = "SELECT personal || ' ' || family FROM Person WHERE id=?;" connection = sqlite3.connect(database_file) cursor = connection.cursor() cursor.execute(query, [person_id]) results = cursor.fetchall() ...
null
DataFest-2018/Multiple-Approaches-to-Combining-Data/scripts/better_query.py
better_query.py
py
447
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 7, "usage_type": "call" } ]
413722799
from django.urls import path from . import views app_name = 'shirts' urlpatterns = [ path('', views.shirts, name='shirts'), path('detail/<slug:slug>/<str:color>/', views.shirts_card, name='shirts_card'), path('create/', views.add_shirt, name='add_shirt'), ]
null
shirts/urls.py
urls.py
py
273
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 9, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 10, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 11, "usage_type": "call" } ]
73130147
from rest_framework import serializers from project.models import Project from placed_user.serializers import PlacedUserSerializer from skill.models import Skill from project_platform.models import ProjectPlatform from project_data.models import ProjectData from project_target_device.models import ProjectTargetDevice ...
null
django-apps/placed_backend/project/serializers.py
serializers.py
py
2,163
python
en
code
null
code-starcoder2
66
[ { "api_name": "rest_framework.serializers.ModelSerializer", "line_number": 10, "usage_type": "attribute" }, { "api_name": "rest_framework.serializers", "line_number": 10, "usage_type": "name" }, { "api_name": "placed_user.serializers.PlacedUserSerializer", "line_number": 11, ...
496501141
#!/usr/bin/python from datetime import datetime, timedelta from typing import IO from dateutil.relativedelta import relativedelta import grequests import requests import json import sys import os import parse import zendesk as zd import slackhandler as slack import util user = '' domain = '' view = '' channel = '' m...
null
python/bot.py
bot.py
py
7,838
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.today", "line_number": 56, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 56, "usage_type": "name" }, { "api_name": "datetime.datetime.now", "line_number": 57, "usage_type": "call" }, { "api_name": "datet...
498687752
from datetime import date import matplotlib.pyplot as plt import seaborn as sns import requests import json import numpy as np def get_data(): """Retrieve the data we will be working with.""" response = requests.get( "http://earthquake.usgs.gov/fdsnws/event/1/query.geojson", params={ ...
null
plot_earthquakes.py
plot_earthquakes.py
py
4,344
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 11, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 35, "usage_type": "call" }, { "api_name": "datetime.date.fromtimestamp", "line_number": 46, "usage_type": "call" }, { "api_name": "datetime.date", ...
258132722
from __future__ import unicode_literals from django.conf.urls import url from .views import NamespaceDetailView, NamespaceListView, SettingEditView urlpatterns = [ url( regex=r'^namespaces/$', view=NamespaceListView.as_view(), name='namespace_list' ), url( regex=r'^namespaces/(?P<...
null
mayan/apps/smart_settings/urls.py
urls.py
py
577
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.conf.urls.url", "line_number": 8, "usage_type": "call" }, { "api_name": "views.NamespaceListView.as_view", "line_number": 9, "usage_type": "call" }, { "api_name": "views.NamespaceListView", "line_number": 9, "usage_type": "name" }, { "api_nam...
170006835
import cv2 import numpy as np import random # load grayscale image img = cv2.imread("data/image/rose.jpg", 0) # thresholding min_value = 200 max_value = 255 thresh_type = cv2.THRESH_BINARY _, img_thresh = cv2.threshold(img, min_value, max_value, thresh_type) # connected components analysis _, labels = cv2.connectedC...
null
src/basic/segmentation/connectedComponentAnalysis.py
connectedComponentAnalysis.py
py
1,287
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.imread", "line_number": 6, "usage_type": "call" }, { "api_name": "cv2.THRESH_BINARY", "line_number": 11, "usage_type": "attribute" }, { "api_name": "cv2.threshold", "line_number": 12, "usage_type": "call" }, { "api_name": "cv2.connectedComponent...
304253323
import os.path, sys import numpy as np import pandas as pd from scipy import linalg from scipy.sparse import csr_matrix from sklearn.preprocessing import OneHotEncoder import Bio.PDB, warnings pdb_list = Bio.PDB.PDBList() pdb_parser = Bio.PDB.PDBParser() from scipy.spatial import distance_matrix from Bio import Biopy...
null
furano_periwal_prot/run_edist_family.py
run_edist_family.py
py
12,269
python
en
code
null
code-starcoder2
66
[ { "api_name": "Bio.PDB.PDB.PDBList", "line_number": 10, "usage_type": "call" }, { "api_name": "Bio.PDB.PDB", "line_number": 10, "usage_type": "attribute" }, { "api_name": "Bio.PDB", "line_number": 10, "usage_type": "name" }, { "api_name": "Bio.PDB.PDB.PDBParser", ...
263979975
#!/usr/bin/env python """test_cam.py: open external USB cam (address 1) to check if it's working. """ __author__ = "Vinicius Guimaraes Goecks" __copyright__ = "TBD" __credits__ = ["TBD", "TBD"] __license__ = "TBD" __version__ = "0.0.0" __maintainer__ = "Vinicius Guimaraes Goecks" __email__ = "viniciusguigo@gmail.com" ...
null
test/test_cam/test_cam.py
test_cam.py
py
1,246
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.VideoCapture", "line_number": 21, "usage_type": "call" }, { "api_name": "cv2.namedWindow", "line_number": 36, "usage_type": "call" }, { "api_name": "cv2.WINDOW_NORMAL", "line_number": 36, "usage_type": "attribute" }, { "api_name": "cv2.imshow", ...
175178490
import os import sys import csv import pandas as pd import getopt import matplotlib.pyplot as plt import math import subprocess def show_total_data(ifile, timeRefrush): plt.style.use("fivethirtyeight") df = pd.read_csv(ifile) rowCnt = df.shape[0] lname = df.columns.values[2:].tolist() i = 1 pl...
null
memory/showTotalMem.py
showTotalMem.py
py
2,035
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.pyplot.style.use", "line_number": 12, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.style", "line_number": 12, "usage_type": "attribute" }, { "api_name": "matplotlib.pyplot", "line_number": 12, "usage_type": "name" }, { "api_na...
230653743
import random from typing import Dict, Mapping, Iterable import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.utils.data.sampler import SubsetRandomSampler from torch.utils.data import DataLoader from torch.utils.tensorbo...
null
tuto/pytorch/solution.py
solution.py
py
7,463
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.nn.Module", "line_number": 14, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 14, "usage_type": "name" }, { "api_name": "torch.nn.Conv2d", "line_number": 23, "usage_type": "call" }, { "api_name": "torch.nn", "line_nu...
129098895
import numpy as np from keras import backend as K from plotting import lossplot, roc, prcurve from performance import ACC, MCC from load_data import load_data from model import build_model,compileModel,build_model_CNN K.set_image_data_format('channels_last') import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # ...
null
main.py
main.py
py
1,958
python
en
code
null
code-starcoder2
66
[ { "api_name": "keras.backend.set_image_data_format", "line_number": 7, "usage_type": "call" }, { "api_name": "keras.backend", "line_number": 7, "usage_type": "name" }, { "api_name": "os.environ", "line_number": 10, "usage_type": "attribute" }, { "api_name": "os.en...
337593346
import json import time import logging from builder import errors from builder.metrics import MetricsLogger public_log = logging.getLogger('public') private_log = logging.getLogger('private') metrics = MetricsLogger() def handle_progress(push_line): details = push_line.get('progressDetail') return "{} Pushi...
null
stage/builder/registry.py
registry.py
py
3,299
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 8, "usage_type": "call" }, { "api_name": "logging.getLogger", "line_number": 9, "usage_type": "call" }, { "api_name": "builder.metrics.MetricsLogger", "line_number": 10, "usage_type": "call" }, { "api_name": "json....
649446085
import torch import matplotlib.pyplot as plt import os import torch.nn as nn m1 = torch.load("mnist_1/initial_state_dict_lt.pth.tar", map_location="cpu").state_dict() def train(model, train_loader, optimizer, criterion): EPS = 1e-6 device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model...
null
analysis.py
analysis.py
py
6,276
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.load", "line_number": 5, "usage_type": "call" }, { "api_name": "torch.device", "line_number": 9, "usage_type": "call" }, { "api_name": "torch.cuda.is_available", "line_number": 9, "usage_type": "call" }, { "api_name": "torch.cuda", "line_n...
119333925
"""Hamiltonian Monte Carlo MCMC sampler classes.""" import logging import numpy as np import hmc from hmc.states import HamiltonianState from hmc.utils import LogRepFloat from hmc.errors import ( IntegratorError, NonReversibleStepError, ConvergenceError) try: import tqdm.auto as tqdm TQDM_AVAILABLE = True ...
null
hmc/samplers.py
samplers.py
py
30,947
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.empty", "line_number": 85, "usage_type": "call" }, { "api_name": "numpy.float64", "line_number": 85, "usage_type": "attribute" }, { "api_name": "numpy.empty", "l...
538259771
# -*- coding: utf-8 -*- from quicky import tenancy from django.contrib.auth import authenticate, login as request_login from django.shortcuts import redirect from . import menu import importlib import json from django.views.decorators.http import require_http_methods from django.views.decorators.csrf import csrf_exempt...
null
apps/hrm/views.py
views.py
py
5,438
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 18, "usage_type": "call" }, { "api_name": "quicky.applications.get_app_by_file", "line_number": 20, "usage_type": "call" }, { "api_name": "quicky.applications", "line_number": 20, "usage_type": "attribute" }, { "ap...
515970234
# Canny edge detector implementation # See https://towardsdatascience.com/canny-edge-detection-step-by-step-in-python-computer-vision-b49c3a2d8123 from utils.timeit import time_it from scipy import ndimage from scipy.ndimage.filters import convolve import numpy as np class CannyEdgeDetector: def __init__( ...
null
order-processing-app/processing/canny_edge_detector.py
canny_edge_detector.py
py
5,117
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.zeros", "line_number": 30, "usage_type": "call" }, { "api_name": "numpy.int32", "line_number": 30, "usage_type": "attribute" }, { "api_name": "utils.timeit.time_it", "line_number": 27, "usage_type": "name" }, { "api_name": "numpy.mgrid", "...
325521718
#!/usr/bin/env python3 ''' Library + demonstration tool for parsing the metadata contained in a `btrfs send` stream, as printed by `btrfs receive --dump`. Usage: btrfs send --no-data SUBVOL/ | btrfs receive --dump | parse_dump.py The `--no-data` flag is optional, but should speed up the send & receive considerably...
null
infra_macros/macro_lib/convert/container_image/btrfs_diff/parse_dump.py
parse_dump.py
py
15,136
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.OrderedDict", "line_number": 41, "usage_type": "call" }, { "api_name": "re.compile", "line_number": 68, "usage_type": "call" }, { "api_name": "re.escape", "line_number": 69, "usage_type": "call" }, { "api_name": "compiler.enriched_namedt...
242228917
from tkinter import * import sqlite3 class Sistema(): def __init__(self, master=None): self.cria_db # Define os containers self.container_01 = Frame(master) self.container_01["pady"] = 10 self.container_01.pack() self.container_02 = Frame(master) self.contai...
null
Tkinter/gerenciamento_estoque/Gerenciador de produtos.py
Gerenciador de produtos.py
py
7,449
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 102, "usage_type": "call" }, { "api_name": "sqlite3.connect", "line_number": 127, "usage_type": "call" }, { "api_name": "sqlite3.connect", "line_number": 169, "usage_type": "call" }, { "api_name": "sqlite3.connect", ...
531403138
# uncompyle6 version 3.7.4 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: build/bdist.linux-x86_64/egg/snmpsim_control_plane/management/exporters/renderer.py # Compiled at: 2020-01-01 13:42:52 import os, stat, tempfile, jinja2 def ren...
null
pycfiles/snmpsim_control_plane-0.0.2-py2.7/renderer.py
renderer.py
py
1,151
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.exists", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path", "line_number": 10, "usage_type": "attribute" }, { "api_name": "os.unlink", "line_number": 11, "usage_type": "call" }, { "api_name": "os.path.join", "line_number...
268245867
# coding: utf-8 # Copyright 2016 Mirantis, 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 appl...
null
nailgun/nailgun/test/unit/test_downgrade_fuel_9_0_2.py
test_downgrade_fuel_9_0_2.py
py
2,117
python
en
code
null
code-starcoder2
66
[ { "api_name": "nailgun.db.dropdb", "line_number": 31, "usage_type": "call" }, { "api_name": "alembic.command.upgrade", "line_number": 32, "usage_type": "call" }, { "api_name": "nailgun.db.migration.ALEMBIC_CONFIG", "line_number": 32, "usage_type": "argument" }, { ...
176343728
# import sqlite3 # conn = sqlite3.connect("new.db") # cursor = conn.cursor() # try: # cursor.execute("""INSERT INTO population VALUES # ("Alexandria", "Alex", 5000000)""") # cursor.execute("""INSERT INTO population VALUES # ("Mahalla", "MHL", "mama")""") # cursor.execute("""SELECT * FROM population WHERE k...
null
sql/sqltest.py
sqltest.py
py
697
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 20, "usage_type": "call" } ]
545385795
import requests import json def barkCheck(messageText): headers = { 'Content-Type': 'application/json; charset=utf-8', 'X-Token-Auth': 'rn4t4uzMufZYNtteRDS9hvZK', } data = "{ \"message\": \"" + messageText + "\" }" return requests.post('https://partner.bark.us/api/v1/messages', header...
null
cbBarkUsi.py
cbBarkUsi.py
py
428
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.post", "line_number": 12, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 15, "usage_type": "call" } ]
164425082
import curses from time import sleep def main(stdscr): # clear screen stdscr.clear() # This raises ZeroDivisionError when i == 10 stdscr.addstr(0, 0, 'Enter something:') for i in range(0, 10): v = i - 10 key = stdscr.getkey() stdscr.addstr(0, 0, f' ') stdscr.a...
null
Meet my pyppy/wrapper_curses.py
wrapper_curses.py
py
666
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.sleep", "line_number": 17, "usage_type": "call" }, { "api_name": "curses.newwin", "line_number": 24, "usage_type": "call" }, { "api_name": "curses.wrapper", "line_number": 33, "usage_type": "call" } ]
431843300
""" Player for the competition """ from players.AbstractPlayer import AbstractPlayer import utils from SearchAlgos import AlphaBeta import time import numpy as np import networkx as nx # TODO: TO DELETE # TODO: This is probably not legal though we'll check import copy import matplotlib.pyplot as plt class Player(Abst...
null
players/CompetePlayer.py
CompetePlayer.py
py
15,343
python
en
code
null
code-starcoder2
66
[ { "api_name": "players.AbstractPlayer.AbstractPlayer", "line_number": 16, "usage_type": "name" }, { "api_name": "players.AbstractPlayer.AbstractPlayer.__init__", "line_number": 18, "usage_type": "call" }, { "api_name": "players.AbstractPlayer.AbstractPlayer", "line_number": 1...
229655718
# using scaled time so each data point is 1 time unit # there is a lot of potential for underflow because of the x^3 term, so many # runs may be needed import pandas as pd import numpy as np import os import matplotlib.pyplot as plt import math import time import argparse import torch import torch.nn as nn import torc...
null
experiments/silverbox/silverbox_anode.py
silverbox_anode.py
py
6,441
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 17, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 37, "usage_type": "call" }, { "api_name": "numpy.asarray", "line_number": 40, "usage_type": "call" }, { "api_name": "numpy.transpose...
458010033
import ssn_multi_probes from util import find_params_to_sigmoid import jax.numpy as np # import scipy.io as sio import json import sys ind_in = int(sys.argv[1]) with open("talapas-full-sweep.json", "r") as read_file: parameters = json.load(read_file) Jee = parameters['Jee'][ind_in] Jei = parameters['Jei'][ind_i...
null
jax_caleb/par_sweep_talapas.py
par_sweep_talapas.py
py
2,258
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.argv", "line_number": 9, "usage_type": "attribute" }, { "api_name": "json.load", "line_number": 12, "usage_type": "call" }, { "api_name": "jax.numpy.array", "line_number": 28, "usage_type": "call" }, { "api_name": "jax.numpy", "line_number":...
127354123
from functools import lru_cache with open("input.txt", mode="r") as f: jolts = [ int(x.strip()) for x in f.readlines() ] jolts.sort() jolts = [0] + jolts + [ jolts[-1] + 3] @lru_cache def counts(j): global jolts if j == 0: return 1 c1, c2, c3 = 0, 0, 0 return (counts(j - 3) if (j - 3) i...
null
2020/10/part2_cache.py
part2_cache.py
py
478
python
en
code
null
code-starcoder2
66
[ { "api_name": "functools.lru_cache", "line_number": 11, "usage_type": "name" } ]
383015348
import pyspark from pyspark.sql import SparkSession spark = SparkSession.builder.getOrCreate() from pyspark.sql.functions import unix_timestamp from pyspark.sql import SQLContext CUSTOMER = spark.read.option('delimiter',"|").csv(r"C:\Users\pooja\Desktop\DBS\Customer.txt") CUSTOMER_EXTN = spark.read....
null
DBS_HackTron_2019_28.py
DBS_HackTron_2019_28.py
py
3,588
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyspark.sql.SparkSession.builder.getOrCreate", "line_number": 5, "usage_type": "call" }, { "api_name": "pyspark.sql.SparkSession.builder", "line_number": 5, "usage_type": "attribute" }, { "api_name": "pyspark.sql.SparkSession", "line_number": 5, "usage_type...
580297243
# Final Project # # Author : Rajarshi Biswas # Sayam Ganguly import pandas as pd from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem import PorterStemmer import string import _pickle as pickle def strip_data(data): data = data[['TITLE','CATEGORY']] return data ...
null
Final Project/Preprocessing.py
Preprocessing.py
py
3,363
python
en
code
null
code-starcoder2
66
[ { "api_name": "nltk.tokenize.word_tokenize", "line_number": 19, "usage_type": "call" }, { "api_name": "nltk.stem.PorterStemmer", "line_number": 23, "usage_type": "call" }, { "api_name": "nltk.corpus.stopwords.words", "line_number": 28, "usage_type": "call" }, { "a...
58522932
# -*- coding: utf-8 -*- """The api module. """ from .datetime import Zulu from .timedelta import Delta now = Zulu.now parse = Zulu.parse range = Zulu.range span_range = Zulu.span_range delta = Delta.parse def create(*args, **kargs): """Factory function to create a new :class:`.Zulu` datetime using the same ...
null
zulu/api.py
api.py
py
385
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.Zulu.now", "line_number": 9, "usage_type": "attribute" }, { "api_name": "datetime.Zulu", "line_number": 9, "usage_type": "name" }, { "api_name": "datetime.Zulu.parse", "line_number": 10, "usage_type": "attribute" }, { "api_name": "datetime....
628601682
#!/usr/bin/env python import rospy import yaml import rospkg config_file_location = "log_config.yaml" class topic_monitor: works = [] def __init__(self, topic_type, topic, min_freq): self.topic_type = topic_type self.msg_count = 0 self.count_list = [] self.working = True...
null
catkin_ws/src/Backup files/rqt_freq_monitor/src/rqt_freq_monitor/frequency_monitor.py
frequency_monitor.py
py
2,381
python
en
code
null
code-starcoder2
66
[ { "api_name": "rospy.Subscriber", "line_number": 20, "usage_type": "call" }, { "api_name": "rospy.AnyMsg", "line_number": 20, "usage_type": "attribute" }, { "api_name": "rospy.Timer", "line_number": 22, "usage_type": "call" }, { "api_name": "rospy.Duration", "...
154171154
import module.feature_engineering as fe import module.utility_es as es from gensim.models import Word2Vec, KeyedVectors import pickle from nltk.tokenize import word_tokenize import pandas as pd import numpy as np def get_entities(tokens, tags): entities_dict = { "NAME": [], "TYPE": [], ...
null
server/module/answer_ext.py
answer_ext.py
py
2,557
python
en
code
null
code-starcoder2
66
[ { "api_name": "nltk.tokenize.word_tokenize", "line_number": 36, "usage_type": "call" }, { "api_name": "module.feature_engineering.clean", "line_number": 37, "usage_type": "call" }, { "api_name": "module.feature_engineering", "line_number": 37, "usage_type": "name" }, ...
207277496
from sklearn.feature_extraction.text import TfidfVectorizer dataset = ["Load up on guns, bring your friends", "It's fun to lose and to pretend", "She's over-bored and self-assured", "Oh no, I know a dirty word", "Hello"] vectorizer = TfidfVectorizer() weighted_matrix = vect...
null
Key Terms Extraction/Key Terms Extraction/task/tfidf_score.py
tfidf_score.py
py
429
python
en
code
null
code-starcoder2
66
[ { "api_name": "sklearn.feature_extraction.text.TfidfVectorizer", "line_number": 9, "usage_type": "call" } ]
278674684
import cv2 import numpy as np from matplotlib import pyplot as plt img = cv2.imread('building2.jpg',0) sobelx = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=1) sobely = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=1) dst= np.hstack((sobelx,sobely)) cv2.imshow('dsti1',img) cv2.waitKey(0) cv2.imshow('dst',dst) cv2.waitKey(0)
null
Common/OpenCV/Day3/Set1/16sobel.py
16sobel.py
py
312
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.imread", "line_number": 4, "usage_type": "call" }, { "api_name": "cv2.Sobel", "line_number": 5, "usage_type": "call" }, { "api_name": "cv2.CV_64F", "line_number": 5, "usage_type": "attribute" }, { "api_name": "cv2.Sobel", "line_number": 6, ...
338652690
import abc import logging __all__ = ['ResolutionError', 'Resolvable', 'Promise', 'Referentiable', 'Reference'] log = logging.getLogger(__name__) class ResolutionError(RuntimeError): """Object could not be resolved.""" class Resolvable(abc.ABC): """An object that ...
null
virtualenv/lib/python3.8/site-packages/plum/resolvable.py
resolvable.py
py
2,250
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 9, "usage_type": "call" }, { "api_name": "abc.ABC", "line_number": 16, "usage_type": "attribute" }, { "api_name": "abc.abstractmethod", "line_number": 19, "usage_type": "attribute" } ]
575803586
# uncompyle6 version 3.7.4 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: build/bdist.macosx-10.13-x86_64/egg/max/run.py # Compiled at: 2019-04-27 23:02:52 import subprocess, sys, yaml, argparse, os from monkey.getbasic import GetBasic...
null
pycfiles/maxauto-1.0.1-py2.7/run.py
run.py
py
2,926
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.exists", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path", "line_number": 18, "usage_type": "attribute" }, { "api_name": "os.makedirs", "line_number": 21, "usage_type": "call" }, { "api_name": "monkey.getbasic.GetBasic", ...
257006151
import xmltodict import numpy as np import pandas as pd from functools import lru_cache from collections import Counter, defaultdict from tqdm.auto import tqdm from nlp import morph_parse, word2pos, tokenize, morphAnalyzer def normalize(v, epsilon=1e-10): return v / (sum(v**2)**0.5 + epsilon) class BaseSenten...
null
code/dale/my_knn.py
my_knn.py
py
13,092
python
en
code
null
code-starcoder2
66
[ { "api_name": "nlp.tokenize", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 34, "usage_type": "call" }, { "api_name": "functools.lru_cache", "line_number": 26, "usage_type": "call" }, { "api_name": "nlp.word2pos", "line...
425593383
import random import sqlite3 class saltClass(): def __init__(self, database=None, insults=None): self.conn = sqlite3.connect(database) self.c = self.conn.cursor() with open(insults, "r") as f: self.insults = [l.strip() for l in f.readlines()] def insult(self, name): ...
null
bokasafn/salty.py
salty.py
py
1,237
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 7, "usage_type": "call" }, { "api_name": "random.randint", "line_number": 14, "usage_type": "call" } ]
178541395
import pandas as pd import math import re import json # TableD = '' zhibiao_path = './zhibiao.json' zhibiao = '' # 读取csv文件 def read_file(path): return pd.read_csv(path, header=0, encoding='gbk') # 将A表中的数据按户进行划分 def spliteFamily(TableA,TableD): # 按照sid区分每一户 # 先取sid,去掉重复值 sid_array = TableA["SID"].drop...
null
src/process/test/test.py
test.py
py
10,081
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 11, "usage_type": "call" }, { "api_name": "re.match", "line_number": 123, "usage_type": "call" }, { "api_name": "re.match", "line_number": 147, "usage_type": "call" }, { "api_name": "re.match", "line_number": 154...
366423117
#!/usr/bin/env python import freshair, os, glob, sys, npr_utils import calendar, numpy, datetime, matplotlib from matplotlib.patches import Rectangle from mutagen.easymp4 import EasyMP4 from PyQt4.QtGui import QColor from optparse import OptionParser matplotlib.use('Agg') import pylab _default_inputdir = '/mnt/media...
null
freshair_by_year.py
freshair_by_year.py
py
9,917
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.use", "line_number": 10, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 17, "usage_type": "call" }, { "api_name": "calendar.monthcalendar", "line_number": 17, "usage_type": "call" }, { "api_name": "numpy.zeros", "...
348944063
#!/usr/bin/python import os import sys import logging import numpy as np import time from home_platform.env import BasicEnvironment from home_platform.utils import Viewer from home_platform.suncg import loadModel, SunCgSceneLoader from home_platform.acoustics import EvertAcoustics, CipicHRTF, FilterBank, \ Materi...
null
slam_ws/acoustic.py
acoustic.py
py
3,800
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 24, "usage_type": "call" }, { "api_name": "os.path", "line_number": 24, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 24, "usage_type": "call" }, { "api_name": "os.path.realpath", "lin...
411410325
# -*- coding: utf-8 -*- """ Created on Fri Dec 8 14:15:30 2017 analysing projector data on Taobao.com @author: talen """ import os,jieba,itertools import pandas as pd import collections as cc jieba.load_userdict('C:/WinPython-64bit-3.6.1.0Qt5/python-3.6.1.amd64/Lib/site-packages/jieba/projectornames.txt') os...
null
sales analysis.py
sales analysis.py
py
4,452
python
en
code
null
code-starcoder2
66
[ { "api_name": "jieba.load_userdict", "line_number": 10, "usage_type": "call" }, { "api_name": "os.chdir", "line_number": 11, "usage_type": "call" }, { "api_name": "pandas.read_excel", "line_number": 12, "usage_type": "call" }, { "api_name": "pandas.Series", "l...
575573102
#!/usr/bin/env python import argparse import bz2 import csv import hashlib import os import shlex import sqlite3 import subprocess import tempfile from pathlib import Path def parseArgs(): parser = argparse.ArgumentParser() parser.add_argument('csv_file', type=str, help='File containi...
null
src/gpu/DNNMark/generate_cachefiles.py
generate_cachefiles.py
py
4,289
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 16, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 33, "usage_type": "call" }, { "api_name": "os.path", "line_number": 33, "usage_type": "attribute" }, { "api_name": "sqlite3.connect", ...
100639889
#!usr/bin/env python ''' 变换函数:cv2.warpAffine ,cv2.warpPerspective cv2.warpAffine 接受2*3的变换矩阵 cv2.warpPerspective 接受3*3的变换矩阵 平移就是将对象换一个位置。如果你要沿(x,y)方向移动, 移动的距离 是(tx,ty),你可以以下面的方式构建移动矩阵: M= [1 0 tx] [0 1 ty] 使用 Numpy 数组构建这个矩阵(数据类型是 np.float32), 然 后把它传给函数 cv2.warpAffine()。 :函数 cv2.warpAffine() 的第三个参数的是输出图像的大小, 它的格式 应该是图像的(宽,...
null
Image Processing/Transformations/Translation.py
Translation.py
py
925
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.VideoCapture", "line_number": 20, "usage_type": "call" }, { "api_name": "cv2.imread", "line_number": 22, "usage_type": "call" }, { "api_name": "numpy.float32", "line_number": 25, "usage_type": "call" }, { "api_name": "cv2.warpAffine", "line_...
190937214
import logging import os from django.conf import settings from django.core.files.storage import get_storage_class from django.db import models from django.utils.timezone import now from django.utils.functional import cached_property from django import template register = template.Library() User = settings.AUTH_USER_MO...
null
codalab/apps/teams/models.py
models.py
py
7,651
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.template.Library", "line_number": 10, "usage_type": "call" }, { "api_name": "django.template", "line_number": 10, "usage_type": "name" }, { "api_name": "django.conf.settings.AUTH_USER_MODEL", "line_number": 11, "usage_type": "attribute" }, { ...
494315738
import json from django.http import HttpResponseRedirect from django.http import HttpResponse from django.shortcuts import get_object_or_404 from django.urls import reverse from django.contrib import messages from django.views import View from django.views.generic import FormView from django.views.generic import ListV...
null
Library/views.py
views.py
py
10,427
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.views.View", "line_number": 17, "usage_type": "name" }, { "api_name": "json.loads", "line_number": 23, "usage_type": "call" }, { "api_name": "django.http.HttpResponse", "line_number": 32, "usage_type": "call" }, { "api_name": "json.dumps", ...
140384265
import numpy as np import os import matplotlib.pyplot as plt from scipy import stats from scipy import optimize import LAMMPSTool as LT def Proportional(xData, m,c): return m*xData+c def IncreasingOnly(inArray, inTimes): arrMax = 0 lstValues = [] lstTimes = [] for i in range(len(inArray)): ...
null
ActivationEnergyPlot.py
ActivationEnergyPlot.py
py
5,228
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.array", "line_number": 23, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 33, "usage_type": "call" }, { "api_name": "numpy.loadtxt", "line_number": 34, "usage_type": "call" }, { "api_name": "numpy.loadtxt", "line_numbe...
445635864
import pandas as pd import xlsxwriter from matplotlib import pyplot as plt from scipy.stats import probplot, shapiro, ttest_ind import seaborn as sns import statsmodels.api as sm from statsmodels.formula.api import ols from scipy.stats import f_oneway import sys from PyQt5 import QtWidgets from PyQt5.QtWidg...
null
report.py
report.py
py
7,118
python
en
code
null
code-starcoder2
66
[ { "api_name": "PyQt5.QtWidgets.QDialog", "line_number": 16, "usage_type": "name" }, { "api_name": "PyQt5.uic.loadUi", "line_number": 19, "usage_type": "call" }, { "api_name": "PyQt5.QtWidgets.QFileDialog.getOpenFileName", "line_number": 23, "usage_type": "call" }, { ...
157515461
""" simple sample to start/stop EC2 instance """ import os, botocore import config as cfg from boto3 import client from flask import Flask, render_template, redirect # create EC2 service client client = client('ec2', aws_access_key_id = cfg.AWS_ACCESS_ID, aws_secret_access_key=cfg.AWS...
null
py-ec2.py
py-ec2.py
py
1,539
python
en
code
null
code-starcoder2
66
[ { "api_name": "boto3.client", "line_number": 10, "usage_type": "name" }, { "api_name": "config.AWS_ACCESS_ID", "line_number": 11, "usage_type": "attribute" }, { "api_name": "config.AWS_ACCESS_KEY", "line_number": 12, "usage_type": "attribute" }, { "api_name": "con...
455080678
from typing import Deque from collections import deque # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sum(self, root: TreeNode) -> int: _sum: int = 0 if not root: ...
null
leetcode_563/solution.py
solution.py
py
1,113
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.Deque", "line_number": 18, "usage_type": "name" }, { "api_name": "collections.deque", "line_number": 18, "usage_type": "call" } ]
464302176
from estruturas.Ponto import Ponto from estruturas.Vizinhanca import Vizinhanca from estruturas.Local import Local from estruturas.CasoInfeccao import CasoInfeccao from estruturas.Controle import Controle from estruturas.TipoTrajeto import TipoTrajeto from estruturas.ControlePonto import ControlePonto from estruturas.R...
null
banco/ConsultasBanco.py
ConsultasBanco.py
py
14,126
python
en
code
null
code-starcoder2
66
[ { "api_name": "psycopg2.connect", "line_number": 69, "usage_type": "call" }, { "api_name": "psycopg2.extras", "line_number": 71, "usage_type": "attribute" }, { "api_name": "estruturas.Ponto.Ponto", "line_number": 101, "usage_type": "call" }, { "api_name": "estrutu...
85836329
import argparse import os import glob import shutil import random def die(string): print(string) exit(1) class Options: def __init__(self): self.initialized=False def initialize(self,parser): parser.add_argument("--input_data_folder", type=str, required=True, help="ex)./data/original"...
null
divide_into_trainvaltest.py
divide_into_trainvaltest.py
py
5,234
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 27, "usage_type": "call" }, { "api_name": "argparse.ArgumentDefaultsHelpFormatter", "line_number": 27, "usage_type": "attribute" }, { "api_name": "os.mkdir", "line_number": 67, "usage_type": "call" }, { "api_...
45757234
#!/usr/bin/python # -*- coding: latin-1 -*- ''' This libraries contained the graphical functions useful for the CRN analysis ''' import sys, os # Standard library import matplotlib as mpl mpl.use('Agg') import numpy as np import random as ran from matplotlib import rc import matplotlib.mlab as mlab import matplotlib....
null
_analysis/pythonTools/lib/visual/graphics.py
graphics.py
py
7,765
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.use", "line_number": 9, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.rc", "line_number": 24, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 24, "usage_type": "name" }, { "api_name": "matplotlib.pyplo...
391804949
"""This module contains the termite tracking functionalities.""" import sys import random import cv2 import data class Termite: """Termite under study abstraction.""" def __init__(self, identity, starting_point, box_size=20): """Initializer. Args: identity (int): termite identit...
null
trackingtermites/tracking.py
tracking.py
py
5,996
python
en
code
null
code-starcoder2
66
[ { "api_name": "random.randint", "line_number": 25, "usage_type": "call" }, { "api_name": "data.DataHandler", "line_number": 62, "usage_type": "call" }, { "api_name": "cv2.VideoCapture", "line_number": 64, "usage_type": "call" }, { "api_name": "sys.exit", "line...
605903009
# coding:utf-8 import tornado.testing import tornado.web import motor.motor_tornado from app import * import os class TestSample(tornado.testing.AsyncHTTPTestCase): def setUp(self): super(TestSample,self).setUp() def get_app(self): db = motor.motor_tornado.MotorClient().prototest_db return tornado.web.Ap...
null
test_app.py
test_app.py
py
2,046
python
en
code
null
code-starcoder2
66
[ { "api_name": "tornado.testing.testing", "line_number": 10, "usage_type": "attribute" }, { "api_name": "tornado.testing", "line_number": 10, "usage_type": "name" }, { "api_name": "motor.motor_tornado.motor_tornado.MotorClient", "line_number": 15, "usage_type": "call" },...
400394739
import pytest import random import numpy as np from kaggle_environments import make from hungry_geese.agents import QValueAgent, QValueSafeAgent, QValueSafeMultiAgent from hungry_geese.utils import ACTIONS, opposite_action from hungry_geese.model import N_ACTIONS random.seed(7) np.random.seed(7) class FakeModelUnifo...
null
tests/agents/test_q_value.py
test_q_value.py
py
4,658
python
en
code
null
code-starcoder2
66
[ { "api_name": "random.seed", "line_number": 10, "usage_type": "call" }, { "api_name": "numpy.random.seed", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 11, "usage_type": "attribute" }, { "api_name": "numpy.ones", "lin...
103693657
from html import escape from aiogram import Dispatcher from telethon.tl.types import Channel from telethon.errors import ChannelPrivateError, RPCError from database import Database from broadcaster import Broadcaster from globals import client, bot, DIR_PATH from filters import * from utils import get_entity, answer, ...
null
handlers.py
handlers.py
py
7,626
python
en
code
null
code-starcoder2
66
[ { "api_name": "aiogram.Dispatcher", "line_number": 13, "usage_type": "call" }, { "api_name": "globals.bot", "line_number": 13, "usage_type": "argument" }, { "api_name": "database.Database", "line_number": 14, "usage_type": "call" }, { "api_name": "globals.DIR_PATH...
494403573
from flask import Flask from database import db from sqlalchemy_utils import create_database, database_exists from routes.routes import blue_print from flask_jwt_extended import JWTManager, jwt_manager import datetime import os app = Flask(__name__) #Valriables SQL db_usuario = os.environ.get('DB_USUARIO') db_clave =...
null
app/app.py
app.py
py
1,051
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 9, "usage_type": "call" }, { "api_name": "os.environ.get", "line_number": 12, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 12, "usage_type": "attribute" }, { "api_name": "os.environ.get", "line_...
576647085
"""mypoll URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
null
poll/urls.py
urls.py
py
2,301
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.conf.urls.url", "line_number": 28, "usage_type": "call" }, { "api_name": "poll.views.IndexView", "line_number": 28, "usage_type": "attribute" }, { "api_name": "poll.views", "line_number": 28, "usage_type": "name" }, { "api_name": "django.conf...
49190242
#! coding: utf-8 from django import template register = template.Library() #http://stackoverflow.com/questions/4356329/creating-a-python-dictionary-from-a-line-of-text/4356415#4356415 def pairwise(iterable): #s -> (s0,s1), (s2,s3), (s4, s5), ... a = iter(iterable) return zip(a, a) @register.inclusion_t...
null
breadcrumbs/templatetags/breadcrumb_tags.py
breadcrumb_tags.py
py
4,110
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.template.Library", "line_number": 4, "usage_type": "call" }, { "api_name": "django.template", "line_number": 4, "usage_type": "name" } ]
154625776
# Copyright 2016 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_tensorflow_nightly/source2.7/tensorflow/contrib/framework/python/framework/checkpoint_utils.py
checkpoint_utils.py
py
11,621
python
en
code
null
code-starcoder2
66
[ { "api_name": "tensorflow.python.platform.gfile.IsDirectory", "line_number": 42, "usage_type": "call" }, { "api_name": "tensorflow.python.platform.gfile", "line_number": 42, "usage_type": "name" }, { "api_name": "tensorflow.python.training.saver.latest_checkpoint", "line_numb...
184021691
# -*- coding: utf-8 -*- """ Created on Tue Feb 5 23:49:45 2019 @author: MAGESHWARAN """ import pandas as pd import numpy as np from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier iris = pd.read_csv("Iris.data.csv", sep =...
null
My_algorithms/k_nearest_neighbors/k_nearest_neighbors_scikit.py
k_nearest_neighbors_scikit.py
py
949
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.ones", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 25, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_...
456765730
import json import os import numpy import paramiko deployment_output = json.load(open("deployment_output.json")) copy_done_vm = {} key_path = "/home/violetadmin1/.ssh/id_rsa" copy_file = "jar/" fog_to_privateip = {} privateip_to_fog = {} edgeip_to_vm = {} fogno_to_globalpublicip ={} vm_copy_status = {} for key in ...
null
deployment/custom/copy_to_edge.py
copy_to_edge.py
py
1,845
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.load", "line_number": 6, "usage_type": "call" }, { "api_name": "paramiko.RSAKey.from_private_key_file", "line_number": 48, "usage_type": "call" }, { "api_name": "paramiko.RSAKey", "line_number": 48, "usage_type": "attribute" }, { "api_name": "p...
2083959
from common.lib.servers.Pulser2.pulse_sequences.pulse_sequence import pulse_sequence from sub_sequences.DopplerCooling import doppler_cooling from sub_sequences.ProbeLaser import probe_laser from sub_sequences.PhotonTimeTags import photon_timetags from labrad.units import WithUnit class probe_line_scan(pulse_sequenc...
null
lib/scripts/pulse_sequences/ProbeLineScan.py
ProbeLineScan.py
py
1,027
python
en
code
null
code-starcoder2
66
[ { "api_name": "common.lib.servers.Pulser2.pulse_sequences.pulse_sequence.pulse_sequence", "line_number": 9, "usage_type": "name" }, { "api_name": "sub_sequences.DopplerCooling.doppler_cooling.all_required_parameters", "line_number": 12, "usage_type": "call" }, { "api_name": "sub_...
68078092
import cv2 from .abstract_image import AbstractImage from flax_baseline.common.flax_log import flax_log from flax_baseline.common.flax_debug import flax_debug # from flax_baseline.common.flax_config import flax_config from flax_baseline.components.factory.denoise_factory import DenoiseFactory from flax_baseline.compone...
null
flax_baseline/components/img_process/base/base_image.py
base_image.py
py
3,709
python
en
code
null
code-starcoder2
66
[ { "api_name": "abstract_image.AbstractImage", "line_number": 10, "usage_type": "name" }, { "api_name": "flax_baseline.common.flax_log.flax_log", "line_number": 28, "usage_type": "name" }, { "api_name": "flax_baseline.common.flax_debug.flax_debug", "line_number": 29, "usag...
219721255
import boto3 import os import cv2 import time def grabar():#splitvideo2 video = cv2.VideoCapture(0) nframes = 0 hora_inicio = time.time() print(hora_inicio) try: if not os.path.exists('data'): os.makedirs('data') except OSError: print('Error: Creati...
null
Proyect/combination.py
combination.py
py
2,682
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.VideoCapture", "line_number": 9, "usage_type": "call" }, { "api_name": "time.time", "line_number": 11, "usage_type": "call" }, { "api_name": "os.path.exists", "line_number": 14, "usage_type": "call" }, { "api_name": "os.path", "line_number":...
612740918
#!/usr/bin/env python3 # Report Tool to quesy news database and present it in a text import psycopg2 DBNAME = "news" def get_most_popular_articles(): """Return most popular articles from the 'database', most viewed first.""" db = psycopg2.connect(database=DBNAME) c = db.cursor() c.execute("SELECT ar...
null
report.py
report.py
py
2,068
python
en
code
null
code-starcoder2
66
[ { "api_name": "psycopg2.connect", "line_number": 11, "usage_type": "call" }, { "api_name": "psycopg2.connect", "line_number": 23, "usage_type": "call" }, { "api_name": "psycopg2.connect", "line_number": 35, "usage_type": "call" } ]
323292539
import os import numpy as np import pandas as pd from sklearn.tree import DecisionTreeRegressor from sklearn.metrics import mean_squared_error import base_methods as base def decision_tree(): prefix = 'Data/' # ------------------------------- Learning ------------------------------- # # Load training dat...
null
Models/dt.py
dt.py
py
1,169
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 14, "usage_type": "call" }, { "api_name": "base_methods.load_from_csv", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path", ...
636402898
# -*- coding: utf-8 -*- """ Created on Sat Nov 21 17:21:44 2020 @author: lenovoz """ import pickle import socket import struct import cv2 HOST = '192.168.1.63' PORT = 8089 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print('Socket created') s.bind((HOST, PORT)) print('Socket bind comp...
null
VideoSend/ServerVideo.py
ServerVideo.py
py
1,236
python
en
code
null
code-starcoder2
66
[ { "api_name": "socket.socket", "line_number": 17, "usage_type": "call" }, { "api_name": "socket.AF_INET", "line_number": 17, "usage_type": "attribute" }, { "api_name": "socket.SOCK_STREAM", "line_number": 17, "usage_type": "attribute" }, { "api_name": "struct.calc...
452540884
#!/usr/bin/python3 import cgi import subprocess print("content-type: text/html") print() mydata = cgi.FieldStorage() imagename = mydata.getvalue("x") cmd = "sudo docker rm -f {}".format(imagename) output = subprocess.getoutput(cmd) print(output)
null
removeContainer.py
removeContainer.py
py
253
python
en
code
null
code-starcoder2
66
[ { "api_name": "cgi.FieldStorage", "line_number": 10, "usage_type": "call" }, { "api_name": "subprocess.getoutput", "line_number": 15, "usage_type": "call" } ]
418762418
import os import re import tempfile from abc import ABC from typing import Dict, Text import boto3 import tensorflow as tf import tensorflow_io as tfio import tensorflow_recommenders as tfrs import urllib3 from recommender_system.recsys_core.recsys_utils import print_with_date # from tqdm.keras import TqdmCallback ...
null
recsys_tfrs_model.py
recsys_tfrs_model.py
py
12,527
python
en
code
null
code-starcoder2
66
[ { "api_name": "tensorflow.distribute.MultiWorkerMirroredStrategy", "line_number": 23, "usage_type": "call" }, { "api_name": "tensorflow.distribute", "line_number": 23, "usage_type": "attribute" }, { "api_name": "tensorflow_recommenders.Model", "line_number": 31, "usage_ty...
172657702
import json from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import SGDClassifier f=open('training.json', 'r') N=int(f.readline()) i=0 train_ans=[] train=[] topic_list=[] for line in f: j = json.loads(line) topic = (j['topic']) if topic in topic_list: topicN = t...
null
Stack Exchange Question Classifier.py
Stack Exchange Question Classifier.py
py
1,006
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.loads", "line_number": 12, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 26, "usage_type": "call" }, { "api_name": "sklearn.feature_extraction.text.TfidfVectorizer", "line_number": 28, "usage_type": "call" }, { "api_name": ...
85459612
""" Adversarial Attacks in Pytorch Written by Harry Kim Licensed under the MIT License WARNING :: All images should be scaled to [0, 1] with transform[to.Tensor()] before used in attacks. WARNING :: All models should return ONLY ONE vector of `(N, C)` where `C = number of classes`. """ import torch import torch.nn ...
null
torchattacks/torchattacks.py
torchattacks.py
py
14,359
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.device", "line_number": 30, "usage_type": "call" }, { "api_name": "torch.max", "line_number": 58, "usage_type": "call" }, { "api_name": "torch.uint8", "line_number": 64, "usage_type": "attribute" }, { "api_name": "torch.cat", "line_number"...
31838145
#This sets up the entire application, which reads the default configuration and initialize the UI #Last updated on 04/15/2019 by Y. Xiang #This code is written in Python 3.6.6 64-bit from PyQt5 import QtGui, QtWidgets, QtCore import broadening import gmm import configparser import generate_report import graph_3D_surfac...
null
source/main.py
main.py
py
7,333
python
en
code
null
code-starcoder2
66
[ { "api_name": "configparser.ConfigParser", "line_number": 23, "usage_type": "call" }, { "api_name": "PyQt5.QtWidgets.QApplication", "line_number": 25, "usage_type": "call" }, { "api_name": "PyQt5.QtWidgets", "line_number": 25, "usage_type": "name" }, { "api_name":...