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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
24347960900 | import numpy as np
import os
from .image_extraction import extract_images_from_pdf
from .images import get_box
from PIL import Image
from flask import current_app
def reference_image(exam_id, page, dpi, widget_area_in=None, padding=0):
"""Returns a reference image for a specified area
The reference image is... | zesje/zesje | zesje/blanks.py | blanks.py | py | 3,019 | python | en | code | 9 | github-code | 6 | [
{
"api_name": "flask.current_app.config",
"line_number": 36,
"usage_type": "attribute"
},
{
"api_name": "flask.current_app",
"line_number": 36,
"usage_type": "name"
},
{
"api_name": "os.path.join",
"line_number": 38,
"usage_type": "call"
},
{
"api_name": "os.path"... |
10702615749 | # pylint: disable=E0401
import js
import functools
from pyodide.ffi import create_once_callable, create_proxy
from enum import Enum
from typing import Callable, TypedDict, Sequence, MutableMapping, Union
State = MutableMapping[str, Union[str, int, dict, list, None]]
Actions = dict[str, Callable]
Attributes = dict[st... | harehare/python-wasm-vdom | vdom.py | vdom.py | py | 6,230 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "typing.MutableMapping",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "typing.Union",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "typing.Callable",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "typing.Union",
"... |
2785515345 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import logging as log
from time import sleep
from html import escape
import requests
class FloodException(Exception): pass
def send(config, post):
# prepare config
c = {'token': '', 'chat': '', 'maxlength': 1000, 'skip': [], 'censor': []}
c.update(... | TechCiel/Reachee | sender/telegram.py | telegram.py | py | 2,274 | python | en | code | 11 | github-code | 6 | [
{
"api_name": "logging.info",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "logging.info",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 29,
... |
26676860635 | from flask import Flask, render_template, request, redirect
from flask_wtf import FlaskForm
from wtforms import StringField, HiddenField, RadioField
from wtforms.validators import Length, ValidationError
import phonenumbers
import random
import json
import os
app = Flask(__name__)
app.secret_key = 'Secret!'
hours = {... | maksimKnz/flask-project2 | app.py | app.py | py | 6,791 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "flask.Flask",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "json.load",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "phonenumbers.is_valid_number",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "phonenumbers.parse... |
7176555609 | import functools
from typing import (
Any,
Callable,
TypeVar,
cast,
)
import warnings
TFunc = TypeVar("TFunc", bound=Callable[..., Any])
def deprecate_method(func: TFunc, message: str = None) -> TFunc:
@functools.wraps(func)
def deprecated_func(*args: Any, **kwargs: Any) -> Any:
warni... | ethereum/py-evm | eth/tools/_utils/deprecation.py | deprecation.py | py | 662 | python | en | code | 2,109 | github-code | 6 | [
{
"api_name": "typing.TypeVar",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "typing.Callable",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "typing.Any",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "typing.Any",
"line_numb... |
70073356027 | from asyncio import coroutine, get_event_loop
from time import time
import requests
import json
class IngestaoDadosDogs:
def __init__(self, urls, dir):
self.urls = urls
self.dir = dir
@coroutine
def collect(self):
start = time()
loop = get_event_loop()
scrape_li... | gustavo-duarte-silva/MentoramaPythonPRO_MOD9 | mod9pro/ScriptsAssincronos/scriptConcorrente.py | scriptConcorrente.py | py | 1,155 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "time.time",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "asyncio.get_event_loop",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "requests.get",
"line_number": 15,
"usage_type": "attribute"
},
{
"api_name": "json.dump",
"l... |
27773589780 | import os
import asyncio
from telepyrobot.setclient import TelePyroBot
from pyrogram import filters
from pyrogram.types import Message
from telepyrobot import COMMAND_HAND_LER
from telepyrobot.utils.pyrohelpers import ReplyCheck
__PLUGIN__ = os.path.basename(__file__.replace(".py", ""))
__help__ = f"""
`{COMMAND_HAND... | Divkix/TelePyroBot | telepyrobot/plugins/self_destruct.py | self_destruct.py | py | 1,145 | python | en | code | 40 | github-code | 6 | [
{
"api_name": "os.path.basename",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "telepyrobot.COMMAND_HAND_LER",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "telepyrobot.... |
32185442685 | import logging
import flask
import time
import signal
import sys
import socket
from flask import Flask
from flask_api import status
from os import environ
from kubernetes import client, config
log = logging.getLogger()
log.addHandler(logging.StreamHandler())
log.setLevel(logging.INFO)
app = Flask(__name__)
try:
... | kiemlicz/util | dockerfiles/experiments/web.py | web.py | py | 1,526 | python | en | code | 20 | github-code | 6 | [
{
"api_name": "logging.getLogger",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "logging.StreamHandler",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "logging.INFO",
"line_number": 15,
"usage_type": "attribute"
},
{
"api_name": "flask.Flask... |
39620185683 |
# Importa e define oque for nescessário para o código
import pygame
import random
WIDTH = 880
HEIGHT = 660
from config import GAME, QUIT
def init_screen(screen):
# Variável para o ajuste de velocidade
clock = pygame.time.Clock()
# Carrega o fundo da tela inicial
background = pygame.image.load('Flyin... | RodrigoAnciaes/Flying_Fox_game | Flying_Fox_Game/first_screen.py | first_screen.py | py | 1,182 | python | pt | code | 0 | github-code | 6 | [
{
"api_name": "pygame.time.Clock",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "pygame.time",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "pygame.image.load",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "pygame.image",
... |
10422651353 | from __future__ import annotations
import copy
from dataclasses import dataclass
from enum import Enum
from typing import TYPE_CHECKING, Self
from randovania.bitpacking import bitpacking
from randovania.bitpacking.bitpacking import BitPackDecoder, BitPackEnum, BitPackValue
from randovania.bitpacking.type_enforcement ... | randovania/randovania | randovania/layout/base/dock_rando_configuration.py | dock_rando_configuration.py | py | 8,008 | python | en | code | 165 | github-code | 6 | [
{
"api_name": "typing.TYPE_CHECKING",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "randovania.bitpacking.bitpacking.BitPackEnum",
"line_number": 22,
"usage_type": "name"
},
{
"api_name": "enum.Enum",
"line_number": 22,
"usage_type": "name"
},
{
"api_n... |
741344040 | import os
from pytest_mock import MockFixture
from app.config import get_config, DevelopmentConfig, ProductionConfig, PRODUCTION, DEVELOPMENT
def test_get_config_in_development():
app_config = get_config()
assert app_config.env == DEVELOPMENT
assert isinstance(app_config, DevelopmentConfig)
def test_... | hrozan/utfpr-final-paper | legacy/smart-object/tests/test_config.py | test_config.py | py | 771 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "app.config.get_config",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "app.config.DEVELOPMENT",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "app.config.DevelopmentConfig",
"line_number": 12,
"usage_type": "argument"
},
{
"api_... |
34375411916 | #!/usr/bin/env python3
from curses import wrapper
from functools import partial
from Gamepad import Gamepad
import curses
import time
def spd_scale(y0, x0, y1, x1, x):
"""Get the speed at the given value of time.
NOTE: The output is not clamped,
regardless of the reference points given."""
# Two ... | kknives/rudra-training | motor-control/js_control.py | js_control.py | py | 2,024 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "curses.noecho",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "curses.cbreak",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "curses.curs_set",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "functools.partial",
"... |
40880830024 | from bs4 import BeautifulSoup
import requests,re,os
import textract
os.chdir("..")
DATA_DIR = "data/fiscal_pdf"
SAVE_DIR = "data/fiscal_txt"
pre_link="http://www.imf.org"
target_dir = "http://www.imf.org/external/np/g20/"
g8_link = "http://www.g8.utoronto.ca/summit/index.htm"
# Extract all IMF Staff Note from IMF webs... | utipe/imf_fiscal | code/corpus_extraction.py | corpus_extraction.py | py | 1,880 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "os.chdir",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "requests.get",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "re.compile",
"line_number"... |
40449028487 | from ray.rllib.evaluation import MultiAgentEpisode, RolloutWorker
from ray.rllib.agents.callbacks import DefaultCallbacks
from ray.rllib.env import BaseEnv
from ray.rllib.policy import Policy
from typing import Dict
from ray.rllib.policy.sample_batch import SampleBatch
import numpy as np
import time
import csv
import... | tud-amr/AC-LCP | utils/callbacks.py | callbacks.py | py | 12,175 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "csv.DictWriter",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "csv.DictWriter",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "ray.rllib.agents.callbacks.DefaultCallbacks",
"line_number": 29,
"usage_type": "name"
},
{
"api_nam... |
27241749881 | import pygal
from random import randint
class Die:
def __init__(self, sides=6):
self.sides = sides
def roll(self):
return randint(1, self.sides)
die = Die(8)
die_1 = Die(8)
results = [die.roll() + die_1.roll() for x in range(1000)]
frequencies = [results.count(x) for x in range(2, 2 * di... | mbrad26/Data-Vizualization | Recap/recap_die_2d8.py | recap_die_2d8.py | py | 580 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "random.randint",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "pygal.Bar",
"line_number": 22,
"usage_type": "call"
}
] |
39620196443 | # ===== Inicialização =====
# ----- Importa e inicia pacotes
import pygame
import random
pygame.init()
# ----- Gera tela principal
WIDTH = 880
HEIGHT = 800
window = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('Flying_Fox')
gravity = 1
difficult = 0
# ----- Inicia assets
METEOR_WIDTH = 100
METE... | RodrigoAnciaes/Flying_Fox_game | Folder_de_Testes/Flappy.py | Flappy.py | py | 4,902 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pygame.init",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "pygame.display.set_mode",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "pygame.display",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "pygame.display... |
72370696507 | from django.urls import path
from products.views import (
CreateProduct,
CreateOption,
Products,
UpdateProduct,
Option,
UpdateOption,
)
urlpatterns = [
path("", Products.as_view()),
path("create/product", CreateProduct.as_view()),
path("update/product/<int:pk>", UpdateProduct.as_vie... | ohnas/Manager-backend | products/urls.py | urls.py | py | 478 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "django.urls.path",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "products.views.Products.as_view",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "products.views.Products",
"line_number": 12,
"usage_type": "name"
},
{
"api_name... |
5759869864 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
#%% Importar los datos (leer la imagen)
img = mpimg.imread('../Data/indice.png')
plt.imshow(img)
#%% reordenar la imagen en una sola tabla
d = img.shape
img_col = np.reshape(img,(d[0]*d[1],d[2]))
#%% Convertir los datos a media cero... | OscarFlores-IFi/CDINP19 | code/p13.py | p13.py | py | 1,039 | python | es | code | 0 | github-code | 6 | [
{
"api_name": "matplotlib.image.imread",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "matplotlib.image",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "matplotlib.pyplot.imshow",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "matplo... |
40464221544 | import os.path
import re
import numpy as np
from PIL import Image
NUM_RE = re.compile(r'(\d+)')
maxint = 999999
WHITE_LIST_FORMATS = {'png', 'jpg', 'jpeg', 'bmp'}
def hstack_images(input_filenames, target_size=(224, 224)):
"""
Horizontally stack all images from @input_filenames in order and write to @out... | eklitzke/dnn-fastai-project | vidextend/flow.py | flow.py | py | 2,047 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "re.compile",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "PIL.Image.open",
"line_number": 19,
"usage_type": "attribute"
},
{
"api_name": "PIL.Image",
"line_number": 19,
"usage_type": "name"
},
{
"api_name": "PIL.Image.new",
"line_num... |
8595213301 | import openpyxl,os,shutil
import pandas as pd
import pymssql
from sqlalchemy import create_engine
backupPath='files-backup'
def get_xlsx_to_dataframe(fliename):
wb = openpyxl.load_workbook(fliename)
sheets = wb.sheetnames
ws = wb.get_sheet_by_name(sheets[0])
df = pd.read_excel(fliename)
if not o... | zjz7304/xlsx_to_database | util.py | util.py | py | 666 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "openpyxl.load_workbook",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "pandas.read_excel",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "os.path.exists",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "os.path",
... |
2687351802 | import numpy as np
import matplotlib.pyplot as plt
import random as rnd
import turtle
N = 100
Nw = 1000
def wedrowniczek(length):
x0, y0 = 0,0
x,y = x0,y0
walkx,walky = [x],[y]
for i in range(length):
rand = rnd.randint(1,4)
if rand == 1:
x += 1
elif rand == 2:
y += 1
elif rand == ... | filipmalecki94/Computer_modeling | lista3/zadanie1.py | zadanie1.py | py | 784 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "random.randint",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.plot",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 32,
"usage_type": "name"
},
{
"api_name": "matplotlib.py... |
29358868643 | from sqlalchemy.orm import joinedload
from clld.db.util import get_distinct_values
from clld.db.models import common
from clld.web import datatables
from clld.web.datatables.base import LinkCol, Col, LinkToMapCol
from clld.web.datatables.parameter import Parameters
from clld.web.datatables.value import Values, ValueNam... | tsammalex/plansa | plansa/datatables.py | datatables.py | py | 2,802 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "clld.web.datatables.Languages",
"line_number": 16,
"usage_type": "attribute"
},
{
"api_name": "clld.web.datatables",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "clld_glottologfamily_plugin.models.Family",
"line_number": 18,
"usage_type": "argu... |
23248318495 | import pygame
#necessary pygame initializing
pygame.init()
#create a surface that will be seen by the user
screen = pygame.display.set_mode((600, 400))
background= pygame.image.load('Background-1.png')
#create a varible for degrees pf rotation
degree = 0
while True:
screen.blit(background, (0,0))
... | Soupupup/pythonsensorgame | rotation test 2.py | rotation test 2.py | py | 1,287 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pygame.init",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "pygame.display.set_mode",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "pygame.display",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "pygame.image.loa... |
5564785730 | from src.core.interfaces.model_abc import ModelAbstract
from src.core.interfaces.repository_abc import RepositoryAbstract
from src.shared import parse_config
from sqlalchemy.orm import Session
import logging
import logging.config
import dataclasses
from typing import List
from datetime import datetime
class SqlAlchem... | ricky-codes/APIGest | src/infrastructure/services/repository.py | repository.py | py | 3,071 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "src.core.interfaces.repository_abc.RepositoryAbstract",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "sqlalchemy.orm.Session",
"line_number": 15,
"usage_type": "name"
},
{
"api_name": "src.core.interfaces.model_abc.ModelAbstract",
"line_number": 16,... |
35522645807 | import requests
from time import sleep
timeToWait = 300 # Time to wait between callouts (in seconds)
while (True):
# Get list of commands to run this callout
URL = "https://slack.flemingcaleb.com:5000/api/agent/4/command/"
r = requests.get(url=URL)
if r.status_code == requests.codes.ok:
# Pro... | flemingcaleb/InfraBot | agent/agent.py | agent.py | py | 567 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "requests.get",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "requests.codes",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "requests.codes",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "time.sleep",
... |
38076886961 | import os
from pathlib import Path
from tempfile import NamedTemporaryFile
import pytest
import pytest_mock
from werkzeug.exceptions import NotFound
from iceart.models import Artist, ArtistDto, ArtistViewModel
def test_artist_vm_init():
with pytest.raises(NotFound):
ArtistViewModel(-1)
def test_artist... | JonSteinn/iceart_api | tests/test_models/test_artist.py | test_artist.py | py | 1,537 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "pytest.raises",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "werkzeug.exceptions.NotFound",
"line_number": 13,
"usage_type": "argument"
},
{
"api_name": "iceart.models.ArtistViewModel",
"line_number": 14,
"usage_type": "call"
},
{
"api_... |
75401661626 | import numpy as np
import time
import torch
from multiprocessing import Array, Manager
from dgl.dataloading.dataloader import GraphCollator
from collections import deque, namedtuple
from gp.utils.datasets import DatasetWithCollate
"""
Following namedtuple makes data collating nad referencing easier
"""
GraphLabelN... | LechengKong/MAG-GNN | dataset.py | dataset.py | py | 4,231 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "collections.namedtuple",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "collections.namedtuple",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "collections.namedtuple",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "... |
39756253957 | """
Plot a grid on H2
with Poincare Disk visualization.
"""
import logging
import os
import matplotlib.pyplot as plt
import numpy as np
import geomstats.visualization as visualization
from geomstats.geometry.hyperbolic import Hyperbolic
H2 = Hyperbolic(dimension=2)
METRIC = H2.metric
def main(left=-128,
... | hhajri/geomstats | examples/plot_grid_h2.py | plot_grid_h2.py | py | 1,552 | python | en | code | null | github-code | 6 | [
{
"api_name": "geomstats.geometry.hyperbolic.Hyperbolic",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "numpy.linspace",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "numpy.array",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "n... |
41843820390 | import numpy as np
from sklearn.metrics import f1_score
from sklearn.naive_bayes import BernoulliNB
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
class NaiveBayes:
"""
Naive Bayes implementation based on Multi-variate Bernoulli using python
... | gmortuza/machine-learning-scratch | machine_learning/bayesian/naive_bayes/naive_bayes.py | naive_bayes.py | py | 5,821 | python | en | code | 6 | github-code | 6 | [
{
"api_name": "numpy.unique",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 37,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 38,
"usage_type": "call"
},
{
"api_name": "numpy.sum",
"line_number": 5... |
19365158235 | import pickle, ssl, logging
import numpy as np
import torch
from torch import nn
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
import pytorch_lightning as pl
import models, curves, utils1, utils, preresnet, resnet
DATASET = datasets.CIFAR10
TEST_ITEMS = 50_000
BATCH_SIZE = 128... | jonasjuerss/mode-connectivity | james/main.py | main.py | py | 12,280 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "torchvision.datasets.CIFAR10",
"line_number": 13,
"usage_type": "attribute"
},
{
"api_name": "torchvision.datasets",
"line_number": 13,
"usage_type": "name"
},
{
"api_name": "torchvision.datasets.CIFAR10",
"line_number": 26,
"usage_type": "attribute"
},
... |
33205173219 | from django.urls import path
from .views import (get_user, add_user, get_categories, get_recipe,
add_to_favourite, get_user_favourites,
get_recipes_in_category, get_random_recipe,
add_to_dislikes)
urlpatterns = [
path('users/<int:telegram_id>', get_user... | AlexanderZharyuk/recipes | recipes_admin_api/api/urls.py | urls.py | py | 684 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "django.urls.path",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "views.get_user",
"line_number": 10,
"usage_type": "argument"
},
{
"api_name": "django.urls.path",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "views.add_user",... |
74056199547 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .activations import ACTIVATIONS
class Embedding(nn.Module):
'''
Abstract base class for any module that embeds a collection of N vertices into
N hidden states
'''
def __init__(self, features, hidden, **kwargs):
super()... | isaachenrion/jets | src/architectures/embedding/embedding.py | embedding.py | py | 2,081 | python | en | code | 9 | github-code | 6 | [
{
"api_name": "torch.nn.Module",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "torch.nn.Linear",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "torch.nn",
"line_numb... |
31146266095 | import tensorflow as tf
import keras.backend as K
def huber_loss(y_true, y_pred):
return tf.losses.huber_loss(y_true, y_pred)
def adjust_binary_cross_entropy(y_true, y_pred):
return K.binary_crossentropy(y_true, K.pow(y_pred, 2))
def MMD_Loss_func(num_source, sigmas=None):
if sigmas is None:
s... | rs-dl/MMD-DRCN | customLoss.py | customLoss.py | py | 1,575 | python | en | code | 7 | github-code | 6 | [
{
"api_name": "tensorflow.losses.huber_loss",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "tensorflow.losses",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_name": "keras.backend.binary_crossentropy",
"line_number": 10,
"usage_type": "call"
},
{
... |
34228298510 | import os
import re
import sys
import glob
import builtins
from contextlib import contextmanager
import setuptools
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
from setuptools.command.install import install as _install
with open("README.md", "r") as fh:
... | AlkaidCheng/aliad | setup.py | setup.py | py | 1,655 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "re.search",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "re.M",
"line_number": 20,
"usage_type": "attribute"
},
{
"api_name": "setuptools.setup",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "setuptools.find_packages",
"... |
13058259505 | from datetime import datetime, timezone
from config import Config
from logger import logger
from model.coordinates import Coordinates
from model.media_type import MediaType
from model.ts_source import TsSource
class MediaFile:
original_path: str
original_filename: str
filename: str
media_type: MediaT... | mbogner/imagination | model/media_file.py | media_file.py | py | 3,104 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "model.media_type.MediaType",
"line_number": 14,
"usage_type": "name"
},
{
"api_name": "datetime.datetime",
"line_number": 18,
"usage_type": "name"
},
{
"api_name": "model.ts_source.TsSource",
"line_number": 19,
"usage_type": "name"
},
{
"api_name": ... |
3081251304 | # -*- coding: utf-8 -*
"""Graphics
.. module:: graphics
:synopsis: Module for creating graphs
"""
# imports
import matplotlib.pyplot as plt
import numpy as np
import resoncalc.output as output
from math import ceil
from csv import DictReader
# globals
n_points = 1000 # count of points in graph
n_rows = 20.0 #... | hydratk/resoncalc | src/resoncalc/graphics.py | graphics.py | py | 8,384 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "numpy.linspace",
"line_number": 31,
"usage_type": "call"
},
{
"api_name": "numpy.real",
"line_number": 31,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "numpy.real",
"line_number":... |
18339770466 | import requests
import json
url = "https://api.telegram.org/bot5653233459:AAHWejZRnvy4luWTetBSbQY5jTzS11mA35U/sendMessage"
photo_url = "https://api.telegram.org/bot5653233459:AAHWejZRnvy4luWTetBSbQY5jTzS11mA35U/sendPhoto"
document_url = "https://api.telegram.org/bot5653233459:AAHWejZRnvy4luWTetBSbQY5jTzS11mA35U/sendD... | mayuritoro/tele_bot | tele_bot/trial.py | trial.py | py | 5,973 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "requests.post",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "requests.post",
"line_number": 63,
"usage_type": "call"
},
{
"api_name": "requests.post",
"line_number": 101,
"usage_type": "call"
},
{
"api_name": "requests.post",
"line_... |
14255581243 | from selenium import webdriver
import time, re
from bs4 import BeautifulSoup
import pyautogui
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
import pyperclip
import os
# 主要功能就是访问300mium所有影片详情页,然后挨个下载封面
class Crawl_51luxu:
def main(self, Dir='F:\\pic\... | ExcaliburEX/GHS | Crawl_51luxu.py | Crawl_51luxu.py | py | 7,503 | python | en | code | 5 | github-code | 6 | [
{
"api_name": "os.getcwd",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "selenium.webdriver.ChromeOptions",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "selenium.webdriver",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "seleniu... |
7261153491 | import cv2
import numpy as np
img = cv2.imread('bookpage.jpg')
grayscaled = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#retval, threshold = cv2.threshold(grayscaled, 11, 255 , cv2.THRESH_BINARY)
threshold = cv2.adaptiveThreshold(grayscaled, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 115, 1)
median = cv2.med... | felipemateus/vis-oCompEstudo | threshHoldExemple2/threshHold.py | threshHold.py | py | 541 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "cv2.imread",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "cv2.cvtColor",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "cv2.COLOR_BGR2GRAY",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_name": "cv2.adaptiveThreshold",
... |
22912396559 | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from flask import Flask, request, jsonify, make_response, abort
import requests
from stations import stations
app = Flask(__name__)
name = [
'station_train_code',
'from_station_name',
'to_station_name',
'lishi',
'start_time',
'ar... | shenmj053/querytickets | tickets.py | tickets.py | py | 5,024 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "flask.Flask",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "flask.request.args.get",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "flask.request.args",
"line_number": 32,
"usage_type": "attribute"
},
{
"api_name": "flask.reque... |
34107122191 | from flask import g, request, current_app
import iot_api_core
import time
class InstanceVersionBaseBehavior():
def __init__(self, widget_type, namespace, instance_id):
self.widget_type = widget_type
self.namespace = namespace
self.instance_id = instance_id
self.lumavate = iot_api_core.Lumavate()
... | Lumavate-Team/python-hello | app/iot_api_core/instance_version_base.py | instance_version_base.py | py | 12,129 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "iot_api_core.Lumavate",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "flask.request.get_json",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "flask.request",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "iot_api_co... |
26112891425 | __authors__ = ["T. Vincent"]
__license__ = "MIT"
__date__ = "07/01/2019"
import os
import logging
import weakref
from . import qt
import silx.resources
from silx.utils import weakref as silxweakref
_logger = logging.getLogger(__name__)
"""Module logger"""
_cached_icons = None
"""Cache loaded icons in a weak struc... | silx-kit/silx | src/silx/gui/icons.py | icons.py | py | 11,642 | python | en | code | 106 | github-code | 6 | [
{
"api_name": "logging.getLogger",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "weakref.WeakValueDictionary",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "silx.utils.weakref.WeakList",
"line_number": 59,
"usage_type": "call"
},
{
"api_nam... |
12571576568 | import requests
import pandas
from bs4 import BeautifulSoup
import json
url = 'https://www.imdb.com/chart/top/'
response = requests.get(url).content
soup = BeautifulSoup(response,'html.parser')
title = soup.find_all('td', class_='titleColumn')
rating = soup.find_all('strong')
images = soup.find_all('img')
movie_... | gpuligundla/IMDB-Top-Movies-List | imdb_scrap.py | imdb_scrap.py | py | 979 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "requests.get",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "pandas.DataFrame",
"line_number": 41,
"usage_type": "call"
}
] |
39697194939 | # -*- coding: utf-8 -*-
import scrapy
from LaGou.items import LagouItem
import LaGou.settings as settings
class LagouSpider(scrapy.Spider):
name = 'lagou'
allowed_domains = ['https://www.lagou.com']
start_urls = ['http://https://www.lagou.com/']
def parse(self, response):
if response.status==... | siqyka/Reptile | works/LaGou/LaGou/spiders/lagou.py | lagou.py | py | 1,369 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "scrapy.Spider",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "LaGou.items.LagouItem",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "LaGou.settings.MAX_PAGE",
"line_number": 29,
"usage_type": "attribute"
},
{
"api_name": "... |
19482945267 | import math
import random
import numba as nb
import numpy as np
@nb.jit(nopython=True)
def dimension_selector_uniform(n_dimensions):
return random.randrange(n_dimensions)
def get_dimension_selector_expovariate(
lambd=None,
rel_lambd=None,
):
if lambd is not None and rel_lambd is not None:
r... | risicle/cluscheck | cluscheck/__init__.py | __init__.py | py | 7,246 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "random.randrange",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "numba.jit",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "math.inf",
"line_number": 29,
"usage_type": "attribute"
},
{
"api_name": "random.expovariate",
"lin... |
37482811265 | # coding: utf-8
import json
import os
import click
import gql
import graphql
import requests
from gql.transport.requests import RequestsHTTPTransport
try:
# python2
from urlparse import urlparse
except ImportError:
# python3
from urllib.parse import urlparse
class SchemaSourceType(click.ParamType... | wapiflapi/gqldiff | gqldiff/clickgql.py | clickgql.py | py | 2,223 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "click.ParamType",
"line_number": 22,
"usage_type": "attribute"
},
{
"api_name": "os.environ.get",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "os.environ",
"line_number": 33,
"usage_type": "attribute"
},
{
"api_name": "gql.Client",
... |
72784612027 | # https://www.codewars.com/kata/558d5c71c68d1e86b000010f
from itertools import product as P
from collections import Counter
# precompute
vampires = []
for L in (2,3):
G = [range(0,10) for _ in range(L)]
limit1 = 10**(2*L-1)
limit2 = 10**L**2-1
for a,b in P(P(*G), P(*G)):
p = int(''.join(m... | blzzua/codewars | 7-kyu/vampire_numbers_less_than_1000000.py | vampire_numbers_less_than_1000000.py | py | 1,072 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "itertools.product",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "collections.Counter",
"line_number": 14,
"usage_type": "call"
}
] |
36310398862 | import pygame
import colors
import config
class Field(pygame.sprite.Sprite):
def __init__(self, x, y, color=None, img_path=None):
super().__init__()
self.x = x
self.y = y
self.color = color
# sprite image
if img_path:
img = pygame.image.load(img_path)... | tobnie/human_planning_horizon | game/world/field.py | field.py | py | 1,046 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pygame.sprite",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "pygame.image.load",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "pygame.image",
"line_number": 17,
"usage_type": "attribute"
},
{
"api_name": "pygame.transfor... |
22610452246 | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import Hybrid, Specialization, ContactPerson, Subject
class MyUserAdmin(UserAdmin):
model = Hybrid
fieldsets = UserAdmin.fieldsets + (
(None, {'fields': (
'middle_name',
'member',
... | hybrida/hybridjango | apps/registration/admin.py | admin.py | py | 792 | python | en | code | 4 | github-code | 6 | [
{
"api_name": "django.contrib.auth.admin.UserAdmin",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "models.Hybrid",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "django.contrib.auth.admin.UserAdmin.fieldsets",
"line_number": 9,
"usage_type": "attribut... |
40610907305 | # Import libraries
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import missingno as msno
from _datetime import date
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.neighbors import LocalOutlierFactor
f... | afatsumcemreg/feature_engineering | 05_feature_scaling.py | 05_feature_scaling.py | py | 2,572 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "pandas.set_option",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "pandas.set_option",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "pandas.set_option",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "pandas.set_opti... |
1370868487 | """Quizzes user on terms and definitions."""
import csv
import random
from collections import namedtuple
RTN = lambda: '\n'
def open_csv_populate_dct():
"""Import a csv and populate a dictionary with its contents."""
dct = {}
with open('csvs/terms_and_definitions.csv') as f:
F_CSV = csv.reader(f... | craighillelson/terms_and_definitions | terms_and_definitions.py | terms_and_definitions.py | py | 1,717 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "csv.reader",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "collections.namedtuple",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "random.random",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "random.choice",
"... |
10981447634 | '''
Created on Oct 26, 2015
@author: jcheung
Developed for Python 2. May work for Python 3 too (but I never tried) with minor changes.
'''
import xml.etree.cElementTree as ET
import codecs
class WSDInstance:
def __init__(self, my_id, lemma, context, index):
self.id = my_id # id of the WSD instanc... | JGuymont/lesk-algorithm | lesk/loader.py | loader.py | py | 2,227 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "xml.etree.cElementTree.parse",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "xml.etree.cElementTree",
"line_number": 29,
"usage_type": "name"
},
{
"api_name": "codecs.encode",
"line_number": 70,
"usage_type": "call"
}
] |
972412310 | ###Episode 1
import numpy as np
import torch
#Training data
# Input (temp, rainfall, humidity)
inputs = np.array([[73,67,43], [91,88,64], [87, 134, 58], [108, 43, 37], [69, 96,70]], dtype='float32')
# targets (apples, oranges)
targets = np.array([[56, 70], [81,101], [119, 133], [22,37], [103, 119]], dtype = 'float... | NancyGirdhar/PyTorch_Basics | PyTorchSeries_E1.py | PyTorchSeries_E1.py | py | 6,595 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "numpy.array",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "numpy.array",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "torch.from_numpy",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "torch.from_numpy",
"line_... |
1218087321 | import os
from collections import namedtuple
#Define a named tuple to represent our files
FileStruct = namedtuple("File", "file_name file_ext file_path dir")
def XMLifyFile(file_struct):
return '\t\t<file alias="' + file_struct.file_name + '">' + file_struct.file_path + "</file>\n"
valid_exts = [".graphml", ".p... | cdit-ma/SEM | medea/src/app/Resources/resourceqrcmaker.py | resourceqrcmaker.py | py | 1,521 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "collections.namedtuple",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "os.walk",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "os.path.splitext",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_nu... |
83273089 | import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
def read_file():
# 读取数据
df = pd.read_table("/you... | goelo/machine_learning | naive_bayes/smsspammessage.py | smsspammessage.py | py | 2,190 | python | en | code | 4 | github-code | 6 | [
{
"api_name": "pandas.read_table",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "sklearn.model_selection.train_test_split",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "sklearn.feature_extraction.text.CountVectorizer",
"line_number": 23,
"usage_typ... |
11902565567 | #!/usr/bin/env python3
from pprint import pprint
import subprocess
import pyone
import config
# -----------------------
# Connect to OpenNebula
# -----------------------
one = pyone.OneServer(config.ONE['address'], session='%s:%s' % (config.ONE['username'], config.ONE['password']))
# prepare hosts to ips mapping
hos... | OpenNebula/addon-3par | scripts/helpers/update-cpu-shares.py | update-cpu-shares.py | py | 1,335 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "pyone.OneServer",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "config.ONE",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "subprocess.check_call",
"line_number": 41,
"usage_type": "call"
}
] |
17591759593 | import pathlib
from PIL import Image
class image_to_c_array:
def __init__(self, image_path, output_path, format_bytes_count, char_array_name, include_header_guard=False, include_header_guard_name=None, reset_output_file=True):
self.image_path = image_path
self.output_path = output_path
... | 0xRooted/File-To-C-Array | filetocarray.py | filetocarray.py | py | 1,846 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pathlib.Path",
"line_number": 9,
"usage_type": "call"
}
] |
14048408200 | from io import StringIO
from pathlib import Path
import streamlit as st
import time
from detect import detect
import os
import sys
import argparse
from PIL import Image
import shutil
import streamlit.components.v1 as components
def get_subdirs(b='.'):
'''
Returns all sub-directories in a spec... | fengxizxf/yolov-bird | main.py | main.py | py | 9,736 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "os.listdir",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 19,
"usage_type": "attribute"
},
{
"api_name": "os.path.isdir",
"line_number... |
19733029074 | # -*- coding: utf-8 -*-
import logging
import requests
from bs4 import BeautifulSoup
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('wb')
class Client:
def __init__(self):
self.session = requests.Session()
self.session.headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Wi... | KogameDev/WildberriesParser | main.py | main.py | py | 1,056 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "logging.basicConfig",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "logging.DEBUG",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "logging.getLogger",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "requests.Sessio... |
35610337121 | import cv2
import os
cam = cv2.VideoCapture("video.avi")
values = []
def discrimator(frame):
return frame[0][0][1] != 253
# Read each frame. Use discriminator on each frame to output a zero or one.
while True:
ret, f = cam.read()
if not ret:
break
values.append(
discrimator(f)
)
... | sectalks/sectalks | ctf-solutions/LON0x26/bc/vid.py | vid.py | py | 492 | python | en | code | 277 | github-code | 6 | [
{
"api_name": "cv2.VideoCapture",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "os.write",
"line_number": 22,
"usage_type": "call"
}
] |
41087502611 | import matplotlib.pyplot as plt
import pandas as pd
def main():
# Charger les données à partir du fichier CSV
data = pd.read_csv("Parcoursup 2023 - Total.csv", delimiter=";")
# Extraire les colonnes nécessaires
dates = pd.to_datetime(data["Date"], format="%d/%m") # type: ignore
en_attente = data[... | Ahhj93/Indicateur-Parcoursup-2023 | parcoursup_candidats_en_attente.py | parcoursup_candidats_en_attente.py | py | 1,820 | python | fr | code | 2 | github-code | 6 | [
{
"api_name": "pandas.read_csv",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "pandas.to_datetime",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.figure",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "matplotlib... |
34836265477 | from django.contrib.contenttypes.models import ContentType
from django_filters import rest_framework as filters
from music_app.models import Artist, Track, Album
from music_app.apps import MusicAppConfig
_content_types_id = {
'artist': ContentType.objects.get(app_label=MusicAppConfig.name, model='artist').id,
... | vladyslavtsurkan/django_music_application | music_app/api/filters.py | filters.py | py | 1,745 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "django.contrib.contenttypes.models.ContentType.objects.get",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "django.contrib.contenttypes.models.ContentType.objects",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "django.contrib.contenttypes.... |
650752867 | import os
import sys
import json
import unittest
import numpy as np
import luigi
import z5py
import cluster_tools.utils.volume_utils as vu
from sklearn.metrics import adjusted_rand_score
from elf.segmentation.mutex_watershed import mutex_watershed
from elf.segmentation.watershed import apply_size_filter
try:
from... | constantinpape/cluster_tools | test/mutex_watershed/test_mws.py | test_mws.py | py | 2,409 | python | en | code | 32 | github-code | 6 | [
{
"api_name": "sys.path.append",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 17,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number... |
19243529886 | import shlex
import django_filters
from django.core.exceptions import FieldError
from django.db.models import Q
# The function and Classes in this file are from https://github.com/nexB/scancode.io/blob/main/scanpipe/filters.py
def parse_query_string_to_lookups(query_string, default_lookup_expr, default_field):
... | nexB/purldb | packagedb/filters.py | filters.py | py | 2,388 | python | en | code | 23 | github-code | 6 | [
{
"api_name": "django.db.models.Q",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "shlex.split",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "django.db.models.Q",
"line_number": 43,
"usage_type": "call"
},
{
"api_name": "django_filters.Char... |
36358232508 | import hide
headers = hide.headers
TOKEN = hide.TOKEN
tell_token = hide.tell_token
chat_id = hide.chat_id
import http.client
import mimetypes
import ssl
import json
import time
from time import localtime, strftime
from datetime import datetime
import requests
import json
# mac has some issue with SLL this fixes it
tr... | tomashege/Olarm_zone_check | check_zone.py | check_zone.py | py | 3,684 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "hide.headers",
"line_number": 2,
"usage_type": "attribute"
},
{
"api_name": "hide.TOKEN",
"line_number": 3,
"usage_type": "attribute"
},
{
"api_name": "hide.tell_token",
"line_number": 4,
"usage_type": "attribute"
},
{
"api_name": "hide.chat_id",
... |
11299411121 | from functools import update_wrapper
import logging
from .action import FunctionAction
from .request import Request
from .traject import Traject
from .config import Configurable
from .settings import SettingSectionContainer
from .converter import ConverterRegistry
from .predicate import PredicateRegistry
from .tween i... | magnus-lycka/morepath | morepath/app.py | app.py | py | 8,665 | python | en | code | null | github-code | 6 | [
{
"api_name": "config.Configurable",
"line_number": 28,
"usage_type": "name"
},
{
"api_name": "reg.Registry",
"line_number": 28,
"usage_type": "name"
},
{
"api_name": "mount.MountRegistry",
"line_number": 28,
"usage_type": "name"
},
{
"api_name": "predicate.Predic... |
30578979945 | import os
import json
from datetime import date
from flask import Flask, g, jsonify, request, abort
from flask_cors import CORS #comment this on deployment
from db.jfl_db import Database
app = Flask(__name__)
CORS(app) #comment this on deployment
def get_db():
'''
Returns the document indexi... | zrahn93/jfl | jfl_services/run.py | run.py | py | 11,376 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "flask.Flask",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "flask_cors.CORS",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "db.jfl_db",
"line_number": 18,
"usage_type": "name"
},
{
"api_name": "flask.g",
"line_number": 18... |
43242321794 | # Same as second example, but using F1 (ALM)
import casadi.casadi as cs
import opengen as og
import json
nu = 3
np = 1
u = cs.SX.sym("u", nu)
p = cs.SX.sym("p", np)
f = cs.dot(u, u)
for i in range(nu):
f += p * u[i]
F1 = cs.sin(u[0]) - 0.3
C = og.constraints.Zero()
U = og.constraints.Ball2(None, 0.5)
problem =... | BjoernLindqvist/Crazyflie_NMPC | third_example.py | third_example.py | py | 1,718 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "casadi.casadi.SX.sym",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "casadi.casadi.SX",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "casadi.casadi",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "casadi.casadi.S... |
74348094589 | from collections import namedtuple, defaultdict
from itertools import combinations, product
from math import sqrt
from typing import List
INPUTTEST = 'inputtest.txt'
INPUTREAL = 'input.txt'
def getLines(fileName):
file = open(fileName,'r')
lines = file.read().splitlines()
file.close()
return lines
c... | David-Hatcher/AoC2021 | Day 19/Day19.py | Day19.py | py | 5,987 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "collections.namedtuple",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "itertools.combinations",
"line_number": 78,
"usage_type": "call"
},
{
"api_name": "collections.defaultdict",
"line_number": 84,
"usage_type": "call"
},
{
"api_name": ... |
15821882121 | #!/usr/bin/env python
import rospy
from std_msgs.msg import Bool
from audio_common_msgs.msg import AudioData
import os
import argparse
import pyaudio
import wave
import datetime
class AudioCapture:
def __init__(
self,
is_record_topic,
audio_data_topic,
num_chan... | robotpt/ros-data-capture | src/data_capture/audio_capture2/scripts/capture.py | capture.py | py | 4,708 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "rospy.init_node",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "rospy.Subscriber",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "std_msgs.msg.Bool",
"line_number": 32,
"usage_type": "argument"
},
{
"api_name": "rospy.Subscrib... |
27757527715 | import math
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import util as u
def reset_param(t):
stdv = 2. / math.sqrt(t.size(0))
t.data.uniform_(-stdv,stdv)
class GCN_LSTM(nn.Module):
def __init__(self, args, activation, device='cpu'):
super().__init__()
sel... | sunny77889/DyGCN | compare_models/GCN_LSTM/gcn_lstm.py | gcn_lstm.py | py | 2,679 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "math.sqrt",
"line_number": 11,
"usage_type": "call"
},
{
"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.LSTM",
"line_num... |
23837831992 | '''
Script for building and visualization of v(x) function for fixed x0 and gamma
(OSCILLATING case of eigenfunction)
'''
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import utils
x0 = 0.41
gamma = 6.0
AFTER_TANGENT = False
SUFFIX_NAME = '_after_tangent' if AFTER_TANGENT else ''
CSV_FILE =... | leonel11/KaschenkoEquation | Scripts/oscillating_draw_v_function.py | oscillating_draw_v_function.py | py | 2,269 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pandas.read_csv",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "utils.EPS",
"line_number": 27,
"usage_type": "attribute"
},
{
"api_name": "numpy.sqrt",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "numpy.cosh",
"line_numb... |
13351154708 | # -*- coding: utf-8 -*-
#electrical calculator
import math
import cmath
import numpy as np
import matplotlib.pyplot as plot
from matplotlib.offsetbox import AnchoredText
#three phase power calculations
def singlePhaseLoad( powerConsumed, powerFactor, leadLag):
#powerConsumed in kW
#power factor
#leadLag ... | vdatl5/electricalCalculator | elecCalc.py | elecCalc.py | py | 4,282 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "math.acos",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "math.sin",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "math.degrees",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "math.acos",
"line_number": 49,
... |
39608443773 | import datetime
import os
import re
import urllib.parse
from itertools import groupby
from django import forms as django_forms
from django.conf import settings
from django.core.paginator import Paginator, InvalidPage
from django import urls
from django.forms import fields
from django.http import HttpResponse, HttpRe... | open-oni/open-oni | core/views/browse.py | browse.py | py | 19,948 | python | en | code | 43 | github-code | 6 | [
{
"api_name": "core.models.Issue.objects.all",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "core.models.Issue",
"line_number": 35,
"usage_type": "attribute"
},
{
"api_name": "core.models",
"line_number": 35,
"usage_type": "name"
},
{
"api_name": "djan... |
27390985743 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
sys.path.insert(0, os.path.abspath("../../"))
sys.path.insert(0, os.path.abspath("."))
import ... | edoaltamura/swiftzoom | docs/source/conf.py | conf.py | py | 3,219 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "sys.path.insert",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "os.path.abspath",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number... |
36917846701 | import logging
import os
import sys
from queue import Empty
from threading import Thread
import argparse
import jsonpickle
from polarity_server import globals
from polarity_server.rest import RestApi
class App:
thread_run = True
@classmethod
def run(cls):
parser = argparse.ArgumentParser()
... | willmfftt/polarityserver | polarity_server/app/app.py | app.py | py | 4,759 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "sys.argv",
"line_number": 26,
"usage_type": "attribute"
},
{
"api_name": "sys.exit",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "os.EX_SOFTWARE",
"... |
36818410851 | import curses
import curses.ascii
from curses.textpad import Textbox
class MyTextPad(Textbox):
ignored_keys = {
curses.KEY_PPAGE, # Page Up
curses.KEY_NPAGE, # Page Down
}
def __init__(self, win, default):
super().__init__(win)
self.default = default
self.line =... | AzaubaevViktor/tagging | console/my_textpad.py | my_textpad.py | py | 2,571 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "curses.textpad.Textbox",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "curses.KEY_PPAGE",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "curses.KEY_NPAGE",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "curse... |
28176425279 | import sqlite3
import json
from datetime import datetime
from traceback import print_tb
from helpers import create_table_if_not_exists, get_db_path, get_timeframe_path, format_data, \
acceptable, get_timeframes
timeframes = get_timeframes()
sql_transaction = []
start_row = 0
# start_row = 8400000 # that is where... | DuncteBot/chatbot | data_parser.py | data_parser.py | py | 5,643 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "helpers.get_timeframes",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "traceback.print_tb",
"line_number": 31,
"usage_type": "call"
},
{
"api_name": "traceback.print_tb",
"line_number": 49,
"usage_type": "call"
},
{
"api_name": "traceback... |
33952361000 | from pyimagesearch.centroidtracker import CentroidTracker
from pyimagesearch.trackableobject import TrackableObject
from imutils.video import VideoStream
from imutils.video import FPS
import numpy as np
import argparse
import imutils
import time
import dlib
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("... | Nem3sisX/piedpiper-socialspace | Inside_Store_Model/run.py | run.py | py | 4,748 | python | en | code | 6 | github-code | 6 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "cv2.dnn.readNetFromCaffe",
"line_number": 37,
"usage_type": "call"
},
{
"api_name": "cv2.dnn",
"line_number": 37,
"usage_type": "attribute"
},
{
"api_name": "imutils... |
14822509390 | from sqlalchemy.orm import Session
from database_models import Task, TaskStatuses
from schemas import CreateTaskModel, UpdateTaskModel, DeleteTaskModel
from datetime import datetime
def create_task(db:Session, task: CreateTaskModel):
db_task = Task(
name = task.name,
description = task.description... | maximzec/ToDoApp | crud.py | crud.py | py | 993 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "sqlalchemy.orm.Session",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "schemas.CreateTaskModel",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "database_models.Task",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "data... |
37018468843 | import numpy as np
# randomly sampling 100 obsev from t-distribution
N = 1000
df = N-1
X = np.random.standard_t(df, size = N)
import matplotlib.pyplot as plt
from scipy.stats import t
x_values = np.arange(-5,5,0.1)
y_values = t.pdf(x_values,df)
# Sample Distribution
count, bins, ignored = plt.hist(X, 20, density = ... | TatevKaren/mathematics-statistics-for-data-science | Probability-Distribution-Functions/Student t distribution.py | Student t distribution.py | py | 634 | python | en | code | 88 | github-code | 6 | [
{
"api_name": "numpy.random.standard_t",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "numpy.random",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_name": "numpy.arange",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "scipy.stats.t.pd... |
14764098844 | import sys
from typing import List, Tuple
def _get_element_orders(arr: List[int],
key: int) -> Tuple[List[int], List[int], int]:
"""
return two lists - one of figures less than
key and one of those greater - and the count
of key in arr
"""
less, greater, equal = [], []... | JoeLove100/data-structures-and-algorithms | divide_and_conquer/majority_element.py | majority_element.py | py | 1,557 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "typing.List",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "typing.Tuple",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "typing.List",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "typing.List",
"line_number": 26... |
2857680026 | import numpy as np
import torch
from functools import reduce # Required in Python 3
import operator
def prod(iterable):
return reduce(operator.mul, iterable, 1)
def multi_index_to_single(tensor, index):
i = 0
return torch.stack([index[i] * prod([tensor.shape[j] for j in range(i + 1, tensor.ndim)]) + in... | DavidRuhe/interferometry | src/gridding_python_improved/add_at.py | add_at.py | py | 1,989 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "functools.reduce",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "operator.mul",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "torch.stack",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "numpy.random.randn",
... |
37430539138 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
name: shopnum1 GuidBuyList.aspx SQL注入
referer: http://www.wooyun.org/bugs/wooyun-2015-0118447
author: Lucifer
description: 文件GuidBuyList.aspx中,参数guid存在SQL注入。
'''
import sys
import requests
class shopnum_GuidBuyList_sqli_BaseVerify:
def __init__(self, url):
... | iceyhexman/onlinetools | scanner/plugins/cms/shopnum/shopnum_GuidBuyList_sqli.py | shopnum_GuidBuyList_sqli.py | py | 1,147 | python | en | code | 1,626 | github-code | 6 | [
{
"api_name": "requests.get",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "sys.argv",
"line_number": 34,
"usage_type": "attribute"
}
] |
22460490121 | import os
import sys
import argparse
import time
import warnings
import torch
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
sys.path.append(os.path.join(os.getcwd().split('cbo-in-python')[0], 'cbo-in-python'))
from src.torch.models import *
from src.datasets import load_mnist_dat... | Igor-Tukh/cbo-in-python | demo/torch_nn_demo.py | torch_nn_demo.py | py | 8,219 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "sys.path.append",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number... |
7161693364 | """
Given an unsorted integer array nums, return the smallest missing positive integer.
You must implement an algorithm that runs in O(n) time and uses constant extra space.
Example 1:
Input: nums = [1,2,0]
Output: 3
Example 2:
Input: nums = [3,4,-1,1]
Output: 2
Example 3:
Input: nums = [7,8,9,11,12]
Output: 1
... | CompetitiveCodingLeetcode/LeetcodeEasy | Hard/FirstMissingPositive_Q41.py | FirstMissingPositive_Q41.py | py | 1,307 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "typing.List",
"line_number": 37,
"usage_type": "name"
}
] |
74494631546 | """
Coin recognition, real life application
task: calculate the value of coins on picture
"""
import cv2
import numpy as np
def detect_coins():
coins = cv2.imread('../input_image/koruny.jpg', 1)
gray = cv2.cvtColor(coins, cv2.COLOR_BGR2GRAY)
img = cv2.medianBlur(gray, 7)
circles = cv2.HoughCircles(
... | tinazhouhui/computer_vision | image_analysis/coin_amount_calculate.py | coin_amount_calculate.py | py | 3,054 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "cv2.imread",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "cv2.cvtColor",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "cv2.COLOR_BGR2GRAY",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "cv2.medianBlur",
... |
34900553836 | #!/usr/bin/env python
import argparse
import collections
import operator
import os
import re
UA_RE = re.compile(r'"(Mozilla[^"]*?)"')
def extract_log(file_obj, counts):
for line in file_obj:
m = UA_RE.search(line)
if not m:
continue
counts[m.groups()[0]] += 1
def main():
... | eklitzke/nginx-ua-extract | extract.py | extract.py | py | 946 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "re.compile",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "argparse.ArgumentParser",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "collections.defaultdict",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "os.listdir"... |
43627672364 | from typing import List
class Solution:
# Two pointers
def maximumScore(self, nums: List[int], k: int) -> int:
i, j = k, k
n = len(nums)
res, minVal = nums[k], nums[k]
while 0 < i or j < n-1:
if i == 0:
j += 1
elif j == n-1:
... | MichaelTQ/LeetcodePythonProject | solutions/leetcode_1751_1800/LeetCode1793_MaximumScoreOfAGoodSubarray.py | LeetCode1793_MaximumScoreOfAGoodSubarray.py | py | 1,424 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "typing.List",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "typing.List",
"line_number": 24,
"usage_type": "name"
}
] |
73924482426 | import re
from bs4 import BeautifulSoup
'''
要爬取信息:
1. 基本信息
2. 作者简介
3. 内容简介
4. 原文摘录
5. 推荐电子书
6. 推荐书籍
7. 评论
'''
class Parser(object):
def __init__(self, soup):
self.title = soup.find('span', property="v:itemreviewed")
self.imgLink = soup.find('a', class_='nbg')
... | icecream-and-tea/labs_web | lab1/lab1_stage1/book_spider/src/html_parser.py | html_parser.py | py | 5,863 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "re.split",
"line_number": 99,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 100,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 101,
"usage_type": "call"
}
] |
17547705346 | from keras.models import Model, load_model, save_model
from keras.layers import Input, Dense, Conv2D, Flatten, BatchNormalization, AveragePooling2D
from keras.activations import relu, softmax
from keras import backend as K
from keras.optimizers import Adam, RMSprop, SGD
import keras.initializers as initializers
class ... | rlalpha/rl-trial | ppo/actor.py | actor.py | py | 3,131 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "keras.layers.Input",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "keras.layers.Input",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "keras.layers.Input",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "keras.layers... |
70808563069 | import torch
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
def calc_region(bbox, ratio, stride, featmap_size=None):
# Base anchor locates in (stride - 1) * 0.5
f_bbox = (bbox - (stride - 1) * 0.5) / stride
x1 = torch.round((1 - ratio) * f_bbox[0] + ratio * f_bbox[2])
... | thangvubk/Cascade-RPN | mmdet/core/bbox/assigners/region_assigner.py | region_assigner.py | py | 8,816 | python | en | code | 177 | github-code | 6 | [
{
"api_name": "torch.round",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "torch.round",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "torch.round",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "torch.round",
"line_number": ... |
40466806630 | import pyvirtualcam
import cv2
import time
from filters import Filters
import math
from datetime import datetime
import ML.HandTrackingModule as htm
class VCam:
def __init__(self, mxhand, video, f, detCon=0.5, cw=640, ch=480, du=True):
cv2.namedWindow('feedback')
self.videocap = video
sel... | biguelito/funcam | vcam.py | vcam.py | py | 5,797 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "cv2.namedWindow",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "ML.HandTrackingModule.HandDetector",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "ML.HandTrackingModule",
"line_number": 27,
"usage_type": "name"
},
{
"api_name... |
15273361459 | from . import TestCase
from flask import url_for
from .. import db
from ...models import User
class UsersTest(TestCase):
render_templates = False
def test_list_users(self):
self._create_user()
response = self.as_user('get', url_for("users"))
self.assertEquals(1, len(response.json[... | juokaz/flask-skeleton | website/api/tests/users_test.py | users_test.py | py | 2,120 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "flask.url_for",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "flask.url_for",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "flask.url_for",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "flask.url_for",
"line_n... |
27009005628 | from scipy.io import loadmat
import numpy as np
import xlrd as x
import pandas as pd
def run(file, delimiter):
file_name = file["file"]
file_type_list = file_name.split(".")
file_type = file_type_list[len(file_type_list) - 1]
if file_type == 'mat':
key = file["key"]
array = read_mat(... | lisunshine1234/mlp-algorithm-python | data/read/read/run.py | run.py | py | 1,021 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "numpy.array",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "scipy.io.loadmat",
"line_number": 31,
"usage_type": "call"
},
{
"api_name": "numpy.loadtxt",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "numpy.array",
"line_nu... |
35508636359 |
#START{
import os
from github import Github
import json
import sys
import re
import time
from tabulate import tabulate
def clone_repos(GITHUB_ACCESS_TOKEN,GITHUB_USERNAME):
g = Github(GITHUB_ACCESS_TOKEN)
# Create "repos" folder if it doesn't exist
if not os.path.exists("repos"):
os.makedirs("rep... | TAFFAHACHRAF/TAFFAHACHRAF | main.py | main.py | py | 7,201 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "github.Github",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "os.path.exists",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 15,
"usage_type": "attribute"
},
{
"api_name": "os.makedirs",
"line_num... |
40005326365 | import pytest
from xdlang.structures import XDType, ast
from xdlang.visitors.parser import parse_text, transform_parse_tree
def parse_and_transform_expr(program_text: str):
parsed = parse_text(program_text, start="expr")
ast = transform_parse_tree(parse_tree=parsed)
return ast
@pytest.mark.parametrize(... | mbednarski/xdlang | tests/ast/test_ast_literal.py | test_ast_literal.py | py | 742 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "xdlang.visitors.parser.parse_text",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "xdlang.structures.ast",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "xdlang.visitors.parser.transform_parse_tree",
"line_number": 9,
"usage_type": "call... |
10220508565 | from time import time
from nazurin.database import Database
from nazurin.models import Illust
from .api import Zerochan
from .config import COLLECTION
patterns = [
# https://www.zerochan.net/123456
r"zerochan\.net/(\d+)",
# https://s1.zerochan.net/Abcdef.600.123456.jpg
# https://static.zerochan.net/A... | y-young/nazurin | nazurin/sites/zerochan/interface.py | interface.py | py | 702 | python | en | code | 239 | github-code | 6 | [
{
"api_name": "api.Zerochan",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "nazurin.database.Database",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "config.COLLECTION",
"line_number": 22,
"usage_type": "argument"
},
{
"api_name": "api.view... |
21867315415 | import phywhisperer.interface.naeusb as NAE
import phywhisperer.interface.program_fpga as LLINT
import os
import re
import logging
import pkg_resources
import threading
import time
from phywhisperer.interface.bootloader_sam3u import Samba
from phywhisperer.sniffer import USBSniffer, USBSimplePrintSink
from phywhisperer... | newaetech/phywhispererusb | software/phywhisperer/usb.py | usb.py | py | 34,049 | python | en | code | 77 | github-code | 6 | [
{
"api_name": "phywhisperer.protocol.PWPacketDispatcher",
"line_number": 15,
"usage_type": "name"
},
{
"api_name": "phywhisperer.sniffer.USBSniffer",
"line_number": 40,
"usage_type": "call"
},
{
"api_name": "pkg_resources.resource_filename",
"line_number": 49,
"usage_type... |
72132172028 | import datetime
import re
import subprocess
import sys
from typing import Optional
def run(argv: list[str]) -> subprocess.CompletedProcess:
return subprocess.run(
argv,
capture_output=True,
encoding='utf-8'
)
def error(str: str) -> None:
sys.stderr.write("%s\n" % str)
def get_m... | djfo/dev-tools | merge_commits.py | merge_commits.py | py | 3,438 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "subprocess.run",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "subprocess.CompletedProcess",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "sys.stderr.write",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "sys.st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.