code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python
# http://stackoverflow.com/questions/9111711/get-coordinates-of-local-maxima-in-2d-array-above-certain-value
import numpy as np
from osgeo import gdal
import scipy.ndimage as ndimage
import scipy.ndimage.filters as filters
# initialize driver
driver = gdal.GetDriverByName('GTiff')
def write_imag... | [
"scipy.ndimage.filters.minimum_filter",
"scipy.ndimage.filters.maximum_filter",
"osgeo.gdal.Open",
"osgeo.gdal.GetDriverByName"
] | [((275, 304), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""GTiff"""'], {}), "('GTiff')\n", (295, 304), False, 'from osgeo import gdal\n'), ((644, 688), 'osgeo.gdal.Open', 'gdal.Open', (['"""img/mozambique-after-subset.tif"""'], {}), "('img/mozambique-after-subset.tif')\n", (653, 688), False, 'from osgeo ... |
import csv
import json
import multiprocessing as mp
import os
import random
import signal
import string
import sys
import traceback
from datetime import datetime, timedelta
from itertools import repeat
import nest_asyncio
import numpy as np
from cate.core import DATA_STORE_REGISTRY, ds
from cate.core.ds import DataAcc... | [
"os.mkdir",
"os.remove",
"numpy.sum",
"random.choices",
"os.path.isfile",
"sys.exc_info",
"csv.DictWriter",
"multiprocessing.cpu_count",
"cate.core.ds.open_dataset",
"os.path.exists",
"datetime.timedelta",
"traceback.format_exc",
"cate.core.DATA_STORE_REGISTRY.get_data_store",
"signal.alar... | [((330, 350), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (348, 350), False, 'import nest_asyncio\n'), ((3313, 3357), 'signal.signal', 'signal.signal', (['signal.SIGALRM', 'alarm_handler'], {}), '(signal.SIGALRM, alarm_handler)\n', (3326, 3357), False, 'import signal\n'), ((3362, 3388), 'signal.alarm'... |
from typing import Optional, Union
import sqlalchemy as sa
from sqlalchemy.engine.result import RowProxy
from database import db, metadata
from .base import BaseModelInterface
__all__ = (
'Account',
'accounts',
'ActiveAccount',
'active_account',
)
active_account = sa.Table(
'active_account',
... | [
"sqlalchemy.insert",
"sqlalchemy.ForeignKey",
"sqlalchemy.update",
"sqlalchemy.Column",
"sqlalchemy.String",
"sqlalchemy.sql.select"
] | [((461, 506), 'sqlalchemy.Column', 'sa.Column', (['"""id"""', 'sa.Integer'], {'primary_key': '(True)'}), "('id', sa.Integer, primary_key=True)\n", (470, 506), True, 'import sqlalchemy as sa\n'), ((647, 708), 'sqlalchemy.Column', 'sa.Column', (['"""credentials_verification"""', 'sa.JSON'], {'nullable': '(True)'}), "('cr... |
__author__ = 'achamseddine'
from django.core.management.base import BaseCommand
from internos.activityinfo.tasks import import_data_and_generate_live_crisis_report
class Command(BaseCommand):
help = 'import_data_and_generate_live_crisis_report'
def add_arguments(self, parser):
parser.add_argument('-... | [
"internos.activityinfo.tasks.import_data_and_generate_live_crisis_report"
] | [((395, 459), 'internos.activityinfo.tasks.import_data_and_generate_live_crisis_report', 'import_data_and_generate_live_crisis_report', (["options['database']"], {}), "(options['database'])\n", (438, 459), False, 'from internos.activityinfo.tasks import import_data_and_generate_live_crisis_report\n')] |
from django.db import models
from django.conf import settings
from workprogramsapp.models import WorkProgram
class FeedbackRecord(models.Model):
'''
Модель записи обратной связи к РПД
'''
types = [
('wish', 'wish'),
('comment', 'comment'),
('claim', 'claim')
]
type = mo... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.ForeignKey"
] | [((318, 416), 'django.db.models.CharField', 'models.CharField', ([], {'choices': 'types', 'default': '"""1"""', 'max_length': '(1024)', 'verbose_name': '"""Тип комментария"""'}), "(choices=types, default='1', max_length=1024, verbose_name=\n 'Тип комментария')\n", (334, 416), False, 'from django.db import models\n')... |
from locust import TaskSet, task, HttpLocust
class ApiClientBehavior(TaskSet):
"""
The @task decorator declares a locust task.
The argument passed the task decorator determines
the relative frequency with which the task
will be spawned within a swarm. For example
a task with a relative frequenc... | [
"locust.task"
] | [((420, 427), 'locust.task', 'task', (['(1)'], {}), '(1)\n', (424, 427), False, 'from locust import TaskSet, task, HttpLocust\n'), ((1014, 1021), 'locust.task', 'task', (['(2)'], {}), '(2)\n', (1018, 1021), False, 'from locust import TaskSet, task, HttpLocust\n')] |
#####################################################################
#####################################################################
# #
# File: OverviewCanvas.py #
# Date: 05-May-2006 ... | [
"Tkinter.Label",
"os.path.join",
"Tkinter.PhotoImage"
] | [((994, 1380), 'Tkinter.Label', 'Tkinter.Label', (['text'], {'bg': '"""white"""', 'justify': '"""left"""', 'wraplength': "text['width']", 'text': '"""CDAT makes use of an open-source, object-oriented, easy-to-learn scripting language (Python) to link together separate software subsystems and packages to form an integra... |
import tensorflow as tf
PATH = "/home/newcomer/Desktop/tensorfun/"
SAVE_PATH = "/home/newcomer/Desktop/tensorfun/train"
feature_names = [
'Elo',
'Pts_div_pld',
'GfA',
'GaA']
def m_input_fn(FILE):
def get_line(line):
line = tf.decode_csv(line, [[0.], [0.], [0], [0.], [0.]])
return dict(zip(featu... | [
"tensorflow.data.TextLineDataset",
"tensorflow.decode_csv",
"tensorflow.estimator.DNNClassifier",
"tensorflow.feature_column.numeric_column"
] | [((726, 847), 'tensorflow.estimator.DNNClassifier', 'tf.estimator.DNNClassifier', ([], {'feature_columns': 'feature_columns', 'hidden_units': '[10, 10]', 'n_classes': '(3)', 'model_dir': 'SAVE_PATH'}), '(feature_columns=feature_columns, hidden_units=[\n 10, 10], n_classes=3, model_dir=SAVE_PATH)\n', (752, 847), True... |
import numpy as np
import pandas as pd
from perceptron import MLP
import seaborn as sns
import matplotlib.pyplot as plt
if __name__ == "__main__":
# create a dataset to train and test a network
x_train = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
y_train = np.array([[1, 0, 0, ... | [
"pandas.DataFrame",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"numpy.array",
"pandas.melt",
"perceptron.MLP",
"pandas.concat",
"matplotlib.pyplot.savefig"
] | [((219, 285), 'numpy.array', 'np.array', (['[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]'], {}), '([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])\n', (227, 285), True, 'import numpy as np\n'), ((300, 366), 'numpy.array', 'np.array', (['[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]'], {... |
import json
import sys
import os.path
import urllib.request
print('\033[95m################################################')
print('Open this python file in your directory for the SKLauncher Mods!')
print('################################################')
if len(sys.argv) == 1:
print('\033[91m[FATAL] You did n... | [
"json.load"
] | [((576, 596), 'json.load', 'json.load', (['json_data'], {}), '(json_data)\n', (585, 596), False, 'import json\n')] |
# -*- coding: utf-8 -*-
"""Report data namespace
Return data optimized for reports implemented in the Reporter
blueprint for consumption by external systems.
"""
from flask import request
from flask_restx import Namespace, Resource
from AIPscan.API import fields
from AIPscan.Data import report_data
from AIPscan.hel... | [
"AIPscan.Data.report_data.agents_transfers",
"flask.request.args.get",
"AIPscan.Data.report_data.storage_locations",
"AIPscan.Data.report_data.largest_files",
"AIPscan.Data.report_data.aips_by_file_format",
"AIPscan.Data.report_data.aips_by_puid",
"flask_restx.Namespace",
"AIPscan.Data.report_data.for... | [((372, 460), 'flask_restx.Namespace', 'Namespace', (['"""report-data"""'], {'description': '"""Retrieve data optimized for AIPscan reports"""'}), "('report-data', description=\n 'Retrieve data optimized for AIPscan reports')\n", (381, 460), False, 'from flask_restx import Namespace, Resource\n'), ((1538, 1585), 'fl... |
import cv2
o = cv2.imread("Sobel4.bmp", cv2.IMREAD_GRAYSCALE)
Scharrx = cv2.Scharr(o, cv2.CV_64F, 1, 0)
Scharrx = cv2.convertScaleAbs(Scharrx)
cv2.imshow("original", o)
cv2.imshow("x", Scharrx)
cv2.waitKey()
cv2.destroyAllWindows()
| [
"cv2.Scharr",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread",
"cv2.convertScaleAbs",
"cv2.imshow"
] | [((16, 62), 'cv2.imread', 'cv2.imread', (['"""Sobel4.bmp"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('Sobel4.bmp', cv2.IMREAD_GRAYSCALE)\n", (26, 62), False, 'import cv2\n'), ((73, 104), 'cv2.Scharr', 'cv2.Scharr', (['o', 'cv2.CV_64F', '(1)', '(0)'], {}), '(o, cv2.CV_64F, 1, 0)\n', (83, 104), False, 'import cv2\n'), ((115, 14... |
import requests, re, bs4, pprint
html = requests.get('https://www.cnnindonesia.com/').text
soup = bs4.BeautifulSoup(html, 'html.parser')
daftar_berita = []
for article in soup.find_all('div', class_='list media_rows')[2].find_all('article'):
link = article.a.attrs['href']
judul = article.find('span', class_='... | [
"bs4.BeautifulSoup",
"pprint.pprint",
"requests.get"
] | [((99, 137), 'bs4.BeautifulSoup', 'bs4.BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (116, 137), False, 'import requests, re, bs4, pprint\n'), ((509, 537), 'pprint.pprint', 'pprint.pprint', (['daftar_berita'], {}), '(daftar_berita)\n', (522, 537), False, 'import requests, re, bs4, ppri... |
from django import forms
from hut.models import Huts
class AddHutForm(forms.ModelForm):
class Meta:
model = Huts
fields = '__all__'
labels = {
'hutname': '',
'image': '',
'altitude': '',
'mountain': '',
'people_capacity': '',
... | [
"django.forms.NumberInput",
"django.forms.TextInput",
"django.forms.FileInput"
] | [((419, 493), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control', 'placeholder': 'Hutname'}"}), "(attrs={'class': 'form-control', 'placeholder': 'Hutname'})\n", (434, 493), False, 'from django import forms\n'), ((562, 634), 'django.forms.FileInput', 'forms.FileInput', ([], {'attrs': "... |
# -*- coding: utf-8 -*-
__author__ = '<NAME> and <NAME>'
__copyright__ = 'Copyright 2020, The arXivDigest project'
import datetime
import gzip
from functools import wraps
from uuid import uuid4
import jwt
from flask import g
from flask import make_response
from flask import redirect
from flask import request
from fla... | [
"uuid.uuid4",
"arxivdigest.core.mail.mail_server.MailServer",
"arxivdigest.frontend.database.general.is_activated",
"arxivdigest.frontend.database.general.get_systems",
"arxivdigest.frontend.database.general.add_activate_trace",
"arxivdigest.frontend.database.admin.isAdmin",
"jwt.encode",
"datetime.da... | [((722, 730), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (727, 730), False, 'from functools import wraps\n'), ((2906, 2921), 'flask.make_response', 'make_response', ([], {}), '()\n', (2919, 2921), False, 'from flask import make_response\n'), ((3185, 3211), 'arxivdigest.core.mail.mail_server.MailServer', 'MailSer... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import date
import pdfkit
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db.models import Sum
from django.http import Ht... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"django.urls.reverse",
"facturacion.forms.ProductoBaseForm"
] | [((913, 979), 'django.shortcuts.render', 'render', (['request', '"""facturacion/productos-base/listar.html"""', 'context'], {}), "(request, 'facturacion/productos-base/listar.html', context)\n", (919, 979), False, 'from django.shortcuts import get_object_or_404, redirect, render\n'), ((1417, 1481), 'django.shortcuts.re... |
# Generated by Django 2.1.7 on 2019-10-08 05:03
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('design', '0023_auto_20191001_0046'),
]
operations = [
... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DecimalField"
] | [((1316, 1380), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""productpriceapi"""', 'name': '"""buy"""'}), "(model_name='productpriceapi', name='buy')\n", (1338, 1380), False, 'from django.db import migrations, models\n'), ((1425, 1490), 'django.db.migrations.RemoveField', 'migrat... |
import unittest
from hustle.core.column_fn import ip_ntoa
from hustle.core.pipeline import SelectPipe, _get_sort_range
from hustle.core.marble import Marble
from operator import itemgetter
EMP_FIELDS = ("+@2id", "+$name", "+%2hire_date", "+@4salary", "+@2department_id")
DEPT_FIELDS = ("+@2id", "+%2name", "+%2building... | [
"hustle.core.pipeline.SelectPipe",
"hustle.core.pipeline._get_sort_range",
"hustle.core.column_fn.ip_ntoa",
"operator.itemgetter",
"hustle.core.marble.Marble"
] | [((378, 391), 'operator.itemgetter', 'itemgetter', (['(0)'], {}), '(0)\n', (388, 391), False, 'from operator import itemgetter\n'), ((474, 487), 'operator.itemgetter', 'itemgetter', (['(1)'], {}), '(1)\n', (484, 487), False, 'from operator import itemgetter\n'), ((612, 654), 'hustle.core.marble.Marble', 'Marble', ([], ... |
from __future__ import print_function, absolute_import, division # makes these scripts backward compatible with python 2.6 and 2.7
# Importing the base class
from co_simulation_base_io import CoSimulationBaseIO
# Other imports
import numpy as np
import co_simulation_tools as cs_tools
def Create(solvers, solver_name... | [
"co_simulation_tools.ImportArrayFromSolver",
"numpy.array"
] | [((586, 598), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (594, 598), True, 'import numpy as np\n'), ((607, 673), 'co_simulation_tools.ImportArrayFromSolver', 'cs_tools.ImportArrayFromSolver', (['from_client', 'data_name', 'data_array'], {}), '(from_client, data_name, data_array)\n', (637, 673), True, 'import co... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 26 18:42 2020
@author: <NAME>
PLASMON Data Analysis
Setup code
This piece of code allows you to compile PLASMON to an .exe
----------------------------
v0.1: Full setup: 26/07/2020
v0.2: minor changes
v0.2.1: trying to get lower file size, no progress
v0.3: adding in ... | [
"cx_Freeze.Executable",
"os.path.dirname",
"os.path.join",
"os.path.realpath"
] | [((868, 917), 'os.path.join', 'os.path.join', (['PYTHON_INSTALL_DIR', '"""tcl"""', '"""tcl8.6"""'], {}), "(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')\n", (880, 917), False, 'import os\n'), ((949, 997), 'os.path.join', 'os.path.join', (['PYTHON_INSTALL_DIR', '"""tcl"""', '"""tk8.6"""'], {}), "(PYTHON_INSTALL_DIR, 'tcl', 'tk8.... |
import json
import pytest
from fastapi import status
from app.factories import ArxivQueryFactory, PaperFactory
from app.models import ArxivQueryModel, PaperModel
from app.response.arxiv_query import ArxivQuery, ArxivQueryGetOut
class TestArxivQueryPost():
def test_save_arxiv_query(self, app_client, db_session):... | [
"app.factories.PaperFactory.build_batch",
"app.response.arxiv_query.ArxivQuery",
"app.response.arxiv_query.ArxivQueryGetOut",
"pytest.mark.parametrize",
"app.factories.ArxivQueryFactory"
] | [((1826, 1882), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""init_is_active"""', '[True, False]'], {}), "('init_is_active', [True, False])\n", (1849, 1882), False, 'import pytest\n'), ((1237, 1280), 'app.factories.ArxivQueryFactory', 'ArxivQueryFactory', ([], {'arxiv_query': 'target_query'}), '(arxiv_que... |
import os
# GUI
import tkinter as tk
from tkinter import messagebox
from tkinter import font
from tkinter.constants import MULTIPLE
from PIL import Image, ImageTk
class Application(tk.Frame):
def __init__(self, logger, mep, master=None):
self.logger = logger
self.mep = mep
# Window init
... | [
"tkinter.StringVar",
"tkinter.Checkbutton",
"PIL.ImageTk.PhotoImage",
"tkinter.Canvas",
"tkinter.Button",
"tkinter.Entry",
"tkinter.messagebox.showwarning",
"tkinter.font.Font",
"tkinter.Scrollbar",
"PIL.Image.open",
"tkinter.BooleanVar",
"tkinter.Frame",
"tkinter.messagebox.askyesno",
"tk... | [((647, 722), 'tkinter.font.Font', 'tk.font.Font', ([], {'family': 'TITLE_FONT_NAME', 'size': 'TITLE_FONT_SIZE', 'weight': '"""normal"""'}), "(family=TITLE_FONT_NAME, size=TITLE_FONT_SIZE, weight='normal')\n", (659, 722), True, 'import tkinter as tk\n'), ((749, 824), 'tkinter.font.Font', 'tk.font.Font', ([], {'family':... |
#!/usr/bin/env python3
"""
Module Docstring
"""
import praw
import pandas as pd
import wget
import pathlib
from pathlib import Path
import sys
import string
__author__ = "<NAME>"
__version__ = "0.1.0"
__license__ = "MIT"
def main():
# Get the current working directory of the script
current_dir = Path.cwd()
... | [
"pandas.DataFrame",
"pathlib.Path.cwd",
"praw.Reddit",
"pathlib.Path"
] | [((309, 319), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (317, 319), False, 'from pathlib import Path\n'), ((463, 563), 'praw.Reddit', 'praw.Reddit', ([], {'client_id': '"""YWdkCzRc9WGAGQ"""', 'client_secret': '"""<KEY>"""', 'user_agent': '"""Reddit_Map_Scraper"""'}), "(client_id='YWdkCzRc9WGAGQ', client_secret=... |
import operator
from collections import defaultdict
def get_value(registers, operand):
return registers[operand] if operand in registers else int(operand)
def handle_generic(op):
def inner(pc, registers, _, args):
registers[args[0]] = op(registers[args[0]], get_value(registers, args[1]))
ret... | [
"collections.defaultdict"
] | [((1438, 1461), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (1449, 1461), False, 'from collections import defaultdict\n')] |
import os
import pygame
# Background Image
bg = pygame.image.load(os.path.join(r'level_2/Utils/Pics/Background','bg.png'))
bg_x = 0
bg_width = bg.get_width() - 3 # Consequent background images overlap by 3 pixels
background_speed = 2 # Background shifts by 2 pixels in each game loop
def draw_bg(win):
global bg_x,... | [
"os.path.join"
] | [((67, 122), 'os.path.join', 'os.path.join', (['"""level_2/Utils/Pics/Background"""', '"""bg.png"""'], {}), "('level_2/Utils/Pics/Background', 'bg.png')\n", (79, 122), False, 'import os\n'), ((692, 748), 'os.path.join', 'os.path.join', (['"""level_2/Utils/Pics/Background"""', '"""bg2.png"""'], {}), "('level_2/Utils/Pic... |
from __future__ import unicode_literals, print_function
from jinja2 import FileSystemLoader, StrictUndefined
from jinja2.environment import Environment
from jinja2 import Template
# env = Environment()
# env.loader = FileSystemLoader('.')
env = Environment(undefined=StrictUndefined)
env.loader = FileSystemLoader('.')
... | [
"jinja2.FileSystemLoader",
"jinja2.environment.Environment"
] | [((246, 284), 'jinja2.environment.Environment', 'Environment', ([], {'undefined': 'StrictUndefined'}), '(undefined=StrictUndefined)\n', (257, 284), False, 'from jinja2.environment import Environment\n'), ((298, 319), 'jinja2.FileSystemLoader', 'FileSystemLoader', (['"""."""'], {}), "('.')\n", (314, 319), False, 'from j... |
"""Pitch Test Module"""
import unittest
from pitches.pitch import Pitch
from pitches.pitch_zone_enums import PitchNames
from pitches.test_config import TEST_ERR_DIST, TEST_ZONES
class TestPitchClass(unittest.TestCase):
"""Test Pitch class"""
def setUp(self):
self.pitch = Pitch(PitchNames.FOUR_SEAM.v... | [
"unittest.main",
"pitches.pitch.Pitch"
] | [((703, 718), 'unittest.main', 'unittest.main', ([], {}), '()\n', (716, 718), False, 'import unittest\n'), ((292, 352), 'pitches.pitch.Pitch', 'Pitch', (['PitchNames.FOUR_SEAM.value', 'TEST_ZONES', 'TEST_ERR_DIST'], {}), '(PitchNames.FOUR_SEAM.value, TEST_ZONES, TEST_ERR_DIST)\n', (297, 352), False, 'from pitches.pitch... |
#!/usr/bin/env python3
'''
providing logic for title selection and return URL through different
provided selectors
'''
from os import path
import json
import subprocess
import sys
class ReadTitles:
'''read titles through files and return corresponding URL'''
def __init__(self):
self.__bFilePath__ = ... | [
"json.load",
"os.path.expanduser",
"sys.exit"
] | [((320, 340), 'os.path.expanduser', 'path.expanduser', (['"""~"""'], {}), "('~')\n", (335, 340), False, 'from os import path\n'), ((510, 526), 'json.load', 'json.load', (['bfile'], {}), '(bfile)\n', (519, 526), False, 'import json\n'), ((1270, 1281), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (1278, 1281), False, ... |
import copy
import itertools
import seaborn as sns
import glob
import os
import math
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import imutils
import numpy as np
from pre_processing import Pre_Processing
import cv2
import scipy.special
import time
import matplotlib
vehicle_info = "vehicle_info"
... | [
"numpy.arctan2",
"cv2.bitwise_and",
"math.atan2",
"cv2.arcLength",
"cv2.boxPoints",
"cv2.minAreaRect",
"cv2.imshow",
"os.path.join",
"cv2.contourArea",
"numpy.zeros_like",
"cv2.cvtColor",
"os.path.exists",
"math.cos",
"pre_processing.Pre_Processing",
"cv2.destroyAllWindows",
"cv2.bound... | [((592, 608), 'pre_processing.Pre_Processing', 'Pre_Processing', ([], {}), '()\n', (606, 608), False, 'from pre_processing import Pre_Processing\n'), ((4137, 4148), 'time.time', 'time.time', ([], {}), '()\n', (4146, 4148), False, 'import time\n'), ((11776, 11787), 'time.time', 'time.time', ([], {}), '()\n', (11785, 117... |
__author__ = "<NAME> :: New Mexico Mira Project, Albuquerque"
""" Module 'astrosupport.stats'.
Numerous statistics and regression classes and functions.
Fork of (extract of) photrix.util, begun 2020-10-23.
Intentions: (1) a separate, importable module for use by all EVD astro python projects.
... | [
"pandas.DataFrame",
"math.sqrt",
"statsmodels.api.OLS",
"statsmodels.regression.mixed_linear_model.MixedLM.from_formula",
"pandas.merge",
"statsmodels.api.add_constant"
] | [((4824, 4894), 'statsmodels.regression.mixed_linear_model.MixedLM.from_formula', 'sm_mm.MixedLM.from_formula', (['formula'], {'groups': 'data[group_var]', 'data': 'data'}), '(formula, groups=data[group_var], data=data)\n', (4850, 4894), True, 'import statsmodels.regression.mixed_linear_model as sm_mm\n'), ((5487, 5525... |
import numpy as np
import math
class Aligner:
def __init__(self,coordFile):
self.coordFile=coordFile
self._natoms=0
self._symbols=[]
self._resids = []
self._atomids = []
self._resnames = []
self._x=[]
self._y=[]
self._z=[]
... | [
"numpy.argmax",
"numpy.cross",
"numpy.zeros",
"math.cosine",
"math.sine",
"numpy.linalg.norm",
"numpy.matmul",
"numpy.dot"
] | [((4770, 4799), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {'dtype': 'float'}), '((3, 3), dtype=float)\n', (4778, 4799), True, 'import numpy as np\n'), ((4807, 4836), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {'dtype': 'float'}), '((3, 3), dtype=float)\n', (4815, 4836), True, 'import numpy as np\n'), ((4842, 4871), 'numpy.z... |
# This file is part of the Reproducible and Reusable Data Analysis Workflow
# Server (flowServ).
#
# Copyright (C) 2019-2021 NYU.
#
# flowServ is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""Unit tests for the generic remote workflo... | [
"flowserv.tests.service.create_user",
"flowserv.tests.serialize.validate_run_handle",
"os.path.realpath",
"flowserv.tests.service.start_run",
"time.sleep",
"flowserv.config.Config",
"flowserv.service.local.LocalAPIFactory",
"flowserv.tests.service.create_workflow",
"flowserv.tests.service.create_gro... | [((814, 864), 'os.path.join', 'os.path.join', (['DIR', '"""../../.files/benchmark/remote"""'], {}), "(DIR, '../../.files/benchmark/remote')\n", (826, 864), False, 'import os\n'), ((2503, 2553), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""is_async"""', '[False, True]'], {}), "('is_async', [False, True])\... |
#!/usr/bin/env python3
"""
General wrapper to help create tasks.
"""
import random
import copy
from torch.utils.data import Dataset
from torch.utils.data._utils import collate
import learn2learn as l2l
class DataDescription(object):
"""
[[Source]](https://github.com/learnables/learn2learn/blob/master/lea... | [
"copy.deepcopy",
"learn2learn.data.MetaDataset"
] | [((3006, 3045), 'copy.deepcopy', 'copy.deepcopy', (['self.dataset_description'], {}), '(self.dataset_description)\n', (3019, 3045), False, 'import copy\n'), ((2245, 2274), 'learn2learn.data.MetaDataset', 'l2l.data.MetaDataset', (['dataset'], {}), '(dataset)\n', (2265, 2274), True, 'import learn2learn as l2l\n')] |
"""Test the reset password process using flask's test_client()."""
from flask import url_for, get_flashed_messages
from flask_login import current_user
def test_200(client):
"""Check the password reset view should always return a 200."""
response = client.get("/auth/reset")
assert "200" in response.stat... | [
"flask.get_flashed_messages",
"run.mail.record_messages",
"flask.url_for",
"run.models.User.query.first"
] | [((1029, 1085), 'flask.url_for', 'url_for', (['"""auth.password_reset"""'], {'token': '""""""', '_external': '(True)'}), "('auth.password_reset', token='', _external=True)\n", (1036, 1085), False, 'from flask import url_for, get_flashed_messages\n'), ((822, 858), 'flask.url_for', 'url_for', (['"""main.home"""'], {'_ext... |
from unittest import mock
import grpc
import pytest
from descarteslabs.common.retry import Retry
from .. import GrpcClient
class FakeRpcError(grpc.RpcError):
def __init__(self, message, code):
self._code = code
def code(self):
return self._code
@mock.patch("descarteslabs.client.grpc.Grpc... | [
"unittest.mock.patch.object",
"descarteslabs.common.retry.Retry",
"unittest.mock.Mock",
"unittest.mock.patch",
"pytest.raises"
] | [((278, 342), 'unittest.mock.patch', 'mock.patch', (['"""descarteslabs.client.grpc.GrpcClient._populate_api"""'], {}), "('descarteslabs.client.grpc.GrpcClient._populate_api')\n", (288, 342), False, 'from unittest import mock\n'), ((344, 418), 'unittest.mock.patch', 'mock.patch', (['"""descarteslabs.common.proto.health.... |
from twilio.rest import Client
import os
class SmsSender:
client = Client(os.environ['TWILIO_ACCOUNT_SID'], os.environ['TWILIO_AUTH_TOKEN'])
@classmethod
def send_to_user(cls, phone, message):
response = cls.client.messages.create(
from_=os.environ['TWILIO_PHONE_NUMBER'],
... | [
"twilio.rest.Client"
] | [((73, 146), 'twilio.rest.Client', 'Client', (["os.environ['TWILIO_ACCOUNT_SID']", "os.environ['TWILIO_AUTH_TOKEN']"], {}), "(os.environ['TWILIO_ACCOUNT_SID'], os.environ['TWILIO_AUTH_TOKEN'])\n", (79, 146), False, 'from twilio.rest import Client\n')] |
import json
def most_spoken_languages(filename, countries):
languages = {}
with open(filename, encoding='UTF-8') as file:
r = json.load(file)
for i in r:
for language in i['languages']:
if language not in languages:
languages[language] = 1
... | [
"json.load"
] | [((143, 158), 'json.load', 'json.load', (['file'], {}), '(file)\n', (152, 158), False, 'import json\n')] |
# Generated by Django 3.0.4 on 2020-03-23 02:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0007_auto_20200323_0246'),
]
operations = [
migrations.AlterField(
model_name='padata',
name='current_ptc',
... | [
"django.db.models.FloatField"
] | [((337, 405), 'django.db.models.FloatField', 'models.FloatField', ([], {'blank': '(True)', 'null': '(True)', 'verbose_name': '"""Current PTC"""'}), "(blank=True, null=True, verbose_name='Current PTC')\n", (354, 405), False, 'from django.db import migrations, models\n'), ((531, 598), 'django.db.models.FloatField', 'mode... |
import logging
from pathlib import Path
from typing import BinaryIO, Callable, Dict, Iterable, NewType, Union, IO
import numpy
from absl import flags
from cv2.cv2 import IMREAD_COLOR, imdecode, cvtColor, COLOR_RGB2BGR
from injector import Binder, Module, inject, singleton
import ffmpeg
import subprocess
from rep0st.db... | [
"numpy.fromfile",
"numpy.frombuffer",
"absl.flags.DEFINE_string",
"pathlib.Path",
"cv2.cv2.imdecode",
"ffmpeg.input",
"typing.NewType",
"cv2.cv2.cvtColor",
"logging.getLogger"
] | [((351, 378), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (368, 378), False, 'import logging\n'), ((399, 504), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""rep0st_media_path"""', '""""""', '"""Path to media directory used by rep0st to save media."""'], {}), "('rep0st_media_... |
import datetime
import time
import pytz
from boto.dynamodb2.fields import HashKey, RangeKey, AllIndex
from boto.dynamodb2.table import Table
from boto.dynamodb2.types import NUMBER
AWS_REGION = "us-east-1"
TABLE_NAME = "21_carlton"
LOCAL_TIMEZONE = pytz.timezone("EST")
ENTRY_TYPE_HUMIDITY = "humidity"
ENTRY_TYPE_TE... | [
"boto.dynamodb2.fields.HashKey",
"pytz.utc.localize",
"pytz.timezone",
"datetime.datetime.fromtimestamp",
"boto.dynamodb2.fields.RangeKey",
"boto.dynamodb2.table.Table"
] | [((252, 272), 'pytz.timezone', 'pytz.timezone', (['"""EST"""'], {}), "('EST')\n", (265, 272), False, 'import pytz\n'), ((1849, 1896), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['self.timestamp'], {}), '(self.timestamp)\n', (1880, 1896), False, 'import datetime\n'), ((1916, 1945), 'pytz.utc.... |
from setuptools import setup, find_packages
import pathlib
here = pathlib.Path(__file__).parent.resolve()
long_description = (here / 'README.md').read_text(encoding='utf-8')
setup(
name='qMriMaps',
version='0.1',
description='qMriMaps',
long_description=long_description,
long_description_content_t... | [
"pathlib.Path",
"setuptools.find_packages"
] | [((666, 692), 'setuptools.find_packages', 'find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (679, 692), False, 'from setuptools import setup, find_packages\n'), ((67, 89), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (79, 89), False, 'import pathlib\n')] |
import enum
from sqlalchemy import (
Column,
Enum,
ForeignKey,
VARCHAR,
Integer,
TEXT
)
# local imports
from dnd.model.base import Base
class DndErrorType(enum.Enum):
INPUT_ERROR = enum.auto() # Err from input processing
GAME_ERROR = enum.auto() # Err from game mec... | [
"sqlalchemy.Enum",
"sqlalchemy.VARCHAR",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column",
"enum.auto"
] | [((211, 222), 'enum.auto', 'enum.auto', ([], {}), '()\n', (220, 222), False, 'import enum\n'), ((278, 289), 'enum.auto', 'enum.auto', ([], {}), '()\n', (287, 289), False, 'import enum\n'), ((350, 361), 'enum.auto', 'enum.auto', ([], {}), '()\n', (359, 361), False, 'import enum\n'), ((418, 429), 'enum.auto', 'enum.auto'... |
import pandas as pd
id = list()
user_id = list()
movie_id = list()
rating = list()
id_c = 1
for line in open("ratings.dat", "r"):
line = line.strip().split("::")
id.append(id_c)
id_c += 1
user_id.append(line[0].strip())
movie_id.append(line[1].strip())
rating.append(line[2].strip())
datafram... | [
"pandas.DataFrame"
] | [((324, 412), 'pandas.DataFrame', 'pd.DataFrame', (["{'id': id, 'user_id': user_id, 'movie_id': movie_id, 'rating': rating}"], {}), "({'id': id, 'user_id': user_id, 'movie_id': movie_id, 'rating':\n rating})\n", (336, 412), True, 'import pandas as pd\n')] |
import json
import redis
import credis
import types
from itertools import izip, chain
from nearpy.storage.storage import Storage
from nearpy.utils import chunk, ichunk
BUFFER_SIZE = 100000
class CRedisStorage(Storage):
""" Storage using credis. """
def __init__(self, host='localhost', port=6379, db=0, keyp... | [
"redis.Redis",
"credis.Connection",
"json.loads",
"nearpy.utils.ichunk",
"json.dumps",
"itertools.chain"
] | [((410, 449), 'credis.Connection', 'credis.Connection', ([], {'host': 'host', 'port': 'port'}), '(host=host, port=port)\n', (427, 449), False, 'import credis\n'), ((471, 511), 'redis.Redis', 'redis.Redis', ([], {'host': 'host', 'port': 'port', 'db': 'db'}), '(host=host, port=port, db=db)\n', (482, 511), False, 'import ... |
#!/usr/bin/env python
"""Test deprecated location of GoDagTimed"""
import os
import timeit
from goatools.test_data.godag_timed import GoDagTimed
from goatools.test_data.godag_timed import prt_hms
from goatools.base import download_go_basic_obo
REPO = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
def... | [
"os.path.abspath",
"timeit.default_timer",
"goatools.test_data.godag_timed.prt_hms",
"goatools.base.download_go_basic_obo",
"os.path.join",
"goatools.test_data.godag_timed.GoDagTimed"
] | [((413, 435), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (433, 435), False, 'import timeit\n'), ((440, 470), 'goatools.test_data.godag_timed.prt_hms', 'prt_hms', (['tic', '"""prt_hms TESTED"""'], {}), "(tic, 'prt_hms TESTED')\n", (447, 470), False, 'from goatools.test_data.godag_timed import prt_... |
import moeda
inteiro = int(input('digite um int: '))
floate = float(input('digite um float: '))
ia = moeda.aumentar(inteiro)
id = moeda.diminuir(inteiro)
ido = moeda.dobro(inteiro)
ime = moeda.metade(inteiro)
print(f' {inteiro}; aumenta = {ia} ;diminuir = {id} ; dobro = {ido} ; metade {ime}')
fa = moeda.aumentar(floa... | [
"moeda.metade",
"moeda.aumentar",
"moeda.dobro",
"moeda.diminuir"
] | [((103, 126), 'moeda.aumentar', 'moeda.aumentar', (['inteiro'], {}), '(inteiro)\n', (117, 126), False, 'import moeda\n'), ((132, 155), 'moeda.diminuir', 'moeda.diminuir', (['inteiro'], {}), '(inteiro)\n', (146, 155), False, 'import moeda\n'), ((162, 182), 'moeda.dobro', 'moeda.dobro', (['inteiro'], {}), '(inteiro)\n', ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @author : Feifei
# @IDE : Pycharm
# @file : deepcopy.py
# @time : 2019/5/31 10:50
from copy import deepcopy
hello_string = ['hEllo','woRld','!']
c_hello_string = deepcopy(hello_string)
del hello_string[-1]
l_hello = [h.replace('l','Y') for h in c_hello_st... | [
"copy.deepcopy"
] | [((227, 249), 'copy.deepcopy', 'deepcopy', (['hello_string'], {}), '(hello_string)\n', (235, 249), False, 'from copy import deepcopy\n')] |
# MIT License
# xlr8
# Copyright (c) 2022 Ethereal AI
#
# 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 use, copy, modify, me... | [
"sklearn.utils.check_random_state",
"sklearn.utils.extmath.randomized_range_finder",
"scipy.linalg.svd",
"sklearn.utils.extmath.svd_flip",
"sklearn.utils.extmath.safe_sparse_dot",
"numpy.dot"
] | [((11843, 11875), 'sklearn.utils.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n', (11861, 11875), False, 'from sklearn.utils import check_array, check_random_state\n'), ((12171, 12318), 'sklearn.utils.extmath.randomized_range_finder', 'randomized_range_finder', (['M'], {'size': 'n_... |
# Copyright (c) 2019 <NAME> <<EMAIL>>
# 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 applica... | [
"uuid.uuid4"
] | [((858, 870), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (868, 870), False, 'import uuid\n'), ((892, 904), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (902, 904), False, 'import uuid\n'), ((926, 938), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (936, 938), False, 'import uuid\n')] |
#!/usr/bin/python
# Copyright 2016 <NAME>, Inc. All rights reserved.
# Licensed under the Apache License, version 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
import os
from contextlib import contextmanager
@contextmanager
def pushd(path):
currentDir = os.getcwd()
os.chdir(path)
yield
os.chdir(c... | [
"os.getcwd",
"os.chdir"
] | [((265, 276), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (274, 276), False, 'import os\n'), ((281, 295), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (289, 295), False, 'import os\n'), ((310, 330), 'os.chdir', 'os.chdir', (['currentDir'], {}), '(currentDir)\n', (318, 330), False, 'import os\n')] |
from __future__ import unicode_literals
import datetime
import frappe
import frappe.defaults
import pprint
from Page import Page
pp = pprint.PrettyPrinter(indent=4)
class Trimming(Page):
def get_header(self):
res = self.get_sub_assemblies()
daily_reports = self.get_daily_reports()
avg = self.get_average("pa... | [
"pprint.PrettyPrinter",
"datetime.datetime.now",
"frappe.get_doc",
"frappe.get_all"
] | [((136, 166), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(4)'}), '(indent=4)\n', (156, 166), False, 'import pprint\n'), ((451, 474), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (472, 474), False, 'import datetime\n'), ((1669, 1713), 'frappe.get_all', 'frappe.get_all', (['""... |
#!/usr/bin/env python
# _*_coding:utf-8_*_
"""
@Project: Project4
@File : app.py
@Author : <NAME>
@Time : 2021/12/3
"""
import dash
from dash import dcc
from dash import html
from dash.dependencies import Input, Output, State
import pandas as pd
import numpy as np
from surprise import KNNBasic, Reader, Dataset
i... | [
"pandas.DataFrame",
"dash.html.H2",
"dash.Dash",
"numpy.average",
"surprise.Dataset.load_from_df",
"pandas.read_csv",
"surprise.Reader",
"warnings.filterwarnings",
"dash.html.Div",
"pandas.merge",
"dash.dependencies.State",
"dash.html.Button",
"dash.dcc.Tab",
"dash.dependencies.Input",
"... | [((335, 368), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (358, 368), False, 'import warnings\n'), ((5181, 5270), 'pandas.read_csv', 'pd.read_csv', (["(myurl + 'movies.dat?raw=true')"], {'header': 'None', 'sep': '"""::"""', 'encoding': '"""latin1"""'}), "(myurl + 'movie... |
#!/usr/bin/env python
"""Tests for `hex_api_integration` package."""
import os
import pytest
import sys
from hex_api_integration.geoapi_airbus.oneatlas import Api as GeoApi
if os.getenv('TEST_AIRBUS_API_KEY') is None:
sys.exit("Please define env TEST_AIRBUS_API_KEY for testing")
@pytest.fixture
def geo_api():... | [
"pytest.raises",
"os.path.exists",
"os.getenv",
"sys.exit"
] | [((180, 212), 'os.getenv', 'os.getenv', (['"""TEST_AIRBUS_API_KEY"""'], {}), "('TEST_AIRBUS_API_KEY')\n", (189, 212), False, 'import os\n'), ((226, 287), 'sys.exit', 'sys.exit', (['"""Please define env TEST_AIRBUS_API_KEY for testing"""'], {}), "('Please define env TEST_AIRBUS_API_KEY for testing')\n", (234, 287), Fals... |
from OSIM.Simulation.NetToComp import NetToComp
from OSIM.Modeling.CircuitSystemEquations import CircuitSystemEquations
from OSIM.Simulation.CircuitAnalysis.CircuitAnalyser import CircuitAnalyser
import numpy as np
seq = CircuitSystemEquations(NetToComp('GilberMixerEasy.net').getComponents())
ca = CircuitAnalyser(seq)... | [
"numpy.zeros",
"OSIM.Simulation.NetToComp.NetToComp",
"OSIM.Simulation.CircuitAnalysis.CircuitAnalyser.CircuitAnalyser",
"numpy.amax"
] | [((300, 320), 'OSIM.Simulation.CircuitAnalysis.CircuitAnalyser.CircuitAnalyser', 'CircuitAnalyser', (['seq'], {}), '(seq)\n', (315, 320), False, 'from OSIM.Simulation.CircuitAnalysis.CircuitAnalyser import CircuitAnalyser\n'), ((1206, 1254), 'numpy.zeros', 'np.zeros', (['(2, res[0].shape[1])'], {'dtype': 'np.float64'})... |
import numpy as np
def get_fuel_v1(mass):
return int(np.floor(mass / 3) - 2)
def get_fuel_v2(mass):
fuel = int(np.floor(mass / 3) - 2)
if fuel <= 0:
return 0
else:
return fuel + get_fuel_v2(fuel)
def load_inputs(filename):
with open(filename) as f:
return [int(line.strip()... | [
"numpy.floor"
] | [((58, 76), 'numpy.floor', 'np.floor', (['(mass / 3)'], {}), '(mass / 3)\n', (66, 76), True, 'import numpy as np\n'), ((121, 139), 'numpy.floor', 'np.floor', (['(mass / 3)'], {}), '(mass / 3)\n', (129, 139), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
'''
<NAME>, Ph.D.
<EMAIL>
www.reubotics.com
Apache 2 License
Software Revision E, 03/13/2022
Verified working on: Python 2.7, 3.8 for Windows 8.1, 10 64-bit and Raspberry Pi Buster (no Mac testing yet).
'''
__author__ = 'reuben.brewer'
import os, sys, platform
import time, d... | [
"sys.stdout.write",
"ctypes.WinDLL",
"threading.Thread",
"traceback.print_exc",
"os.getcwd",
"platform.uname",
"time.time",
"time.sleep",
"tkinter.font.nametofont",
"sys.exc_info",
"future.builtins.input",
"platform.system",
"inspect.stack",
"sys.exit"
] | [((1127, 1144), 'platform.system', 'platform.system', ([], {}), '()\n', (1142, 1144), False, 'import platform\n'), ((1191, 1213), 'ctypes.WinDLL', 'ctypes.WinDLL', (['"""winmm"""'], {}), "('winmm')\n", (1204, 1213), False, 'import ctypes\n'), ((43868, 43879), 'time.time', 'time.time', ([], {}), '()\n', (43877, 43879), ... |
from django.contrib import admin
from django.contrib.admin import helpers
from django.contrib.admin.options import IS_POPUP_VAR, csrf_protect_m
from django.contrib.auth.admin import UserAdmin
from django.forms.forms import NON_FIELD_ERRORS
from django.utils.translation import ugettext_lazy as _
from django.utils.encodi... | [
"django.contrib.admin.site.register"
] | [((732, 772), 'django.contrib.admin.site.register', 'admin.site.register', (['Follow', 'FollowAdmin'], {}), '(Follow, FollowAdmin)\n', (751, 772), False, 'from django.contrib import admin\n'), ((773, 810), 'django.contrib.admin.site.register', 'admin.site.register', (['Like', 'LikesAdmin'], {}), '(Like, LikesAdmin)\n',... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# Copyright 2010 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/LICEN... | [
"googleapis.codegen.api.Api",
"os.path.dirname",
"google.apputils.basetest.main"
] | [((2608, 2623), 'google.apputils.basetest.main', 'basetest.main', ([], {}), '()\n', (2621, 2623), False, 'from google.apputils import basetest\n'), ((1271, 1293), 'googleapis.codegen.api.Api', 'api.Api', (['discovery_doc'], {}), '(discovery_doc)\n', (1278, 1293), False, 'from googleapis.codegen import api\n'), ((1149, ... |
import json
from urllib.request import urlopen
def getjson(url):
return json.loads(urlopen(url).read().decode("utf-8"))
def search(keyword):
result = getjson("https://api.duckduckgo.com/?q="+keyword+"&format=json")
results = []
for key in result["RelatedTopics"]:
if "Result" in key:
resu... | [
"urllib.request.urlopen"
] | [((88, 100), 'urllib.request.urlopen', 'urlopen', (['url'], {}), '(url)\n', (95, 100), False, 'from urllib.request import urlopen\n')] |
import json
import hashlib
from datetime import datetime
from urllib.parse import urlparse
import logging
log = logging.info
# /!\ dict values should be kept unique for sanity
HASH_PREFIXES = {
'url': 'u',
'group': 'g',
'check': 'c',
'webhook': 'w',
}
def data_from_request(request):
"""Return a... | [
"datetime.datetime.strptime",
"json.loads",
"urllib.parse.urlparse"
] | [((483, 506), 'json.loads', 'json.loads', (["(raw or '{}')"], {}), "(raw or '{}')\n", (493, 506), False, 'import json\n'), ((3431, 3492), 'datetime.datetime.strptime', 'datetime.strptime', (['datetime_isoformat', '"""%Y-%m-%dT%H:%M:%S.%f"""'], {}), "(datetime_isoformat, '%Y-%m-%dT%H:%M:%S.%f')\n", (3448, 3492), False, ... |
"""create_table_hot_word
Revision ID: ff6c4638cce3
Revises:
Create Date: 2016-04-01 18:15:31.896317
"""
# revision identifiers, used by Alembic.
revision = 'ff6c4638cce3'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"sqlalchemy.dialects.mysql.BIGINT",
"sqlalchemy.VARCHAR",
"sqlalchemy.Date",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.Integer"
] | [((931, 956), 'alembic.op.drop_table', 'op.drop_table', (['"""hot_word"""'], {}), "('hot_word')\n", (944, 956), False, 'from alembic import op\n'), ((732, 761), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (755, 761), True, 'import sqlalchemy as sa\n'), ((767, 804), 'sql... |
# encoding: utf-8
'''
CSVファイルからパスワード管理DB作成
'''
import os, sqlite3, hashlib, random, string, csv
from contextlib import closing
# generate random string
def randomname(n):
return ''.join(random.choices(string.ascii_letters + string.digits, k=n))
# csv file to array
def readcsv(csvfile):
data = []
with open... | [
"os.remove",
"csv.reader",
"os.path.dirname",
"random.choices",
"os.path.exists",
"sqlite3.connect"
] | [((1236, 1258), 'os.path.exists', 'os.path.exists', (['dbfile'], {}), '(dbfile)\n', (1250, 1258), False, 'import os, sqlite3, hashlib, random, string, csv\n'), ((1165, 1190), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1180, 1190), False, 'import os, sqlite3, hashlib, random, string, csv\... |
import os
import sys
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import optotrak.calibrationcore as cc
from utils.logger import *
#import analysis.delayedfeedback.database as db
#import analysis.delayedfeedback.datalayer as dtl
import analysis.delayedfeedback.analyze_delayedfeedback as a... | [
"matplotlib.pyplot.title",
"numpy.load",
"numpy.abs",
"numpy.sum",
"numpy.argmax",
"os.walk",
"numpy.ones",
"numpy.isnan",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.interp",
"os.path.join",
"numpy.linalg.pinv",
"numpy.nanmean",
"matplotlib.pyplot.imshow",
"os.path.dirname",
... | [((1394, 1441), 'numpy.arange', 'np.arange', (['framenumbers[0]', 'framenumbers[-1]', '(1)'], {}), '(framenumbers[0], framenumbers[-1], 1)\n', (1403, 1441), True, 'import numpy as np\n'), ((1659, 1688), 'numpy.interp', 'np.interp', (['x', 'framenumbers', 't'], {}), '(x, framenumbers, t)\n', (1668, 1688), True, 'import ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((1548, 1580), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""createTime"""'}), "(name='createTime')\n", (1561, 1580), False, 'import pulumi\n'), ((1751, 1787), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""inactiveReason"""'}), "(name='inactiveReason')\n", (1764, 1787), False, 'import pulumi\n'), ((2356, 2... |
import mock
import os
import pytest
from spackl.db.base import BaseDb, get_default_db_conn_kwargs
from spackl.db import Postgres
uname = os.uname()[1]
expected_default_url = 'postgresql://{0}@localhost:5432/{0}'.format(uname)
query = 'select * from nowhere'
expected_query_results = [{'first': 'a', 'second': 'b', 'thi... | [
"os.uname",
"mock.patch",
"pytest.raises",
"spackl.db.Postgres",
"spackl.db.base.get_default_db_conn_kwargs"
] | [((139, 149), 'os.uname', 'os.uname', ([], {}), '()\n', (147, 149), False, 'import os\n'), ((505, 515), 'spackl.db.Postgres', 'Postgres', ([], {}), '()\n', (513, 515), False, 'from spackl.db import Postgres\n'), ((681, 695), 'spackl.db.Postgres', 'Postgres', (['name'], {}), '(name)\n', (689, 695), False, 'from spackl.d... |
import numpy as np
import time
from keras.callbacks import TensorBoard, ModelCheckpoint
from keras.models import Model, Input, load_model
from keras.layers.core import Activation
from keras.layers.core import Dense, Dropout
from keras.layers import concatenate
from keras.initializers import he_normal
from DataGenerato... | [
"keras.models.load_model",
"keras.layers.core.Dense",
"numpy.load",
"numpy.random.seed",
"keras.callbacks.ModelCheckpoint",
"keras.layers.core.Activation",
"keras.models.Input",
"keras.models.Model",
"time.time",
"DataGenerator.DataGenerator",
"keras.layers.core.Dropout"
] | [((844, 862), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (858, 862), True, 'import numpy as np\n'), ((1429, 1466), 'keras.callbacks.ModelCheckpoint', 'ModelCheckpoint', (['epoch_path'], {'period': '(4)'}), '(epoch_path, period=4)\n', (1444, 1466), False, 'from keras.callbacks import TensorBoard, M... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-12-29 09:51
from __future__ import unicode_literals
from bluebottle.clients import properties
from bluebottle.utils.utils import get_languages
from django.db import migrations
def migrate_to_office_regions(apps, schema_editor):
Location = apps.get_mo... | [
"django.db.migrations.RunPython"
] | [((1930, 2004), 'django.db.migrations.RunPython', 'migrations.RunPython', (['migrate_to_office_regions', 'migrations.RunPython.noop'], {}), '(migrate_to_office_regions, migrations.RunPython.noop)\n', (1950, 2004), False, 'from django.db import migrations\n')] |
# Generated by Django 3.0.6 on 2020-05-07 21:23
from django.db import migrations, models
import core.models
class Migration(migrations.Migration):
dependencies = [
("core", "0005_service_ignored_ips"),
]
operations = [
migrations.AddField(
model_name="service",
... | [
"django.db.models.TextField"
] | [((366, 453), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'default': '""""""', 'validators': '[core.models._validate_regex]'}), "(blank=True, default='', validators=[core.models.\n _validate_regex])\n", (382, 453), False, 'from django.db import migrations, models\n')] |
#Mock01
# Mocking GPIO for running application on Windows platform
# import spidev
# import RPi.GPIO as GPIO
import time
# Pin definition
RST_PIN = 17
DC_PIN = 25
CS_PIN = 8
BUSY_PIN = 24
# SPI device, bus = 0, device = 0
# SPI = spidev.SpiDev(0, 0)
def digital_write(pin, value):
... | [
"time.sleep"
] | [((390, 420), 'time.sleep', 'time.sleep', (['(delaytime / 1000.0)'], {}), '(delaytime / 1000.0)\n', (400, 420), False, 'import time\n')] |
""" Testing driver LatinHypercubeDriver."""
import unittest
from random import seed
from types import GeneratorType
import numpy as np
from openmdao.api import IndepVarComp, Group, Problem, Component
from openmdao.test.paraboloid import Paraboloid
from openmdao.test.util import assert_rel_error
from openmdao.driver... | [
"unittest.main",
"openmdao.api.IndepVarComp",
"numpy.random.seed",
"openmdao.api.Problem",
"openmdao.drivers.latinhypercube_driver.LatinHypercubeDriver",
"numpy.floor",
"openmdao.drivers.latinhypercube_driver._rand_latin_hypercube",
"random.seed",
"openmdao.drivers.latinhypercube_driver._mmlhs",
"... | [((7420, 7435), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7433, 7435), False, 'import unittest\n'), ((753, 771), 'random.seed', 'seed', (['self.seedval'], {}), '(self.seedval)\n', (757, 771), False, 'from random import seed\n'), ((780, 808), 'numpy.random.seed', 'np.random.seed', (['self.seedval'], {}), '(se... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 7 12:22:19 2018
@author: Administrator
"""
from bs4 import BeautifulSoup
import requests
from matplotlib import pyplot as plt
def get_html(url):
'''
爬取网页函数
'''
head={}
#写入User Agent信息
head['User-Agent'] = 'Mozilla/5.0 (Linux; Android 4.1.1; Nexus... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"pygal.Line",
"matplotlib.pyplot.figure",
"requests.get",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"bs4.BeautifulSoup"
] | [((713, 779), 'pygal.Line', 'pygal.Line', ([], {'title': '"""一周最高气温和最低气温曲线图"""', 'x_title': '"""日期"""', 'y_title': '"""温度值(℃)"""'}), "(title='一周最高气温和最低气温曲线图', x_title='日期', y_title='温度值(℃)')\n", (723, 779), False, 'import pygal\n'), ((1003, 1039), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'dpi': '(128)', 'figsize... |
#!/usr/bin/python3
import argparse
import gzip
import json
import os
import shutil
import sys
import nbt
# Parse command-line arguments
parser = argparse.ArgumentParser(
description='Port players from one world to another')
parser.add_argument('old_world')
parser.add_argument('new_world')
parser.add_argument('-... | [
"os.mkdir",
"gzip.open",
"argparse.ArgumentParser",
"nbt.String",
"nbt.Byte",
"os.path.isdir",
"nbt.Int",
"nbt.Short",
"nbt.read",
"nbt.write",
"nbt.Double",
"os.path.isfile",
"nbt.Float",
"shutil.copyfile",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((148, 225), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Port players from one world to another"""'}), "(description='Port players from one world to another')\n", (171, 225), False, 'import argparse\n'), ((444, 486), 'os.path.join', 'os.path.join', (['args.old_world', '"""playerdata"... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'd:\leichui\workspace\screenshot-master\ui\dialog_afterDraw.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QSizePolicy",
"PyQt5.QtGui.QIcon",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QGroupBox",
"PyQt5.QtWidgets.QSpacerItem",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtGui.QPixmap",
"PyQt5.QtCore.QMetaObject.connectSlotsByName... | [((560, 589), 'PyQt5.QtWidgets.QVBoxLayout', 'QtWidgets.QVBoxLayout', (['Dialog'], {}), '(Dialog)\n', (581, 589), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((678, 702), 'PyQt5.QtWidgets.QLabel', 'QtWidgets.QLabel', (['Dialog'], {}), '(Dialog)\n', (694, 702), False, 'from PyQt5 import QtCore, QtGui, QtWidg... |
"""
Example, which shows the difference between the new approach and a fix
efficiency.
The collectors efficiency and irradiance are calculated depending on
the loss method 'Andasol'.
"""
import os
import matplotlib.pyplot as plt
import pandas as pd
from oemof.thermal.concentrating_solar_power import csp_precalc
# S... | [
"pandas.DataFrame",
"os.mkdir",
"matplotlib.pyplot.show",
"oemof.thermal.concentrating_solar_power.csp_precalc",
"os.path.exists",
"matplotlib.pyplot.subplots",
"pandas.to_datetime",
"os.path.join"
] | [((410, 441), 'os.path.join', 'os.path.join', (['base_path', '"""data"""'], {}), "(base_path, 'data')\n", (422, 441), False, 'import os\n'), ((457, 491), 'os.path.join', 'os.path.join', (['base_path', '"""results"""'], {}), "(base_path, 'results')\n", (469, 491), False, 'import os\n'), ((688, 722), 'pandas.to_datetime'... |
import os
import sys
import time
import json
from datapackage import Package
from etl_server.pipelines.controllers import Controllers as PipelineControllers
from etl_server.users.models import Models as UserModels
if __name__ == '__main__':
etl_pipelines = PipelineControllers({}, os.environ['ETLS_DATABASE_URL'])
... | [
"etl_server.pipelines.controllers.Controllers",
"time.sleep"
] | [((263, 319), 'etl_server.pipelines.controllers.Controllers', 'PipelineControllers', (['{}', "os.environ['ETLS_DATABASE_URL']"], {}), "({}, os.environ['ETLS_DATABASE_URL'])\n", (282, 319), True, 'from etl_server.pipelines.controllers import Controllers as PipelineControllers\n'), ((540, 554), 'time.sleep', 'time.sleep'... |
__all__ = ['generate_func_common_stub']
import textwrap
from vecstub import vector_tuple
def generate_func_common_stub():
names = [
'abs', 'ceil', 'clamp', 'floatBitsToInt', 'floatBitsToUint', 'floor',
'fma', 'fmax', 'fmin', 'fract', 'frexp', 'intBitsToFloat', 'isinf',
'isnan', 'ldexp',... | [
"vecstub.vector_tuple"
] | [((7856, 7871), 'vecstub.vector_tuple', 'vector_tuple', (['(1)'], {}), '(1)\n', (7868, 7871), False, 'from vecstub import vector_tuple\n'), ((7947, 7962), 'vecstub.vector_tuple', 'vector_tuple', (['(2)'], {}), '(2)\n', (7959, 7962), False, 'from vecstub import vector_tuple\n'), ((8038, 8053), 'vecstub.vector_tuple', 'v... |
import re
import os
import six
if six.PY2:
from io import open
from castervoice.lib.ctrl.mgr.loading.load.content_request import ContentRequest
from castervoice.lib.ctrl.mgr.loading.load.content_type import ContentType
class ContentRequestGenerator(object):
"""
Generates a set of requests from a path.
... | [
"castervoice.lib.ctrl.mgr.loading.load.content_request.ContentRequest",
"os.walk",
"re.search",
"io.open"
] | [((1159, 1177), 'os.walk', 'os.walk', (['directory'], {}), '(directory)\n', (1166, 1177), False, 'import os\n'), ((3097, 3129), 're.search', 're.search', (['"""return (.+?),"""', 'line'], {}), "('return (.+?),', line)\n", (3106, 3129), False, 'import re\n'), ((1307, 1339), 'io.open', 'open', (['file_path'], {'encoding'... |
"""
Used internally to handle style changes without breaking backwards
compatibility.
"""
import warnings as _warnings
import functools as _functools
def backport(func):
"""
Backport a function name into an old style for compatibility.
The docstring is updated to reflect that the new func... | [
"warnings.warn",
"functools.wraps"
] | [((650, 672), 'functools.wraps', '_functools.wraps', (['func'], {}), '(func)\n', (666, 672), True, 'import functools as _functools\n'), ((726, 799), 'warnings.warn', '_warnings.warn', (['"""This function name is deprecated"""', 'DeprecationWarning', '(2)'], {}), "('This function name is deprecated', DeprecationWarning,... |
# -*- coding: utf-8 -*-
"""Console script for happy_repo."""
import sys
import click
from happy_repo import simple_function
@click.command()
@click.option('--upper',
type=bool,
default=False,
is_flag=True,
flag_value=True)
@click.argument('string', type=str)
def... | [
"click.argument",
"click.echo",
"click.option",
"click.command",
"happy_repo.simple_function"
] | [((127, 142), 'click.command', 'click.command', ([], {}), '()\n', (140, 142), False, 'import click\n'), ((144, 229), 'click.option', 'click.option', (['"""--upper"""'], {'type': 'bool', 'default': '(False)', 'is_flag': '(True)', 'flag_value': '(True)'}), "('--upper', type=bool, default=False, is_flag=True, flag_value=T... |
import pytest
from pyspark.sql import SparkSession
from pyspark.sql.types import StringType
from faas.generate import GenerateSynthetic, convert_dict_to_list
from faas.transformer.etl import ETLConfig, FeatureConfig, TargetConfig
from faas.transformer.lightgbm import ETLWrapperForLGBM
@pytest.mark.parametrize(
(... | [
"faas.transformer.lightgbm.ETLWrapperForLGBM",
"faas.generate.convert_dict_to_list",
"faas.generate.GenerateSynthetic",
"pytest.param",
"faas.transformer.etl.TargetConfig",
"faas.transformer.etl.FeatureConfig"
] | [((551, 616), 'faas.generate.GenerateSynthetic', 'GenerateSynthetic', ([], {'num_categorical': 'num_categorical', 'num_numeric': '(2)'}), '(num_categorical=num_categorical, num_numeric=2)\n', (568, 616), False, 'from faas.generate import GenerateSynthetic, convert_dict_to_list\n'), ((950, 973), 'faas.transformer.lightg... |
#
# (C) Copyright Cloudlab URV 2021
#
# 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 wr... | [
"pickle.loads",
"lithops.storage.Storage",
"os.environ.get",
"gc.collect",
"joblib.parallel.register_parallel_backend",
"lithops.multiprocessing.Pool",
"diskcache.Cache",
"logging.getLogger",
"pickle.dumps"
] | [((946, 973), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (963, 973), False, 'import logging\n'), ((1088, 1140), 'joblib.parallel.register_parallel_backend', 'register_parallel_backend', (['"""lithops"""', 'LithopsBackend'], {}), "('lithops', LithopsBackend)\n", (1113, 1140), False, 'f... |
from matplotlib import pyplot as plt
from matplotlib import rcParams
import numpy as np
import pickle
import copy as cp
import gs2_plotting as gplot
from plot_phi2_vs_time import plot_phi2_ky_vs_t
def my_single_task(ifile,run,myin,myout,mygrids,mytime,myfields,stitching=False):
# Compute and save to dat file
... | [
"matplotlib.pyplot.title",
"numpy.absolute",
"pickle.dump",
"numpy.empty",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.arange",
"gs2_plotting.plot_1d",
"numpy.copy",
"numpy.transpose",
"numpy.max",
"numpy.linspace",
"numpy.divide",
"copy.deepcopy",
"numpy.ceil",
"matplotlib.pyplo... | [((9739, 9785), 'gs2_plotting.merge_pdfs', 'gplot.merge_pdfs', (['pdflist', 'merged_pdfname', 'run'], {}), '(pdflist, merged_pdfname, run)\n', (9755, 9785), True, 'import gs2_plotting as gplot\n'), ((11442, 11467), 'copy.deepcopy', 'cp.deepcopy', (['full_time[0]'], {}), '(full_time[0])\n', (11453, 11467), True, 'import... |
import config
import re
def process_role(role):
"""Process the role given by the user.
Return None if no roles detected"""
# strip the leading @ in case someone fucks up
role = role.lstrip('@')
tmp_cap = list()
for w in role.split(' '):
if w.lower() in ['fp', 'il', 'gms', 'gmsm']:
... | [
"re.compile"
] | [((1056, 1095), 're.compile', 're.compile', (['"""^0x\\\\w{6}$"""', 're.IGNORECASE'], {}), "('^0x\\\\w{6}$', re.IGNORECASE)\n", (1066, 1095), False, 'import re\n')] |
# Copyright 2017 Mastercard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"requests.post",
"utils.redis_broker_url"
] | [((1332, 1387), 'requests.post', 'requests.post', (['callback'], {'json': 'data', 'verify': '(not insecure)'}), '(callback, json=data, verify=not insecure)\n', (1345, 1387), False, 'import requests\n'), ((688, 712), 'utils.redis_broker_url', 'utils.redis_broker_url', ([], {}), '()\n', (710, 712), False, 'import utils\n... |
from PySide import QtGui
# from mw_gui import Ui_MainWindow
class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.setMaximumSize(300, 300)
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
mainwindow = MainWindow()
m... | [
"PySide.QtGui.QMainWindow.__init__",
"PySide.QtGui.QApplication"
] | [((256, 284), 'PySide.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (274, 284), False, 'from PySide import QtGui\n'), ((132, 164), 'PySide.QtGui.QMainWindow.__init__', 'QtGui.QMainWindow.__init__', (['self'], {}), '(self)\n', (158, 164), False, 'from PySide import QtGui\n')] |
"""
File: 1337.py
Title: The K Weakest Rows in a Matrix
Difficulty: Easy
URL: https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/
"""
import unittest
from typing import List
class Solution:
def kWeakestRows(self, mat: List[List[int]], k: int) -> List[int]:
rows = []
for... | [
"unittest.main"
] | [((1262, 1277), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1275, 1277), False, 'import unittest\n')] |
# code for a local TFlite (Tensor Flow Lite) test, assuming an env where tflite is installed, see instructions below
"""
sample zipped test env should be available here:
https://github.com/lineality/tensorflow_lite_in_aws_lambda_function
to use pre-made-zipped tflite env for python 3.8:
$ unzip env.zip
$ source env/... | [
"numpy.asarray",
"tflite_runtime.interpreter.Interpreter"
] | [((2302, 2329), 'tflite_runtime.interpreter.Interpreter', 'Interpreter', (['"""model.tflite"""'], {}), "('model.tflite')\n", (2313, 2329), False, 'from tflite_runtime.interpreter import Interpreter\n'), ((2876, 2917), 'numpy.asarray', 'np.asarray', (['X_raw_input'], {'dtype': 'np.float32'}), '(X_raw_input, dtype=np.flo... |
#!/usr/bin/env python3
import logging
import re
from time import gmtime, strftime
from playerlib.backends.backend_factory import *
from urwim import clamp, App, rdb, RdbObject
class PlaybackController:
def __init__(self, config):
self.backend = BackendFactory(config, self.next, self.update_current_state... | [
"time.gmtime",
"re.match",
"urwim.rdb.subscribe",
"urwim.App",
"logging.getLogger",
"urwim.RdbObject"
] | [((387, 426), 'logging.getLogger', 'logging.getLogger', (['"""PlaybackController"""'], {}), "('PlaybackController')\n", (404, 426), False, 'import logging\n'), ((451, 493), 'urwim.RdbObject', 'RdbObject', (['(100)'], {'min_value': '(0)', 'max_value': '(100)'}), '(100, min_value=0, max_value=100)\n', (460, 493), False, ... |
from uuid import uuid4
"""Made by <NAME>"""
"""Edited by <NAME> Jason"""
class Lesson():
def __init__(self, title, description, thumbnail):
self.__title = title
self.__description = description
self.__thumbnail = thumbnail
self.__lessonID = str(uuid4().hex)
def set_title(self,... | [
"uuid.uuid4"
] | [((283, 290), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (288, 290), False, 'from uuid import uuid4\n')] |
"""Functions for downloading and extracting inaturalist open data"""
# TODO: Download separate archive files in parallel?
from datetime import datetime, timezone
from io import FileIO
from os.path import basename, getsize
from pathlib import Path
from tarfile import TarFile
from time import time
import boto3
from boto... | [
"os.path.basename",
"os.path.getsize",
"time.time",
"botocore.config.Config",
"rich.print",
"pathlib.Path",
"datetime.datetime.fromtimestamp",
"datetime.datetime.now"
] | [((1823, 1864), 'rich.print', 'print', (['f"""Downloading to: {download_file}"""'], {}), "(f'Downloading to: {download_file}')\n", (1828, 1864), False, 'from rich import print\n'), ((4195, 4274), 'rich.print', 'print', (['f"""[cyan]Possible new release in ~[magenta]{est_release_days} [cyan]days"""'], {}), "(f'[cyan]Pos... |
# this is the python implementation for the credit risk project
import os
import numpy as np
import pandas as pd
import re
from math import sqrt
import time
import string
import matplotlib
import matplotlib.pyplot as plt
import nltk
import sklearn
from sklearn import preprocessing
from sklearn.feature_extraction.text... | [
"sklearn.ensemble.RandomForestClassifier",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"pandas.DataFrame",
"matplotlib.pyplot.show",
"sklearn.preprocessing.scale",
"os.getcwd",
"sklearn.model_selection.train_test_split",
"pandas.read_csv",
"sklearn.model_selection.cross_val_score",
"num... | [((1085, 1192), 'os.chdir', 'os.chdir', (['"""C:\\\\Users\\\\wmwms\\\\OneDrive - George Mason University\\\\Academics\\\\2020Fall\\\\CS584\\\\HW2"""'], {}), "(\n 'C:\\\\Users\\\\wmwms\\\\OneDrive - George Mason University\\\\Academics\\\\2020Fall\\\\CS584\\\\HW2'\n )\n", (1093, 1192), False, 'import os\n'), ((117... |
# Step 0: Add NRPy's directory to the path
# https://stackoverflow.com/questions/16780014/import-file-from-parent-directory
import os,sys
nrpy_dir_path = os.path.join("..")
if nrpy_dir_path not in sys.path:
sys.path.append(nrpy_dir_path)
nrpy_dir_path = os.path.join("../..")
if nrpy_dir_path not in sys.path:
sy... | [
"sys.path.append",
"NRPy_param_funcs.set_parval_from_str",
"sympy.Rational",
"indexedexp.zerorank1",
"sympy.sympify",
"Min_Max_and_Piecewise_Expressions.coord_greater_bound",
"GiRaFFEfood_NRPy.GiRaFFEfood_NRPy_Common_Functions.compute_ValenciavU_from_ED_and_BU",
"os.path.join",
"Min_Max_and_Piecewis... | [((154, 172), 'os.path.join', 'os.path.join', (['""".."""'], {}), "('..')\n", (166, 172), False, 'import os, sys\n'), ((258, 279), 'os.path.join', 'os.path.join', (['"""../.."""'], {}), "('../..')\n", (270, 279), False, 'import os, sys\n'), ((892, 961), 'NRPy_param_funcs.set_parval_from_str', 'par.set_parval_from_str',... |
import turtle
t = turtle.Turtle()
t.color("lime")
t.width(3)
t.penup()
t.shape("turtle")
for step in range(2000):
t.forward(1)
if t.xcor() < -170 or t.xcor() > 170:
t.right(180)
input()
| [
"turtle.Turtle"
] | [((19, 34), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (32, 34), False, 'import turtle\n')] |
import time
import unittest
from datetime import timedelta
from ModularChess.controller.Timer import Timer
from ModularChess.utils.Exceptions import TimerError
class TestTimer(unittest.TestCase):
def setUp(self):
def end_call():
self.finished = True
self.end_call = end_call
... | [
"unittest.main",
"ModularChess.controller.Timer.Timer",
"datetime.timedelta",
"time.sleep"
] | [((4841, 4856), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4854, 4856), False, 'import unittest\n'), ((332, 352), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(1)'}), '(seconds=1)\n', (341, 352), False, 'from datetime import timedelta\n'), ((378, 403), 'datetime.timedelta', 'timedelta', ([], {'millise... |
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
requirements = [
'requests>=2.7',
'beautifulsoup4>=4.3',
]
setup(name='dotmil_domains',
version='0.0.1',
description='An incomplete listing of .mil domains',
url='https://github.com/esonder... | [
"setuptools.setup"
] | [((172, 564), 'setuptools.setup', 'setup', ([], {'name': '"""dotmil_domains"""', 'version': '"""0.0.1"""', 'description': '"""An incomplete listing of .mil domains"""', 'url': '"""https://github.com/esonderegger/dotmil-domains"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'pack... |
from unittest import TestCase
from rotate_array import Solution
class TestNoOrbit(TestCase):
def test_single_step(self):
values = [1, 2, 3, 4, 5]
Solution().rotate(values, 1)
self.assertEqual([5, 1, 2, 3, 4], values)
def test_two_steps(self):
values = [1, 2, 3, 4, 5]
... | [
"rotate_array.Solution"
] | [((170, 180), 'rotate_array.Solution', 'Solution', ([], {}), '()\n', (178, 180), False, 'from rotate_array import Solution\n'), ((321, 331), 'rotate_array.Solution', 'Solution', ([], {}), '()\n', (329, 331), False, 'from rotate_array import Solution\n'), ((508, 518), 'rotate_array.Solution', 'Solution', ([], {}), '()\n... |
# -*- coding:utf-8 –*-
# 用turtlr画时钟
# 以自定义shape的方式实现
import turtle as t
import datetime as d
global hourPoint, minPoint, secPoint, fontWriter
def skip(step): # 抬笔,跳到一个地方
t.penup()
t.forward(step)
t.pendown()
def drawclock(radius): # 画表盘
t.speed(0)
t.mode("logo") # 以Logo坐标、角度方式
t.hideturtl... | [
"turtle.speed",
"turtle.register_shape",
"turtle.dot",
"turtle.begin_poly",
"turtle.ontimer",
"turtle.end_poly",
"turtle.hideturtle",
"turtle.pendown",
"turtle.forward",
"turtle.penup",
"turtle.home",
"turtle.Pen",
"datetime.datetime.now",
"turtle.tracer",
"turtle.right",
"turtle.pensi... | [((177, 186), 'turtle.penup', 't.penup', ([], {}), '()\n', (184, 186), True, 'import turtle as t\n'), ((191, 206), 'turtle.forward', 't.forward', (['step'], {}), '(step)\n', (200, 206), True, 'import turtle as t\n'), ((211, 222), 'turtle.pendown', 't.pendown', ([], {}), '()\n', (220, 222), True, 'import turtle as t\n')... |
from ._functions import pdist
import numpy as np
def smote(minority_data_points, k=1):
'''
SMOTE (Synthetic Minority Oversampling TEchnique).
Used to generate more data points for minority class or imbalanced learning.
Parameters
----------
minority_data_points : numpy.array
Inputs or ... | [
"numpy.argsort",
"numpy.random.uniform",
"numpy.arange"
] | [((1508, 1544), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', '(npoints * k)'], {}), '(0, 1, npoints * k)\n', (1525, 1544), True, 'import numpy as np\n'), ((950, 979), 'numpy.argsort', 'np.argsort', (['distances'], {'axis': '(1)'}), '(distances, axis=1)\n', (960, 979), True, 'import numpy as np\n'), ((12... |
import logging
from logging.handlers import SMTPHandler, RotatingFileHandler
import os
from flask import Flask, request, current_app
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_mail import Mail
from flask_bootstrap import Bootstrap
from flask... | [
"flask_caching.Cache",
"flask.Flask",
"flask_mail.Mail",
"flask_moment.Moment",
"flask_sqlalchemy.SQLAlchemy",
"flask_migrate.Migrate",
"flask_login.LoginManager",
"flask_bootstrap.Bootstrap"
] | [((474, 486), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (484, 486), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((497, 506), 'flask_migrate.Migrate', 'Migrate', ([], {}), '()\n', (504, 506), False, 'from flask_migrate import Migrate\n'), ((515, 529), 'flask_login.LoginManager', 'LoginManag... |
"""
To build *.exe use the next command in the terminal:
(vision) D:/Projects/vision> python bone-age/build.py build
To create an msi-installer:
(vision) D:/Projects/vision> python bone-age/build.py bdist_msi
"""
from pathlib import Path
import bsmu.bone_age.app
import bsmu.bone_age.plugins
from bsmu.vi... | [
"pathlib.Path"
] | [((494, 535), 'pathlib.Path', 'Path', (['"""src/bsmu/bone_age/app/__main__.py"""'], {}), "('src/bsmu/bone_age/app/__main__.py')\n", (498, 535), False, 'from pathlib import Path\n'), ((430, 444), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (434, 444), False, 'from pathlib import Path\n')] |