code stringlengths 21 1.03M | apis list | extract_api stringlengths 74 8.23M |
|---|---|---|
from sqlalchemy import Column, String, ForeignKey
from sqlalchemy.orm import relationship
from odp.db import Base
class ClientScope(Base):
"""Model of a many-to-many client-scope association,
representing the set of OAuth2 scopes that a client
may request."""
__tablename__ = 'client_scope'
clie... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.ForeignKey"
] | [((512, 566), 'sqlalchemy.orm.relationship', 'relationship', (['"""Client"""'], {'back_populates': '"""client_scopes"""'}), "('Client', back_populates='client_scopes')\n", (524, 566), False, 'from sqlalchemy.orm import relationship\n'), ((579, 632), 'sqlalchemy.orm.relationship', 'relationship', (['"""Scope"""'], {'bac... |
#!/usr/bin/python
import wave
import struct
# Convert audio to byte array
wav = wave.open("bulan.wav", mode='rb')
frame_bytes = bytearray(list(wav.readframes(wav.getnframes())))
shorts = struct.unpack('H'*(len(frame_bytes)//2), frame_bytes)
extracted_left = shorts[::2]
extracted_right = shorts[1::2]
extractedLSB = "... | [
"wave.open"
] | [((81, 114), 'wave.open', 'wave.open', (['"""bulan.wav"""'], {'mode': '"""rb"""'}), "('bulan.wav', mode='rb')\n", (90, 114), False, 'import wave\n')] |
import logging
import configparser
from flask import Flask, render_template
from flask_ask import Ask, statement, question
app = Flask(__name__)
app.config.from_pyfile('settings.cfg', silent = True)
ask = Ask(app, '/')
logging.getLogger('flask_ask').setLevel(logging.DEBUG)
DIAPASON_URL = "https://diapason.reset.e... | [
"logging.getLogger",
"flask_ask.question",
"flask_ask.statement",
"configparser.ConfigParser",
"flask_ask.Ask",
"flask.render_template",
"flask.Flask"
] | [((132, 147), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (137, 147), False, 'from flask import Flask, render_template\n'), ((208, 221), 'flask_ask.Ask', 'Ask', (['app', '"""/"""'], {}), "(app, '/')\n", (211, 221), False, 'from flask_ask import Ask, statement, question\n'), ((389, 415), 'flask.render_te... |
import streamlit as st
def visualization():
st.markdown(f"""
# Определение физической потребности в жидкости""")
selected = [
'7 дней - 1 месяц',
'1 - 3 месяца',
'4 - 6 месяцев',
'7 - 9 месяцев',
'10 - 12 месяцев',
'1 - 3 года',
'4 - 6 лет',
... | [
"streamlit.selectbox",
"streamlit.button",
"streamlit.number_input",
"streamlit.markdown"
] | [((49, 121), 'streamlit.markdown', 'st.markdown', (['f"""\n # Определение физической потребности в жидкости"""'], {}), '(f"""\n # Определение физической потребности в жидкости""")\n', (60, 121), True, 'import streamlit as st\n'), ((398, 440), 'streamlit.selectbox', 'st.selectbox', (['"""Выберите возраст"""', 'sel... |
import unittest
from src.naturerec_model.model import create_database, Session, Location
from src.naturerec_model.logic import create_location
class TestLocation(unittest.TestCase):
def setUp(self) -> None:
create_database()
create_location(name="<NAME>",
address="Lashford ... | [
"src.naturerec_model.model.Session.begin",
"src.naturerec_model.model.create_database",
"src.naturerec_model.logic.create_location"
] | [((221, 238), 'src.naturerec_model.model.create_database', 'create_database', ([], {}), '()\n', (236, 238), False, 'from src.naturerec_model.model import create_database, Session, Location\n'), ((247, 434), 'src.naturerec_model.logic.create_location', 'create_location', ([], {'name': '"""<NAME>"""', 'address': '"""Lash... |
import pygame
from core import Vector2D, Color
from .shape import Shape
class Rectangle(Shape):
def __init__(self, position: Vector2D, size: Vector2D, color: Color):
self.position = position
self.size = size
self.color = color
def draw(self, surface):
pygame.draw.rect(surface... | [
"pygame.draw.rect"
] | [((296, 399), 'pygame.draw.rect', 'pygame.draw.rect', (['surface', 'self.color', '(self.position.x, self.position.y, self.size.x, self.size.y)'], {}), '(surface, self.color, (self.position.x, self.position.y,\n self.size.x, self.size.y))\n', (312, 399), False, 'import pygame\n')] |
# eventparser.py
# Copyright 2014 <NAME>
# Licence: See LICENCE (BSD licence)
"""Event parser class.
"""
import re
from solentware_misc.core import utilities
from .emailextractor import (
RESULTS_PREFIX,
SECTION_PREFIX,
SECTION_BODY,
MATCH_BODY,
TEAMS_BODY,
GAMES_BODY,
FINISHED,
UNFIN... | [
"re.compile"
] | [((2149, 2199), 're.compile', 're.compile', (['BOARD'], {'flags': '(re.IGNORECASE | re.DOTALL)'}), '(BOARD, flags=re.IGNORECASE | re.DOTALL)\n', (2159, 2199), False, 'import re\n'), ((2396, 2446), 're.compile', 're.compile', (['ROUND'], {'flags': '(re.IGNORECASE | re.DOTALL)'}), '(ROUND, flags=re.IGNORECASE | re.DOTALL... |
import os
import shutil
import numpy as np
import pickle
import gzip
from keras.models import model_from_json
import astropy.table as astab
import json
import logging
logger = logging.getLogger(__name__)
def pickleWrite(obj, filepath, protocol=-1):
"""
I write your python object obj into a pickle file at fil... | [
"os.path.join",
"logging.getLogger",
"numpy.argsort",
"json.dump",
"os.path.splitext",
"json.load",
"pickle.load",
"numpy.where",
"os.path.exists",
"shutil.rmtree",
"numpy.array",
"pickle.dump",
"gzip.open",
"os.makedirs"
] | [((178, 205), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (195, 205), False, 'import logging\n'), ((764, 800), 'pickle.dump', 'pickle.dump', (['obj', 'pkl_file', 'protocol'], {}), '(obj, pkl_file, protocol)\n', (775, 800), False, 'import pickle\n'), ((1285, 1306), 'pickle.load', 'pickl... |
import os, pynja, repo
@pynja.project
class bench_func(repo.CppProject):
def emit(self):
libnstd = self.add_cpplib_dependency('nstd', 'sta')
self.includePaths.append(os.path.join(libnstd.projectDir, "inc"))
sources = [
"src/bench_func.cpp",
]
with self.cpp_com... | [
"os.path.join"
] | [((188, 227), 'os.path.join', 'os.path.join', (['libnstd.projectDir', '"""inc"""'], {}), "(libnstd.projectDir, 'inc')\n", (200, 227), False, 'import os, pynja, repo\n')] |
#!/usr/bin/env Python
import requests
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
class QuerySolr(object):
"""
Directly query the solr shards without using Tomcat for faster and more reliable searching.
"""
def __init__(self,
url='https://esgf-index... | [
"requests.packages.urllib3.disable_warnings",
"requests.get"
] | [((72, 116), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (114, 116), False, 'import requests\n'), ((3783, 3820), 'requests.get', 'requests.get', (['self.url'], {'params': 'params'}), '(self.url, params=params)\n', (3795, 3820), False, 'import requests\n'... |
# -*- coding: utf-8 -*-
import csv, heapq, logging, multiprocessing, os, sys, tempfile
if sys.version_info.major == 2:
from io import open
from optparse import OptionParser
csv.field_size_limit(2**30) # can't use sys.maxsize because of Windows error
class CsvSortError(Exception):
pass
def csvsort(input_fil... | [
"optparse.OptionParser",
"csv.writer",
"multiprocessing.cpu_count",
"tempfile.NamedTemporaryFile",
"os.remove",
"multiprocessing.Pool",
"sys.getsizeof",
"csv.field_size_limit",
"io.open",
"csv.reader"
] | [((178, 207), 'csv.field_size_limit', 'csv.field_size_limit', (['(2 ** 30)'], {}), '(2 ** 30)\n', (198, 207), False, 'import csv, heapq, logging, multiprocessing, os, sys, tempfile\n'), ((3169, 3195), 'os.remove', 'os.remove', (['sorted_filename'], {}), '(sorted_filename)\n', (3178, 3195), False, 'import csv, heapq, lo... |
import logging
from django.shortcuts import redirect
from django.urls import reverse
from . import configs
from . import google_services
from .sdk import SheetsdbSDK
logger = logging.getLogger(__name__)
def require_meta_spreadsheet(view_func):
"""
Gets the meta spreadsheet of user and set it as the `meta_s... | [
"django.urls.reverse",
"logging.getLogger"
] | [((178, 205), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (195, 205), False, 'import logging\n'), ((779, 825), 'django.urls.reverse', 'reverse', (['"""sheetsdb-update-meta-spreadsheet-id"""'], {}), "('sheetsdb-update-meta-spreadsheet-id')\n", (786, 825), False, 'from django.urls import... |
import torch
import numpy as np
import re
import os
from scipy.misc import imread, imresize
def shrink_weight_bias(conv_weight_key,model, bn_eps = 1e-6):
index = re.findall('module_list.(\d+).', conv_weight_key)[0]
shape = model[conv_weight_key].shape
out_channels, in_channels = shape[0], shape[1]
... | [
"os.path.join",
"torch.load",
"re.findall",
"numpy.save",
"scipy.misc.imread",
"scipy.misc.imresize",
"torch.mm",
"torch.sqrt",
"torch.zeros",
"os.makedirs"
] | [((1504, 1540), 'os.makedirs', 'os.makedirs', (['save_dir'], {'exist_ok': '(True)'}), '(save_dir, exist_ok=True)\n', (1515, 1540), False, 'import os\n'), ((1546, 1581), 'os.path.join', 'os.path.join', (['save_dir', '"""model.npy"""'], {}), "(save_dir, 'model.npy')\n", (1558, 1581), False, 'import os\n'), ((1605, 1670),... |
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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 require... | [
"datetime.datetime.now",
"time.monotonic",
"pathlib.Path",
"typing.NamedTuple"
] | [((960, 1087), 'typing.NamedTuple', 'NamedTuple', (['"""Datum"""', "[('name', str), ('value', Union[int, float]), ('unit', str), ('timestamp',\n float), ('complete', bool)]"], {}), "('Datum', [('name', str), ('value', Union[int, float]), ('unit',\n str), ('timestamp', float), ('complete', bool)])\n", (970, 1087),... |
"""Main module for the hagerstrand package."""
import os
import ipyleaflet
import ee
import box
#import math
from ipyleaflet import FullScreenControl, LayersControl, DrawControl, MeasureControl, ScaleControl, TileLayer, basemaps, basemap_to_tiles, Marker, MarkerCluster
#import ipywidgets
from sklearn.neighbors import B... | [
"ipyleaflet.MeasureControl",
"json.dumps",
"geopandas.points_from_xy",
"ipyleaflet.TileLayer",
"os.path.exists",
"pandas.read_csv",
"ipyleaflet.FullScreenControl",
"ipyleaflet.GeoData",
"ipyleaflet.Marker",
"sklearn.neighbors.BallTree",
"os.makedirs",
"shapely.geometry.Point",
"ee.Image",
... | [((16234, 16257), 'os.path.abspath', 'os.path.abspath', (['in_shp'], {}), '(in_shp)\n', (16249, 16257), False, 'import os\n'), ((16382, 16406), 'shapefile.Reader', 'shapefile.Reader', (['in_shp'], {}), '(in_shp)\n', (16398, 16406), False, 'import shapefile\n'), ((17393, 17416), 'os.path.abspath', 'os.path.abspath', (['... |
#!/usr/bin/env python
from items import items # this file contains a dictionary of all the available items in the game
from enemies import enemies # this file contains a dictionary of all the enemies you can fight in the game
from player import Player # this file contains the Player() class, which is the building block... | [
"player.Player"
] | [((1367, 1375), 'player.Player', 'Player', ([], {}), '()\n', (1373, 1375), False, 'from player import Player\n')] |
def lp(z, q, k, tol = 1e-9, extra_precision = False):
'''
Generate a time-inhomogeneous, discrete time Markov chain for the willow
tree [1] via linear programming (LP), using the discrete density pairs
{z(i), q(i)}, for i = 1, ..., n, output of the function 'sampling'.
The willow tree linear progra... | [
"numpy.linspace",
"numpy.append",
"numpy.nonzero",
"numpy.eye",
"numpy.argwhere",
"numpy.sqrt",
"numpy.zeros",
"numpy.ones",
"time.time",
"scipy.optimize.linprog",
"numpy.array"
] | [((8492, 8516), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(k + 1)'], {}), '(0, 1, k + 1)\n', (8503, 8516), True, 'import numpy as np\n'), ((8579, 8603), 'numpy.ones', 'np.ones', (['n'], {'dtype': 'np.int'}), '(n, dtype=np.int)\n', (8586, 8603), True, 'import numpy as np\n'), ((6499, 6592), 'scipy.optimize.linpr... |
import logging
from typing import List
from .index import Index
from .template import Template
def write(template: Template, indexes: List[Index]):
for index in indexes:
path = index.path.joinpath('index.html')
logging.info(f"Writing {path}")
html = index.to_html(template)
... | [
"logging.info"
] | [((244, 275), 'logging.info', 'logging.info', (['f"""Writing {path}"""'], {}), "(f'Writing {path}')\n", (256, 275), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Import DNS Zone
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------... | [
"noc.core.validators.is_int",
"noc.ip.models.address.Address",
"noc.dns.models.dnszone.DNSZone",
"noc.dns.models.dnszonerecord.DNSZoneRecord.objects.filter",
"noc.ip.models.vrf.VRF.get_global",
"re.compile",
"noc.ip.models.addressprofile.AddressProfile.get_by_name",
"noc.core.management.base.CommandEr... | [((8308, 8331), 're.compile', 're.compile', (['"""("[^"]*")"""'], {}), '(\'("[^"]*")\')\n', (8318, 8331), False, 'import re\n'), ((9574, 9594), 're.compile', 're.compile', (['""""\\\\s+\\""""'], {}), '(\'"\\\\s+"\')\n', (9584, 9594), False, 'import re\n'), ((11123, 11301), 're.compile', 're.compile', (['"""^(?P<zone>\\... |
# -*- coding: utf-8 -*-
from beyondtheadmin.companies.models import Company
def add_companies_to_context(request):
if not (hasattr(request, 'user') and request.user.is_authenticated):
return {}
return {
'companies': Company.objects.filter(users=request.user)
}
| [
"beyondtheadmin.companies.models.Company.objects.filter"
] | [((242, 284), 'beyondtheadmin.companies.models.Company.objects.filter', 'Company.objects.filter', ([], {'users': 'request.user'}), '(users=request.user)\n', (264, 284), False, 'from beyondtheadmin.companies.models import Company\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Simple script to generate charts based on scale testing """
import json
import numpy as np
import matplotlib.pyplot as plt
MATRIX_SIZES = [1000, 2000, 3000, 4000, 5000, 10000]
THREAD_COUNTS = [1, 2, 4, 8, 16, 24]
# def get_average_value(data, threads, size):
# ""... | [
"numpy.arange",
"matplotlib.pyplot.subplots"
] | [((1997, 2011), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2009, 2011), True, 'import matplotlib.pyplot as plt\n'), ((2032, 2044), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (2041, 2044), True, 'import numpy as np\n'), ((3212, 3226), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), ... |
from unittest import mock
from django.urls import reverse
from django.utils.translation import LANGUAGE_SESSION_KEY
from ..views import change_language
@mock.patch('django.utils.translation.activate')
def test_change_language(activate_mock, client):
url = reverse('change-language')
response = client.post(ur... | [
"django.urls.reverse",
"unittest.mock.patch"
] | [((157, 204), 'unittest.mock.patch', 'mock.patch', (['"""django.utils.translation.activate"""'], {}), "('django.utils.translation.activate')\n", (167, 204), False, 'from unittest import mock\n'), ((493, 540), 'unittest.mock.patch', 'mock.patch', (['"""django.utils.translation.activate"""'], {}), "('django.utils.transla... |
import numpy as np
from enum import IntEnum, auto
from .repgen import generate_2D_cartesian_representation
from .Molecule import Molecule
from .SymRep import SymRep
import logging
logger = logging.getLogger(__name__)
class ExampleMoleculeType(IntEnum):
EQUILATERAL_TRIANGLE = auto()
HEXAGON = auto()
SQUARE... | [
"logging.getLogger",
"enum.auto",
"numpy.sqrt",
"numpy.cos",
"numpy.sin"
] | [((190, 217), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (207, 217), False, 'import logging\n'), ((282, 288), 'enum.auto', 'auto', ([], {}), '()\n', (286, 288), False, 'from enum import IntEnum, auto\n'), ((303, 309), 'enum.auto', 'auto', ([], {}), '()\n', (307, 309), False, 'from enu... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, print_function, unicode_literals, \
absolute_import
import os
import unittest
from collections import OrderedDict
import numpy as np
from pymatgen.io.lammps.data import L... | [
"pymatgen.io.lammps.force_field.ForceField",
"os.path.join",
"pymatgen.io.lammps.data.LammpsForceFieldData.from_forcefield_and_topology",
"os.path.dirname",
"unittest.main",
"collections.OrderedDict",
"pymatgen.io.lammps.topology.Topology.from_molecule",
"numpy.testing.assert_almost_equal",
"numpy.a... | [((558, 583), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (573, 583), False, 'import os\n'), ((6283, 6298), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6296, 6298), False, 'import unittest\n'), ((1681, 1719), 'pymatgen.io.lammps.topology.Topology.from_molecule', 'Topology.from_mol... |
import unittest
from iutils.utils import two_level_split
class TestTwoLevelSplit(unittest.TestCase):
def test_two_level_split(self):
self.assertEqual(two_level_split('a "b c" "d"'), ["a", "b c", "d"])
# multiple spaces with quotes
self.assertEqual(
two_level_split('a "b c" "d"... | [
"iutils.utils.two_level_split"
] | [((164, 194), 'iutils.utils.two_level_split', 'two_level_split', (['"""a "b c" "d\\""""'], {}), '(\'a "b c" "d"\')\n', (179, 194), False, 'from iutils.utils import two_level_split\n'), ((292, 331), 'iutils.utils.two_level_split', 'two_level_split', (['"""a "b c" "d" "ef gh\\""""'], {}), '(\'a "b c" "d" "ef gh"\')\n',... |
"""
Start the web server.
$ python run.py \
--debug \
--port 8008
"""
import argparse
import json
from annotation_tools.annotation_tools import app
DEFAULT_PORT = 8003
def parse_args():
parser = argparse.ArgumentParser(description='Visipedia Annotation Toolkit')
parser.add_argument('--debug', dest='debug',
... | [
"argparse.ArgumentParser",
"annotation_tools.annotation_tools.app.run"
] | [((203, 270), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Visipedia Annotation Toolkit"""'}), "(description='Visipedia Annotation Toolkit')\n", (226, 270), False, 'import argparse\n'), ((695, 752), 'annotation_tools.annotation_tools.app.run', 'app.run', ([], {'port': 'args.port', 'hos... |
# Generated by Django 2.1.4 on 2019-09-05 18:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('apps', '0012_auto_20190905_1622'),
]
operations = [
migrations.AddField(
model_name='orders',
name='code',
... | [
"django.db.models.CharField"
] | [((329, 373), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': '(100)'}), "(default='', max_length=100)\n", (345, 373), False, 'from django.db import migrations, models\n')] |
from random import random
n = 10
S = []
S.append('G') # Initial state
for i in range(n):
u = random()
if S[i] == 'G':
if u < 0.5:
S.append('G')
else:
S.append('B')
elif S[i] == 'B':
if u < 0.7:
S.append('G')
else:
S.append(... | [
"random.random"
] | [((102, 110), 'random.random', 'random', ([], {}), '()\n', (108, 110), False, 'from random import random\n')] |
from skimage import io
from pyxelate import Pyx, Pal
import os
import ffmpeg
import cv2
import shutil
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--input', type=str, default="",help='Locate the input video')
parser.add_argument('--downsample_by', type=int, default=14,help='Speci... | [
"os.listdir",
"skimage.io.imsave",
"argparse.ArgumentParser",
"pyxelate.Pyx",
"shutil.rmtree",
"cv2.VideoCapture",
"skimage.io.imread",
"os.makedirs"
] | [((138, 163), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (161, 163), False, 'import argparse\n'), ((468, 480), 'os.listdir', 'os.listdir', ([], {}), '()\n', (478, 480), False, 'import os\n'), ((594, 606), 'os.listdir', 'os.listdir', ([], {}), '()\n', (604, 606), False, 'import os\n'), ((784... |
import pandas as pd
'''
# Handling imbalanced data sets by sampling
## Down-sampling = Randomly removing observations from a class to prevent its signal from dominating the learning algorithm
## Up-sampling = Randomly duplicating observations from a class in order to reinforce its signal
--- Following functions ar... | [
"pandas.concat"
] | [((1287, 1344), 'pandas.concat', 'pd.concat', (['[df_sample_mode_target, df_rest_modes]'], {'axis': '(0)'}), '([df_sample_mode_target, df_rest_modes], axis=0)\n', (1296, 1344), True, 'import pandas as pd\n'), ((1597, 1654), 'pandas.concat', 'pd.concat', (['[df_sample_mode_target, df_rest_modes]'], {'axis': '(0)'}), '([... |
#!/usr/bin/env python3
from setuptools import find_packages, setup
setup(name='sonify', packages=find_packages())
| [
"setuptools.find_packages"
] | [((99, 114), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (112, 114), False, 'from setuptools import find_packages, setup\n')] |
from schematics.models import Model
from schematics.types import ModelType, ListType, PolyModelType
from ._arg_group import CMDArgGroup
from ._condition import CMDCondition
from ._fields import CMDStageField, CMDVersionField, CMDCommandNameField
from ._help import CMDHelp
from ._operation import CMDOperation
from ._ou... | [
"schematics.types.ModelType",
"schematics.types.PolyModelType"
] | [((691, 724), 'schematics.types.ModelType', 'ModelType', (['CMDHelp'], {'required': '(True)'}), '(CMDHelp, required=True)\n', (700, 724), False, 'from schematics.types import ModelType, ListType, PolyModelType\n'), ((600, 622), 'schematics.types.ModelType', 'ModelType', (['CMDResource'], {}), '(CMDResource)\n', (609, 6... |
import base64
from os import environ
DEPLOY = bool(environ.get("DEPLOY"))
def getenv(name: str, fallback: str = "") -> str:
"""Return an (optionally base64-encoded) env var."""
variable = environ.get(name)
if DEPLOY and variable is not None:
variable = base64.b64decode(variable).decode()
ret... | [
"os.environ.get",
"base64.b64decode"
] | [((53, 74), 'os.environ.get', 'environ.get', (['"""DEPLOY"""'], {}), "('DEPLOY')\n", (64, 74), False, 'from os import environ\n'), ((200, 217), 'os.environ.get', 'environ.get', (['name'], {}), '(name)\n', (211, 217), False, 'from os import environ\n'), ((584, 636), 'os.environ.get', 'environ.get', (['"""ROOT_MEMBERS_ID... |
"""
@author: <NAME>
modulos encargados del comportamiento los enemigos
"""
import math
from Armas import Anillo
from Armas import ArmaAtaqueTriangular
from Armas import ArmaBarrera
from Armas import ArmaEstandarApuntada
class Enemigo :
"""Enemigo simple, sigue un recorrido y dispara siempre que puede ha... | [
"Armas.ArmaAtaqueTriangular",
"Armas.ArmaBarrera",
"Armas.Anillo",
"Armas.ArmaEstandarApuntada",
"math.radians"
] | [((989, 1024), 'Armas.ArmaEstandarApuntada', 'ArmaEstandarApuntada', (['(60)', '"""Enemigo"""'], {}), "(60, 'Enemigo')\n", (1009, 1024), False, 'from Armas import ArmaEstandarApuntada\n'), ((4453, 4497), 'Armas.ArmaAtaqueTriangular', 'ArmaAtaqueTriangular', (['(45)', '"""Enemigo"""', '(270)', '(30)'], {}), "(45, 'Enemi... |
""" Global Flask Application Settings """
import os
class Config(object):
DEBUG = False
TESTING = False
BASE_DIR = os.path.dirname(__file__)
CLIENT_DIR = os.path.join(BASE_DIR, 'client')
if not os.path.exists(CLIENT_DIR):
raise Exception(
'Client App directory not found: {}'.... | [
"os.path.join",
"os.environ.get",
"os.path.dirname",
"os.path.exists"
] | [((130, 155), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (145, 155), False, 'import os\n'), ((173, 205), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""client"""'], {}), "(BASE_DIR, 'client')\n", (185, 205), False, 'import os\n'), ((666, 706), 'os.environ.get', 'os.environ.get', (['"""... |
"""Definition of ResUNet architecture"""
# Taken from https://github.com/nikhilroxtomar/Deep-Residual-Unet/blob/master/Deep%20Residual%20UNet.ipynb
from tensorflow import keras
def bn_act(x, act=True):
x = keras.layers.BatchNormalization()(x)
if act == True:
x = keras.layers.Activation("relu")(x)
... | [
"tensorflow.keras.models.Model",
"tensorflow.keras.layers.Add",
"tensorflow.keras.layers.UpSampling2D",
"tensorflow.keras.layers.Input",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Concatenate"
] | [((1710, 1778), 'tensorflow.keras.layers.Input', 'keras.layers.Input', (['(input_shape[0], input_shape[1], input_shape[2])'], {}), '((input_shape[0], input_shape[1], input_shape[2]))\n', (1728, 1778), False, 'from tensorflow import keras\n'), ((2551, 2586), 'tensorflow.keras.models.Model', 'keras.models.Model', (['inpu... |
# Generated by Django 3.2.7 on 2021-09-09 08:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='firstgasstation',
... | [
"django.db.models.ForeignKey"
] | [((365, 473), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""api.service"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, to='api.service')\n", (382, 473), False, 'from django.db... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import pandas as pd
from Bio import SeqIO
import re
import numpy as np
import time
anno_file = sys.argv[1]
exonskip_file = sys.argv[2]
ref_file = sys.argv[3]
geneRef_file = sys.argv[4]
intron_ref_file = sys.argv[5]
output_file = sys.argv[6]
'''Part 0: import ... | [
"Bio.SeqIO.parse",
"re.finditer",
"pandas.Series",
"numpy.isnan",
"pandas.read_csv",
"time.time",
"pandas.concat"
] | [((339, 383), 'pandas.read_csv', 'pd.read_csv', (['anno_file'], {'index_col': '(0)', 'sep': '""" """'}), "(anno_file, index_col=0, sep=' ')\n", (350, 383), True, 'import pandas as pd\n'), ((461, 509), 'pandas.read_csv', 'pd.read_csv', (['exonskip_file'], {'index_col': '(0)', 'sep': '""" """'}), "(exonskip_file, index_c... |
import os
from setuptools import setup, find_packages
import subprocess
def get_long_description():
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
return long_description
def pa... | [
"os.path.join",
"os.path.dirname",
"setuptools.find_packages"
] | [((139, 164), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (154, 164), False, 'import os\n'), ((1164, 1179), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1177, 1179), False, 'from setuptools import setup, find_packages\n'), ((181, 222), 'os.path.join', 'os.path.join', (['... |
import socket
from dns_shark.resolver_core import ResolverCore
from typing import List
from dns_shark.resource_record import ResourceRecord
from random import Random
class Resolver:
"""
This class contains the API for dns shark.
These are the methods that should be used by any other developer seeking to ... | [
"random.Random",
"socket.socket"
] | [((1373, 1421), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (1386, 1421), False, 'import socket\n'), ((1521, 1529), 'random.Random', 'Random', ([], {}), '()\n', (1527, 1529), False, 'from random import Random\n')] |
import time
import argparse
import numpy as np
import matplotlib.pyplot as plt
import torch
import torchvision
import torchvision.transforms as transforms
import n3ml.model
import n3ml.encoder
import n3ml.optimizer
def accuracy(r: torch.Tensor, label: int) -> torch.Tensor:
"""
:param r: (time interval, # ... | [
"torch.rand",
"torch.zeros_like",
"argparse.ArgumentParser",
"torch.save",
"torch.sum",
"torch.stack",
"torchvision.transforms.ToTensor",
"torch.zeros"
] | [((785, 804), 'torch.zeros_like', 'torch.zeros_like', (['r'], {}), '(r)\n', (801, 804), False, 'import torch\n'), ((1706, 1747), 'torch.zeros', 'torch.zeros', (['(time_interval, num_classes)'], {}), '((time_interval, num_classes))\n', (1717, 1747), False, 'import torch\n'), ((5858, 5883), 'argparse.ArgumentParser', 'ar... |
# Generated by Django 2.2.2 on 2019-07-08 20:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Project',
fields=[
... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.DateTimeField",
"django.db.models.DateField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.OneToOneField"
] | [((3667, 3792), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'related_name': '"""developers"""', 'through': '"""tasksmanager.DeveloperWorkTask"""', 'to': '"""tasksmanager.Developer"""'}), "(related_name='developers', through=\n 'tasksmanager.DeveloperWorkTask', to='tasksmanager.Developer')\n",... |
# coding=utf-8
import requests
import getinfo
def run(studata,cook):
"""获取处理后的数据
:param studatae:学生信息
:param cook:传入的cookie
:return :打卡结果
"""
# 读取个人提交信息
info = getinfo.data(studata, cook)
if info == 0:
print("今日打卡已完成,自动打卡取消\n")
return "已完成"
# 提交今日打卡
url = 'https... | [
"requests.post",
"getinfo.data"
] | [((190, 217), 'getinfo.data', 'getinfo.data', (['studata', 'cook'], {}), '(studata, cook)\n', (202, 217), False, 'import getinfo\n'), ((484, 527), 'requests.post', 'requests.post', (['url'], {'json': 'info', 'headers': 'head'}), '(url, json=info, headers=head)\n', (497, 527), False, 'import requests\n')] |
import os
from keras.models import load_model
from keras import models
from keras import backend as K
from keras_preprocessing import image
import numpy as np
import matplotlib.pyplot as plt
from keras.models import load_model
import cv2
# cnn可视化,参考deep learning with python一书
class PredictImg():
def ... | [
"matplotlib.pyplot.grid",
"keras_preprocessing.image.load_img",
"keras.backend.function",
"matplotlib.pyplot.figure",
"numpy.zeros",
"keras.backend.mean",
"numpy.uint8",
"keras.backend.gradients",
"os.getcwd",
"numpy.maximum",
"matplotlib.pyplot.show",
"keras.models.load_model",
"matplotlib.... | [((5059, 5070), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (5068, 5070), False, 'import os\n'), ((471, 522), 'keras_preprocessing.image.load_img', 'image.load_img', (['self.img_path'], {'target_size': '(80, 80)'}), '(self.img_path, target_size=(80, 80))\n', (485, 522), False, 'from keras_preprocessing import image\n')... |
import torch
import torch.nn.utils.rnn as rnn
import numpy as np
import pandas
from torch.utils.data import Dataset
from sklearn.preprocessing import LabelEncoder
from parsers.spacy_wrapper import spacy_whitespace_parser as spacy_ws
from common.symbols import SPACY_POS_TAGS
import json
import transformers
from transfo... | [
"torch.LongTensor",
"transformers.BertTokenizer.from_pretrained",
"pandas.read_csv",
"numpy.array",
"sklearn.preprocessing.LabelEncoder",
"common.symbols.SPACY_POS_TAGS.index"
] | [((1625, 1703), 'pandas.read_csv', 'pandas.read_csv', (['self.file_path'], {'sep': 'self.sep', 'header': '(0)', 'keep_default_na': '(False)'}), '(self.file_path, sep=self.sep, header=0, keep_default_na=False)\n', (1640, 1703), False, 'import pandas\n'), ((6787, 6833), 'transformers.BertTokenizer.from_pretrained', 'Bert... |
# -*- coding: utf-8 -*-
import tkinter as tk
from tkinter import ttk
import noval.ui_base as ui_base
class TextFrame(ttk.Frame):
def __init__(
self,
master,
show_scrollbar=True,
borderwidth=0,
relief="flat",
text_class = tk.Text,
**kw
):
#设置文本框边界高... | [
"tkinter.ttk.Frame.__init__",
"noval.ui_base.SafeScrollbar"
] | [((330, 402), 'tkinter.ttk.Frame.__init__', 'ttk.Frame.__init__', (['self', 'master'], {'borderwidth': 'borderwidth', 'relief': 'relief'}), '(self, master, borderwidth=borderwidth, relief=relief)\n', (348, 402), False, 'from tkinter import ttk\n'), ((484, 543), 'noval.ui_base.SafeScrollbar', 'ui_base.SafeScrollbar', ([... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Small set of shims that when imported by shape.bzl makes it valid python that
can be imported and unit tested.
On... | [
"dataclasses.is_dataclass",
"dataclasses.asdict"
] | [((611, 642), 'dataclasses.is_dataclass', 'dataclasses.is_dataclass', (['right'], {}), '(right)\n', (635, 642), False, 'import dataclasses\n'), ((676, 700), 'dataclasses.asdict', 'dataclasses.asdict', (['left'], {}), '(left)\n', (694, 700), False, 'import dataclasses\n'), ((704, 729), 'dataclasses.asdict', 'dataclasses... |
from matching import approximate_matcher
from matching import query_parser
from matching import reaction_matcher
from util import singleton
@singleton.Singleton
class ServiceConfig(object):
"""A singleton class that contains global service configuration and state.
All state/config is considered unmodifia... | [
"matching.query_parser.QueryParser",
"matching.reaction_matcher.ReactionMatcher",
"matching.approximate_matcher.CascadingMatcher"
] | [((391, 417), 'matching.query_parser.QueryParser', 'query_parser.QueryParser', ([], {}), '()\n', (415, 417), False, 'from matching import query_parser\n'), ((451, 518), 'matching.approximate_matcher.CascadingMatcher', 'approximate_matcher.CascadingMatcher', ([], {'max_results': '(10)', 'min_score': '(0.1)'}), '(max_res... |
import mxnet as mx
import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import random
def parse_xml(xml_path):
bbox= []
tree = ET.parse(xml_path)
root = tree.getroot()
objects = root.findall('object')
for object in objects:
name = object.fi... | [
"matplotlib.patches.Rectangle",
"random.random",
"matplotlib.pyplot.imshow",
"mxnet.image.imdecode",
"matplotlib.pyplot.subplots",
"xml.etree.ElementTree.parse",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis"
] | [((187, 205), 'xml.etree.ElementTree.parse', 'ET.parse', (['xml_path'], {}), '(xml_path)\n', (195, 205), True, 'import xml.etree.ElementTree as ET\n'), ((702, 716), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (714, 716), True, 'import matplotlib.pyplot as plt\n'), ((721, 738), 'matplotlib.pyplot.ims... |
import getopt
import sys
import requests
from selenium import webdriver
import settings
class BotBase(object):
def __init__(self, argv, url):
self.__url = url
self.__menu__(argv=argv)
self.__start_driver__()
@property
def driver(self):
return self.__driver
@property
... | [
"requests.get",
"getopt.getopt",
"sys.exit",
"time.sleep",
"selenium.webdriver.PhantomJS"
] | [((785, 839), 'requests.get', 'requests.get', ([], {'url': '"""http://gimmeproxy.com/api/getProxy"""'}), "(url='http://gimmeproxy.com/api/getProxy')\n", (797, 839), False, 'import requests\n'), ((1576, 1669), 'selenium.webdriver.PhantomJS', 'webdriver.PhantomJS', ([], {'executable_path': 'settings.PHANTOMJS_DRIVER', 'd... |
"""API URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/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-based vie... | [
"django.urls.include",
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((838, 868), 'django.conf.urls.url', 'url', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (841, 868), False, 'from django.conf.urls import url\n'), ((1183, 1246), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.S... |
from io import BytesIO
from os.path import dirname, join
from zipfile import ZipFile
import requests
import typer
from github import Github
from github.GitReleaseAsset import GitReleaseAsset
from perke.cli.base import app
@app.command('download')
def download_command() -> None:
"""
Perke requires a trained ... | [
"typer.progressbar",
"io.BytesIO",
"github.Github",
"os.path.dirname",
"requests.get",
"zipfile.ZipFile",
"typer.echo",
"perke.cli.base.app.command"
] | [((227, 250), 'perke.cli.base.app.command', 'app.command', (['"""download"""'], {}), "('download')\n", (238, 250), False, 'from perke.cli.base import app\n'), ((1010, 1018), 'github.Github', 'Github', ([], {}), '()\n', (1016, 1018), False, 'from github import Github\n'), ((2214, 2247), 'typer.echo', 'typer.echo', (['""... |
"""Name finder - find and return a unoccupied name."""
import os
from itertools import count
def _standard_name_finder(
basename, norm_occupied,
ids_generator=lambda: count(start=1),
formatter=lambda **frags: '{basename}-{id}'.format(**frags),
):
"""Help to build a name finder.
Args... | [
"os.path.splitext",
"itertools.count"
] | [((187, 201), 'itertools.count', 'count', ([], {'start': '(1)'}), '(start=1)\n', (192, 201), False, 'from itertools import count\n'), ((1725, 1739), 'itertools.count', 'count', ([], {'start': '(1)'}), '(start=1)\n', (1730, 1739), False, 'from itertools import count\n'), ((2596, 2619), 'itertools.count', 'count', ([], {... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: moling
# @Date: 2016-12-12 18:12:23
# @Last Modified time: 2016-12-12 18:26:35
from flask import current_app, g, request
from app.models import User
def login_user():
print('login_user')
cookie = request.cookies.get(current_app.config['COOKIE_NAME'])
... | [
"app.models.User.find_by_cookie",
"flask.request.cookies.get"
] | [((265, 319), 'flask.request.cookies.get', 'request.cookies.get', (["current_app.config['COOKIE_NAME']"], {}), "(current_app.config['COOKIE_NAME'])\n", (284, 319), False, 'from flask import current_app, g, request\n'), ((333, 360), 'app.models.User.find_by_cookie', 'User.find_by_cookie', (['cookie'], {}), '(cookie)\n',... |
#
# Creates tables GTF, GTF_genes
# in db ensembl and fill them
#
import gzip, time
from io import TextIOWrapper
import mysql.connector
from util import execute_insert, reportTime
#=== table GTF ============
INSTR_CREATE_GTF = """CREATE TABLE IF NOT EXISTS GTF(
chromosome varchar(4) DEFAULT NULL,
sou... | [
"util.execute_insert",
"time.time",
"util.reportTime",
"io.TextIOWrapper",
"gzip.open"
] | [((3580, 3591), 'time.time', 'time.time', ([], {}), '()\n', (3589, 3591), False, 'import gzip, time\n'), ((4710, 4751), 'util.reportTime', 'reportTime', (['"""Done_GTF"""', 'total', 'start_time'], {}), "('Done_GTF', total, start_time)\n", (4720, 4751), False, 'from util import execute_insert, reportTime\n'), ((5120, 51... |
import time
import helpers
from pages import Page
from RunProtocolModal import RunProtocolModal
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
#WELCOME_SPLASH_SCREEN = (By.CLASS_NAME, "welcome-overlays")
W... | [
"RunProtocolModal.RunProtocolModal",
"pages.Page.__init__",
"time.sleep"
] | [((1785, 1812), 'pages.Page.__init__', 'Page.__init__', (['self', 'driver'], {}), '(self, driver)\n', (1798, 1812), False, 'from pages import Page\n'), ((2901, 2914), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (2911, 2914), False, 'import time\n'), ((3035, 3048), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 3 15:00:32 2020
@author: parsotak
"""
## Using pandas to read data with date time and float
import pandas as pd
import numpy as np
import datetime
import matplotlib.dates as mdates
from pandas.plotting import register_matplotlib_converters
regis... | [
"pandas.plotting.register_matplotlib_converters",
"matplotlib.dates.DateFormatter",
"pandas.to_datetime",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"pandas.read_csv",
"matplotlib.dates.DayLocator"
] | [((315, 347), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (345, 347), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((492, 526), 'pandas.read_csv', 'pd.read_csv', (['infile'], {'delimiter': '""","""'}), "(infile, delimiter=',')\n", (503... |
import time
from google.cloud import pubsub_v1
import google.api_core.exceptions
PROJECT_ID = "k8strain-301514"
# Executed in a thread to receive messages using streaming pull
def receive_message_1(message):
print("Message from subscription 1 ", message.data)
message.ack()
# Be careful not reading lots... | [
"time.sleep",
"google.cloud.pubsub_v1.SubscriberClient"
] | [((346, 359), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (356, 359), False, 'import time\n'), ((527, 540), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (537, 540), False, 'import time\n'), ((926, 954), 'google.cloud.pubsub_v1.SubscriberClient', 'pubsub_v1.SubscriberClient', ([], {}), '()\n', (952, 954),... |
import torch
import torch.nn as nn
class Flatten(nn.Module):
def forward(self, input):
return input.view(input.size(0), -1)
class UnFlatten(nn.Module):
def forward(self, input):
return input.view(input.size(0), 64, 6, 6)
class VAE(nn.Module):
def __init__(self, image_channels=3, z_dim=32)... | [
"torch.nn.Linear",
"torch.nn.ReLU",
"torch.nn.Sigmoid",
"torch.nn.ConvTranspose2d",
"torch.nn.Conv2d"
] | [((724, 747), 'torch.nn.Linear', 'nn.Linear', (['h_dim', 'z_dim'], {}), '(h_dim, z_dim)\n', (733, 747), True, 'import torch.nn as nn\n'), ((767, 790), 'torch.nn.Linear', 'nn.Linear', (['h_dim', 'z_dim'], {}), '(h_dim, z_dim)\n', (776, 790), True, 'import torch.nn as nn\n'), ((810, 833), 'torch.nn.Linear', 'nn.Linear', ... |
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter
class FenceRendererMixin:
def Fence(self, node):
if not node.lang:
self('<pre><code>')
self.value_(node)
self('</code></pre>')
return
... | [
"pygments.lexers.get_lexer_by_name",
"pygments.formatters.HtmlFormatter"
] | [((335, 363), 'pygments.lexers.get_lexer_by_name', 'get_lexer_by_name', (['node.lang'], {}), '(node.lang)\n', (352, 363), False, 'from pygments.lexers import get_lexer_by_name\n'), ((406, 421), 'pygments.formatters.HtmlFormatter', 'HtmlFormatter', ([], {}), '()\n', (419, 421), False, 'from pygments.formatters import Ht... |
import xml.etree.ElementTree as ET
import gzip
import glob
import os
# mytree = ET.parse('simple_xml.xml')
# myroot = mytree.getroot()
# print(myroot)
"""
data='''<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<food>
<item name="breakfast">Idly</item>
<price>$2.5</price>
<description>
Two idly's with... | [
"gzip.open",
"glob.glob"
] | [((2056, 2117), 'glob.glob', 'glob.glob', (['"""D:\\\\Software\\\\Untitled Project\\\\2020\\\\Apr\\\\*.als"""'], {}), "('D:\\\\Software\\\\Untitled Project\\\\2020\\\\Apr\\\\*.als')\n", (2065, 2117), False, 'import glob\n'), ((900, 920), 'gzip.open', 'gzip.open', (['directory'], {}), '(directory)\n', (909, 920), False,... |
import aiohttp
import pydash
import json
class ApiReport():
def __init__(self, httpclient):
self._httpclient = httpclient
async def req_recommend(self, worker_id):
request = self._httpclient.request()
url = self._httpclient.scheduler_url('/reports/recommend')
try:
a... | [
"json.dumps"
] | [((722, 755), 'json.dumps', 'json.dumps', (["{'worker': worker_id}"], {}), "({'worker': worker_id})\n", (732, 755), False, 'import json\n'), ((1262, 1285), 'json.dumps', 'json.dumps', (['update_body'], {}), '(update_body)\n', (1272, 1285), False, 'import json\n'), ((2796, 2844), 'json.dumps', 'json.dumps', (["{'message... |
from sklearn.metrics import f1_score
import json
from json import JSONEncoder
import numpy as np
# This function calculates the F1-score
def calculate_f1_score(predictions, labels):
f1 = f1_score(predictions, labels)
return f1
# Serializes an object to json
def save_json(result, filename) -> None:
"""
... | [
"json.load",
"json.dumps",
"sklearn.metrics.f1_score"
] | [((192, 221), 'sklearn.metrics.f1_score', 'f1_score', (['predictions', 'labels'], {}), '(predictions, labels)\n', (200, 221), False, 'from sklearn.metrics import f1_score\n'), ((1050, 1062), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1059, 1062), False, 'import json\n'), ((619, 647), 'json.dumps', 'json.dumps', (... |
# -*- coding: utf-8 -*-
"""
Fast and exit-safe interface to PyGRASS Raster and Vector layer
using multiprocessing
(C) 2015 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
:authors: <NAME>
"""
from grass.... | [
"multiprocessing.Lock",
"logging.debug",
"sys.exit",
"multiprocessing.Pipe",
"multiprocessing.Process",
"threading.Thread",
"threading.Lock",
"logging.warning",
"doctest.testmod",
"time.sleep"
] | [((5744, 5761), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (5759, 5761), False, 'import doctest\n'), ((2191, 2207), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2205, 2207), False, 'import threading\n'), ((2711, 2755), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.thread_checker'}... |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from math import sqrt
import control as ctl
from control.matlab import *
class identificaParametros():
def __init__(self, dados):
self._t_aux = np.linspace(0,5,5001)
self._v_aux = 0*np.linspace(0,5,5001)
self._u = (11.... | [
"numpy.linspace",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.xlim",
"pandas.read_csv",
"numpy.log",
"matplotlib.pyplot.close",
"numpy.ones",
"matplotlib.pyplot.title",
"numpy.array",
"matplotlib.pyplot.save... | [((230, 253), 'numpy.linspace', 'np.linspace', (['(0)', '(5)', '(5001)'], {}), '(0, 5, 5001)\n', (241, 253), True, 'import numpy as np\n'), ((454, 505), 'pandas.read_csv', 'pd.read_csv', (['f"""Python\\\\Dados\\\\{dados}.csv"""'], {'sep': '""";"""'}), "(f'Python\\\\Dados\\\\{dados}.csv', sep=';')\n", (465, 505), True, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: ampel/contrib/hu/t3/TNSTalker.py
# License: BSD-3-Clause
# Author: <EMAIL>
# Date: 17.11.2018
# Last Modified Date: 04.09.2019
# Last Modified By: <NAME> <<EMAIL>>
import re
from itertools import islice
fro... | [
"itertools.islice",
"io.StringIO",
"slack.errors.SlackClientError",
"json.dump",
"ampel.ztf.util.ZTFIdMapper.to_ztf_id",
"datetime.datetime.today",
"ampel.struct.JournalAttributes.JournalAttributes",
"re.sub"
] | [((7017, 7040), 'ampel.ztf.util.ZTFIdMapper.to_ztf_id', 'to_ztf_id', (['tran_view.id'], {}), '(tran_view.id)\n', (7026, 7040), False, 'from ampel.ztf.util.ZTFIdMapper import to_ztf_id\n'), ((8683, 8706), 'ampel.ztf.util.ZTFIdMapper.to_ztf_id', 'to_ztf_id', (['tran_view.id'], {}), '(tran_view.id)\n', (8692, 8706), False... |
from skimage.measure import moments_normalized, moments_central, moments_hu
from numpy import sign, log10, abs, sum, divide, ndarray
def match_shapes(img_a: ndarray, img_b: ndarray):
'''
This function takes in input two images and returns
the distances between the images using the HU moments.
... | [
"numpy.abs",
"skimage.measure.moments_central",
"numpy.sign"
] | [((656, 680), 'numpy.abs', 'abs', (['(1 / hu_b - 1 / hu_a)'], {}), '(1 / hu_b - 1 / hu_a)\n', (659, 680), False, 'from numpy import sign, log10, abs, sum, divide, ndarray\n'), ((695, 711), 'numpy.abs', 'abs', (['(hu_b - hu_a)'], {}), '(hu_b - hu_a)\n', (698, 711), False, 'from numpy import sign, log10, abs, sum, divide... |
#! /usr/bin/env python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Toaster Implementation
#
# Copyright (C) 2013-2016 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License... | [
"orm.models.Project.objects.create_project",
"orm.models.Release.objects.create",
"django.utils.timezone.now",
"orm.models.Target.objects.create",
"django.core.urlresolvers.reverse",
"re.search",
"orm.models.BitbakeVersion.objects.create",
"orm.models.Build.objects.create"
] | [((1272, 1363), 'orm.models.BitbakeVersion.objects.create', 'BitbakeVersion.objects.create', ([], {'name': '"""bbv1"""', 'giturl': '"""/tmp/"""', 'branch': '"""master"""', 'dirpath': '""""""'}), "(name='bbv1', giturl='/tmp/', branch='master',\n dirpath='')\n", (1301, 1363), False, 'from orm.models import BitbakeVers... |
import sys
import time
def gera():
r = []
for n in range(100):
yield n
time.sleep(0.1)
return r
g = gera()
for v in g:
print(v) | [
"time.sleep"
] | [((96, 111), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (106, 111), False, 'import time\n')] |
from django.urls import path
import views
urlpatterns = [
path('api/location-search', views.location_search, name='location_search'),
path('api/object-params', views.get_object_params, name='get_object_params'),
path('api/transport-means', views.get_transport_means, name='get_transport_means')
]
| [
"django.urls.path"
] | [((63, 137), 'django.urls.path', 'path', (['"""api/location-search"""', 'views.location_search'], {'name': '"""location_search"""'}), "('api/location-search', views.location_search, name='location_search')\n", (67, 137), False, 'from django.urls import path\n'), ((143, 219), 'django.urls.path', 'path', (['"""api/object... |
from logging import Logger, getLogger
from typing import List, Optional
from pydantic import BaseModel, create_model
from fastapi import Depends, Body, Request, Response
from fastapi.applications import FastAPI
from fastapi_rest_jsonapi.common import Methods
from fastapi_rest_jsonapi.common.exceptions import RestAPIExc... | [
"logging.getLogger",
"fastapi_rest_jsonapi.resource.utils.is_detail_resource",
"fastapi.Depends",
"pydantic.create_model",
"fastapi.Body"
] | [((2315, 2343), 'fastapi_rest_jsonapi.resource.utils.is_detail_resource', 'is_detail_resource', (['resource'], {}), '(resource)\n', (2333, 2343), False, 'from fastapi_rest_jsonapi.resource.utils import is_detail_resource\n'), ((2531, 2599), 'pydantic.create_model', 'create_model', (['f"""{schema.__type__}-{method}-{mod... |
# <NAME> <<EMAIL>>
# 10 Jan 2016
# N-array tree drawing for avtomation.com
import pygame
import math
class Tree:
root = None
_next_id = -1
depth = -1
numChildren = -1
positions = {} # (index,depth) array
def __init__(self,depth,numChildren):
self.depth = depth
self.numChildren = numChildren
self.root = sel... | [
"pygame.display.set_mode",
"pygame.display.update",
"pygame.draw.line",
"math.floor"
] | [((3353, 3396), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(1000, 600)', '(0)', '(32)'], {}), '((1000, 600), 0, 32)\n', (3376, 3396), False, 'import pygame\n'), ((3581, 3604), 'pygame.display.update', 'pygame.display.update', ([], {}), '()\n', (3602, 3604), False, 'import pygame\n'), ((2304, 2444), 'pygam... |
#!/usr/bin/env python
# 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, software
# d... | [
"dino.environ.env.config.get",
"logging.getLogger",
"werkzeug.contrib.fixers.ProxyFix",
"os.environ.get",
"flask.Flask"
] | [((798, 825), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (815, 825), False, 'import logging\n'), ((842, 871), 'logging.getLogger', 'logging.getLogger', (['"""socketio"""'], {}), "('socketio')\n", (859, 871), False, 'import logging\n'), ((1053, 1068), 'flask.Flask', 'Flask', (['__name_... |
import os
from PIL import Image
import numpy as np
from sldc import TileExtractionException, alpha_rasterize
from sldc_cytomine import CytomineSlide, CytomineTile, CytomineTileBuilder
class CytomineProjectionSlide(CytomineSlide):
def __init__(self, img_instance, projection):
self._img_instance = img_inst... | [
"os.path.join",
"PIL.Image.open",
"os.path.exists"
] | [((1300, 1348), 'os.path.join', 'os.path.join', (['self._working_path', 'cache_filename'], {}), '(self._working_path, cache_filename)\n', (1312, 1348), False, 'import os\n'), ((1368, 1394), 'os.path.exists', 'os.path.exists', (['cache_path'], {}), '(cache_path)\n', (1382, 1394), False, 'import os\n'), ((1824, 1846), 'P... |
from tensorflow.keras.models import load_model
from detect_and_predict_mask import Mask
import imutils
import numpy as np
import time
import cv2
import logger
class Videopred:
def __init__(self):
self.log_writer = logger.App_Logger()
self.file_object = open("../logs/Detect_from_video.log", 'a+')
... | [
"logger.App_Logger",
"cv2.destroyAllWindows",
"tensorflow.keras.models.load_model",
"cv2.imshow",
"cv2.dnn.readNet",
"imutils.resize",
"cv2.waitKey",
"cv2.rectangle",
"detect_and_predict_mask.Mask",
"cv2.putText",
"cv2.VideoCapture",
"time.sleep"
] | [((227, 246), 'logger.App_Logger', 'logger.App_Logger', ([], {}), '()\n', (244, 246), False, 'import logger\n'), ((593, 635), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['prototxtpath', 'weightspath'], {}), '(prototxtpath, weightspath)\n', (608, 635), False, 'import cv2\n'), ((734, 784), 'tensorflow.keras.models.load_model... |
"""Script to update AH with contract configs."""
import contextlib
import json
import os
import yaml
@contextlib.contextmanager
def cd(path):
"""Change directory with context manager."""
old_cwd = os.getcwd()
try:
os.chdir(path)
yield
os.chdir(old_cwd)
except Exception as e: ... | [
"os.getcwd",
"os.system",
"json.dumps",
"yaml.safe_load",
"os.chdir"
] | [((209, 220), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (218, 220), False, 'import os\n'), ((854, 875), 'json.dumps', 'json.dumps', (['addresses'], {}), '(addresses)\n', (864, 875), False, 'import json\n'), ((238, 252), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (246, 252), False, 'import os\n'), ((275, 292)... |
import json
import boto3
import os
from flask import Flask, request
from flask.wrappers import Response
app = Flask(__name__)
# Set allowance to serve from all IP addresses and ports
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80)
# Set table name from environment variables, the table name is a variable ... | [
"boto3.client",
"boto3.resource",
"flask.Flask"
] | [((110, 125), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (115, 125), False, 'from flask import Flask, request\n'), ((586, 610), 'boto3.client', 'boto3.client', (['"""dynamodb"""'], {}), "('dynamodb')\n", (598, 610), False, 'import boto3\n'), ((623, 649), 'boto3.resource', 'boto3.resource', (['"""dynamo... |
import discord
import asyncio
from app.vars.client import client
from app.helpers import Notify, getUser
from discord.ext import commands
@client.command(aliases=['removeban','xunban','unbanid', 'unban_id', 'id_unban'])
@commands.guild_only()
@commands.has_permissions(ban_members=True)
async def unban(ctx, id):
no... | [
"app.helpers.Notify",
"discord.ext.commands.guild_only",
"app.vars.client.client.command",
"asyncio.sleep",
"discord.ext.commands.has_permissions",
"app.helpers.getUser.byID"
] | [((140, 226), 'app.vars.client.client.command', 'client.command', ([], {'aliases': "['removeban', 'xunban', 'unbanid', 'unban_id', 'id_unban']"}), "(aliases=['removeban', 'xunban', 'unbanid', 'unban_id',\n 'id_unban'])\n", (154, 226), False, 'from app.vars.client import client\n'), ((222, 243), 'discord.ext.commands... |
"""Data update coordinator for integration blueprint."""
from __future__ import annotations
from typing import Any
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .api import... | [
"homeassistant.helpers.update_coordinator.UpdateFailed"
] | [((1274, 1297), 'homeassistant.helpers.update_coordinator.UpdateFailed', 'UpdateFailed', (['exception'], {}), '(exception)\n', (1286, 1297), False, 'from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed\n')] |
import logging
from datetime import datetime
from pathlib import Path
import pytorch_lightning as pl
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import TensorBoardLogger
from src.registry import Registry
from src.utils.config_validation import Config
from src.utils.helpers import... | [
"src.registry.Registry.init_modules",
"pytorch_lightning.Trainer",
"torch.load",
"logging.log",
"datetime.datetime.now",
"pathlib.Path",
"src.utils.helpers.create_config_parser",
"torch.onnx.export",
"pytorch_lightning.seed_everything",
"src.utils.config_validation.Config"
] | [((377, 401), 'pytorch_lightning.seed_everything', 'pl.seed_everything', (['seed'], {}), '(seed)\n', (395, 401), True, 'import pytorch_lightning as pl\n'), ((421, 435), 'pathlib.Path', 'Path', (['"""./runs"""'], {}), "('./runs')\n", (425, 435), False, 'from pathlib import Path\n'), ((1317, 1340), 'src.registry.Registry... |
import sqlite3
import time
from hashlib import md5
import smtplib
from email.header import Header
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formataddr
def send_email(db, to_addr, weight):
cur = db.cursor()
old_cote = cur.execute('SELECT * FROM ... | [
"email.mime.text.MIMEText",
"email.header.Header",
"smtplib.SMTP",
"sqlite3.connect",
"time.time",
"email.mime.multipart.MIMEMultipart"
] | [((2099, 2130), 'sqlite3.connect', 'sqlite3.connect', (['"""../db.sqlite"""'], {}), "('../db.sqlite')\n", (2114, 2130), False, 'import sqlite3\n'), ((1246, 1274), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', (['"""alternative"""'], {}), "('alternative')\n", (1259, 1274), False, 'from email.mime.multipart impo... |
import nanoid
from django.conf import settings
def generate_id():
return nanoid.generate(size=settings.SNOWFLAKE_SIZE)
| [
"nanoid.generate"
] | [((79, 124), 'nanoid.generate', 'nanoid.generate', ([], {'size': 'settings.SNOWFLAKE_SIZE'}), '(size=settings.SNOWFLAKE_SIZE)\n', (94, 124), False, 'import nanoid\n')] |
"""Signatures api tests"""
from rest_framework.test import APITestCase
from django.contrib.auth.models import User
from specialhandling.checks.models import Check
from specialhandling.signatures.models import Signature
class SignatureAPIGetTests(APITestCase):
"""Get tests"""
def setUp(self):
self.t... | [
"specialhandling.signatures.models.Signature.objects.get",
"specialhandling.signatures.models.Signature.objects.create",
"specialhandling.checks.models.Check.objects.create",
"django.contrib.auth.models.User.objects.create_user",
"django.contrib.auth.models.User.objects.create_superuser"
] | [((331, 385), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', (['"""jim"""', '"""<EMAIL>"""', '"""kerrigan"""'], {}), "('jim', '<EMAIL>', 'kerrigan')\n", (355, 385), False, 'from django.contrib.auth.models import User\n'), ((438, 492), 'django.contrib.auth.models.User.objects.create_u... |
import random
import pytest
@pytest.fixture(scope='session')
def freezed_random(request):
random.seed(a=request.node.name)
return random
| [
"pytest.fixture",
"random.seed"
] | [((32, 63), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (46, 63), False, 'import pytest\n'), ((97, 129), 'random.seed', 'random.seed', ([], {'a': 'request.node.name'}), '(a=request.node.name)\n', (108, 129), False, 'import random\n')] |
import logging
from logging import StreamHandler
from _pytest.logging import LogCaptureFixture
from starlite.logging import LoggingConfig
config = LoggingConfig(root={"handlers": ["queue_listener"], "level": "WARNING"})
config.configure()
logger = logging.getLogger()
def test_logger(caplog: LogCaptureFixture) -> N... | [
"starlite.logging.LoggingConfig",
"logging.getLogger"
] | [((150, 222), 'starlite.logging.LoggingConfig', 'LoggingConfig', ([], {'root': "{'handlers': ['queue_listener'], 'level': 'WARNING'}"}), "(root={'handlers': ['queue_listener'], 'level': 'WARNING'})\n", (163, 222), False, 'from starlite.logging import LoggingConfig\n'), ((251, 270), 'logging.getLogger', 'logging.getLogg... |
from __future__ import unicode_literals
from django.db import models
import datetime as dt
from django.contrib.auth.mixins import LoginRequiredMixin
from django.dispatch import receiver
from django.db.models.signals import (post_save,pre_save,)
# from PIL import Image
from django.core.files import File
from django.disp... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.URLField",
"django.db.models.signals.post_save.connect",
"phonenumber_field.modelfields.PhoneNumberField",
"django.db.models.TextField",
"django.db.models.EmailField",
"numpy.mean",
"cloudinary.models.CloudinaryField",... | [((1750, 1796), 'django.db.models.signals.post_save.connect', 'post_save.connect', (['create_profile'], {'sender': 'User'}), '(create_profile, sender=User)\n', (1767, 1796), False, 'from django.db.models.signals import post_save, pre_save\n'), ((620, 683), 'django.db.models.OneToOneField', 'models.OneToOneField', (['Us... |
import ncs
import re
# class to be added..
class CommonUtil :
def getDeviceType(self,service, device, name):
device = device.ncs__devices.device[name]
if(device.device_type.netconf.exists()):
device_type = "netconf"
return device_type
if(device.device_type.cli.ex... | [
"re.compile"
] | [((1732, 1762), 're.compile', 're.compile', (['"""[^0-9]+([0-9]+)$"""'], {}), "('[^0-9]+([0-9]+)$')\n", (1742, 1762), False, 'import re\n'), ((2186, 2216), 're.compile', 're.compile', (['"""[^0-9]+([0-9]+)$"""'], {}), "('[^0-9]+([0-9]+)$')\n", (2196, 2216), False, 'import re\n')] |
import os
import os.path as osp
from glob import glob
import numpy as np
import cv2
import h5py
import torch
from torch.utils.data import Dataset
# My libraries
import utils.data_augmentation as data_augmentation
import constants
class Omniverse_Dataset(Dataset):
def __init__(self, root_dir,... | [
"utils.data_augmentation.dropout_random_ellipses_4corruptmask",
"numpy.ones_like",
"utils.data_augmentation.add_noise_to_depth",
"numpy.sum",
"cv2.cvtColor",
"numpy.zeros",
"numpy.arange",
"utils.data_augmentation.compute_xyz",
"utils.data_augmentation.add_noise",
"torch.from_numpy",
"utils.data... | [((1301, 1411), 'cv2.resize', 'cv2.resize', (['rgb_img', "(self.params['img_width'], self.params['img_height'])"], {'interpolation': 'cv2.INTER_LINEAR'}), "(rgb_img, (self.params['img_width'], self.params['img_height']),\n interpolation=cv2.INTER_LINEAR)\n", (1311, 1411), False, 'import cv2\n'), ((1449, 1489), 'cv2.... |
from collections import namedtuple
from itertools import chain
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.functional as F
from .optimizers import IngraphGradientDescent
from .utils.general_utils import copy_and_replace, do_not_copy, nested_flatten, nested_pack, NONE_TENSOR, is_none_t... | [
"torch.enable_grad",
"torch.rand_like",
"copy.deepcopy",
"torch.zeros_like",
"torch.nn.ModuleList",
"torch.nn.ModuleDict",
"torch.nn.Parameter",
"collections.namedtuple",
"torch.stack",
"torch.is_grad_enabled",
"torch.zeros",
"torch.as_tensor",
"torch.cat"
] | [((732, 830), 'collections.namedtuple', 'namedtuple', (['"""Result"""', "['model', 'train_loss_history', 'valid_loss_history', 'optimizer_state']"], {}), "('Result', ['model', 'train_loss_history', 'valid_loss_history',\n 'optimizer_state'])\n", (742, 830), False, 'from collections import namedtuple\n'), ((15141, 15... |
from django.contrib import admin
from .models import User, Picture
admin.site.register(User)
admin.site.register(Picture)
| [
"django.contrib.admin.site.register"
] | [((68, 93), 'django.contrib.admin.site.register', 'admin.site.register', (['User'], {}), '(User)\n', (87, 93), False, 'from django.contrib import admin\n'), ((94, 122), 'django.contrib.admin.site.register', 'admin.site.register', (['Picture'], {}), '(Picture)\n', (113, 122), False, 'from django.contrib import admin\n')... |
#Naive Bayes Model
from sklearn.naive_bayes import GaussianNB
from sklearn.naive_bayes import BernoulliNB
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import ComplementNB
cnb = ComplementNB()
bnb = BernoulliNB()
mnb = MultinomialNB()
gnb = GaussianNB()
#comment out the function of naive bay... | [
"sklearn.naive_bayes.GaussianNB",
"sklearn.naive_bayes.BernoulliNB",
"sklearn.naive_bayes.MultinomialNB",
"sklearn.naive_bayes.ComplementNB"
] | [((205, 219), 'sklearn.naive_bayes.ComplementNB', 'ComplementNB', ([], {}), '()\n', (217, 219), False, 'from sklearn.naive_bayes import ComplementNB\n'), ((226, 239), 'sklearn.naive_bayes.BernoulliNB', 'BernoulliNB', ([], {}), '()\n', (237, 239), False, 'from sklearn.naive_bayes import BernoulliNB\n'), ((246, 261), 'sk... |
from django.db import models
from clientes.models import Clientes
from django.forms import ModelForm
# Create your models here.
class Vehiculos(models.Model):
placa = models.CharField(max_length=20)
modelo = models.CharField(max_length=100)
marca = models.CharField(max_length=100)
km = models.CharField(max_length=2... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((168, 199), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)'}), '(max_length=20)\n', (184, 199), False, 'from django.db import models\n'), ((210, 242), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (226, 242), False, 'from django.db ... |
from chrono import Timer
from numpy import ndarray
from zoloto.cameras.camera import Camera
from zoloto.marker_type import MarkerType
from zoloto.viewer import CameraViewer
class TestCamera(Camera):
marker_type = MarkerType.DICT_6X6_50
def get_marker_size(self, marker_id: int) -> int:
return 100
c... | [
"chrono.Timer"
] | [((411, 418), 'chrono.Timer', 'Timer', ([], {}), '()\n', (416, 418), False, 'from chrono import Timer\n')] |
"""recipe_search URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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... | [
"django.urls.path",
"django.conf.urls.static.static"
] | [((1728, 1789), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (1734, 1789), False, 'from django.conf.urls.static import static\n'), ((926, 957), 'django.urls.path', 'path', (['"""admin/"""', 'a... |
from time import time
import numpy as np
from scipy.misc import imresize
import definitions
from playgrounds.core.features import Feature
from playgrounds.keras_models.features.multi_dector.workers import tiny_yolo_v2
import cv2
from playgrounds.utilities import opencv_utilities
class FeatureDetector(Feature):
... | [
"cv2.VideoWriter",
"cv2.imshow",
"cv2.waitKey",
"playgrounds.utilities.opencv_utilities.getFileNameFromPath",
"scipy.misc.imresize",
"cv2.rectangle",
"cv2.VideoWriter_fourcc",
"cv2.imread",
"cv2.putText",
"cv2.VideoCapture",
"cv2.destroyAllWindows"
] | [((1118, 1145), 'cv2.VideoCapture', 'cv2.VideoCapture', (['inputData'], {}), '(inputData)\n', (1134, 1145), False, 'import cv2\n'), ((1394, 1425), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'mp4v'"], {}), "(*'mp4v')\n", (1416, 1425), False, 'import cv2\n'), ((1550, 1597), 'cv2.VideoWriter', 'cv2.VideoWrite... |
from datetime import datetime
from pyomt5.api import MT5TimeFrame
from pyomt5.stock import StockPriceHistory
c = StockPriceHistory()
start_date = datetime(2019, 1, 1)
end_date = datetime(2019, 5, 2)
data = c.get_price_from(symbol='PETR4',
from_date=start_date,
to_date=e... | [
"pyomt5.stock.StockPriceHistory",
"datetime.datetime"
] | [((114, 133), 'pyomt5.stock.StockPriceHistory', 'StockPriceHistory', ([], {}), '()\n', (131, 133), False, 'from pyomt5.stock import StockPriceHistory\n'), ((148, 168), 'datetime.datetime', 'datetime', (['(2019)', '(1)', '(1)'], {}), '(2019, 1, 1)\n', (156, 168), False, 'from datetime import datetime\n'), ((180, 200), '... |
import re
from netfilterqueue import NetfilterQueue
def print_and_accept(pkt):
payload = str(pkt.get_payload())
cc = re.search('cc .......................', payload)
if cc != None:
print(cc.group(0))
pwd = re.search('pwd .....................', payload)
if pwd != None:
print(pwd.group(0))
pkt.accep... | [
"re.search",
"netfilterqueue.NetfilterQueue"
] | [((335, 351), 'netfilterqueue.NetfilterQueue', 'NetfilterQueue', ([], {}), '()\n', (349, 351), False, 'from netfilterqueue import NetfilterQueue\n'), ((122, 170), 're.search', 're.search', (['"""cc ......................."""', 'payload'], {}), "('cc .......................', payload)\n", (131, 170), False, 'import re\n... |
import pandas as pd
from sklearn.tree import DecisionTreeRegressor
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_absolute_error
iowa_file_path = 'train.csv'
home_data = pd.read_csv(iowa_file_path)
y = home_data.SalePrice
feature_columns = ['LotArea', 'YearBuilt', '1stFlrSF', '2... | [
"sklearn.model_selection.train_test_split",
"pandas.read_csv",
"sklearn.metrics.mean_absolute_error",
"sklearn.tree.DecisionTreeRegressor"
] | [((211, 238), 'pandas.read_csv', 'pd.read_csv', (['iowa_file_path'], {}), '(iowa_file_path)\n', (222, 238), True, 'import pandas as pd\n'), ((435, 458), 'sklearn.tree.DecisionTreeRegressor', 'DecisionTreeRegressor', ([], {}), '()\n', (456, 458), False, 'from sklearn.tree import DecisionTreeRegressor\n'), ((661, 699), '... |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... | [
"pytest.raises",
"mock.Mock",
"pytest.fixture",
"six.itervalues"
] | [((1092, 1156), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[PartitionCountBalancer, GeneticBalancer]'}), '(params=[PartitionCountBalancer, GeneticBalancer])\n', (1106, 1156), False, 'import pytest\n'), ((1909, 1931), 'six.itervalues', 'six.itervalues', (['ct.rgs'], {}), '(ct.rgs)\n', (1923, 1931), False, 'imp... |
import itertools
import json
import pathlib
from typing import (
Any,
Callable,
Dict,
Iterator,
List,
NoReturn,
Optional,
Tuple,
Type,
TypeVar,
Union,
)
import requests
from .weapons import (
Damage,
Infusion,
Infusions,
Requirements,
SaturationCurve,
... | [
"json.dump",
"typing.TypeVar",
"requests.get",
"json.loads",
"json.load",
"pathlib.Path",
"itertools.count"
] | [((398, 410), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (405, 410), False, 'from typing import Any, Callable, Dict, Iterator, List, NoReturn, Optional, Tuple, Type, TypeVar, Union\n'), ((437, 471), 'pathlib.Path', 'pathlib.Path', (['"""./.darksouls/cache"""'], {}), "('./.darksouls/cache')\n", (449, 471... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.