code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys
import numpy as np
from vebio.Utilities import dict_to_yaml, yaml_to_dict
from joblib import dump, load
import matplotlib as mpl
if len(sys.argv) > 1:
params_filename = sys.argv[1]
ve_params = yaml_to_dict(params_filename)
else:
ve_params = {}
font={'family':'Helvetica', 'size':'15'}
mpl.rc('f... | [
"vebio.Utilities.dict_to_yaml",
"matplotlib.rc",
"numpy.load",
"vebio.Utilities.yaml_to_dict",
"numpy.power",
"numpy.array",
"numpy.exp",
"joblib.load"
] | [((311, 333), 'matplotlib.rc', 'mpl.rc', (['"""font"""'], {}), "('font', **font)\n", (317, 333), True, 'import matplotlib as mpl\n'), ((333, 362), 'matplotlib.rc', 'mpl.rc', (['"""xtick"""'], {'labelsize': '(14)'}), "('xtick', labelsize=14)\n", (339, 362), True, 'import matplotlib as mpl\n'), ((362, 391), 'matplotlib.r... |
# -*- coding: utf-8 -*-
from terraform_compliance.common.helper import (
seek_key_in_dict, # importing this purely because the unit tests require it to exist in global scope
Null
)
from terraform_compliance.common.error_handling import Error
def it_must_contain_something(_step_obj, something, inherited_valu... | [
"terraform_compliance.common.helper.seek_key_in_dict"
] | [((1299, 1336), 'terraform_compliance.common.helper.seek_key_in_dict', 'seek_key_in_dict', (['resource', 'something'], {}), '(resource, something)\n', (1315, 1336), False, 'from terraform_compliance.common.helper import seek_key_in_dict, Null\n'), ((5833, 5875), 'terraform_compliance.common.helper.seek_key_in_dict', 's... |
# coding: utf-8
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
from pydocx.openxml.packaging.open_xml_part import OpenXmlPart
from pydocx.openxml.wordprocessing import Footnotes
class FootnotesPart(OpenXmlPart):
'''
Represents a Footnotes part within a Word document... | [
"pydocx.openxml.wordprocessing.Footnotes.load"
] | [((994, 1043), 'pydocx.openxml.wordprocessing.Footnotes.load', 'Footnotes.load', (['self.root_element'], {'container': 'self'}), '(self.root_element, container=self)\n', (1008, 1043), False, 'from pydocx.openxml.wordprocessing import Footnotes\n')] |
from django.db import models
from taxinnovation.apps.utils.models import TIMBaseModel
class BaseRhCatalogModel(TIMBaseModel):
created_by = models.ForeignKey(
verbose_name='Usuario creador',
to='users.User',
on_delete=models.CASCADE,
default=1,
related_name='%(app_label)s_%... | [
"django.db.models.ForeignKey"
] | [((146, 306), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'verbose_name': '"""Usuario creador"""', 'to': '"""users.User"""', 'on_delete': 'models.CASCADE', 'default': '(1)', 'related_name': '"""%(app_label)s_%(class)s_created"""'}), "(verbose_name='Usuario creador', to='users.User',\n on_delete=models.... |
"""
data_curation_functions.py
Extract Kevin's functions for curation of public datasets
Modify them to match Jonathan's curation methods in notebook
01/30/2020
"""
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib_venn import venn3
import seaborn as sns
impor... | [
"imp.reload",
"atomsci.ddm.utils.datastore_functions.dataset_key_exists",
"atomsci.ddm.utils.datastore_functions.upload_df_to_DS",
"atomsci.ddm.utils.datastore_functions.retrieve_dataset_by_datasetkey",
"atomsci.ddm.utils.datastore_functions.config_client",
"atomsci.ddm.utils.curate_data.average_and_remov... | [((6452, 6471), 'atomsci.ddm.utils.datastore_functions.config_client', 'dsf.config_client', ([], {}), '()\n', (6469, 6471), True, 'import atomsci.ddm.utils.datastore_functions as dsf\n'), ((11650, 11664), 'pandas.concat', 'pd.concat', (['lst'], {}), '(lst)\n', (11659, 11664), True, 'import pandas as pd\n'), ((14964, 14... |
import sqlalchemy as sa
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import as_declarative
from sqlalchemy_utils.functions import database_exists, create_database
# Database connection init
engine = None
session = None
@as_declarative()
class Base():
id = sa.Column(sa.In... | [
"sqlalchemy_utils.functions.database_exists",
"sqlalchemy_utils.functions.create_database",
"sqlalchemy.Column",
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.as_declarative",
"sqlalchemy.orm.sessionmaker"
] | [((265, 281), 'sqlalchemy.ext.declarative.as_declarative', 'as_declarative', ([], {}), '()\n', (279, 281), False, 'from sqlalchemy.ext.declarative import as_declarative\n'), ((305, 344), 'sqlalchemy.Column', 'sa.Column', (['sa.Integer'], {'primary_key': '(True)'}), '(sa.Integer, primary_key=True)\n', (314, 344), True, ... |
# Licensed under an MIT style license -- see LICENSE.md
import numpy as np
import os
from pesummary.core.file.formats.base_read import (
Read, SingleAnalysisRead, MultiAnalysisRead
)
__author__ = ["<NAME> <<EMAIL>>"]
class SingleAnalysisDefault(SingleAnalysisRead):
"""Class to handle result files which only... | [
"pesummary.core.file.formats.csv.read_csv",
"pesummary.core.file.formats.numpy.read_numpy",
"pesummary.core.file.formats.sql.read_sql",
"pesummary.core.file.formats.hdf5.read_hdf5",
"os.path.isfile",
"numpy.array",
"pesummary.core.file.formats.base_read.Read.extension_from_path",
"pesummary.core.file.... | [((4663, 4709), 'pesummary.core.file.formats.base_read.Read.extension_from_path', 'Read.extension_from_path', (['path_to_results_file'], {}), '(path_to_results_file)\n', (4687, 4709), False, 'from pesummary.core.file.formats.base_read import Read, SingleAnalysisRead, MultiAnalysisRead\n'), ((6122, 6136), 'pesummary.cor... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.ferias, name='list-ferias'),
path('lista/',
views.lista_productos, name='lista-productos'),
path('<str:feria_id>/',
views.ferias_detail, name='feria-detail'),
path('<str:feria_id>/<slug:slug>/',
... | [
"django.urls.path"
] | [((71, 113), 'django.urls.path', 'path', (['""""""', 'views.ferias'], {'name': '"""list-ferias"""'}), "('', views.ferias, name='list-ferias')\n", (75, 113), False, 'from django.urls import path\n'), ((119, 180), 'django.urls.path', 'path', (['"""lista/"""', 'views.lista_productos'], {'name': '"""lista-productos"""'}), ... |
from machine import Pin
from i2cp import i2cSlave
from pixelstrip import PixelStrip, current_time
from animation_pulse import PulseAnimation
I2C_ADDRESS = 0x41
BRIGHTNESS = 0.5
# List of Animations
animation = [
PulseAnimation(),
PulseAnimation([(0, 136, 0, 0), (64, 64, 0, 0)]),
PulseAnimation([(0, 0, 136... | [
"animation_pulse.PulseAnimation",
"pixelstrip.PixelStrip",
"pixelstrip.current_time",
"i2cp.i2cSlave",
"machine.Pin"
] | [((547, 563), 'machine.Pin', 'Pin', (['(25)', 'Pin.OUT'], {}), '(25, Pin.OUT)\n', (550, 563), False, 'from machine import Pin\n'), ((594, 648), 'i2cp.i2cSlave', 'i2cSlave', (['(0)'], {'sda': '(16)', 'scl': '(17)', 'slave_address': 'I2C_ADDRESS'}), '(0, sda=16, scl=17, slave_address=I2C_ADDRESS)\n', (602, 648), False, '... |
import os.path
from unittest import TestCase
from lingpy.basic.wordlist import Wordlist
from lingpy.compare.lexstat import LexStat
from code.cli import TESTS_DIR
from code.prepare.base import load_data
from code.prepare.lexstat import *
FIXTURE_DATASET = os.path.join(TESTS_DIR, 'fixtures/GER.tsv')
FIXTURE_DATASE... | [
"code.prepare.base.load_data"
] | [((449, 475), 'code.prepare.base.load_data', 'load_data', (['FIXTURE_DATASET'], {}), '(FIXTURE_DATASET)\n', (458, 475), False, 'from code.prepare.base import load_data\n'), ((495, 526), 'code.prepare.base.load_data', 'load_data', (['FIXTURE_DATASET_ASJP'], {}), '(FIXTURE_DATASET_ASJP)\n', (504, 526), False, 'from code.... |
import sys
import argparse
from torch.nn.modules.container import ModuleList
sys.path.append('/Users/lee/Downloads/Renjue/Machine-Learning-Operations/02_code_organisation/final_exercise/cookiecutter project/src')
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.model import... | [
"sys.path.append",
"models.model.MyAwesomeModel",
"data.make_dataset.main",
"pytest.raises",
"torch.Size"
] | [((78, 223), 'sys.path.append', 'sys.path.append', (['"""/Users/lee/Downloads/Renjue/Machine-Learning-Operations/02_code_organisation/final_exercise/cookiecutter project/src"""'], {}), "(\n '/Users/lee/Downloads/Renjue/Machine-Learning-Operations/02_code_organisation/final_exercise/cookiecutter project/src'\n )\n... |
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
import re, string
import scipy
train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv')
sample_sub = pd.read_csv('sample_submission.csv')
train.head()
#fillna
train['comment_text'].fillna("unk", inplace=True)
t... | [
"pandas.read_csv",
"sklearn.feature_extraction.text.CountVectorizer",
"scipy.sparse.save_npz",
"re.compile"
] | [((139, 163), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (150, 163), True, 'import pandas as pd\n'), ((171, 194), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (182, 194), True, 'import pandas as pd\n'), ((208, 244), 'pandas.read_csv', 'pd.read_csv', ... |
from pathlib import Path
import wandb
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchtext
from tqdm import tqdm
import random
from seq2seq.dataset import SourceField, TargetField
# if torch.cuda.is_available:
# device = torch.device("cuda")
# else:
fro... | [
"torch.nn.Dropout",
"wandb.log",
"wandb.watch",
"torch.nn.Embedding",
"torch.cat",
"pathlib.Path",
"torch.device",
"torch.FloatTensor",
"torch.nn.functional.nll_loss",
"torch.nn.Linear",
"torch.zeros",
"torchtext.data.TabularDataset",
"torch.nn.LSTM",
"seq2seq.dataset.SourceField",
"rand... | [((396, 415), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (408, 415), False, 'import torch\n'), ((6751, 6806), 'pathlib.Path', 'Path', (['"""../../../results_analyzing/bleu/multi-bleu.perl"""'], {}), "('../../../results_analyzing/bleu/multi-bleu.perl')\n", (6755, 6806), False, 'from pathlib import... |
import struct
from mmap import mmap
from typing import Union
from DyldExtractor.file_context import FileContext
from DyldExtractor.macho.segment_context import SegmentContext
from DyldExtractor.macho.macho_structs import (
LoadCommandMap,
LoadCommands,
load_command,
UnknownLoadCommand,
mach_header_64,
segment_... | [
"DyldExtractor.macho.segment_context.SegmentContext",
"DyldExtractor.macho.macho_structs.mach_header_64",
"DyldExtractor.macho.macho_structs.LoadCommandMap.get"
] | [((793, 821), 'DyldExtractor.macho.macho_structs.mach_header_64', 'mach_header_64', (['file', 'offset'], {}), '(file, offset)\n', (807, 821), False, 'from DyldExtractor.macho.macho_structs import LoadCommandMap, LoadCommands, load_command, UnknownLoadCommand, mach_header_64, segment_command_64\n'), ((2608, 2651), 'Dyld... |
import sys
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QWidget, QLabel, QLineEdit
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtCore import QSize
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setMinimumSize(... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QMainWindow.__init__",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtCore.QSize",
"PyQt5.QtWidgets.QApplication"
] | [((980, 1012), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (1002, 1012), False, 'from PyQt5 import QtCore, QtWidgets\n'), ((262, 288), 'PyQt5.QtWidgets.QMainWindow.__init__', 'QMainWindow.__init__', (['self'], {}), '(self)\n', (282, 288), False, 'from PyQt5.QtWidgets im... |
# -*- coding: utf-8 -*-
import pkg_resources
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'python-hyperscan'
copyright = u'2017, <NAME>'
author = u'<NAME... | [
"pkg_resources.get_distribution"
] | [((333, 376), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['"""hyperscan"""'], {}), "('hyperscan')\n", (363, 376), False, 'import pkg_resources\n')] |
from app import app, Roles
from app.exceptions.base import ResourceNotFoundException, \
AuthorizationException
from app.repository import custom_form_repository
from app.service import role_service, group_service
from app.utils import copernica
def find_form_by_form_id(form_id):
return custom_form_repository.... | [
"app.repository.custom_form_repository.get_active_followed_forms_by_user",
"app.repository.custom_form_repository.get_active_unfollowed_by_user",
"app.utils.copernica.update_subprofile",
"app.repository.custom_form_repository.get_form_submission_by_id",
"app.exceptions.base.ResourceNotFoundException",
"ap... | [((297, 348), 'app.repository.custom_form_repository.get_form_by_form_id', 'custom_form_repository.get_form_by_form_id', (['form_id'], {}), '(form_id)\n', (339, 348), False, 'from app.repository import custom_form_repository\n'), ((396, 447), 'app.repository.custom_form_repository.get_form_by_form_id', 'custom_form_rep... |
""" Game controller """
import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey, Boolean, desc
from sqlalchemy.orm import relationship, object_session
from smserver.models import schema, song_stat, user
from smserver.smutils.smpacket import smpacket
__all__ = ['Game']
class Game(schema.Base):
... | [
"sqlalchemy.orm.object_session",
"smserver.models.user.User.user_index",
"sqlalchemy.ForeignKey",
"sqlalchemy.orm.relationship",
"sqlalchemy.Column",
"sqlalchemy.desc",
"smserver.smutils.smpacket.smpacket.SMPacketServerNSCGON"
] | [((366, 399), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (372, 399), False, 'from sqlalchemy import Column, Integer, DateTime, ForeignKey, Boolean, desc\n'), ((418, 447), 'sqlalchemy.Column', 'Column', (['Boolean'], {'default': '(True)'}), '(Boolean, defaul... |
import torch.nn as nn
from strimadec.models.utils.kl_divergences import gaussian_kl
class DVAE_LossModel(nn.Module):
def __init__(self, discrete_vae):
super().__init__()
self.VAE = discrete_vae
return
def loss_func(self, z, x):
x_tilde = self.VAE.decode(z)
# compute b... | [
"strimadec.models.utils.kl_divergences.gaussian_kl"
] | [((1741, 1788), 'strimadec.models.utils.kl_divergences.gaussian_kl', 'gaussian_kl', (['q_transform_dist', 'p_transform_dist'], {}), '(q_transform_dist, p_transform_dist)\n', (1752, 1788), False, 'from strimadec.models.utils.kl_divergences import gaussian_kl\n')] |
#
# (C) Copyright 2020 <NAME>
#
# SPDX-License-Identifier: MIT
#
# original source from
# https://flask.palletsprojects.com/en/1.1.x/tutorial/
#
import base64
import nacl.pwhash
import nacl.utils
import re
import sqlite3
from flask import (
Blueprint,
request,
)
from flask_api import status
from iota.db impo... | [
"iota.db.get_db",
"flask.Blueprint",
"flask.request.headers.get",
"re.sub",
"flask.request.get_json"
] | [((336, 386), 'flask.Blueprint', 'Blueprint', (['"""token"""', '__name__'], {'url_prefix': '"""/api/v1"""'}), "('token', __name__, url_prefix='/api/v1')\n", (345, 386), False, 'from flask import Blueprint, request\n'), ((534, 542), 'iota.db.get_db', 'get_db', ([], {}), '()\n', (540, 542), False, 'from iota.db import ge... |
import os
from sphinx_bulma import events
__version__ = "0.0.1"
__title__ = "sphinx_bulma"
__description__ = "Sphinx theme using Bulma CSS framework"
__uri__ = "https://github.com/pauleveritt/sphinx-bulma"
__doc__ = __description__ + " <" + __uri__ + ">"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "A... | [
"os.path.dirname",
"os.path.join"
] | [((802, 827), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (817, 827), False, 'import os\n'), ((913, 933), 'os.path.join', 'os.path.join', (['pkgdir'], {}), '(pkgdir)\n', (925, 933), False, 'import os\n'), ((578, 603), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n'... |
from datetime import datetime
import dbconfig
from main.sqla.app import db
from flask_sqlalchemy import SQLAlchemy
class item(db.Model):
__bind_key__ = 'project_it_lending_log_db'
__tablename__ = 'videos'
fields=['id','name','comment']
id = db.Column(db.Integer, primary_key=True)
name = db.Col... | [
"main.sqla.app.db.ForeignKey",
"main.sqla.app.db.String",
"main.sqla.app.db.Column"
] | [((263, 302), 'main.sqla.app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (272, 302), False, 'from main.sqla.app import db\n'), ((363, 394), 'main.sqla.app.db.Column', 'db.Column', (['db.text'], {'default': '"""#"""'}), "(db.text, default='#')\n", (372, 394),... |
# No shebang line, this module is meant to be imported
#
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
# Copyright 2015 <NAME>
#
# 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
#
# ht... | [
"sqlalchemy.schema.UniqueConstraint",
"pyfarm.models.core.types.id_column",
"pyfarm.master.config.config.get"
] | [((1135, 1158), 'pyfarm.master.config.config.get', 'config.get', (['"""table_gpu"""'], {}), "('table_gpu')\n", (1145, 1158), False, 'from pyfarm.master.config import config\n'), ((1222, 1243), 'pyfarm.models.core.types.id_column', 'id_column', (['db.Integer'], {}), '(db.Integer)\n', (1231, 1243), False, 'from pyfarm.mo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Distributed under the terms of the MIT License.
"""
Script to extract all independant cages from a CIF using pyWindow code.
Author: <NAME>
Date Created: 04 Apr 2019
"""
import sys
import atools
def main():
if (not len(sys.argv) == 2):
print("""
Usage: e... | [
"atools.modularize",
"atools.convert_CIF_2_PDB",
"sys.exit"
] | [((569, 598), 'atools.convert_CIF_2_PDB', 'atools.convert_CIF_2_PDB', (['CIF'], {}), '(CIF)\n', (593, 598), False, 'import atools\n'), ((686, 718), 'atools.modularize', 'atools.modularize', ([], {'file': 'pdb_file'}), '(file=pdb_file)\n', (703, 718), False, 'import atools\n'), ((402, 412), 'sys.exit', 'sys.exit', ([], ... |
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
"torch.cuda.synchronize",
"trimesh.load",
"argparse.ArgumentParser",
"torch.cat",
"numpy.ones",
"numpy.linalg.norm",
"numpy.tile",
"torch.no_grad",
"soft_renderer.SoftRenderer",
"cv2.imwrite",
"ext_utils.joint_catalog.SMALJointInfo",
"os.path.dirname",
"numpy.transpose",
"torch.load",
"t... | [((669, 702), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""third_party"""'], {}), "(0, 'third_party')\n", (684, 702), False, 'import sys, os\n'), ((702, 726), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./"""'], {}), "(0, './')\n", (717, 726), False, 'import sys, os\n'), ((1174, 1218), 'argparse.ArgumentPa... |
import os
import sys
import datetime
import hashlib
import logging
import traceback
import multiprocessing
import grpc
import concurrent.futures as futures
import service.common
sys.path.append(os.path.join(os.getcwd(), 'chess-alpha-zero', 'src'))
from chess_zero.env.chess_env import ChessEnv
# Importing the gener... | [
"multiprocessing.Process",
"service.service_spec.alpha_zero_pb2.Output",
"traceback.print_exc",
"logging.basicConfig",
"os.getcwd",
"multiprocessing.Manager",
"chess_zero.env.chess_env.ChessEnv",
"hashlib.sha256",
"service.alpha_zero.AlphaZeroClass",
"concurrent.futures.ThreadPoolExecutor",
"dat... | [((470, 570), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': '(10)', 'format': '"""%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s"""'}), "(level=10, format=\n '%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s')\n", (489, 570), False, 'import logging\n'), ((572, 611), 'logging.getLogger'... |
"""The tests in this file verify that the views associated with tags
work as expected. Tests include:
- tags in detail view
- tags in ticket form
"""
from django.urls import reverse
from django.test import TestCase
from tickets.tests.factories import UserFactory, TicketFactory
class ProjectTaggingTestCase(TestC... | [
"django.urls.reverse",
"tickets.tests.factories.UserFactory",
"tickets.tests.factories.TicketFactory"
] | [((537, 570), 'tickets.tests.factories.UserFactory', 'UserFactory', ([], {'username': '"""gcostanza"""'}), "(username='gcostanza')\n", (548, 570), False, 'from tickets.tests.factories import UserFactory, TicketFactory\n'), ((595, 633), 'tickets.tests.factories.TicketFactory', 'TicketFactory', ([], {'submitted_by': 'sel... |
import pprint
import random
from functools import partial
from collections import defaultdict
class Host:
def __init__(self, id):
self.id = id
self.received = set()
def gossip(self, packet, next_hosts):
if packet not in self.received:
self.received.add(packet)
... | [
"random.sample",
"functools.partial",
"random.randrange",
"random.choice"
] | [((448, 471), 'random.sample', 'random.sample', (['HOSTS', '(4)'], {}), '(HOSTS, 4)\n', (461, 471), False, 'import random\n'), ((1173, 1198), 'functools.partial', 'partial', (['defaultdict', 'int'], {}), '(defaultdict, int)\n', (1180, 1198), False, 'from functools import partial\n'), ((1267, 1287), 'random.choice', 'ra... |
from django.shortcuts import render
from django.http import HttpResponse
from chatwork.models import Account
import requests
from datetime import date
from dateutil.relativedelta import relativedelta
from django.db.models import Count
import environ
env = environ.Env(DEBUG=(bool, False))
# Create your views here.
def... | [
"chatwork.models.Account.objects.filter",
"datetime.date.today",
"dateutil.relativedelta.relativedelta",
"chatwork.models.Account.objects.update_or_create",
"requests.get",
"django.shortcuts.render",
"django.db.models.Count",
"environ.Env"
] | [((256, 288), 'environ.Env', 'environ.Env', ([], {'DEBUG': '(bool, False)'}), '(DEBUG=(bool, False))\n', (267, 288), False, 'import environ\n'), ((701, 746), 'django.shortcuts.render', 'render', (['request', '"""chatwork/show.html"""', 'params'], {}), "(request, 'chatwork/show.html', params)\n", (707, 746), False, 'fro... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# The code is based on HigherHRNet-Human-Pose-Estimation.
# (https://github.com/HRNet/HigherHRNet-Human-Pose-Estimation)
# Modified by <NAME> (<EMAIL>).
# ------------------------... | [
"torch.where",
"torch.autograd.Variable",
"torch.nonzero",
"torch.cat",
"torch.abs",
"logging.getLogger"
] | [((548, 575), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (565, 575), False, 'import logging\n'), ((644, 699), 'torch.autograd.Variable', 'torch.autograd.Variable', (['t'], {'requires_grad': 'requires_grad'}), '(t, requires_grad=requires_grad)\n', (667, 699), False, 'import torch\n'), ... |
import pytest
import sys
def run_tests():
errno = pytest.main("tests/test_decode.py tests/test_encode.py")
sys.exit(errno)
| [
"sys.exit",
"pytest.main"
] | [((55, 111), 'pytest.main', 'pytest.main', (['"""tests/test_decode.py tests/test_encode.py"""'], {}), "('tests/test_decode.py tests/test_encode.py')\n", (66, 111), False, 'import pytest\n'), ((116, 131), 'sys.exit', 'sys.exit', (['errno'], {}), '(errno)\n', (124, 131), False, 'import sys\n')] |
from manimlib.imports import *
import matplotlib.pyplot as plt
import csv
import codecs
# import pandas as pd
# import ctypes
# # from https://www.cnpython.com/qa/81434
# def GetTextLength(text, points=10, font='思源黑体 Bold'):
# class SIZE(ctypes.Structure):
# _fields_ = [("cx", ctypes.c_long), ("cy", ctypes... | [
"matplotlib.pyplot.imread",
"csv.reader",
"codecs.open"
] | [((1342, 1450), 'matplotlib.pyplot.imread', 'plt.imread', (['"""E:\\\\GitHub\\\\manim\\\\my_manim_projects\\\\my_projects\\\\resource\\\\png_files\\\\m_set_01.bmp"""'], {}), "(\n 'E:\\\\GitHub\\\\manim\\\\my_manim_projects\\\\my_projects\\\\resource\\\\png_files\\\\m_set_01.bmp'\n )\n", (1352, 1450), True, 'impor... |
from flask import jsonify, render_template, request
from pili.main import main
@main.app_errorhandler(403)
def forbidden(e):
if (
request.accept_mimetypes.accept_json
and not request.accept_mimetypes.accept_html
):
response = jsonify({'error': 'forbidden'})
response.status_cod... | [
"pili.main.main.app_errorhandler",
"flask.jsonify",
"flask.render_template"
] | [((83, 109), 'pili.main.main.app_errorhandler', 'main.app_errorhandler', (['(403)'], {}), '(403)\n', (104, 109), False, 'from pili.main import main\n'), ((405, 431), 'pili.main.main.app_errorhandler', 'main.app_errorhandler', (['(404)'], {}), '(404)\n', (426, 431), False, 'from pili.main import main\n'), ((732, 758), '... |
"""You Only Look Once Object Detection v3"""
# pylint: disable=arguments-differ
from __future__ import absolute_import
from __future__ import division
import os
import mxnet as mx
from mxnet import gluon
from mxnet.gluon import nn
from gluoncv.model_zoo.yolo.darknet import _conv2d, darknet53
from gluoncv.model_zoo.yol... | [
"mxnet.gluon.nn.HybridSequential",
"gluoncv.loss.YOLOV3Loss",
"mxnet.gluon.nn.LeakyReLU",
"mxnet.gluon.nn.Conv2D",
"gluoncv.model_store.get_model_file",
"mxnet.gluon.nn.BatchNorm",
"gluoncv.model_zoo.yolo.darknet.darknet53",
"mxnet.gluon.contrib.nn.SyncBatchNorm",
"gluoncv.model_zoo.yolo.darknet._co... | [((655, 685), 'mxnet.gluon.nn.HybridSequential', 'nn.HybridSequential', ([], {'prefix': '""""""'}), "(prefix='')\n", (674, 685), False, 'from mxnet.gluon import nn\n'), ((6590, 6598), 'mxnet.cpu', 'mx.cpu', ([], {}), '()\n', (6596, 6598), True, 'import mxnet as mx\n'), ((6620, 6657), 'os.path.join', 'os.path.join', (['... |
import time
import numpy as np
from typing import Tuple
import os
import torch
import torch.nn.functional as F
from torch.optim.optimizer import Optimizer
from torch.utils.data.dataset import Dataset
from torch.utils.tensorboard import SummaryWriter
from models.fatchord_version import WaveRNN
from trainer.common impor... | [
"utils.files.pickle_binary",
"utils.files.get_files",
"utils.dataset.get_vocoder_datasets",
"utils.dsp.label_2_float",
"os.remove",
"utils.display.stream",
"utils.checkpoints.save_checkpoint",
"os.path.exists",
"torch.nn.functional.l1_loss",
"utils.files.unpickle_binary",
"trainer.common.VocSess... | [((997, 1047), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', ([], {'log_dir': 'paths.voc_log', 'comment': '"""v1"""'}), "(log_dir=paths.voc_log, comment='v1')\n", (1010, 1047), False, 'from torch.utils.tensorboard import SummaryWriter\n'), ((1208, 1234), 'os.path.exists', 'os.path.exists', (['path_top_k'], ... |
from pydantic import ValidationError
import pytest
import cv2
from labelbox.data.annotation_types import Point
def test_point():
with pytest.raises(ValidationError):
line = Point()
with pytest.raises(TypeError):
line = Point([0, 1])
point = Point(x=0, y=1)
expected = {"coordinates":... | [
"cv2.imread",
"pytest.raises",
"labelbox.data.annotation_types.Point"
] | [((274, 289), 'labelbox.data.annotation_types.Point', 'Point', ([], {'x': '(0)', 'y': '(1)'}), '(x=0, y=1)\n', (279, 289), False, 'from labelbox.data.annotation_types import Point\n'), ((141, 171), 'pytest.raises', 'pytest.raises', (['ValidationError'], {}), '(ValidationError)\n', (154, 171), False, 'import pytest\n'),... |
"""Backend for multilayer network draw method using three.js.
This is still experimental and is missing many features.
"""
from .. import drawnet
from .. import drawbackends
import os
TEMPLATE_FILE=os.path.join( os.path.dirname(drawbackends.__file__),"threejs_template.html")
SIZE=100
class NetFigureThreeJS(drawnet.... | [
"os.path.dirname"
] | [((215, 253), 'os.path.dirname', 'os.path.dirname', (['drawbackends.__file__'], {}), '(drawbackends.__file__)\n', (230, 253), False, 'import os\n')] |
import unittest
import numpy as np
class TestCase(unittest.TestCase):
def test_approx_k(self):
try:
from task import k, U, Sigma, Vt, approx
approx_test = U @ Sigma[:, :k] @ Vt[:k, :]
np.testing.assert_array_equal(approx, approx_test,
... | [
"numpy.testing.assert_array_equal"
] | [((235, 331), 'numpy.testing.assert_array_equal', 'np.testing.assert_array_equal', (['approx', 'approx_test', '"""The approximation does not look right."""'], {}), "(approx, approx_test,\n 'The approximation does not look right.')\n", (264, 331), True, 'import numpy as np\n')] |
#coding:utf-8
#
# id: bugs.core_4451
# title: Allow output to trace explain plan form.
# decription:
# Checked on
# 4.0.0.1685 SS: 7.985s.
# 4.0.0.1685 CS: 8.711s.
# 3.0.5.33206 SS: 7.281s.
# 3.0.5... | [
"pytest.mark.version",
"firebird.qa.python_act",
"firebird.qa.db_factory"
] | [((670, 715), 'firebird.qa.db_factory', 'db_factory', ([], {'sql_dialect': '(3)', 'init': 'init_script_1'}), '(sql_dialect=3, init=init_script_1)\n', (680, 715), False, 'from firebird.qa import db_factory, python_act, Action\n'), ((5713, 5762), 'firebird.qa.python_act', 'python_act', (['"""db_1"""'], {'substitutions': ... |
"""
Takes the videos from the dataset and creates a table to store their various analysis/status
Takes a couple seconds.
"""
import psycopg2
data_connection = psycopg2.connect(database="gdelt_social_video", user="postgres")
data_cursor = data_connection.cursor()
# We only want videos that have been crawled successfull... | [
"psycopg2.connect"
] | [((160, 224), 'psycopg2.connect', 'psycopg2.connect', ([], {'database': '"""gdelt_social_video"""', 'user': '"""postgres"""'}), "(database='gdelt_social_video', user='postgres')\n", (176, 224), False, 'import psycopg2\n'), ((615, 684), 'psycopg2.connect', 'psycopg2.connect', ([], {'database': '"""video_article_retrieva... |
from __future__ import print_function
from numpy import *
import commands
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
def sdds2py(FileName,para_col,para_col_name):
'''
export data from sdds file (parameter or column) data to python data
fro... | [
"commands.getoutput"
] | [((793, 816), 'commands.getoutput', 'commands.getoutput', (['cmd'], {}), '(cmd)\n', (811, 816), False, 'import commands\n'), ((999, 1022), 'commands.getoutput', 'commands.getoutput', (['cmd'], {}), '(cmd)\n', (1017, 1022), False, 'import commands\n')] |
import magma as m
from mantle import Register, Counter, Invert, Mux
from loam.boards.icestick import IceStick
N = 8
icestick = IceStick()
icestick.Clock.on()
for i in range(N):
icestick.J3[i].output().on()
main = icestick.main()
def DefineTriangle(n):
T = m.Bits(n)
class _Triangle(m.Circuit):
na... | [
"mantle.Register",
"magma.Bits",
"mantle.Mux",
"mantle.Counter",
"magma.In",
"loam.boards.icestick.IceStick",
"magma.Out",
"mantle.Invert"
] | [((129, 139), 'loam.boards.icestick.IceStick', 'IceStick', ([], {}), '()\n', (137, 139), False, 'from loam.boards.icestick import IceStick\n'), ((646, 657), 'mantle.Counter', 'Counter', (['(32)'], {}), '(32)\n', (653, 657), False, 'from mantle import Register, Counter, Invert, Mux\n'), ((711, 722), 'mantle.Register', '... |
from tensorflow.keras import Model
from tensorflow.keras.layers import Conv2D, Add, Input, Concatenate
from utils.model_utils import Conv2D_BatchNorm,DownBlock,RESBridgeBlock,UpBlock,FD_Block
######################################################################################################################... | [
"utils.model_utils.FD_Block",
"tensorflow.keras.layers.Conv2D",
"utils.model_utils.DownBlock",
"tensorflow.keras.layers.Concatenate",
"utils.model_utils.UpBlock",
"tensorflow.keras.Model",
"utils.model_utils.Conv2D_BatchNorm",
"tensorflow.keras.layers.Input",
"utils.model_utils.RESBridgeBlock",
"t... | [((679, 820), 'utils.model_utils.Conv2D_BatchNorm', 'Conv2D_BatchNorm', (['input', 'filters'], {'kernel_size': '(3)', 'strides': '(1)', 'padding': 'padding', 'activation': 'activation', 'kernel_initializer': 'kernel_initializer'}), '(input, filters, kernel_size=3, strides=1, padding=padding,\n activation=activation,... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright © 2016, Continuum Analytics, Inc. All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------------------------------------------------------... | [
"conda_kapsel.plugins.network_util.can_connect_to_socket",
"socket.socket"
] | [((560, 609), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (573, 609), False, 'import socket\n'), ((956, 1005), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (969,... |
from patlet import PatLet
test = PatLet('salom')
test.printer(char='3')
test.writer(char='3')
| [
"patlet.PatLet"
] | [((34, 49), 'patlet.PatLet', 'PatLet', (['"""salom"""'], {}), "('salom')\n", (40, 49), False, 'from patlet import PatLet\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 16:34:44 2020
@author: mofarrag
"""
try:
import Hapi
except ImportError:
try:
import HAPI
except ImportError:
import sys
sys.path.append(".")
import Hapi
| [
"sys.path.append"
] | [((190, 210), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (205, 210), False, 'import sys\n')] |
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be use... | [
"sys.path.append",
"xml.etree.ElementTree.fromstring",
"os.path.realpath",
"proton.template.get_template",
"xml.etree.ElementTree.tostring"
] | [((670, 691), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (685, 691), False, 'import sys\n'), ((1315, 1351), 'proton.template.get_template', 'template.get_template', (['"""basic.xhtml"""'], {}), "('basic.xhtml')\n", (1336, 1351), False, 'from proton import template\n'), ((1619, 1640), 'xml.etr... |
"""Optimization tools."""
def bracket_monotonic(f, x0=0.0, x1=1.0, factor=2.0):
"""Return `(x0, x1)` where `f(x0)*f(x1) < 0`.
Assumes that `f` is monotonic and that the root exists.
Proceeds by increasing the size of the interval by `factor` in the
direction of the root until the root is found.
... | [
"uncertainties.core.ufloat",
"uncertainties.nominal_value"
] | [((1670, 1682), 'uncertainties.core.ufloat', 'ufloat', (['x', '(0)'], {}), '(x, 0)\n', (1676, 1682), False, 'from uncertainties.core import nominal_value, ufloat, AffineScalarFunc\n'), ((2118, 2134), 'uncertainties.nominal_value', 'nominal_value', (['a'], {}), '(a)\n', (2131, 2134), False, 'from uncertainties import no... |
#!/usr/bin/env python3
#
# lemonbarpy
#
# (c) 2016 <NAME>
import os
import sys
import json
import signal
import argparse
import bspwm
CONFIG_FILE = '/home/neo/Projekte/Python/lemonbarpy/conf/lemonbarpy.json'
# TODO: remove this dirty solution
BAR = None
"""
@description
Shutdown handler to shut down the b... | [
"signal.signal",
"os.path.isfile",
"argparse.ArgumentParser",
"sys.exit"
] | [((397, 408), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (405, 408), False, 'import sys\n'), ((697, 722), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (720, 722), False, 'import argparse\n'), ((998, 1042), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'sigint_handler'], {}), '(sig... |
'''
Base class for video streams
'''
import logging
import queue
from .base import ActiveNode
class VideoReadStream(ActiveNode):
'''A stream of video frames being read from a source'''
frame_count = 0
current_frame = None
dropped_frame_count = 0
def __init__(self, output_queue, name='VideoStream'... | [
"logging.warning",
"logging.debug"
] | [((749, 800), 'logging.debug', 'logging.debug', (['"""Frame number: %d"""', 'self.frame_count'], {}), "('Frame number: %d', self.frame_count)\n", (762, 800), False, 'import logging\n'), ((1413, 1450), 'logging.warning', 'logging.warning', (['"""No frame received."""'], {}), "('No frame received.')\n", (1428, 1450), Fal... |
import logging
import pytest
from img_metadata_lib.common import setup_logger
from img_metadata_lib.common import get_event_body
def test_setup_logger_returns_logger():
assert isinstance(setup_logger(), logging.Logger)
def test_get_event_body_returns_dict():
assert isinstance(get_event_body({"body": '{"ke... | [
"img_metadata_lib.common.get_event_body",
"img_metadata_lib.common.setup_logger"
] | [((195, 209), 'img_metadata_lib.common.setup_logger', 'setup_logger', ([], {}), '()\n', (207, 209), False, 'from img_metadata_lib.common import setup_logger\n'), ((291, 335), 'img_metadata_lib.common.get_event_body', 'get_event_body', (['{\'body\': \'{"key": "value"}\'}'], {}), '({\'body\': \'{"key": "value"}\'})\n', (... |
# coding:utf-8
# --author-- lanhua.zhou
""" 文件操作函数集合 """
import os
import sys
import re
import time
import shutil
import subprocess
import tempfile
import hashlib
import locale
import json
import logging
import zfused_api
import zfused_login
import zfused_maya
import record
# will ???
REPLACE = {
"P:":"C:/Clus... | [
"subprocess.Popen",
"os.remove",
"locale.getdefaultlocale",
"os.makedirs",
"os.path.isdir",
"os.path.getsize",
"os.path.dirname",
"tempfile.gettempdir",
"tempfile.SpooledTemporaryFile",
"time.time",
"os.path.isfile",
"zfused_login.core.util.ztranser_server_addr",
"os.path.splitext",
"shuti... | [((370, 397), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (387, 397), False, 'import logging\n'), ((620, 640), 'os.path.dirname', 'os.path.dirname', (['dst'], {}), '(dst)\n', (635, 640), False, 'import os\n'), ((713, 734), 'shutil.copy', 'shutil.copy', (['src', 'dst'], {}), '(src, dst)... |
from tkinter import *
import math
import winsound
# ---------------------------- CONSTANTES------------------------------- #
PINK = "#e2979c"
RED = "#e7305b"
GREEN = "#9bdeac"
YELLOW = "#f7f5dd"
FONT_NAME = "Abys"
WORK_MIN = 1
SHORT_BREAK_MIN = 0.25
LONG_BREAK_MIN = 60
timer = None
ordem =0
lista =['✔','✔','✔✔','✔... | [
"math.floor",
"winsound.PlaySound"
] | [((1550, 1572), 'math.floor', 'math.floor', (['(conta / 60)'], {}), '(conta / 60)\n', (1560, 1572), False, 'import math\n'), ((1594, 1616), 'math.floor', 'math.floor', (['(conta % 60)'], {}), '(conta % 60)\n', (1604, 1616), False, 'import math\n'), ((2235, 2287), 'winsound.PlaySound', 'winsound.PlaySound', (['"""System... |
import numpy as np
# Adapted from https://github.com/Hakuyume/chainer-ssd
def decode_onnx(loc, priors, variances):
"""Decode locations from predictions using priors to undo
the encoding we did for offset regression at train time.
Args:
loc (tensor): location predictions for loc layers,
... | [
"numpy.exp",
"numpy.concatenate"
] | [((1494, 1836), 'numpy.concatenate', 'np.concatenate', (['(priors[:, :2] + pre[:, :2] * variances[0] * priors[:, 2:], priors[:, :2] +\n pre[:, 2:4] * variances[0] * priors[:, 2:], priors[:, :2] + pre[:, 4:6] *\n variances[0] * priors[:, 2:], priors[:, :2] + pre[:, 6:8] * variances[0\n ] * priors[:, 2:], priors... |
# Generated by Django 2.2.7 on 2020-01-04 23:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('MainProject', '0022_auto_20200105_0036'),
]
operations = [
migrations.RemoveField(
model_name='... | [
"django.db.migrations.RemoveField",
"django.db.models.FileField",
"django.db.models.ForeignKey",
"django.db.models.AutoField"
] | [((272, 340), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""coursematerial"""', 'name': '"""doc_file"""'}), "(model_name='coursematerial', name='doc_file')\n", (294, 340), False, 'from django.db import migrations, models\n'), ((492, 585), 'django.db.models.AutoField', 'models.Aut... |
# coding: utf-8
import sys
from setuptools import setup, find_packages
NAME = "improving_agent"
VERSION = "1.0.0"
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
REQUIRES = [
"connexion>=2.0.2",
"swagger-ui-bundle>... | [
"setuptools.find_packages"
] | [((663, 678), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (676, 678), False, 'from setuptools import setup, find_packages\n')] |
"""
Copyright 2020 <NAME>, <NAME>
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... | [
"dataclasses.field",
"dataclasses.dataclass"
] | [((707, 728), 'dataclasses.dataclass', 'dataclass', ([], {'order': '(True)'}), '(order=True)\n', (716, 728), False, 'from dataclasses import dataclass, field\n'), ((939, 960), 'dataclasses.dataclass', 'dataclass', ([], {'order': '(True)'}), '(order=True)\n', (948, 960), False, 'from dataclasses import dataclass, field\... |
import platform
import sys
import crayons
class OSType(object):
LINUX = "linux"
MAC = "mac"
WIN = "win"
def os_name():
pl = sys.platform
if pl == "linux" or pl == "linux2":
return OSType.LINUX
elif pl == "darwin":
return OSType.MAC
elif pl == "win32":
return OSTy... | [
"platform.machine",
"crayons.yellow"
] | [((823, 854), 'crayons.yellow', 'crayons.yellow', (['text'], {'bold': 'bold'}), '(text, bold=bold)\n', (837, 854), False, 'import crayons\n'), ((359, 377), 'platform.machine', 'platform.machine', ([], {}), '()\n', (375, 377), False, 'import platform\n')] |
#!/usr/bin/env python
import multiprocessing
import os
import sys
import docopt
import devbase
import performance_analyst as pa
import timer_case
import performance
doc_string = """\
Measure the performance of a PCRaster installation and store the results in
a database
Usage:
{command} [--repeat=<count>] [--max-... | [
"timer_case.measure_multicore_operation_performance",
"timer_case.measure_multicore_operation_scalability",
"performance_analyst.ProgressTimerRunner",
"performance_analyst.StreamTimerRunner",
"docopt.docopt",
"os.path.basename",
"performance_analyst.CompositeTimerRunner",
"performance.determine_databa... | [((1393, 1470), 'timer_case.measure_classic_operation_performance', 'timer_case.measure_classic_operation_performance', (['data_prefix', 'repeat', 'runner'], {}), '(data_prefix, repeat, runner)\n', (1441, 1470), False, 'import timer_case\n'), ((1584, 1663), 'timer_case.measure_multicore_operation_performance', 'timer_c... |
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
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, merge, publish, distri... | [
"traceback.format_exception",
"json.loads",
"json.dumps",
"sys.stdout.flush",
"sys.stderr.flush",
"datetime.datetime.now",
"logging.getLogger"
] | [((10476, 10499), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (10497, 10499), False, 'import datetime\n'), ((10666, 10702), 'json.dumps', 'json.dumps', (['dict'], {'ensure_ascii': '(False)'}), '(dict, ensure_ascii=False)\n', (10676, 10702), False, 'import json\n'), ((10377, 10414), 'json.loads',... |
#-*-coding:utf-8-*-
# date:2020-03-28
# Author: X.L.Eric
# function: image pixel - float (0.~1.)
import cv2 # 加载 OpenCV 库
import numpy as np # 加载 numpy 库
if __name__ == "__main__":
img_h = 480
img_w = 640
img = np.zeros([img_h,img_w], dtype = np.float)
cv2.namedWindow('image_0', 1)
cv2.imshow('ima... | [
"cv2.waitKey",
"cv2.imshow",
"numpy.zeros",
"cv2.namedWindow"
] | [((224, 264), 'numpy.zeros', 'np.zeros', (['[img_h, img_w]'], {'dtype': 'np.float'}), '([img_h, img_w], dtype=np.float)\n', (232, 264), True, 'import numpy as np\n'), ((271, 300), 'cv2.namedWindow', 'cv2.namedWindow', (['"""image_0"""', '(1)'], {}), "('image_0', 1)\n", (286, 300), False, 'import cv2\n'), ((305, 331), '... |
import numpy as np
import matplotlib.pyplot as plt
class House():
def __init__(self, K: float=0.5, C: float=0.3, Qhvac: float=9, hvacON: float=0, occupancy: float=1, Tin_initial: float=30):
self.K = K # thermal conductivity
self.C = C # thermal capacity
self.Tin = Tin_initial # Inside Tempe... | [
"numpy.full",
"random.randint",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.finfo",
"numpy.random.randint",
"matplotlib.pyplot.subplots"
] | [((592, 603), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (601, 603), True, 'import matplotlib.pyplot as plt\n'), ((632, 650), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (644, 650), True, 'import matplotlib.pyplot as plt\n'), ((3837, 3849), 'matplotlib.pyplot.legend', ... |
import os
import pandas as pd
from datetime import datetime
from feast import FeatureStore
from example_feature_repo.example import (
driver,
driver_hourly_stats_view,
customer,
customer_daily_profile_view,
)
def test_end_to_end_one_feature_view(feature_store: FeatureStore):
try:
# apply... | [
"datetime.datetime.now",
"os.system"
] | [((2460, 2531), 'os.system', 'os.system', (['f"""PYTHONPATH=$PYTHONPATH:/$(pwd) feast -c {repo_name} apply"""'], {}), "(f'PYTHONPATH=$PYTHONPATH:/$(pwd) feast -c {repo_name} apply')\n", (2469, 2531), False, 'import os\n'), ((2549, 2689), 'os.system', 'os.system', (['f"""PYTHONPATH=$PYTHONPATH:/$(pwd) feast -c {repo_nam... |
#! usr/bin/env python3
# -*- coding:utf-8 -*-
"""
Copyright 2018 The Google AI Language Team Authors.
BASED ON Google_BERT.
@Author:WeiYi
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import modeling
import optimization
imp... | [
"os.remove",
"tensorflow.reduce_sum",
"tensorflow.logging.info",
"modeling.BertModel",
"tensorflow.trainable_variables",
"tensorflow.contrib.tpu.TPUConfig",
"tensorflow.train.Scaffold",
"tensorflow.reshape",
"tensorflow.logging.set_verbosity",
"tensorflow.matmul",
"pickle.load",
"modeling.Bert... | [((2362, 2437), 'tensorflow.flags.DEFINE_string', 'tf.flags.DEFINE_string', (['"""master"""', 'None', '"""[Optional] TensorFlow master URL."""'], {}), "('master', None, '[Optional] TensorFlow master URL.')\n", (2384, 2437), True, 'import tensorflow as tf\n'), ((3866, 4057), 'modeling.BertModel', 'modeling.BertModel', (... |
import argparse
import pandas as pd
from .analyse import analyse
from .diff import diff
pd.set_option('display.float_format', "{:.2f}".format)
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
def main():
parser = argparse.ArgumentParser(descr... | [
"pandas.set_option",
"argparse.ArgumentParser"
] | [((91, 145), 'pandas.set_option', 'pd.set_option', (['"""display.float_format"""', '"""{:.2f}""".format'], {}), "('display.float_format', '{:.2f}'.format)\n", (104, 145), True, 'import pandas as pd\n'), ((146, 184), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 5... |
# Generated by Django 3.0.5 on 2020-12-03 02:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('upload', '0002_image_pack_number'),
]
operations = [
migrations.AddField(
model_name='image',
name='is_cover',
... | [
"django.db.models.IntegerField"
] | [((333, 363), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (352, 363), False, 'from django.db import migrations, models\n')] |
from helper import greeting
msg = input("Please input a message: ")
print("Your Message: ")
greeting(msg)
| [
"helper.greeting"
] | [((92, 105), 'helper.greeting', 'greeting', (['msg'], {}), '(msg)\n', (100, 105), False, 'from helper import greeting\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
#0. SET PARAMETERS
###Path to directory with models (one or several models to be tested)
model_dir = ''
###DIRECTORY WITH IMAGES
#Tumor
base_dir_tu = ''
#Benign
base_dir_norm = ''
###OUTPUT DIRECTORY FOR RESULT FILES
result_dir = ''
###
#1. IMPORT... | [
"staintools.BrightnessStandardizer",
"keras.models.load_model",
"statistics.median",
"numpy.float32",
"staintools.StainNormalizer",
"numpy.expand_dims",
"staintools.read_image",
"keras.preprocessing.image.img_to_array",
"keras.preprocessing.image.load_img",
"numpy.array",
"PIL.ImageOps.flip",
... | [((867, 919), 'staintools.read_image', 'staintools.read_image', (['"""standard_he_stain_small.jpg"""'], {}), "('standard_he_stain_small.jpg')\n", (888, 919), False, 'import staintools\n'), ((970, 1005), 'staintools.BrightnessStandardizer', 'staintools.BrightnessStandardizer', ([], {}), '()\n', (1003, 1005), False, 'imp... |
from kvdroid import activity, Point
import re
class Metrics(object):
config = activity.getResources().getConfiguration()
metric = activity.getResources().getDisplayMetrics()
def height_dp(self):
return self.config.screenHeightDp
def width_dp(self):
return self.config.screenWidthDp
... | [
"kvdroid.Point",
"kvdroid.activity.getResources",
"kvdroid.activity.getWindowManager"
] | [((646, 653), 'kvdroid.Point', 'Point', ([], {}), '()\n', (651, 653), False, 'from kvdroid import activity, Point\n'), ((83, 106), 'kvdroid.activity.getResources', 'activity.getResources', ([], {}), '()\n', (104, 106), False, 'from kvdroid import activity, Point\n'), ((139, 162), 'kvdroid.activity.getResources', 'activ... |
import json
import os
from harvester.OAHarvester import OAHarvester
from config.path_config import CONFIG_PATH_TEST, DATA_PATH
FIXTURES_PATH = os.path.dirname(__file__)
config_harvester = json.load(open(CONFIG_PATH_TEST, "r"))
harvester_2_publications = OAHarvester(config_harvester)
harvester_2_publications_sample =... | [
"os.path.dirname",
"json.load",
"os.path.join",
"harvester.OAHarvester.OAHarvester"
] | [((145, 170), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (160, 170), False, 'import os\n'), ((257, 286), 'harvester.OAHarvester.OAHarvester', 'OAHarvester', (['config_harvester'], {}), '(config_harvester)\n', (268, 286), False, 'from harvester.OAHarvester import OAHarvester\n'), ((321, 36... |
import pymc3 as pm
import theano.tensor as T
from .layers import Dense
class LikelyhoodModels:
def __init__(self):
"""
"""
pass
def gaussian_lk(self, shape_in, input_tensor, out_shape, observed,
total_size, prior, beta=5, **priors_kwargs):
"""
"""... | [
"pymc3.Categorical",
"pymc3.Model",
"pymc3.Normal",
"pymc3.HalfCauchy",
"pymc3.Gamma",
"theano.tensor.nnet.softmax",
"pymc3.Bernoulli",
"theano.tensor.nnet.sigmoid",
"pymc3.StudentT"
] | [((334, 344), 'pymc3.Model', 'pm.Model', ([], {}), '()\n', (342, 344), True, 'import pymc3 as pm\n'), ((628, 666), 'pymc3.HalfCauchy', 'pm.HalfCauchy', ([], {'name': '"""sigma"""', 'beta': 'beta'}), "(name='sigma', beta=beta)\n", (641, 666), True, 'import pymc3 as pm\n'), ((732, 802), 'pymc3.Normal', 'pm.Normal', (['""... |
import turtle as t
import random
timmy = t.Turtle()
colours = ["CornflowerBlue", "DarkOrchid", "IndianRed", "DeepSkyBlue", "LightSeaGreen", "wheat", "SlateGray", "SeaGreen"]
def draw_shape(num_sides):
angle = 360 / num_sides
for _ in range(num_sides):
timmy.forward(100)
timmy.right(angle)
... | [
"random.choice",
"turtle.Turtle"
] | [((42, 52), 'turtle.Turtle', 't.Turtle', ([], {}), '()\n', (50, 52), True, 'import turtle as t\n'), ((370, 392), 'random.choice', 'random.choice', (['colours'], {}), '(colours)\n', (383, 392), False, 'import random\n')] |
import gc
import platform
from dataclasses import dataclass
from functools import partial
from multiprocessing import set_start_method
from typing import (Any, Callable, List, Optional, Tuple, Union)
from deap import tools
from fedot.core.chains.chain import Chain
from fedot.core.chains.chain_validation import valida... | [
"functools.partial",
"fedot.core.composer.optimisers.gp_comp.gp_optimiser.GPChainOptimiserParameters",
"fedot.core.data.data_split.train_test_data_setup",
"fedot.core.repository.operation_types_repository.OperationTypesRepository",
"fedot.core.composer.cache.OperationsCache",
"fedot.core.chains.chain_vali... | [((1802, 1819), 'platform.system', 'platform.system', ([], {}), '()\n', (1817, 1819), False, 'import platform\n'), ((1854, 1891), 'multiprocessing.set_start_method', 'set_start_method', (['"""spawn"""'], {'force': '(True)'}), "('spawn', force=True)\n", (1870, 1891), False, 'from multiprocessing import set_start_method\... |
import asyncio
import logging
import random
from .utils.utils import isint
from datetime import datetime
from quart import Quart, render_template, request, redirect
from .fetch_blockchain_data import BlockchainFetch
app = Quart(__name__)
app.jinja_options = {}
app.logger.level = logging.INFO
# load config.py
ap... | [
"quart.redirect",
"random.randint",
"quart.request.args.get",
"quart.render_template",
"asyncio.get_running_loop",
"quart.Quart",
"datetime.datetime.now"
] | [((227, 242), 'quart.Quart', 'Quart', (['__name__'], {}), '(__name__)\n', (232, 242), False, 'from quart import Quart, render_template, request, redirect\n'), ((2552, 2578), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (2576, 2578), False, 'import asyncio\n'), ((6304, 6335), 'quart.request.... |
from pathlib import Path, PurePath
import secrets
from urllib3.util import parse_url
import requests
from src.configuration import get_secret
__all__ = ["delete", "download", "move", "saved_name"]
def delete(prompt_id: str) -> bool:
"""Delete a media file."""
f_name = sorted(Path(get_secret("IMAGES_DIR"))... | [
"secrets.token_hex",
"urllib3.util.parse_url",
"src.configuration.get_secret",
"pathlib.PurePath",
"requests.get"
] | [((773, 790), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (785, 790), False, 'import requests\n'), ((653, 674), 'secrets.token_hex', 'secrets.token_hex', (['(12)'], {}), '(12)\n', (670, 674), False, 'import secrets\n'), ((1211, 1240), 'src.configuration.get_secret', 'get_secret', (['"""IMAGES_DIR_TEMP"""'... |
from unittest import TestCase, mock
from komand.exceptions import PluginException
from komand_active_directory_ldap.actions.query_group_membership import QueryGroupMembership
from komand_active_directory_ldap.actions.query_group_membership.schema import Input, Output
from unit_test.common import MockServer
from unit_te... | [
"komand_active_directory_ldap.actions.query_group_membership.QueryGroupMembership",
"unittest.mock.MagicMock",
"unit_test.common.MockConnection"
] | [((481, 520), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {'return_value': 'MockServer'}), '(return_value=MockServer)\n', (495, 520), False, 'from unittest import TestCase, mock\n'), ((956, 995), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {'return_value': 'MockServer'}), '(return_value=MockServer)\n', (970... |
# NASA EO-Metadata-Tools Python interface for the Common Metadata Repository (CMR)
#
# https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html
#
# Copyright (c) 2020 United States Government as represented by the Administrator
# of the National Aeronautics and Space Administration. All Rights Reserved.
#
# ... | [
"cmr.search.common._next_page_state",
"test.cmr.MockResponse",
"test.cmr.resolve_full_path",
"cmr.util.common.read_file",
"cmr.search.common.umm_fields",
"cmr.search.common._continue_download",
"cmr.search.common.meta_fields",
"cmr.search.common.clear_scroll",
"cmr.search.common.open_api",
"cmr.se... | [((1349, 1371), 'cmr.util.common.read_file', 'common.read_file', (['file'], {}), '(file)\n', (1365, 1371), True, 'import cmr.util.common as common\n'), ((1383, 1448), 'test.cmr.MockResponse', 'tutil.MockResponse', (['json_response'], {'status': 'status', 'headers': 'headers'}), '(json_response, status=status, headers=h... |
import boto3
import os
import requests
import datetime
import json
import asyncio
import time
cognito_client = boto3.client('cognito-idp')
website_url = os.environ['WEBSITE_URL']
test_username = os.environ['TEST_USERNAME']
test_password = os.environ['TEST_PASSWORD']
app_client_id = os.environ['APP_CLIENT_ID']
api_ur... | [
"asyncio.gather",
"asyncio.get_event_loop",
"boto3.client",
"json.dumps",
"time.time",
"datetime.timedelta",
"requests.get",
"datetime.datetime.now"
] | [((112, 139), 'boto3.client', 'boto3.client', (['"""cognito-idp"""'], {}), "('cognito-idp')\n", (124, 139), False, 'import boto3\n'), ((574, 602), 'datetime.timedelta', 'datetime.timedelta', ([], {'hours': '(19)'}), '(hours=19)\n', (592, 602), False, 'import datetime\n'), ((613, 636), 'datetime.datetime.now', 'datetime... |
"""Functions to configure energy demand outputs for supply model
"""
import os
import logging
import numpy as np
import pandas as pd
from energy_demand.basic import date_prop, testing_functions, lookup_tables
def constrained_results(
results_constrained,
results_unconstrained_no_heating,
submo... | [
"pandas.DataFrame",
"energy_demand.basic.lookup_tables.basic_lookups",
"logging.debug",
"numpy.sum",
"energy_demand.basic.date_prop.convert_h_to_day_year_and_h",
"energy_demand.basic.testing_functions.test_if_minus_value_in_array",
"logging.info"
] | [((5766, 5853), 'logging.info', 'logging.info', (['"""... Prepared results for energy supply model in unconstrained mode"""'], {}), "(\n '... Prepared results for energy supply model in unconstrained mode')\n", (5778, 5853), False, 'import logging\n'), ((7133, 7175), 'logging.info', 'logging.info', (['"""... writing... |
import re
equations = open("day18/input").read().splitlines()
pattern = re.compile("[()*/+-]|[0-9]+")
op_precedence = {"+": 1, "-": 1, "*": 0, "/": 0, "(": 2, ")": 2}
def shunting_yard(eq, patt):
operator_stack = []
output = []
for m in re.finditer(patt, eq):
tok = m.group(0)
if tok.is... | [
"re.finditer",
"re.compile"
] | [((74, 103), 're.compile', 're.compile', (['"""[()*/+-]|[0-9]+"""'], {}), "('[()*/+-]|[0-9]+')\n", (84, 103), False, 'import re\n'), ((254, 275), 're.finditer', 're.finditer', (['patt', 'eq'], {}), '(patt, eq)\n', (265, 275), False, 'import re\n')] |
# Generated by Django 2.1.10 on 2019-07-28 14:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20190721_1312'),
]
operations = [
migrations.AlterField(
model_name='verb',
name='ref',
... | [
"django.db.models.CharField"
] | [((329, 384), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(255)', 'null': '(True)'}), '(blank=True, max_length=255, null=True)\n', (345, 384), False, 'from django.db import migrations, models\n')] |
class Log:
def __init__(self, newFile):
self.fileName = "logs/" + newFile
# check that "logs" folder exists and create it if necessary
import os
if not os.path.isdir("logs"):
os.makedirs("logs")
# TODO: error checking on file...does it exist, is... | [
"os.path.isdir",
"datetime.datetime.now",
"os.makedirs"
] | [((876, 890), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (888, 890), False, 'from datetime import datetime\n'), ((202, 223), 'os.path.isdir', 'os.path.isdir', (['"""logs"""'], {}), "('logs')\n", (215, 223), False, 'import os\n'), ((237, 256), 'os.makedirs', 'os.makedirs', (['"""logs"""'], {}), "('logs')... |
""" Map klassen """
import pygame
import math
class Map():
EMPTY = 0
WALL = 1
POINT = 2
PLAYER = 3
RED_GHOST = 4
CYAN_GHOST = 5
PINK_GHOST = 6
ORANGE_GHOST = 7
""" Initialiserer map klasse """
def __init__(self, file_name):
image = pygame.image.load("maps/{0}".form... | [
"math.floor"
] | [((3009, 3043), 'math.floor', 'math.floor', (['((pos[0] + offset) / 16)'], {}), '((pos[0] + offset) / 16)\n', (3019, 3043), False, 'import math\n'), ((3052, 3086), 'math.floor', 'math.floor', (['((pos[1] + offset) / 16)'], {}), '((pos[1] + offset) / 16)\n', (3062, 3086), False, 'import math\n')] |
"""
Watch out with the size parameter, it will kill your RAM
"""
import random
import time
size = 1000
def generate_list(size):
test = []
for i in range(size):
test.append(random.randint(0, size))
return test
def find(test, id):
for i in range(len(test)):
if test[i] == id:
... | [
"random.randint",
"time.time"
] | [((361, 372), 'time.time', 'time.time', ([], {}), '()\n', (370, 372), False, 'import time\n'), ((486, 497), 'time.time', 'time.time', ([], {}), '()\n', (495, 497), False, 'import time\n'), ((413, 424), 'time.time', 'time.time', ([], {}), '()\n', (422, 424), False, 'import time\n'), ((554, 565), 'time.time', 'time.time'... |
#!/usr/bin/env python
######################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2017, Rice University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that t... | [
"matplotlib.pyplot.get_cmap",
"matplotlib.pyplot.plot",
"matplotlib.colors.Normalize",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.axis",
"numpy.cumsum",
"matplotlib.pyplot.figure",
"matplotlib.path.Path",
"numpy.sin",
"numpy.loadtxt",
"numpy.cos",
"matplotlib.pyplot.gca",
"matplotlib.pyplo... | [((2421, 2433), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2431, 2433), True, 'import matplotlib.pyplot as plt\n'), ((2434, 2451), 'matplotlib.pyplot.axis', 'plt.axis', (['"""equal"""'], {}), "('equal')\n", (2442, 2451), True, 'import matplotlib.pyplot as plt\n'), ((2457, 2493), 'matplotlib.pyplot.axe... |
import json
from glob import glob
def test_valid_json():
"""Test if all json files are valid"""
for filename in glob("./scripts/*.json"):
with open(filename, "r") as fin:
assert json.load(fin)
| [
"json.load",
"glob.glob"
] | [((122, 146), 'glob.glob', 'glob', (['"""./scripts/*.json"""'], {}), "('./scripts/*.json')\n", (126, 146), False, 'from glob import glob\n'), ((208, 222), 'json.load', 'json.load', (['fin'], {}), '(fin)\n', (217, 222), False, 'import json\n')] |
import random
import numpy as np
import data as dt
import time
import copy
from tabulate import tabulate
from collections import OrderedDict
data = []
# Graph object
class Graph:
def __init__(self, nodes, edges, chosen, available, num_strategies, max_weight):
self.nodes = nodes
self.edges = edges
self.... | [
"random.randint",
"copy.copy",
"data.save",
"random.choice",
"time.time",
"tabulate.tabulate"
] | [((3861, 3877), 'copy.copy', 'copy.copy', (['graph'], {}), '(graph)\n', (3870, 3877), False, 'import copy\n'), ((4403, 4414), 'time.time', 'time.time', ([], {}), '()\n', (4412, 4414), False, 'import time\n'), ((5471, 5487), 'data.save', 'dt.save', (['data[i]'], {}), '(data[i])\n', (5478, 5487), True, 'import data as dt... |
# coding: utf-8
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
"""
Entity Related HTTP resources
========================
File contains HTTP resources for an Entity module
"""
from flask import request, abort
from sqlalchemy.exc import IntegrityError
from app.core.entity.models import EntityType
... | [
"app.core.entity.models.EntityType",
"app.extensions.db.session.add",
"app.extensions.db.session.begin",
"flask.abort",
"app.blueprint.route",
"app.extensions.db.session.delete",
"flask.request.get_json",
"app.core.entity.models.EntityType.query.get",
"app.extensions.db.session.commit"
] | [((417, 483), 'app.blueprint.route', 'blueprint.route', (['"""entity-type/<string:entity_id>"""'], {'methods': "['GET']"}), "('entity-type/<string:entity_id>', methods=['GET'])\n", (432, 483), False, 'from app import blueprint\n'), ((684, 753), 'app.blueprint.route', 'blueprint.route', (['"""entity-type/<string:entity_... |
#!flask\Scripts\python.exe
import os
from flask_debugtoolbar import DebugToolbarExtension
from flask_script import Manager, Shell
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, MigrateCommand
from mdt_app import create_app, db
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
migra... | [
"flask_script.Manager",
"flask_migrate.Migrate",
"flask_debugtoolbar.DebugToolbarExtension",
"flask_script.Shell",
"os.getenv"
] | [((325, 341), 'flask_migrate.Migrate', 'Migrate', (['app', 'db'], {}), '(app, db)\n', (332, 341), False, 'from flask_migrate import Migrate, MigrateCommand\n'), ((352, 378), 'flask_debugtoolbar.DebugToolbarExtension', 'DebugToolbarExtension', (['app'], {}), '(app)\n', (373, 378), False, 'from flask_debugtoolbar import ... |
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.http import JsonResponse
from django.contrib.auth.models import User # STEP 1: Import the user
from foundation.models import Daily,Vocabulary
from rest_framework import status, response, views
from rest_framework.authenti... | [
"api.serializers.gateway.RegisterSerializer",
"api.serializers.dashboard.VocaddSerializer",
"django.http.JsonResponse",
"rest_framework.response.Response",
"api.serializers.gateway.LoginSerializer"
] | [((655, 692), 'api.serializers.gateway.RegisterSerializer', 'RegisterSerializer', ([], {'data': 'request.data'}), '(data=request.data)\n', (673, 692), False, 'from api.serializers.gateway import RegisterSerializer, LoginSerializer\n'), ((784, 855), 'rest_framework.response.Response', 'response.Response', ([], {'status'... |
from modeldata import from_downloaded
from utilities import get_ecmwf_variable_code,get_n_months,add_month_to_timestamp
import log
from ecmwfapi import ECMWFDataServer
from datetime import date,timedelta
from netCDF4 import Dataset
import os
def ecmwfserver(output_dir,variables,start_date,end_date,
... | [
"netCDF4.Dataset",
"os.mkdir",
"os.remove",
"utilities.add_month_to_timestamp",
"ecmwfapi.ECMWFDataServer",
"datetime.date.strftime",
"utilities.get_ecmwf_variable_code",
"os.path.exists",
"modeldata.from_downloaded",
"log.info",
"utilities.get_n_months"
] | [((616, 650), 'utilities.get_n_months', 'get_n_months', (['start_date', 'end_date'], {}), '(start_date, end_date)\n', (628, 650), False, 'from utilities import get_ecmwf_variable_code, get_n_months, add_month_to_timestamp\n'), ((2294, 2311), 'ecmwfapi.ECMWFDataServer', 'ECMWFDataServer', ([], {}), '()\n', (2309, 2311),... |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Generate a mig server and client pair from migs.def
# Emitting:
# nacl_exc_server.c
# nacl_exc.h
import os
import re
im... | [
"os.path.abspath",
"os.remove",
"os.makedirs",
"tempfile.mkstemp",
"os.path.dirname",
"re.subn",
"os.path.exists",
"os.close",
"sys.exit",
"sys.stderr.write",
"os.write",
"subprocess.check_call"
] | [((763, 790), 'os.path.abspath', 'os.path.abspath', (['dst_header'], {}), '(dst_header)\n', (778, 790), False, 'import os\n'), ((806, 833), 'os.path.abspath', 'os.path.abspath', (['dst_server'], {}), '(dst_server)\n', (821, 833), False, 'import os\n'), ((1163, 1229), 're.subn', 're.subn', (['"""ServerPrefix catch_;"""'... |
__author__ = 'Jon'
from polls.models import Poll, Choice
from django.contrib import admin
admin.site.register(Poll)
admin.site.register(Choice)
| [
"django.contrib.admin.site.register"
] | [((97, 122), 'django.contrib.admin.site.register', 'admin.site.register', (['Poll'], {}), '(Poll)\n', (116, 122), False, 'from django.contrib import admin\n'), ((124, 151), 'django.contrib.admin.site.register', 'admin.site.register', (['Choice'], {}), '(Choice)\n', (143, 151), False, 'from django.contrib import admin\n... |
import pandas as pd
import numpy
def convert_messages_to_hourly_bins(df, period='H', fillnans=False,
run_resample=True):
"""Resample the messages to a new time-resolution.
Defaults to hourly.
Arguments
---------
df : pandas DataFrame
A DataFrame of mess... | [
"pandas.DataFrame",
"pandas.isnull"
] | [((857, 911), 'pandas.DataFrame', 'pd.DataFrame', (["{'sog': speed_ts, 'draught': draught_ts}"], {}), "({'sog': speed_ts, 'draught': draught_ts})\n", (869, 911), True, 'import pandas as pd\n'), ((1454, 1475), 'pandas.isnull', 'pd.isnull', (['df_new.sog'], {}), '(df_new.sog)\n', (1463, 1475), True, 'import pandas as pd\... |
from flask import Flask, render_template, url_for, flash, redirect, abort, request
from . import main
from .forms import RegistrationForm, LoginForm, BlogForm, UpdateProfile, CommentForm
from app.requests import get_quotes
from ..models import User, Blog, Comment
from .. import db, photos
from flask_login import login_... | [
"app.requests.get_quotes",
"flask.flash",
"flask.request.args.get",
"flask_login.login_user",
"flask.abort",
"flask_login.logout_user",
"flask.url_for",
"flask.render_template",
"flask_login.current_user._get_current_object"
] | [((410, 422), 'app.requests.get_quotes', 'get_quotes', ([], {}), '()\n', (420, 422), False, 'from app.requests import get_quotes\n'), ((434, 471), 'flask.request.args.get', 'request.args.get', (['"""page"""', '(1)'], {'type': 'int'}), "('page', 1, type=int)\n", (450, 471), False, 'from flask import Flask, render_templa... |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
Converts an IBEIS database to a wildbook db
"""
# TODO: ADD COPYRIGHT TAG
from __future__ import absolute_import, division, print_function
#import ibeis
import utool
import json
import requests
from six.moves import zip, map
print, print_, printDBG, rrr, profile = ut... | [
"utool.inject",
"six.moves.zip",
"requests.post",
"json.dumps"
] | [((318, 355), 'utool.inject', 'utool.inject', (['__name__', '"""[export_wb]"""'], {}), "(__name__, '[export_wb]')\n", (330, 355), False, 'import utool\n'), ((895, 924), 'six.moves.zip', 'zip', (['imgsetid_list', 'nids_list'], {}), '(imgsetid_list, nids_list)\n', (898, 924), False, 'from six.moves import zip, map\n'), (... |
import numpy as np
import networkx as nx
from bokeh.plotting import figure, show, output_notebook
from bokeh.layouts import column
from bokeh.models import Slider, ColumnDataSource, CustomJS
## TODO:
# 1. Calculate MST, determine two subsets each edge connects
# 2. Given a drawn layout, filter opacity of nodes/edg... | [
"networkx.Graph",
"scipy.spatial.distance.pdist",
"networkx.utils.UnionFind",
"networkx.minimum_spanning_tree"
] | [((1020, 1038), 'networkx.utils.UnionFind', 'UnionFind', (['g.nodes'], {}), '(g.nodes)\n', (1029, 1038), False, 'from networkx.utils import UnionFind\n'), ((1283, 1293), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1291, 1293), True, 'import networkx as nx\n'), ((647, 657), 'networkx.Graph', 'nx.Graph', ([], {}), '... |
from recommender_engine import make_recommendation
"""
This sample used movielens datasets @ http://files.grouplens.org/datasets/movielens/ml-10m.zip
"""
def make_preference_space_MovieLens(path):
""" create preference space for Movielens data set
"""
movies = {}
for line in open(path + '/movies.dat'):
(movi... | [
"recommender_engine.make_recommendation"
] | [((831, 1016), 'recommender_engine.make_recommendation', 'make_recommendation', ([], {'person_to_recommend': '"""1"""', 'preference_space': 'preference_space', 'recommender_approach': '"""user_based"""', 'number_of_items_to_recommend': '(10)', 'similarity_measure': '"""cosine"""'}), "(person_to_recommend='1', preferenc... |
import re
from ztag.annotation import Annotation
from ztag.annotation import OperatingSystem
from ztag.annotation import Type
from ztag.annotation import Manufacturer
from ztag import protocols
import ztag.test
class FtpBelkin(Annotation):
protocol = protocols.FTP
subprotocol = protocols.FTP.BANNER
port =... | [
"re.compile"
] | [((345, 433), 're.compile', 're.compile', (['"""^220 Belkin Network USB Hub Ver \\\\d+\\\\.\\\\d+\\\\.\\\\d+ FTP"""', 're.IGNORECASE'], {}), "('^220 Belkin Network USB Hub Ver \\\\d+\\\\.\\\\d+\\\\.\\\\d+ FTP', re.\n IGNORECASE)\n", (355, 433), False, 'import re\n')] |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... | [
"dataflow.shared.log.batch_logger.exception",
"json.dumps",
"dataflow.batch.utils.time_util.get_monday_timestamp",
"dataflow.batch.utils.resource_util.get_default_jobnavi_label",
"dataflow.batch.utils.result_table_util.is_model_serve_mode_offline",
"json.loads",
"random.randint",
"dataflow.shared.meta... | [((2547, 2589), 'json.loads', 'json.loads', (['self.job_info.jobserver_config'], {}), '(self.job_info.jobserver_config)\n', (2557, 2589), False, 'import json\n'), ((2735, 2786), 'dataflow.shared.jobnavi.jobnavi_helper.JobNaviHelper', 'JobNaviHelper', (['self.geog_area_code', 'self.cluster_id'], {}), '(self.geog_area_co... |