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
56500142
from django.urls import path, include from .views import cart_update, cart, cart_delete, checkout_home, checkout_done urlpatterns = [ path('update/<slug:slug>/', cart_update, name='cart_update'), path('delete/<slug:slug>/', cart_delete, name='cart_delete'), path('checkout/', checkout_home, name='checkout')...
null
carts/urls.py
urls.py
py
420
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 5, "usage_type": "call" }, { "api_name": "views.cart_update", "line_number": 5, "usage_type": "argument" }, { "api_name": "django.urls.path", "line_number": 6, "usage_type": "call" }, { "api_name": "views.cart_delet...
353490385
""" Serializers for Django Rest Framework """ import re import json from dateutil import parser from collections import OrderedDict from rest_framework import serializers from django.core.exceptions import ValidationError from django.utils.translation import ugettext as _ from proctoring.models import (Exam, Archive...
null
proctoring/serializers.py
serializers.py
py
9,749
python
en
code
null
code-starcoder2
66
[ { "api_name": "rest_framework.serializers.ModelSerializer", "line_number": 20, "usage_type": "attribute" }, { "api_name": "rest_framework.serializers", "line_number": 20, "usage_type": "name" }, { "api_name": "rest_framework.serializers.ReadOnlyField", "line_number": 24, ...
160944659
# flake8: noqa """ Copyright 2020 - Present Okta, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
null
okta/models/theme.py
theme.py
py
6,683
python
en
code
null
code-starcoder2
66
[ { "api_name": "okta.okta_object.OktaObject", "line_number": 33, "usage_type": "name" }, { "api_name": "okta.models.email_template_touch_point_variant.EmailTemplateTouchPointVariant", "line_number": 50, "usage_type": "attribute" }, { "api_name": "okta.models.email_template_touch_p...
447445390
import cv2 import numpy as np import math import Main import random import Przedproces import WykrywanieZnakow import MozliwaTablica import MozliwyZnak # STALE GLOBALNE MODULU ############################# SZEROKOSC_WSPOLCZYNNIKA_WYPELNIENIA_TABLIC = 1.3 WYSOKOSC_WSPOLCZYNNIKA_WYPELNIENIA_TABLIC = 1.5 ###############...
null
WykrywanieTablic.py
WykrywanieTablic.py
py
8,640
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.zeros", "line_number": 23, "usage_type": "call" }, { "api_name": "numpy.uint8", "line_number": 23, "usage_type": "attribute" }, { "api_name": "numpy.zeros", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.uint8", "line_numb...
363890785
import xlwt,random,string file = xlwt.Workbook() # 注意这里的Workbook首字母是大写 table = file.add_sheet('sheet 1') # 新建一个sheet for _ in range(0,5000): table.write(_,0,_) # 写入数据table.write(行,列,value) table.write(_,1,''.join(random.sample(string.ascii_letters+string.digits, 8))) # 如果对一个单元格重复操作,会引发 # returns er...
null
addData.py
addData.py
py
632
python
en
code
null
code-starcoder2
66
[ { "api_name": "xlwt.Workbook", "line_number": 2, "usage_type": "call" }, { "api_name": "random.sample", "line_number": 7, "usage_type": "call" }, { "api_name": "string.ascii_letters", "line_number": 7, "usage_type": "attribute" }, { "api_name": "string.digits", ...
542573433
import logging import webapp2 from frameworks.WebContainer import StandardPage from google.appengine.ext.webapp import template from app.wrapper import url_inject import json from app.timesheet.TimeSheet import TimesheetEntry from app.Person import Person from admin.utils import KnownError import csv class TimeSheetHo...
null
src/timesheet_app.py
timesheet_app.py
py
4,088
python
en
code
null
code-starcoder2
66
[ { "api_name": "frameworks.WebContainer.StandardPage", "line_number": 12, "usage_type": "name" }, { "api_name": "google.appengine.ext.webapp.template.render", "line_number": 15, "usage_type": "call" }, { "api_name": "google.appengine.ext.webapp.template", "line_number": 15, ...
566830072
from sklearn.preprocessing import StandardScaler, MinMaxScaler, minmax_scale import numpy as np import pandas as pd stdscaler = StandardScaler() minmax_scaler = MinMaxScaler() """ 함수의 파라미터에 -1이 들어가면 특별한 의미를 갖는데, 다른 나머지 차원 크기를 맞추고 남은 크기를 해당 차원에 할당해 준다는 의미입니다 >> arr = np.zeros(64,64,3) # 64 * 64 size image with RGB chann...
null
DATE_18_7_11/Scikit_Learn/Scikit_Learn_Min_Max_Scaling.py
Scikit_Learn_Min_Max_Scaling.py
py
1,305
python
en
code
null
code-starcoder2
66
[ { "api_name": "sklearn.preprocessing.StandardScaler", "line_number": 4, "usage_type": "call" }, { "api_name": "sklearn.preprocessing.MinMaxScaler", "line_number": 5, "usage_type": "call" }, { "api_name": "numpy.arange", "line_number": 19, "usage_type": "call" }, { ...
219600785
# server.py - leader election server import logging import sys import gevent from gevent.pool import Pool import zerorpc class NullElection(object): def __init__(self, addr, config_file='config'): self.addr = addr self.up = [] self.servers = [] f = open(config_file, 'r') ...
null
bully_election_algorithm.py
bully_election_algorithm.py
py
7,538
python
en
code
null
code-starcoder2
66
[ { "api_name": "zerorpc.Client", "line_number": 33, "usage_type": "call" }, { "api_name": "logging.debug", "line_number": 54, "usage_type": "call" }, { "api_name": "logging.debug", "line_number": 61, "usage_type": "call" }, { "api_name": "logging.debug", "line_...
489780932
# importe as bibliotecas from suaBibSignal import * import numpy as np import sounddevice as sd import matplotlib.pyplot as plt from sklearn import preprocessing from scipy import signal import soundfile as sf import time data, samplerate = sf.read("rilrilril.wav") dados = [] for i in data: dados.append(i[0]) m...
null
Projeto 8/encode_versaoAlunos.py
encode_versaoAlunos.py
py
1,764
python
en
code
null
code-starcoder2
66
[ { "api_name": "soundfile.read", "line_number": 12, "usage_type": "call" }, { "api_name": "numpy.linspace", "line_number": 20, "usage_type": "call" }, { "api_name": "scipy.signal.kaiserord", "line_number": 39, "usage_type": "call" }, { "api_name": "scipy.signal", ...
400884471
from functools import reduce def normalize(name): return name.capitalize() # 测试: L1 = ['adam', 'LISA', 'barT'] L2 = list(map(normalize, L1)) print(L2) def prod(L): def fn(x, y): return x * y return reduce(fn, L) print('3 * 5 * 7 * 9 =', prod([3, 5, 7, 9])) CHAR_TO_FLOAT = { '0': 0, '1': ...
null
basic/Execrise.py
Execrise.py
py
1,614
python
en
code
null
code-starcoder2
66
[ { "api_name": "functools.reduce", "line_number": 14, "usage_type": "call" }, { "api_name": "functools.reduce", "line_number": 45, "usage_type": "call" } ]
591481460
import wget import sys import os from fbchat import Client from fbchat.models import * from getpass import getpass print(""" ---------------------------------------------- FBCID (Facebook Conversation Image Downloader) ---------------------------------------------- """) email = str(input('Enter email: ')) pswd = getp...
null
fbcid.py
fbcid.py
py
1,798
python
en
code
null
code-starcoder2
66
[ { "api_name": "getpass.getpass", "line_number": 15, "usage_type": "call" }, { "api_name": "fbchat.Client", "line_number": 19, "usage_type": "call" }, { "api_name": "sys.exit", "line_number": 22, "usage_type": "call" }, { "api_name": "os.path.join", "line_numbe...
182294121
import sys import os import os.path import lib.cnn.matnpyio as io #import lib.cnn.cnn as cnn import lib.cnn.matnpy as matnpy import tensorflow as tf import numpy as np #from math import ceil #import random from sklearn.model_selection import train_test_split #from sklearn.model_selection import StratifiedKFold imp...
null
main_covar.py
main_covar.py
py
7,520
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.listdir", "line_number": 45, "usage_type": "call" }, { "api_name": "lib.cnn.matnpyio.get_dico_area_to_cortex", "line_number": 53, "usage_type": "call" }, { "api_name": "lib.cnn.matnpyio", "line_number": 53, "usage_type": "name" }, { "api_name": "...
486562121
""" See http://inform-fiction.org/zmachine/standards/z1point1/index.html for a definition of the Z-Machine See README.md for a summary of architecture """ import random import os import json from zmachine.memory import Memory,BitArray from zmachine.text import ZText from zmachine.dictionary import Dictionary from...
null
zmachine/interpreter.py
interpreter.py
py
48,382
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.urandom", "line_number": 54, "usage_type": "call" }, { "api_name": "random.seed", "line_number": 62, "usage_type": "call" }, { "api_name": "random.randint", "line_number": 66, "usage_type": "call" }, { "api_name": "zmachine.memory.Memory", "l...
231990969
# -*- coding: utf-8 -*- """ Created on Thu Dec 14 22:18:42 2017 @author: elara """ import platform import os import pandas as pd from datetime import datetime import itertools from pandasql import sqldf import math import multiprocessing pysqldf = lambda q: sqldf(q, globals()) if platform.system() == 'Linux': ma...
null
7_split_corpus/old/splitcorpus_alland2016.py
splitcorpus_alland2016.py
py
9,660
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandasql.sqldf", "line_number": 15, "usage_type": "call" }, { "api_name": "platform.system", "line_number": 17, "usage_type": "call" }, { "api_name": "platform.system", "line_number": 19, "usage_type": "call" }, { "api_name": "os.listdir", "line...
3648667
from __future__ import print_function from __future__ import division import os import sys sys.path.append('../scripts') import numpy as np import xarray as xr import timeit import warnings warnings.filterwarnings("ignore") from analysis_functions import add_datetime_info from fit_coeff_rhc_functions import fit_cld_pro...
null
fig2_fit_coeff/linear_coeff_and_rhc_profile.py
linear_coeff_and_rhc_profile.py
py
4,039
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 5, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 5, "usage_type": "attribute" }, { "api_name": "warnings.filterwarnings", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path", "li...
367545554
import serial import time import odrive import os import plan import vision serial_is_connected = 0 begin_time = 0 pneumatic_states = [0, 0, 0, 0, 0] pneumatic_table = [['a', 'A'],['b', 'B'],['c', 'C'],['d','D'],['e', 'E']] last_rotate_states = 'abcd' try: ser = serial.Serial('/dev/ttyUSB0',115200) ...
null
cv/hardware.py
hardware.py
py
12,042
python
en
code
null
code-starcoder2
66
[ { "api_name": "serial.Serial", "line_number": 14, "usage_type": "call" }, { "api_name": "odrive.find_any", "line_number": 61, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 96, "usage_type": "call" }, { "api_name": "time.sleep", "line_numbe...
155508855
import pytest from uuid import UUID from opentrons import types @pytest.fixture async def test_setup(async_server, async_client): hw = async_server['com.opentrons.hardware']._backend hw._attached_instruments[types.Mount.LEFT] = { 'model': 'p10_single_v1', 'id': 'fake10pip'} hw._attached_instrumen...
null
api/tests/opentrons/server/test_calibration_check.py
test_calibration_check.py
py
5,308
python
en
code
null
code-starcoder2
66
[ { "api_name": "opentrons.types.Mount", "line_number": 10, "usage_type": "attribute" }, { "api_name": "opentrons.types", "line_number": 10, "usage_type": "name" }, { "api_name": "opentrons.types.Mount", "line_number": 12, "usage_type": "attribute" }, { "api_name": ...
548547750
import random from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F # Adapted from DQN Pytorch tutorial # See: https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html#replay-memory # and https://pytorch.org/tutorials/beginner/blitz/neural_netwo...
null
hw3a_afausti2/dqn.py
dqn.py
py
2,138
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.namedtuple", "line_number": 14, "usage_type": "call" }, { "api_name": "torch.nn.Module", "line_number": 18, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 18, "usage_type": "name" }, { "api_name": "torch.nn.Linear"...
225261604
import face_recognition import cv2 import os import pickle print(cv2.__version__) Encodings = [] Names = [] #image_dir ='/home/jetson/Desktop/pyPro/faceRecognizer/demoImages/known' image_dir ='/home/jetson/Desktop/pyPro/faceRecognizer/demoImages/Data' for root, dirs, files in os.walk(image_dir): print(files) ...
null
faceRecognizer/test.py
test.py
py
1,349
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.__version__", "line_number": 6, "usage_type": "attribute" }, { "api_name": "os.walk", "line_number": 14, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 17, "usage_type": "call" }, { "api_name": "os.path", "line_number":...
133997921
from django.shortcuts import render, get_object_or_404 from .models import MenuItem, Tartalom, Feladat, Kepek, Tematika, HomeItem def home(request): menu_list = MenuItem.objects.order_by('order') home_list = HomeItem.objects.order_by('order') context_dict = { 'menu_list': menu_list, 'activ...
null
django/pylvax_app/views.py
views.py
py
3,164
python
en
code
null
code-starcoder2
66
[ { "api_name": "models.MenuItem.objects.order_by", "line_number": 6, "usage_type": "call" }, { "api_name": "models.MenuItem.objects", "line_number": 6, "usage_type": "attribute" }, { "api_name": "models.MenuItem", "line_number": 6, "usage_type": "name" }, { "api_na...
450727634
from flask import jsonify, request from flask_login import login_required, current_user from sqlalchemy import desc, asc from SpaceDock.objects import * from SpaceDock.formatting import game_info, game_version_info from SpaceDock.common import with_session, edit_object from flask_json import FlaskJSON, JsonError, json_...
null
SpaceDock/endpoints/game.py
game.py
py
4,721
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlalchemy.desc", "line_number": 22, "usage_type": "call" }, { "api_name": "flask_json.as_json", "line_number": 16, "usage_type": "name" }, { "api_name": "flask_json.as_json", "line_number": 39, "usage_type": "name" }, { "api_name": "SpaceDock.forma...
103275410
import logging import os import json from typing import List, TextIO, Union from seqeval.metrics.sequence_labeling import get_entities from utils_entity import InputExample, Split, EntityClassificationTask logger = logging.getLogger(__name__) class NER(EntityClassificationTask): def __init__(self, label_idx=-1)...
null
tasks_entity.py
tasks_entity.py
py
7,809
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 9, "usage_type": "call" }, { "api_name": "utils_entity.EntityClassificationTask", "line_number": 12, "usage_type": "name" }, { "api_name": "typing.Union", "line_number": 17, "usage_type": "name" }, { "api_name": "u...
42848728
import matplotlib.pyplot as plt import math import random import numpy as np import matplotlib.pyplot as plt T_init = 2 # 初始最大温度 alpha = 0.95 # 降温系数 T_min = 1e-3 # 最小温度,即退出循环条件 def obj(x): y = np.sin(10 * np.pi * x) / x return -y def SA(T_init, alpha, T_min): T = T_init x_new = random.random() * 1...
null
SwarmIntelligence/SimulatedAnnealing.py
SimulatedAnnealing.py
py
1,782
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.sin", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.pi", "line_number": 11, "usage_type": "attribute" }, { "api_name": "random.random", "line_number": 17, "usage_type": "call" }, { "api_name": "random.random", "line_numbe...
606855675
import pickle import cv2 import numpy as np import math import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import matplotlib.image as mpimg import glob import os from moviepy.editor import VideoFileClip, ImageSequenceClip def grayscale(img): ''' Convert img to grayscale ''' return ...
null
labutils.py
labutils.py
py
8,700
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.cvtColor", "line_number": 16, "usage_type": "call" }, { "api_name": "cv2.COLOR_RGB2GRAY", "line_number": 16, "usage_type": "attribute" }, { "api_name": "numpy.uint8", "line_number": 22, "usage_type": "call" }, { "api_name": "numpy.max", "lin...
99422089
import os from typing import Optional from meiga import Error, Result, isSuccess from meiga.decorators import meiga from alice import Auth, Config, Onboarding @meiga def get_user_id_from_onboarding( api_key, verbose: Optional[bool] = False ) -> Result[str, Error]: config = Config(api_key=api_key, verbose=ve...
null
examples/auth.py
auth.py
py
1,310
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.Optional", "line_number": 12, "usage_type": "name" }, { "api_name": "alice.Config", "line_number": 14, "usage_type": "call" }, { "api_name": "alice.Onboarding.from_config", "line_number": 15, "usage_type": "call" }, { "api_name": "alice.Onboa...
477585302
import os import sqlite3 from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash from datetime import date app = Flask(__name__) app.config.from_object(__name__) app.config.update(dict( DATABASE=os.path.join(app.root_path, 'hyperstore.db'), DEBUG=True, SECRET...
null
database/web/hyperstore.py
hyperstore.py
py
12,667
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 12, "usage_type": "call" }, { "api_name": "os.path", "line_number": 12, "usage_type": "attribute" }, { "api_name": "flask.request.form", "line_n...
556695184
from absl import flags from absl.flags import FLAGS import numpy as np # import tensorflow as tf # from tensorflow.keras import Model # from tensorflow.keras.layers import ( # Add, # Concatenate, # Conv2D, # Input, # Lambda, # LeakyReLU, # MaxPool2D, # UpSampling2D, # ZeroPadding2D, ...
null
old/yolov3-tf2/yolov3_tf2/models.py
models.py
py
34,484
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.getcwd", "line_number": 26, "usage_type": "call" }, { "api_name": "os.chdir", "line_number": 27, "usage_type": "call" }, { "api_name": "os.path.dirname", "line_number": 27, "usage_type": "call" }, { "api_name": "os.path", "line_number": 27, ...
556304161
import numpy as np import matplotlib.pyplot as plt plt.xlabel("x") plt.ylabel("y") plt.axes().set_aspect("equal") ax = plt.gca() # gca stands for 'get current axis' ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') ax.xaxis.set_ticks_position('bottom') ax.spines['bottom'].set_position(('data',0...
null
log/syojyo/main.py
main.py
py
796
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.pyplot.xlabel", "line_number": 4, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 4, "usage_type": "name" }, { "api_name": "matplotlib.pyplot.ylabel", "line_number": 5, "usage_type": "call" }, { "api_name": "matp...
324129044
# -*- coding:utf-8 -*- import os import sys import time try: from winsound import Beep executable_path='D:/chromedriver.exe' except ImportError: #Not Windows, at Linux def Beep(freq, duration): os.system('play -nq -t alsa synth {} sine {}'.format(duration, freq)) executable_path='/usr/lib/chrom...
null
joonggonara_mobile.py
joonggonara_mobile.py
py
6,675
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.system", "line_number": 11, "usage_type": "call" }, { "api_name": "sys.executable", "line_number": 20, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 21, "usage_type": "attribute" }, { "api_name": "sys.executable", "lin...
202029131
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import networkx as nx import matplotlib.pyplot as plt import math from heapq import heappush, heappop from itertools import count # librerias propias import mapas as m def targetIncrease(G,listSource,listTarget): """Retorna una lista de nodos en un camino de uno o m...
null
proyecto/algoritmo planeacion redes inalambricas/increase.py
increase.py
py
21,353
python
en
code
null
code-starcoder2
66
[ { "api_name": "heapq.heappush", "line_number": 82, "usage_type": "name" }, { "api_name": "heapq.heappop", "line_number": 83, "usage_type": "name" }, { "api_name": "itertools.count", "line_number": 89, "usage_type": "call" }, { "api_name": "networkx.NetworkXNoPath"...
640583843
#!/usr/bin/python # -*- coding: utf-8 -*- from PyQt5 import QtWidgets # 使用命令pyuic5 ext4_form.ui -o form.py将ui文件转化为py文件 from ext4_form import Ui_QtWindow # 通过同时继承QWidget和手动设计的Ui_QtWindow class MyDesignerShow(QtWidgets.QWidget, Ui_QtWindow): def __init__(self): # 加载父类QWidget中的初始化内容 super(MyDesigne...
null
python/codeSnippet/PyQt/ext4_3.py
ext4_3.py
py
624
python
en
code
null
code-starcoder2
66
[ { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 11, "usage_type": "attribute" }, { "api_name": "PyQt5.QtWidgets", "line_number": 11, "usage_type": "name" }, { "api_name": "ext4_form.Ui_QtWindow", "line_number": 11, "usage_type": "name" }, { "api_name": "Py...
266718404
from math import sqrt import sys import argparse def get_roots(a, b, c): discriminant = b ** 2 - 4 * a * c if discriminant < 0: return None, None root1 = (-b - sqrt(discriminant)) / (2 * a) root2 = (-b + sqrt(discriminant)) / (2 * a) if discriminant == 0: return root1, None e...
null
quadratic_equation.py
quadratic_equation.py
py
1,001
python
en
code
null
code-starcoder2
66
[ { "api_name": "math.sqrt", "line_number": 11, "usage_type": "call" }, { "api_name": "math.sqrt", "line_number": 12, "usage_type": "call" }, { "api_name": "argparse.ArgumentParser", "line_number": 20, "usage_type": "call" } ]
79880762
__author__ = 'axc' import yaml import requests from lxml.html import fromstring hackery = yaml.load_all(open("hackery.yml", 'r')) def is_online(url): try: r = requests.get(url, timeout=5) return r.status_code except Exception as e: return e def get_site_title(url): try: ...
null
hackery.py
hackery.py
py
1,620
python
en
code
null
code-starcoder2
66
[ { "api_name": "yaml.load_all", "line_number": 8, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 12, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 20, "usage_type": "call" }, { "api_name": "lxml.html.fromstring", "li...
496756559
from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from piston.resource import Resource from api.handlers import ShortUrlHandler shorturl_handler = Resource(ShortUrlHandler) urlpatterns = patterns('', url(r'^shorturl/create/', shorturl_handler), url(r'^shorturl/ge...
null
url_shortener/api/urls.py
urls.py
py
482
python
en
code
null
code-starcoder2
66
[ { "api_name": "piston.resource.Resource", "line_number": 6, "usage_type": "call" }, { "api_name": "api.handlers.ShortUrlHandler", "line_number": 6, "usage_type": "argument" }, { "api_name": "django.views.generic.simple.direct_to_template", "line_number": 14, "usage_type":...
188829974
#Definition for singly-linked list. def timeit(method): def timed(*args, **kw): global calc calc = defaultdict(int) print ('===========') ts = time.time() result = method(*args, **kw) te = time.time() print ('%r %2.8f ms' % (method.__name__, (te - ts) * 1000...
null
lc/mdm/20190831_mdm_62_unique_paths.py
20190831_mdm_62_unique_paths.py
py
1,941
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.basicConfig", "line_number": 26, "usage_type": "call" }, { "api_name": "logging.DEBUG", "line_number": 26, "usage_type": "attribute" }, { "api_name": "logging.debug", "line_number": 33, "usage_type": "call" } ]
545158767
# -*- coding: utf-8 -*- ######################################################### import os, traceback, io, re from . import logger class ToolBaseFile(object): @classmethod def read(cls, filepath, mode='r'): try: import codecs ifp = codecs.open(filepath, mode, encoding='utf8') ...
null
lib/tool_base/file.py
file.py
py
1,816
python
en
code
null
code-starcoder2
66
[ { "api_name": "codecs.open", "line_number": 12, "usage_type": "call" }, { "api_name": "traceback.format_exc", "line_number": 20, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 28, "usage_type": "call" }, { "api_name": "traceback.format_exc", ...
610972882
import torch from discrete_nn.layers.type_defs import ValueTypes, DiscreteWeights from discrete_nn.layers.logit_linear import LogitLinear from discrete_nn.layers.local_reparametrization import LocalReparametrization from discrete_nn.models.pi.real import PiReal from discrete_nn.models.base_model import LogitModel cla...
null
discrete_nn/models/pi/logit_tanh.py
logit_tanh.py
py
4,689
python
en
code
null
code-starcoder2
66
[ { "api_name": "discrete_nn.models.base_model.LogitModel", "line_number": 9, "usage_type": "name" }, { "api_name": "discrete_nn.layers.type_defs.DiscreteWeights", "line_number": 14, "usage_type": "name" }, { "api_name": "discrete_nn.layers.type_defs.DiscreteWeights", "line_num...
505114645
#!/usr/bin/env fades import os import json import operator import random import unicodedata import certg # fades >=5 RESULT_DIR = 'result' PROCESSED_OK = 'ok' PROCESSED_FLAG = "__processed__" def cback(data): """Show progress.""" print(" ", data['progress']) def generate_fronts(db): """Generate the...
null
art/generate_cards.py
generate_cards.py
py
4,525
python
en
code
null
code-starcoder2
66
[ { "api_name": "certg.process", "line_number": 39, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 40, "usage_type": "call" }, { "api_name": "os.path", "line_number": 40, "usage_type": "attribute" }, { "api_name": "certg.process", "line_num...
587572635
# -*- coding: utf-8 -*- """ Created on Sun Aug 13 19:14:11 2017 @author: gansc """ import glob import random import numpy as np import cv2 import matplotlib.image as mpimg import config class ImageLoader(config.ConfigClass): def __init__(self): super().__init__() def get_random(self, img_set...
null
images.py
images.py
py
1,569
python
en
code
null
code-starcoder2
66
[ { "api_name": "config.ConfigClass", "line_number": 15, "usage_type": "attribute" }, { "api_name": "glob.glob", "line_number": 23, "usage_type": "call" }, { "api_name": "random.choice", "line_number": 25, "usage_type": "call" }, { "api_name": "matplotlib.image.imre...
103440487
import sys,json # reading input with open(sys.argv[1], 'r') as f_read: dfa_data = json.load(f_read) states = dfa_data['states'] sybmols = dfa_data['letters'] trans_fxn = dfa_data['transition_function'] start_states = dfa_data['start_states'] end_states = dfa_data['final_states'] new_start_state =...
null
q3/q3.py
q3.py
py
4,824
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.argv", "line_number": 4, "usage_type": "attribute" }, { "api_name": "json.load", "line_number": 5, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 144, "usage_type": "attribute" }, { "api_name": "json.dump", "line_number": 1...
329816101
### Given an array of strings, group anagrams together. ### For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], ### Return: ### [ ### ["ate", "eat","tea"], ### ["nat","tan"], ### ["bat"] ### ] ### Note: All inputs will be in lower-case. from operator import mul from itertools import groupby clas...
null
49-group-anagrams.py
49-group-anagrams.py
py
1,546
python
en
code
null
code-starcoder2
66
[ { "api_name": "operator.mul", "line_number": 31, "usage_type": "argument" }, { "api_name": "itertools.groupby", "line_number": 54, "usage_type": "call" } ]
10038745
import asyncio from contextlib import asynccontextmanager import pytest from mitmproxy.addons.clientplayback import ClientPlayback from mitmproxy.addons.clientplayback import ReplayHandler from mitmproxy.addons.proxyserver import Proxyserver from mitmproxy.connection import Address from mitmproxy.exceptions import Co...
null
test/mitmproxy/addons/test_clientplayback.py
test_clientplayback.py
py
6,100
python
en
code
null
code-starcoder2
66
[ { "api_name": "asyncio.start_server", "line_number": 18, "usage_type": "call" }, { "api_name": "contextlib.asynccontextmanager", "line_number": 16, "usage_type": "name" }, { "api_name": "mitmproxy.connection.Address", "line_number": 17, "usage_type": "name" }, { "...
404457255
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the BSD 3-Clause License (the "License"); # you may n...
null
PyTorch/contrib/cv/classification/EfficientNet-B3/tools/train_net.py
train_net.py
py
3,783
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.__version__", "line_number": 32, "usage_type": "attribute" }, { "api_name": "os.environ", "line_number": 41, "usage_type": "attribute" }, { "api_name": "os.environ", "line_number": 42, "usage_type": "attribute" }, { "api_name": "torch.distribu...
590753890
import os import tensorflow as tf from absl import flags as absl_flags from keras import backend as K from keras.models import model_from_json WORKING_DIR = os.getcwd() try: tf.app.flags.DEFINE_integer('training_iteration', 1000, 'number of training iterations.') tf.app.flags.DEFINE_integer('model_version', ...
null
examples/export_keras_model.py
export_keras_model.py
py
1,772
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.getcwd", "line_number": 8, "usage_type": "call" }, { "api_name": "tensorflow.app.flags.DEFINE_integer", "line_number": 11, "usage_type": "call" }, { "api_name": "tensorflow.app", "line_number": 11, "usage_type": "attribute" }, { "api_name": "tens...
182514363
#coding: utf-8 #!/usr/bin/python3 import sys import os import numpy as np import matplotlib.pyplot as plt #Load simulation name and path if (len(sys.argv) > 3) : print('Too much argument') sys.exit() elif (len(sys.argv) == 1): print('Use default path and default simulation name') path = '.' simula...
null
postprocessing/sCourbe.py
sCourbe.py
py
1,908
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.argv", "line_number": 10, "usage_type": "attribute" }, { "api_name": "sys.exit", "line_number": 12, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 13, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 17...
14633162
import traceback from configparser import ConfigParser class Database: @classmethod def get_properties(cls, dbname): filename = dbname + '.ini' cp = ConfigParser() try: cp.read(filename, encoding='utf-8') except FileNotFoundError: print('Warning: {filena...
null
Facade/pagemaker.py
pagemaker.py
py
2,141
python
en
code
null
code-starcoder2
66
[ { "api_name": "configparser.ConfigParser", "line_number": 9, "usage_type": "call" }, { "api_name": "traceback.format_exc", "line_number": 63, "usage_type": "call" } ]
301553899
# USAGE # python neural_style_transfer_video.py --models models # import the necessary packages from imutils.video import VideoStream from imutils import paths import itertools import argparse import imutils import time import cv2 def overlay_image_alpha(img, img_overlay, pos, alpha_mask): """Overlay img_overlay ...
null
neural-style-transfer/neural_style_transfer_video.py
neural_style_transfer_video.py
py
4,216
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.imread", "line_number": 44, "usage_type": "call" }, { "api_name": "argparse.ArgumentParser", "line_number": 47, "usage_type": "call" }, { "api_name": "imutils.paths.list_files", "line_number": 54, "usage_type": "call" }, { "api_name": "imutils.p...
71649917
# coding=utf-8 # # Copyright 2013-2015 david reid <zathrasorama@gmail.com> # # 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 requir...
null
pywind/ofgem/Station.py
Station.py
py
4,641
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.version_info", "line_number": 24, "usage_type": "attribute" }, { "api_name": "pywind.ofgem.Base.set_attr_from_xml", "line_number": 68, "usage_type": "call" }, { "api_name": "pywind.ofgem.Base.set_attr_from_xml", "line_number": 70, "usage_type": "call" ...
430566984
import sys import argparse from itertools import izip from collections import defaultdict from csplit import csplit def main(): parser = argparse.ArgumentParser(description='Train alignment models') parser.add_argument('corpus', help='original corpus') args = parser.parse_args() with open(args.corpus)...
null
hw1/uncsplit.py
uncsplit.py
py
1,001
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 8, "usage_type": "call" }, { "api_name": "itertools.izip", "line_number": 13, "usage_type": "call" }, { "api_name": "sys.stdin", "line_number": 13, "usage_type": "attribute" }, { "api_name": "collections.defa...
604673180
from __future__ import absolute_import, unicode_literals from celery import group from .celery import app import time @app.task def task1(duration): time.sleep(duration) # print('async task1 finished') @app.task def task2(duration): # print('async task 2 triggered') job = group(task3.s(2 * duratio...
null
celery/periodic_task_async_multiqueue/task_async.py
task_async.py
py
615
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.sleep", "line_number": 11, "usage_type": "call" }, { "api_name": "celery.app.task", "line_number": 9, "usage_type": "attribute" }, { "api_name": "celery.app", "line_number": 9, "usage_type": "name" }, { "api_name": "celery.group", "line_num...
134266429
import pygame,pygame.locals pygame.init() screen = pygame.display.set_mode((400,300)) loop = True while loop: for e in pygame.event.get(): if e.type == pygame.KEYDOWN: if e.key == pygame.K_ESCAPE: loop = False pygame.quit()
null
lw/yoyoyo.py
yoyoyo.py
py
262
python
en
code
null
code-starcoder2
66
[ { "api_name": "pygame.init", "line_number": 2, "usage_type": "call" }, { "api_name": "pygame.display.set_mode", "line_number": 11, "usage_type": "call" }, { "api_name": "pygame.display", "line_number": 11, "usage_type": "attribute" }, { "api_name": "pygame.event.g...
515969756
from flask import Flask from flask import request app = Flask(__name__) @app.route('/') def index(): return '<h1>Hello World<h1>' @app.route('/user/<name>') def user(name): #al importar el objeto request podemos obtener atributos de este #en esta sentencia request es una variable global user_agent = r...
null
hello.py
hello.py
py
555
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 3, "usage_type": "call" }, { "api_name": "flask.request.headers.get", "line_number": 13, "usage_type": "call" }, { "api_name": "flask.request.headers", "line_number": 13, "usage_type": "attribute" }, { "api_name": "flask...
237636656
import torch import torch.nn as nn class SEBlock(nn.Module): def __init__(self, channel, reduction=16): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.se = nn.Sequential( nn.Linear(channel, channel // reduction), nn.PReLU(), nn.Linear(c...
null
projects/vision/blocks.py
blocks.py
py
541
python
en
code
null
code-starcoder2
66
[ { "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.AdaptiveAvgPool2d", "line_number": 9, "usage_type": "call" }, { "api_name": "torch.nn", ...
282450431
from django.urls import path from django.views.generic import TemplateView from django.views.generic.base import RedirectView #Users from users.views import Loginv, Logout, createAccaunt #Mall from mall.views import StoreCreate, storesChoices, ProductCreate, TypeChooseOrCreate, storeMain, productsPaginateView, prod...
null
openproject/appsurls.py
appsurls.py
py
1,937
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 17, "usage_type": "call" }, { "api_name": "users.views.Logout", "line_number": 17, "usage_type": "argument" }, { "api_name": "django.urls.path", "line_number": 21, "usage_type": "call" }, { "api_name": "django.views...
463003848
################################################################################################################################ # $Id$ ################################################################################################################################ # # Copyright (c) 2012; Mark Rogaski. # # All right...
null
umami/forms/player.py
player.py
py
4,033
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.forms.ModelForm", "line_number": 54, "usage_type": "name" }, { "api_name": "django.forms.ModelChoiceField", "line_number": 55, "usage_type": "call" }, { "api_name": "django.forms", "line_number": 55, "usage_type": "name" }, { "api_name": "uma...
557324661
import os import json from redis import Redis from circuitbreaker import circuit REDIS_HOST = os.getenv('REDIS_HOST') REDIS_DB = int(os.getenv('REDIS_DB')) class ClienteRedis: def __init__(self): self.con = Redis( host=REDIS_HOST, db=REDIS_DB, socket_connect_timeout=2,...
null
services/autenticacao/autenticacaoapp/cliente_redis.py
cliente_redis.py
py
1,027
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.getenv", "line_number": 6, "usage_type": "call" }, { "api_name": "os.getenv", "line_number": 7, "usage_type": "call" }, { "api_name": "redis.Redis", "line_number": 11, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 21, ...
478406247
import matplotlib.pyplot as plt import numpy as np x = np.arange(0.1, 100) plt.title("time complexity") plt.scatter(x, x * (np.log2(x)), s=0.5, alpha=0.5, label='O(n*logn)') # O(nlogn) 时间复杂度 plt.scatter(x, x, s=0.5, alpha=0.5, label='O(n)') # O(nlogn) 时间复杂度 plt.scatter(x, x * x, s=0.5, alpha=0.5, label='O(n²)') # ...
null
画图/SortTimeXY.py
SortTimeXY.py
py
397
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.arange", "line_number": 4, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.title", "line_number": 6, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 6, "usage_type": "name" }, { "api_name": "matplotlib.pyplot...
288439014
# -*- coding: utf-8 -*- """ Created on Sun May 27 22:45:44 2018 @author: devyash """ # Multiple Linear Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('50_Startups.csv') X = dataset.iloc[:, :-1].v...
null
regression/Multiple Linear Regression/My_multiple_linear_regression.py
My_multiple_linear_regression.py
py
2,434
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 15, "usage_type": "call" }, { "api_name": "sklearn.preprocessing.LabelEncoder", "line_number": 21, "usage_type": "call" }, { "api_name": "sklearn.preprocessing.OneHotEncoder", "line_number": 23, "usage_type": "call" }, {...
402313058
from datetime import datetime from .BaseMatcher import BaseMatcher import pytz import re class TimezoneMatcher(BaseMatcher): name = 'timezone' timezones = { 'MARK': pytz.timezone('US/Hawaii'), 'UTC': pytz.timezone('UTC'), 'SIMON': pytz.timezone('Europe/London'), 'KEITH': pytz...
null
matchers/TimezoneMatcher.py
TimezoneMatcher.py
py
2,040
python
en
code
null
code-starcoder2
66
[ { "api_name": "BaseMatcher.BaseMatcher", "line_number": 7, "usage_type": "name" }, { "api_name": "pytz.timezone", "line_number": 12, "usage_type": "call" }, { "api_name": "pytz.timezone", "line_number": 13, "usage_type": "call" }, { "api_name": "pytz.timezone", ...
156558096
"""Bookmanager URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.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-b...
null
Bookmanager/urls.py
urls.py
py
8,103
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 24, "usage_type": "call" }, { "api_name": "django.contrib.admin.site", "line_number": 24, "usage_type": "attribute" }, { "api_name": "django.contrib.admin", "line_number": 24, "usage_type": "name" }, { "api_name": "...
467599133
from django.http import HttpResponseRedirect from django.contrib import messages from django.shortcuts import render from django.urls import reverse from django.utils.safestring import mark_safe from django.core.mail import EmailMessage from django.contrib.auth.models import User from .forms import EventForm from .uti...
null
otc/app/views.py
views.py
py
11,965
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.date.today", "line_number": 25, "usage_type": "call" }, { "api_name": "datetime.date", "line_number": 25, "usage_type": "attribute" }, { "api_name": "django.utils.safestring.mark_safe", "line_number": 34, "usage_type": "call" }, { "api_name...
16937363
import cv2 class _VideoCapture: def __init__(self, video_source=0): self.video = cv2.VideoCapture(video_source) if not self.video.isOpened(): raise ValueError('Unable video source', video_source) print(video_source) # self.width = 700 # self.video.get(cv2.CAP_PROP_FRAME_...
null
_VideoCapture.py
_VideoCapture.py
py
779
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.VideoCapture", "line_number": 6, "usage_type": "call" }, { "api_name": "cv2.cvtColor", "line_number": 21, "usage_type": "call" }, { "api_name": "cv2.COLOR_BGR2RGB", "line_number": 21, "usage_type": "attribute" } ]
317058308
from pyecharts import Geo keys = ['上海', '北京', '合肥', '哈尔滨', '广州', '成都', '无锡', '杭州', '武汉', '深圳', '西安', '郑州', '重庆', '长沙', '贵阳', '乌鲁木齐'] values = [4.07, 1.85, 4.38, 2.21, 3.53, 4.37, 1.38, 4.29, 4.1, 1.31, 3.92, 4.47, 2.40, 3.60, 1.2, 3.7] geo = Geo("全国主要城市空气质量热力图", "data from pm2.5", title_color="#fff", title_pos="...
null
project/templates/myApp/forecast/map.py
map.py
py
841
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyecharts.Geo", "line_number": 6, "usage_type": "call" } ]
441323566
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.new_game, name='new_game'), url(r'^(\w+)$', views.index, name='index'), url(r'^(\w+)/authenticate/', views.authenticate, name='authenticate'), url(r'^(\w+)/register/', views.register, name='register'), url(r'^(\w...
null
game/urls.py
urls.py
py
710
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...
114792927
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render,redirect from .forms import * from django.utils import timezone # Create your views here. def get_list(request): if request.method=='POST': form = FormToDo(request.POST) if form.is_valid(): ...
null
list/views.py
views.py
py
931
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.utils.timezone.now", "line_number": 16, "usage_type": "call" }, { "api_name": "django.utils.timezone", "line_number": 16, "usage_type": "name" }, { "api_name": "django.shortcuts.redirect", "line_number": 18, "usage_type": "call" }, { "api_nam...
76811307
import os import sys import warnings BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASE_DIR) warnings.filterwarnings('ignore') import argparse import random import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader from simpleAICV.detectio...
null
tools/test_detection_model.py
test_detection_model.py
py
2,981
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.dirname", "line_number": 5, "usage_type": "call" }, { "api_name": "os.path", "line_number": 5, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 5, "usage_type": "call" }, { "api_name": "sys.path.append", "line...
70488004
from django.http import HttpResponse, Http404 from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.db import transaction from .models import * from .forms import * from peewee import DoesNotExist # Create your views here. # def welcome(request): # ret...
null
jirani/views.py
views.py
py
7,440
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.shortcuts.redirect", "line_number": 21, "usage_type": "call" }, { "api_name": "peewee.DoesNotExist", "line_number": 27, "usage_type": "name" }, { "api_name": "django.http.Http404", "line_number": 28, "usage_type": "call" }, { "api_name": "dja...
226873293
#在進行深度學習訓練模型之前,首先下載IMDb網路電影資料集 import urllib.request import os import tarfile #匯入 urllib 模組,用於下載檔案 #匯入 os 模組,用於確認檔案是否存在 #匯入 tarfile 模組,用於解壓縮檔案 url = 'https://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz' #IMDb網路電影資料集的下載網址 filepath = 'IMDb/aclImdb_v1.tar.gz' #欲儲存檔案的位置與檔名 if not os.path.isfile(filepath): #如果系...
null
IMDb_1.py
IMDb_1.py
py
6,415
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.isfile", "line_number": 11, "usage_type": "call" }, { "api_name": "os.path", "line_number": 11, "usage_type": "attribute" }, { "api_name": "urllib.request.request.urlretrieve", "line_number": 12, "usage_type": "call" }, { "api_name": "urllib...
166585927
__author__ = "Nadimozzaman Pappo" __github__ = "http://github.com/mnpappo" """ Just Testing using saved model. """ import numpy as np import scipy.misc from keras.models import model_from_json # load some image to test def load_and_scale_imgs(): img_names = ['data/cat.jpg', 'data/dog.jpg'] # resize img to 32x3...
null
cifar10_test.py
cifar10_test.py
py
1,141
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.transpose", "line_number": 16, "usage_type": "call" }, { "api_name": "scipy.misc.misc.imresize", "line_number": 16, "usage_type": "call" }, { "api_name": "scipy.misc.misc", "line_number": 16, "usage_type": "attribute" }, { "api_name": "scipy.m...
86228070
from pygame.sprite import Sprite import random class Pipe(Sprite): def __init__(self,image,st): super(Pipe,self).__init__() self.pipe_down = image.pipe_down self.pipe_up = image.pipe_up self.down_rect = self.pipe_down.get_rect() self.up_rect = self.pipe_up.get_rect() ...
null
pipe.py
pipe.py
py
978
python
en
code
null
code-starcoder2
66
[ { "api_name": "pygame.sprite.Sprite", "line_number": 4, "usage_type": "name" }, { "api_name": "random.randint", "line_number": 13, "usage_type": "call" } ]
191053238
# -*- coding: utf-8 -*- """ Created on Mon Aug 28 21:27:37 2017 @author: David Roberts """ import psycopg2 from configparser import ConfigParser def config(filename='database.ini', section='postgresql'): # create a parser parser = ConfigParser() # read config file parser.read(filename) # get s...
null
db_write.py
db_write.py
py
3,310
python
en
code
null
code-starcoder2
66
[ { "api_name": "configparser.ConfigParser", "line_number": 13, "usage_type": "call" }, { "api_name": "psycopg2.connect", "line_number": 42, "usage_type": "call" }, { "api_name": "psycopg2.DatabaseError", "line_number": 53, "usage_type": "attribute" }, { "api_name":...
10289188
from nltk.tokenize import word_tokenize from nltk.corpus import stopwords def clear_text(text): stop_words = stopwords.words('english') tokens = word_tokenize(text) words = [word.lower() for word in tokens if word.isalpha()] words = [w for w in words if not w in stop_words] return words
null
hadoop/python_functions/tweet_clean.py
tweet_clean.py
py
311
python
en
code
null
code-starcoder2
66
[ { "api_name": "nltk.corpus.stopwords.words", "line_number": 5, "usage_type": "call" }, { "api_name": "nltk.corpus.stopwords", "line_number": 5, "usage_type": "name" }, { "api_name": "nltk.tokenize.word_tokenize", "line_number": 7, "usage_type": "call" } ]
504915928
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: /Users/sogubaby/.virtualenvs/scrapy_middlewares/lib/python3.7/site-packages/scrapy_cabinet/libs/sle/extractor/TimeExtractor.py # Compiled at: 2019-11-18 00:40:08 ...
null
pycfiles/scrapy_cabinet-0.0.4.macosx-10.9-x86_64.tar/TimeExtractor.cpython-37.py
TimeExtractor.cpython-37.py
py
3,446
python
en
code
null
code-starcoder2
66
[ { "api_name": "scrapy_cabinet.libs.defaults.DATETIME_PATTERN", "line_number": 20, "usage_type": "name" }, { "api_name": "scrapy_cabinet.libs.defaults.DATETIME_PATTERN_XPATH", "line_number": 21, "usage_type": "name" }, { "api_name": "typing.Union", "line_number": 25, "usag...
410218207
import serial from math import * import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import time ser= serial.Serial('/dev/ttyACM1') #collect data from Arduino fig = plt.figure() #initialize 3d figure ax = fig.add_subplot(111, projection='3d') X = [] #empty arrays to gather data Y = [] Z = [] now...
null
scanner.py
scanner.py
py
1,452
python
en
code
null
code-starcoder2
66
[ { "api_name": "serial.Serial", "line_number": 7, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure", "line_number": 9, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 9, "usage_type": "name" }, { "api_name": "time.time", ...
621100820
# -*- coding: utf-8 -*- import chess import chess.pgn import datetime class Stream: """ Managing methods for saving and reading games from files """ def readPGN(file): """ Read a game in PGN from a files and return the board of this game,the white name, the black name and the re...
null
save.py
save.py
py
3,509
python
en
code
null
code-starcoder2
66
[ { "api_name": "chess.pgn.read_game", "line_number": 19, "usage_type": "call" }, { "api_name": "chess.pgn", "line_number": 19, "usage_type": "attribute" }, { "api_name": "chess.pgn.Game", "line_number": 42, "usage_type": "call" }, { "api_name": "chess.pgn", "li...
536343916
import numpy as np from pycontrol import mat, ml import matplotlib.pyplot as plt import time # true value ar = 10.0 br = 5.0 cr = 2.0 N = 100 sigma = 0.5 np.random.seed(123) def gen_dataset(): x_data = np.arange(0, N) / N y_data = ar*x_data*x_data + br*x_data + cr + \ np.random.normal(scale=s...
null
docs/ml/Least_squares/Least_squares.py
Least_squares.py
py
1,165
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.random.seed", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 16, "usage_type": "attribute" }, { "api_name": "numpy.arange", "line_number": 19, "usage_type": "call" }, { "api_name": "numpy.random.normal"...
615169246
from flor.transformer.visitors import get_change_and_read_set, LoadStoreDetector, StatementCounter from flor.transformer.code_gen import * from flor.transformer.utils import set_intersection, set_union, node_in_nodes import copy import astor import os class Transformer(ast.NodeTransformer): static_key = 0 cla...
null
flor/transformer/__init__.py
__init__.py
py
9,847
python
en
code
null
code-starcoder2
66
[ { "api_name": "astor.to_source", "line_number": 25, "usage_type": "call" }, { "api_name": "os.path.splitext", "line_number": 26, "usage_type": "call" }, { "api_name": "os.path", "line_number": 26, "usage_type": "attribute" }, { "api_name": "flor.transformer.visito...
340319316
# uncompyle6 version 3.7.4 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: build/bdist.linux-x86_64/egg/show/utils.py # Compiled at: 2013-09-27 03:40:37 from django.core.cache import cache from django.utils import timezone from show.mod...
null
pycfiles/jmbo_show-0.3.2-py2.7/utils.py
utils.py
py
4,752
python
en
code
null
code-starcoder2
66
[ { "api_name": "show.models.Show", "line_number": 11, "usage_type": "name" }, { "api_name": "django.core.cache.cache.get", "line_number": 16, "usage_type": "call" }, { "api_name": "django.core.cache.cache", "line_number": 16, "usage_type": "name" }, { "api_name": "...
225844079
#coding: utf8 from collections import namedtuple, OrderedDict as oDict from sanic.exceptions import MethodNotSupported, NotFound import re add_slash = lambda uri: uri if uri.endswith('/') else '%s/' % uri class Route(object): class DefineError(Exception): pass HTTP_METHODS = set(['GET', 'POST', 'PU...
null
sweet_web/router.py
router.py
py
7,952
python
en
code
null
code-starcoder2
66
[ { "api_name": "re.compile", "line_number": 15, "usage_type": "call" }, { "api_name": "re.compile", "line_number": 16, "usage_type": "call" }, { "api_name": "collections.OrderedDict", "line_number": 35, "usage_type": "call" }, { "api_name": "re.compile", "line_...
232129162
#!/usr/bin/python3 import numpy as np from sys import exit from math import floor, ceil import os.path as path from pprint import pprint import os, argparse, shutil report = {} def error(str): if str in report: report[str] += 1 else: report[str] = 1 print(str) print(line) print() ...
null
filter_train_csv.py
filter_train_csv.py
py
2,865
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 22, "usage_type": "call" }, { "api_name": "shutil.copy", "line_number": 38, "usage_type": "call" }, { "api_name": "os.path.splitext", "line_number": 38, "usage_type": "call" }, { "api_name": "os.path", "l...
600564232
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/6/7 16:42 # @Author : liugang9 # @Email : mlcc330@hotmail.com # @File : getCPUInfo.py # @Software: PyCharm # @license: Apache Licence # @contact: 3323202070@qq.com import psutil import os from influxdb import InfluxDBClient import time,math,random ...
null
src/practices/github/getCPUInfo.py
getCPUInfo.py
py
984
python
en
code
null
code-starcoder2
66
[ { "api_name": "psutil.Process", "line_number": 16, "usage_type": "call" }, { "api_name": "os.getpid", "line_number": 16, "usage_type": "call" }, { "api_name": "psutil.virtual_memory", "line_number": 19, "usage_type": "call" }, { "api_name": "psutil.cpu_percent", ...
100412797
import logging from PySide2 import QtWidgets, QtCore from PySide2.QtWidgets import QFileDialog from shiboken2 import wrapInstance import maya.OpenMaya as oM import maya.OpenMayaUI as omUI import maya.cmds as cmds import pymel.core as pnc import pymel.core.datatypes as dt from pymel.core.system import Path import rando...
null
Environment/src/scatter.py
scatter.py
py
19,657
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 14, "usage_type": "call" }, { "api_name": "maya.OpenMayaUI.MQtUtil.mainWindow", "line_number": 19, "usage_type": "call" }, { "api_name": "maya.OpenMayaUI.MQtUtil", "line_number": 19, "usage_type": "attribute" }, { ...
165213368
#!/usr/bin/env python3 """This script does the following: 1. Counts the total number of words 2. Counts the number of unique words 3. Number of unique word occurrences""" import logging logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s') # logging.basicConfig(file...
null
Wk5_word_counter_lab2_Ravulcaba_ver.py
Wk5_word_counter_lab2_Ravulcaba_ver.py
py
3,068
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.basicConfig", "line_number": 9, "usage_type": "call" }, { "api_name": "logging.DEBUG", "line_number": 9, "usage_type": "attribute" }, { "api_name": "logging.debug", "line_number": 27, "usage_type": "call" }, { "api_name": "logging.debug", ...
217639963
import psycopg2 import sys # Read in some data data = """user1,manager\nuser2,worker\nuser3,worker\nuser4,manager\nuser5,exec""" # Setup the database connection conn = psycopg2.connect(dbname=sys.argv[1],host='127.0.0.1',port=int(sys.argv[2])) cur = conn.cursor() # Prepare the data for the roles table rows = data.sp...
null
sql/do_inserts.py
do_inserts.py
py
866
python
en
code
null
code-starcoder2
66
[ { "api_name": "psycopg2.connect", "line_number": 8, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 8, "usage_type": "attribute" } ]
77679911
from handlerframe import get,post,parse_post_params,getQueryString,APIError,APIValueError,Page from model import next_id,Blog,User,Comment import time, re, hashlib, json from aiohttp import web from cookieutil import COOKIE_NAME,MAX_AGE,COOKIE_KEY,user2cookie @get('/') async def index(request): blogs = await Blog....
null
awesomeblog/www/handlers.py
handlers.py
py
11,384
python
en
code
null
code-starcoder2
66
[ { "api_name": "model.Blog.sql_select", "line_number": 9, "usage_type": "call" }, { "api_name": "model.Blog", "line_number": 9, "usage_type": "name" }, { "api_name": "handlerframe.get", "line_number": 7, "usage_type": "call" }, { "api_name": "model.Blog.find", ...
418772896
''' Created on 03/05/2012 Este codigo es parte de Marcos -- ERP Software Copyright (C) 2012 Eneldo Antonio Serrata Peralta. All rights reserved. Marcos 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 ver...
null
marcos/views.py
views.py
py
1,534
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.shortcuts.render_to_response", "line_number": 33, "usage_type": "call" }, { "api_name": "django.template.context.RequestContext", "line_number": 33, "usage_type": "call" }, { "api_name": "django.contrib.auth.views.logout", "line_number": 35, "usage_t...
255300685
#coding:utf-8 from matplotlib import pyplot as plt import numpy as np import matplotlib.animation as animation fig,ax=plt.subplots() X=np.linspace(-2*np.pi,2*np.pi,1000,endpoint=True) y1=np.sin(X) y2=np.cos(X) line,=plt.plot(X,y1,color='r',linestyle='--',linewidth=2,alpha=0.2,label='sin') #label表示添加标签 plt.plot(X,y2,col...
null
python/SMS/word.py
word.py
py
1,475
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.pyplot.subplots", "line_number": 5, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 5, "usage_type": "name" }, { "api_name": "numpy.linspace", "line_number": 6, "usage_type": "call" }, { "api_name": "numpy.pi", ...
282095473
# Licensed under a 3-clause BSD style license - see LICENSE.rst from numpy.testing import assert_allclose import numpy as np import pytest from astropy import units as u from astropy.coordinates import SkyCoord from astropy.tests.helper import assert_quantity_allclose from astropy.utils.data import get_pkg_data_filena...
null
regions/shapes/tests/test_line.py
test_line.py
py
3,785
python
en
code
null
code-starcoder2
66
[ { "api_name": "astropy.utils.data.get_pkg_data_filename", "line_number": 22, "usage_type": "call" }, { "api_name": "astropy.io.fits.getheader", "line_number": 23, "usage_type": "call" }, { "api_name": "astropy.io.fits", "line_number": 23, "usage_type": "name" }, { ...
79463733
from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit, Button class AddLinkForm(forms.Form): link = forms.CharField() helper = FormHelper() helper.form_action = '/links/getmytags' helper.form_method = 'GET' helper.add_input(Submit('Add link', 'A...
null
links_everywhere/forms.py
forms.py
py
609
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.forms.Form", "line_number": 6, "usage_type": "attribute" }, { "api_name": "django.forms", "line_number": 6, "usage_type": "name" }, { "api_name": "django.forms.CharField", "line_number": 7, "usage_type": "call" }, { "api_name": "django.forms"...
218287450
""" Kwic Trader trading system Created by: Robert (Alex) Spangler Plant City, FL, USA Spring of 2021 """ """ NOTE: cerebro.plot() only works with matplotlib 3.2.0 be sure to have this version installed. """ import backtrader as bt import alpaca_backtrader_api as api import pandas as pd import environmentVars import da...
null
backTest.py
backTest.py
py
4,507
python
en
code
null
code-starcoder2
66
[ { "api_name": "environmentVars.API_KEY", "line_number": 45, "usage_type": "attribute" }, { "api_name": "environmentVars.SECRET_KEY", "line_number": 46, "usage_type": "attribute" }, { "api_name": "backtrader.SignalStrategy", "line_number": 51, "usage_type": "attribute" }...
95397598
#!/usr/bin/env python3 '''Current state: Main.py creates two csvs - stats.csv and games.csv. These feed into the Jupyter Notebook. The jupyter notebook is good to go. Need to update the loop below so it will loop through the entire season.''' # Importing required modules import time import requests import os impor...
null
main.py
main.py
py
2,811
python
en
code
null
code-starcoder2
66
[ { "api_name": "selenium.webdriver.Firefox", "line_number": 25, "usage_type": "call" }, { "api_name": "selenium.webdriver", "line_number": 25, "usage_type": "name" }, { "api_name": "pandas.DataFrame", "line_number": 26, "usage_type": "call" }, { "api_name": "player...
272607254
import os from bs4 import BeautifulSoup #first bulk: [5:9] fix1 = ['viktor', 'kaisa'] # [7:11] fix2 = ['ahri', 'anivia', 'annie', 'aphelios', 'ashe', 'aurelionsol', 'azir', 'blitzcrank', 'brand', 'caitlyn', 'corki', 'draven', 'elise', 'graves', 'heimerdinger', 'jhin', 'jinx', 'kalista', 'karma', 'karthus', 'kassadin',...
null
aram/aram.py
aram.py
py
26,466
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path", "line_number": 19, "usage_type": "attribute" }, { "api_name": "bs4.BeautifulSoup", "line_number": 21, "usage_type": "call" } ]
47617964
#!/usr/bin/env python3 # # * -------------------------------------------------------------------------- # * Licensed under MIT (https://git.biohpc.swmed.edu/BICF/Astrocyte/chipseq_analysis/LICENSE.md) # * -------------------------------------------------------------------------- # '''Trim low quality reads and remove...
null
workflow/scripts/trim_reads.py
trim_reads.py
py
4,451
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 24, "usage_type": "call" }, { "api_name": "logging.NullHandler", "line_number": 25, "usage_type": "call" }, { "api_name": "logging.INFO", "line_number": 27, "usage_type": "attribute" }, { "api_name": "argparse.Argu...
225417507
import utils # Main method def main(): url = utils.get_url() output_path = utils.get_output_path() audio_only = utils.get_audio_only() if not audio_only: video_quality = utils.get_stream_quality() if audio_only: stream_list = utils.list_streams(url, audio_only) if not stre...
null
main.py
main.py
py
1,879
python
en
code
null
code-starcoder2
66
[ { "api_name": "utils.get_url", "line_number": 5, "usage_type": "call" }, { "api_name": "utils.get_output_path", "line_number": 6, "usage_type": "call" }, { "api_name": "utils.get_audio_only", "line_number": 7, "usage_type": "call" }, { "api_name": "utils.get_strea...
535455479
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import settings class BaselineModel(nn.Module): def __init__(self, **kwargs): """ Initialize new baseline model. :keyword argument: hidden_size: int, number of hitten units. """...
null
models.py
models.py
py
3,957
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.nn.Module", "line_number": 9, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 9, "usage_type": "name" }, { "api_name": "torch.nn.RNN", "line_number": 19, "usage_type": "call" }, { "api_name": "torch.nn", "line_number"...
433841796
from PySide2 import QtCore, QtGui, QtWidgets from shiboken2 import wrapInstance from maya import OpenMayaUI as omui import pymel.core as pm import pprint def getNamespaces(): '''Return the root namespace and all namespace that are direct child of root.''' currentNamespace = pm.namespaceInfo(curre...
null
rendering/remapMat/listClashingNames.py
listClashingNames.py
py
3,212
python
en
code
null
code-starcoder2
66
[ { "api_name": "pymel.core.namespaceInfo", "line_number": 11, "usage_type": "call" }, { "api_name": "pymel.core", "line_number": 11, "usage_type": "name" }, { "api_name": "pymel.core.namespace", "line_number": 12, "usage_type": "call" }, { "api_name": "pymel.core",...
124670699
import locale import re from html.parser import HTMLParser import feedparser import database from datetime import datetime class FeedParser: unique_field = "id" locale.setlocale(locale.LC_ALL, "de_DE") TAG_RE = re.compile(r'<[^>]+>') hp = HTMLParser() dateHandler = None def __init__(self, co...
null
FeedParser.py
FeedParser.py
py
1,784
python
en
code
null
code-starcoder2
66
[ { "api_name": "locale.setlocale", "line_number": 12, "usage_type": "call" }, { "api_name": "locale.LC_ALL", "line_number": 12, "usage_type": "attribute" }, { "api_name": "re.compile", "line_number": 13, "usage_type": "call" }, { "api_name": "html.parser.HTMLParser...
101524149
import socket import win32api import win32com import win32con import win32com.client import time from timeit import Timer import argparse import pyautogui def click(x, y): win32api.SetCursorPos((x, y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP...
null
psionic.py
psionic.py
py
5,001
python
en
code
null
code-starcoder2
66
[ { "api_name": "win32api.SetCursorPos", "line_number": 14, "usage_type": "call" }, { "api_name": "win32api.mouse_event", "line_number": 15, "usage_type": "call" }, { "api_name": "win32con.MOUSEEVENTF_LEFTDOWN", "line_number": 15, "usage_type": "attribute" }, { "api...
435707816
import pandas as pd import numpy as np import collections import itertools from sklearn import metrics from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt # ================= # Utility functions # ================= def readin(filepath): df = pd.read_csv(filepath, header=None) ...
null
assignment1/q2/q2_ref.py
q2_ref.py
py
14,287
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.eye", "line_number": 19, "usage_type": "call" }, { "api_name": "numpy.maximum", "line_number": 23, "usage_type": "call" }, { "api_name": "numpy.where", "line_numbe...
627432605
import matplotlib import pandas as pd import numpy as np import matplotlib.pyplot as plt # Matlab-style plotting import seaborn as sns color = sns.color_palette() sns.set_style('darkgrid') import warnings def ignore_warn(*args, **kwargs): pass warnings.warn = ignore_warn # ignore annoying warning (from sklea...
null
src/__init__.py
__init__.py
py
6,445
python
en
code
null
code-starcoder2
66
[ { "api_name": "seaborn.color_palette", "line_number": 7, "usage_type": "call" }, { "api_name": "seaborn.set_style", "line_number": 8, "usage_type": "call" }, { "api_name": "warnings.warn", "line_number": 16, "usage_type": "attribute" }, { "api_name": "warnings.fil...