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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6946844574 | import pandas as pd
import numpy as np
import re
from sklearn.model_selection import train_test_split
from bs4 import BeautifulSoup
import nltk
from nltk import word_tokenize
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from gensim.models import Word2Vec
from keras.preprocessi... | BINHONG-SU/AMLS_II_assignment19_20- | DataProcessing.py | DataProcessing.py | py | 5,639 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "nltk.corpus.stopwords.words",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "nltk.corpus.stopwords",
"line_number": 25,
"usage_type": "name"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "r... |
72442802919 | import random
import math
import pygame
from pygame.locals import *
# Colors
BACKGROUND = (187, 173, 160)
TILE_COLOR = {
'0' : (204, 192, 179),
'2' : (238, 228, 218),
'4' : (237, 224, 200),
'8' : (242, 177, 121),
'16' : (245, 149, 99),
'32' : (246, 124, 95),
'64... | filipposerafini/PyGame2048 | 2048.py | 2048.py | py | 10,836 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "pygame.Vector2",
"line_number": 58,
"usage_type": "call"
},
{
"api_name": "pygame.Surface",
"line_number": 99,
"usage_type": "call"
},
{
"api_name": "pygame.draw.rect",
"line_number": 105,
"usage_type": "call"
},
{
"api_name": "pygame.draw",
"li... |
4600772003 | from fastapi import FastAPI
from pydantic import BaseModel
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
fakedb = []
class myinfo(B... | samriddhisv/FastAPI_Backend_Project_PESUIO | main.py | main.py | py | 1,153 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "fastapi.FastAPI",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "fastapi.middleware.cors.CORSMiddleware",
"line_number": 10,
"usage_type": "argument"
},
{
"api_name": "pydantic.BaseModel",
"line_number": 19,
"usage_type": "name"
},
{
"api_... |
884340632 | #!/usr/bin/env python
from pathlib import Path
import os
import sys
import json
import subprocess
import collections.abc
import datetime
def update(d, u):
for k, v in u.items():
if isinstance(v, collections.abc.Mapping):
d[k] = update(d.get(k, {}), v)
else:
d[k] = v
retu... | graehu/ta-git | ta-git.py | ta-git.py | py | 7,805 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "collections.abc.abc",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "collections.abc",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "sys.argv",
"line_number": 20,
"usage_type": "attribute"
},
{
"api_name": "os.path",
... |
27768703664 | """Config and Funcs"""
from discord.emoji import Emoji
from discord.enums import ButtonStyle
from discord.interactions import Interaction
from discord.partial_emoji import PartialEmoji
from discord.ui.item import Item
import config as cfg
import discord
from discord.ui import *
from discord.ext import commands
import... | wuliao97/DiSpotify-old | funcs.py | funcs.py | py | 7,423 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "discord.ui",
"line_number": 35,
"usage_type": "attribute"
},
{
"api_name": "discord.ui",
"line_number": 41,
"usage_type": "attribute"
},
{
"api_name": "discord.ext.commands.Bot",
"line_number": 42,
"usage_type": "attribute"
},
{
"api_name": "discord... |
32071060069 | from __future__ import annotations
from unittest.mock import Mock
import torch
from coola import objects_are_equal
from pytest import mark, raises
from torch.utils.data.datapipes.iter import IterableWrapper
from redcat import BatchedTensor
from redcat.datapipes.iter import BatchExtender
from redcat.datapipes.iter.jo... | durandtibo/redcat | tests/unit/datapipes/iter/test_joining.py | test_joining.py | py | 4,014 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "redcat.datapipes.iter.BatchExtender",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "torch.utils.data.datapipes.iter.IterableWrapper",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "redcat.datapipes.iter.BatchExtender",
"line_number": 25,
... |
75369447399 | from django.urls import path
from . import views
app_name = 'core'
urlpatterns = [
path("", views.index, name='index'),
path('pdf/<int:pdf_id>/', views.pdf_view, name='pdf_view'),
path("projects/", views.projects, name='projects'),
# path("contact/", views.contact, name='contact'),
] | ryanpereda/django-test | django_test/core/urls.py | urls.py | py | 303 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.urls.path",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "django.urls.path",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "django.urls.path",
"line_number": 10,
"usage_type": "call"
}
] |
36662031870 | from flask import Flask, render_template, request, redirect, session
import random
app = Flask(__name__)
app.secret_key = "baloney"
@app.route("/")
def index():
if "Gold" not in session:
session["Gold"] = 100
if "logger" not in session:
session["logger"] = []
if "count" not in session:
session["count"] = 0
i... | RayS99/ninjagold | gold.py | gold.py | py | 1,579 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "flask.Flask",
"line_number": 3,
"usage_type": "call"
},
{
"api_name": "flask.session",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "flask.session",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "flask.session",
"line_number... |
35510628571 | from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers.core import Flatten, Dense
from keras.optimizers import SGD
def cnn_model(image_wdith, image_height, channels, classes):
model = Sequential()
model.add(Conv2D(filters=64, kernel_size=3, strides=1, padding='sa... | Jacqueline121/FBGAN_and_MVGG16 | Different Classification Methods/CNN/CNN.py | CNN.py | py | 1,104 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "keras.models.Sequential",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "keras.layers.Conv2D",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "keras.layers.MaxPooling2D",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "... |
39067163486 | import numpy as np
import cv2
import sys
PATH_VIDEO = r'D:\Databases\Videos'
PONTE_VIDEO = PATH_VIDEO + r'\Ponte.mp4'
algorithm_types = {
'KNN': cv2.createBackgroundSubtractorKNN(),
'GMG': cv2.bgsegm.createBackgroundSubtractorGMG(),
'CNT': cv2.bgsegm.createBackgroundSubtractorCNT(),
'MOG': ... | RobertoRosa7/python | py_detecao_movimentos/counter.py | counter.py | py | 3,445 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "cv2.createBackgroundSubtractorKNN",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "cv2.bgsegm.createBackgroundSubtractorGMG",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "cv2.bgsegm",
"line_number": 10,
"usage_type": "attribute"
},
... |
75115417000 | import os
from typing import Optional
from bs4 import BeautifulSoup
from weasyprint import HTML
from .errors import EpubMissingNcx, MissingTmpDirPath, TmpPathDoesntExists
from ..epub import Epub
class Pdf:
def __init__(self) -> None:
self.contents_dir = None
self.epub = None
self.tmp_dir... | EstebanBorai/rewritt | rewritt/converter/pdf/pdf.py | pdf.py | py | 2,753 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "typing.Optional",
"line_number": 19,
"usage_type": "name"
},
{
"api_name": "os.getcwd",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 3... |
26515066725 | import collections
import functools
from absl.testing import absltest
from absl.testing import parameterized
from dm_alchemy import event_tracker as ev_trk
from dm_alchemy import symbolic_alchemy_bots
from dm_alchemy import symbolic_alchemy_trackers
from dm_alchemy.ideal_observer import ideal_observer
from dm_alchemy.... | deepmind/dm_alchemy | dm_alchemy/ideal_observer/ideal_observer_test.py | ideal_observer_test.py | py | 13,801 | python | en | code | 190 | github-code | 18 | [
{
"api_name": "collections.Counter",
"line_number": 16,
"usage_type": "attribute"
},
{
"api_name": "dm_alchemy.types.stones_and_potions.AlignedStone",
"line_number": 17,
"usage_type": "attribute"
},
{
"api_name": "dm_alchemy.types.stones_and_potions",
"line_number": 17,
"... |
39048489578 | # -*- coding: UTF-8 -*-
"""
Based on ``behave tutorial``
Feature: Step Result Table
Scenario: Unordered Result Table Comparison (RowFixture Table)
Given a set of specific users
| name | department |
| Alice | Beer Cans |
| Bob | Beer Cans |
| Charly | Sil... | behave/behave.example | features/steps/step_tutorial07.py | step_tutorial07.py | py | 3,208 | python | en | code | 146 | github-code | 18 | [
{
"api_name": "hamcrest.assert_that",
"line_number": 54,
"usage_type": "call"
},
{
"api_name": "hamcrest.assert_that",
"line_number": 60,
"usage_type": "call"
},
{
"api_name": "hamcrest.library.collection.issequence_containinginanyorder.contains_inanyorder",
"line_number": 60... |
24888286461 | from enum import IntEnum
from discord import Embed, Permissions
class OpStatus(IntEnum):
SUCCESS = 0x2ECC71,
FAILURE = 0xc0392B,
WARNING = 0xf39C12,
NONE = -1
def build_embed(ctx, desc: str, title: str = '', status: OpStatus = OpStatus.SUCCESS) -> Embed:
name = ctx.message.server.me.nick if ctx.message.server.... | HellPie/discord-reply-bot | bot/utils.py | utils.py | py | 2,178 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "enum.IntEnum",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "discord.Embed",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "discord.Embed",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "discord.Permissions",
"li... |
21597308182 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 27 09:50:47 2021
@author: 12086
"""
################################################################
# Jared McDaniel #
# ECE 351 Section 51 #
# Lab 5 ... | JMac1999/ECE351_Code | McDaniel_Jared_ECE351_Lab5.py | McDaniel_Jared_ECE351_Lab5.py | py | 3,016 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "matplotlib.pyplot.rcParams.update",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.rcParams",
"line_number": 23,
"usage_type": "attribute"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 23,
"usage_type": "name"
},
{
... |
41546864735 | # 子图与多种图形绘制
# 常用图表
# 有点太复杂,目前看不懂2019年02月15日17:13:46
import numpy as np
import matplotlib.pyplot as plt
def main():
# 散点图 scatter
fig = plt.figure()
# 表示散点图画在此区域内
ax = fig.add_subplot(3, 3, 1)
n = 102
# 随机数
X = np.random.normal(0, 1, n)
Y = np.random.normal(0, 1, n)
# 上色,Y除以X(颜色展示)... | huohuo123/PythonProject | DataAnalysisCode/matplotlib/matplotlibTest2.py | matplotlibTest2.py | py | 3,340 | python | zh | code | 0 | github-code | 18 | [
{
"api_name": "matplotlib.pyplot.figure",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "numpy.random.normal",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "numpy.... |
12870859416 | #!/usr/bin/python3
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_selection import chi2
from io import StringIO
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountV... | valancej/vulnerability-data-classification | model.py | model.py | py | 2,491 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "pandas.read_json",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "sklearn.feature_extraction.text.TfidfVectorizer",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "sklearn.feature_selection.chi2",
"line_number": 38,
"usage_type": "call"... |
4950706033 | # -*- coding: utf-8 -*-
from django.utils.datastructures import MultiValueDictKeyError
from django.views.decorators.csrf import csrf_exempt
from django.http import JsonResponse
from django.shortcuts import render
import urllib.request, json
import requests
import time
##PRODUCTION
@csrf_exempt
def get_location_userna... | sergiosuarez/torre-backend | geotorre/backend/views.py | views.py | py | 6,835 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.http.JsonResponse",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "django.views.decorators.csrf.csrf_exempt",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "django.http.JsonResponse",
"line_number": 30,
"usage_type": "call"
},... |
10999593196 | import pyogmaneo
import gym
import numpy as np
# Squashing function
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x))
# Create the environment
env = gym.make('CartPole-v1')
# Get observation size
numObs = env.observation_space.shape[0] # 4 values for Cart-Pole
numActions = env.action_space.n # N actions (1 discret... | ogmacorp/PyOgmaNeo2 | examples/CartPole_Manual.py | CartPole_Manual.py | py | 2,565 | python | en | code | 18 | github-code | 18 | [
{
"api_name": "numpy.exp",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "gym.make",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "pyogmaneo.ComputeSystem.setNumThreads",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "pyogmaneo.Com... |
41082785864 | from flask import Blueprint, jsonify, abort, request
from ..healthtrace_models import Clinics, db
bp = Blueprint('clinics', __name__, url_prefix='/clinics')
@bp.route('', methods=['GET'])
def get_all_clinics():
clinics = Clinics.query.all()
result = []
for c in clinics:
result.append(c.serialize())... | pvmartins/Nucamp_bootcamp | 2-SQL/healthtrace/src/api/clinics.py | clinics.py | py | 2,059 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "flask.Blueprint",
"line_number": 3,
"usage_type": "call"
},
{
"api_name": "healthtrace_models.Clinics.query.all",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "healthtrace_models.Clinics.query",
"line_number": 7,
"usage_type": "attribute"
},
... |
21164584188 | import streamlit as st
from model.banco import Banco
from time import sleep
banco = Banco()
data_hospital = ()
st.title("Hospital")
def inputs_hospital(layout, key='include_hospital'):
with layout.form(key=f"{key}", clear_on_submit = False):
input_hospital_code = st.number_input(label="Código do Hospital", step... | plmorais/IAAD | pages/hospital.py | hospital.py | py | 3,306 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "model.banco.Banco",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "streamlit.title",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "streamlit.number_input",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "streamlit.text... |
15500756910 | from flask import jsonify
import json
import requests
from grocerylistapp.errors.exceptions import InvalidUsage
from urllib.parse import urlparse
from bs4 import BeautifulSoup
# repeated attributes for sites using WordPress Recipe maker
wprm_scrapers = {
"title": ("h2", "class", "wprm-recipe-name"),
"lines... | wenzstev/groceryappRestAPI | grocerylistapp/scraper.py | scraper.py | py | 7,199 | python | en | code | 2 | github-code | 18 | [
{
"api_name": "requests.get",
"line_number": 146,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 151,
"usage_type": "call"
},
{
"api_name": "urllib.parse.urlparse",
"line_number": 153,
"usage_type": "call"
},
{
"api_name": "grocerylistap... |
74539297639 | from datetime import datetime
from email.mime import image
from xml.dom.minicompat import NodeList
from flask import render_template, jsonify, redirect, url_for, flash, request
import hashlib
import json
import sqlite3
from importlib_metadata import files
from numpy import block
from Blockchain.bfunctions import *
fro... | muderick/Anti-Money-Laundering-with-Blockchain | Blockchain/bchain.py | bchain.py | py | 14,103 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "uuid.uuid4",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "sqlite3.connect",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "Blockchain.model.Transactions.query.all",
"line_number": 38,
"usage_type": "call"
},
{
"api_name": "Bl... |
15703488595 | import matplotlib
from matplotlib import pyplot as plt
import glob
import numpy as np
import sys
filename = sys.argv[1]
r = np.genfromtxt(filename,usecols=0)
rho = np.genfromtxt(filename,usecols=1)
P = np.genfromtxt(filename,usecols=2)
vp = np.genfromtxt(filename,usecols=6)
vr = np.genfromtxt(filename,usecols=3)
alp... | brianfarris/Disco2 | plotting_scripts/plot_SStest.py | plot_SStest.py | py | 2,172 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "sys.argv",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "numpy.genfromtxt",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "numpy.genfromtxt",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "numpy.genfromtxt",
... |
4668990401 | from typing import List
class Solution:
def shortestPathLength(self, graph: List[List[int]]) -> int:
n = len(graph)
vis = [[False for _ in range(1 << n)] for _ in range(n)]
q = list()
for i in range(n):
q.append((i, 1 << i, 0))
vis[i][1 << i] = True
... | yucongxing/leetcode | 0847_Shortest_Path_Visiting_All_Nodes.py | 0847_Shortest_Path_Visiting_All_Nodes.py | py | 806 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "typing.List",
"line_number": 5,
"usage_type": "name"
}
] |
37961145770 | import csv
import os
from collections import Counter
numvotes = Counter()
candidates = []
output = []
pervote = []
# Reads in csv file
csvpath = os.path.join("Resources", "election_data.csv")
with open(csvpath, newline = "") as csvfile:
csvreader = csv.reader(csvfile, delimiter=",")
next(csvreader)
... | ryan10611/python-challenge | PyPoll/main.py | main.py | py | 1,860 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "collections.Counter",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "csv.reader",
"line_n... |
25818286786 | from django.views.generic import TemplateView
import requests
class HomeView(TemplateView):
template_name = "index.html"
api_key = 'AIzaSyC-IpGE2nkQsstBu4KAOEV2u5v2Qxcud8E'
id_youtube = 'UCx7zc0MyoSdDSQXvq5Gl8gg'
part = 'snippet,statistics'
def get_context_data(self, **kwargs):
context = s... | asrulmaaliy26/tugassisterpakfajarsemester5 | 6.sosmed/youtubeapi/youtubeapi/views.py | views.py | py | 957 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "django.views.generic.TemplateView",
"line_number": 4,
"usage_type": "name"
},
{
"api_name": "requests.get",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "requests.exceptions",
"line_number": 19,
"usage_type": "attribute"
}
] |
86715875329 | # -*-coding:utf-8-*-
"""
Author: Rage
Date: 19-4-26
"""
import xlwt
import queue
import threading
import time
StopEvent = object()
class ThreadPool:
def __init__(self, max_num, max_tast_num=0):
self.max_num = max_num # 最大线程数
if max_tast_num: # 根据是否指定最大任务数来指定队列程度
self.q = queue.... | JustMeliyu/training | next_station/thread_process/thread_write_execl.py | thread_write_execl.py | py | 3,862 | python | zh | code | 0 | github-code | 18 | [
{
"api_name": "queue.Queue",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "queue.Queue",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "threading.Thread",
"line_number": 38,
"usage_type": "call"
},
{
"api_name": "threading.currentThread",
... |
39669804186 | from flask import Flask, request, redirect, render_template, session, flash
from mysqlconnection import MySQLConnector
app = Flask(__name__)
mysql = MySQLConnector(app,'mydb')
@app.route('/')
def index():
query = "SELECT name, age, date_format(friendsince, '%M %d %Y') as dates FROM friends"
friends = mysql.query_db(q... | vincentereyes/pythonflask | fullfriends/server.py | server.py | py | 810 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "flask.Flask",
"line_number": 3,
"usage_type": "call"
},
{
"api_name": "mysqlconnection.MySQLConnector",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "flask.render_template",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "flask.... |
19313511801 | from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.text import slugify
def replace_characters(text):
text = text.replace('ə', 'e')
text = text.replace('ç', 'c')
text = text.replace('ğ', 'g')
text = text.replace('ö', 'o')
text = text.replace('ş', 's')... | Metanet96/news_site | front/models.py | models.py | py | 2,330 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.utils.text.slugify",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "django.contrib.auth.models.AbstractUser",
"line_number": 27,
"usage_type": "name"
},
{
"api_name": "django.db.models.Model",
"line_number": 31,
"usage_type": "attribute"
... |
34906882107 | import json
import os
import logbook
logger = logbook.Logger("config")
mongo_connection = json.loads(os.getenv('MONGO_CONNECTION', '"mongodb://localhost:27017"'))
redis_connection = json.loads(os.getenv('REDIS_CONNECTION', '"redis://localhost:6379/1"'))
dal_url = json.loads(os.getenv('DAL_CONNECTION', '""'))
sentry_... | guydolinksy/truemedicalreport | src/backend/backend/config.py | config.py | py | 1,370 | python | en | code | 5 | github-code | 18 | [
{
"api_name": "logbook.Logger",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "json.loads",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "os.getenv",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "json.loads",
"line_number": 9,
... |
33591429239 | import torch
from algorithms.meanshift_base import MeanShiftBase
class MeanShiftPytorch(MeanShiftBase):
def __init__(self, cuda=True, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.cuda = cuda
self.pi = torch.asin(torch.tensor(1.))
if cuda:
self.pi... | creinders/ClusteringAlgorithmsFromScratch | algorithms/meanshift_pt.py | meanshift_pt.py | py | 1,917 | python | en | code | 9 | github-code | 18 | [
{
"api_name": "algorithms.meanshift_base.MeanShiftBase",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "torch.asin",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "torch.tensor",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "torch.... |
6231942177 | import copy
import json
import logging
import time
import gevent
from gevent import monkey
from common.influxdb import influxdb_connections
from utils.time import floor_minute
from dmonitor.alert.alert_codes import AlertCode, AlertLevel, AlertStatus, AlertType
from dmonitor.metrics.base import DataLossOutputTotal
fr... | Tencent/bk-base | src/datamgr/datamanager/dmonitor/monitor/data_trend_alert.py | data_trend_alert.py | py | 23,123 | python | en | code | 85 | github-code | 18 | [
{
"api_name": "gevent.monkey.patch_all",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "gevent.monkey",
"line_number": 17,
"usage_type": "name"
},
{
"api_name": "logging.info",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "logging.error",
... |
28180927239 | # -*- coding: utf-8 -*-
"""
@author: nina
"""
import time
import itertools
start_time = time.time()
f = open('day24.txt', 'r')
txt = f.readlines()
tiles = []
for line in txt:
txt2 = line.replace('e','e.').replace('w','w.')
l = txt2.split('.')
tiles.append(l[:-1])
tile_dict = {}
for tile in tiles:
x ... | nina-balerina/AoC_2020 | day24.py | day24.py | py | 2,403 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "time.time",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "time.time",
"line_number": 48,
"usage_type": "call"
},
{
"api_name": "itertools.product",
"line_number": 51,
"usage_type": "call"
},
{
"api_name": "time.time",
"line_number": 8... |
40413675429 | import collections
import math
############################################################
# Problem 3a
def findAlphabeticallyLastWord(text):
"""
Given a string |text|, return the word in |text| that comes last
alphabetically (that is, the word that would appear last in a dictionary).
A word is defin... | ayeryn/AIHW | foundations/submission.py | submission.py | py | 5,871 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "math.sqrt",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "math.pow",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "collections.defaultdict",
"line_number": 135,
"usage_type": "call"
}
] |
3086858830 | """
Purpose: Declare schema for ChefFollower model.
"""
from django.db import models
from django.contrib.auth import get_user_model
from utils.models import TimeStampMixin
from community.models import Chef
class ChefFollower(TimeStampMixin, models.Model):
""" ORM class that present the ChefFollower table ""... | raviteja2250/tabletop-backend-develop | community/models/chef_follower.py | chef_follower.py | py | 793 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "utils.models.TimeStampMixin",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "django.db.models.Model",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "django.db.models",
"line_number": 12,
"usage_type": "name"
},
{
"api_name... |
39994091828 | """
参数配置及初始化方法
"""
import logging
# sqlLite数据库地址
#DB_PATH: str = 'sqlite:///E:\\workspace\\py\\lite-blog\\data\\lite_blog.db'
DB_PATH: str = 'sqlite:///db/lite_blog.db'
# 文件保存地址
#FILE_PATH: str = "E:\\workspace\\py\\lite-blog\\data\\file"
FILE_PATH: str = "file"
LOG_LEVEL = logging.INFO
| twodogleee/lite-blog | config.py | config.py | py | 332 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "logging.INFO",
"line_number": 13,
"usage_type": "attribute"
}
] |
30421242630 |
import numpy as np
from scipy import stats
import itertools
from models import base_punisher_models
from models import typed_audience_models as audience_models
from models import pragmatic_punisher_models
from utils import joint_density
def sigmoid(x, beta, bias):
if x==0:
return 0
else:
retu... | sradkani/punishment-rcsa-cogsci22 | configs/paper/Batistoni_2021/exp1_stage2_audience1.py | exp1_stage2_audience1.py | py | 4,962 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "numpy.exp",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "numpy.arange",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "numpy.arange",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "numpy.arange",
"line_number":... |
9462672531 | from collections import Counter
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
from dataset.augmentation import get_image_classification_tf_data_aug
def test_data_augmentation(ds: tf.data.Dataset):
'''
Function helpful for debugging data augmentation and making sure it's wor... | AndreaFalanti/popnas | src/dataset/utils.py | utils.py | py | 4,178 | python | en | code | 2 | github-code | 18 | [
{
"api_name": "tensorflow.data",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "matplotlib.pyplot.switch_backend",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 19,
"usage_type": "name"
},
{
"api_name"... |
36185320751 | import os
import httplib2
from apiclient import discovery
from oauth2client import client
from oauth2client import file
from oauth2client import tools
class Mail(object):
_scopes = 'https://www.googleapis.com/auth/gmail.readonly'
_client_secret_file = 'client_secret.json'
_application_name = 'USB Notifie... | obihann/whats-happening | gmail.py | gmail.py | py | 1,406 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "httplib2.Http",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "os.path.expanduser",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 20,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"lin... |
43971313415 | from django.conf.urls import url
from project import views
urlpatterns = [
url(r'^profile/$', views.Profile.as_view(), name="profile"),
url(r'^add-reservation/$', views.AddReservation.as_view(), name="add"),
url(r'^add-item/$', views.AddItem.as_view(), name="new"),
url(r'^add-feedback/$', views.AddFee... | abhishekm47/restaurant-django | project/urls.py | urls.py | py | 1,259 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.conf.urls.url",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "project.views.Profile.as_view",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "project.views.Profile",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_na... |
783000170 | from transformers import T5Tokenizer, T5EncoderModel
# t5文本表示
tokenizer = T5Tokenizer.from_pretrained("t5-base")
model = T5EncoderModel.from_pretrained("t5-base")
input_ids = tokenizer("Studies have been shown that owning a dog is good for you", return_tensors="pt").input_ids # Batch size 1
outputs = model(input_ids=... | iliaohai/bert-log | Models/T5/T5.py | T5.py | py | 402 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "transformers.T5Tokenizer.from_pretrained",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "transformers.T5Tokenizer",
"line_number": 4,
"usage_type": "name"
},
{
"api_name": "transformers.T5EncoderModel.from_pretrained",
"line_number": 5,
"usage_ty... |
17701935399 | import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
from pyspark.sql import DataFrame, Row
from awsglue import DynamicFrame
args = getResolvedOptions(sys.argv, ['JOB_NAME'])... | LeonardoZV/aws-glue-kafka-python-exemplos | efinanceira-monitoracao-transmissao/capturar_eventos_job.py | capturar_eventos_job.py | py | 1,147 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "awsglue.utils.getResolvedOptions",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "sys.argv",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "pyspark.context.SparkContext",
"line_number": 11,
"usage_type": "call"
},
{
"api_n... |
72234966119 | import uuid
from django.db import models
from django.contrib.auth import get_user_model
"""
Currently active user model is imported for representing clients.
This method will return default django User model or the custom user model if one would be specified.
"""
User = get_user_model()
class Dataset(models.Model)... | gorgeous-george/smart_tracker | tracker_core/dashboard/models.py | models.py | py | 4,857 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.contrib.auth.get_user_model",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "django.db.models.Model",
"line_number": 13,
"usage_type": "attribute"
},
{
"api_name": "django.db.models",
"line_number": 13,
"usage_type": "name"
},
{
"a... |
11919683557 | VERSION = '1.0'
import json
from argparse import ArgumentParser
from os import getenv
def parse_args():
parser = ArgumentParser('Terraform dynamic inventory for Ansible')
parser.add_argument('--list', action='store_true', default=True, help='List nodes (default: True)')
parser.add_argument('--host', help... | pbacterio/terraform-inventory | terraform.py | terraform.py | py | 2,798 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "os.getenv",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "json.load",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "json.dumps",
"line_num... |
11043066285 | from django.shortcuts import render
from .models import Book
from datetime import datetime
def books_view(request):
template = 'books/books_list.html'
books = []
for book in Book.objects.all():
item = {
'name': book.name,
'author': book.author,
'pub_date': book.... | sn1ch/databases | databases/models_list_displaying/books/views.py | views.py | py | 1,445 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "models.Book.objects.all",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "models.Book.objects",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "models.Book",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "django.shor... |
2257905741 | import requests
import bs4
import sys
URL = 'https://dhlottery.co.kr/gameResult.do?method=byWin'
raw = requests.get(URL)
html = bs4.BeautifulSoup(raw.text, 'html.parser')
# sys.stdout = open('lotto23.txt','w',encoding="utf-8")
# print(html)
# sys.stdout.close()
target = html.find('div', {'class', 'nums'})
... | gitcat87/webai_20221205 | python_work/12월/230103/lotto3.py | lotto3.py | py | 783 | python | ko | code | 0 | github-code | 18 | [
{
"api_name": "requests.get",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 8,
"usage_type": "call"
}
] |
7383165262 | from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def home(request):
return render(request, 'home.html')
def String(request):
return render(request, 'String.html')
def s1(request):
return render(request, 's1.html')
def tests1(request):
sentence =... | Yashjaiswal638/Basic-Django-project | app1/views.py | views.py | py | 17,159 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.shortcuts.render",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "django.shortcuts.render",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "django.shortcuts.render",
"line_number": 16,
"usage_type": "call"
},
{
"api_name":... |
21038049285 | import itertools
import json
import operator
import re
import warnings
from functools import reduce
polish_json_filename = './static/polish_words.json'
lemko_json_filename = './static/lemko_words.json'
def firstLetterFromSentencesToUpper(sentences):
return [sent[0].upper() + sent[1:] for sent in sentences]
# ... | olinho/SentenceGenerator-with-Vue | server/utils.py | utils.py | py | 3,871 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "itertools.product",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "functools.reduce",
"line_number": 46,
"usage_type": "call"
},
{
"api_name": "operator.concat",
"line_number": 46,
"usage_type": "attribute"
},
{
"api_name": "re.findall",
... |
26669886988 | from datetime import date, timedelta
from decimal import *
import pdb
"""
Module construct
---------------------
class InvalidOperationError
custom build exception class that contains a message
class UserQuitException
custom build exception class that contains a message
class Accountant
Transaction _transa... | SenlisO/PerDiemTracker | Working Files/bank.py | bank.py | py | 27,622 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "datetime.date",
"line_number": 155,
"usage_type": "call"
},
{
"api_name": "datetime.date",
"line_number": 205,
"usage_type": "call"
},
{
"api_name": "datetime.date",
"line_number": 208,
"usage_type": "call"
},
{
"api_name": "datetime.date",
"lin... |
30216931671 | #! /usr/bin/env python3
from PIL import Image
import os
import argparse
parser = argparse.ArgumentParser(description = "Convert all png files to a gif animation, reserve the transparent attribute.")
parser.add_argument("--duration", type = float, default = 0.1, help = "Duration of each frame, in unit s, shou... | snljty/GauFreqToVMD | png2gif_animate_transparent.py | png2gif_animate_transparent.py | py | 1,672 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "PIL.Image.open",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "PIL.Image",
"line_number": 17,
"usage_type": "name"
},
{
"api_name": "PIL.Image.ADAPTIVE",
... |
41544979144 | import itertools
import string
#chars = string.digits
chars = input("Entre com a string a ser permutada: ex(luis123@) \n")
resultado = itertools.permutations(chars, len(chars))
for i in resultado:
print(''.join(i))
if 'sanethay@' == ''.join(i):
break
if 'teste123' == ''.join(i):
break | felipeQueiroga/python_security | 09_word_lists/word_list.py | word_list.py | py | 318 | python | pt | code | 0 | github-code | 18 | [
{
"api_name": "itertools.permutations",
"line_number": 8,
"usage_type": "call"
}
] |
12369125988 | import tensorflow as tf
import numpy as np
import cv2
import os
from tqdm import tqdm
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from random import shuffle
in_data = '/Users/ibneetkaur/Desktop/coding/image_recognizer/train'
def refining_img():
labeled_images = []
for ... | Ibneet/Autoencoder | image_recognizer.py | image_recognizer.py | py | 5,829 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "tqdm.tqdm",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "os.listdir",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 15,
... |
18864367790 | import psycopg2
import time
from configparser import ConfigParser
config = ConfigParser()
config.read(['/etc/flant-testcase.conf'])
db_url = config.get('main', 'database')
db = psycopg2.connect(db_url)
def save_hit(url):
crs = db.cursor()
crs.execute('insert into hit (url) values (%(url)s)',
... | wikkibe/flant-testcase | webapp.py | webapp.py | py | 607 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "configparser.ConfigParser",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "psycopg2.connect",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "time.time",
"line_number": 22,
"usage_type": "call"
}
] |
13494627368 | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.support.ui import WebDriverWait
drive_path = '/home/jhomani/projects/python/geckodriver'
uri = "https://www.bing.com/translator"
def config():
driver = webdriver.... | swalisoft/pyscraper | main.py | main.py | py | 1,633 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "selenium.webdriver.Firefox",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "selenium.webdriver",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "selenium.webdriver.firefox.service.Service",
"line_number": 10,
"usage_type": "call"
},
... |
17565969268 | # Stdlib imports
# Core Django imports
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
# Third-party app imports
# Imports from my app
class StationsPlotsConfig(AppConfig):
name = "src.plots"
verbose_name = _("StationsPlots")
class DomainsPlotsConfig(AppConfig):
... | julienpaul/django-weathervis | src/plots/apps.py | apps.py | py | 377 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.apps.AppConfig",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "django.utils.translation.gettext_lazy",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "django.apps.AppConfig",
"line_number": 15,
"usage_type": "name"
},
{
... |
35806708805 | import requests
import random
import asyncio
import os
progress = [
"""
┳━━━━━━━━━━┓
┃ 🏮
┃ /|\\
┃
┃
┃
┃
┃
┃
"""
,
"""
┳━━━━┿━━━━━┓
┃ 🏮
┃ /|\\
┃
┃
┃
┃
┃
┃
"""
,
"""
┳━━━━┿━━━━━┓
┃ │ 🏮
┃ /|\\
┃
┃
┃
┃
┃
┃
"""
,
"""
┳━━━━┿━━━━━┓
┃ │ 🏮
┃ │ /|\\
┃
┃
┃
┃
┃
┃
"""
,... | BenjaminThio/mini-games | Mini Games/Hangman.py | Hangman.py | py | 3,603 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "requests.get",
"line_number": 154,
"usage_type": "call"
},
{
"api_name": "asyncio.get_event_loop",
"line_number": 157,
"usage_type": "call"
},
{
"api_name": "os.system",
"line_number": 161,
"usage_type": "call"
},
{
"api_name": "asyncio.sleep",
... |
20302664980 | import importlib
from django.db import migrations
original_migration_module = importlib.import_module("evap.evaluation.migrations.0123_evaluation_state_fsm_int")
class Migration(migrations.Migration):
"""
Initially, we forgot to migrate logentries in 0123, so this migration cleans this up.
Note that 0123... | e-valuation/EvaP | evap/evaluation/migrations/0127_fix_logentry_types.py | 0127_fix_logentry_types.py | py | 630 | python | en | code | 93 | github-code | 18 | [
{
"api_name": "importlib.import_module",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "django.db.migrations.Migration",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "django.db.migrations",
"line_number": 7,
"usage_type": "name"
},
{
"api... |
37358534831 | # my task solution
def thirt(n):
loop = [1, 10, 9, 12, 3, 4]
sum = 0
while True:
current_sum = 0
for index, digit in enumerate(str(n)[::-1]):
current_index = index % len(loop)
current_sum += int(digit) * loop[current_index]
if sum == current_sum:
... | YauhenVadeika/CodewarsTasks | Task 225 A Rule of Divisibility by 13/A Rule of Divisibility by 13.py | A Rule of Divisibility by 13.py | py | 1,433 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "itertools.cycle",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "itertools.cycle",
"line_number": 57,
"usage_type": "call"
}
] |
19020307183 | from django.shortcuts import render
import requests
from bs4 import BeautifulSoup
import pandas as pd
import csv
from matplotlib import pyplot as plt
from io import StringIO
# Create your views here.
def scrapper(url):
page = requests.get(url)
htmlContent = page.content
soup = BeautifulSoup(h... | saurabhWagh12/Web_Scrapping | web_scrapping/website/views.py | views.py | py | 3,221 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "requests.get",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "django.shortcuts.render",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "django.shortcu... |
25980528753 | import argparse
from glob import glob
import os
from pathlib import Path
import re
from aicsimageio import AICSImage
import numpy as np
import pandas as pd
from scipy.ndimage import affine_transform
import skimage.io as skio
import yaml
from yaml.loader import SafeLoader
overwrite = True
import registration_utils
... | aics-int/multiplex_immuno_processing | old_workflow/bandaid_crop_exported_images_to_timelapse_img.py | bandaid_crop_exported_images_to_timelapse_img.py | py | 9,345 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 59,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 59,
"usage_type": "attribute"
},
{
"api_name": "os.listdir",
"l... |
28232924934 | # -*- 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
class WebcrawlerPipeline(object):
def process_item(self, item, spider):
return item
from scrapy.exceptions impo... | avanishtiwari38/scrapy_crawler | webcrawler/pipelines.py | pipelines.py | py | 795 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "scrapy.exceptions.DropItem",
"line_number": 23,
"usage_type": "call"
}
] |
42876335295 | from torch import nn
import torch
from utils.misc import Accumulator, Timer
def accuracy(y_hat, y):
"""
计算训练正确的样本的个数
:param y_hat: 预测值
:param y: 真实值
:return:
"""
# 如果是二维的数据的话,就按行取最大值的索引
if len(y_hat.shape) > 1 and y_hat.shape[1] > 1:
y_hat = y_hat.argmax(axis=1)
# 按位运算,获取正确... | SduWangyu/Adversarial_Defence_KSD | utils/evaluate.py | evaluate.py | py | 2,434 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "torch.nn.Module",
"line_number": 30,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 30,
"usage_type": "name"
},
{
"api_name": "utils.misc.Accumulator",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "torch.no_grad",
... |
28085902984 | import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import time
# 测试浏览导航 back forword
class baiduSearch(unittest.TestCase):
def... | wallaceok/python3_test | org/web/test1.py | test1.py | py | 1,256 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "unittest.TestCase",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "selenium.webdriver.Chrome",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "selenium.webdriver",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "se... |
33065875701 | #!/usr/local/bin/python3
import numpy as np
import pandas as pd
pd.options.mode.chained_assignment = None
import geopandas as gpd
# pygeos sjoin gives widely inaccurate results, so force using rtree instead
#import pygeos
gpd.options.use_pygeos = False
from geopandas import GeoSeries
from geopandas.tools import sjoin... | kevinstadler/theview | prominence.py | prominence.py | py | 4,889 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "pandas.options",
"line_number": 4,
"usage_type": "attribute"
},
{
"api_name": "geopandas.options",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "argparse.ArgumentParser",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "geop... |
32205699780 | from django.urls import path
from . import views
app_name = 'spendings'
urlpatterns = [
path("", views.index, name="index"),
path("all_spendings/", views.SpendingsView.as_view(), name="all_spendings"),
path("<int:pk>/", views.SpendingDetailView.as_view(), name="spending_details"),
path("spending/", vi... | daniel-arsenie/Teme-curs-ITF | sesiunea14/finance_manager/spendings/urls.py | urls.py | py | 369 | python | en | code | 0 | github-code | 18 | [
{
"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",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "django.urls.path",
... |
3548484258 | # building a system that will tell the user what to watch next based on the word vector similarity of the description of movies.
import numpy as np
import spacy
nlp = spacy.load('en_core_web_md')
with open('movies.txt', 'r') as f:
descriptions = f.readlines()
def suggest_movie(description):
# Tokenise the i... | taekyung-leee/data-analysis-from-Bootcamp | spaCy/Algorithm/watch_next.py | watch_next.py | py | 1,227 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "spacy.load",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "numpy.argmax",
"line_number": 18,
"usage_type": "call"
}
] |
18414295822 | from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import object
from tkinter import *
from scipy.interpolate import UnivariateSpline
import os, sys
from xymath.splines import Spline
class SplinePage(object):
def leavePageCallback(self):... | sonofeft/XYmath | xymath/gui/page_spline.py | page_spline.py | py | 8,091 | python | en | code | 2 | github-code | 18 | [
{
"api_name": "future.standard_library.install_aliases",
"line_number": 3,
"usage_type": "call"
},
{
"api_name": "future.standard_library",
"line_number": 3,
"usage_type": "name"
},
{
"api_name": "builtins.object",
"line_number": 11,
"usage_type": "name"
},
{
"api... |
35754385615 | import hashlib
import json
from time import time
from urllib.parse import urlparse
import requests
#区块链类
class Blockchain(object):
def __init__(self):
self.chain = []
self.current_transactions = []
self.nodes = set() #初始化节点,set()防止节点重复
#创建创世块
self.new_block(previous_hash=1,... | Galvin-wjw/Blockchain | blockchain.py | blockchain.py | py | 5,221 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "time.time",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "json.dumps",
"line_number": 58,
"usage_type": "call"
},
{
"api_name": "hashlib.sha256",
"line_number": 59,
"usage_type": "call"
},
{
"api_name": "hashlib.sha256",
"line_number... |
12759235247 | from django.shortcuts import render,redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from .models import Diary
# Create your views here.
@login_required(login_url='login-page')
def diary_index(request):
context ... | iamsourav37/Django-Project | daily_life/mydiary/views.py | views.py | py | 1,588 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.shortcuts.render",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "django.contrib.auth.decorators.login_required",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "models.Diary.objects.filter",
"line_number": 20,
"usage_type": "cal... |
74708312361 | from keras import models
from keras import layers
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import pandas as pd
import mlflow
mlflow.autolog()
mlflow.set_experiment("SAW approximate and predict new data FINAL")
def generatesaw():
x = np.linspace(0, 50, 1... | Chilibonitsu/ML-mlflow-AND-OR-XOR-plus-Sine-Wave-prediction | timeSeries mlflow Final/timeSeriesSin sawX feature predict All data.py | timeSeriesSin sawX feature predict All data.py | py | 2,838 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "mlflow.autolog",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "mlflow.set_experiment",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "numpy.linspace",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "keras.models.Sequen... |
5944851856 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from abc import ABC, abstractmethod
import math
from interface.loggable import Loggable
from interface.transceiver import Transceiver
class Router(Loggable, ABC):
"""
Responsible for forwarding messages received by publisher to other
subscribers and routers
... | gregjhansell97/hive-map-algorithms | interface/src/interface/router.py | router.py | py | 1,570 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "interface.loggable.Loggable",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "abc.ABC",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "math.inf",
"line_number": 26,
"usage_type": "attribute"
},
{
"api_name": "interface.transceiv... |
17952613735 | #!/usr/bin/env python
'''
:mod:`module.ecb`
'''
import re
import math
from mpl_toolkits.mplot3d import axes3d
from matplotlib import cm
from scipy.interpolate import griddata
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
from module import AbstractModule
from util import Si... | DwyaneShi/Logviz | module/ECB.py | ECB.py | py | 8,076 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "module.AbstractModule",
"line_number": 20,
"usage_type": "name"
},
{
"api_name": "re.compile",
"line_number": 45,
"usage_type": "call"
},
{
"api_name": "util.SizeUtils.convert_size",
"line_number": 55,
"usage_type": "call"
},
{
"api_name": "util.Siz... |
26437651310 | import json
from django.apps import apps
from django.core import serializers
from django.urls import reverse, reverse_lazy
from django.http import HttpResponse, JsonResponse
from django.db.models import Q
from django.views.generic import DetailView, ListView, TemplateView, View
from django.shortcuts import render, get_... | tayursky/med-crm | directory/views/list.py | list.py | py | 6,925 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "django.contrib.auth.mixins.LoginRequiredMixin",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "django.views.generic.DetailView",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "directory.utils.get_model",
"line_number": 20,
"usage_type"... |
21697349362 | from django.shortcuts import render
from django.http import JsonResponse, HttpResponse
from .models import Student, Course
def get_students(request):
students = Student.objects.all().values()
output = [entry for entry in students]
return JsonResponse(output, safe=False)
def create_student(request):
i... | MNikiforovV/ikrit-test-task | ikrTestTask/university/views.py | views.py | py | 1,015 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "models.Student.objects.all",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "models.Student.objects",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_name": "models.Student",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "dj... |
9350434888 | from argparse import ArgumentParser
from os import mkdir
from os.path import join, exists
import h5py
import sys
def write_mesh_as_obj(fname, verts, faces):
with open(fname, 'w') as fp:
for v in verts:
fp.write('v %f %f %f\n' % (v[0], v[1], v[2]))
for f in faces + 1: # Faces are 1-bas... | QhelDIV/ShapeFormer | shapeformer/data/dfaust_datasets/datagen/write_sequence_to_obj.py | write_sequence_to_obj.py | py | 1,880 | python | en | code | 158 | github-code | 18 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "h5py.File",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "sys.exit",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_n... |
73646789479 | import numpy as np
from astropy.io.fits import file
def sign(x):
"""
Return 1 if x is positive, -1 if it's negative, and 0 if it's zero.
"""
if x > 0:
return 1
elif x < 0:
return -1
else:
return 0
def vertex_sign(P, O):
"""
Sign of the vertex P with respect to ... | HsienYiLiu/advance_porject_big3d | inpoly.py | inpoly.py | py | 6,770 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "os.path.exists",
"line_number": 176,
"usage_type": "call"
},
{
"api_name": "astropy.io.fits.file",
"line_number": 176,
"usage_type": "argument"
},
{
"api_name": "os.path",
"line_number": 176,
"usage_type": "attribute"
},
{
"api_name": "astropy.io.fi... |
71349293801 | import time
import sys
import pygame
import pygame_gui
import re
import pygame_gui
pygame.init()
font = pygame.font.Font('arial.ttf', 24)
screen = pygame.display.set_mode([800, 500])
timer = pygame.time.Clock()
message = "chukdsa"
color = 'white'
snip = font.render(message, True, pygame.Color(color))
counter = 0
speed... | tranvanchilong/karaoke_app | karaoke.py | karaoke.py | py | 4,706 | python | vi | code | 0 | github-code | 18 | [
{
"api_name": "pygame.init",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "pygame.font.Font",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "pygame.font",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "pygame.display.set_mode",
... |
4384934379 | # Oytun Demirbilek
# 150150032
import moviepy.video.io.VideoFileClip as mpy
import moviepy.editor as edit
import cv2
import numpy as np
from sklearn.svm import SVR
from sklearn.model_selection import KFold
import matplotlib.pyplot as plt
def MSE(y_pred, y_true):
return np.sqrt(np.square(y_pred - y_true)).mean()
... | oytundemirbilek/practicals-computer-vision | task4_handtracking/main.py | main.py | py | 9,275 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "numpy.sqrt",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "numpy.square",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "sklearn.model_selection.KFold",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "numpy.random.se... |
74609028840 | import re
from functools import partial
from pyramid.config import Configurator
from clldutils.path import Path
from clld.interfaces import IParameter, IMapMarker, IDomainElement, IValue
from clld.web.adapters.base import adapter_factory
from clld.web.app import menu_item
from clld_glottologfamily_plugin.util import ... | clld/nts | nts/__init__.py | __init__.py | py | 2,304 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "clld_glottologfamily_plugin.util.LanguageByFamilyMapMarker",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "clld.interfaces.IValue.providedBy",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "clld.interfaces.IValue",
"line_number": 22,
... |
27243115224 | #!/usr/bin/env python
from pathlib import Path
import subprocess
from versions import get_versions_data, write_versions_json
INDEX_HTML = r'''<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url={default_branch}" />
</head>
<body>
<p>Got to <a href="{default_branch}">default document... | goerz/bibdeskparser | .travis/docs_post_process.py | docs_post_process.py | py | 1,538 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "subprocess.run",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "pathlib.Path",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "versions.get_versions_data",
"line_number": 40,
"usage_type": "call"
},
{
"api_name": "versions.write... |
32363758876 | import math
import numpy as np
import matplotlib.pyplot as plt
def A(a1, a2):
"""Створення матриці А з заданими параметрами а1 та а2"""
A = np.zeros((3, 3))
A[0][1] = 1
A[1][2] = 1
A[2][0] = -1
A[2][1] = -a1
A[2][2] = -a2
return A
def B(b):
"""Створення матриці B... | d9ria/system-analysis | lab1.py | lab1.py | py | 3,840 | python | uk | code | 0 | github-code | 18 | [
{
"api_name": "numpy.zeros",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "numpy.eye",
"line_number": 41,... |
38323343590 | from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.db.utils import IntegrityError
from django.core.files import File
import os
class Command(BaseCommand):
help = 'Creates demo users'
def handle(self, *args, **options):
User = get_user_model... | Noah-Lc/simple-blog-rest-api | backend/core/management/commands/create_demo_users.py | create_demo_users.py | py | 1,910 | python | en | code | 3 | github-code | 18 | [
{
"api_name": "django.core.management.base.BaseCommand",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "django.contrib.auth.get_user_model",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "os.getenv",
"line_number": 49,
"usage_type": "call"
},
{
... |
34546879488 | import pytest
# jax imports
import jax
import jax.numpy as jnp
# crs imports
import cr.nimble as cnb
from cr.nimble.dsp import *
atol = 1e-6
rtol = 1e-6
def test_dct1():
for n in [4,8,16]:
for i in range(n):
print(n, i)
y = cnb.vec_unit(n, i)
a = dct(y)
x ... | carnotresearch/cr-nimble | tests/dsp/test_dct.py | test_dct.py | py | 659 | python | en | code | 7 | github-code | 18 | [
{
"api_name": "cr.nimble.vec_unit",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "cr.nimble",
"line_number": 18,
"usage_type": "name"
},
{
"api_name": "jax.numpy.allclose",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "jax.numpy",
"line... |
102112751 | # Your code goes here.
# You can delete these comments, but do not change the name of this file
# Write your code to expect a terminal of 80 characters wide and 24 rows high
import gspread
from google.oauth2.service_account import Credentials
SCOPE = [
"https://www.googleapis.com/auth/spreadsheets",
"https://... | rnc-personal/CIPythonWalkthrough | run.py | run.py | py | 3,295 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "google.oauth2.service_account.Credentials.from_service_account_file",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "google.oauth2.service_account.Credentials",
"line_number": 14,
"usage_type": "name"
},
{
"api_name": "gspread.authorize",
"line_numbe... |
20699388945 | from json import load
import os
import argparse
import random
from copy import deepcopy
import torchvision
import torchvision.transforms as transforms
from torch import nn
from torch.nn import functional as F
import sys
import torch
import numpy as np
# sys.path.append("../../")
torch.manual_seed(0)
from fedlab.core... | williamium3000/fedlab-projects | examples/standalone-cifar10/standalone.py | standalone.py | py | 4,938 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "torch.manual_seed",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "argparse.ArgumentParser",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "torch.nn.Module",
"line_number": 39,
"usage_type": "attribute"
},
{
"api_name": "torch.... |
10999103616 | import pygame
import serial
(SCREEN_WIDTH, SCREEN_HEIGHT) = (300, 200)
SCREEN = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
BACKGROUND_COLOUR = (32, 32, 32)
pygame.display.set_caption('EOgmaDrive Controller')
pygame.font.init()
FONT = pygame.font.SysFont("Arial", 20)
def display_mode(string, colour):
... | ogmacorp/EOgmaDrive | Configuration2/PiTop_Controller.py | PiTop_Controller.py | py | 1,799 | python | en | code | 71 | github-code | 18 | [
{
"api_name": "pygame.display.set_mode",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "pygame.display",
"line_number": 5,
"usage_type": "attribute"
},
{
"api_name": "pygame.display.set_caption",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "p... |
12588081399 | from logging import getLogger
import httpx
from ddns_clienter_core.runtimes.config import TaskConfig
from .abs import DDNSProviderAbs, DDNSProviderException
logger = getLogger(__name__)
_update_api_url = "https://dynv6.com/api/update"
_rest_api_url = "https://dynv6.com/api/v2"
async def _call_update_api(
dom... | rexzhang/ddns-clienter | ddns_clienter_core/runtimes/dns_providers/dynv6.py | dynv6.py | py | 6,566 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "logging.getLogger",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "httpx.AsyncClient",
"line_number": 37,
"usage_type": "call"
},
{
"api_name": "httpx.HTTPError",
"line_number": 40,
"usage_type": "attribute"
},
{
"api_name": "httpx.StreamE... |
23259405549 | import sqlalchemy as sa
from sqlalchemy import func
from flashcards.database import Base
class Card(Base):
__tablename__ = 'cards'
id = sa.Column(sa.Integer, primary_key=True)
user_id = sa.Column(sa.Integer, sa.ForeignKey('users.id'), index=True)
title = sa.Column('title', sa.String, nullable=False,... | baleen37/flashcards-py | flashcards/models/card.py | card.py | py | 488 | python | en | code | 2 | github-code | 18 | [
{
"api_name": "flashcards.database.Base",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "sqlalchemy.Column",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.Integer",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "sql... |
31650497405 | """fixture models
Revision ID: edf9d4b6cdea
Revises: bb02384217e4
Create Date: 2023-05-21 20:04:01.734393
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "edf9d4b6cdea"
down_revision = "bb02384217e4"
branch_labels = None
depends_on = None
def upgrade() -> None... | Studio-Yandex-Practicum/ProCharity_back_2.0 | src/core/db/migrations/versions/2023-05-21_20.04.01_fixture_models.py | 2023-05-21_20.04.01_fixture_models.py | py | 1,399 | python | en | code | 10 | github-code | 18 | [
{
"api_name": "alembic.op.alter_column",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "alembic.op",
"line_number": 20,
"usage_type": "name"
},
{
"api_name": "alembic.op.add_column",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "alembic.op",... |
36147499423 | # 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
# d... | naanal/product | admin/monitor/openstack_dashboard/static_settings.py | static_settings.py | py | 8,818 | python | en | code | 1 | github-code | 18 | [
{
"api_name": "xstatic.main.main.XStatic",
"line_number": 56,
"usage_type": "call"
},
{
"api_name": "xstatic.main.main",
"line_number": 56,
"usage_type": "attribute"
},
{
"api_name": "xstatic.main",
"line_number": 56,
"usage_type": "name"
},
{
"api_name": "xstatic... |
42505535009 |
import matplotlib.pyplot as plt
import numpy as np
import cv2
import json
train_json = json.load(open('../../../SVHN-Data/mchar_train.json'))
# 数据标注处理
def parse_json(d):
arr = np.array([
d['top'], d['height'], d['left'], d['width'], d['label']
])
arr = arr.astype(int)
return arr
img = cv2.im... | Yujing-Zhao/SVHN | main/DataLoader.py | DataLoader.py | py | 768 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "json.load",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "numpy.array",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "cv2.imreasd",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.figure",
"line... |
70596840679 | #!/usr/bin/env python3
import sys
from time import sleep
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from PIL import Image
from io import BytesIO
from xvfbwrapper import Xvfb
WEBCAMS = {
"https://webcam.exdesign.ru/cds-polyustrovo-1": "webcam1.png",
"https://webcam.e... | approximatenumber/polyustrovo-live-stream-bot | capture.py | capture.py | py | 1,437 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "selenium.webdriver.firefox.options.Options",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "selenium.webdriver.Chrome",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "selenium.webdriver",
"line_number": 23,
"usage_type": "name"
},
... |
31546959129 | """Handle interactions with github."""
import logging
import os
import shutil
import requests
from github import Github
from provision.utils import chdir, run
LOG = logging.getLogger(__name__)
def git_clone(repo: str, dest_path: str = "", args: list = ["--recursive"]) -> None:
"""Clone git repo to dest path."""... | comfortablynick/provision | provision/git.py | git.py | py | 3,386 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "logging.getLogger",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "shutil.which",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "os.path.expanduser",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "os.path",
"line... |
74539279399 |
import json
import os
from model.Puzzle import Puzzle
from PIL import Image, ImageDraw, ImageFont, ImageColor
from cryptography.fernet import Fernet
import base64
from controller.Context import Context
from controller.Strategy import plainSave, encryptSave
# from customExcept import OverwriteSave
# State class holdin... | mucsci-students/2023sp-420-SNEK | src/controller/SaveAndLoad.py | SaveAndLoad.py | py | 6,734 | python | en | code | 2 | github-code | 18 | [
{
"api_name": "os.path.exists",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 24,
"usage_type": "attribute"
},
{
"api_name": "os.listdir",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "os.path.splitext",
"line_n... |
39041995918 | #
# Parse mapfile and dump all information collected.
# Requires https://github.com/pfalcon/pymapfile .
#
import sys
import logging
from pprint import pprint
from mapfile import GnuMapFile
logging.basicConfig(level=logging.DEBUG)
f = open(sys.argv[1])
m = GnuMapFile(f)
m.skip_till_memmap()
m.skip_while_lead_space()... | pfalcon/ScratchABit | tools/map2scratchabit.py | map2scratchabit.py | py | 1,305 | python | en | code | 391 | github-code | 18 | [
{
"api_name": "logging.basicConfig",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "logging.DEBUG",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "sys.argv",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "mapfile.GnuMapFi... |
5728320298 | import os, shutil, random
from glob import glob
from tqdm import tqdm
if __name__ == '__main__':
in_bpath = '/data/datasets/godatasets/goboard_datasets/'
train_bpath = in_bpath + 'train/yehu/'
test_bpath = in_bpath +'test/yehu/'
train_prop = 0.7
label_file_postfix = '.schema'
image_file_postfi... | foxkillerli/recognize_goboard | process_data/split_train_test_goboard.py | split_train_test_goboard.py | py | 1,198 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "glob.glob",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "random.shuffle",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "tqdm.tqdm",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "os.path.split",
"line_number":... |
1173937792 | from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from rex.modules.ffn import MLP
from rex.utils.span import find_closest_span_pairs, find_closest_span_pairs_with_index
class SubjObjSpan(nn.Module):
"""
Inputs:
hidden: (batch_size, seq_len, hidden_size)
... | Spico197/REx | rex/modules/span.py | span.py | py | 6,058 | python | en | code | 21 | github-code | 18 | [
{
"api_name": "torch.nn.Module",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "typing.Optional",
"line_number": 19,
"usage_type": "name"
},
{
"api_name": "torch.nn.Linear",
"... |
31452970705 | import logging
import azure.functions as func
import json
from random import randint
# from pathlib import Path
# calcola-somma function
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
users = {"1754462800": {"name": "John", "surn... | AndreVale69/FaaS-Azure-presentation | code/ServerPOST/__init__.py | __init__.py | py | 5,479 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "azure.functions.HttpRequest",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "azure.functions",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "logging.info",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "azure.fun... |
11306404005 | '''
Train the highest number prediction with the rational extractor.
'''
import torch
from torch.utils.data import DataLoader
import pytorch_lightning as pl
from HighestNumber.HighestDataset import HighestDataset
from HighestNumber.reinforce_rational_extraction import ReinforceRationalExtractor, HighestNumberLSTM, Rein... | gersonfoks/rational-dialog-model | misc/HighestNumber/train_reinforce.py | train_reinforce.py | py | 2,219 | python | en | code | 0 | github-code | 18 | [
{
"api_name": "HighestNumber.HighestDataset.HighestDataset",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "torch.utils.data.DataLoader",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "HighestNumber.HighestDataset.HighestDataset",
"line_number": 15,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.