code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import click
import tqdm
from mapchete import commands
from mapchete.cli import utils
@click.command(help="Copy TileDirectory from one source to another.")
@utils.arg_src_tiledir
@utils.arg_dst_tiledir
@utils.opt_zoom
@utils.opt_area
@utils.opt_area_crs
@utils.opt_bounds
@utils.opt_bounds_crs
@utils.opt_overwrite
@u... | [
"mapchete.commands.cp",
"click.BadOptionUsage",
"click.command"
] | [((90, 158), 'click.command', 'click.command', ([], {'help': '"""Copy TileDirectory from one source to another."""'}), "(help='Copy TileDirectory from one source to another.')\n", (103, 158), False, 'import click\n'), ((752, 863), 'click.BadOptionUsage', 'click.BadOptionUsage', (['x', 'f"""\'--{x} foo\' is deprecated. ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ResCompany(models.Model):
_inherit = 'res.company'
timesheet_range = fields.Selection([('week', 'Week'), ('month', 'Month')],
default='week', string='Timesheet... | [
"odoo.fields.Selection"
] | [((218, 384), 'odoo.fields.Selection', 'fields.Selection', (["[('week', 'Week'), ('month', 'Month')]"], {'default': '"""week"""', 'string': '"""Timesheet range"""', 'help': '"""Periodicity on which you validate your timesheets."""'}), "([('week', 'Week'), ('month', 'Month')], default='week',\n string='Timesheet rang... |
import logging
from datetime import datetime
import pandas as pd
import geopandas as gpd
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def export_watering_data(df_watering):
"""Write data about watered trees and information about trees to csv and geojson files.
Args:
watered_tr... | [
"logging.getLogger",
"datetime.datetime.now"
] | [((99, 126), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (116, 126), False, 'import logging\n'), ((772, 786), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (784, 786), False, 'from datetime import datetime\n'), ((2183, 2197), 'datetime.datetime.now', 'datetime.now', ([], {... |
import os
from contextlib import contextmanager
@contextmanager
def inside_bake(bake):
"""
Execute code from inside the baked cookiecutter
"""
old_path = os.getcwd()
try:
os.chdir(os.path.join(bake.project.dirpath(), bake.project.basename))
yield
finally:
os.chdir(old_p... | [
"os.chdir",
"os.getcwd"
] | [((172, 183), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (181, 183), False, 'import os\n'), ((306, 324), 'os.chdir', 'os.chdir', (['old_path'], {}), '(old_path)\n', (314, 324), False, 'import os\n')] |
from win32com.client import Dispatch
class WpsWord:
def __init__(self):
self.word = Dispatch('word.Application')
self.word.Visible = True
def open(self,docx):
self.word.Documents.Open(docx)
| [
"win32com.client.Dispatch"
] | [((99, 127), 'win32com.client.Dispatch', 'Dispatch', (['"""word.Application"""'], {}), "('word.Application')\n", (107, 127), False, 'from win32com.client import Dispatch\n')] |
from chimerax.atomic import Structure
from chimerax.core.commands import run
run(session,"view")
for m in session.models:
if isinstance(m, Structure):
m._set_chain_descriptions(session)
m._report_chain_descriptions(session) | [
"chimerax.core.commands.run"
] | [((78, 98), 'chimerax.core.commands.run', 'run', (['session', '"""view"""'], {}), "(session, 'view')\n", (81, 98), False, 'from chimerax.core.commands import run\n')] |
"""
Various functions for model evaluation.
"""
import numpy as np
import pandas as pd
from utils.load_data_raw import DataGenerator_raw
from utils.custom_loss import angle_diff_deg
from utils.plot import plot_history
def model_complete_eval(model, history, part_test, params, batch_size=1024,
... | [
"utils.plot.plot_history",
"utils.custom_loss.angle_diff_deg",
"numpy.max",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.square",
"numpy.min",
"utils.load_data_raw.DataGenerator_raw",
"numpy.arange"
] | [((1809, 1847), 'utils.load_data_raw.DataGenerator_raw', 'DataGenerator_raw', (['part_test'], {}), '(part_test, **params)\n', (1826, 1847), False, 'from utils.load_data_raw import DataGenerator_raw\n'), ((3489, 3506), 'numpy.min', 'np.min', (['part_test'], {}), '(part_test)\n', (3495, 3506), True, 'import numpy as np\n... |
import html
from pyrogram import Client, filters
from pyrogram.errors.exceptions.bad_request_400 import MessageNotModified
from .. import config, help_dict, get_entity, log_errors, public_log_errors
ZWS = '\u200B'
def _generate_sexy(entity, ping):
text = getattr(entity, 'title', None)
if not text:
text... | [
"pyrogram.filters.command",
"html.escape"
] | [((429, 452), 'html.escape', 'html.escape', (["(text or '')"], {}), "(text or '')\n", (440, 452), False, 'import html\n'), ((1297, 1370), 'pyrogram.filters.command', 'filters.command', (["['info', 'whois']"], {'prefixes': "config['config']['prefixes']"}), "(['info', 'whois'], prefixes=config['config']['prefixes'])\n", ... |
from django.test import TestCase
from zentral.core.events.utils import decode_args, encode_args
class EventUtilsTestCase(TestCase):
def test_decode_args(self):
for encoded, decoded in (("", [""]),
(r"\\a", [r"\a"]),
(r"|1|2|3||", ["", "1", ... | [
"zentral.core.events.utils.decode_args",
"zentral.core.events.utils.encode_args"
] | [((438, 458), 'zentral.core.events.utils.decode_args', 'decode_args', (['encoded'], {}), '(encoded)\n', (449, 458), False, 'from zentral.core.events.utils import decode_args, encode_args\n'), ((770, 790), 'zentral.core.events.utils.encode_args', 'encode_args', (['decoded'], {}), '(decoded)\n', (781, 790), False, 'from ... |
"""
Created by <NAME>
"""
import numpy as np
from scipy.stats import truncnorm
import statsmodels.api as sm
from py4etrics.base_for_models import GenericLikelihoodModel_TobitTruncreg
class Truncreg(GenericLikelihoodModel_TobitTruncreg):
"""
Method 1:
Truncreg(endog, exog, left=<-np.inf>, right=<np.inf>).f... | [
"numpy.append",
"numpy.exp",
"numpy.dot",
"numpy.std",
"statsmodels.api.OLS"
] | [((1308, 1323), 'numpy.dot', 'np.dot', (['x', 'beta'], {}), '(x, beta)\n', (1314, 1323), True, 'import numpy as np\n'), ((1981, 2002), 'numpy.std', 'np.std', (['res_ols.resid'], {}), '(res_ols.resid)\n', (1987, 2002), True, 'import numpy as np\n'), ((2064, 2096), 'numpy.append', 'np.append', (['params_ols', 'sigma_ols'... |
import twitter
import time
import socket
import sys
import json
from langdetect import detect
from config import *
import argparse
def get_twitter_api():
oauth_token, oauth_token_secret = OAUTH_TOKEN, OAUTH_TOKEN_SECRET
auth = twitter.oauth.OAuth(oauth_token, oauth_token_secret,
... | [
"argparse.ArgumentParser",
"socket.socket",
"twitter.TwitterStream",
"time.sleep",
"langdetect.detect",
"twitter.oauth.OAuth",
"twitter.Twitter"
] | [((239, 326), 'twitter.oauth.OAuth', 'twitter.oauth.OAuth', (['oauth_token', 'oauth_token_secret', 'CONSUMER_KEY', 'CONSUMER_SECRET'], {}), '(oauth_token, oauth_token_secret, CONSUMER_KEY,\n CONSUMER_SECRET)\n', (258, 326), False, 'import twitter\n'), ((370, 396), 'twitter.Twitter', 'twitter.Twitter', ([], {'auth': ... |
from django import forms
from sql_to_django.widgets import DivContentEditable
class QueryInputForm(forms.Form):
query = forms.CharField(max_length=1000, widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Please input working SQL query.'})) | [
"django.forms.Textarea"
] | [((167, 268), 'django.forms.Textarea', 'forms.Textarea', ([], {'attrs': "{'class': 'form-control', 'placeholder': 'Please input working SQL query.'}"}), "(attrs={'class': 'form-control', 'placeholder':\n 'Please input working SQL query.'})\n", (181, 268), False, 'from django import forms\n')] |
import easygui as g
import os
#先打开第一个文件,显示并提取文件内容
file = g.fileopenbox(title='文件选择', msg='请选择你要打开的第一个文件文件', default='./*.txt', filetypes=['.txt', 'txt文档'])
file_name = os.path.basename(file)
with open(file,encoding='utf-8')as f1:
content = f1.read()
file_content = g.textbox(title='显示文件内容', msg='文件【%s】的内容显示如下' % fi... | [
"easygui.indexbox",
"easygui.fileopenbox",
"easygui.msgbox",
"os.path.splitext",
"easygui.textbox",
"os.path.basename",
"easygui.filesavebox",
"easygui.buttonbox"
] | [((58, 160), 'easygui.fileopenbox', 'g.fileopenbox', ([], {'title': '"""文件选择"""', 'msg': '"""请选择你要打开的第一个文件文件"""', 'default': '"""./*.txt"""', 'filetypes': "['.txt', 'txt文档']"}), "(title='文件选择', msg='请选择你要打开的第一个文件文件', default='./*.txt',\n filetypes=['.txt', 'txt文档'])\n", (71, 160), True, 'import easygui as g\n'), ((1... |
"""Utilties to create objects for testing."""
import pkg_resources as pkg
from itertools import repeat
from bs4.element import Tag
from lisc.objects.base import Base
from lisc.data import Articles, ArticlesAll, Term
from lisc.utils.db import SCDB
####################################################################... | [
"lisc.utils.db.SCDB.__init__",
"bs4.element.Tag",
"pkg_resources.resource_filename",
"lisc.objects.base.Base",
"lisc.data.ArticlesAll",
"lisc.data.Term",
"itertools.repeat"
] | [((806, 821), 'bs4.element.Tag', 'Tag', ([], {'name': '"""Out"""'}), "(name='Out')\n", (809, 821), False, 'from bs4.element import Tag\n'), ((834, 850), 'bs4.element.Tag', 'Tag', ([], {'name': '"""Inn1"""'}), "(name='Inn1')\n", (837, 850), False, 'from bs4.element import Tag\n'), ((863, 879), 'bs4.element.Tag', 'Tag', ... |
# Generated by Django 2.2 on 2019-05-27 20:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0008_remove_projectmodel_cover'),
]
operations = [
migrations.DeleteModel(
name='ImageModel',
),
migrations.De... | [
"django.db.migrations.DeleteModel"
] | [((233, 274), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""ImageModel"""'}), "(name='ImageModel')\n", (255, 274), False, 'from django.db import migrations\n'), ((307, 350), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""ProjectModel"""'}), "(name='Proj... |
#!/usr/bin/env python
from mako.template import Template
from mako.runtime import Context
from StringIO import StringIO
mytemplate = Template("hello, ${name}!")
buf = StringIO()
ctx = Context(buf, name="Akagi201")
mytemplate.render_context(ctx)
print(buf.getvalue())
| [
"mako.template.Template",
"StringIO.StringIO",
"mako.runtime.Context"
] | [((135, 162), 'mako.template.Template', 'Template', (['"""hello, ${name}!"""'], {}), "('hello, ${name}!')\n", (143, 162), False, 'from mako.template import Template\n'), ((169, 179), 'StringIO.StringIO', 'StringIO', ([], {}), '()\n', (177, 179), False, 'from StringIO import StringIO\n'), ((186, 215), 'mako.runtime.Cont... |
import asyncio
from datetime import timedelta
from typing import List
from protoactor.actor.actor_context import AbstractContext, GlobalRootContext
from protoactor.actor.event_stream import GlobalEventStream
from protoactor.actor.props import Props
from protoactor.mailbox.dispatcher import Dispatchers
from protoactor.... | [
"protoactor.cluster.providers.single_remote_instance.protos_pb2.GetKinds",
"protoactor.cluster.member_status_events.ClusterTopologyEvent",
"protoactor.remote.serialization.Serialization",
"protoactor.remote.remote.Remote",
"protoactor.actor.props.Props.from_func",
"protoactor.cluster.providers.single_remo... | [((1016, 1037), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(10)'}), '(seconds=10)\n', (1025, 1037), False, 'from datetime import timedelta\n'), ((1552, 1571), 'protoactor.actor.props.Props.from_func', 'Props.from_func', (['fn'], {}), '(fn)\n', (1567, 1571), False, 'from protoactor.actor.props import Props\n')... |
import os
import json
from dotenv import load_dotenv
from flask import Flask, request, abort, Response
from fcm import FcmIntegration
# Load environment variables
load_dotenv('.env')
# Initialize Flask app
app = Flask(__name__)
app.config.from_object('config.ProductionConfig')
# Initialize Firebase app
default_app... | [
"flask.Flask",
"flask.request.form.getlist",
"flask.request.form.get",
"dotenv.load_dotenv",
"flask.Response",
"fcm.FcmIntegration",
"flask.abort"
] | [((166, 185), 'dotenv.load_dotenv', 'load_dotenv', (['""".env"""'], {}), "('.env')\n", (177, 185), False, 'from dotenv import load_dotenv\n'), ((216, 231), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (221, 231), False, 'from flask import Flask, request, abort, Response\n'), ((719, 743), 'flask.request.f... |
import re
def phone_is_valid(phone):
"""
:param phone: Телефон для валидации
:type phone: str
:return: Результат валидации
:rtype: bool
"""
return True if re.match(r'^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$', phone) else False
def length_is_valid(obj, min_=None, max_=None):
... | [
"re.match"
] | [((185, 263), 're.match', 're.match', (['"""^((8|\\\\+7)[\\\\- ]?)?(\\\\(?\\\\d{3}\\\\)?[\\\\- ]?)?[\\\\d\\\\- ]{7,10}$"""', 'phone'], {}), "('^((8|\\\\+7)[\\\\- ]?)?(\\\\(?\\\\d{3}\\\\)?[\\\\- ]?)?[\\\\d\\\\- ]{7,10}$', phone)\n", (193, 263), False, 'import re\n')] |
import torch
import pytorch_lightning as pl
class SegmentationIoU(pl.metrics.Metric):
def __init__(self, n_classes: int, by_classes: bool = False, without_background_class: bool = False):
super().__init__(compute_on_step=False)
self._n_classes = n_classes
self._without_background_class = w... | [
"torch.mean",
"torch.count_nonzero"
] | [((1581, 1607), 'torch.mean', 'torch.mean', (['iou_by_classes'], {}), '(iou_by_classes)\n', (1591, 1607), False, 'import torch\n'), ((1012, 1048), 'torch.count_nonzero', 'torch.count_nonzero', (['overlap_indices'], {}), '(overlap_indices)\n', (1031, 1048), False, 'import torch\n'), ((1069, 1105), 'torch.count_nonzero',... |
import tensorflow
from tensorflow.keras.datasets import mnist
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Conv2D, MaxPooling2D, Flatten
from tensorflow.keras.optimizers import RMSprop
(mnist_train_images, mnist_train_labels), (mnist_test_images, mnist_test_labels)... | [
"tensorflow.keras.utils.to_categorical",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.datasets.mnist.load_data",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"matplotlib.pyplot.title",
"matplotli... | [((323, 340), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (338, 340), False, 'from tensorflow.keras.datasets import mnist\n'), ((985, 1046), 'tensorflow.keras.utils.to_categorical', 'tensorflow.keras.utils.to_categorical', (['mnist_train_labels', '(10)'], {}), '(mnist_train_labels,... |
from __future__ import absolute_import, print_function
import tweepy, base64, requests, pickle, json
class twitter_client(object):
def __init__(self):
self.session = requests.Session()
def _handle_creds(self):
'''Reusable credential handler
Arguments:
self - instance... | [
"requests.Session",
"pickle.load",
"tweepy.API",
"tweepy.parsers.JSONParser",
"base64.decodebytes",
"tweepy.OAuthHandler"
] | [((182, 200), 'requests.Session', 'requests.Session', ([], {}), '()\n', (198, 200), False, 'import tweepy, base64, requests, pickle, json\n'), ((470, 502), 'base64.decodebytes', 'base64.decodebytes', (['auth_list[0]'], {}), '(auth_list[0])\n', (488, 502), False, 'import tweepy, base64, requests, pickle, json\n'), ((529... |
import os
import shutil
import numpy as np
import pandas as pd
import pytest
from .. import misc
class _FakeTable(object):
def __init__(self, name, columns):
self.name = name
self.columns = columns
@pytest.fixture
def fta():
return _FakeTable('a', ['aa', 'ab', 'ac'])
@pytest.fixture
def ... | [
"pandas.Series",
"numpy.array",
"os.path.isdir",
"pytest.raises",
"shutil.rmtree",
"pandas.DataFrame"
] | [((1466, 1565), 'pandas.DataFrame', 'pd.DataFrame', (["{'to_zone_id': [2, 3, 4], 'from_zone_id': [1, 1, 1], 'distance': [0.1, 0.2,\n 0.9]}"], {}), "({'to_zone_id': [2, 3, 4], 'from_zone_id': [1, 1, 1],\n 'distance': [0.1, 0.2, 0.9]})\n", (1478, 1565), True, 'import pandas as pd\n'), ((1722, 1771), 'pandas.Series'... |
import re
import subprocess
import sys
from typing import Optional, List
from platypush.message.response.ping import PingResponse
from platypush.plugins import Plugin, action
PING_MATCHER = re.compile(
r"(?P<min>\d+.\d+)/(?P<avg>\d+.\d+)/(?P<max>\d+.\d+)/(?P<mdev>\d+.\d+)"
)
PING_MATCHER_BUSYBOX = re.compile(
... | [
"platypush.message.response.ping.PingResponse",
"re.compile"
] | [((193, 293), 're.compile', 're.compile', (['"""(?P<min>\\\\d+.\\\\d+)/(?P<avg>\\\\d+.\\\\d+)/(?P<max>\\\\d+.\\\\d+)/(?P<mdev>\\\\d+.\\\\d+)"""'], {}), "(\n '(?P<min>\\\\d+.\\\\d+)/(?P<avg>\\\\d+.\\\\d+)/(?P<max>\\\\d+.\\\\d+)/(?P<mdev>\\\\d+.\\\\d+)'\n )\n", (203, 293), False, 'import re\n'), ((307, 377), 're.co... |
from operator import and_
from sqlalchemy import and_, func
from sqlalchemy.orm import Session
from models import DBEcoPartProject, DBSample
def get_sample(db: Session, sample_id: int):
return db.query(DBSample).filter(DBSample.id == sample_id).first()
def get_samples_from_box(db: Session, north_east_lat: fl... | [
"sqlalchemy.func.lower",
"sqlalchemy.and_"
] | [((441, 578), 'sqlalchemy.and_', 'and_', (['(DBSample.lat >= south_west_lat)', '(DBSample.lng >= south_west_lng)', '(DBSample.lat <= north_east_lat)', '(DBSample.lng <= north_east_lng)'], {}), '(DBSample.lat >= south_west_lat, DBSample.lng >= south_west_lng, \n DBSample.lat <= north_east_lat, DBSample.lng <= north_e... |
from goco import Goco
GoogleApi = Goco('client_secret.json')
MyDrive = GoogleApi.connect(scope='drive.readonly', service_name='drive', version='v3')
Files = MyDrive.files().list()
print(Files.execute())
input()
| [
"goco.Goco"
] | [((37, 63), 'goco.Goco', 'Goco', (['"""client_secret.json"""'], {}), "('client_secret.json')\n", (41, 63), False, 'from goco import Goco\n')] |
#!/bin/env python
"""Start the bot."""
from ilswbot.ilswbot import updater
from ilswbot.config import config
if config['webhook']['enabled']:
updater.start_webhook(
listen='127.0.0.1',
port=config['webhook']['port'],
url_path=config['webhook']['token'],
)
domain = config['webhook'... | [
"ilswbot.ilswbot.updater.idle",
"ilswbot.ilswbot.updater.start_webhook",
"ilswbot.ilswbot.updater.start_polling"
] | [((149, 263), 'ilswbot.ilswbot.updater.start_webhook', 'updater.start_webhook', ([], {'listen': '"""127.0.0.1"""', 'port': "config['webhook']['port']", 'url_path': "config['webhook']['token']"}), "(listen='127.0.0.1', port=config['webhook']['port'],\n url_path=config['webhook']['token'])\n", (170, 263), False, 'from... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is an Astropy affiliated package.
"""
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init im... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.path.realpath",
"os.path.expanduser"
] | [((499, 532), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.atmosphy"""'], {}), "('~/.atmosphy')\n", (517, 532), False, 'import os\n'), ((561, 587), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (577, 587), False, 'import os\n'), ((644, 676), 'os.path.exists', 'os.path.exists', (['a... |
import unittest
import numpy as np
import scipy.stats
import sys
from kldmwr import bivar
from kldmwr import distributions2d
def bvnrm_pdf(x, p):
mu = [0, 0]
sgm = [[p[0], p[1]], [p[1], p[2]]]
return scipy.stats.multivariate_normal.pdf(x, mean=mu, cov=sgm)
def bvnrm_cdf(x, p):
mu = [0, 0]
sgm = [... | [
"kldmwr.bivar.order_stats",
"kldmwr.bivar.find_relvts_in",
"numpy.testing.assert_equal",
"numpy.reshape",
"kldmwr.bivar.mle",
"kldmwr.bivar.find_boundary_bbs",
"kldmwr.bivar.find_relbbs",
"numpy.array",
"numpy.testing.assert_almost_equal",
"kldmwr.bivar.zbce",
"unittest.main",
"kldmwr.bivar.fi... | [((6865, 6880), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6878, 6880), False, 'import unittest\n'), ((789, 906), 'numpy.array', 'np.array', (['[[-1.797, -0.648], [0.436, 0.812], [0.436, 0.812], [-0.044, -0.884], [-\n 0.064, -0.884], [1.886, 0.957]]'], {}), '([[-1.797, -0.648], [0.436, 0.812], [0.436, 0.81... |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 21 11:28:21 2019
@author: keelin
"""
from numpy import fliplr, flipud
from opencxr.utils.resize_rescale import rescale_to_min_max
from skimage import util
from skimage.transform import rotate
def invert_grayscale(np_array_in, preserve_dtype=True):
"""
A method ... | [
"skimage.util.invert",
"numpy.flipud",
"skimage.transform.rotate",
"numpy.fliplr",
"opencxr.utils.resize_rescale.rescale_to_min_max"
] | [((691, 715), 'skimage.util.invert', 'util.invert', (['np_array_in'], {}), '(np_array_in)\n', (702, 715), False, 'from skimage import util\n'), ((1486, 1516), 'skimage.transform.rotate', 'rotate', (['np_array_in', 'rot_angle'], {}), '(np_array_in, rot_angle)\n', (1492, 1516), False, 'from skimage.transform import rotat... |
###Package Importing
import numpy as np
import pandas as pd
from sklearn import metrics
import logging
from sklearn.externals import joblib
from sklearn.metrics import f1_score
import matplotlib.pyplot as plt
import os
from datetime import datetime
from preprocessing import hash_col
from preprocessing import on... | [
"logging.getLogger",
"model.machine_learning.LR",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.roc_curve",
"numpy.mean",
"model.machine_learning.RF",
"numpy.float64",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"model.machine_learni... | [((825, 852), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (842, 852), False, 'import logging\n'), ((909, 939), 'logging.FileHandler', 'logging.FileHandler', (['"""log.txt"""'], {}), "('log.txt')\n", (928, 939), False, 'import logging\n'), ((991, 1064), 'logging.Formatter', 'logging.For... |
# -*- coding: utf-8 -*-
'''
Models of category
'''
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Category(models.Model):
'''
Model category
'''
category = models.CharField(max_length=50)
description = models.CharField(max_length=100)
... | [
"django.db.models.CharField"
] | [((232, 263), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (248, 263), False, 'from django.db import models\n'), ((282, 314), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (298, 314), False, 'from django.db ... |
# -*- coding: utf-8 -*-
import math
import random
import torch
import numpy as np
class BucketIterator(object):
def __init__(self, data, batch_size, shuffle=True, sort=True):
self.shuffle = shuffle
self.sort = sort
self.batches, self.max_doc_len, self.num_batch = self.sort_and_p... | [
"torch.tensor",
"numpy.pad",
"random.shuffle"
] | [((3191, 3219), 'random.shuffle', 'random.shuffle', (['self.batches'], {}), '(self.batches)\n', (3205, 3219), False, 'import random\n'), ((2480, 2568), 'numpy.pad', 'np.pad', (['y_pair', '((0, max_doc_len - doc_len), (0, max_doc_len - doc_len))', '"""constant"""'], {}), "(y_pair, ((0, max_doc_len - doc_len), (0, max_do... |
import logging
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from mks.models import Member
from committees.models import Committee
from fuzzy_match import fuzzy_match
logger = logging.getLogger("open-knesset.mmm.models")
def text_lookup(Model, text):
"""receives a text and a... | [
"logging.getLogger",
"django.db.models.DateField",
"django.db.models.ManyToManyField",
"fuzzy_match.fuzzy_match",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((216, 260), 'logging.getLogger', 'logging.getLogger', (['"""open-knesset.mmm.models"""'], {}), "('open-knesset.mmm.models')\n", (233, 260), False, 'import logging\n'), ((2276, 2304), 'django.db.models.URLField', 'models.URLField', ([], {'unique': '(True)'}), '(unique=True)\n', (2291, 2304), False, 'from django.db imp... |
"""
connectToExistingConfig.py
Connecting to an existing session.
- For Windows, the default session ID=1.
- For Windows Connection Mgr, session ID=?
- For Linux, there are two ways to login:
1> Login with username/password
2> Use the API-Key instead.
- Then provide ... | [
"ixnetwork_restpy.testplatform.testplatform.TestPlatform",
"traceback.format_exc"
] | [((1239, 1292), 'ixnetwork_restpy.testplatform.testplatform.TestPlatform', 'TestPlatform', (['apiServerIp'], {'log_file_name': '"""restpy.log"""'}), "(apiServerIp, log_file_name='restpy.log')\n", (1251, 1292), False, 'from ixnetwork_restpy.testplatform.testplatform import TestPlatform\n'), ((2260, 2282), 'traceback.for... |
import numpy as np
from scipy.signal import savgol_filter
from qube.postprocess.dataset import Axis
def create_name(name, suffix=None, prefix=None):
elements = []
if prefix:
elements.append(str(prefix))
elements.append(str(name))
if suffix:
elements.append(str(suffix))
name = '_'.j... | [
"numpy.less_equal",
"scipy.signal.savgol_filter",
"qube.postprocess.dataset.Axis",
"numpy.nanmean",
"numpy.array",
"numpy.count_nonzero",
"numpy.argsort",
"numpy.moveaxis",
"numpy.gradient",
"numpy.greater_equal",
"numpy.mean",
"numpy.histogram",
"numpy.less",
"numpy.greater",
"numpy.sor... | [((1153, 1253), 'numpy.histogram', 'np.histogram', (['ds.value'], {'bins': 'bins', 'range': 'range', 'normed': 'normed', 'weights': 'weights', 'density': 'density'}), '(ds.value, bins=bins, range=range, normed=normed, weights=\n weights, density=density)\n', (1165, 1253), True, 'import numpy as np\n'), ((1367, 1418)... |
#!python
import ipaddress
import socket
import time
import os
import sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
# Protocol Scanner imports
from scan_mods.protocol_scanners.http_scanner import http_scanner
from scan_mods.protocol_sca... | [
"scan_mods.protocol_scanners.https_scanner.https_scanner",
"ipaddress.ip_address",
"scan_mods.protocol_scanners.dns_scanner.udp_dns_scanner",
"socket.socket",
"os.path.realpath",
"os.path.dirname",
"time.time",
"scan_mods.protocol_scanners.dns_scanner.tcp_dns_scanner",
"sys.path.append",
"scan_mod... | [((144, 171), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (159, 171), False, 'import os\n'), ((172, 198), 'sys.path.append', 'sys.path.append', (['parentdir'], {}), '(parentdir)\n', (187, 198), False, 'import sys\n'), ((104, 130), 'os.path.realpath', 'os.path.realpath', (['__file__'], ... |
#Crie um pgm que leia dois valores e mostre um menu na tela:
'''[1]somar
[2]multiplicar
[3]maior
[4]novos numeros
[5]sair do programa'''
#seu pgm deverá realizar a operação solicitada em cada caso
from time import sleep
opção = 0
n1 = int(input('1º VALOR: '))
n2 = int(input('2ª VALOR: '))
while opção != 5:
print(''... | [
"time.sleep"
] | [((1060, 1068), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (1065, 1068), False, 'from time import sleep\n')] |
import subprocess
import sys
def main():
result = subprocess.run(sys.argv[1:], capture_output=True, shell=False, text=True)
sys.stderr.write(result.stderr)
sys.stderr.flush()
sys.stdout.write(result.stdout)
sys.stdout.flush()
sys.exit(result.returncode)
| [
"subprocess.run",
"sys.stderr.flush",
"sys.stderr.write",
"sys.exit",
"sys.stdout.flush",
"sys.stdout.write"
] | [((55, 128), 'subprocess.run', 'subprocess.run', (['sys.argv[1:]'], {'capture_output': '(True)', 'shell': '(False)', 'text': '(True)'}), '(sys.argv[1:], capture_output=True, shell=False, text=True)\n', (69, 128), False, 'import subprocess\n'), ((133, 164), 'sys.stderr.write', 'sys.stderr.write', (['result.stderr'], {})... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
from jubakit.loader.twitter import TwitterStreamLoader, TwitterOAuthHandler
class TwitterStreamLoaderTest(TestCase):
oauth = TwitterOAuthHandler(consumer_key='x', consumer_secre... | [
"jubakit.loader.twitter.TwitterOAuthHandler",
"jubakit.loader.twitter.TwitterStreamLoader"
] | [((268, 367), 'jubakit.loader.twitter.TwitterOAuthHandler', 'TwitterOAuthHandler', ([], {'consumer_key': '"""x"""', 'consumer_secret': '"""x"""', 'access_token': '"""x"""', 'access_secret': '"""x"""'}), "(consumer_key='x', consumer_secret='x', access_token='x',\n access_secret='x')\n", (287, 367), False, 'from jubak... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import proxy_pb2 as proxy__pb2
class CMCProxyStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
sel... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler"
] | [((1280, 1355), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""proto.CMCProxy"""', 'rpc_method_handlers'], {}), "('proto.CMCProxy', rpc_method_handlers)\n", (1316, 1355), False, 'import grpc\n'), ((1028, 1223), 'grpc.unary_unary_rpc_method_handler', 'grpc.unary_unary_rpc_method_ha... |
from pytest import raises, warns
from bidso.find import find_in_bids, find_root, _generate_pattern
from .paths import BIDS_PATH, task_ieeg
filename = task_ieeg.get_filename(BIDS_PATH)
def test_find_root():
assert find_root(filename).name == 'bids'
assert find_root(filename, target='subject').name == 'sub-be... | [
"bidso.find.find_root",
"bidso.find.find_in_bids",
"pytest.warns",
"pytest.raises"
] | [((436, 540), 'bidso.find.find_in_bids', 'find_in_bids', (['filename'], {'subject': '"""bert"""', 'session': '"""day01"""', 'run': '"""1"""', 'extension': '""".nii.gz"""', 'upwards': '(True)'}), "(filename, subject='bert', session='day01', run='1', extension=\n '.nii.gz', upwards=True)\n", (448, 540), False, 'from b... |
from __future__ import absolute_import, division, print_function
import os
from vivarium.compartment.process import (
initialize_state)
from vivarium.compartment.composition import (
get_derivers,
simulate_with_environment,
plot_simulation_output, load_compartment)
# processes
from vivarium.processes... | [
"os.path.exists",
"vivarium.compartment.composition.load_compartment",
"os.makedirs",
"vivarium.processes.division.Division",
"vivarium.compartment.composition.plot_simulation_output",
"vivarium.compartment.composition.simulate_with_environment",
"os.path.join",
"vivarium.compartment.composition.get_d... | [((725, 739), 'vivarium.processes.growth.Growth', 'Growth', (['config'], {}), '(config)\n', (731, 739), False, 'from vivarium.processes.growth import Growth\n'), ((755, 771), 'vivarium.processes.division.Division', 'Division', (['config'], {}), '(config)\n', (763, 771), False, 'from vivarium.processes.division import D... |
#!/usr/bin/env python
import os
import sys
import platform
from setuptools import setup, find_packages
from setuptools.extension import Extension
repo_base_dir = os.path.abspath(os.path.dirname(__file__))
# pull in the packages metadata
package_about = {}
with open(os.path.join(repo_base_dir, "graphi", "__about__.py")... | [
"platform.python_implementation",
"setuptools.find_packages",
"os.path.join",
"setuptools.extension.Extension",
"os.path.dirname"
] | [((179, 204), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (194, 204), False, 'import os\n'), ((267, 320), 'os.path.join', 'os.path.join', (['repo_base_dir', '"""graphi"""', '"""__about__.py"""'], {}), "(repo_base_dir, 'graphi', '__about__.py')\n", (279, 320), False, 'import os\n'), ((391, ... |
from unittest import TestCase
import pandas as pd
from fireant.slicer.widgets import CSV
from fireant.tests.slicer.mocks import (
CumSum,
ElectionOverElection,
cat_dim_df,
cont_cat_dim_df,
cont_dim_df,
cont_dim_operation_df,
cont_uni_dim_df,
cont_uni_dim_ref_df,
multi_metric_df,
... | [
"fireant.tests.slicer.mocks.cont_cat_dim_df.copy",
"fireant.tests.slicer.mocks.cat_dim_df.copy",
"fireant.tests.slicer.mocks.cont_uni_dim_df.copy",
"fireant.utils.format_dimension_key",
"fireant.tests.slicer.mocks.cont_dim_operation_df.copy",
"fireant.utils.format_metric_key",
"fireant.tests.slicer.mock... | [((2455, 2520), 'pandas.Index', 'pd.Index', (["['Democrat', 'Independent', 'Republican']"], {'name': '"""Party"""'}), "(['Democrat', 'Independent', 'Republican'], name='Party')\n", (2463, 2520), True, 'import pandas as pd\n'), ((3156, 3194), 'copy.copy', 'copy.copy', (['slicer.dimensions.candidate'], {}), '(slicer.dime... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.5.0
# kernelspec:
# display_name: Python [conda env:PROJ_irox_oer] *
# language: python
# name: conda-env-PROJ... | [
"os.path.exists",
"pickle.dump",
"os.makedirs",
"os.environ.get",
"os.path.join",
"os.getcwd",
"methods.isnotebook",
"local_methods.get_job_paths_info",
"pandas.DataFrame",
"os.system",
"time.time",
"misc_modules.pandas_methods.reorder_df_columns",
"os.walk"
] | [((807, 818), 'time.time', 'time.time', ([], {}), '()\n', (816, 818), False, 'import time\n'), ((1302, 1314), 'methods.isnotebook', 'isnotebook', ([], {}), '()\n', (1312, 1314), False, 'from methods import isnotebook\n'), ((1453, 1485), 'os.environ.get', 'os.environ.get', (['"""COMPENV"""', '"""wsl"""'], {}), "('COMPEN... |
from rest_framework import status
from rest_framework.reverse import reverse
from resource_tracker.models import ResourceGroupTextAttributeDefinition
from tests.test_resource_tracker.test_api.base_test_api import BaseTestAPI
class TestTextAttributeDefinitionDelete(BaseTestAPI):
def setUp(self):
super(Te... | [
"resource_tracker.models.ResourceGroupTextAttributeDefinition.objects.filter",
"rest_framework.reverse.reverse"
] | [((458, 603), 'rest_framework.reverse.reverse', 'reverse', (['"""api_text_attribute_definition_retrieve_update_delete"""'], {'args': '[self.rg_physical_servers.id, self.rg_physical_servers_description.id]'}), "('api_text_attribute_definition_retrieve_update_delete', args=[self.\n rg_physical_servers.id, self.rg_phys... |
# Generated by Django 2.2.1 on 2019-08-02 13:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='User',
fields=[
... | [
"django.db.models.OneToOneField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((333, 426), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (349, 426), False, 'from django.db import migrations, models\... |
import unittest
from fluentcheck.classes import Check
from fluentcheck.exceptions import CheckError
class TestSequencesAssertions(unittest.TestCase):
def test_is_empty(self):
res = Check('').is_empty()
self.assertIsInstance(res, Check)
res2 = Check([]).is_empty()
self.assertIsInsta... | [
"fluentcheck.classes.Check"
] | [((195, 204), 'fluentcheck.classes.Check', 'Check', (['""""""'], {}), "('')\n", (200, 204), False, 'from fluentcheck.classes import Check\n'), ((273, 282), 'fluentcheck.classes.Check', 'Check', (['[]'], {}), '([])\n', (278, 282), False, 'from fluentcheck.classes import Check\n'), ((352, 361), 'fluentcheck.classes.Check... |
# -*- coding: utf-8 -*-
from addons.base import generic_views
from addons.figshare.serializer import FigshareSerializer
from website.project.decorators import (
must_have_addon, must_be_addon_authorizer,
)
SHORT_NAME = 'figshare'
FULL_NAME = SHORT_NAME
figshare_account_list = generic_views.account_list(
SH... | [
"addons.base.generic_views.import_auth",
"addons.base.generic_views.get_config",
"website.project.decorators.must_have_addon",
"addons.base.generic_views.set_config",
"addons.base.generic_views.deauthorize_node",
"addons.base.generic_views.account_list",
"website.project.decorators.must_be_addon_authori... | [((286, 344), 'addons.base.generic_views.account_list', 'generic_views.account_list', (['SHORT_NAME', 'FigshareSerializer'], {}), '(SHORT_NAME, FigshareSerializer)\n', (312, 344), False, 'from addons.base import generic_views\n'), ((379, 436), 'addons.base.generic_views.import_auth', 'generic_views.import_auth', (['SHO... |
from bson import ObjectId
from utils.exceptions import InvalidIdError
def validate_id(id_to_check, name):
if not ObjectId.is_valid(id_to_check):
raise InvalidIdError("{} is not valid".format(name))
def stringify_id(item):
item_id = str(item['_id'])
del item['_id']
item['id'] = item_id
def... | [
"bson.ObjectId.is_valid"
] | [((120, 150), 'bson.ObjectId.is_valid', 'ObjectId.is_valid', (['id_to_check'], {}), '(id_to_check)\n', (137, 150), False, 'from bson import ObjectId\n')] |
from typing import Tuple
import numpy as np
from keras import Input, Model
from keras.callbacks import History
from keras.engine.saving import load_model
from keras.layers import Dense, regularizers, Dropout, BatchNormalization
from keras.optimizers import Optimizer
class MLP:
def __init__(self, input_size: Tupl... | [
"keras.Model",
"keras.Input",
"numpy.empty",
"keras.layers.Dense",
"keras.engine.saving.load_model",
"keras.layers.BatchNormalization",
"keras.layers.Dropout",
"keras.layers.regularizers.l1_l2"
] | [((730, 753), 'keras.Input', 'Input', ([], {'shape': 'input_size'}), '(shape=input_size)\n', (735, 753), False, 'from keras import Input, Model\n'), ((1382, 1423), 'keras.Model', 'Model', ([], {'inputs': 'inputs', 'outputs': 'predictions'}), '(inputs=inputs, outputs=predictions)\n', (1387, 1423), False, 'from keras imp... |
"""Mask the area outside of the input shapes with no data."""
import logging
import warnings
import rasterio
from rasterio.features import geometry_mask
logger = logging.getLogger(__name__)
def mask(raster, shapes, nodata=None, crop=False, all_touched=False,
invert=False, pad=False):
"""Mask the area... | [
"logging.getLogger",
"rasterio.features.bounds",
"rasterio.coords.disjoint_bounds",
"warnings.warn",
"rasterio.features.geometry_mask"
] | [((166, 193), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (183, 193), False, 'import logging\n'), ((2975, 3034), 'rasterio.coords.disjoint_bounds', 'rasterio.coords.disjoint_bounds', (['source_bounds', 'mask_bounds'], {}), '(source_bounds, mask_bounds)\n', (3006, 3034), False, 'import ... |
from tensorflow import keras
from tqdm import tqdm
import os
import matplotlib.pyplot as plt
import cv2
from skimage.color import rgb2gray, gray2rgb, rgb2lab, lab2rgb
import numpy as np
from inception_embeddings import inception_embedding
import json
with open('parameters.json') as f:
data = json.load... | [
"skimage.color.rgb2gray",
"os.listdir",
"skimage.color.rgb2lab",
"cv2.imread",
"skimage.color.lab2rgb",
"inception_embeddings.inception_embedding",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"tensorflow.keras.models.load_model",
"matplotlib.pyplot.tight_layout",
"cv2.cvtColor",
... | [((368, 401), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['filepath'], {}), '(filepath)\n', (391, 401), False, 'from tensorflow import keras\n'), ((793, 816), 'inception_embeddings.inception_embedding', 'inception_embedding', (['im'], {}), '(im)\n', (812, 816), False, 'from inception_embeddings i... |
import collections
import jax.numpy as np
from chex import Array, dataclass
RotParams = collections.namedtuple("Params", ["rotation"])
@dataclass
class RotationParams:
rotation: Array
def InitPCARotation():
# create marginal functions
# TODO a bin initialization function
def init_func(inputs):
... | [
"collections.namedtuple",
"jax.numpy.linalg.svd",
"jax.numpy.ones_like",
"jax.numpy.zeros_like",
"jax.numpy.dot",
"jax.numpy.mean"
] | [((90, 136), 'collections.namedtuple', 'collections.namedtuple', (['"""Params"""', "['rotation']"], {}), "('Params', ['rotation'])\n", (112, 136), False, 'import collections\n'), ((958, 982), 'jax.numpy.dot', 'np.dot', (['inputs', 'rotation'], {}), '(inputs, rotation)\n', (964, 982), True, 'import jax.numpy as np\n'), ... |
#!flask/bin/python
from flask import Flask, request, jsonify
app = Flask(__name__)
from sklearn.externals import joblib
pipeline = joblib.load('models/pipeline.pickle')
targets = joblib.load('models/targets.pickle')
def predict(text):
idx = pipeline.predict([text])[0]
return targets[idx]
@app.route('/')
def... | [
"flask.jsonify",
"flask.request.args.get",
"sklearn.externals.joblib.load",
"flask.Flask"
] | [((68, 83), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (73, 83), False, 'from flask import Flask, request, jsonify\n'), ((133, 170), 'sklearn.externals.joblib.load', 'joblib.load', (['"""models/pipeline.pickle"""'], {}), "('models/pipeline.pickle')\n", (144, 170), False, 'from sklearn.externals import ... |
"""Регистрация в админке."""
from django.contrib import admin
from django.db import models
from .models import Device
class RadiusListFilter(admin.SimpleListFilter):
"""Фильтр для радиуса зны покрытия с шагом 100 м."""
title = "Радиус больше чем"
parameter_name = "radius__gt"
def lookups(self, requ... | [
"django.contrib.admin.register",
"django.db.models.Max"
] | [((1054, 1076), 'django.contrib.admin.register', 'admin.register', (['Device'], {}), '(Device)\n', (1068, 1076), False, 'from django.contrib import admin\n'), ((460, 480), 'django.db.models.Max', 'models.Max', (['"""radius"""'], {}), "('radius')\n", (470, 480), False, 'from django.db import models\n')] |
import mock
import yaml
from boto3.session import Session
from botocore.exceptions import ClientError
from botocore.exceptions import NoCredentialsError
from botocore.exceptions import NoRegionError
from botocore.exceptions import EndpointConnectionError
from st2tests.base import BaseSensorTestCase
from sqs_sensor im... | [
"botocore.exceptions.EndpointConnectionError",
"botocore.exceptions.NoRegionError",
"mock.Mock",
"botocore.exceptions.NoCredentialsError",
"botocore.exceptions.ClientError",
"mock.MagicMock"
] | [((6910, 6921), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (6919, 6921), False, 'import mock\n'), ((892, 983), 'botocore.exceptions.ClientError', 'ClientError', (["{'Error': {'Code': 'AWS.SimpleQueueService.NonExistentQueue'}}", '"""sqs_test"""'], {}), "({'Error': {'Code': 'AWS.SimpleQueueService.NonExistentQueue'}},\... |
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import binascii
import numpy as np
import random
import argparse
import time
from lxml import etree
from lm_scorer import LMScorer
from utils import _load_config, _remove_outliner
from pdfalto.alto_parser import filter_text
from pdfalto.wrapper import PdfAltoWrapper
... | [
"utils._load_config",
"pdfalto.wrapper.PdfAltoWrapper",
"numpy.array",
"xgboost.Booster",
"lxml.etree.fromstring",
"xgboost.DMatrix",
"logging.info",
"logging.error",
"lxml.etree.tostring",
"os.remove",
"numpy.mean",
"os.listdir",
"argparse.ArgumentParser",
"numpy.max",
"pdfalto.alto_par... | [((420, 497), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""client.log"""', 'filemode': '"""w"""', 'level': 'logging.DEBUG'}), "(filename='client.log', filemode='w', level=logging.DEBUG)\n", (439, 497), False, 'import logging\n'), ((14206, 14337), 'argparse.ArgumentParser', 'argparse.ArgumentParse... |
import os
import tqdm
import logging
import torch
import torch.nn as nn
from torch import optim
from torch.utils.data import DataLoader, TensorDataset
from transformers import BertTokenizer
from agents.utils import Statistics
from agents.optim_schedule import ScheduledOptim
from .soft_masked_bert import SoftMaskedBer... | [
"logging.getLogger",
"torch.optim.Adam",
"os.path.exists",
"agents.optim_schedule.ScheduledOptim",
"torch.load",
"transformers.BertTokenizer.from_pretrained",
"agents.optim_schedule.ScheduledOptim.add_cmdline_args",
"torch.utils.data.TensorDataset",
"torch.nn.BCELoss",
"torch.round",
"torch.nn.N... | [((448, 475), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (465, 475), False, 'import logging\n'), ((9679, 9741), 'torch.optim.Adam', 'optim.Adam', (['optimizer_grouped_parameters'], {'lr': 'opt.learning_rate'}), '(optimizer_grouped_parameters, lr=opt.learning_rate)\n', (9689, 9741), Fa... |
# Copyright 2018 <NAME> <<EMAIL>>. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"pyaff4.utils.SmartStr",
"ctypes.CDLL",
"ctypes.get_errno",
"platform.machine",
"os.strerror",
"ctypes.sizeof"
] | [((3209, 3227), 'platform.machine', 'platform.machine', ([], {}), '()\n', (3225, 3227), False, 'import platform\n'), ((3377, 3410), 'ctypes.CDLL', 'ctypes.CDLL', (['None'], {'use_errno': '(True)'}), '(None, use_errno=True)\n', (3388, 3410), False, 'import ctypes\n'), ((3279, 3299), 'pyaff4.utils.SmartStr', 'utils.Smart... |
import traceback
import boto3
class RetrieveCurationDetailsException(Exception):
pass
def get_code_commit_file(repo, filePath):
client = boto3.client('codecommit')
response = client.get_file(
repositoryName=repo,
filePath=filePath
)
return response
def lambda_handler(event, co... | [
"boto3.resource",
"traceback.print_exc",
"boto3.client"
] | [((150, 176), 'boto3.client', 'boto3.client', (['"""codecommit"""'], {}), "('codecommit')\n", (162, 176), False, 'import boto3\n'), ((2142, 2168), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (2156, 2168), False, 'import boto3\n'), ((1028, 1049), 'traceback.print_exc', 'traceback.prin... |
import unittest
import os
from thunderbolt.client.local_directory_client import LocalDirectoryClient
class TestLocalDirectoryClient(unittest.TestCase):
def setUp(self):
self.client = LocalDirectoryClient('.', None, None, use_cache=False)
def test_to_absolute_path(self):
source = './hoge/hoge/... | [
"os.path.abspath",
"thunderbolt.client.local_directory_client.LocalDirectoryClient"
] | [((197, 251), 'thunderbolt.client.local_directory_client.LocalDirectoryClient', 'LocalDirectoryClient', (['"""."""', 'None', 'None'], {'use_cache': '(False)'}), "('.', None, None, use_cache=False)\n", (217, 251), False, 'from thunderbolt.client.local_directory_client import LocalDirectoryClient\n'), ((396, 422), 'os.pa... |
# ----------------------------------------------------------------------------------------------
# CoFormer Official Code
# Copyright (c) <NAME>. All Rights Reserved
# Licensed under the Apache License 2.0 [see LICENSE for details]
# -------------------------------------------------------------------------------------... | [
"cv2.rectangle",
"nltk.download",
"torch.from_numpy",
"util.misc.get_sha",
"numpy.array",
"argparse.ArgumentParser",
"pathlib.Path",
"models.build_model",
"numpy.random.seed",
"util.misc.init_distributed_mode",
"torch.topk",
"re.match",
"cv2.putText",
"util.misc.nested_tensor_from_tensor_l... | [((1315, 1337), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (1325, 1337), False, 'import cv2\n'), ((3134, 3169), 'numpy.array', 'np.array', (['[[[0.485, 0.456, 0.406]]]'], {}), '([[[0.485, 0.456, 0.406]]])\n', (3142, 3169), True, 'import numpy as np\n'), ((3180, 3215), 'numpy.array', 'np.array',... |
# -------------------------------------------------------
# CSCI 561, Spring 2021
# Homework 1
# The Oregon Trail
# Author: <NAME>
# This creates a Node class,
# representing the node in search space
# -------------------------------------------------------
import numpy as np
class Node:
def __init__(self, xy, h)... | [
"numpy.array2string"
] | [((614, 661), 'numpy.array2string', 'np.array2string', (['xy'], {'precision': '(0)', 'separator': '""","""'}), "(xy, precision=0, separator=',')\n", (629, 661), True, 'import numpy as np\n')] |
# Copyright (c) 2018, ZIH,
# Technische Universitaet Dresden,
# Federal Republic of Germany
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain t... | [
"metricq.rpc.rpc_handler"
] | [((1771, 1790), 'metricq.rpc.rpc_handler', 'rpc_handler', (['"""test"""'], {}), "('test')\n", (1782, 1790), False, 'from metricq.rpc import RPCBase, rpc_handler\n'), ((1851, 1871), 'metricq.rpc.rpc_handler', 'rpc_handler', (['"""toast"""'], {}), "('toast')\n", (1862, 1871), False, 'from metricq.rpc import RPCBase, rpc_... |
"""
Internal tools needed to query the index based on rectangles
and position/radius. Based on tools in argodata:
https://github.com/ArgoCanada/argodata/blob/master/R/utils.R#L54-L165
"""
import warnings
import numpy as np
def geodist_rad(long1, lat1, long2, lat2, R=6371.010):
delta_long = long2 - long1
delt... | [
"numpy.sqrt",
"numpy.minimum",
"numpy.sin",
"warnings.catch_warnings",
"numpy.asarray",
"numpy.asfarray",
"numpy.cos",
"warnings.simplefilter",
"numpy.maximum",
"numpy.isinf"
] | [((760, 794), 'numpy.maximum', 'np.maximum', (["r1['xmin']", "r2['xmin']"], {}), "(r1['xmin'], r2['xmin'])\n", (770, 794), True, 'import numpy as np\n'), ((812, 846), 'numpy.minimum', 'np.minimum', (["r1['xmax']", "r2['xmax']"], {}), "(r1['xmax'], r2['xmax'])\n", (822, 846), True, 'import numpy as np\n'), ((864, 898), ... |
import urllib.request, json
from .models import Source, Article
api_key = None
source_base_url = None
articles_base_url = None
def configure_request(app):
global api_key, source_base_url, articles_base_url
api_key = app.config['API_KEY']
source_base_url = app.config["SOURCE_API_BASE_URL"]
arti... | [
"json.loads"
] | [((585, 613), 'json.loads', 'json.loads', (['get_sources_data'], {}), '(get_sources_data)\n', (595, 613), False, 'import urllib.request, json\n'), ((1721, 1750), 'json.loads', 'json.loads', (['get_articles_data'], {}), '(get_articles_data)\n', (1731, 1750), False, 'import urllib.request, json\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from datetime import datetime
from pathlib import Path
from typing import List
from unittest import mock
from unittest.mock import MagicMock
import pandas as pd
import pytest
import pytz
from prefect import Flow
from cdp_backend.database import functions as db_... | [
"datetime.datetime",
"pytz.timezone",
"cdp_backend.pipeline.event_index_pipeline.get_highest_confidence_transcript_for_each_session.run",
"pandas.read_parquet",
"cdp_backend.database.models.Transcript",
"cdp_backend.database.models.Session.Example",
"cdp_backend.database.functions.generate_and_attach_do... | [((1086, 1131), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n_grams"""', '[1, 2, 3]'], {}), "('n_grams', [1, 2, 3])\n", (1109, 1131), False, 'import pytest\n'), ((1133, 1186), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""store_local"""', '[True, False]'], {}), "('store_local', [True, Fals... |
import json
import serial
import socket
import sys
# Error checking around the existance and proper format of options.json is
# intentionally not implemented since the user will have no way to fix the
# issue (it is a developer issue). A python exception printed out in the log
# is the most useful thing for them to pu... | [
"json.load",
"serial.Serial",
"socket.socket",
"sys.exit"
] | [((391, 414), 'json.load', 'json.load', (['options_file'], {}), '(options_file)\n', (400, 414), False, 'import json\n'), ((968, 1016), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (981, 1016), False, 'import socket\n'), ((523, 555), 'serial.Se... |
import socket
import threading
import cv2 as cv
class Tello:
"""
Handles connection to the DJI Tello drone
"""
def __init__(self, local_ip, local_port, is_dummy=False, tello_ip='192.168.10.1', tello_port=8889):
"""
Initializes connection with Tello and sends both command a... | [
"threading.Timer",
"cv2.VideoCapture",
"socket.socket",
"threading.Thread"
] | [((2329, 2370), 'threading.Timer', 'threading.Timer', (['(0.5)', 'self.set_abort_flag'], {}), '(0.5, self.set_abort_flag)\n', (2344, 2370), False, 'import threading\n'), ((8206, 8230), 'cv2.VideoCapture', 'cv.VideoCapture', (['address'], {}), '(address)\n', (8221, 8230), True, 'import cv2 as cv\n'), ((615, 663), 'socke... |
# Rest libraries
from flask import json, request, Response
from app.apis.namespaces import api_ns_geomodels
from flask_restx import Resource
from marshmallow import ValidationError
from marshmallow_jsonschema import JSONSchema
# Additional libraries
# Importing modules
from .schemas import ModelsSchema, ModelSchemeDe... | [
"app.apis.namespaces.api_ns_geomodels.route",
"app.apis.namespaces.api_ns_geomodels.doc",
"flask.request.get_json",
"marshmallow_jsonschema.JSONSchema",
"flask.request.values.to_dict"
] | [((1130, 1157), 'app.apis.namespaces.api_ns_geomodels.route', 'api_ns_geomodels.route', (['"""/"""'], {}), "('/')\n", (1152, 1157), False, 'from app.apis.namespaces import api_ns_geomodels\n'), ((2272, 2319), 'app.apis.namespaces.api_ns_geomodels.route', 'api_ns_geomodels.route', (['"""/<string:geoModelUrn>"""'], {}), ... |
from utils.library import files
config = files.get_yaml("config.yaml")
class HotsException(Exception):
"""Базовый класс для других исключений"""
def __init__(self, *args):
if args:
self.message = args[0]
else:
self.message = None
def __str__(self):
if sel... | [
"utils.library.files.get_yaml"
] | [((42, 71), 'utils.library.files.get_yaml', 'files.get_yaml', (['"""config.yaml"""'], {}), "('config.yaml')\n", (56, 71), False, 'from utils.library import files\n')] |
# -*- coding: UTF-8 -*-
# Copyright©2020 <EMAIL> All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | [
"bs4.BeautifulSoup",
"doctest.testmod"
] | [((2239, 2256), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (2254, 2256), False, 'import doctest\n'), ((1480, 1507), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""lxml"""'], {}), "(html, 'lxml')\n", (1493, 1507), False, 'from bs4 import BeautifulSoup\n')] |
r"""
Manifold Subsets Defined as Pullbacks of Subsets under Continuous Maps
"""
# ****************************************************************************
# Copyright (C) 2021 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | [
"sage.categories.metric_spaces.MetricSpaces",
"sage.categories.sets_cat.Sets",
"sage.modules.free_module_element.vector",
"sage.misc.latex.latex",
"sage.modules.free_module.is_FreeModule",
"sage.manifolds.subset.ManifoldSubset.__init__"
] | [((17422, 17438), 'sage.modules.free_module_element.vector', 'vector', (['SR', 'expr'], {}), '(SR, expr)\n', (17428, 17438), False, 'from sage.modules.free_module_element import vector\n'), ((22556, 22629), 'sage.manifolds.subset.ManifoldSubset.__init__', 'ManifoldSubset.__init__', (['self', 'base_manifold', 'name'], {... |
import functools
from btypes.big_endian import *
import gx
from j3d.material import *
import j3d.string_table
import logging
logger = logging.getLogger(__name__)
index8 = NoneableConverter(uint8,0xFF)
index16 = NoneableConverter(uint16,0xFFFF)
class Header(Struct):
magic = ByteString(4)
section_size = uint3... | [
"logging.getLogger",
"functools.wraps",
"functools.partial",
"gx.ConstantColor",
"gx.ConstantAlpha"
] | [((135, 162), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (152, 162), False, 'import logging\n'), ((12213, 12243), 'functools.wraps', 'functools.wraps', (['load_function'], {}), '(load_function)\n', (12228, 12243), False, 'import functools\n'), ((12539, 12571), 'functools.wraps', 'func... |
from itertools import chain
from uuid import uuid4
from django.db.models.signals import post_save, pre_save
from main import models as edd_models
from . import models
def campaign_check(sender, instance, raw, using, **kwargs):
# make sure there is a UUID set
if instance.uuid is None:
instance.uuid ... | [
"main.models.Update.load_update",
"django.db.models.signals.post_save.connect",
"django.db.models.signals.pre_save.connect",
"uuid.uuid4"
] | [((926, 1005), 'django.db.models.signals.pre_save.connect', 'pre_save.connect', (['campaign_check'], {'sender': 'models.Campaign', 'dispatch_uid': 'dispatch'}), '(campaign_check, sender=models.Campaign, dispatch_uid=dispatch)\n', (942, 1005), False, 'from django.db.models.signals import post_save, pre_save\n'), ((1318,... |
# -*- coding: utf-8 -*-
import os
import gzip
import tarfile
import numpy as np
from urllib.request import urlopen
from urllib.error import HTTPError, URLError
from astropy import wcs
from astropy.coordinates import SkyCoord
from pymoc import MOC
from pymoc.io.fits import read_moc_fits
def downloadFile(url, dest_... | [
"tarfile.open",
"pymoc.MOC",
"gzip.open",
"os.path.join",
"astropy.coordinates.SkyCoord",
"urllib.request.urlopen",
"os.path.isfile",
"numpy.array",
"os.path.basename",
"astropy.wcs.WCS",
"os.remove"
] | [((976, 1000), 'tarfile.open', 'tarfile.open', (['input_file'], {}), '(input_file)\n', (988, 1000), False, 'import tarfile\n'), ((1209, 1236), 'gzip.open', 'gzip.open', (['input_file', '"""rb"""'], {}), "(input_file, 'rb')\n", (1218, 1236), False, 'import gzip\n'), ((3586, 3602), 'astropy.wcs.WCS', 'wcs.WCS', ([], {'na... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** <NAME>
**Copyright(c):** MakeHuman Team 2001-2019
**Licensing:** AG... | [
"log.warning",
"log.notice",
"getpath.getSysDataPath",
"log.error",
"log.debug",
"numpy.zeros",
"debugdump.dump.appendMessage",
"time.time",
"log.message",
"image.Image"
] | [((1331, 1378), 'getpath.getSysDataPath', 'getSysDataPath', (['"""textures/texture_notfound.png"""'], {}), "('textures/texture_notfound.png')\n", (1345, 1378), False, 'from getpath import getSysDataPath\n'), ((9761, 9798), 'log.message', 'log.message', (['"""Reloading all textures"""'], {}), "('Reloading all textures')... |
from graphene import ObjectType, String, ID
class Group(ObjectType):
id = ID()
name = String()
category_id = String()
@staticmethod
def resolve_id(group, info):
return group.get('id')
@staticmethod
def resolve_name(group, info):
return group.get('name')
@stati... | [
"graphene.String",
"graphene.ID"
] | [((79, 83), 'graphene.ID', 'ID', ([], {}), '()\n', (81, 83), False, 'from graphene import ObjectType, String, ID\n'), ((95, 103), 'graphene.String', 'String', ([], {}), '()\n', (101, 103), False, 'from graphene import ObjectType, String, ID\n'), ((122, 130), 'graphene.String', 'String', ([], {}), '()\n', (128, 130), Fa... |
import asyncio
import json
import logging
import re
import secrets
from ipaddress import ip_address, ip_network
from operator import attrgetter
from time import time
from typing import Any, AsyncGenerator, Awaitable, Callable, Dict, List, Literal, Optional, Set
from sentry_sdk import capture_event
from sentry_sdk.util... | [
"logging.getLogger",
"operator.attrgetter",
"json.loads",
"starlette.responses.Response",
"secrets.token_urlsafe",
"starlette.routing.get_name",
"sentry_sdk.capture_event",
"starlette.datastructures.URL",
"time.time",
"sentry_sdk.utils.exc_info_from_error",
"ipaddress.ip_network"
] | [((772, 812), 'logging.getLogger', 'logging.getLogger', (['"""foxglove.middleware"""'], {}), "('foxglove.middleware')\n", (789, 812), False, 'import logging\n'), ((830, 872), 'logging.getLogger', 'logging.getLogger', (['"""foxglove.bad_requests"""'], {}), "('foxglove.bad_requests')\n", (847, 872), False, 'import loggin... |
from django.db import models
from django.contrib.sites.models import Site
# Create your models here.
class Config(models.Model):
site = models.OneToOneField(Site, on_delete=models.PROTECT)
nome = models.CharField('Nome do Site', max_length=255)
telefone = models.CharField('Telefone de Contato', max_length=... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.TimeField",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((141, 193), 'django.db.models.OneToOneField', 'models.OneToOneField', (['Site'], {'on_delete': 'models.PROTECT'}), '(Site, on_delete=models.PROTECT)\n', (161, 193), False, 'from django.db import models\n'), ((205, 253), 'django.db.models.CharField', 'models.CharField', (['"""Nome do Site"""'], {'max_length': '(255)'}... |
from behave import given, when, then
from pages.dashboard import dashboard
@then(u'Dashboard Status shows correct values for row "{row}"')
def step_impl_dashboard_status(context, row):
dashboard.verify_status(row)
@then(u'Clicking on Status Refresh should refresh status component')
def step_impl_status_refresh(... | [
"pages.dashboard.dashboard.verify_refresh",
"pages.dashboard.dashboard.verify_battery_refresh",
"pages.dashboard.dashboard.verify_battery_status",
"pages.dashboard.dashboard.verify_gps_setting",
"pages.dashboard.dashboard.verify_status",
"behave.then",
"pages.dashboard.dashboard.veify_detector_setting"
... | [((78, 140), 'behave.then', 'then', (['u"""Dashboard Status shows correct values for row "{row}\\""""'], {}), '(u\'Dashboard Status shows correct values for row "{row}"\')\n', (82, 140), False, 'from behave import given, when, then\n'), ((223, 290), 'behave.then', 'then', (['u"""Clicking on Status Refresh should refres... |
"""Testing the database function"""
#pylint: disable=w0621
import copy
import json
import pytest
from mediamanager import database
from mediamanager import medium
DEMO = medium.Medium("ID", "FILENAME", json.dumps(["TAG1", "TAG2"]))
DEMO2 = medium.Medium("ID2", "FILENAME2", json.dumps(["TAG1", "TAG2"]))
@pytest.fix... | [
"json.dumps",
"mediamanager.database.Database",
"pytest.raises",
"copy.deepcopy",
"pytest.fixture"
] | [((310, 342), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (324, 342), False, 'import pytest\n'), ((206, 234), 'json.dumps', 'json.dumps', (["['TAG1', 'TAG2']"], {}), "(['TAG1', 'TAG2'])\n", (216, 234), False, 'import json\n'), ((278, 306), 'json.dumps', 'json.dumps', (... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-30 03:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0002_auto_20160326_1912'),
]
operations = [
migrations.AddField(... | [
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((420, 528), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'help_text': '"""Shortname proporcionado por disqus"""', 'max_length': '(1000)', 'null': '(True)'}), "(blank=True, help_text='Shortname proporcionado por disqus',\n max_length=1000, null=True)\n", (436, 528), False, 'from django... |
"""
Driver for CO2 sensor via USB
Intelligent Infrared CO2 Module
(Model: MH-Z19)
"""
import struct
from osgar.node import Node
from osgar.bus import BusShutdownException
class WinsenCO2(Node):
def __init__(self, config, bus):
super().__init__(config, bus)
bus.register('raw', 'co2')
... | [
"struct.unpack_from"
] | [((1224, 1257), 'struct.unpack_from', 'struct.unpack_from', (['""">H"""', 'data', '(2)'], {}), "('>H', data, 2)\n", (1242, 1257), False, 'import struct\n')] |
from dask.distributed import Client
import dask.array as da
import dask_ml
import dask_bigquery
import numpy as np
client = Client("localhost:8786")
x = da.sum(np.ones(5))
x.compute()
| [
"dask.distributed.Client",
"numpy.ones"
] | [((126, 150), 'dask.distributed.Client', 'Client', (['"""localhost:8786"""'], {}), "('localhost:8786')\n", (132, 150), False, 'from dask.distributed import Client\n'), ((163, 173), 'numpy.ones', 'np.ones', (['(5)'], {}), '(5)\n', (170, 173), True, 'import numpy as np\n')] |
from datequarter import DateQuarter
if __name__ == "__main__":
quarter1 = DateQuarter(2019, 1)
quarter2 = DateQuarter(2018, 4)
print(list(DateQuarter.between(quarter1, quarter2)))
| [
"datequarter.DateQuarter",
"datequarter.DateQuarter.between"
] | [((80, 100), 'datequarter.DateQuarter', 'DateQuarter', (['(2019)', '(1)'], {}), '(2019, 1)\n', (91, 100), False, 'from datequarter import DateQuarter\n'), ((116, 136), 'datequarter.DateQuarter', 'DateQuarter', (['(2018)', '(4)'], {}), '(2018, 4)\n', (127, 136), False, 'from datequarter import DateQuarter\n'), ((153, 19... |
from django.conf.urls import url
from home_logs.public import views
urlpatterns = [
url('^$', views.public, name='public'),
url('^lang/(?P<lang>[\w\-]+)/', views.public, name='public_el'),
url('^norights/$', views.no_rights, name='no_rights'),
]
| [
"django.conf.urls.url"
] | [((91, 129), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.public'], {'name': '"""public"""'}), "('^$', views.public, name='public')\n", (94, 129), False, 'from django.conf.urls import url\n'), ((135, 200), 'django.conf.urls.url', 'url', (['"""^lang/(?P<lang>[\\\\w\\\\-]+)/"""', 'views.public'], {'name': '"""publ... |
from flask import jsonify
from pytest_cov.embed import cleanup_on_sigterm
cleanup_on_sigterm()
def configure_routes(app):
@app.route("/")
def hello_world():
return jsonify(
message="Hello World",
)
| [
"pytest_cov.embed.cleanup_on_sigterm",
"flask.jsonify"
] | [((76, 96), 'pytest_cov.embed.cleanup_on_sigterm', 'cleanup_on_sigterm', ([], {}), '()\n', (94, 96), False, 'from pytest_cov.embed import cleanup_on_sigterm\n'), ((184, 214), 'flask.jsonify', 'jsonify', ([], {'message': '"""Hello World"""'}), "(message='Hello World')\n", (191, 214), False, 'from flask import jsonify\n'... |
"""Web socket proxy."""
import asyncio
import collections
import weakref
import aiohttp
from aiohttp import web
from aiohttp import WSMsgType
from being.serialization import dumps
from being.logging import get_logger
class WebSocket:
"""WebSocket connections. Interfaces with aiohttp web socket requests. Can
... | [
"collections.deque",
"weakref.WeakSet",
"being.logging.get_logger",
"asyncio.sleep",
"aiohttp.web.WebSocketResponse"
] | [((647, 664), 'weakref.WeakSet', 'weakref.WeakSet', ([], {}), '()\n', (662, 664), False, 'import weakref\n'), ((686, 715), 'collections.deque', 'collections.deque', ([], {'maxlen': '(100)'}), '(maxlen=100)\n', (703, 715), False, 'import collections\n'), ((738, 761), 'being.logging.get_logger', 'get_logger', (['"""WebSo... |
import uuid
from djongo import models
from node.blockchain.inner_models import Block as PydanticBlock
from node.core.models import CustomModel
class PendingBlock(CustomModel):
_id = models.UUIDField(primary_key=True, default=uuid.uuid4)
number = models.PositiveBigIntegerField()
hash = models.CharField(... | [
"djongo.models.CharField",
"node.blockchain.inner_models.Block.parse_raw",
"djongo.models.UUIDField",
"djongo.models.PositiveBigIntegerField",
"djongo.models.BinaryField"
] | [((191, 245), 'djongo.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4'}), '(primary_key=True, default=uuid.uuid4)\n', (207, 245), False, 'from djongo import models\n'), ((259, 291), 'djongo.models.PositiveBigIntegerField', 'models.PositiveBigIntegerField', ([], {}), '()\n', ... |
from openmdao.api import ExplicitComponent
import numpy as np
import os
import sys
from wisdem.pymap import pyMAP
from wisdem.commonse import gravity, Enum
from wisdem.commonse.utilities import assembleI, unassembleI
Anchor = Enum('DRAGEMBEDMENT SUCTIONPILE')
NLINES_MAX = 15
NPTS_PLOT = 20
class MapMooring(Explic... | [
"numpy.mean",
"numpy.eye",
"numpy.trapz",
"numpy.sqrt",
"wisdem.pymap.pyMAP",
"numpy.array",
"wisdem.commonse.Enum",
"numpy.zeros",
"numpy.linspace",
"numpy.cos",
"numpy.dot",
"numpy.outer",
"numpy.sin",
"numpy.deg2rad",
"numpy.gradient",
"numpy.arange"
] | [((231, 264), 'wisdem.commonse.Enum', 'Enum', (['"""DRAGEMBEDMENT SUCTIONPILE"""'], {}), "('DRAGEMBEDMENT SUCTIONPILE')\n", (235, 264), False, 'from wisdem.commonse import gravity, Enum\n'), ((19924, 19931), 'wisdem.pymap.pyMAP', 'pyMAP', ([], {}), '()\n', (19929, 19931), False, 'from wisdem.pymap import pyMAP\n'), ((2... |
import json
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import csv
import time
import copy
import os
from datetime import datetime
import error_metrics
global gld_num
gld_num = '1'
os.chdir('/home/ankit/PFO-ADC-DER-Testbed/ADC-DER-Testbed/testbed/post_process')
# discard_time = 3600*4
#... | [
"numpy.abs",
"json.loads",
"error_metrics.calculate",
"numpy.sqrt",
"numpy.imag",
"datetime.datetime.strptime",
"numpy.where",
"os.chdir",
"numpy.array",
"numpy.real",
"numpy.sum",
"csv.reader",
"copy.deepcopy",
"numpy.nonzero",
"time.time",
"matplotlib.pyplot.subplots",
"matplotlib.... | [((214, 299), 'os.chdir', 'os.chdir', (['"""/home/ankit/PFO-ADC-DER-Testbed/ADC-DER-Testbed/testbed/post_process"""'], {}), "('/home/ankit/PFO-ADC-DER-Testbed/ADC-DER-Testbed/testbed/post_process'\n )\n", (222, 299), False, 'import os\n'), ((400, 414), 'json.loads', 'json.loads', (['lp'], {}), '(lp)\n', (410, 414), ... |
#!/usr/bin/python3
# -*- encoding: utf-8 -*-
'''
@File : print_with_color.py
@Time : 2021/03/07 12:41:35
@Author : Lynne
@Email : <EMAIL>
@Desc : None
'''
from functools import partial
class FontColor:
BLACK = 30
RED = 31
GREEN = 32
YELLO = 33
BLUE = 34
AMARANTH =... | [
"functools.partial"
] | [((3073, 3202), 'functools.partial', 'partial', (['print_color'], {'font_color': 'FontColor.RED', 'background_color': 'BackgroundColor.NOCOLOR', 'terminal_mode': 'TerminalMode.DEFAULT'}), '(print_color, font_color=FontColor.RED, background_color=\n BackgroundColor.NOCOLOR, terminal_mode=TerminalMode.DEFAULT)\n', (30... |
#!/usr/bin/python
import subprocess
import sys
import json
import os
from nidm.experiment.tools.rest import RestParser
if 'DEBUG' in os.environ and os.environ['DEBUG'] == "1":
directory = '/opt/project/'
else:
directory = './'
#
# To run as a test:
#
# docker run -e "DEBUG=1" -v /home/crowley/coinstac-se... | [
"subprocess.check_output",
"json.loads",
"nidm.experiment.tools.rest.RestParser",
"json.dumps",
"sys.stdin.read"
] | [((888, 906), 'json.loads', 'json.loads', (['in_str'], {}), '(in_str)\n', (898, 906), False, 'import json\n'), ((1185, 1235), 'nidm.experiment.tools.rest.RestParser', 'RestParser', ([], {'output_format': 'RestParser.OBJECT_FORMAT'}), '(output_format=RestParser.OBJECT_FORMAT)\n', (1195, 1235), False, 'from nidm.experime... |
from __future__ import print_function
import sys, os.path as path
sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))
from summarizer.utils.reader import read_csv
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab
import os
import argparse
from sets import S... | [
"matplotlib.pyplot.hist",
"numpy.sqrt",
"numpy.array",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.subplot2grid",
"sets.Set",
"numpy.arange",
"numpy.mean",
"matplotlib.mlab.normpdf",
"os.listdir",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.linspace",
"nu... | [((348, 362), 'matplotlib.use', 'mpl.use', (['"""pgf"""'], {}), "('pgf')\n", (355, 362), True, 'import matplotlib as mpl\n'), ((12684, 12741), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Results Aggregator"""'}), "(description='Results Aggregator')\n", (12707, 12741), False, 'import a... |
import sys, os
import time
import itertools
import cv2
CHARS_str = ".:-=/(?%@"
#CHARS_str = "#%@AED=-:."
LEN_CH = len(CHARS_str)
VAL = (255 // len(CHARS_str))
CHARS = {255:"#",
250:"%",
230:"@",
210:"A",
180:"E",
150:"D",
120:"+",
90:"=",
60:"-"... | [
"itertools.chain",
"os.get_terminal_size",
"cv2.resize",
"cv2.VideoCapture",
"cv2.cvtColor",
"sys.stdout.flush",
"sys.stdout.write"
] | [((389, 411), 'cv2.VideoCapture', 'cv2.VideoCapture', (['path'], {}), '(path)\n', (405, 411), False, 'import cv2\n'), ((509, 548), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2GRAY'], {}), '(frame, cv2.COLOR_BGR2GRAY)\n', (521, 548), False, 'import cv2\n'), ((575, 597), 'os.get_terminal_size', 'os.get_term... |
import unittest
import sys
if sys.version_info[0] < 3:
mock_o = '__builtin__.open'
import mock
else:
mock_o = 'builtins.open'
import unittest.mock as mock
from obdlib.obd.pids import Pids
class TestPids(unittest.TestCase):
def setUp(self):
self.pids = Pids()
def test_set_mode(self):... | [
"unittest.mock.MagicMock",
"obdlib.obd.pids.Pids",
"unittest.mock.patch",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((458, 476), 'unittest.mock.patch', 'mock.patch', (['mock_o'], {}), '(mock_o)\n', (468, 476), True, 'import unittest.mock as mock\n'), ((284, 290), 'obdlib.obd.pids.Pids', 'Pids', ([], {}), '()\n', (288, 290), False, 'from obdlib.obd.pids import Pids\n'), ((531, 564), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], ... |
import os
import io
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = '\n' + f.read()
classifiers = ['Development Status :: 3 - Alpha',
'Operating System :: POSIX :: ... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((88, 113), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (103, 113), False, 'import os\n'), ((128, 159), 'os.path.join', 'os.path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (140, 159), False, 'import os\n'), ((1393, 1408), 'setuptools.find_packages', 'find_packages'... |