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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
495834642 | from pprint import pprint
import requests
from nifstd_tools.simplify import ematch, sub, pred, obj, endIn, fasIn, layerIn, ie, ext
def query(neupop_id):
url = ('http://sparc-data.scicrunch.io:9000/scigraph/dynamic/'
f'demos/apinat/neru-4/{neupop_id}.json?limit=9999999')
resp = requests.get(url, he... | null | connected_pairs.py | connected_pairs.py | py | 2,470 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "requests.get",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "nifstd_tools.simplify.ematch",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "nifstd_tools.simplify.sub",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "n... |
175448463 | import requests
import time as t
import random
from bs4 import BeautifulSoup as bs
import discord
from discord.ext import commands
from discord.ext.commands import Bot
from datetime import datetime, date, time, timezone
import os
client = commands.Bot(command_prefix='$')
@client.event
async def on_ready():
print('Lo... | null | fpit.py | fpit.py | py | 2,509 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "discord.ext.commands.Bot",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "discord.ext.commands",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "os.environ.get",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "os.envir... |
371206350 | from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.views.generic import View
from django.db import models
from django_crucrudile.models.mixins import (
AutoPatternsMixin,
make_model_mixin,
make_model_mixins
)
from tests.views import (
AutoPatternsMixin... | null | tests/test_model_mixins.py | test_model_mixins.py | py | 10,208 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.test.TestCase",
"line_number": 21,
"usage_type": "name"
},
{
"api_name": "django_crucrudile.models.mixins.AutoPatternsMixin",
"line_number": 24,
"usage_type": "name"
},
{
"api_name": "django.db.models.Model",
"line_number": 24,
"usage_type": "attribu... |
480290078 | import os
import csv
import chinese_tagging_api
from bs4 import BeautifulSoup
import random
import time
from googletrans import Translator
import chinese_nlp
directory = 'static/articles/'
counter = 0
companies = chinese_tagging_api.load_company_names('Data/2000_Chinese_Companies.xlsx', 'Chinese Lexicon',
... | null | marco-polo2/load_data.py | load_data.py | py | 5,032 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "chinese_tagging_api.load_company_names",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "time.mktime",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "time.strptime",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "time... |
79377484 | import sys
import numpy as np
import progressbar
import torch
from sklearn.metrics import roc_auc_score
from datasets.batch_generator import BatchGenerator
from datasets.data_loader import init_data_loading
from models.rnn_vae import RNN_VAE
def setup_model_and_dataloading(train_source, val_source, batch_size, data... | null | utils/experiment_utils.py | experiment_utils.py | py | 5,238 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "datasets.data_loader.init_data_loading",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "datasets.batch_generator.BatchGenerator",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "datasets.batch_generator.BatchGenerator",
"line_number": 28,
... |
633110760 | import discord
from discord.ext import commands
import datetime
from urllib import parse, request
import re
bot = commands.Bot(command_prefix='-', description="This is a Helper Bot")
@bot.command()
async def pin(ctx):
await ctx.send(':thumbsup: ')
@bot.command()
async def sum(ctx, numOne: int, num... | null | src/index.py | index.py | py | 2,124 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "discord.ext.commands.Bot",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "discord.ext.commands",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "discord.Embed",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "datetime.da... |
180018629 | from sklearn.preprocessing import normalize
import numpy as np
from scipy.sparse import lil_matrix
from initialise import initialise
# Input data must be integers, conversion during numpy array set-up
# cannot round correctly
def normaliser(dpsi,dtheta,dt,tau):
psigrid=np.arange(0, 320000+dpsi, dpsi)
tgrid=np.a... | null | Transition_Matrices/Stommel_PseudoPolar/row_normaliser.py | row_normaliser.py | py | 800 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "numpy.arange",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "numpy.arange",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "numpy.loadtxt",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "sklearn.preprocessing.normali... |
650249726 | import os
import re
import requests
from collections import namedtuple
from enum import Enum
from data import _Data
_SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
_session = None
def _fetch(year, day, input_file):
cookies = {'session': _session}
r = requests.get(
'https://adventofcode.co... | null | util/python/util/aoc.py | aoc.py | py | 2,203 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.dirname",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "os.path.realpath",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "requests.get",
"line_n... |
287767692 | # -*-coding: utf-8 -*-
"""
杭州链家爬虫
"""
import scrapy
from scrapy.http import Request
from lxml.html import etree
from Spider.items import AddressItem
from Spider.items import LianJiaItem
from Spider.utils import PinyinUtil
class LJSpider(scrapy.Spider):
name = "LJSpider"
allowed_domains = ['hz.lianjia.com']
... | null | Spider/spiders/LJSpider.py | LJSpider.py | py | 2,938 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "scrapy.Spider",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "Spider.utils.PinyinUtil",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "scrapy.http.Request",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "scrapy... |
439864033 | """Change start_urls to desired typepad blog archive url
Also change condition for outgoing links to the original non-archive link"""
import scrapy
from scrapy.selector import Selector
import re
class test_spider(scrapy.Spider):
name = "scraper"
start_urls = ['http://ashleymorris.typepad.com/ashley_morris_the... | null | Scrapers/typepad.py | typepad.py | py | 4,407 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "scrapy.Spider",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "scrapy.Request",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "scrapy.Request",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "scrapy.Request",
... |
334038892 | # ===============================================================================
# Copyright 2013 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | null | pychron/processing/plotters/options/spectrum.py | spectrum.py | py | 15,885 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "re.compile",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "pychron.processing.plotters.options.age.AgeOptions",
"line_number": 36,
"usage_type": "name"
},
{
"api_name": "traits.api.Int",
"line_number": 38,
"usage_type": "call"
},
{
"api_... |
3349272 | #!/usr/bin/env python3
import sys
from typing import List
def risk_level(data: List[str]) -> int:
result = 0
max_row = len(data)
max_col = len(data[0])
for i in range(len(data)):
for j in range(len(data[i])):
min_adj = min([
data[i + ii][j + jj]
f... | null | 2021/day_09_smoke_basin_1.py | day_09_smoke_basin_1.py | py | 936 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "typing.List",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "sys.stdin",
"line_number": 41,
"usage_type": "attribute"
}
] |
312617599 | from django.contrib.auth.models import User, Group
# from .models import Profile, Task, Project
from .models import *
from rest_framework import viewsets, permissions, generics
from rest_framework.response import Response
from rest_framework import status
from knox.models import AuthToken
from .serializers import *
fro... | null | uspl/api.py | api.py | py | 58,012 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "rest_framework.generics.RetrieveAPIView",
"line_number": 56,
"usage_type": "attribute"
},
{
"api_name": "rest_framework.generics",
"line_number": 56,
"usage_type": "name"
},
{
"api_name": "rest_framework.decorators.permission_classes",
"line_number": 57,
"u... |
222023807 | from . import api
from flask import request, jsonify, render_template
from ..exceptions import ValidationError
def forbidden(message):
response = jsonify({ 'error': 'forbidden', 'message': message })
response.status_code = 403
return response
def unauthorized(message):
response = jsonify({ 'error': 'unautho... | null | app/api/errors.py | errors.py | py | 926 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "flask.jsonify",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "flask.jsonify",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "flask.jsonify",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "flask.request.accept_mimetyp... |
80680700 | #!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
# Complete the freqQuery function below.
def freqQuery(queries):
arr = []
freq_check = Counter()
ff_check = Counter()
for x, y in queries:
if x == 1:
ff_check[freq_check[y]] -= ... | null | hackerrank/dict hashmaps/frequency-queries.py | frequency-queries.py | py | 923 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "collections.Counter",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "collections.Counter",
"line_number": 15,
"usage_type": "call"
}
] |
155437887 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This prog... | null | bin/rename_fasta.py | rename_fasta.py | py | 3,186 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "sys.argv",
"line_number": 35,
"usage_type": "attribute"
},
{
"api_name": "os.linesep.join",
"line_number": 48,
"usage_type": "call"
},
{
"api_name": "os.linesep",
... |
70906950 | from django.urls import path
from Topic.views import (
TopicDetailView,
TopicCreateAPIView,
TopicDetailAPIView,
TopicListAPIView,
)
app_name = 'topic'
urlpatterns = [
path('detail/<slug:slug>/', TopicDetailView.as_view(), name='detail'),
path('api/', TopicListAPIView.as_view(), name='api-list'... | null | Topic/urls.py | urls.py | py | 482 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.urls.path",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "Topic.views.TopicDetailView.as_view",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "Topic.views.TopicDetailView",
"line_number": 12,
"usage_type": "name"
},
{
"... |
509400381 | #!/usr/bin/env python 3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
#
"""
acc 指标
Authors: panxu(panxu@baidu.com)
Date: 2020/05/30 07:36:00
"""
from typing import Dict
import torch
from .metric import Metric
class AccMetric(Metric):
"""
Acc Metric
"""
ACC ... | null | easytext/metrics/acc_metric.py | acc_metric.py | py | 1,632 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "metric.Metric",
"line_number": 20,
"usage_type": "name"
},
{
"api_name": "torch.Tensor",
"line_number": 33,
"usage_type": "attribute"
},
{
"api_name": "torch.Tensor",
"line_number": 34,
"usage_type": "attribute"
},
{
"api_name": "torch.LongTensor",
... |
460897227 | import bs4
import re
import unicodedata
def strip_accents(text):
try:
text = unicode(text, 'utf-8')
except NameError: # unicode is a default on python 3
pass
text = unicodedata.normalize('NFD', text)
text = text.encode('ascii', 'ignore')
text ... | null | sentiment_model_git/tweet_cleanerV2.py | tweet_cleanerV2.py | py | 5,513 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "unicodedata.normalize",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_num... |
454282862 | import copy
import random
import argparse
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from mergedeep import Strategy, merge
from typeguard import typechecked
import model.metric as module_metric
from trainer import verbose
from utils.util import update_src_web_video_dir
from parse_con... | null | fusion.py | fusion.py | py | 5,935 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "numpy.ndarray",
"line_number": 19,
"usage_type": "attribute"
},
{
"api_name": "numpy.bool",
"line_number": 40,
"usage_type": "attribute"
},
{
"api_name": "numpy.argsort",
"line_number": 41,
"usage_type": "call"
},
{
"api_name": "typeguard.typechecke... |
325758489 | import os
import logging
import threading
import atexit
import time
import sqlite3
from operator import itemgetter
import api
import veriflame
import queenbee
from twilio import rest
from tornado import web, ioloop, httpserver
working = os.path.expanduser('~/.queenbee')
database = os.path.join(working, 'queenbee.db... | null | app/__init__.py | __init__.py | py | 6,504 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.expanduser",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 17,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_numb... |
105977929 | from pyramid.config import Configurator
from pyramid.session import SignedCookieSessionFactory
from sqlalchemy import engine_from_config
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from .security import DefaultRoot
import os
from .models impor... | null | learning_journal/__init__.py | __init__.py | py | 1,734 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sqlalchemy.engine_from_config",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.orm.sessionmaker",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "os.environ",
"line_number": 24,
"usage_type": "attribute"
},
{
"api_nam... |
525826862 | from django.shortcuts import render
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import TemplateView,View
from personal_info.models import ContactInfo
from education.models import EducationInfo
from experience.models import Experience
from project.models import Project,Certificati... | null | Resume_Project/resume/review/views.py | views.py | py | 4,843 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.contrib.auth.mixins.LoginRequiredMixin",
"line_number": 32,
"usage_type": "name"
},
{
"api_name": "django.views.generic.TemplateView",
"line_number": 32,
"usage_type": "name"
},
{
"api_name": "personal_info.models.ContactInfo.objects.filter",
"line_numbe... |
287230164 | import fiona
from tqdm import tqdm
from utils.utils import get_key_recursive
def is_valid_geom(geom):
"""
Checks to see if geometry is a valid GeoJSON geometry type or
GeometryCollection. For example, helps detect features with area of 0.
Geometries must be non-empty, and have at least x, y coordina... | null | utils/verifications.py | verifications.py | py | 4,404 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "fiona.open",
"line_number": 112,
"usage_type": "call"
},
{
"api_name": "tqdm.tqdm",
"line_number": 113,
"usage_type": "call"
},
{
"api_name": "utils.utils.get_key_recursive",
"line_number": 114,
"usage_type": "call"
}
] |
136820249 | from subprocess import getoutput
from PyQt5 import QtWidgets
from utils.logger import Logger
class GitApplication(QtWidgets.QWidget, Logger):
def __init__(self):
super().__init__()
def check_update(self):
self.log("I check for updates.")
getoutput("git fetch")
git_msg = get... | null | connection_manager/graphics/git_app.py | git_app.py | py | 1,443 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "PyQt5.QtWidgets.QWidget",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "PyQt5.QtWidgets",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "utils.logger.Logger",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "subproc... |
206337782 | import sys
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
from mdp import MDP
class POMDP(MDP):
def __init__(self, actions, transitions=None, observations=None, rewards=None, states=None, gamma=0.95):
if not (0 < gamma <= 1):
raise ValueError('A POMDP must have 0 < gamm... | null | Machine Learning/Aima/pomdp2.py | pomdp2.py | py | 4,707 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "mdp.MDP",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "collections.defaultdict",
"line_number": 77,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 97,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_nu... |
160696038 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 5 20:59:18 2020
@author: Odegov Ilya
"""
import os
import sys
current_dir = os.path.dirname(os.path.realpath(__file__))
parent_dir = os.path.dirname(current_dir)
if parent_dir not in sys.path:
sys.path.append(parent_dir)
from time import time... | null | gpt/gptrun.py | gptrun.py | py | 1,880 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.dirname",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "os.path.realpath",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "os.path.dirname",
"... |
176238318 | from django.shortcuts import render
from django.http import HttpResponse
from .models import Table1
import re
from collections import defaultdict
from django.db.models import Count
import json
import datetime
# Create your views here.
# 取出全部数据
shorts = Table1.objects.all()
# 构造正则,将太长的标题给剪断
def split(name):
p = r... | null | work/myDjango/index/views.py | views.py | py | 2,670 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "models.Table1.objects.all",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "models.Table1.objects",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "models.Table1",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "re... |
429658327 | """asynchronous URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... | null | asynchronous/urls.py | urls.py | py | 1,472 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.contrib.auth.models.User.objects.last",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "django.contrib.auth.models.User.objects",
"line_number": 28,
"usage_type": "attribute"
},
{
"api_name": "django.contrib.auth.models.User",
"line_number": 28... |
468406173 | from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import numpy as np
from PIL import Image
from matplotlib import cm
import imageio
import os
class ImageDisplay(QLabel):
""" Displays an image as a QLabel
Drawing is realized such that the aspect-ratio is kept ... | null | viewer_tool/tensor_viewer/imagedisplay.py | imagedisplay.py | py | 6,172 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "numpy.ndarray",
"line_number": 98,
"usage_type": "call"
},
{
"api_name": "numpy.byte",
"line_number": 98,
"usage_type": "attribute"
},
{
"api_name": "numpy.min",
"line_number": 112,
"usage_type": "call"
},
{
"api_name": "numpy.max",
"line_number... |
624197663 | # -*- coding: utf-8 -*-
# Migration script for existing rpm units to include repodata
#
# Copyright © 2010-2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later ... | null | pulp_rpm/src/pulp_rpm/migrations/0002_rpm_unit_repodata.py | 0002_rpm_unit_repodata.py | py | 1,567 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "logging.getLogger",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "pulp.server.managers.content.query.ContentQueryManager",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "pulp_rpm.yum_plugin.metadata.get_package_xml",
"line_number": 31,
... |
227006389 | import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def l2norm(t):
return F.normalize(t, p = 2, dim = -1)
def ema_inplace(moving_avg, new, decay):
... | null | notebooks/vector_quantize_pytorch.py | vector_quantize_pytorch.py | py | 9,830 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "torch.nn.functional.normalize",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "torch.nn.functional",
"line_number": 13,
"usage_type": "name"
},
{
"api_name": "torch.randperm",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "torc... |
587891487 | import cv2
import os
import numpy as np
# prepare a list of files in a directory
file_list = os.listdir()
# counter to assign file name
num = 1
# loop to finally modify our positive images
if not os.path.exists('pos'):
os.makedirs('pos')
for file in file_list:
if file.endswith('.jpg'):
img = ... | null | Vortex/model/image_extraction/img_extract_pos.py | img_extract_pos.py | py | 568 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.listdir",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "os.path.exists",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "os.makedirs",
"line_number"... |
479757533 | import tweepy
import random
consumer_key = 'consumerkey'
consumer_secret = 'consumer_secret'
access_token = 'access_token'
access_token_secret = 'access_token_secret'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
auth.secure = True
api = tweepy.API... | null | EncouragingTweets/helper.py | helper.py | py | 1,184 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "tweepy.OAuthHandler",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "tweepy.API",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "random.choice",
"line_number": 26,
"usage_type": "call"
}
] |
487350949 | # Copyright 2018 The Rlgraph Authors, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | null | rlgraph/components/policies/dueling_policy.py | dueling_policy.py | py | 14,489 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "rlgraph.get_backend",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "rlgraph.get_backend",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "rlgraph.components.policies.policy.Policy",
"line_number": 36,
"usage_type": "name"
},
{
... |
574348615 | from tensorflow.keras.applications.vgg19 import VGG19
from tensorflow.keras.applications.vgg19 import preprocess_input
from tensorflow.keras.applications.vgg19 import decode_predictions
from PIL import Image
import numpy as np
from tensorflow.keras import backend as K
import tensorflow as tf
import time
import pickle
f... | null | texture-synthesis/actual-texture.py | actual-texture.py | py | 15,201 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "tensorflow.keras.applications.vgg19.VGG19",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "PIL.Image.open",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "PIL.Image",
"line_number": 30,
"usage_type": "name"
},
{
"api_name": "PI... |
277010053 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
from ftocp import FTOCP
from map import MAP
import pdb
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
# plt.rc('font', size=12)
# ==============================================================================================
# Ini... | null | Ex1_RegulationProblem/main.py | main.py | py | 2,634 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "matplotlib.pyplot.rc",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "matplotlib.pyplot.rc",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "matplotlib.p... |
651801884 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#1
col_names=['CENA', 'LICZBA_POKOI','METRAZ','liczba','ADRES','OPIS']
df = pd.read_csv("./train.tsv", sep="\t", names=col_names)
SredniaCena = df.loc[:,"CENA"].mean().round(0)
SredniaCenaDF = pd.DataFrame(data=[SredniaCena])
SredniaCenaDF.to_csv('o... | null | zestaw1.py | zestaw1.py | py | 2,262 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "pandas.DataFrame",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "pandas.DataFrame.from_records",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "pandas.D... |
249820262 | import smtplib
import sys
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email import encoders
def SendMail(to_name, to_addr, attachment_file_path):
fromaddr = "<from your email id>"
toaddr = to_addr
msg = MIMEMultipart()
msg['From'... | null | send_mail_gmail_smtp.py | send_mail_gmail_smtp.py | py | 1,121 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "email.MIMEMultipart.MIMEMultipart",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "email.MIMEText.MIMEText",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "email.MIMEBase.MIMEBase",
"line_number": 27,
"usage_type": "call"
},
{
... |
260491172 | from collections import namedtuple
import torch.nn.functional as F
from gym import spaces
from gym.spaces import Box, Discrete
import torch
import torch.nn as nn
from ppo.control_flow.multi_step.env import Obs, subtasks, Env
from ppo.control_flow.lines import Subtask
from ppo.control_flow.recurrence import get_obs_se... | null | ppo/agent.py | agent.py | py | 13,192 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "collections.namedtuple",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "torch.nn.Module",
"line_number": 21,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 21,
"usage_type": "name"
},
{
"api_name": "gym.spaces.Discr... |
310985253 | #!/usr/bin/env python3
# @Time : 4/6/20 9:34 AM
# @Author : fangcheng.ji
# @FileName: evaluation.py
import contextlib
import copy
import io
import itertools
import json
import logging
import numpy as np
import os
from collections import OrderedDict
import torch
from fvcore.common.file_io import PathManager
from py... | null | projects/Alleria/alleria/evaluation.py | evaluation.py | py | 25,027 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "detectron2.evaluation.evaluator.DatasetEvaluator",
"line_number": 34,
"usage_type": "name"
},
{
"api_name": "torch.device",
"line_number": 66,
"usage_type": "call"
},
{
"api_name": "logging.getLogger",
"line_number": 67,
"usage_type": "call"
},
{
"a... |
48910949 | import csv
import matplotlib.pyplot as plt
import datetime
import itertools
import numpy as np
FILENAME = "nfcapd.csv"
def tarific2():
who = '217.15.20.194' #input('Ведите IP абонента - ')
cost = 0.5 #(float)(input('Какой у него тариф? - '))
rawData = []
x = []
y = []
res = 0... | null | lab123/lab2.py | lab2.py | py | 1,362 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "csv.reader",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "numpy.array",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.plot",
"line_number": 48,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
... |
311395146 | import os.path
from sys import platform
import threading
from FolderStatistic.IFolder import Folder
from FolderStatistic import TreeList
from enum import Enum
class Status(Enum):
Waiting = 0
Connected = 1
Running = 2
Paused = 3
Finished = 4
def __str__(self):
if self.val... | null | Verzeichnisstatistik_V2/FolderStatistic/FolderStats.py | FolderStats.py | py | 4,213 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "enum.Enum",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "threading.Thread",
"line_number": 31,
"usage_type": "attribute"
},
{
"api_name": "threading.Thread.__init__",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "threading.Th... |
273720969 | #!/usr/bin/python
import sys
import argparse
import re
import cPickle as pickle
from bisect import bisect_left as bis
parser = argparse.ArgumentParser(description="Build a taxonomy tree in cPickle files")
parser.add_argument("input", type=str, help="File with the genomes")
parser.add_argument("-t","--tree", type=str,... | null | build_taxonomy.py | build_taxonomy.py | py | 3,981 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "sys.stderr.write",
"line_number": 47,
"usage_type": "call"
},
{
"api_name": "sys.stderr",
"line_number": 47,
"usage_type": "attribute"
},
{
"api_name": "cPickle.load"... |
166600514 | from flask import Flask
from flask import render_template, request, redirect, url_for, flash
import zBazy
app = Flask(__name__)
app.config.update(dict(SECRET_KEY = "haslo"))
PYTANIA = zBazy.baza()
@app.route('/', methods=["GET","POST"])
def index():
if request.method == "POST":
punktacja = 0
od... | null | web.py | web.py | py | 694 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "flask.Flask",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "zBazy.baza",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "flask.request.method",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "flask.request",
"l... |
95793345 |
from flask import Flask, render_template, request, make_response, jsonify
import numpy as np
import pandas as pd
import joblib
import spacy
from tensorflow.keras.models import Sequential, load_model
from tensorflow.keras.layers import Dense
from tensorflow.keras import Input
from tensorflow.keras.losses import sparse... | null | medcabinet/app.py | app.py | py | 1,776 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "tensorflow.keras.models.load_model",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "spacy.load",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "flask.F... |
22617871 | from flask import Flask #引入flask模块
import requests
app = Flask(__name__) # 命名以个模块名
@app.route("/") # 这个表示当路由路径后面参数是括号里面的时候,就会执行下的自定函数;
def hello(): #没有参数相当于空函数,可以直接返回值;不需要其他条件;
return "Hello World!!!!!!!!!!!" #当路由路径正确时候,就会直接执行这个函数,这个函数只有返回值;
@app.route('/hello') #/hello/后面的参数被... | null | 测试.py | 测试.py | py | 822 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "flask.Flask",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "requests.post",
"line_number": 13,
"usage_type": "call"
}
] |
351209586 | from collections import OrderedDict
from koparadigm.rules import *
class Paradigm(object):
def __init__(self):
self.verb2labels = verb2labels()
self.verb_label2rules = verb_label2rules()
self.label2endings = label2endings()
def __call__(self, verb):
if verb in sel... | null | koparadigm/koparadigm.py | koparadigm.py | py | 1,471 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "collections.OrderedDict",
"line_number": 28,
"usage_type": "call"
}
] |
569014387 | #!/usr/bin/python3
""" Base class """
import uuid
import datetime
import models
import copy
class BaseModel:
""" BaseModel class"""
def __init__(self, *args, **kwargs):
if kwargs:
for key, value in kwargs.items():
if key != "__class__":
if key == "create... | null | models/base_model.py | base_model.py | py | 1,432 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "datetime.datetime.strptime",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "datetime.datetime",
"line_number": 17,
"usage_type": "attribute"
},
{
"api_name": "datetime.timedelta",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "... |
16786910 | from django.db import models
from django.template.defaultfilters import slugify
from django.conf import settings
from ckeditor_uploader.fields import RichTextUploadingField
from django.utils.translation import ugettext as _
import re
from klb.models import Klb
# Create your models here.
class Chapter(models.Model):
... | null | chapter/models.py | models.py | py | 2,601 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.db.models.Model",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "django.db.models",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "klb.models",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "django.db.mod... |
263705129 | import pandas as pd
import os.path
import glob
import os
import time
import json
from datetime import datetime
def main():
# Create 1 row dataframe for each mission
list1 = glob.glob('*_battery_status_*.csv')
list2 = glob.glob('*_vehicle_land_detected_*.csv')
list3 = glob.glob('*_vehicle_status_0.csv')... | null | data_organize.py | data_organize.py | py | 5,332 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "glob.glob",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "glob.glob",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "glob.glob",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 14... |
74632460 | import json
import requests
url = "https://api.flock.com/hooks/sendMessage/143e0be4-159b-4cd7-bff7-482b6aa1aefb"
headers = {'Content-Type' : 'applpicaton/json'}
payload={"text": "Test-Kibana-webhooks"}
with open("/home/chirag.da/django-app/snap.txt", 'rw') as f:
data = f.readlines()[-1].split(' ')
#lines = s... | null | snap.py | snap.py | py | 622 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "requests.post",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "json.dumps",
"line_number": 16,
"usage_type": "call"
}
] |
491316332 | import argparse
errors = {}
okays = {'BS_RESULT_OK': 'everything is fine'}
warnings = {}
def ok(name, desc):
okays['BS_RESULT_OK_' + name] = desc
def w(name, desc):
warnings['BS_RESULT_WARNING_' + name] = desc
def e(name, desc):
errors['BS_RESULT_ERROR_' + name] = desc
# keep alphabetical
e('BAD_M... | null | src/result_gen.py | result_gen.py | py | 2,955 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 41,
"usage_type": "call"
}
] |
333636668 | import matplotlib
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
font = {'family' : 'Calibri Light',
'weight' : 'bold',
'size' : 12}
matplotlib.rc('font', **font)
# import mpld3
# mpld3.enable_notebook()
sns.set_style('white')
df = pd.read_csv('Predi... | null | Bikes-Weather/box_plot.py | box_plot.py | py | 1,483 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "matplotlib.rc",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "seaborn.set_style",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.sub... |
322939204 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 9 11:39:21 2018
@author: Jacob
script used to open the LIDAR shutter at specified times or SZAs of day
THANKS to cmoriarty who commented on the issue on github (https://github.com/qpit/thorlabs_apt/issues/3)
You will need to install ftd2xx and pyephem if you haven't al... | null | sza_shutter.py | sza_shutter.py | py | 13,672 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "email_lidar.Email",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "datetime.datetime.now",
"line_number": 55,
"usage_type": "call"
},
{
"api_name": "datetime.datetime",
"line_number": 55,
"usage_type": "attribute"
},
{
"api_name": "dateti... |
573809991 | #!/usr/bin/env python3
import json
import base64
import struct
import matplotlib.pyplot as plt
f = open('voltage_wave.txt', 'r')
l = []
n = []
for line in f.readlines():
if(len(line) > 0 and line[0] == 'd'):
data = json.loads(line[6:])
data = data['data'].encode('ascii')
decoded = base64... | null | firmware/plugwatch_G/particle_voltage_test/wave_processor.py | wave_processor.py | py | 668 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "json.loads",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "base64.b64decode",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "struct.unpack",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.plot",
... |
476211970 | '''
Copyright 2015 define().
This file is part of dsgnutils.
dsgnutils is free software: you can redistribute it and/or modify it under the
terms of the Lesser GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
dsgnutils is... | null | pypi_install_script/dsgnutils-0.0.9.tar/setup.py | setup.py | py | 1,711 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.join",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 26,
"usage_type": "attribute"
},
{
"api_name": "os.path.dirname",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "re.match",
"line_number... |
479704301 | """
============================
Author:柠檬班-木森
Time:2020/4/2 20:37
E-mail:3247119728@qq.com
Company:湖南零檬信息技术有限公司
============================
"""
import re
user = "python"
pwd = "lemonban"
name = "musen"
age = 18
# 使用字符串的方法进行替换(缺点,每次只能替换一个数据,效率太低)
# data = '{"user":#user#,"pwd":#pwd#,"name":"#name#","age":"#age#"}... | null | py27_api_test/01扩展学习的代码/08使用正则表达式高效的替换用例数据.py | 08使用正则表达式高效的替换用例数据.py | py | 1,276 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "re.search",
"line_number": 40,
"usage_type": "call"
},
{
"api_name": "common.handle_config.conf.get",
"line_number": 49,
"usage_type": "call"
},
{
"api_name": "common.handle_config.conf",
"line_number": 49,
"usage_type": "name"
}
] |
408597910 | import yaml
class YamlFormat:
"""
This class works with yaml file.
Class has 2 methods:
1. serialization
2. deserialization.
"""
@staticmethod
def serialization(file, data):
"""
This method dumps into yaml file.
:param file: object file.
:param data: da... | null | storage_yaml.py | storage_yaml.py | py | 692 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "yaml.dump",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "yaml.load",
"line_number": 32,
"usage_type": "call"
}
] |
335908598 | # -*- coding: utf-8 -*-
import cv2
import numpy as np
def alpha_blending(img1, img2, alpha=0.5):
out = img1 * alpha + img2 * (1-alpha)
return out.astype(np.uint8)
# Read image
img1 = cv2.imread("imori.jpg").astype(np.float32)
img2 = cv2.imread("thorino.jpg").astype(np.float32)
# Alpha blending
out = alpha... | null | Question_51_60/Alpha Blending.py | Alpha Blending.py | py | 503 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "numpy.uint8",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "cv2.imread",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "numpy.float32",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "cv2.imread",
"line_... |
132523214 |
import os
import glob
import functools
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
import sys
sys.path.append('/home/ubuntu/Projects/qunex_utils/qunex_utils')
from qunex import qunex
from utils_read import read_freesurfer, read_mask_stats, r... | null | qunex_utils/outliers.py | outliers.py | py | 8,605 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sys.path.append",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number... |
275462363 | from __future__ import absolute_import
from __future__ import unicode_literals
from pyhive.tests.sqlachemy_test_case import SqlAlchemyTestCase
from pyhive.tests.sqlachemy_test_case import with_engine_connection
from sqlalchemy.engine import create_engine
from sqlalchemy.schema import Column
from sqlalchemy.schema impor... | null | pyhive/tests/test_sqlalchemy_hive.py | test_sqlalchemy_hive.py | py | 2,861 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "datetime.datetime",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "decimal.Decimal",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "unittest.TestCase",
"line_number": 34,
"usage_type": "attribute"
},
{
"api_name": "pyhive.tests... |
230493621 | import paramiko
import re
import os
import time
import logging
host="134.111.87.198"
user="root"
pw="syseng"
#host_esx="192.168.61.56"
#host_esx_pw="syseng01"
port = 22
logging.basicConfig(level=logging.INFO)
my_files = "my_files"
vib_script="vib_copy.py"
aul_script="AUL.py"
AUL_Upgrade1="AUL_Upgrade12.py"
esx_post_... | null | ftESXAutomation/myExp.py | myExp.py | py | 11,974 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "logging.basicConfig",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "logging.INFO",
"line_number": 15,
"usage_type": "attribute"
},
{
"api_name": "paramiko.Transport",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "paramiko.SFT... |
574865896 | import json
from instances.management.commands.base_load_class import BaseLoadCommand
from instances.models import Observation
class Command(BaseLoadCommand):
MODEL_CLASS = Observation
FINAL_MESSAGE = 'loaded {} observations - elapsed time {}'
def _process_object(self, line):
json_object = json.l... | null | instances/management/commands/load_observation.py | load_observation.py | py | 2,706 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "instances.management.commands.base_load_class.BaseLoadCommand",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "instances.models.Observation",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "json.loads",
"line_number": 11,
"usage_type": "c... |
172946966 |
from .import views
from django.conf.urls import url
urlpatterns = [
url(r'^addCar/$', views.addCar, name='addCar'),
url(r'^carorder/$', views.carorder, name='carorder'),
url(r'^updatelist/$', views.updatelist, name='updatelist'),
url(r'^myorder/$', views.myorder, name='myorder'),
... | null | iceberg/cars/urls.py | urls.py | py | 385 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.conf.urls.url",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "django.conf.urls.url",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "django.conf.urls.url",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "django.co... |
225045146 | import json
import os
import htmlPy
import config
import utils.helpers as helpers
import utils.defaults as defaults
from ui.utils import Dialog, FileDialog
from ui.MainHandler import MainHandler
from core.middleware.launch_handler import (
save_setup_data, is_first_time_launch, is_valid_admin_details)
class Lau... | null | silos/ui/LaunchHandler.py | LaunchHandler.py | py | 5,724 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "htmlPy.Object",
"line_number": 15,
"usage_type": "attribute"
},
{
"api_name": "ui.MainHandler.MainHandler",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "core.middleware.launch_handler.is_first_time_launch",
"line_number": 26,
"usage_type": "cal... |
97322919 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 24 15:30:53 2019
@author: stuartedris
"""
#%%
#####################################
### Import some libraries ###########
#####################################
import sys, os, warnings
import numpy as np
from datetime import datetime
#%%
# Mai... | null | Scripts/Data_Collection/write_FH.py | write_FH.py | py | 3,315 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sys.argv",
"line_number": 26,
"usage_type": "attribute"
},
{
"api_name": "sys.argv",
"line_number": 27,
"usage_type": "attribute"
},
{
"api_name": "numpy.loadtxt",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "datetime.datetime",
"li... |
501130371 | import discord
client = discord.Client()
import sys,os,json,random
from datetime import datetime, timedelta
import getweather
t = datetime.now
from discord.ext import commands
bot = commands.Bot(command_prefix=">")
async def vcfunc(audioname, msg, vc): #音声流すだけ
#print(t().strftime("[ %H:%M:%S ] "),"start audio f... | null | textfunc.py | textfunc.py | py | 13,968 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "discord.Client",
"line_number": 2,
"usage_type": "call"
},
{
"api_name": "datetime.datetime.now",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "datetime.datetime",
"line_number": 7,
"usage_type": "name"
},
{
"api_name": "discord.ext.... |
634533183 | from __future__ import annotations
import logging
import os
import json
import itertools
from concurrent import futures
from io import StringIO
from typing import Any, TYPE_CHECKING
from collections import defaultdict
import dpath
from igraph import Graph
try:
from networkx import DiGraph, node_link_data
except ... | null | checkov/common/bridgecrew/wrapper.py | wrapper.py | py | 7,646 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "logging.info",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "networkx.DiGraph",
"line_number": 19,
"usage_type": "name"
},
{
"api_name": "networkx.node_link_data",
"line_number": 20,
"usage_type": "name"
},
{
"api_name": "typing.TYPE_CHE... |
227549742 | # Copyright (C) 2021 hohay
# License: MIT
from PIL import Image
import os.path
import numpy as np
data_path = "C:\\thesis\\ndataset\\src\\"
data_out_path = "C:\\thesis\\ndataset\\ctrain\\"
data_dirs = os.listdir(data_path)
Image.MAX_IMAGE_PIXELS = 120560400
OX = 5000# 2500 # Train: 0
OY = 5000#1250 # ... | null | splitimage.py | splitimage.py | py | 1,132 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.listdir",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "PIL.Image.MAX_IMAGE_PIXELS",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "PIL.Image",
... |
549746198 | from iofog.microservices.client import Client
from iofog.microservices.exception import IoFogException
from iofog.microservices.iomessage import IoMessage
from iofog.microservices.listener import *
import threading
import os
import shutil
from apscheduler.schedulers.blocking import BlockingScheduler
lock = threading.... | null | python-test-v2/watchdog/index.py | index.py | py | 1,881 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "threading.Lock",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "iofog.microservices.client.Client",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "iofog.microservices.exception.IoFogException",
"line_number": 18,
"usage_type": "name"
... |
146161797 | from typing import List
from fastapi import APIRouter, Depends
from fastapi.responses import JSONResponse
from sqlalchemy.orm import Session
from api.utils import get_db
from crud import store_crud
from schemas import Store, StoreCreate, StoreUpdate
router = APIRouter()
@router.get("/", response_model=List[Store])... | null | backend/api/v1/routers/stores_router.py | stores_router.py | py | 1,417 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "fastapi.APIRouter",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.orm.Session",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "fastapi.Depends",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "api.utils.ge... |
251676281 | import os
from collections import OrderedDict
class PathOfFiles(object):
def __init__(self, pre_fix_path):
self._prefix_path = os.path.abspath(pre_fix_path) + "/"
self._abs_path_of_files_list = None
self._symlink_dict = OrderedDict()
self.get_path_of_files()
@property
def ... | null | path_of_files.py | path_of_files.py | py | 2,094 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.abspath",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "collections.OrderedDict",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "os.chdir",
"lin... |
149647350 | #coding: utf-8
import simplejson as json
from apps.utils import ajax
from apps.common import com_user
from apps.math import common as math_com
import common
from libs.models.math.models import SXTextBookCatalog, SXTextBookCatalogRelateKnowledge, \
SXKnowledge, SXAskRelateKnowledge
from libs.models.activity.yuke.mod... | null | apps/active/yuke/view.py | view.py | py | 10,126 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "common.get_book",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "apps.utils.ajax.ajax_fail",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "apps.utils.ajax",
"line_number": 23,
"usage_type": "name"
},
{
"api_name": "common.get_... |
127980579 | # coding: utf-8
import pandas as pd
import numpy as np
import warnings
warnings.filterwarnings('ignore')
import matplotlib.pyplot as plt
import seaborn as sns
import os
import time
import gc
import datetime
import xgboost as xgb
from sklearn.model_selection import train_test_split
from sklearn.externals import joblib
f... | null | DC_Code/baseline.py | baseline.py | py | 25,011 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "warnings.filterwarnings",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "pandas.read_cs... |
64913733 | from flask import Flask
import logging
import json
import os
import requests
from flask_mqtt import Mqtt
from time import sleep
app = Flask(__name__)
while True:
device_ip=os.environ.get('MASTER_IP')
if device_ip is not None:
app.config['MQTT_CLIENT_ID'] = device_ip
app.config['MQTT_CLEAN_SES... | null | balluff_master_connector/code/app.py | app.py | py | 1,575 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "flask.Flask",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "os.environ.get",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "os.environ",
"line_number": 13,
"usage_type": "attribute"
},
{
"api_name": "flask_mqtt.Mqtt",
"lin... |
442815361 | import spotipy
from spotipy.oauth2 import SpotifyOAuth
from flask import Flask, render_template
from flask_session import Session
from colour import Color
import sqlite3
import datetime
# load the client keys from a file
secrets = open("keys.txt", "r")
CLIENT_ID = secrets.readline().strip()
CLIENT_SECRET = secrets.rea... | null | app.py | app.py | py | 4,120 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "spotipy.Spotify",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "spotipy.oauth2.SpotifyOAuth",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "colour.Color",
"line_number": 54,
"usage_type": "call"
},
{
"api_name": "flask.Flask"... |
59414087 | import os
import zipfile
import matplotlib.pyplot as plt
import time
import datetime
from collections import defaultdict
import tensorflow as tf
from sklearn.cross_validation import train_test_split
import numpy as np
# Step 1: Load the data.
# Read the data into a list of strings.
def read_data():
pos_file = op... | null | Cite-O-Smear.py | Cite-O-Smear.py | py | 17,133 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "collections.defaultdict",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "collections.defaultdict",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "collections.defaultdict",
"line_number": 31,
"usage_type": "call"
},
{
"api_name"... |
37421709 | # -*- coding: utf-8 -*-
"""Utility to convert images to MONO_HMSB format."""
from PIL import Image
from os import path
import sys
def error(msg):
"""Display error and exit."""
print (msg)
sys.exit(-1)
def set_bit(value, index, high=True):
"""Set the index:th bit of value.
Args:
value (... | null | python/upesp32/oled1309/utils/img2monoHMSB.py | img2monoHMSB.py | py | 1,612 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sys.exit",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "sys.argv",
"line_number": 50,
"usage_type": "attribute"
},
{
"api_name": "os.path.exists",
"line_number": 54,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 54... |
599174767 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 06 08:22:55 2017
@author: C.L. Hoyt
"""
""" This script spits out the response function for a Rogowski coil."""
import numpy as np
import matplotlib.pylab as plt
from scipy.constants import inch
plt.close('all')
# constants
eps0 = 8.854e-12
mu0 = 4.0*np.p... | null | rogo_analysis.py | rogo_analysis.py | py | 3,203 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "matplotlib.pylab.close",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "matplotlib.pylab",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "numpy.pi",
"line_number": 16,
"usage_type": "attribute"
},
{
"api_name": "scipy.constants... |
3791216 | import numpy as np
from matplotlib import pyplot as plt
from datasets import dataset_1
from gradient_descent import gradient_descent
from linear_cost import linear_cost
from linear_cost_derivate import linear_cost_derivate
# Training data
(X, y) = dataset_1
m, n = X.shape
#print(X.shape)
#print(y.shape)
theta_0 = np.... | null | gradientDecent/linreg/minimize_test.py | minimize_test.py | py | 1,044 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "datasets.dataset_1",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "numpy.random.rand",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "numpy.random",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "gradient_desce... |
520280767 | from pymongo import MongoClient
from ConfigParser import RawConfigParser
from django.conf import settings
DB_CONFIG_FILE = open(settings.DB_CONFIG_FILE)
config = RawConfigParser()
config.readfp(DB_CONFIG_FILE)
HOST = config.get("credentials", "HOST")
PORT = int(config.get("credentials", "PORT"))
client = MongoClient(H... | null | manager/db/db_manager.py | db_manager.py | py | 356 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.conf.settings.DB_CONFIG_FILE",
"line_number": 5,
"usage_type": "attribute"
},
{
"api_name": "django.conf.settings",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "ConfigParser.RawConfigParser",
"line_number": 6,
"usage_type": "call"
},
... |
489477349 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020 xaj
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | null | create_snapshot.py | create_snapshot.py | py | 2,081 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.getenv",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "requests.get",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "requests.get",
"line_number": 41,
"usage_type": "call"
},
{
"api_name": "requests.post",
"line_number"... |
414740289 | #%%
import pandas as pd
import numpy as np
# from sklearn.svm import SVC
from sklearn.metrics import classification_report
from sklearn import metrics
# from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
from sklearn.model_selection import GridSearchCV
from sklearn.linear_model import L... | null | Restaurant_3.py | Restaurant_3.py | py | 7,251 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "pandas.concat",
"... |
529729088 | import pickle
import config
import numpy as np
from functools import reduce
def flatten_reduce_lambda(matrix):
return list(reduce(lambda x, y: x + y, matrix, []))
tokens = pickle.load(open(config.TOKEN_DIC_OUTPUT, 'rb'))
allText = pickle.load(open(config.EMBEDDED_SENTENCES, 'rb'))
allText = flatten_reduce_lambda(... | null | LSTM/metamorphasis/model.py | model.py | py | 1,867 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "functools.reduce",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "pickle.load",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "config.TOKEN_DIC_OUTPUT",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "pickle.load",
... |
10742792 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
# Email: master@liwenzhou.com
from collections import Counter
import re
import atexit
import time
import math
def count_words(file, ignore_case=False):
words_dic = {}
with open(file, encoding="utf8") as f:
words = re.compile(r'[^a-zA-Z\s]')
f... | null | 0004/count_words_v2.py | count_words_v2.py | py | 1,297 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "re.compile",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "collections.Counter",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "time.time",
"line_number": ... |
537587488 | import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.model_selection import train_test_split
def label_map(label):
for i in range(label.shape[0]):
print(label[i])
if label[i]>=50 and label[i]<=60:
la... | null | model/model.py | model.py | py | 1,716 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "sklearn.preprocessing.LabelEncoder",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "sklearn.model_selection.train_test_split",
"line_number": 41,
"usage_type": "call"
}... |
617551318 | import pandas
import requests
import json
import googlemaps
GMAPS_API_KEY = '' # Preencha com a API Key gerada no Google.
gmaps = googlemaps.Client(key=GMAPS_API_KEY)
BASE_PATH = "" # Preencha esse valor com um caminho para gravar os arquivos xls.
YEAR = "2017"
MONTH = "05"
PATH = "{}/data/{}/".format(YEAR)
FILE = ... | null | _site/assets/ssp-analise.py | ssp-analise.py | py | 951 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "googlemaps.Client",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 19,
"usage_type": "call"
}
] |
509840281 | #-----------------------------------------------------------------------------------------------------------------
#Include libraries
#-----------------------------------------------------------------------------------------------------------------
import sys
import shutil
import subprocess
import os
import random
impo... | null | MakeTileLayout.py | MakeTileLayout.py | py | 25,030 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sys.path.append",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 19,
"usage_type": "attribute"
},
{
"api_name": "sys.path.append",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_nu... |
153037697 | import time
import logging
import threading
from dynamo.dataformat import Site
from dynamo.source.siteinfo import SiteInfoSource
from dynamo.utils.interface.phedex import PhEDEx
from dynamo.utils.interface.ssb import SiteStatusBoard
LOG = logging.getLogger(__name__)
def lfn_to_pfn(lfn, protocol, xml):
if type(xm... | null | lib/source/impl/phedexsiteinfo.py | phedexsiteinfo.py | py | 4,980 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "logging.getLogger",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "dynamo.source.siteinfo.SiteInfoSource",
"line_number": 47,
"usage_type": "name"
},
{
"api_name": "dynamo.source.siteinfo.SiteInfoSource.__init__",
"line_number": 51,
"usage_type":... |
439317739 | from __future__ import print_function, division, unicode_literals, absolute_import
import os
import re
import fnmatch
from itertools import cycle, chain
from collections import defaultdict
import numpy as np
from mpi4py import MPI
from .base import BaseValidationTest, TestResult
from .plotting import plt
from .paralle... | null | descqa/srv_ngals.py | srv_ngals.py | py | 11,433 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "mpi4py.MPI.COMM_WORLD",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "mpi4py.MPI",
"line_number": 14,
"usage_type": "name"
},
{
"api_name": "base.BaseValidationTest",
"line_number": 22,
"usage_type": "name"
},
{
"api_name": "os.path... |
27532822 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import tempfile
import base64
import logging
import unittest
import mock
from oneid import service, session, keychain, utils
# TODO: this is starting to look like a fixture
from .test_session import TestSession, mock_request
logger = logging.getLogger... | null | tests/test_service.py | test_service.py | py | 10,463 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "logging.getLogger",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "unittest.TestCase",
"line_number": 19,
"usage_type": "attribute"
},
{
"api_name": "oneid.keychain.Keypair.from_secret_pem",
"line_number": 21,
"usage_type": "call"
},
{
"a... |
647217004 | from flask import Flask, Blueprint, session, jsonify
from pylync import db, app
import datetime
from pylync import db
from pylync.users.models import User
class Entity(db.Model):
__table_args__ = {"useexisting": True}
__tablename__ = 'entity'
id = db.Column(db.Integer, primary_key=True)
name = db.Colu... | null | pylync/entities/models.py | models.py | py | 2,479 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pylync.db.Model",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "pylync.db",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "pylync.db.Column",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "pylync.db",
"line_n... |
637450741 | import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.optimizers import Adam
from players.d3q.network import DuelingDeepQNetwork
from utils.replay_buffer import ReplayBuffer
class Agent():
def __init__(self, lr, gamma, n_actions, epsilon, batch_size, input_dims, coldstart... | null | players/d3q/agent.py | agent.py | py | 5,349 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "utils.replay_buffer.ReplayBuffer",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "players.d3q.network.DuelingDeepQNetwork",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "players.d3q.network.DuelingDeepQNetwork",
"line_number": 27,
"us... |
212678947 | #!/usr/bin/env python3
import argparse
from collections import Counter
import itertools
import sys
from nlmaps_tools.answer_mrl import canonicalize_nwr_features
from nlmaps_tools.parse_mrl import MrlGrammar
def get_tags_in_nwr(nwr, exclude=tuple()):
nwr = canonicalize_nwr_features(nwr)
tags = []
for fea... | null | bin/make_nwr_name_stats.py | make_nwr_name_stats.py | py | 2,167 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "nlmaps_tools.answer_mrl.canonicalize_nwr_features",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "itertools.chain.from_iterable",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "itertools.chain",
"line_number": 30,
"usage_type": "attri... |
131501431 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | null | yes/google-cloud-sdk/.install/.backup/lib/tools/regen_apis/regen.py | regen.py | py | 4,601 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "apitools.gen.gen_client.__file__",
"line_number": 33,
"usage_type": "attribute"
},
{
"api_name": "apitools.gen.gen_client",
"line_number": 33,
"usage_type": "name"
},
{
"api_name": "os.path.join",
"line_number": 44,
"usage_type": "call"
},
{
"api_na... |
647531500 | # -*- coding: utf-8 -*-
from PIL import Image, ImageDraw
from itertools import cycle
import re
import math
class Info(object):
def __init__(self, title, mode, input):
self.word_count = 0
self.mode = mode
self.title = title
self.input = input
def get_mode(self):
return ... | null | squares/main.py | main.py | py | 9,203 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "re.sub",
"line_number": 44,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 49,
"usage_type": "call"
},
{
"api_name": "itertools.cycle",
"line_number": 107,
"usage_type": "call"
},
{
"api_name": "math.sqrt",
"line_number": 168,
... |
330372426 | # Examples of different ways to filter data
mylist = [1, 4, -5, 10, -7, 2, 3, -1]
# All positive values
pos = [n for n in mylist if n > 0]
print(pos)
# All negative values
neg = [n for n in mylist if n < 0]
print(neg)
# Negative values clipped to 0
neg_clip = [n if n > 0 else 0 for n in mylist]
print(neg_clip)
# P... | null | src/1/filtering_list_elements/example.py | example.py | py | 1,082 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "itertools.compress",
"line_number": 39,
"usage_type": "call"
}
] |
638780066 | #
# Chapter 6, example 2b
#
from sklearn import datasets
import numpy as np
import tensorflow as tf
import pylab as plt
import os
if not os.path.isdir('figures'):
print('creating the figures folder')
os.makedirs('figures')
no_iters = 1000
no_labels = 3
no_features = 4
no_exps = 25
no_folds = 3
seed = 10
t... | null | lec_examples/eg6.2b.py | eg6.2b.py | py | 3,425 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.isdir",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "os.makedirs",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "tensorflow.set_random_seed",
... |
246164346 | # import ROOT
from ROOT import gROOT
from ROOT import TFile as tf
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('Agg')
# import ML package
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.tensor import Tensor
import torch.... | null | WGAN_CGEM_Two_Dim_v1.py | WGAN_CGEM_Two_Dim_v1.py | py | 22,834 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "matplotlib.use",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "logging.getLogger",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "os.path.splitext",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.