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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16643088009 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='DatabaseConnection',
fields=[
('id', models.Aut... | eminhalimovic/generator | project/migrations/0001_initial.py | 0001_initial.py | py | 9,864 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "django.db.migrations.Migration",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "django.db.migrations",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "django.db.migrations.CreateModel",
"line_number": 13,
"usage_type": "call"
},
... |
71483930748 | # SPDX-License-Identifier: MIT
# (c) 2023 knuxify and Ear Tag contributors
from gi.repository import GObject
import magic
import mimetypes
import mutagen.id3
from mutagen.id3 import PictureType
from .file import CoverType
from .file_mutagen_common import EartagFileMutagenCommon
# These are copied from the code for ... | knuxify/eartag | src/backends/file_mutagen_id3.py | file_mutagen_id3.py | py | 17,256 | python | en | code | 67 | github-code | 6 | [
{
"api_name": "mutagen.id3.id3",
"line_number": 52,
"usage_type": "attribute"
},
{
"api_name": "mutagen.id3",
"line_number": 52,
"usage_type": "name"
},
{
"api_name": "mutagen.id3.id3",
"line_number": 53,
"usage_type": "attribute"
},
{
"api_name": "mutagen.id3",
... |
37224124676 | from tkinter import *
import mouse
import keyboard
"""main.py
* TODO
+ text file config
+ each line: config = 2 then can remove whitespace and process
+ use .ini, more research in phone
+ reload configs button
+ much later: refactor to not look terrible
+ later: import tkinter as tk instead of import ... | amagicmuffin/GUI-Automation | main.pyw | main.pyw | pyw | 4,318 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "mouse.click",
"line_number": 58,
"usage_type": "call"
},
{
"api_name": "mouse.press",
"line_number": 89,
"usage_type": "call"
},
{
"api_name": "keyboard.press",
"line_number": 92,
"usage_type": "call"
}
] |
14026081089 | """
@author: Yuhao Cheng
@contact: yuhao.cheng[at]outlook.com
The pose models is from the PyPose repo
Because Pypose is not open, we just use some functions from that.
"""
import os
import logging
import torch
import torch.nn as nn
from collections import OrderedDict
import dsntnn
from ..model_reg... | YuhaoCheng/PyAnomaly | pyanomaly/networks/auxiliary/pose/models.py | models.py | py | 14,116 | python | en | code | 107 | github-code | 6 | [
{
"api_name": "logging.getLogger",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "torch.nn.Conv2d",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "torch.nn",
"line_number": 23,
"usage_type": "name"
},
{
"api_name": "torch.nn.Module",
"lin... |
23948022348 | import numpy as np
import cv2
cv2.namedWindow('image')
def nothing(x):
return None
cv2.createTrackbar('CP', 'image', 10, 400, nothing)
switch = 'color/gray'
cv2.createTrackbar(switch, 'image', 0, 1, nothing)
cv2.createTrackbar
while(1):
img = cv2.imread('data/lena.jpg')
pos = cv2.getTrackbarPos('CP',... | DavidCarricondo/opencv-miniprojects | trackbars2.py | trackbars2.py | py | 703 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "cv2.namedWindow",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "cv2.createTrackbar",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "cv2.createTrackbar",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "cv2.createTrackba... |
20478288256 | import os
from typing import List, Literal, Optional, Tuple, Union, overload
from pydantic import BaseModel, ValidationError
from yaml import YAMLError, load
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
from ..constants import (
_CONFIG_YAML_FILENAME,
_TASK_TYPE... | henryivesjones/sprinkler | sprinkler/targets/sprinkler_config.py | sprinkler_config.py | py | 2,578 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pydantic.BaseModel",
"line_number": 21,
"usage_type": "name"
},
{
"api_name": "pydantic.BaseModel",
"line_number": 26,
"usage_type": "name"
},
{
"api_name": "typing.Optional",
"line_number": 29,
"usage_type": "name"
},
{
"api_name": "typing.Optional... |
19804139291 | from flask import Flask, jsonify, make_response
import flask
import json
app = Flask(__name__)
@app.route('/')
def index():
resp = {'Hello':'World!'}
return make_response(jsonify(resp))
if __name__ == '__main__':
app.run(debug=True) | mgurdal/python_ml_service | restful_simple.py | restful_simple.py | py | 247 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "flask.Flask",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "flask.make_response",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "flask.jsonify",
"line_number": 10,
"usage_type": "call"
}
] |
1781857521 |
from sklearn.datasets import load_iris
from sklearn.linear_model import LinearRegression
import xgboost as xgb
from sklearn.externals import joblib
data = load_iris()
x = data.data
y = data.target
clf = xgb.XGBClassifier()
clf.fit(x,y)
y_hat = clf.predict_proba([[1,2,3,4]])
joblib.dump(clf,'iris_model.model')
clf1 = ... | fzyy0412/hexin | model_api/model.py | model.py | py | 404 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "sklearn.datasets.load_iris",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "xgboost.XGBClassifier",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "sklearn.externals.joblib.dump",
"line_number": 12,
"usage_type": "call"
},
{
"api_... |
6217788501 | #! /usr/bin/env python3
from argparse import ArgumentParser, BooleanOptionalAction
import os
import glob
import re
from pdfminer.high_level import extract_text
from dateutil import parser
import ocrmypdf
# Map German month names to English
MONTH_GERMAN_TO_ENGLISH = {
"Januar": "January",
"Februar": "February... | kaeff/.bin | prefix_filename_date_ocr.py | prefix_filename_date_ocr.py | py | 3,546 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "re.search",
"line_number": 41,
"usage_type": "call"
},
{
"api_name": "re.search",
"line_number": 45,
"usage_type": "call"
},
{
"api_name": "dateutil.parser.parse",
"line_number": 57,
"usage_type": "call"
},
{
"api_name": "dateutil.parser",
"line... |
73499582269 | import torch
from torch import nn
class BinaryFeature(nn.Module):
def __init__(self):
super(BinaryFeature, self).__init__()
def forward(self, treatment):
return torch.cat([treatment, 1.0-treatment], dim=1)
def get_acic_feature():
backdoor_feature = nn.Sequential(nn.Linear(177, 200),
... | liyuan9988/DeepFrontBackDoor | src/features/acic_feature.py | acic_feature.py | py | 804 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "torch.nn.Module",
"line_number": 4,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 4,
"usage_type": "name"
},
{
"api_name": "torch.cat",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "torch.nn.Sequential",
"line... |
6489849831 | import torch
from hyperparams import Hyperparams as hp
import librosa
import os
import numpy as np
import torch.nn as nn
def reduce_mean(x, axis):
sorted(axis)
axis = list(reversed(axis))
for d in axis:
x = torch.mean(x, dim=d)
return x
def snr(y, y_pred):
sqrt_l2_loss = torch.sqrt(reduc... | Liumyleo/Pytorch-UNet | get_matric.py | get_matric.py | py | 4,525 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "torch.mean",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "torch.sqrt",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "torch.sqrt",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "torch.log",
"line_number": 20,
... |
24452908515 | from httpx import AsyncClient
from nonebot.log import logger
import random
import asyncio
import nonebot
import sqlite3
import os
from base64 import b64encode
from pathlib import Path
from PIL import Image
from io import BytesIO
error = "Error:"
# save_path,可在env设置, 默认False, 类型bool或str
try:
save_path = nonebot.ge... | mzttsaintly/Warfarin-bot | warfarin/plugins/nonebot_plugin_setu4/get_data.py | get_data.py | py | 4,467 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "nonebot.get_driver",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "os.listdir",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "sqlite3.connect",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "pathlib.Path",
"lin... |
1996333840 | from rest_framework.response import Response
from rest_framework import status
import uuid
class SubCreateMixin:
main_model = None
sub_serializer_class = None
main_rel_field = None
sub_field = None
def create(self, request, *args, **kwargs):
data = request.data
try:
su... | rahmadsubakti/my-kanban-management | kanban-api/kanban_management/kanban/mixins.py | mixins.py | py | 3,468 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "rest_framework.response.Response",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "rest_framework.status.HTTP_201_CREATED",
"line_number": 36,
"usage_type": "attribute"
},
{
"api_name": "rest_framework.status",
"line_number": 36,
"usage_type": "na... |
35650576834 | import requests
cookies = {
'SESSION': '',
}
json_data = {
'from': '2023-08-10',
'to': '2023-12-31',
'accompanyingPersons': 0,
'agenda': {
'id': '15245207-2ff7-4f8a-8aa3-34273c46bb8c',
},
}
response = requests.post(
'https://frs.gov.cz/api/ip/external/timetable/slots',
cookies... | gordeser/frsgovbot | main.py | main.py | py | 661 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "requests.post",
"line_number": 16,
"usage_type": "call"
}
] |
28489008660 | import os
import uuid
import requests
from flask import Flask, request, send_file
from newspaper import Article
from sumy.nlp.stemmers import Stemmer
from sumy.nlp.tokenizers import Tokenizer
from sumy.parsers.plaintext import PlaintextParser
from sumy.summarizers.luhn import LuhnSummarizer as Summarizer
from wand.colo... | dhairay-thakur/article-summarizer | app.py | app.py | py | 3,095 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "flask.Flask",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "flask.request.get_json",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "flask.request",
"line_number": 21,
"usage_type": "name"
},
{
"api_name": "newspaper.Article",
... |
18148371700 | # -*- coding: utf-8 -*-
from odoo import models, fields, api
import time
import logging
_logger = logging.getLogger(__name__)
from datetime import datetime, timedelta
class time_diff(models.Model):
_name = 'vit.time_diff'
depart = fields.Datetime(string="Departure", required=False, default=lambda self:time.s... | yusupnurkarimah/vITraining | vit_time_diff/models/models.py | models.py | py | 1,341 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "logging.getLogger",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "odoo.models.Model",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "odoo.models",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "odoo.fields.Datetim... |
27529493732 | from art import logo
import random
import sys
# list of pokemon names
pokemon = ["Bulbasaur", "Ivysaur", "Venusaur", "Charmander", "Charmeleon", "Charizard", "Squirtle", "Wartortle",
"Blastoise", "Caterpie", "Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidgeotto",
"Pidgeot"... | sherrycayheyhey/100-Days-of-Code | NumberGuess/main.py | main.py | py | 4,209 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "sys.exit",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "sys.exit",
"line_number": 49,
"usage_type": "call"
},
{
"api_name": "art.logo",
"line_number": 64,
"usage_type": "argument"
},
{
"api_name": "random.randint",
"line_number": 68... |
74064124668 | #!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['Click>=7.0', ]
setup_requirements = [ ]
test_requirements ... | dipanwita2019/twitter-senitment-analysis | setup.py | setup.py | py | 1,561 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "setuptools.setup",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "setuptools.find_packages",
"line_number": 44,
"usage_type": "call"
}
] |
9075752164 |
from flask import request
from api.endpoints.shared.BaseEndpoint import BaseEndpoint
class Search_Report(BaseEndpoint):
""" Search_Report.py """
# --------------------------------------------------------------------------
def get(self):
# search for a report (either by a search query, or return ... | i2a-org/bifrost | api/endpoints/search/Search_Report.py | Search_Report.py | py | 963 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "api.endpoints.shared.BaseEndpoint.BaseEndpoint",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "flask.request.args",
"line_number": 13,
"usage_type": "attribute"
},
{
"api_name": "flask.request",
"line_number": 13,
"usage_type": "name"
},
{
... |
43214044560 | from django.test import TestCase
from ..models import Group, Post, User
class ModelTest(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.user = User.objects.create_user(username='user_1')
cls.post = Post.objects.create(
text='[Фокшаны.] Еще переходъ до... | Chinpakamon/hw05_final | yatube/posts/tests/test_models.py | test_models.py | py | 2,468 | python | ru | code | 0 | github-code | 6 | [
{
"api_name": "django.test.TestCase",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "models.User.objects.create_user",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "models.User.objects",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_... |
26825111846 | from telegram import Bot
from .creds import get_telegram_credentials
MESSAGE = """
Hey guys, there's a new PR [here]({url}). Someone might wanna check it out?
"""
def send_telegram_message(pr_url):
bot_token, chat_id = get_telegram_credentials()
telegram_bot = Bot(bot_token)
telegram_bot.send_message(ch... | lysnikolaou/github-telegram-bot | github_telegram_bot/telegram.py | telegram.py | py | 367 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "creds.get_telegram_credentials",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "telegram.Bot",
"line_number": 12,
"usage_type": "call"
}
] |
7428605988 | from ..exceptions import TooManyObservables
from ..helpers import Status
from ..task import Task
from ..report import Report
from .base import BaseWorker
class Observables(BaseWorker):
def analyse(self, task: Task, report: Report, manual_trigger: bool=False):
try:
task.init_observables_from_... | pandora-analysis/pandora | pandora/workers/observables.py | observables.py | py | 1,045 | python | en | code | 220 | github-code | 6 | [
{
"api_name": "base.BaseWorker",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "task.Task",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "report.Report",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "task.init_observables_from_fil... |
2424261734 | # mapitem.py
# general class for how MapPLZ represents points, lines, polygons
# FreeBSD license - by Nick Doiron (@mapmeld)
import geojson
class MapItem(dict):
def __init__(self, db=None, **kwargs):
self.db = db
self["properties"] = {}
for key, value in kwargs.iteritems():
if... | mapmeld/mapplz-python | mapitem.py | mapitem.py | py | 1,842 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "geojson.Point",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "geojson.LineString",
"line_number": 41,
"usage_type": "call"
},
{
"api_name": "geojson.Polygon",
"line_number": 49,
"usage_type": "call"
},
{
"api_name": "geojson.Feature",
... |
38043243132 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 8 21:59:58 2017
@author: rik
"""
from fl_conn_builder import graph as gr
from fl_conn_builder import flight_node
from datetime import timedelta
from collections import defaultdict
from fl_conn_builder.mct_calculator import mct_calculation_basic, m... | ricmapu/Flight-Connection-Builder | fl_conn_builder/ConnectionBuilder.py | ConnectionBuilder.py | py | 6,200 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "core.schedule.Schedule",
"line_number": 18,
"usage_type": "name"
},
{
"api_name": "fl_conn_builder.mct_calculator.mct_calculation_basic",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "fl_conn_builder.graph.directedGraph",
"line_number": 22,
"usa... |
74992258108 | from django.test import TestCase
from udemy.apps.core.models import ModelTest, ModelRelatedObject
from udemy.apps.core.serializer import ModelSerializer
class ModelTestSerializer(ModelSerializer):
class Meta:
model = ModelTest
fields = ('id', 'title', 'model_related')
related_objects = di... | gabrielustosa/udemy-old | udemy/apps/core/tests/related_object/test_related_object_serializer.py | test_related_object_serializer.py | py | 4,258 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "udemy.apps.core.serializer.ModelSerializer",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "udemy.apps.core.models.ModelTest",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "udemy.apps.core.serializer.ModelSerializer",
"line_number": 19,
... |
21846554116 | import re
import numpy as np
import sys
import os
import pandas as pd
import pytesseract
from cv2 import cv2
TEMP_PATH = './temp' # 这里的根路径时调用者GUI_test的路径
class NotAImgException(Exception):
def __init__(self, msg):
super.__init__(msg)
self.msg = f"{msg} is not a image"
class Img_manager:
... | Wuhx190311/OCR | ocr/img_manager.py | img_manager.py | py | 7,758 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pandas.DataFrame",
"line_number": 26,
"usage_type": "attribute"
},
{
"api_name": "os.path.split",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 32,
"usage_type": "attribute"
},
{
"api_name": "cv2.cv2.imdecode",
... |
46522160716 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 28 12:34:21 2020
@author: margauxpeschiera
"""
import sqlite3
from tqdm import tqdm
from typing import Iterable
from reading import (
read_excel_file_patient,
read_excel_file_patient_hist,
Patient,
PatientHistorique,
)
import docum... | MargauxPeschiera/codoc_interview_project | database.py | database.py | py | 5,704 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "sqlite3.connect",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "sqlite3.Error",
"line_number": 25,
"usage_type": "attribute"
},
{
"api_name": "typing.Iterable",
"line_number": 40,
"usage_type": "name"
},
{
"api_name": "reading.PatientHis... |
31990834587 | import torch
import numpy as np
from dataTST import SynDataMetaTST
from MetaTST import Meta
import argparse
parser = argparse.ArgumentParser()
from utils import MatConvert, TST_MMD_u, MMDu
def main(args):
torch.manual_seed(222)
torch.cuda.manual_seed_all(222)
np.random.seed(222)
dtype... | fengliu90/MetaTesting | main_metaKL.py | main_metaKL.py | py | 14,834 | python | en | code | 5 | github-code | 6 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "torch.manual_seed",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "torch.cuda.manual_seed_all",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "t... |
23170867966 | #!/usr/bin/env python
import csv
import os
import sys
import socket
import ipaddress
import tarfile
import shutil
import time
import requests
from pprint import pprint
from datetime import datetime
from zipfile import ZipFile
from collections import defaultdict
# Start timer
startTime = time.time()
# API_KEY
# Def... | nchekwa/cloud-iprange-feeder | feeder_MAXMIND_GeoIP.py | feeder_MAXMIND_GeoIP.py | py | 8,881 | python | en | code | 10 | github-code | 6 | [
{
"api_name": "time.time",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "os.environ.get",
"line_number": 31,
"usage_type": "call"
},
{
"api_name": "os.environ",
"line_number": 31,
"usage_type": "attribute"
},
{
"api_name": "os.environ.get",
"line_n... |
27321040363 | """
SF Socioeconomics preprocessing
Reads SF Education, Occupation and Socioeconomics data, applies the preprocessing steps below and writes the result to files.
- Harmonize column names
- Remove rows with no information apart from `finregistryid`
- Drop duplicated rows
- Merge files into a single dataset
Input files... | dsgelab/finregistry-data | finregistry_data/registries/sf_socioeconomic.py | sf_socioeconomic.py | py | 5,389 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "logging.basicConfig",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "logging.INFO",
"line_number": 39,
"usage_type": "attribute"
},
{
"api_name": "tqdm.tqdm",
"line_number": 56,
"usage_type": "call"
},
{
"api_name": "csv.Sniffer",
"li... |
27580929336 | def write():
import streamlit as st
#datetime is imported so that the user's [entry, date] pair can be saved
from datetime import datetime
import nltk as nltk
import joblib
import math as math
nltk.download('vader_lexicon')
from nltk.sentiment.vader import SentimentIntensityAnaly... | hpdhillon/stJournalAttempt2.0 | mindfulnessdash.py | mindfulnessdash.py | py | 7,964 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "nltk.download",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "nltk.sentiment.vader.SentimentIntensityAnalyzer",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "sentence_transformers.SentenceTransformer",
"line_number": 20,
"usage_type":... |
3913426970 | import math
import json
import pandas as pd
from utils import measure
class Row:
def __init__(self, row):
self.range = row[0]
self.frequency = row[1]
self.cf = 0
self.i = (row[0][1] - row[0][0]) + 1
def midpoint(self):
r = self.range
return (r[0] + r[1]) / ... | JustAProgrammer01234/Statistics | calculation/grouped_data.py | grouped_data.py | py | 4,634 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "utils.measure.measure",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "utils.measure",
"line_number": 29,
"usage_type": "name"
},
{
"api_name": "utils.measure.measure",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "utils.measu... |
33851179454 | '''
bullet class
'''
import pygame
class Bullet(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load("images/bullet.gif").convert()
self.rect = self.image.get_rect()
self.rect.x = -100
self.rect.y = ... | Inviernos/Alien-Lord | bullet.py | bullet.py | py | 438 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pygame.sprite",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "pygame.sprite.Sprite.__init__",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "pygame.sprite",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "py... |
71359787067 | import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class Net(nn.Module):
def __init__(self, h_sizes, dropout=0.5, activation=F.sigmoid, batch_norm=False):
# self.loss = torch.nn.MSELoss()
super(Net, self).__init__()
self.activation = activation
self.h_sizes = ... | bennit6/EC523 | modelhelper/MLP_Model.py | MLP_Model.py | py | 1,273 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "torch.nn.Module",
"line_number": 5,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "torch.nn.functional.sigmoid",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_name": "torch.nn.... |
9185458440 | from tests.support import unittest2, inPy3k
try:
unicode
except NameError:
# Python 3
unicode = str
long = int
import inspect
import sys
from mock import Mock, MagicMock, _magics
class TestMockingMagicMethods(unittest2.TestCase):
def test_deleting_magic_methods(self):
mock = Mock()
... | bazelbuild/bazel | third_party/py/mock/tests/testmagicmethods.py | testmagicmethods.py | py | 14,716 | python | en | code | 21,632 | github-code | 6 | [
{
"api_name": "tests.support.unittest2.TestCase",
"line_number": 16,
"usage_type": "attribute"
},
{
"api_name": "tests.support.unittest2",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "mock.Mock",
"line_number": 19,
"usage_type": "call"
},
{
"api_name"... |
73027752189 | from urllib.robotparser import RobotFileParser
from sqlalchemy import Column, Integer, String, TIMESTAMP, Binary, ForeignKey, LargeBinary, Table, and_
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from hashlib import sha256
from selenium.common.exceptions import Timeout... | jgombac/crawler | db_classes.py | db_classes.py | py | 11,004 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "threading.Lock",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.ext.declarative.declarative_base",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.Column",
"line_number": 20,
"usage_type": "call"
},
{
"api_... |
6380985534 | import pandas as pd
import numpy as np
import torch
from torch.utils.data import Dataset
class VentilatorDatasetMLP(Dataset):
def __init__(self, annotations_file, idx=None, device='cuda'):
self.data = pd.read_csv(annotations_file)
if idx is not None:
self.data = self.data.iloc[idx].re... | sherif-abdelkarim/ventilator_pressure_prediction | dataset.py | dataset.py | py | 1,886 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "torch.utils.data.Dataset",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "pandas.read_csv",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "numpy.stack",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "torch.tensor",
... |
21551278084 | import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import animation
import sys
import random
def get_available_actions(grid, state):
actions = []
row, col = state
num_rows, num_cols = len(grid), len(grid[0])
# Check up
if row > 0 and grid[row-... | SamuelLipovetsky/tp2_ia | TP2.py | TP2.py | py | 8,427 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "numpy.random.rand",
"line_number": 45,
"usage_type": "call"
},
{
"api_name": "numpy.random",
"line_number": 45,
"usage_type": "attribute"
},
{
"api_name": "numpy.random.choice",
"line_number": 52,
"usage_type": "call"
},
{
"api_name": "numpy.random"... |
74324006589 | import xlrd
import xlwt
import xlutils.copy
workbook = xlrd.open_workbook('C:\\Users\DTJ\Desktop\工作簿1.xls')
####################################通过名称获取##################################
#sheets = workbook.sheet_names()
#worksheet = workbook.sheet_by_name(sheets[0])
####################################通过索引获取###########... | Calcifa/Excel_Test | Excel_Test.py | Excel_Test.py | py | 692 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "xlrd.open_workbook",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "xlutils.copy.copy.copy",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "xlutils.copy.copy",
"line_number": 17,
"usage_type": "attribute"
},
{
"api_name": "xluti... |
1115942687 | # import requests
# from bs4 import BeautifulSoup
# url = 'https://www.indeed.com/jobs?q=GCP+cloud&l=Irvine%2C+CA&explvl=entry_level'
# response = requests.get(url)
# soup = BeautifulSoup(response.content, 'html.parser')
# job_listings = soup.find_all('div', class_='jobsearch-SerpJobCard')
# for job in job_listings... | cloudarcKnights/python-scripting-project | findjob.py | findjob.py | py | 1,129 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "requests.get",
"line_number": 30,
"usage_type": "call"
}
] |
16066650601 | from django.shortcuts import render
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from .JWTTokens import *
from .JWTTokenAuthentication import JWTAuthentication
from .permissions import companyPermission,employerPermission
from .backend import M... | nitesh5695/employee | EMS/users/views.py | views.py | py | 7,789 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "rest_framework.views.APIView",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "serializer.companySerializer",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "serializer.is_valid",
"line_number": 15,
"usage_type": "call"
},
{
"api... |
2270574072 | #! /usr/bin/env python
from setuptools import setup
from distutils.command.build import build
# Override the build command to automatically compile message catalogs
class BuildCmd(build):
def run(self):
from babel.messages.frontend import compile_catalog
compiler = compile_catalog(self.d... | MarcoKoch/sphinx-cmake_domain | setup.py | setup.py | py | 631 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "distutils.command.build.build",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "babel.messages.frontend.compile_catalog",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "setuptools.setup",
"line_number": 22,
"usage_type": "call"
}
] |
34183795262 | # 효율성 초과됨. -> 다시풀어야됨
# from itertools import permutations
# def solution(numbers):
# str_per_list=[]
# per = list(permutations(numbers, len(numbers)))
# for p in per:
# str_per = "".join([str(_) for _ in p])
# str_per_list.append(int(str_per))
# answer = max(str_per_list)
# return an... | study-for-interview/algorithm-study | hanjo/개인용/programmers/정렬/L2_가장큰수/solution.py | solution.py | py | 886 | python | en | code | 8 | github-code | 6 | [
{
"api_name": "functools.cmp_to_key",
"line_number": 23,
"usage_type": "call"
}
] |
14026142959 | '''
This file is to set up the setting about the system, torch, CUDA, cudnn and so on based on the xxx.yaml
'''
import torch
import logging
import argparse
logger = logging.getLogger(__name__)
def system_setup(args, cfg):
# cudnn related setting
torch.backends.cudnn.enable = cfg.SYSTEM.cudnn.enable
... | YuhaoCheng/PyAnomaly | pyanomaly/utils/system.py | system.py | py | 2,402 | python | en | code | 107 | github-code | 6 | [
{
"api_name": "logging.getLogger",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "torch.backends",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "torch.backends",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "torch.backen... |
2855912648 | from bottle import request, response, HTTPResponse
from conans.util.log import logger
import traceback
from conans.model.version import Version
class VersionCheckerPlugin(object):
''' The VersionCheckerPlugin plugin checks version from client and
sets a header in the response to indicate if its last versi... | AversivePlusPlus/AversivePlusPlus | tools/conan/conans/server/rest/bottle_plugins/version_checker.py | version_checker.py | py | 2,481 | python | en | code | 31 | github-code | 6 | [
{
"api_name": "conans.model.version.Version",
"line_number": 15,
"usage_type": "argument"
},
{
"api_name": "conans.model.version.Version",
"line_number": 16,
"usage_type": "argument"
},
{
"api_name": "bottle.request.headers.get",
"line_number": 31,
"usage_type": "call"
... |
72482867707 | from . import bp as app
from flask import render_template
# Routes that return JSON
user_data = { # Mock database data
'lucasl': {
'user_id': 0,
'name': 'Lucas',
'favoriteColor': 'blue',
'posts': [
{
'id': 0,
'title': 'This is post 1',
... | LynxDDragon/FlaskWeekClass | app/blueprints/main/routes.py | routes.py | py | 2,645 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "flask.render_template",
"line_number": 97,
"usage_type": "call"
},
{
"api_name": "flask.render_template",
"line_number": 101,
"usage_type": "call"
},
{
"api_name": "flask.render_template",
"line_number": 105,
"usage_type": "call"
}
] |
27510967763 | """
Script used to archivate the current virtual environment into a form
suitable for later de archivating.
Does not work with develop mode of installed packages
"""
from os import chdir, getcwd, walk
from os.path import basename
from os.path import join as pj
import shutil
import sys
import tempfile
from zipfile imp... | revesansparole/oaserver | script/archivate_oas_venv.py | archivate_oas_venv.py | py | 1,428 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "os.path.basename",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "sys.prefix",
"line_number": 24,
"usage_type": "attribute"
},
{
"api_name": "sys.prefix",
"line_number": 25,
"usage_type": "attribute"
},
{
"api_name": "tempfile.mkdtemp",
... |
39688366474 | # Nov 16th '19
# Time: O(numCourses)
# Space: O(numCourses)
class Solution:
def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:
"""
Topological Sort Solution
"""
dep_map = collections.defaultdict(list)
in_degree = collections.defaultdict(int)
... | cmattey/leetcode_problems | Python/lc_210_course_schedule_ii.py | lc_210_course_schedule_ii.py | py | 2,863 | python | en | code | 4 | github-code | 6 | [
{
"api_name": "collections.defaultdict",
"line_number": 77,
"usage_type": "call"
}
] |
72531916989 | from collections import OrderedDict
from enum import Enum
from pathlib import Path
import rich
import typer
import yaml
from models_library.services import ServiceDockerData
from ..versioning import bump_version_string
from ..yaml_utils import ordered_safe_dump, ordered_safe_load
class TargetVersionChoices(str, Enu... | ITISFoundation/osparc-simcore | packages/service-integration/src/service_integration/commands/metadata.py | metadata.py | py | 2,204 | python | en | code | 35 | github-code | 6 | [
{
"api_name": "enum.Enum",
"line_number": 14,
"usage_type": "name"
},
{
"api_name": "enum.Enum",
"line_number": 19,
"usage_type": "name"
},
{
"api_name": "pathlib.Path",
"line_number": 30,
"usage_type": "name"
},
{
"api_name": "typer.Argument",
"line_number": ... |
42151941099 | import ctypes
from typing import List
from .constants import SIZE, SOLUTIONS
from .transformations import all_transformations
def filter_redundant_solutions(solutions: List[List[int]]) -> List[List[int]]:
"""
Iterates by all solutions and check whether its transformations (rotation and symmetries) is
reo... | lukaszszymankiewicz/8qp | app/src/solve.py | solve.py | py | 1,557 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "typing.List",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "transformations.all_transformations",
"line_number": 23,
"usage_type": "name"
},
{
"api_name": "ctypes.CDLL",
"line_number": 47,
"usage_type": "call"
},
{
"api_name": "ctypes.POI... |
11332871922 | from application.controllers import store_controller
from application.data import db
from application.data.db import session
from application.data.models import SparePartInStore, SparePartSupplier, AutoOrder
from datetime import datetime, date, timedelta
def low_index(store_id, product_number):
return session.qu... | BritneyBob/bikeparts | application/data/repository/auto_order_repository.py | auto_order_repository.py | py | 1,898 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "application.data.db.session.query",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "application.data.models.SparePartInStore",
"line_number": 10,
"usage_type": "argument"
},
{
"api_name": "application.data.db.session",
"line_number": 10,
"usage_ty... |
43899975683 | from xml.dom import minidom
from xml.parsers.expat import ExpatError
class XMP:
MARKER_SOI = b'\xff\xd8'
MARKER_EOI = b'\xff\xd9'
MARKER_SOS = b'\xff\xda'
MARKER_APP1 = b'\xff\xe1'
XMP_IDENTIFIER = b'http://ns.adobe.com/xap/1.0/\x00'
XMP_PACKET_BEGIN = b'<?xpacket begin="w" id="W5M0MpCehiHzre... | ntieman/blender-facebook-360 | src/xmp.py | xmp.py | py | 5,554 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "xml.dom.minidom.parseString",
"line_number": 93,
"usage_type": "call"
},
{
"api_name": "xml.dom.minidom",
"line_number": 93,
"usage_type": "name"
},
{
"api_name": "xml.parsers.expat.ExpatError",
"line_number": 94,
"usage_type": "name"
},
{
"api_name... |
2719228301 | import os
import numpy as np
import matplotlib.pyplot as plt
from analysis_libs import get_nice_featureset_short_name, get_nice_dataset_name
all_feat_types = ['vggish', 'maad']
all_feat_cols = ['blue', 'orange']
feat_mode = 'mean'
pval_thresh = 0.05
analysed_data_dir = 'analysed_data'
corr_type = 'pearson'
all_datase... | sarabsethi/sscape-avian-div-generalisability | fig_richness_feat_corrs.py | fig_richness_feat_corrs.py | py | 2,584 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "matplotlib.pyplot.subplots",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 15,
"usage_type": "name"
},
{
"api_name": "numpy.ravel",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "matplotlib.p... |
70066352188 | # Возьмите любые 1-3 задания из прошлых домашних заданий. Добавьте к ним
# логирование ошибок и полезной информации. Также реализуйте возможность
# запуска из командной строки с передачей параметров.
import argparse
import logging
FORMAT = "%(asctime)s %(levelname)s %(message)s"
logging.basicConfig(format=FORMAT, fi... | RezvovaAnna/Python_immersion | seminar_15/task03_Archive.py | task03_Archive.py | py | 2,499 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "logging.basicConfig",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "logging.INFO",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "logging.getLogger",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "argparse.Argu... |
21691252345 | # author: cmelgreen
# date: 9/12/20
#
# written as answer to/based on vishal's codereview question at:
# https://codereview.stackexchange.com/questions/249239/modelling-of-partcle-flow-under-electric-field
#
# particle dispersion model from:
# electrostatic forces alter particle size distributions in atmospheric dust
... | cmelgreen/ParticleFlow | Particle_Flow_Refactored.py | Particle_Flow_Refactored.py | py | 4,814 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "scipy.stats.truncnorm",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "scipy.stats",
"line_number": 24,
"usage_type": "name"
},
{
"api_name": "numpy.inf",
"line_number": 24,
"usage_type": "attribute"
},
{
"api_name": "numpy.random.normal"... |
4643587046 | import os
import sys
import cv2
import time
import shutil
import numpy as np
from threading import Thread, Event
class Camera(object):
def __init__(self, camera_id: int | float | str = 0,
show_frame: bool = False,
vertical_flip: bool = False,
save_video: bool =... | EvilFis/MultiCamVision | cam/Camera.py | Camera.py | py | 10,764 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "sys.platform",
"line_number": 19,
"usage_type": "attribute"
},
{
"api_name": "threading.Event",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "threading.Thread",
"line_number": 40,
"usage_type": "call"
},
{
"api_name": "time.sleep",
"... |
7325051750 | import asyncio
import re
import ssl
from decimal import Decimal
from itertools import chain
from pathlib import Path
from typing import Optional, Union
import ujson
import yarl
from aiocache import cached
from aiohttp import ClientResponseError, ServerDisconnectedError
from pydantic import ValidationError
from meta_a... | dex-guru/meta-aggregation-api | meta_aggregation_api/providers/paraswap_v5/paraswap_provider_v5.py | paraswap_provider_v5.py | py | 12,517 | python | en | code | 32 | github-code | 6 | [
{
"api_name": "meta_aggregation_api.utils.logger.get_logger",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "meta_aggregation_api.utils.errors.TokensError",
"line_number": 38,
"usage_type": "name"
},
{
"api_name": "meta_aggregation_api.utils.errors.TokensError",
"l... |
19249525892 | import email
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from datetime import datetime
# add new email address to the destination emails list
def add_dest_addr(addr):
with open(r'files/emails.txt', 'r+') as emailFile:
dest_address = emailFile.... | RadXGH/smart-cctv-univ-proj | scripts/email_notify.py | email_notify.py | py | 2,607 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "email.mime.multipart.MIMEMultipart",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "datetime.datetime.now",
"line_number": 52,
"usage_type": "call"
},
{
"api_name": "datetime.datetime",
"line_number": 52,
"usage_type": "name"
},
{
"api_na... |
6271612707 | from django.shortcuts import render
from rest_framework import parsers, renderers, status
from rest_framework.authtoken.models import Token
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.compat import coreapi, coreschema
from rest_framework.response import Response
from rest_fr... | sirapobmeech/ManageMate | managemate_bacend/user/views.py | views.py | py | 2,958 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "rest_framework.views.APIView",
"line_number": 15,
"usage_type": "name"
},
{
"api_name": "rest_framework.response.Response",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "rest_framework.status.HTTP_200_OK",
"line_number": 20,
"usage_type": "attri... |
41843919920 | import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
if len(gpus) > 1:
# Using the second GPU
tf.config.experimental.set_visible_devices(gpus[1], 'GPU')
import matplotlib.pyplot as plt
from data import tokenizer
from Transformer import Transformer
from utils import get_mask
from utils import Cu... | gmortuza/machine-learning-scratch | machine_learning/neural_network/transformer/evaluate.py | evaluate.py | py | 3,381 | python | en | code | 6 | github-code | 6 | [
{
"api_name": "tensorflow.config.list_physical_devices",
"line_number": 2,
"usage_type": "call"
},
{
"api_name": "tensorflow.config",
"line_number": 2,
"usage_type": "attribute"
},
{
"api_name": "tensorflow.config.experimental.set_visible_devices",
"line_number": 5,
"usag... |
29401123216 | from src.channel import Channel
import isodate
import datetime
class PlayList:
def __init__(self, playlist_id):
self.playlist_id = playlist_id
youtube = Channel.get_service()
playlist_videos = youtube.playlistItems().list(playlistId=self.playlist_id,
... | AnastasiaLykova/youtube-analytics-project | src/playlist.py | playlist.py | py | 3,442 | python | en | code | null | github-code | 6 | [
{
"api_name": "src.channel.Channel.get_service",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "src.channel.Channel",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "src.channel.Channel.get_service",
"line_number": 31,
"usage_type": "call"
},
{
... |
43889299075 | from django.contrib import messages
from django.core.exceptions import ValidationError
from django.forms import ModelForm
from django.forms.widgets import NumberInput
from django import forms
from django.http import Http404
from django.shortcuts import redirect
from django.utils import timezone
from upload.models imp... | minosssss/nutriProject | upload/forms.py | forms.py | py | 2,175 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "django.forms.ModelForm",
"line_number": 14,
"usage_type": "name"
},
{
"api_name": "upload.models.Upload",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "django.forms.ClearableFileInput",
"line_number": 20,
"usage_type": "call"
},
{
"api_n... |
29355056966 | import re
import pytest
from marshmallow import ValidationError, validate
from marshmallow_utils.fields.url import URLValidator
@pytest.mark.parametrize(
"valid_url",
[
"http://example.org",
"https://example.org",
"ftp://example.org",
"ftps://example.org",
"http://exa... | anikachurilova/marshmallow-utils | tests/fields/test_url.py | test_url.py | py | 6,487 | python | en | code | null | github-code | 6 | [
{
"api_name": "marshmallow_utils.fields.url.URLValidator",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "pytest.mark.parametrize",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "pytest.mark",
"line_number": 9,
"usage_type": "attribute"
},
{
"... |
72764470268 | from surprise.model_selection import GridSearchCV
from surprise.accuracy import rmse
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity, pairwise_kernels
from tqdm import tqdm
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import ... | Amayas29/review-analysis | src/iads/recommandation/prediction.py | prediction.py | py | 3,900 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "numpy.asarray",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "numpy.mean",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "numpy.asarray",
"line_number": 41,
"usage_type": "call"
},
{
"api_name": "numpy.log2",
"line_number"... |
28189027933 | import boto3
from boto3.dynamodb.conditions import Key
dynamodb = boto3.resource('dynamodb', region_name='us-east-2')
table = dynamodb.Table('Books')
# Queries item who's attribute name ('Author') and it is equal to "John Grisham"
resp = table.query(KeyConditionExpression=Key('Author').eq('John Grisham'))
print("The... | rashi2911/aws-dynamodb-bookstore | src/multiple_items_retrieve.py | multiple_items_retrieve.py | py | 402 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "boto3.resource",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "boto3.dynamodb.conditions.Key",
"line_number": 8,
"usage_type": "call"
}
] |
31261398091 | from itertools import groupby
from math import pow
from ModestMaps.Core import Coordinate
from operator import attrgetter
import unittest
class TestSeedTiles(unittest.TestCase):
def _call_fut(self, zoom_until):
from tilequeue.tile import seed_tiles
return list(seed_tiles(zoom_until=zoom_until))
... | thanhnghiacntt/tilequeue | tests/test_tile.py | test_tile.py | py | 9,667 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "unittest.TestCase",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "tilequeue.tile.seed_tiles",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "ModestMaps.Core.Coordinate",
"line_number": 21,
"usage_type": "call"
},
{
"api_na... |
16543783897 | import os
import sys
from optparse import OptionParser
from nuitka.__past__ import md5
from nuitka.tools.testing.Common import (
check_output,
convertUsing2to3,
decideNeeds2to3,
getPythonSysPath,
getPythonVersionString,
getTempDir,
my_print,
setup,
)
from nuitka.tools.testing.Constructs... | Nuitka/Nuitka | nuitka/tools/testing/measure_construct_performance/__main__.py | __main__.py | py | 7,755 | python | en | code | 10,019 | github-code | 6 | [
{
"api_name": "os.environ",
"line_number": 29,
"usage_type": "attribute"
},
{
"api_name": "nuitka.tools.testing.Common.getPythonSysPath",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "optparse.OptionParser",
"line_number": 36,
"usage_type": "call"
},
{
... |
30353229771 | from os.path import abspath
from io import BytesIO
import copy
import numpy
from pyface.api import GUI
# Local imports.
from common import TestCase, is_running_with_nose
class TestStreamline(TestCase):
def make_data(self):
"""Trivial data -- creates an elementatry scalar field and a
constant vec... | enthought/mayavi | integrationtests/mayavi/test_streamline.py | test_streamline.py | py | 5,775 | python | en | code | 1,177 | github-code | 6 | [
{
"api_name": "common.TestCase",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "numpy.arange",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "numpy.reshape",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "numpy.transpose",
"lin... |
17031252314 | import sys; sys.path.insert(0, '../')
from invert.config import all_solvers
from invert import Solver
import numpy as np
import mne
from esinet.forward import get_info, create_forward_model
pp = dict(surface='white', hemi='both', verbose=0)
# Parameters
sampling = 'ico3'
montage = "biosemi16"
alpha = 0.1
epochs = 1
... | LukeTheHecker/invert | tests/test_solvers.py | test_solvers.py | py | 1,408 | python | en | code | 5 | github-code | 6 | [
{
"api_name": "sys.path.insert",
"line_number": 1,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 1,
"usage_type": "attribute"
},
{
"api_name": "esinet.forward.get_info",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "esinet.forward.cr... |
15832609768 | import aoc12_data
from typing import List, Tuple
Directions = List[Tuple[str, int]]
def drive(directions: Directions):
current_dir = 90
direction_map = {
0: "N",
90: "E",
180: "S",
270: "W",
}
current_pos = [0, 0]
moves = {"E": (0, 1), "W": (0, -1), "N": (1, 0), "S... | zidarsk8/aoc2020 | aoc12.py | aoc12.py | py | 3,276 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "typing.List",
"line_number": 4,
"usage_type": "name"
},
{
"api_name": "typing.Tuple",
"line_number": 4,
"usage_type": "name"
},
{
"api_name": "aoc12_data.data.splitlines",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "aoc12_data.data",
... |
18537189569 | # Prob_link: https://www.codingninjas.com/studio/problems/cycle-detection-in-undirected-graph_8230798?challengeSlug=striver-sde-challenge&leftPanelTab=0
from collections import deque
def getAdjList(edges, n):
adjList = [[] for i in range(0, n+1)]
for v1, v2 in edges:
if v1 not in adjList[v2]:
... | Red-Pillow/Strivers-SDE-Sheet-Challenge | P160_Cycle_Detection_In_Undirected_Graph.py | P160_Cycle_Detection_In_Undirected_Graph.py | py | 1,586 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "collections.deque",
"line_number": 13,
"usage_type": "call"
}
] |
10066939086 |
import sys
import platform
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import (QCoreApplication, QPropertyAnimation, QDate, QDateTime, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt, QEvent)
from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabas... | FarhanSyed23/PCOS-Probability-Predictor | main.py | main.py | py | 2,555 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "Splash.Ui_SplashScreen",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "PySide2.QtCore.Qt",
"line_number": 28,
"usage_type": "attribute"
},
{
"api_name": "PySide2.QtCore",
"line_number": 28,
"usage_type": "name"
},
{
"api_name": "PySide2.... |
1071988039 | import os
import shutil
import subprocess
import random
import sys
import PySimpleGUI as psg
layout = [
[ psg.Text("Randomize Fossils?", size = 17), psg.Button("Yes", key = "dig", size = 5) ],
[ psg.Text("Randomize Starter?", size = 17), psg.Button("Yes", key = "start", size = 5) ],
# [ psg.Text("Randomize... | opiter09/Fossil-Fighters-Randomizer | randomize.py | randomize.py | py | 11,229 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "PySimpleGUI.Text",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "PySimpleGUI.Button",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "PySimpleGUI.Text",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "PySimpleGUI.Button... |
29380827119 | import configparser
import os
from posixpath import dirname
def _init():
global _global_config
_global_config = configparser.ConfigParser()
# 获取绝对路径
abs_path = os.path.abspath(__file__)
# 获取目录路径
dir_name = os.path.dirname(abs_path) # 2
path = dir_name + r'/../../config/config.ini'
i... | tsumirai/XunHuanSpider | src/config/conf.py | conf.py | py | 528 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "configparser.ConfigParser",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "os.path.abspath",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "os.path.dirname... |
32595132371 |
import cv2
import logging
import numpy as np
import argparse
from face_detect import face_detect
from head_pose import head_pose
from landmark import landmark
from gaze import gaze
from openvino.inference_engine import IENetwork, IECore
from movemouse import MouseController
logger = logging.getLogger()
logger.setLev... | somasundaram1702/Gaze-estimation-and-control-computer-pointer | inference.py | inference.py | py | 3,859 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "logging.getLogger",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "logging.DEBUG",
"line_number": 15,
"usage_type": "attribute"
},
{
"api_name": "face_detect.face_detect",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "landmark... |
2720067648 | #!/usr/bin/python3
"""
Python script that sends a POST request to the URL and
to an URL with the letter as a parameter
"""
import requests
import sys
if __name__ == "__main__":
letter = "" if len(sys.argv) == 1 else sys.argv[1]
payload = {"q": letter}
r = requests.post("http://0.0.0.0:5000/search_user", ... | Wolleys/alx-higher_level_programming | 0x11-python-network_1/8-json_api.py | 8-json_api.py | py | 578 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "sys.argv",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "requests.post",
"line_number": 14,
"usage_type": "call"
}
] |
16849284625 | import json
import pytest
from server.tests.conftest import api_client, django_db_setup # noqa
from django.db import DatabaseError, ProgrammingError
from django.urls import reverse
from snippetapp.models import Tag
@pytest.mark.django_db
class TestTags:
"""
Test cases for the tag endpoint.
"""
url ... | Mahesh-VM/snippet | snippetapp/tests/test_tag.py | test_tag.py | py | 2,942 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "django.urls.reverse",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "snippetapp.models.Tag.objects.create",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "snippetapp.models.Tag.objects",
"line_number": 21,
"usage_type": "attribute"
}... |
10713286979 | from tsfresh.feature_extraction import feature_calculators as fc
from tqdm.notebook import tqdm
import pandas as pd
import pywt
import numpy as np
def feature_extractor(df, noLevels, waveletName):
'''
Preprocesses the entire dataframe (computes DWT + feature extract from each sub-band)
Inputs:
... | Miltos-90/ECG_Signal_Classification | utils.py | utils.py | py | 4,358 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "tqdm.notebook.tqdm",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "pandas.DataFrame",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "tsfresh.feature_extraction.feature_calculators.abs_energy",
"line_number": 39,
"usage_type": "call"
... |
6605560136 | from collections import deque
import sys
from typing import Deque, List, Tuple
dx: List[int] = [0, -1, 1, 0]
dy: List[int] = [1, 0, 0, -1]
def bfs(graph) -> int:
shark_size: int = 2
shark_feed: int = 0
shark_time: int = 0
answer: int = 0
moving_que: Deque[Tuple[int, int]] = deque()
visited: L... | JeongGod/Algo-study | JaeYoung/week06/baekjoon/16236.py | 16236.py | py | 2,463 | python | ko | code | 7 | github-code | 6 | [
{
"api_name": "typing.List",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "typing.List",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "typing.Deque",
"line_number": 14,
"usage_type": "name"
},
{
"api_name": "typing.Tuple",
"line_number": ... |
71125000189 | #!/usr/bin/env python
import gi
import Save
import file_dialog
import ntpath
import subprocess
import toogle
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GdkPixbuf
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="PDF Conve... | krawat10/ImageToPDFConveterLinux | main.py | main.py | py | 10,623 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "gi.require_version",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "gi.repository.Gtk.Window",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "gi.repository.Gtk",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "gi.... |
12110696247 | import regex
def rule(r):
ret_rules = []
sub_rules = r.split(" | ")
for sub_rule in sub_rules:
if "\"" in sub_rule:
return sub_rule.strip()[1:-1]
else:
ret_rules.append([int(i) for i in sub_rule.split(" ")])
return ret_rules
def consolidate_rules(rs):
cons... | scjohnson/aoc_2020 | solution_19.py | solution_19.py | py | 2,504 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "regex.search",
"line_number": 57,
"usage_type": "call"
},
{
"api_name": "regex.search",
"line_number": 58,
"usage_type": "call"
},
{
"api_name": "regex.match",
"line_number": 59,
"usage_type": "call"
},
{
"api_name": "regex.search",
"line_number... |
277090348 | import pandas as pd
import altair as alt
import pytest
from prepropy import eda
def gen_test_data():
test_data = pd.DataFrame()
test_data["num1"] = [8.5, 8, 9.2, 9.1, 9.4]
test_data["num2"] = [0.88, 0.93, 0.95, 0.92, 0.91]
test_data["num3"] = [0.46, 0.78, 0.66, 0.69, 0.52]
test_data["num4"] = [0.0... | UBC-MDS/prepropy | tests/test_eda.py | test_eda.py | py | 2,520 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pandas.DataFrame",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "prepropy.eda.eda",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "prepropy.eda",
"line_number": 21,
"usage_type": "name"
},
{
"api_name": "prepropy.eda.eda",
... |
27226271664 | # https://terrain.party/
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
from PIL import Image,ImageFilter
import numpy as np
import os
PATH_TO_HEIGTHMAP = os.path.join("heightmap")
file="idf"
path = os.path.join(PATH_TO_HEIGTHMAP,"{}.png".format(file))
# Pillow... | zarnold/heightmap | draw_contour.py | draw_contour.py | py | 1,309 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "os.path.join",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 1... |
43507811281 | import torch
from ot import *
from utils import *
def FGSM(net,inputs,labels,device,eps,criterion):
net,inputs,labels = net.to(device),inputs.to(device),labels.to(device)
x = inputs.clone().detach().requires_grad_(True).to(device)
alpha = eps
pred,_ = net(x)
loss = criterion(pred,la... | aminul-huq/WideResNet_MNIST_Adversarial_Training | attacks.py | attacks.py | py | 3,954 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "torch.sign",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "torch.empty_like",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "torch.clamp",
"line_number": 31,
"usage_type": "call"
},
{
"api_name": "torch.autograd.grad",
"li... |
18601714715 | import pytest
from pathlib import Path
import pytchbuild.tutorialcompiler.fromgitrepo.repo_functions as TCRF
class TestEnsureStatusClean:
def test_when_is_clean(self, clean_cloned_repo):
TCRF.ensure_status_clean(clean_cloned_repo)
# If we get here without exception, test has passed.
def test... | pytchlang/pytch-build | tests/tutorialcompiler/fromgitrepo/test_repo_functions.py | test_repo_functions.py | py | 2,429 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pytchbuild.tutorialcompiler.fromgitrepo.repo_functions.ensure_status_clean",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "pytchbuild.tutorialcompiler.fromgitrepo.repo_functions",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "pytest.raises",
... |
28997824849 | import os
from bs4 import BeautifulSoup
import re
from .init_pool import init_pool
from ..utils import get_content
def build_data():
print("===开始同步\"建造模拟器\"数据===")
init_data = init_pool
cot = get_content("https://wiki.biligame.com/blhx/%E5%BB%BA%E9%80%A0%E6%A8%A1%E6%8B%9F%E5%99%A8")
soup = Beautifu... | ACGN-Alliance/nonebot-plugin-azurlane-assistant-data | scripts/build_simulator/data_spider.py | data_spider.py | py | 3,611 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "init_pool.init_pool",
"line_number": 13,
"usage_type": "name"
},
{
"api_name": "utils.get_content",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "utils.get_con... |
74261582907 | import pandas as pd
import time
import os
from os import listdir
from os.path import isfile, join
from strsimpy.jaro_winkler import JaroWinkler
from strsimpy.normalized_levenshtein import NormalizedLevenshtein
from strsimpy.cosine import Cosine
from strsimpy.jaccard import Jaccard
from strsimpy.sorensen_dice ... | Adriana031991/process-matches-python | domain/usecases/process_matches/determine_matches.py | determine_matches.py | py | 3,320 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "strsimpy.jaro_winkler.JaroWinkler",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "strsimpy.normalized_levenshtein.NormalizedLevenshtein",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "strsimpy.cosine.Cosine",
"line_number": 17,
"usag... |
18200385429 | from pydantic import BaseSettings
class Settings(BaseSettings):
database_url: str = 'postgresql+asyncpg://postgres:postgres@localhost:5432/postgres'
bot_token: str = '5693124495:AAGBRnfIcUpQnGL9ieeg5p9c6mLwD9r5e04'
media_root: str = '../media/'
settings = Settings(
_env_file='.env',
_env_file_... | samoilenkoa7/CryptoWalletSearchBot | tgbotbase/config.py | config.py | py | 339 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "pydantic.BaseSettings",
"line_number": 4,
"usage_type": "name"
}
] |
40040019303 | import os, shutil
from uparser import wordparse
from joblib import Parallel, delayed
from tqdm import tqdm
num_jobs = 20
infolder = 'Words'
outfolder = 'Outputs'
for fdr in [outfolder]:
if os.path.exists(fdr):
shutil.rmtree(fdr)
os.mkdir(fdr)
langs = []
langwdmap = {}
flist = os.listdir(infolder)
fo... | vikram-kv/Unified_Parser | run_parser_all_lang_all_opt.py | run_parser_all_lang_all_opt.py | py | 1,193 | python | en | code | 3 | github-code | 6 | [
{
"api_name": "os.path.exists",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "shutil.rmtree",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "os.mkdir",
"line_number... |
73831187709 | from DQN import *
from memory import *
import numpy as np
import torch.optim as optim
import math
action_dict = {"up": 0, "right": 1, "down": 2, "left": 3}
actions=["up", "right", "down", "left"]
class grid_agent:
def __init__(self, config, device, model=False):
self.device=device
self.board_si... | fhtanaka/TCC2018 | grid_world/agent.py | agent.py | py | 5,136 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "torch.optim.load",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "torch.optim",
"line_number": 27,
"usage_type": "name"
},
{
"api_name": "torch.optim.RMSprop",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "torch.optim",
"l... |
16123791627 | from config import CFG
import gc
import torch
from torch.utils.data import DataLoader
import torch.nn as nn
from utils import AverageMeter, timeSince, get_score
from transformers import AutoTokenizer
from dataset import collate, TrainDataset
from model import CustomModel
import numpy as np
from torch.optim import AdamW... | keimoriyama/kaggle_FB3 | code/train.py | train.py | py | 9,283 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "config.CFG.logger.info",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "config.CFG.logger",
"line_number": 24,
"usage_type": "attribute"
},
{
"api_name": "config.CFG",
"line_number": 24,
"usage_type": "name"
},
{
"api_name": "config.CFG.t... |
2116767943 | import pygame
import numpy as np
import os
def getRectangle(width, height, x=0, y=0):
v=np.array([[x, y],
[x+width, y],
[x+width, y+height],
[x, y+height]],
dtype = 'float')
return v
def R3mat(deg):
theta = np.deg2rad(deg)
c... | princesskim/Mid | Mid_clock.py | Mid_clock.py | py | 4,503 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "numpy.array",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "numpy.deg2rad",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "numpy.cos",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "numpy.sin",
"line_number": 17,... |
8398590327 | from openfl.data import one_hot
from openfl.data.pytorch.ptfldata_inmemory import PyTorchFLDataInMemory
import logging
import numpy as np
import torchvision
def _load_raw_datashards(shard_num, nb_collaborators):
"""Load the raw data by shard
Returns tuples of the dataset shard divided into training and... | sarthakpati/OpenFederatedLearning | openfl/data/pytorch/ptmnist_inmemory.py | ptmnist_inmemory.py | py | 4,979 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "torchvision.datasets.MNIST",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "torchvision.datasets",
"line_number": 19,
"usage_type": "attribute"
},
{
"api_name": "torchvision.datasets.MNIST",
"line_number": 20,
"usage_type": "call"
},
{
"a... |
40546312272 | from django.shortcuts import render
# Create your views here.
import time
import random
import base64
from io import BytesIO
from functools import wraps
from django.http import JsonResponse, HttpResponse
from admin_manage.models import Admin, Token, Company
from PIL import Image
def method_verify(req_method='POST'):... | hamster1963/face-all-in-one-machine-backend | admin_manage/views.py | views.py | py | 8,874 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "django.http.JsonResponse",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "functools.wraps",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "django.http.JsonResponse",
"line_number": 51,
"usage_type": "call"
},
{
"api_name": "adm... |
27986312291 | import multiprocessing
import time
from pynvml import *
import numpy as np
def modify_pycmd(cmd, gpus=None, ctrl=None):
"""
:param cmd: python py_cmd.py model_name -m train
,不包含-d的信息
:param gpus:
:return:
"""
assert gpus
for id in gpus:
ctrl[id] = 1
gpu_str = '%d' % gpus[0]... | cenchaojun/mmd_rs | EXP_CONCONFIG/multi_train.py | multi_train.py | py | 3,985 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "EXP_CONCONFIG.CONFIGS.model_NWPU_VHR_10_config.NV10_cfgs",
"line_number": 54,
"usage_type": "name"
},
{
"api_name": "multiprocessing.Array",
"line_number": 79,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 79,
"usage_type": "call"
},... |
33392346155 | import os # noqa
os.environ['OPENBLAS_NUM_THREADS'] = '16' # noqa, must go before jax
from pmwd import (
Configuration,
Cosmology,
boltzmann,
linear_modes,
lpt,
nbody,
scatter,
)
import logging
import numpy as np
import argparse
from os.path import join as pjoin
from ..utils import (attrd... | maho3/ltu-cmass | cmass/nbody/pmwd.py | pmwd.py | py | 3,811 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "os.environ",
"line_number": 2,
"usage_type": "attribute"
},
{
"api_name": "utils.get_global_config",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "utils.setup_logger",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "argparse.Ar... |
34181454852 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 26 10:28:57 2021
@author: Kollarlab
"""
import time
import numpy
import os
import matplotlib.pyplot as plt
import userfuncs
from plotting_tools import simplescan_plot
def get_default_settings():
settings = {}
settings['scanname'] = 'rabi_chevron'
setti... | MRitter95/Kollar-Lab | Old_scripts_delete_20220804/Scripts/rabi_chevron.py | rabi_chevron.py | py | 8,653 | python | en | code | 2 | github-code | 6 | [
{
"api_name": "userfuncs.saveDir",
"line_number": 67,
"usage_type": "call"
},
{
"api_name": "userfuncs.timestamp",
"line_number": 68,
"usage_type": "call"
},
{
"api_name": "numpy.round",
"line_number": 80,
"usage_type": "call"
},
{
"api_name": "numpy.linspace",
... |
4931610734 | # -*- coding: utf-8 -*-
import os
import pickle
import numpy as np
from PIL import Image
import paddle.v2 as paddle
__UNK__ = 'UNK'
__GO__ = 'GO'
__EOS__ = 'EOS'
# 保存词典
def save_dict(dict_path, word2id, id2word):
f = open(dict_path + 'word2id.pkl', 'wb')
pickle.dump(word2id, f)
f.close()
f = open(d... | wondervictor/DeepLearningWithPaddle | ImageCaption/data_reader.py | data_reader.py | py | 3,642 | python | en | code | 5 | github-code | 6 | [
{
"api_name": "pickle.dump",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "pickle.dump",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "pickle.load",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "pickle.load",
"line_number": ... |
21368481886 | #-------------------------------------------------
#motor number in Motordriver_py3 refers to port on motor driver
#-------------------------------------------------
import sys
from PyQt4 import QtCore, QtGui, uic, Qt
import pyqtgraph as pg
import serial
import hardware.Motordriver_py3 as mo
import hardwa... | physikier/magnetometer | remote_power_measurement_ui.py | remote_power_measurement_ui.py | py | 11,530 | python | en | code | 0 | github-code | 6 | [
{
"api_name": "numpy.zeros",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "pyqtgraph.Qt.QtGui.QMainWindow",
"line_number": 39,
"usage_type": "attribute"
},
{
"api_name": "pyqtgraph.Qt.QtGui",
"line_number": 39,
"usage_type": "name"
},
{
"api_name": "Py... |
24948745462 | # chatapp/urls.py
from django.urls import path
from .views import (
GroupChatView,
OneonOneChatView,
RoomRedirectView,
TopPageView
)
app_name = 'chatapp'
urlpatterns = [
# page view
path('', TopPageView.as_view(), name='top_page'),
path('chat_room/<slug:room_pk>/', OneonOneChatView.as_v... | mayonnaises/channels-chat | chatapp/urls.py | urls.py | py | 539 | python | en | code | 1 | github-code | 6 | [
{
"api_name": "django.urls.path",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "views.TopPageView.as_view",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "views.TopPageView",
"line_number": 17,
"usage_type": "name"
},
{
"api_name": "django.u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.